1 var __extends = (this && this.__extends) || (function () {
  2     var extendStatics = function (d, b) {
  3         extendStatics = Object.setPrototypeOf ||
  4             ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5             function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6         return extendStatics(d, b);
  7     };
  8     return function (d, b) {
  9         extendStatics(d, b);
 10         function __() { this.constructor = d; }
 11         d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
 12     };
 13 })();
 14 /*
 15  * DO NOT MODIFY: this source code has been automatically generated from Java
 16  *                with JSweet (http://www.jsweet.org)
 17  *
 18  * Sweet Home 3D, Copyright (c) 2024 Space Mushrooms <info@sweethome3d.com>
 19  *
 20  * This program is free software; you can redistribute it and/or modify
 21  * it under the terms of the GNU General Public License as published by
 22  * the Free Software Foundation; either version 2 of the License, or
 23  * (at your option) any later version.
 24  *
 25  * This program is distributed in the hope that it will be useful,
 26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 28  * GNU General Public License for more details.
 29  *
 30  * You should have received a copy of the GNU General Public License
 31  * along with this program; if not, write to the Free Software
 32  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 33  */
 34 /**
 35  * Base class used to write objects to XML.
 36  * @author Emmanuel Puybaret
 37  * @class
 38  */
 39 var ObjectXMLExporter = /** @class */ (function () {
 40     function ObjectXMLExporter() {
 41     }
 42     /**
 43      * Writes in XML the given <code>object</code> in the element returned by the
 44      * {@link #getTag(Object) getTag}, then writes its attributes and children
 45      * calling {@link #writeAttributes(XMLWriter, Object) writeAttributes}
 46      * and {@link #writeChildren(XMLWriter, Object) writeChildren} methods.
 47      * @param {XMLWriter} writer
 48      * @param {Object} object
 49      */
 50     ObjectXMLExporter.prototype.writeElement = function (writer, object) {
 51         writer.writeStartElement(this.getTag(object));
 52         this.writeAttributes(writer, object);
 53         this.writeChildren(writer, object);
 54         writer.writeEndElement();
 55     };
 56     /**
 57      * Returns the element tag matching the object in parameter.
 58      * @return {string} the simple class name of the exported object with its first letter at lower case,
 59      * without <code>Home</code> prefix if it's the case.
 60      * @param {Object} object
 61      */
 62     ObjectXMLExporter.prototype.getTag = function (object) {
 63         var tagName = (function (c) { return typeof c === 'string' ? c.substring(c.lastIndexOf('.') + 1) : c["__class"] ? c["__class"].substring(c["__class"].lastIndexOf('.') + 1) : c["name"].substring(c["name"].lastIndexOf('.') + 1); })(object.constructor);
 64         if ( /* startsWith */(function (str, searchString, position) {
 65             if (position === void 0) { position = 0; }
 66             return str.substr(position, searchString.length) === searchString;
 67         })(tagName, "Home") && !(tagName === ("Home"))) {
 68             tagName = tagName.substring(4);
 69         }
 70         return /* toLowerCase */ tagName.charAt(0).toLowerCase() + tagName.substring(1);
 71     };
 72     /**
 73      * Writes the attributes of the object in parameter.
 74      * @param {XMLWriter} writer
 75      * @param {Object} object
 76      */
 77     ObjectXMLExporter.prototype.writeAttributes = function (writer, object) {
 78     };
 79     /**
 80      * Writes the children of the object in parameter.
 81      * @param {XMLWriter} writer
 82      * @param {Object} object
 83      */
 84     ObjectXMLExporter.prototype.writeChildren = function (writer, object) {
 85     };
 86     return ObjectXMLExporter;
 87 }());
 88 ObjectXMLExporter["__class"] = "com.eteks.sweethome3d.io.ObjectXMLExporter";
 89 /**
 90  * Creates a writer in the given output stream encoded in UTF-8.
 91  * @param {StringWriter} out
 92  * @class
 93  * @extends java.io.FilterWriter
 94  * @author Emmanuel Puybaret
 95  */
 96 var XMLWriter = /** @class */ (function () {
 97     function XMLWriter(out) {
 98         this.elements = ([]);
 99         if (this.emptyElement === undefined) {
100             this.emptyElement = false;
101         }
102         if (this.elementWithText === undefined) {
103             this.elementWithText = false;
104         }
105         this.out = out;
106         this.out.write("<?xml version='1.0'?>\n");
107     }
108     /**
109      * Writes a start tag for the given element.
110      * @param {string} element
111      */
112     XMLWriter.prototype.writeStartElement = function (element) {
113         if ( /* size */this.elements.length > 0) {
114             if (this.emptyElement) {
115                 this.out.write(">");
116             }
117             this.writeIndentation();
118         }
119         this.out.write("<" + element);
120         /* push */ (this.elements.push(element) > 0);
121         this.emptyElement = true;
122         this.elementWithText = false;
123     };
124     /**
125      * Writes an end tag for the given element.
126      */
127     XMLWriter.prototype.writeEndElement = function () {
128         var element = this.elements.pop();
129         if (this.emptyElement) {
130             this.out.write("/>");
131         }
132         else {
133             if (!this.elementWithText) {
134                 this.writeIndentation();
135             }
136             this.out.write("</" + element + ">");
137         }
138         this.emptyElement = false;
139         this.elementWithText = false;
140     };
141     /**
142      * Adds spaces according to the current depth of XML tree.
143      * @private
144      */
145     /*private*/ XMLWriter.prototype.writeIndentation = function () {
146         this.out.write("\n");
147         for (var i = 0; i < /* size */ this.elements.length; i++) {
148             {
149                 this.out.write("  ");
150             }
151             ;
152         }
153     };
154     XMLWriter.prototype.writeAttribute$java_lang_String$java_lang_String = function (name, value) {
155         this.out.write(" " + name + "=\'" + XMLWriter.replaceByEntities(value) + "\'");
156     };
157     XMLWriter.prototype.writeAttribute$java_lang_String$java_lang_String$java_lang_String = function (name, value, defaultValue) {
158         if ((value != null || value !== defaultValue) && !(value === defaultValue)) {
159             this.writeAttribute$java_lang_String$java_lang_String(name, value);
160         }
161     };
162     /**
163      * Writes the name and the value of an attribute in the tag of the last started element,
164      * except if <code>value</code> equals <code>defaultValue</code>.
165      * @param {string} name
166      * @param {string} value
167      * @param {string} defaultValue
168      */
169     XMLWriter.prototype.writeAttribute = function (name, value, defaultValue) {
170         if (((typeof name === 'string') || name === null) && ((typeof value === 'string') || value === null) && ((typeof defaultValue === 'string') || defaultValue === null)) {
171             return this.writeAttribute$java_lang_String$java_lang_String$java_lang_String(name, value, defaultValue);
172         }
173         else if (((typeof name === 'string') || name === null) && ((typeof value === 'string') || value === null) && defaultValue === undefined) {
174             return this.writeAttribute$java_lang_String$java_lang_String(name, value);
175         }
176         else
177             throw new Error('invalid overload');
178     };
179     XMLWriter.prototype.writeIntegerAttribute$java_lang_String$int = function (name, value) {
180         this.writeAttribute$java_lang_String$java_lang_String(name, /* valueOf */ String(value).toString());
181     };
182     XMLWriter.prototype.writeIntegerAttribute$java_lang_String$int$int = function (name, value, defaultValue) {
183         if (value !== defaultValue) {
184             this.writeAttribute$java_lang_String$java_lang_String(name, /* valueOf */ String(value).toString());
185         }
186     };
187     /**
188      * Writes the name and the integer value of an attribute in the tag of the last started element,
189      * except if <code>value</code> equals <code>defaultValue</code>.
190      * @param {string} name
191      * @param {number} value
192      * @param {number} defaultValue
193      */
194     XMLWriter.prototype.writeIntegerAttribute = function (name, value, defaultValue) {
195         if (((typeof name === 'string') || name === null) && ((typeof value === 'number') || value === null) && ((typeof defaultValue === 'number') || defaultValue === null)) {
196             return this.writeIntegerAttribute$java_lang_String$int$int(name, value, defaultValue);
197         }
198         else if (((typeof name === 'string') || name === null) && ((typeof value === 'number') || value === null) && defaultValue === undefined) {
199             return this.writeIntegerAttribute$java_lang_String$int(name, value);
200         }
201         else
202             throw new Error('invalid overload');
203     };
204     XMLWriter.prototype.writeLongAttribute$java_lang_String$long = function (name, value) {
205         this.writeAttribute$java_lang_String$java_lang_String(name, /* valueOf */ String(value).toString());
206     };
207     XMLWriter.prototype.writeLongAttribute$java_lang_String$java_lang_Long = function (name, value) {
208         if (value != null) {
209             this.writeAttribute$java_lang_String$java_lang_String(name, value.toString());
210         }
211     };
212     /**
213      * Writes the name and the long value of an attribute in the tag of the last started element,
214      * except if <code>value</code> equals <code>null</code>.
215      * @param {string} name
216      * @param {number} value
217      */
218     XMLWriter.prototype.writeLongAttribute = function (name, value) {
219         if (((typeof name === 'string') || name === null) && ((typeof value === 'number') || value === null)) {
220             return this.writeLongAttribute$java_lang_String$java_lang_Long(name, value);
221         }
222         else if (((typeof name === 'string') || name === null) && ((typeof value === 'number') || value === null)) {
223             return this.writeLongAttribute$java_lang_String$long(name, value);
224         }
225         else
226             throw new Error('invalid overload');
227     };
228     XMLWriter.prototype.writeFloatAttribute$java_lang_String$float = function (name, value) {
229         this.writeAttribute$java_lang_String$java_lang_String(name, /* valueOf */ String(value).toString());
230     };
231     XMLWriter.prototype.writeFloatAttribute$java_lang_String$float$float = function (name, value, defaultValue) {
232         if (value !== defaultValue) {
233             this.writeFloatAttribute$java_lang_String$float(name, value);
234         }
235     };
236     /**
237      * Writes the name and the float value of an attribute in the tag of the last started element,
238      * except if <code>value</code> equals <code>defaultValue</code>.
239      * @param {string} name
240      * @param {number} value
241      * @param {number} defaultValue
242      */
243     XMLWriter.prototype.writeFloatAttribute = function (name, value, defaultValue) {
244         if (((typeof name === 'string') || name === null) && ((typeof value === 'number') || value === null) && ((typeof defaultValue === 'number') || defaultValue === null)) {
245             return this.writeFloatAttribute$java_lang_String$float$float(name, value, defaultValue);
246         }
247         else if (((typeof name === 'string') || name === null) && ((typeof value === 'number') || value === null) && defaultValue === undefined) {
248             return this.writeFloatAttribute$java_lang_String$java_lang_Float(name, value);
249         }
250         else if (((typeof name === 'string') || name === null) && ((typeof value === 'number') || value === null) && defaultValue === undefined) {
251             return this.writeFloatAttribute$java_lang_String$float(name, value);
252         }
253         else
254             throw new Error('invalid overload');
255     };
256     XMLWriter.prototype.writeFloatAttribute$java_lang_String$java_lang_Float = function (name, value) {
257         if (value != null) {
258             this.writeAttribute$java_lang_String$java_lang_String(name, value.toString());
259         }
260     };
261     /**
262      * Writes the name and the value of an attribute in the tag of the last started element,
263      * except if <code>value</code> equals <code>null</code>.
264      * @param {string} name
265      * @param {Big} value
266      */
267     XMLWriter.prototype.writeBigDecimalAttribute = function (name, value) {
268         if (value != null) {
269             this.writeAttribute$java_lang_String$java_lang_String(name, /* valueOf */ String(value).toString());
270         }
271     };
272     /**
273      * Writes the name and the boolean value of an attribute in the tag of the last started element,
274      * except if <code>value</code> equals <code>defaultValue</code>.
275      * @param {string} name
276      * @param {boolean} value
277      * @param {boolean} defaultValue
278      */
279     XMLWriter.prototype.writeBooleanAttribute = function (name, value, defaultValue) {
280         if (value !== defaultValue) {
281             this.writeAttribute$java_lang_String$java_lang_String(name, /* valueOf */ String(value).toString());
282         }
283     };
284     /**
285      * Writes the name and the color value of an attribute in the tag of the last started element,
286      * except if <code>value</code> equals <code>null</code>. The color is written in hexadecimal.
287      * @param {string} name
288      * @param {number} color
289      */
290     XMLWriter.prototype.writeColorAttribute = function (name, color) {
291         if (color != null) {
292             this.writeAttribute$java_lang_String$java_lang_String(name, CoreTools.format("%08X", color));
293         }
294     };
295     /**
296      * Writes the given <code>text</code> as the content of the current element.
297      * @param {string} text
298      */
299     XMLWriter.prototype.writeText = function (text) {
300         if (this.emptyElement) {
301             this.out.write(">");
302             this.emptyElement = false;
303             this.elementWithText = true;
304         }
305         this.out.write(XMLWriter.replaceByEntities(text));
306     };
307     /**
308      * Returns the string in parameter with &, <, ', " and feed line characters replaced by their matching entities.
309      * @param {string} s
310      * @return {string}
311      * @private
312      */
313     /*private*/ XMLWriter.replaceByEntities = function (s) {
314         return /* replace */ /* replace */ /* replace */ /* replace */ /* replace */ s.split("&").join("&").split("<").join("<").split("\'").join("'").split("\"").join(""").split("\n").join("
");
315     };
316     XMLWriter.prototype.write$int = function (c) {
317         this.writeText(/* valueOf */ String(String.fromCharCode(c)).toString());
318     };
319     XMLWriter.prototype.write$char_A$int$int = function (buffer, offset, length) {
320         this.writeText(buffer.join('').substr(offset, length));
321     };
322     /**
323      * Writes the given characters array as the content of the current element.
324      * @param {char[]} buffer
325      * @param {number} offset
326      * @param {number} length
327      */
328     XMLWriter.prototype.write = function (buffer, offset, length) {
329         if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'string'))) || buffer === null) && ((typeof offset === 'number') || offset === null) && ((typeof length === 'number') || length === null)) {
330             return this.write$char_A$int$int(buffer, offset, length);
331         }
332         else if (((typeof buffer === 'string') || buffer === null) && ((typeof offset === 'number') || offset === null) && ((typeof length === 'number') || length === null)) {
333             return this.write$java_lang_String$int$int(buffer, offset, length);
334         }
335         else if (((typeof buffer === 'number') || buffer === null) && offset === undefined && length === undefined) {
336             return this.write$int(buffer);
337         }
338         else
339             throw new Error('invalid overload');
340     };
341     XMLWriter.prototype.write$java_lang_String$int$int = function (str, offset, length) {
342         this.writeText(str.substring(offset, offset + length));
343     };
344     return XMLWriter;
345 }());
346 XMLWriter["__class"] = "com.eteks.sweethome3d.io.XMLWriter";
347 /**
348  * SAX handler for Sweet Home 3D XML stream. Read home should respect the following DTD:<pre>
349  * <!ELEMENT home (property*, furnitureVisibleProperty*, environment?, backgroundImage?, print?, compass?, (camera | observerCamera)*, level*,
350  * (pieceOfFurniture | doorOrWindow | furnitureGroup | light)*, wall*, room*, polyline*, dimensionLine*, label*)>
351  * <!ATTLIST home
352  * version CDATA #IMPLIED
353  * name CDATA #IMPLIED
354  * camera (observerCamera | topCamera) "topCamera"
355  * selectedLevel CDATA #IMPLIED
356  * wallHeight CDATA #IMPLIED
357  * basePlanLocked (false | true) "false"
358  * furnitureSortedProperty CDATA #IMPLIED
359  * furnitureDescendingSorted (false | true) "false">
360  *
361  * <!ELEMENT property EMPTY>
362  * <!ATTLIST property
363  * name CDATA #REQUIRED
364  * value CDATA #REQUIRED
365  * type (STRING|CONTENT) "STRING">
366  *
367  * <!ELEMENT furnitureVisibleProperty EMPTY>
368  * <!ATTLIST furnitureVisibleProperty name CDATA #REQUIRED>
369  *
370  * <!ELEMENT environment (property*, (camera | observerCamera)*, texture?, texture?) >
371  * <!ATTLIST environment
372  * groundColor CDATA #IMPLIED
373  * backgroundImageVisibleOnGround3D (false | true) "false"
374  * skyColor CDATA #IMPLIED
375  * lightColor CDATA #IMPLIED
376  * wallsAlpha CDATA "0"
377  * allLevelsVisible (false | true) "false"
378  * observerCameraElevationAdjusted (false | true) "true"
379  * ceillingLightColor CDATA #IMPLIED
380  * drawingMode (FILL | OUTLINE | FILL_AND_OUTLINE) "FILL"
381  * subpartSizeUnderLight CDATA "0"
382  * photoWidth CDATA "400"
383  * photoHeight CDATA "300"
384  * 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"
385  * photoQuality CDATA "0"
386  * videoWidth CDATA "320"
387  * videoAspectRatio (RATIO_4_3 | RATIO_16_9 | RATIO_24_10) "RATIO_4_3"
388  * videoQuality CDATA "0"
389  * videoSpeed CDATA #IMPLIED
390  * videoFrameRate CDATA "25">
391  *
392  * <!ELEMENT backgroundImage EMPTY>
393  * <!ATTLIST backgroundImage
394  * image CDATA #REQUIRED
395  * scaleDistance CDATA #REQUIRED
396  * scaleDistanceXStart CDATA #REQUIRED
397  * scaleDistanceYStart CDATA #REQUIRED
398  * scaleDistanceXEnd CDATA #REQUIRED
399  * scaleDistanceYEnd CDATA #REQUIRED
400  * xOrigin CDATA "0"
401  * yOrigin CDATA "0"
402  * visible (false | true) "true">
403  *
404  * <!ELEMENT print (printedLevel*)>
405  * <!ATTLIST print
406  * headerFormat CDATA #IMPLIED
407  * footerFormat CDATA #IMPLIED
408  * planScale CDATA #IMPLIED
409  * furniturePrinted (false | true) "true"
410  * planPrinted (false | true) "true"
411  * view3DPrinted (false | true) "true"
412  * paperWidth CDATA #REQUIRED
413  * paperHeight CDATA #REQUIRED
414  * paperTopMargin CDATA #REQUIRED
415  * paperLeftMargin CDATA #REQUIRED
416  * paperBottomMargin CDATA #REQUIRED
417  * paperRightMargin CDATA #REQUIRED
418  * paperOrientation (PORTRAIT | LANDSCAPE | REVERSE_LANDSCAPE) #REQUIRED>
419  *
420  * <!ELEMENT printedLevel EMPTY>
421  * <!ATTLIST printedLevel level ID #REQUIRED>
422  *
423  * <!ELEMENT compass (property*)>
424  * <!ATTLIST compass
425  * x CDATA #REQUIRED
426  * y CDATA #REQUIRED
427  * diameter CDATA #REQUIRED
428  * northDirection CDATA "0"
429  * longitude CDATA #IMPLIED
430  * latitude CDATA #IMPLIED
431  * timeZone CDATA #IMPLIED
432  * visible (false | true) "true">
433  *
434  * <!ENTITY % cameraCommonAttributes
435  * 'id ID #IMPLIED
436  * name CDATA #IMPLIED
437  * lens (PINHOLE | NORMAL | FISHEYE | SPHERICAL) "PINHOLE"
438  * x CDATA #REQUIRED
439  * y CDATA #REQUIRED
440  * z CDATA #REQUIRED
441  * yaw CDATA #REQUIRED
442  * pitch CDATA #REQUIRED
443  * time CDATA #IMPLIED
444  * fieldOfView CDATA #REQUIRED
445  * renderer CADATA #IMPLIED'>
446  *
447  * <!ELEMENT camera (property*)>
448  * <!ATTLIST camera
449  * %cameraCommonAttributes;
450  * attribute (topCamera | storedCamera | cameraPath) #REQUIRED>
451  *
452  * <!ELEMENT observerCamera (property*)>
453  * <!ATTLIST observerCamera
454  * %cameraCommonAttributes;
455  * attribute (observerCamera | storedCamera | cameraPath) #REQUIRED
456  * fixedSize (false | true) "false">
457  *
458  * <!ELEMENT level (property*, backgroundImage?)>
459  * <!ATTLIST level
460  * id ID #REQUIRED
461  * name CDATA #REQUIRED
462  * elevation CDATA #REQUIRED
463  * floorThickness CDATA #REQUIRED
464  * height CDATA #REQUIRED
465  * elevationIndex CDATA "-1"
466  * visible (false | true) "true"
467  * viewable (false | true) "true">
468  *
469  * <!ENTITY % furnitureCommonAttributes
470  * 'id ID #IMPLIED
471  * name CDATA #REQUIRED
472  * angle CDATA "0"
473  * visible (false | true) "true"
474  * movable (false | true) "true"
475  * description CDATA #IMPLIED
476  * information CDATA #IMPLIED
477  * license CDATA #IMPLIED
478  * creator CDATA #IMPLIED
479  * modelMirrored (false | true) "false"
480  * nameVisible (false | true) "false"
481  * nameAngle CDATA "0"
482  * nameXOffset CDATA "0"
483  * nameYOffset CDATA "0"
484  * price CDATA #IMPLIED'>
485  *
486  * <!ELEMENT furnitureGroup ((pieceOfFurniture | doorOrWindow | furnitureGroup | light)*, property*, textStyle?)>
487  * <!ATTLIST furnitureGroup
488  * %furnitureCommonAttributes;
489  * level IDREF #IMPLIED
490  * x CDATA #IMPLIED
491  * y CDATA #IMPLIED
492  * elevation CDATA #IMPLIED
493  * width CDATA #IMPLIED
494  * depth CDATA #IMPLIED
495  * height CDATA #IMPLIED
496  * dropOnTopElevation CDATA #IMPLIED>
497  *
498  * <!ENTITY % pieceOfFurnitureCommonAttributes
499  * 'level IDREF #IMPLIED
500  * catalogId CDATA #IMPLIED
501  * x CDATA #REQUIRED
502  * y CDATA #REQUIRED
503  * elevation CDATA "0"
504  * width CDATA #REQUIRED
505  * depth CDATA #REQUIRED
506  * height CDATA #REQUIRED
507  * dropOnTopElevation CDATA "1"
508  * model CDATA #IMPLIED
509  * icon CDATA #IMPLIED
510  * planIcon CDATA #IMPLIED
511  * modelRotation CDATA "1 0 0 0 1 0 0 0 1"
512  * modelCenteredAtOrigin CDATA #IMPLIED
513  * backFaceShown (false | true) "false"
514  * modelFlags CDATA #IMPLIED
515  * modelSize CDATA #IMPLIED
516  * doorOrWindow (false | true) "false"
517  * resizable (false | true) "true"
518  * deformable (false | true) "true"
519  * texturable (false | true) "true"
520  * staircaseCutOutShape CDATA #IMPLIED
521  * color CDATA #IMPLIED
522  * shininess CDATA #IMPLIED
523  * valueAddedTaxPercentage CDATA #IMPLIED
524  * currency CDATA #IMPLIED'>
525  *
526  * <!ENTITY % pieceOfFurnitureHorizontalRotationAttributes
527  * 'horizontallyRotatable (false | true) "true"
528  * pitch CDATA "0"
529  * roll CDATA "0"
530  * widthInPlan CDATA #IMPLIED
531  * depthInPlan CDATA #IMPLIED
532  * heightInPlan CDATA #IMPLIED'>
533  *
534  * <!ELEMENT pieceOfFurniture (property*, textStyle?, texture?, material*, transformation*)>
535  * <!ATTLIST pieceOfFurniture
536  * %furnitureCommonAttributes;
537  * %pieceOfFurnitureCommonAttributes;
538  * %pieceOfFurnitureHorizontalRotationAttributes;>
539  *
540  * <!ELEMENT doorOrWindow (sash*, property*, textStyle?, texture?, material*, transformation*)>
541  * <!ATTLIST doorOrWindow
542  * %furnitureCommonAttributes;
543  * %pieceOfFurnitureCommonAttributes;
544  * wallThickness CDATA "1"
545  * wallDistance CDATA "0"
546  * wallWidth CDATA "1"
547  * wallLeft CDATA "0"
548  * wallHeight CDATA "1"
549  * wallTop CDATA "0"
550  * wallCutOutOnBothSides (false | true) "false"
551  * widthDepthDeformable (false | true) "true"
552  * cutOutShape CDATA #IMPLIED
553  * boundToWall (false | true) "true">
554  *
555  * <!ELEMENT sash EMPTY>
556  * <!ATTLIST sash
557  * xAxis CDATA #REQUIRED
558  * yAxis CDATA #REQUIRED
559  * width CDATA #REQUIRED
560  * startAngle CDATA #REQUIRED
561  * endAngle CDATA #REQUIRED>
562  *
563  * <!ELEMENT light (lightSource*, lightSourceMaterial*, property*, textStyle?, texture?, material*, transformation*)>
564  * <!ATTLIST light
565  * %furnitureCommonAttributes;
566  * %pieceOfFurnitureCommonAttributes;
567  * %pieceOfFurnitureHorizontalRotationAttributes;
568  * power CDATA "0.5">
569  *
570  * <!ELEMENT lightSource EMPTY>
571  * <!ATTLIST lightSource
572  * x CDATA #REQUIRED
573  * y CDATA #REQUIRED
574  * z CDATA #REQUIRED
575  * color CDATA #REQUIRED
576  * diameter CDATA #IMPLIED>
577  *
578  * <!ELEMENT lightSourceMaterial EMPTY>
579  * <!ATTLIST lightSourceMaterial
580  * name #REQUIRED>
581  *
582  * <!ELEMENT shelfUnit (shelf*, property*, textStyle?, texture?, material*, transformation*)>
583  * <!ATTLIST shelfUnit
584  * %furnitureCommonAttributes;
585  * %pieceOfFurnitureCommonAttributes;
586  * %pieceOfFurnitureHorizontalRotationAttributes;>
587  *
588  * <!ELEMENT shelf EMPTY>
589  * <!ATTLIST shelf
590  * elevation CDATA #IMPLIED
591  * xLower CDATA #IMPLIED
592  * yLower CDATA #IMPLIED
593  * zLower CDATA #IMPLIED
594  * xUpper CDATA #IMPLIED
595  * yUpper CDATA #IMPLIED
596  * zUpper CDATA #IMPLIED>
597  *
598  * <!ELEMENT textStyle EMPTY>
599  * <!ATTLIST textStyle
600  * attribute (nameStyle | areaStyle | lengthStyle) #IMPLIED
601  * fontName CDATA #IMPLIED
602  * fontSize CDATA #REQUIRED
603  * bold (false | true) "false"
604  * italic (false | true) "false"
605  * alignment (LEFT | CENTER | RIGHT) "CENTER">
606  *
607  * <!ELEMENT texture EMPTY>
608  * <!ATTLIST texture
609  * attribute (groundTexture | skyTexture | leftSideTexture | rightSideTexture | floorTexture | ceilingTexture) #IMPLIED
610  * catalogId CDATA #IMPLIED
611  * name CDATA #REQUIRED
612  * width CDATA #REQUIRED
613  * height CDATA #REQUIRED
614  * xOffset CDATA "0"
615  * yOffset CDATA "0"
616  * angle CDATA "0"
617  * scale CDATA "1"
618  * creator CDATA #IMPLIED
619  * fittingArea (false | true) "false"
620  * leftToRightOriented (true | false) "true"
621  * image CDATA #REQUIRED>
622  *
623  * <!ELEMENT material (texture?)>
624  * <!ATTLIST material
625  * name CDATA #REQUIRED
626  * key CDATA #IMPLIED
627  * color CDATA #IMPLIED
628  * shininess CDATA #IMPLIED>
629  *
630  * <!ELEMENT transformation EMPTY>
631  * <!ATTLIST transformation
632  * name CDATA #REQUIRED
633  * matrix CDATA #REQUIRED>
634  *
635  * <!ELEMENT wall (property*, texture?, texture?, baseboard?, baseboard?)>
636  * <!ATTLIST wall
637  * id ID #REQUIRED
638  * level IDREF #IMPLIED
639  * wallAtStart IDREF #IMPLIED
640  * wallAtEnd IDREF #IMPLIED
641  * xStart CDATA #REQUIRED
642  * yStart CDATA #REQUIRED
643  * xEnd CDATA #REQUIRED
644  * yEnd CDATA #REQUIRED
645  * height CDATA #IMPLIED
646  * heightAtEnd CDATA #IMPLIED
647  * thickness CDATA #REQUIRED
648  * arcExtent CDATA #IMPLIED
649  * pattern CDATA #IMPLIED
650  * topColor CDATA #IMPLIED
651  * leftSideColor CDATA #IMPLIED
652  * leftSideShininess CDATA "0"
653  * rightSideColor CDATA #IMPLIED
654  * rightSideShininess CDATA "0">
655  *
656  * <!ELEMENT baseboard (texture?)>
657  * <!ATTLIST baseboard
658  * attribute (leftSideBaseboard | rightSideBaseboard) #REQUIRED
659  * thickness CDATA #REQUIRED
660  * height CDATA #REQUIRED
661  * color CDATA #IMPLIED>
662  *
663  * <!ELEMENT room (property*, textStyle?, textStyle?, texture?, texture?, point+)>
664  * <!ATTLIST room
665  * id ID #IMPLIED
666  * level IDREF #IMPLIED
667  * name CDATA #IMPLIED
668  * nameAngle CDATA "0"
669  * nameXOffset CDATA "0"
670  * nameYOffset CDATA "-40"
671  * areaVisible (false | true) "false"
672  * areaAngle CDATA "0"
673  * areaXOffset CDATA "0"
674  * areaYOffset CDATA "0"
675  * floorVisible (false | true) "true"
676  * floorColor CDATA #IMPLIED
677  * floorShininess CDATA "0"
678  * ceilingVisible (false | true) "true"
679  * ceilingColor CDATA #IMPLIED
680  * ceilingShininess CDATA "0"
681  * ceilingFlat (false | true) "false">
682  *
683  * <!ELEMENT point EMPTY>
684  * <!ATTLIST point
685  * x CDATA #REQUIRED
686  * y CDATA #REQUIRED>
687  *
688  * <!ELEMENT polyline (property*, point+)>
689  * <!ATTLIST polyline
690  * id ID #IMPLIED
691  * level IDREF #IMPLIED
692  * thickness CDATA "1"
693  * capStyle (BUTT | SQUARE | ROUND) "BUTT"
694  * joinStyle (BEVEL | MITER | ROUND | CURVED) "MITER"
695  * dashStyle (SOLID | DOT | DASH | DASH_DOT | DASH_DOT_DOT | CUSTOMIZED) "SOLID"
696  * dashPattern CDATA #IMPLIED
697  * dashOffset CDATA "0"
698  * startArrowStyle (NONE | DELTA | OPEN | DISC) "NONE"
699  * endArrowStyle (NONE | DELTA | OPEN | DISC) "NONE"
700  * elevation CDATA #IMPLIED
701  * color CDATA #IMPLIED
702  * closedPath (false | true) "false">
703  *
704  * <!ELEMENT dimensionLine (property*, textStyle?)>
705  * <!ATTLIST dimensionLine
706  * id ID #IMPLIED
707  * level IDREF #IMPLIED
708  * xStart CDATA #REQUIRED
709  * yStart CDATA #REQUIRED
710  * elevationStart CDATA "0"
711  * xEnd CDATA #REQUIRED
712  * yEnd CDATA #REQUIRED
713  * elevationEnd CDATA "0"
714  * offset CDATA #REQUIRED
715  * endMarkSize CDATA "10";
716  * angle CDATA "0"
717  * color CDATA #IMPLIED
718  * visibleIn3D (false | true) "false">
719  *
720  * <!ELEMENT label (property*, textStyle?, text)>
721  * <!ATTLIST label
722  * id ID #IMPLIED
723  * level IDREF #IMPLIED
724  * x CDATA #REQUIRED
725  * y CDATA #REQUIRED
726  * angle CDATA "0"
727  * elevation CDATA "0"
728  * pitch CDATA #IMPLIED
729  * color CDATA #IMPLIED
730  * outlineColor CDATA #IMPLIED>
731  *
732  * <!ELEMENT text (#PCDATA)>
733  * </pre>
734  * with <code>home</code> as root element.
735  * Attributes named <code>attribute</code> indicate the names of the object fields
736  * where some elements should be stored.
737  * @author Emmanuel Puybaret
738  * @param {UserPreferences} preferences
739  * @class
740  * @extends DefaultHandler
741  */
742 var HomeXMLHandler = /** @class */ (function (_super) {
743     __extends(HomeXMLHandler, _super);
744     function HomeXMLHandler(preferences) {
745         var _this = this;
746         if (((preferences != null && preferences instanceof UserPreferences) || preferences === null)) {
747             var __args = arguments;
748             _this = _super.call(this) || this;
749             if (_this.preferences === undefined) {
750                 _this.preferences = null;
751             }
752             if (_this.home === undefined) {
753                 _this.home = null;
754             }
755             if (_this.homeElementName === undefined) {
756                 _this.homeElementName = null;
757             }
758             if (_this.labelText === undefined) {
759                 _this.labelText = null;
760             }
761             if (_this.leftSideBaseboard === undefined) {
762                 _this.leftSideBaseboard = null;
763             }
764             if (_this.rightSideBaseboard === undefined) {
765                 _this.rightSideBaseboard = null;
766             }
767             if (_this.homeBackgroundImage === undefined) {
768                 _this.homeBackgroundImage = null;
769             }
770             if (_this.backgroundImage === undefined) {
771                 _this.backgroundImage = null;
772             }
773             if (_this.materialTexture === undefined) {
774                 _this.materialTexture = null;
775             }
776             _this.buffer = { str: "", toString: function () { return this.str; } };
777             _this.elements = ([]);
778             _this.attributes = ([]);
779             _this.groupsFurniture = ([]);
780             _this.properties = ([]);
781             _this.textStyles = ([]);
782             _this.levels = ({});
783             _this.joinedWalls = ({});
784             _this.textures = ({});
785             _this.materials = ([]);
786             _this.transformations = ([]);
787             _this.sashes = ([]);
788             _this.lightSources = ([]);
789             _this.lightSourceMaterialNames = ([]);
790             _this.shelfBoxes = ([]);
791             _this.shelfElevations = ([]);
792             _this.points = ([]);
793             _this.furnitureVisiblePropertyNames = ([]);
794             _this.printedLevelIds = ([]);
795             _this.preferences = preferences != null ? preferences : new DefaultUserPreferences(false, null);
796         }
797         else if (preferences === undefined) {
798             var __args = arguments;
799             {
800                 var __args_1 = arguments;
801                 var preferences_1 = null;
802                 _this = _super.call(this) || this;
803                 if (_this.preferences === undefined) {
804                     _this.preferences = null;
805                 }
806                 if (_this.home === undefined) {
807                     _this.home = null;
808                 }
809                 if (_this.homeElementName === undefined) {
810                     _this.homeElementName = null;
811                 }
812                 if (_this.labelText === undefined) {
813                     _this.labelText = null;
814                 }
815                 if (_this.leftSideBaseboard === undefined) {
816                     _this.leftSideBaseboard = null;
817                 }
818                 if (_this.rightSideBaseboard === undefined) {
819                     _this.rightSideBaseboard = null;
820                 }
821                 if (_this.homeBackgroundImage === undefined) {
822                     _this.homeBackgroundImage = null;
823                 }
824                 if (_this.backgroundImage === undefined) {
825                     _this.backgroundImage = null;
826                 }
827                 if (_this.materialTexture === undefined) {
828                     _this.materialTexture = null;
829                 }
830                 _this.buffer = { str: "", toString: function () { return this.str; } };
831                 _this.elements = ([]);
832                 _this.attributes = ([]);
833                 _this.groupsFurniture = ([]);
834                 _this.properties = ([]);
835                 _this.textStyles = ([]);
836                 _this.levels = ({});
837                 _this.joinedWalls = ({});
838                 _this.textures = ({});
839                 _this.materials = ([]);
840                 _this.transformations = ([]);
841                 _this.sashes = ([]);
842                 _this.lightSources = ([]);
843                 _this.lightSourceMaterialNames = ([]);
844                 _this.shelfBoxes = ([]);
845                 _this.shelfElevations = ([]);
846                 _this.points = ([]);
847                 _this.furnitureVisiblePropertyNames = ([]);
848                 _this.printedLevelIds = ([]);
849                 _this.preferences = preferences_1 != null ? preferences_1 : new DefaultUserPreferences(false, null);
850             }
851             if (_this.preferences === undefined) {
852                 _this.preferences = null;
853             }
854             if (_this.home === undefined) {
855                 _this.home = null;
856             }
857             if (_this.homeElementName === undefined) {
858                 _this.homeElementName = null;
859             }
860             if (_this.labelText === undefined) {
861                 _this.labelText = null;
862             }
863             if (_this.leftSideBaseboard === undefined) {
864                 _this.leftSideBaseboard = null;
865             }
866             if (_this.rightSideBaseboard === undefined) {
867                 _this.rightSideBaseboard = null;
868             }
869             if (_this.homeBackgroundImage === undefined) {
870                 _this.homeBackgroundImage = null;
871             }
872             if (_this.backgroundImage === undefined) {
873                 _this.backgroundImage = null;
874             }
875             if (_this.materialTexture === undefined) {
876                 _this.materialTexture = null;
877             }
878             _this.buffer = { str: "", toString: function () { return this.str; } };
879             _this.elements = ([]);
880             _this.attributes = ([]);
881             _this.groupsFurniture = ([]);
882             _this.properties = ([]);
883             _this.textStyles = ([]);
884             _this.levels = ({});
885             _this.joinedWalls = ({});
886             _this.textures = ({});
887             _this.materials = ([]);
888             _this.transformations = ([]);
889             _this.sashes = ([]);
890             _this.lightSources = ([]);
891             _this.lightSourceMaterialNames = ([]);
892             _this.shelfBoxes = ([]);
893             _this.shelfElevations = ([]);
894             _this.points = ([]);
895             _this.furnitureVisiblePropertyNames = ([]);
896             _this.printedLevelIds = ([]);
897         }
898         else
899             throw new Error('invalid overload');
900         return _this;
901     }
902     /**
903      *
904      */
905     HomeXMLHandler.prototype.startDocument = function () {
906         this.home = null;
907         /* clear */ (this.elements.length = 0);
908         /* clear */ (this.attributes.length = 0);
909         /* clear */ (this.groupsFurniture.length = 0);
910         /* clear */ (function (obj) { for (var member in obj)
911             delete obj[member]; })(this.levels);
912         /* clear */ (function (obj) { for (var member in obj)
913             delete obj[member]; })(this.joinedWalls);
914     };
915     /**
916      *
917      * @param {string} uri
918      * @param {string} localName
919      * @param {string} name
920      * @param {Attributes} attributes
921      */
922     HomeXMLHandler.prototype.startElement = function (uri, localName, name, attributes) {
923         var _this = this;
924         /* setLength */ (function (sb, length) { return sb.str = sb.str.substring(0, length); })(this.buffer, 0);
925         /* push */ (this.elements.push(name) > 0);
926         var attributesMap = ({});
927         for (var i = 0; i < attributes.getLength(); i++) {
928             {
929                 /* put */ (attributesMap[attributes.getQName(i)] = attributes.getValue(i).replace(""", "\"").replace("<", "<").replace(">", ">").replace("&", "&"));
930             }
931             ;
932         }
933         /* push */ (this.attributes.push(attributesMap) > 0);
934         if (!("property" === name) && !("furnitureVisibleProperty" === name) && !("textStyle" === name)) {
935             /* push */ (this.properties.push({}) > 0);
936             /* push */ (this.textStyles.push({}) > 0);
937         }
938         if ("home" === name) {
939             this.setHome(this.createHome(name, attributesMap));
940             /* clear */ (this.furnitureVisiblePropertyNames.length = 0);
941             this.homeBackgroundImage = null;
942         }
943         else if ("environment" === name) {
944             /* clear */ (function (obj) { for (var member in obj)
945                 delete obj[member]; })(this.textures);
946         }
947         else if ("level" === name) {
948             this.backgroundImage = null;
949         }
950         else if (("pieceOfFurniture" === name) || ("doorOrWindow" === name) || ("light" === name) || ("shelfUnit" === name) || ("furnitureGroup" === name)) {
951             /* clear */ (function (obj) { for (var member in obj)
952                 delete obj[member]; })(this.textures);
953             /* clear */ (this.materials.length = 0);
954             /* clear */ (this.transformations.length = 0);
955             /* clear */ (this.sashes.length = 0);
956             /* clear */ (this.lightSources.length = 0);
957             /* clear */ (this.lightSourceMaterialNames.length = 0);
958             /* clear */ (this.shelfBoxes.length = 0);
959             /* clear */ (this.shelfElevations.length = 0);
960             if ("furnitureGroup" === name) {
961                 /* push */ (this.groupsFurniture.push([]) > 0);
962             }
963         }
964         else if ("room" === name) {
965             /* clear */ (function (obj) { for (var member in obj)
966                 delete obj[member]; })(this.textures);
967             /* clear */ (this.points.length = 0);
968         }
969         else if ("polyline" === name) {
970             /* clear */ (this.points.length = 0);
971         }
972         else if ("label" === name) {
973             this.labelText = null;
974         }
975         else if ("wall" === name) {
976             /* clear */ (function (obj) { for (var member in obj)
977                 delete obj[member]; })(this.textures);
978             this.leftSideBaseboard = null;
979             this.rightSideBaseboard = null;
980         }
981         else if ("baseboard" === name) {
982             /* remove */ (function (map) { var deleted = _this.textures[HomeXMLHandler.UNIQUE_ATTRIBUTE]; delete _this.textures[HomeXMLHandler.UNIQUE_ATTRIBUTE]; return deleted; })(this.textures);
983         }
984         else if ("material" === name) {
985             this.materialTexture = null;
986         }
987     };
988     /**
989      *
990      * @param {char[]} ch
991      * @param {number} start
992      * @param {number} length
993      */
994     HomeXMLHandler.prototype.characters = function (ch, start, length) {
995         /* append */ (function (sb) { sb.str += ch.substr(start, length); return sb; })(this.buffer);
996     };
997     /**
998      *
999      * @param {string} uri
1000      * @param {string} localName
1001      * @param {string} name
1002      */
1003     HomeXMLHandler.prototype.endElement = function (uri, localName, name) {
1004         /* pop */ this.elements.pop();
1005         var parent = (this.elements.length == 0) ? null : /* peek */ (function (a) { return a.length == 0 ? null : a[a.length - 1]; })(this.elements);
1006         var attributesMap = this.attributes.pop();
1007         if (this.homeElementName != null && (this.homeElementName === name)) {
1008             this.setHomeAttributes(this.home, name, attributesMap);
1009         }
1010         else if ("furnitureVisibleProperty" === name) {
1011             if ( /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "name") == null) {
1012                 throw new SAXException("Missing name attribute");
1013             }
1014             /* add */ (this.furnitureVisiblePropertyNames.push(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "name")) > 0);
1015         }
1016         else if ("environment" === name) {
1017             this.setEnvironmentAttributes(this.home.getEnvironment(), name, attributesMap);
1018         }
1019         else if ("compass" === name) {
1020             this.setCompassAttributes(this.home.getCompass(), name, attributesMap);
1021         }
1022         else if ("print" === name) {
1023             this.home.setPrint(this.createPrint(attributesMap));
1024         }
1025         else if (("printedLevel" === name) && ("print" === parent)) {
1026             if ( /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "level") == null) {
1027                 throw new SAXException("Missing level attribute");
1028             }
1029             /* add */ (this.printedLevelIds.push(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "level")) > 0);
1030         }
1031         else if ("level" === name) {
1032             var level = this.createLevel(name, attributesMap);
1033             this.setLevelAttributes(level, name, attributesMap);
1034             /* put */ (this.levels[ /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "id")] = level);
1035             this.home.addLevel(level);
1036         }
1037         else if (("camera" === name) || ("observerCamera" === name)) {
1038             var camera = this.createCamera(name, attributesMap);
1039             this.setCameraAttributes(camera, name, attributesMap);
1040             var attribute = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "attribute");
1041             if ("cameraPath" === attribute) {
1042                 var cameraPath = (this.home.getEnvironment().getVideoCameraPath().slice(0));
1043                 /* add */ (cameraPath.push(camera) > 0);
1044                 this.home.getEnvironment().setVideoCameraPath(cameraPath);
1045             }
1046             else if ("topCamera" === attribute) {
1047                 var topCamera = this.home.getTopCamera();
1048                 topCamera.setCamera(camera);
1049                 topCamera.setTime(camera.getTime());
1050                 topCamera.setLens(camera.getLens());
1051             }
1052             else if ("observerCamera" === attribute) {
1053                 var observerCamera = this.home.getObserverCamera();
1054                 observerCamera.setCamera(camera);
1055                 observerCamera.setTime(camera.getTime());
1056                 observerCamera.setLens(camera.getLens());
1057                 observerCamera.setFixedSize(camera.isFixedSize());
1058             }
1059             else if ("storedCamera" === attribute) {
1060                 var storedCameras = (this.home.getStoredCameras().slice(0));
1061                 /* add */ (storedCameras.push(camera) > 0);
1062                 this.home.setStoredCameras(storedCameras);
1063             }
1064         }
1065         else if (("pieceOfFurniture" === name) || ("doorOrWindow" === name) || ("light" === name) || ("shelfUnit" === name) || ("furnitureGroup" === name)) {
1066             var piece = "furnitureGroup" === name ? this.createFurnitureGroup(name, attributesMap, /* pop */ this.groupsFurniture.pop()) : this.createPieceOfFurniture(name, attributesMap);
1067             this.setPieceOfFurnitureAttributes(piece, name, attributesMap);
1068             if (this.homeElementName != null && (this.homeElementName === parent)) {
1069                 this.home.addPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture(piece);
1070                 var levelId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "level");
1071                 if (levelId != null) {
1072                     piece.setLevel(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.levels, levelId));
1073                 }
1074             }
1075             else if ("furnitureGroup" === parent) {
1076                 /* add */ ( /* peek */(function (a) { return a.length == 0 ? null : a[a.length - 1]; })(this.groupsFurniture).push(piece) > 0);
1077             }
1078         }
1079         else if ("wall" === name) {
1080             var wall = this.createWall(name, attributesMap);
1081             /* put */ (this.joinedWalls[ /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "id")] = new HomeXMLHandler.JoinedWall(wall, /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "wallAtStart"), /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "wallAtEnd")));
1082             this.setWallAttributes(wall, name, attributesMap);
1083             this.home.addWall(wall);
1084             var levelId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "level");
1085             if (levelId != null) {
1086                 wall.setLevel(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.levels, levelId));
1087             }
1088         }
1089         else if ("baseboard" === name) {
1090             var baseboard = this.createBaseboard(name, attributesMap);
1091             if ("leftSideBaseboard" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "attribute")) {
1092                 this.leftSideBaseboard = baseboard;
1093             }
1094             else {
1095                 this.rightSideBaseboard = baseboard;
1096             }
1097         }
1098         else if ("room" === name) {
1099             var room = this.createRoom(name, attributesMap, /* toArray */ this.points.slice(0));
1100             this.setRoomAttributes(room, name, attributesMap);
1101             this.home.addRoom$com_eteks_sweethome3d_model_Room(room);
1102             var levelId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "level");
1103             if (levelId != null) {
1104                 room.setLevel(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.levels, levelId));
1105             }
1106         }
1107         else if ("polyline" === name) {
1108             var polyline = this.createPolyline(name, attributesMap, /* toArray */ this.points.slice(0));
1109             this.setPolylineAttributes(polyline, name, attributesMap);
1110             this.home.addPolyline$com_eteks_sweethome3d_model_Polyline(polyline);
1111             var levelId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "level");
1112             if (levelId != null) {
1113                 polyline.setLevel(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.levels, levelId));
1114             }
1115         }
1116         else if ("dimensionLine" === name) {
1117             var dimensionLine = this.createDimensionLine(name, attributesMap);
1118             this.setDimensionLineAttributes(dimensionLine, name, attributesMap);
1119             this.home.addDimensionLine(dimensionLine);
1120             var levelId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "level");
1121             if (levelId != null) {
1122                 dimensionLine.setLevel(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.levels, levelId));
1123             }
1124         }
1125         else if ("label" === name) {
1126             var label = this.createLabel(name, attributesMap, this.labelText);
1127             this.setLabelAttributes(label, name, attributesMap);
1128             this.home.addLabel(label);
1129             var levelId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "level");
1130             if (levelId != null) {
1131                 label.setLevel(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.levels, levelId));
1132             }
1133         }
1134         else if ("text" === name) {
1135             this.labelText = this.getCharacters();
1136         }
1137         else if ("textStyle" === name) {
1138             var attribute = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "attribute");
1139             /* put */ ( /* peek */(function (a) { return a.length == 0 ? null : a[a.length - 1]; })(this.textStyles)[attribute != null ? attribute : HomeXMLHandler.UNIQUE_ATTRIBUTE] = this.createTextStyle(name, attributesMap));
1140         }
1141         else if ("texture" === name) {
1142             if ("material" === parent) {
1143                 this.materialTexture = this.createTexture(name, attributesMap);
1144             }
1145             else {
1146                 var attribute = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "attribute");
1147                 /* put */ (this.textures[attribute != null ? attribute : HomeXMLHandler.UNIQUE_ATTRIBUTE] = this.createTexture(name, attributesMap));
1148             }
1149         }
1150         else if ("material" === name) {
1151             /* add */ (this.materials.push(this.createMaterial(name, attributesMap)) > 0);
1152         }
1153         else if ("transformation" === name) {
1154             var matrixAttribute = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "matrix");
1155             if (matrixAttribute == null) {
1156                 throw new SAXException("Missing attribute matrix");
1157             }
1158             else {
1159                 var values = matrixAttribute.split(/ /);
1160                 if (values.length < 12) {
1161                     throw new SAXException("Missing values for attribute matrix");
1162                 }
1163                 try {
1164                     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])]];
1165                     var transformation = new Transformation(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "name"), matrix);
1166                     /* add */ (this.transformations.push(this.resolveObject(transformation, name, attributesMap)) > 0);
1167                 }
1168                 catch (ex) {
1169                     throw new SAXException("Invalid value for attribute matrix", ex);
1170                 }
1171             }
1172         }
1173         else if ("point" === name) {
1174             /* add */ (this.points.push([this.parseFloat(attributesMap, "x"), this.parseFloat(attributesMap, "y")]) > 0);
1175         }
1176         else if ("sash" === name) {
1177             var sash = new Sash(this.parseFloat(attributesMap, "xAxis"), this.parseFloat(attributesMap, "yAxis"), this.parseFloat(attributesMap, "width"), this.parseFloat(attributesMap, "startAngle"), this.parseFloat(attributesMap, "endAngle"));
1178             /* add */ (this.sashes.push(this.resolveObject(sash, name, attributesMap)) > 0);
1179         }
1180         else if ("lightSource" === name) {
1181             var lightSource = new LightSource(this.parseFloat(attributesMap, "x"), this.parseFloat(attributesMap, "y"), this.parseFloat(attributesMap, "z"), this.parseOptionalColor(attributesMap, "color"), this.parseOptionalFloat(attributesMap, "diameter"));
1182             /* add */ (this.lightSources.push(this.resolveObject(lightSource, name, attributesMap)) > 0);
1183         }
1184         else if ("lightSourceMaterial" === name) {
1185             /* add */ (this.lightSourceMaterialNames.push(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "name")) > 0);
1186         }
1187         else if ("shelf" === name) {
1188             if ( /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "xLower") != null) {
1189                 /* add */ (this.shelfBoxes.push(new BoxBounds(this.parseFloat(attributesMap, "xLower"), this.parseFloat(attributesMap, "yLower"), this.parseFloat(attributesMap, "zLower"), this.parseFloat(attributesMap, "xUpper"), this.parseFloat(attributesMap, "yUpper"), this.parseFloat(attributesMap, "zUpper"))) > 0);
1190             }
1191             else {
1192                 /* add */ (this.shelfElevations.push(this.parseFloat(attributesMap, "elevation")) > 0);
1193             }
1194         }
1195         else if ("backgroundImage" === name) {
1196             var backgroundImage = new BackgroundImage(this.parseContent(name, attributesMap, "image"), this.parseFloat(attributesMap, "scaleDistance"), this.parseFloat(attributesMap, "scaleDistanceXStart"), this.parseFloat(attributesMap, "scaleDistanceYStart"), this.parseFloat(attributesMap, "scaleDistanceXEnd"), this.parseFloat(attributesMap, "scaleDistanceYEnd"), /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "xOrigin") != null ? this.parseFloat(attributesMap, "xOrigin") : 0, /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "yOrigin") != null ? this.parseFloat(attributesMap, "yOrigin") : 0, !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "visible")));
1197             backgroundImage = this.resolveObject(backgroundImage, name, attributesMap);
1198             if (this.homeElementName != null && (this.homeElementName === parent)) {
1199                 this.homeBackgroundImage = backgroundImage;
1200             }
1201             else {
1202                 this.backgroundImage = backgroundImage;
1203             }
1204         }
1205         else if ("property" === name) {
1206             if (this.homeElementName != null) {
1207                 if ( /* Enum.name */ObjectProperty.Type[ObjectProperty.Type.CONTENT] === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "type")) {
1208                     /* put */ ( /* peek */(function (a) { return a.length == 0 ? null : a[a.length - 1]; })(this.properties)[ /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "name")] = this.parseContent(name, attributesMap, "value"));
1209                 }
1210                 else {
1211                     /* put */ ( /* peek */(function (a) { return a.length == 0 ? null : a[a.length - 1]; })(this.properties)[ /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "name")] = /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributesMap, "value"));
1212                 }
1213             }
1214         }
1215         if (!("property" === name) && !("furnitureVisibleProperty" === name) && !("textStyle" === name)) {
1216             /* pop */ this.properties.pop();
1217             /* pop */ this.textStyles.pop();
1218         }
1219     };
1220     /**
1221      * Returns the trimmed string of last element value.
1222      * @return {string}
1223      * @private
1224      */
1225     HomeXMLHandler.prototype.getCharacters = function () {
1226         return this.buffer.str.replace(/"/g, '\"').replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&');
1227     };
1228     /**
1229      *
1230      */
1231     HomeXMLHandler.prototype.endDocument = function () {
1232         var printedLevels = ([]);
1233         for (var index = 0; index < this.printedLevelIds.length; index++) {
1234             var levelId = this.printedLevelIds[index];
1235             {
1236                 {
1237                     var array = this.home.getLevels();
1238                     for (var index1 = 0; index1 < array.length; index1++) {
1239                         var level = array[index1];
1240                         {
1241                             if (levelId === level.getId()) {
1242                                 /* add */ (printedLevels.push(level) > 0);
1243                                 break;
1244                             }
1245                         }
1246                     }
1247                 }
1248             }
1249         }
1250         var print = this.home.getPrint();
1251         if (print != null && !(printedLevels.length == 0) && print.constructor === HomePrint) {
1252             this.home.setPrint(new HomePrint(print.getPaperOrientation(), print.getPaperWidth(), print.getPaperHeight(), print.getPaperTopMargin(), print.getPaperLeftMargin(), print.getPaperBottomMargin(), print.getPaperRightMargin(), print.isFurniturePrinted(), print.isPlanPrinted(), printedLevels, print.isView3DPrinted(), print.getPlanScale(), print.getHeaderFormat(), print.getFooterFormat()));
1253         }
1254         {
1255             var array = /* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(this.joinedWalls);
1256             for (var index = 0; index < array.length; index++) {
1257                 var joinedWall = array[index];
1258                 {
1259                     var wall = joinedWall.getWall();
1260                     if (joinedWall.getWallAtStartId() != null && !(joinedWall.getWallAtStartId() === wall.getId())) {
1261                         var joinedWallAtStart = (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.joinedWalls, joinedWall.getWallAtStartId());
1262                         if (joinedWallAtStart != null) {
1263                             wall.setWallAtStart(joinedWallAtStart.getWall());
1264                         }
1265                     }
1266                     if (joinedWall.getWallAtEndId() != null && !(joinedWall.getWallAtEndId() === wall.getId())) {
1267                         var joinedWallAtEnd = (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.joinedWalls, joinedWall.getWallAtEndId());
1268                         if (joinedWallAtEnd != null) {
1269                             wall.setWallAtEnd(joinedWallAtEnd.getWall());
1270                         }
1271                     }
1272                 }
1273             }
1274         }
1275     };
1276     /**
1277      * Returns the object that will be stored in a home. This method is called for each home object created by this handler
1278      * after its instantiation and returns <code>elementObject</code>. It might be overridden to substitute an object
1279      * parsed from an XML element and its attributes for an other one of a different subclass if needed.
1280      * @param {Object} elementObject
1281      * @param {string} elementName
1282      * @param {Object} attributes
1283      * @return {Object}
1284      */
1285     HomeXMLHandler.prototype.resolveObject = function (elementObject, elementName, attributes) {
1286         return elementObject;
1287     };
1288     /**
1289      * Returns a new {@link Home} instance initialized from the given <code>attributes</code>.
1290      * @return {Home} a home instance with its version set.
1291      * @param {string} elementName
1292      * @param {Object} attributes
1293      * @private
1294      */
1295     HomeXMLHandler.prototype.createHome = function (elementName, attributes) {
1296         var home;
1297         if ( /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "wallHeight") != null) {
1298             home = new Home(this.parseFloat(attributes, "wallHeight"));
1299         }
1300         else {
1301             home = new Home();
1302         }
1303         var version = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "version");
1304         if (version != null) {
1305             try {
1306                 home.setVersion(/* parseInt */ parseInt(version));
1307             }
1308             catch (ex) {
1309                 throw new SAXException("Invalid value for integer attribute version", ex);
1310             }
1311         }
1312         return this.resolveObject(home, elementName, attributes);
1313     };
1314     /**
1315      * Sets the attributes of the given <code>home</code>.
1316      * If needed, this method should be called from {@link #endElement}.
1317      * @param {Home} home
1318      * @param {string} elementName
1319      * @param {Object} attributes
1320      */
1321     HomeXMLHandler.prototype.setHomeAttributes = function (home, elementName, attributes) {
1322         {
1323             var array = /* entrySet */ (function (o) { var s = []; for (var e in o)
1324                 s.push({ k: e, v: o[e], getKey: function () { return this.k; }, getValue: function () { return this.v; } }); return s; })(/* peek */ (function (a) { return a.length == 0 ? null : a[a.length - 1]; })(this.properties));
1325             for (var index = 0; index < array.length; index++) {
1326                 var property = array[index];
1327                 {
1328                     if (typeof property.getValue() === 'string') {
1329                         home.setProperty(property.getKey(), property.getValue());
1330                     }
1331                 }
1332             }
1333         }
1334         if ( /* size */this.furnitureVisiblePropertyNames.length > 0) {
1335             this.home.setFurnitureVisiblePropertyNames(this.furnitureVisiblePropertyNames);
1336         }
1337         this.home.setBackgroundImage(this.homeBackgroundImage);
1338         home.setName(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "name"));
1339         var selectedLevelId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "selectedLevel");
1340         if (selectedLevelId != null) {
1341             this.home.setSelectedLevel(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.levels, selectedLevelId));
1342         }
1343         if ("observerCamera" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "camera")) {
1344             this.home.setCamera(this.home.getObserverCamera());
1345         }
1346         home.setBasePlanLocked("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "basePlanLocked"));
1347         var furnitureSortedPropertyName = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "furnitureSortedProperty");
1348         if (furnitureSortedPropertyName != null) {
1349             try {
1350                 home.setFurnitureSortedPropertyName(furnitureSortedPropertyName);
1351             }
1352             catch (ex) {
1353             }
1354         }
1355         home.setFurnitureDescendingSorted("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "furnitureDescendingSorted"));
1356         if (attributes['structure']) {
1357             home['structure'] = this.parseContent(this.homeElementName, attributes, 'structure');
1358         }
1359     };
1360     /**
1361      * Sets the attributes of the given <code>environment</code>.
1362      * If needed, this method should be called from {@link #endElement}.
1363      * @param {HomeEnvironment} environment
1364      * @param {string} elementName
1365      * @param {Object} attributes
1366      * @private
1367      */
1368     HomeXMLHandler.prototype.setEnvironmentAttributes = function (environment, elementName, attributes) {
1369         this.setProperties(environment, elementName, attributes);
1370         var groundColor = this.parseOptionalColor(attributes, "groundColor");
1371         if (groundColor != null) {
1372             environment.setGroundColor(groundColor);
1373         }
1374         environment.setGroundTexture(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.textures, "groundTexture"));
1375         environment.setBackgroundImageVisibleOnGround3D("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "backgroundImageVisibleOnGround3D"));
1376         var skyColor = this.parseOptionalColor(attributes, "skyColor");
1377         if (skyColor != null) {
1378             environment.setSkyColor(skyColor);
1379         }
1380         environment.setSkyTexture(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.textures, "skyTexture"));
1381         var lightColor = this.parseOptionalColor(attributes, "lightColor");
1382         if (lightColor != null) {
1383             environment.setLightColor(lightColor);
1384         }
1385         var wallsAlpha = this.parseOptionalFloat(attributes, "wallsAlpha");
1386         if (wallsAlpha != null) {
1387             environment.setWallsAlpha(wallsAlpha);
1388         }
1389         environment.setAllLevelsVisible("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "allLevelsVisible"));
1390         environment.setObserverCameraElevationAdjusted(!("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "observerCameraElevationAdjusted")));
1391         var ceillingLightColor = this.parseOptionalColor(attributes, "ceillingLightColor");
1392         if (ceillingLightColor != null) {
1393             environment.setCeillingLightColor(ceillingLightColor);
1394         }
1395         var drawingMode = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "drawingMode");
1396         if (drawingMode != null) {
1397             try {
1398                 environment.setDrawingMode(/* Enum.valueOf */ HomeEnvironment.DrawingMode[drawingMode]);
1399             }
1400             catch (ex) {
1401             }
1402         }
1403         var subpartSizeUnderLight = this.parseOptionalFloat(attributes, "subpartSizeUnderLight");
1404         if (subpartSizeUnderLight != null) {
1405             environment.setSubpartSizeUnderLight(subpartSizeUnderLight);
1406         }
1407         var photoWidth = this.parseOptionalInteger(attributes, "photoWidth");
1408         if (photoWidth != null) {
1409             environment.setPhotoWidth(photoWidth);
1410         }
1411         var photoHeight = this.parseOptionalInteger(attributes, "photoHeight");
1412         if (photoHeight != null) {
1413             environment.setPhotoHeight(photoHeight);
1414         }
1415         var photoAspectRatio = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "photoAspectRatio");
1416         if (photoAspectRatio != null) {
1417             try {
1418                 environment.setPhotoAspectRatio(/* Enum.valueOf */ AspectRatio[photoAspectRatio]);
1419             }
1420             catch (ex) {
1421             }
1422         }
1423         var photoQuality = this.parseOptionalInteger(attributes, "photoQuality");
1424         if (photoQuality != null) {
1425             environment.setPhotoQuality(photoQuality);
1426         }
1427         var videoWidth = this.parseOptionalInteger(attributes, "videoWidth");
1428         if (videoWidth != null) {
1429             environment.setVideoWidth(videoWidth);
1430         }
1431         var videoAspectRatio = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "videoAspectRatio");
1432         if (videoAspectRatio != null) {
1433             try {
1434                 environment.setVideoAspectRatio(/* Enum.valueOf */ AspectRatio[videoAspectRatio]);
1435             }
1436             catch (ex) {
1437             }
1438         }
1439         var videoQuality = this.parseOptionalInteger(attributes, "videoQuality");
1440         if (videoQuality != null) {
1441             environment.setVideoQuality(videoQuality);
1442         }
1443         var videoSpeed = this.parseOptionalFloat(attributes, "videoSpeed");
1444         if (videoSpeed != null) {
1445             environment.setVideoSpeed(videoSpeed);
1446         }
1447         var videoFrameRate = this.parseOptionalInteger(attributes, "videoFrameRate");
1448         if (videoFrameRate != null) {
1449             environment.setVideoFrameRate(videoFrameRate);
1450         }
1451     };
1452     /**
1453      * Returns a new {@link HomePrint} instance initialized from the given <code>attributes</code>.
1454      * @param {Object} attributes
1455      * @return {HomePrint}
1456      */
1457     HomeXMLHandler.prototype.createPrint = function (attributes) {
1458         var paperOrientation = HomePrint.PaperOrientation.PORTRAIT;
1459         try {
1460             if ( /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "paperOrientation") == null) {
1461                 throw new SAXException("Missing paperOrientation attribute");
1462             }
1463             paperOrientation = /* Enum.valueOf */ HomePrint.PaperOrientation[ /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "paperOrientation")];
1464         }
1465         catch (ex) {
1466         }
1467         var homePrint = new HomePrint(paperOrientation, this.parseFloat(attributes, "paperWidth"), this.parseFloat(attributes, "paperHeight"), this.parseFloat(attributes, "paperTopMargin"), this.parseFloat(attributes, "paperLeftMargin"), this.parseFloat(attributes, "paperBottomMargin"), this.parseFloat(attributes, "paperRightMargin"), !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "furniturePrinted")), !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "planPrinted")), !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "view3DPrinted")), this.parseOptionalFloat(attributes, "planScale"), /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "headerFormat"), /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "footerFormat"));
1468         return this.resolveObject(homePrint, "print", attributes);
1469     };
1470     /**
1471      * Sets the attributes of the given <code>compass</code>.
1472      * If needed, this method should be called from {@link #endElement}.
1473      * @param {Compass} compass
1474      * @param {string} elementName
1475      * @param {Object} attributes
1476      */
1477     HomeXMLHandler.prototype.setCompassAttributes = function (compass, elementName, attributes) {
1478         this.setProperties(compass, elementName, attributes);
1479         compass.setX(this.parseOptionalFloat(attributes, "x"));
1480         compass.setY(this.parseOptionalFloat(attributes, "y"));
1481         compass.setDiameter(this.parseOptionalFloat(attributes, "diameter"));
1482         var northDirection = this.parseOptionalFloat(attributes, "northDirection");
1483         if (northDirection != null) {
1484             compass.setNorthDirection(northDirection);
1485         }
1486         var longitude = this.parseOptionalFloat(attributes, "longitude");
1487         if (longitude != null) {
1488             compass.setLongitude(longitude);
1489         }
1490         var latitude = this.parseOptionalFloat(attributes, "latitude");
1491         if (latitude != null) {
1492             compass.setLatitude(latitude);
1493         }
1494         var timeZone = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "timeZone");
1495         if (timeZone != null) {
1496             compass.setTimeZone(timeZone);
1497         }
1498         compass.setVisible(!("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "visible")));
1499     };
1500     /**
1501      * Returns a new {@link Camera} instance initialized from the given <code>attributes</code>.
1502      * @param {string} elementName
1503      * @param {Object} attributes
1504      * @return {Camera}
1505      * @private
1506      */
1507     HomeXMLHandler.prototype.createCamera = function (elementName, attributes) {
1508         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
1509         var x = this.parseFloat(attributes, "x");
1510         var y = this.parseFloat(attributes, "y");
1511         var z = this.parseFloat(attributes, "z");
1512         var yaw = this.parseFloat(attributes, "yaw");
1513         var pitch = this.parseFloat(attributes, "pitch");
1514         var fieldOfView = this.parseFloat(attributes, "fieldOfView");
1515         var camera;
1516         if ("observerCamera" === elementName) {
1517             camera = id != null ? new ObserverCamera(id, x, y, z, yaw, pitch, fieldOfView) : new ObserverCamera(x, y, z, yaw, pitch, fieldOfView);
1518         }
1519         else {
1520             camera = id != null ? new Camera(id, x, y, z, yaw, pitch, fieldOfView) : new Camera(x, y, z, yaw, pitch, fieldOfView);
1521         }
1522         return this.resolveObject(camera, elementName, attributes);
1523     };
1524     /**
1525      * Sets the attributes of the given <code>camera</code>.
1526      * If needed, this method should be called from {@link #endElement}.
1527      * @param {Camera} camera
1528      * @param {string} elementName
1529      * @param {Object} attributes
1530      */
1531     HomeXMLHandler.prototype.setCameraAttributes = function (camera, elementName, attributes) {
1532         this.setProperties(camera, elementName, attributes);
1533         if (camera != null && camera instanceof ObserverCamera) {
1534             camera.setFixedSize("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "fixedSize"));
1535         }
1536         var lens = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "lens");
1537         if (lens != null) {
1538             try {
1539                 camera.setLens(/* Enum.valueOf */ Camera.Lens[lens]);
1540             }
1541             catch (ex) {
1542             }
1543         }
1544         var time = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "time");
1545         if (time != null) {
1546             try {
1547                 camera.setTime(/* parseLong */ parseInt(time));
1548             }
1549             catch (ex) {
1550                 throw new SAXException("Invalid value for long attribute time", ex);
1551             }
1552         }
1553         camera.setName(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "name"));
1554         camera.setRenderer(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "renderer"));
1555     };
1556     /**
1557      * Returns a new {@link Level} instance initialized from the given <code>attributes</code>.
1558      * @param {string} elementName
1559      * @param {Object} attributes
1560      * @return {Level}
1561      * @private
1562      */
1563     HomeXMLHandler.prototype.createLevel = function (elementName, attributes) {
1564         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
1565         var name = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "name");
1566         var elevation = this.parseFloat(attributes, "elevation");
1567         var floorThickness = this.parseFloat(attributes, "floorThickness");
1568         var height = this.parseFloat(attributes, "height");
1569         var level = id != null ? new Level(id, name, elevation, floorThickness, height) : new Level(name, elevation, floorThickness, height);
1570         return this.resolveObject(level, elementName, attributes);
1571     };
1572     /**
1573      * Sets the attributes of the given <code>level</code>.
1574      * If needed, this method should be called from {@link #endElement}.
1575      * @param {Level} level
1576      * @param {string} elementName
1577      * @param {Object} attributes
1578      */
1579     HomeXMLHandler.prototype.setLevelAttributes = function (level, elementName, attributes) {
1580         this.setProperties(level, elementName, attributes);
1581         level.setBackgroundImage(this.backgroundImage);
1582         var elevationIndex = this.parseOptionalInteger(attributes, "elevationIndex");
1583         if (elevationIndex != null) {
1584             level.setElevationIndex(elevationIndex);
1585         }
1586         level.setVisible(!("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "visible")));
1587         level.setViewable(!("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "viewable")));
1588     };
1589     /**
1590      * Returns a new {@link HomePieceOfFurniture} instance initialized from the given <code>attributes</code>.
1591      * @param {string} elementName
1592      * @param {Object} attributes
1593      * @return {HomePieceOfFurniture}
1594      * @private
1595      */
1596     HomeXMLHandler.prototype.createPieceOfFurniture = function (elementName, attributes) {
1597         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
1598         var catalogId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "catalogId");
1599         var tags = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "tags") != null ? /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "tags").split(/ /) : null;
1600         var elevation = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "elevation") != null ? this.parseFloat(attributes, "elevation") : 0;
1601         var dropOnTopElevation = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "dropOnTopElevation") != null ? this.parseFloat(attributes, "dropOnTopElevation") : 1;
1602         var modelRotation = null;
1603         if ( /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "modelRotation") != null) {
1604             var values = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "modelRotation").split(/ /);
1605             if (values.length < 9) {
1606                 throw new SAXException("Missing values for attribute modelRotation");
1607             }
1608             try {
1609                 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])]];
1610             }
1611             catch (ex) {
1612                 throw new SAXException("Invalid value for attribute modelRotation", ex);
1613             }
1614         }
1615         var name = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "name");
1616         var description = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "description");
1617         var information = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "information");
1618         var license = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "license");
1619         var creationDate = this.parseOptionalLong(attributes, "creationDate");
1620         var grade = this.parseOptionalFloat(attributes, "grade");
1621         var icon = this.parseContent(elementName, attributes, "icon");
1622         var planIcon = this.parseContent(elementName, attributes, "planIcon");
1623         var model = this.parseContent(elementName, attributes, "model");
1624         var width = this.parseFloat(attributes, "width");
1625         var depth = this.parseFloat(attributes, "depth");
1626         var height = this.parseFloat(attributes, "height");
1627         var movable = !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "movable"));
1628         var modelFlags = this.parseOptionalInteger(attributes, "modelFlags");
1629         if (modelFlags == null) {
1630             modelFlags = "true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "backFaceShown") ? PieceOfFurniture.SHOW_BACK_FACE : 0;
1631         }
1632         var modelSize = this.parseOptionalLong(attributes, "modelSize");
1633         var creator = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "creator");
1634         var resizable = !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "resizable"));
1635         var deformable = !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "deformable"));
1636         var texturable = !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "texturable"));
1637         var price = this.parseOptionalDecimal(attributes, "price");
1638         var valueAddedTaxPercentage = this.parseOptionalDecimal(attributes, "valueAddedTaxPercentage");
1639         var currency = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "currency");
1640         var piece;
1641         if (("doorOrWindow" === elementName) || ("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "doorOrWindow"))) {
1642             var wallThickness = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "wallThickness") != null ? this.parseFloat(attributes, "wallThickness") : 1;
1643             var wallDistance = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "wallDistance") != null ? this.parseFloat(attributes, "wallDistance") : 0;
1644             var cutOutShape = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "cutOutShape");
1645             if (cutOutShape == null && !("doorOrWindow" === elementName)) {
1646                 cutOutShape = PieceOfFurniture.DEFAULT_CUT_OUT_SHAPE;
1647             }
1648             var wallCutOutOnBothSides = "true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "wallCutOutOnBothSides");
1649             var widthDepthDeformable = !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "widthDepthDeformable"));
1650             var catalogDoorOrWindow = new CatalogDoorOrWindow(catalogId, name, description, information, license, tags, creationDate, grade, icon, planIcon, model, width, depth, height, elevation, dropOnTopElevation, movable, cutOutShape, wallThickness, wallDistance, wallCutOutOnBothSides, widthDepthDeformable, /* toArray */ this.sashes.slice(0), modelRotation, modelFlags, modelSize, creator, resizable, deformable, texturable, price, valueAddedTaxPercentage, currency, null, null);
1651             piece = id != null ? new HomeDoorOrWindow(id, catalogDoorOrWindow) : new HomeDoorOrWindow(catalogDoorOrWindow);
1652         }
1653         else {
1654             var staircaseCutOutShape = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "staircaseCutOutShape");
1655             var horizontallyRotatable = !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "horizontallyRotatable"));
1656             if ("light" === elementName) {
1657                 var catalogLight = new CatalogLight(catalogId, name, description, information, license, tags, creationDate, grade, icon, planIcon, model, width, depth, height, elevation, dropOnTopElevation, movable, /* toArray */ this.lightSources.slice(0), /* toArray */ this.lightSourceMaterialNames.slice(0), staircaseCutOutShape, modelRotation, modelFlags, modelSize, creator, resizable, deformable, texturable, horizontallyRotatable, price, valueAddedTaxPercentage, currency, null, null);
1658                 piece = id != null ? new HomeLight(id, catalogLight) : new HomeLight(catalogLight);
1659             }
1660             else if ("shelfUnit" === elementName) {
1661                 var shelfElevations = (function (s) { var a = []; while (s-- > 0)
1662                     a.push(0); return a; })(/* size */ this.shelfElevations.length);
1663                 for (var i = 0; i < shelfElevations.length; i++) {
1664                     {
1665                         shelfElevations[i] = /* floatValue */ /* get */ this.shelfElevations[i];
1666                     }
1667                     ;
1668                 }
1669                 var catalogShelfUnit = new CatalogShelfUnit(catalogId, name, description, information, license, tags, creationDate, grade, icon, planIcon, model, width, depth, height, elevation, dropOnTopElevation, shelfElevations, /* toArray */ this.shelfBoxes.slice(0), movable, staircaseCutOutShape, modelRotation, modelFlags, modelSize, creator, resizable, deformable, texturable, horizontallyRotatable, price, valueAddedTaxPercentage, currency, null, null);
1670                 piece = id != null ? new HomeShelfUnit(id, catalogShelfUnit) : new HomeShelfUnit(catalogShelfUnit);
1671             }
1672             else {
1673                 var catalogPiece = new CatalogPieceOfFurniture(catalogId, name, description, information, license, tags, creationDate, grade, icon, planIcon, model, width, depth, height, elevation, dropOnTopElevation, movable, staircaseCutOutShape, modelRotation, modelFlags, modelSize, creator, resizable, deformable, texturable, horizontallyRotatable, price, valueAddedTaxPercentage, currency, null, null);
1674                 piece = id != null ? new HomePieceOfFurniture(id, catalogPiece) : new HomePieceOfFurniture(catalogPiece);
1675             }
1676         }
1677         return this.resolveObject(piece, elementName, attributes);
1678     };
1679     /**
1680      * Returns a new {@link HomeFurnitureGroup} instance initialized from the given <code>attributes</code>.
1681      * @param {string} elementName
1682      * @param {Object} attributes
1683      * @param {HomePieceOfFurniture[]} furniture
1684      * @return {HomeFurnitureGroup}
1685      * @private
1686      */
1687     HomeXMLHandler.prototype.createFurnitureGroup = function (elementName, attributes, furniture) {
1688         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
1689         var angle = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "angle") != null ? this.parseFloat(attributes, "angle") : 0;
1690         var modelMirrored = "true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "modelMirrored");
1691         var name = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "name");
1692         var furnitureGroup = id != null ? new HomeFurnitureGroup(id, furniture, angle, modelMirrored, name) : new HomeFurnitureGroup(furniture, angle, modelMirrored, name);
1693         return this.resolveObject(furnitureGroup, elementName, attributes);
1694     };
1695     /**
1696      * Sets the attributes of the given <code>piece</code>.
1697      * If needed, this method should be called from {@link #endElement}.
1698      * @param {HomePieceOfFurniture} piece
1699      * @param {string} elementName
1700      * @param {Object} attributes
1701      */
1702     HomeXMLHandler.prototype.setPieceOfFurnitureAttributes = function (piece, elementName, attributes) {
1703         this.setProperties(piece, elementName, attributes);
1704         piece.setNameStyle(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(/* peek */ (function (a) { return a.length == 0 ? null : a[a.length - 1]; })(this.textStyles), "nameStyle"));
1705         piece.setNameVisible("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "nameVisible"));
1706         var nameAngle = this.parseOptionalFloat(attributes, "nameAngle");
1707         if (nameAngle != null) {
1708             piece.setNameAngle(nameAngle);
1709         }
1710         var nameXOffset = this.parseOptionalFloat(attributes, "nameXOffset");
1711         if (nameXOffset != null) {
1712             piece.setNameXOffset(nameXOffset);
1713         }
1714         var nameYOffset = this.parseOptionalFloat(attributes, "nameYOffset");
1715         if (nameYOffset != null) {
1716             piece.setNameYOffset(nameYOffset);
1717         }
1718         piece.setVisible(!("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "visible")));
1719         if (!(piece != null && piece instanceof HomeFurnitureGroup)) {
1720             var x = this.parseOptionalFloat(attributes, "x");
1721             if (x != null) {
1722                 piece.setX(x);
1723             }
1724             var y = this.parseOptionalFloat(attributes, "y");
1725             if (y != null) {
1726                 piece.setY(y);
1727             }
1728             var angle = this.parseOptionalFloat(attributes, "angle");
1729             if (angle != null) {
1730                 piece.setAngle(angle);
1731             }
1732             if (piece.isHorizontallyRotatable()) {
1733                 var pitch = this.parseOptionalFloat(attributes, "pitch");
1734                 if (pitch != null) {
1735                     piece.setPitch(pitch);
1736                 }
1737                 var roll = this.parseOptionalFloat(attributes, "roll");
1738                 if (roll != null) {
1739                     piece.setRoll(roll);
1740                 }
1741             }
1742             var widthInPlan = this.parseOptionalFloat(attributes, "widthInPlan");
1743             if (widthInPlan != null) {
1744                 piece.setWidthInPlan(widthInPlan);
1745             }
1746             var depthInPlan = this.parseOptionalFloat(attributes, "depthInPlan");
1747             if (depthInPlan != null) {
1748                 piece.setDepthInPlan(depthInPlan);
1749             }
1750             var heightInPlan = this.parseOptionalFloat(attributes, "heightInPlan");
1751             if (heightInPlan != null) {
1752                 piece.setHeightInPlan(heightInPlan);
1753             }
1754             if (this.home.getVersion() < 5500 || ("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "modelCenteredAtOrigin"))) {
1755                 piece.setModelCenteredAtOrigin(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "modelRotation") == null);
1756             }
1757             if (piece.isResizable()) {
1758                 piece.setModelMirrored("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "modelMirrored"));
1759             }
1760             if (piece.isTexturable()) {
1761                 if ( /* size */this.materials.length > 0) {
1762                     piece.setModelMaterials(/* toArray */ this.materials.slice(0));
1763                 }
1764                 var color = this.parseOptionalColor(attributes, "color");
1765                 if (color != null) {
1766                     piece.setColor(color);
1767                 }
1768                 var texture = (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.textures, HomeXMLHandler.UNIQUE_ATTRIBUTE);
1769                 if (texture != null) {
1770                     piece.setTexture(texture);
1771                 }
1772                 var shininess = this.parseOptionalFloat(attributes, "shininess");
1773                 if (shininess != null) {
1774                     piece.setShininess(shininess);
1775                 }
1776             }
1777             if (piece.isDeformable()) {
1778                 if ( /* size */this.transformations.length > 0) {
1779                     piece.setModelTransformations(/* toArray */ this.transformations.slice(0));
1780                 }
1781             }
1782             if ((piece != null && piece instanceof HomeLight) && /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "power") != null) {
1783                 piece.setPower(this.parseFloat(attributes, "power"));
1784             }
1785             else if ((piece != null && piece instanceof HomeDoorOrWindow) && ("doorOrWindow" === elementName)) {
1786                 var doorOrWindow = piece;
1787                 doorOrWindow.setBoundToWall(!("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "boundToWall")));
1788                 var wallWidth = this.parseOptionalFloat(attributes, "wallWidth");
1789                 if (wallWidth != null) {
1790                     doorOrWindow.setWallWidth(wallWidth);
1791                 }
1792                 var wallLeft = this.parseOptionalFloat(attributes, "wallLeft");
1793                 if (wallLeft != null) {
1794                     doorOrWindow.setWallLeft(wallLeft);
1795                 }
1796                 var wallHeight = this.parseOptionalFloat(attributes, "wallHeight");
1797                 if (wallHeight != null) {
1798                     doorOrWindow.setWallHeight(wallHeight);
1799                 }
1800                 var wallTop = this.parseOptionalFloat(attributes, "wallTop");
1801                 if (wallTop != null) {
1802                     doorOrWindow.setWallTop(wallTop);
1803                 }
1804             }
1805         }
1806         else {
1807             piece.setCatalogId(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "catalogId"));
1808             piece.setDescription(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "description"));
1809             piece.setInformation(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "information"));
1810             piece.setLicense(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "license"));
1811             piece.setCreator(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "creator"));
1812         }
1813     };
1814     /**
1815      * Returns a new {@link Wall} instance initialized from the given <code>attributes</code>.
1816      * @param {string} elementName
1817      * @param {Object} attributes
1818      * @return {Wall}
1819      * @private
1820      */
1821     HomeXMLHandler.prototype.createWall = function (elementName, attributes) {
1822         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
1823         var xStart = this.parseFloat(attributes, "xStart");
1824         var yStart = this.parseFloat(attributes, "yStart");
1825         var xEnd = this.parseFloat(attributes, "xEnd");
1826         var yEnd = this.parseFloat(attributes, "yEnd");
1827         var thickness = this.parseFloat(attributes, "thickness");
1828         var wall = id != null ? new Wall(id, xStart, yStart, xEnd, yEnd, thickness, 0) : new Wall(xStart, yStart, xEnd, yEnd, thickness, 0);
1829         return this.resolveObject(wall, elementName, attributes);
1830     };
1831     /**
1832      * Sets the attributes of the given <code>wall</code>.
1833      * If needed, this method should be called from {@link #endElement}.
1834      * @param {Wall} wall
1835      * @param {string} elementName
1836      * @param {Object} attributes
1837      */
1838     HomeXMLHandler.prototype.setWallAttributes = function (wall, elementName, attributes) {
1839         this.setProperties(wall, elementName, attributes);
1840         wall.setLeftSideBaseboard(this.leftSideBaseboard);
1841         wall.setRightSideBaseboard(this.rightSideBaseboard);
1842         wall.setHeight(this.parseOptionalFloat(attributes, "height"));
1843         wall.setHeightAtEnd(this.parseOptionalFloat(attributes, "heightAtEnd"));
1844         wall.setArcExtent(this.parseOptionalFloat(attributes, "arcExtent"));
1845         wall.setTopColor(this.parseOptionalColor(attributes, "topColor"));
1846         wall.setLeftSideColor(this.parseOptionalColor(attributes, "leftSideColor"));
1847         wall.setLeftSideTexture(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.textures, "leftSideTexture"));
1848         var leftSideShininess = this.parseOptionalFloat(attributes, "leftSideShininess");
1849         if (leftSideShininess != null) {
1850             wall.setLeftSideShininess(leftSideShininess);
1851         }
1852         wall.setRightSideColor(this.parseOptionalColor(attributes, "rightSideColor"));
1853         wall.setRightSideTexture(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.textures, "rightSideTexture"));
1854         var rightSideShininess = this.parseOptionalFloat(attributes, "rightSideShininess");
1855         if (rightSideShininess != null) {
1856             wall.setRightSideShininess(rightSideShininess);
1857         }
1858         var pattern = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "pattern");
1859         if (pattern != null) {
1860             try {
1861                 wall.setPattern(this.preferences.getPatternsCatalog().getPattern$java_lang_String(pattern));
1862             }
1863             catch (ex) {
1864             }
1865         }
1866     };
1867     /**
1868      * Returns a new {@link Room} instance initialized from the given <code>attributes</code>.
1869      * @param {string} elementName
1870      * @param {Object} attributes
1871      * @param {float[][]} points
1872      * @return {Room}
1873      * @private
1874      */
1875     HomeXMLHandler.prototype.createRoom = function (elementName, attributes, points) {
1876         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
1877         var room = id != null ? new Room(id, points) : new Room(points);
1878         return this.resolveObject(room, elementName, attributes);
1879     };
1880     /**
1881      * Sets the attributes of the given <code>room</code>.
1882      * If needed, this method should be called from {@link #endElement}.
1883      * @param {Room} room
1884      * @param {string} elementName
1885      * @param {Object} attributes
1886      */
1887     HomeXMLHandler.prototype.setRoomAttributes = function (room, elementName, attributes) {
1888         this.setProperties(room, elementName, attributes);
1889         room.setNameStyle(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(/* peek */ (function (a) { return a.length == 0 ? null : a[a.length - 1]; })(this.textStyles), "nameStyle"));
1890         room.setAreaStyle(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(/* peek */ (function (a) { return a.length == 0 ? null : a[a.length - 1]; })(this.textStyles), "areaStyle"));
1891         room.setName(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "name"));
1892         var nameAngle = this.parseOptionalFloat(attributes, "nameAngle");
1893         if (nameAngle != null) {
1894             room.setNameAngle(nameAngle);
1895         }
1896         var nameXOffset = this.parseOptionalFloat(attributes, "nameXOffset");
1897         if (nameXOffset != null) {
1898             room.setNameXOffset(nameXOffset);
1899         }
1900         var nameYOffset = this.parseOptionalFloat(attributes, "nameYOffset");
1901         if (nameYOffset != null) {
1902             room.setNameYOffset(nameYOffset);
1903         }
1904         room.setAreaVisible("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "areaVisible"));
1905         var areaAngle = this.parseOptionalFloat(attributes, "areaAngle");
1906         if (areaAngle != null) {
1907             room.setAreaAngle(areaAngle);
1908         }
1909         var areaXOffset = this.parseOptionalFloat(attributes, "areaXOffset");
1910         if (areaXOffset != null) {
1911             room.setAreaXOffset(areaXOffset);
1912         }
1913         var areaYOffset = this.parseOptionalFloat(attributes, "areaYOffset");
1914         if (areaYOffset != null) {
1915             room.setAreaYOffset(areaYOffset);
1916         }
1917         room.setFloorVisible(!("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "floorVisible")));
1918         room.setFloorColor(this.parseOptionalColor(attributes, "floorColor"));
1919         room.setFloorTexture(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.textures, "floorTexture"));
1920         var floorShininess = this.parseOptionalFloat(attributes, "floorShininess");
1921         if (floorShininess != null) {
1922             room.setFloorShininess(floorShininess);
1923         }
1924         room.setCeilingVisible(!("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "ceilingVisible")));
1925         room.setCeilingColor(this.parseOptionalColor(attributes, "ceilingColor"));
1926         room.setCeilingTexture(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.textures, "ceilingTexture"));
1927         var ceilingShininess = this.parseOptionalFloat(attributes, "ceilingShininess");
1928         if (ceilingShininess != null) {
1929             room.setCeilingShininess(ceilingShininess);
1930         }
1931         room.setCeilingFlat("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "ceilingFlat"));
1932     };
1933     /**
1934      * Returns a new {@link Polyline} instance initialized from the given <code>attributes</code>.
1935      * @param {string} elementName
1936      * @param {Object} attributes
1937      * @param {float[][]} points
1938      * @return {Polyline}
1939      * @private
1940      */
1941     HomeXMLHandler.prototype.createPolyline = function (elementName, attributes, points) {
1942         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
1943         var polyline = id != null ? new Polyline(id, points) : new Polyline(points);
1944         return this.resolveObject(polyline, elementName, attributes);
1945     };
1946     /**
1947      * Sets the attributes of the given <code>polyline</code>.
1948      * If needed, this method should be called from {@link #endElement}.
1949      * @param {Polyline} polyline
1950      * @param {string} elementName
1951      * @param {Object} attributes
1952      */
1953     HomeXMLHandler.prototype.setPolylineAttributes = function (polyline, elementName, attributes) {
1954         this.setProperties(polyline, elementName, attributes);
1955         var thickness = this.parseOptionalFloat(attributes, "thickness");
1956         if (thickness != null) {
1957             polyline.setThickness(thickness);
1958         }
1959         var capStyle = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "capStyle");
1960         if (capStyle != null) {
1961             try {
1962                 polyline.setCapStyle(/* Enum.valueOf */ Polyline.CapStyle[capStyle]);
1963             }
1964             catch (ex) {
1965             }
1966         }
1967         var joinStyle = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "joinStyle");
1968         if (joinStyle != null) {
1969             try {
1970                 polyline.setJoinStyle(/* Enum.valueOf */ Polyline.JoinStyle[joinStyle]);
1971             }
1972             catch (ex) {
1973             }
1974         }
1975         var dashStyle = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "dashStyle");
1976         if (dashStyle != null) {
1977             try {
1978                 polyline.setDashStyle(/* Enum.valueOf */ Polyline.DashStyle[dashStyle]);
1979             }
1980             catch (ex) {
1981             }
1982         }
1983         var dashPattern = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "dashPattern");
1984         if (dashPattern != null) {
1985             try {
1986                 var values = dashPattern.split(/ /);
1987                 var pattern = (function (s) { var a = []; while (s-- > 0)
1988                     a.push(0); return a; })(values.length);
1989                 for (var i = 0; i < values.length; i++) {
1990                     {
1991                         pattern[i] = /* parseFloat */ parseFloat(values[i]);
1992                     }
1993                     ;
1994                 }
1995                 polyline.setDashPattern(pattern);
1996             }
1997             catch (ex) {
1998                 throw new SAXException("Invalid value for dash pattern", ex);
1999             }
2000         }
2001         var dashOffset = this.parseOptionalFloat(attributes, "dashOffset");
2002         if (dashOffset != null) {
2003             polyline.setDashOffset(dashOffset);
2004         }
2005         var startArrowStyle = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "startArrowStyle");
2006         if (startArrowStyle != null) {
2007             try {
2008                 polyline.setStartArrowStyle(/* Enum.valueOf */ Polyline.ArrowStyle[startArrowStyle]);
2009             }
2010             catch (ex) {
2011             }
2012         }
2013         var endArrowStyle = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "endArrowStyle");
2014         if (endArrowStyle != null) {
2015             try {
2016                 polyline.setEndArrowStyle(/* Enum.valueOf */ Polyline.ArrowStyle[endArrowStyle]);
2017             }
2018             catch (ex) {
2019             }
2020         }
2021         var elevation = this.parseOptionalFloat(attributes, "elevation");
2022         if (elevation != null) {
2023             polyline.setVisibleIn3D(true);
2024             polyline.setElevation(elevation);
2025         }
2026         var color = this.parseOptionalColor(attributes, "color");
2027         if (color != null) {
2028             polyline.setColor(color);
2029         }
2030         polyline.setClosedPath("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "closedPath"));
2031     };
2032     /**
2033      * Returns a new {@link DimensionLine} instance initialized from the given <code>attributes</code>.
2034      * @param {string} elementName
2035      * @param {Object} attributes
2036      * @return {DimensionLine}
2037      * @private
2038      */
2039     HomeXMLHandler.prototype.createDimensionLine = function (elementName, attributes) {
2040         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
2041         var xStart = this.parseFloat(attributes, "xStart");
2042         var yStart = this.parseFloat(attributes, "yStart");
2043         var optionalValue = this.parseOptionalFloat(attributes, "elevationStart");
2044         var elevationStart = optionalValue != null ? /* floatValue */ optionalValue : 0;
2045         var xEnd = this.parseFloat(attributes, "xEnd");
2046         var yEnd = this.parseFloat(attributes, "yEnd");
2047         optionalValue = this.parseOptionalFloat(attributes, "elevationEnd");
2048         var elevationEnd = optionalValue != null ? /* floatValue */ optionalValue : 0;
2049         var offset = this.parseFloat(attributes, "offset");
2050         var dimensionLine = id != null ? new DimensionLine(id, xStart, yStart, elevationStart, xEnd, yEnd, elevationEnd, offset) : new DimensionLine(xStart, yStart, elevationStart, xEnd, yEnd, elevationEnd, offset);
2051         optionalValue = this.parseOptionalFloat(attributes, "endMarkSize");
2052         if (optionalValue != null) {
2053             dimensionLine.setEndMarkSize(/* floatValue */ optionalValue);
2054         }
2055         optionalValue = this.parseOptionalFloat(attributes, "pitch");
2056         if (optionalValue != null) {
2057             dimensionLine.setPitch(/* floatValue */ optionalValue);
2058         }
2059         var color = this.parseOptionalColor(attributes, "color");
2060         if (color != null) {
2061             dimensionLine.setColor(color);
2062         }
2063         dimensionLine.setVisibleIn3D("true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "visibleIn3D"));
2064         return this.resolveObject(dimensionLine, elementName, attributes);
2065     };
2066     /**
2067      * Sets the attributes of the given dimension line.
2068      * If needed, this method should be called from {@link #endElement}.
2069      * @param {DimensionLine} dimensionLine
2070      * @param {string} elementName
2071      * @param {Object} attributes
2072      */
2073     HomeXMLHandler.prototype.setDimensionLineAttributes = function (dimensionLine, elementName, attributes) {
2074         this.setProperties(dimensionLine, elementName, attributes);
2075         dimensionLine.setLengthStyle(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(/* peek */ (function (a) { return a.length == 0 ? null : a[a.length - 1]; })(this.textStyles), "lengthStyle"));
2076     };
2077     /**
2078      * Returns a new {@link Label} instance initialized from the given <code>attributes</code>.
2079      * @param {string} elementName
2080      * @param {Object} attributes
2081      * @param {string} text
2082      * @return {Label}
2083      * @private
2084      */
2085     HomeXMLHandler.prototype.createLabel = function (elementName, attributes, text) {
2086         var id = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "id");
2087         var x = this.parseFloat(attributes, "x");
2088         var y = this.parseFloat(attributes, "y");
2089         var label = id != null ? new Label(id, text, x, y) : new Label(text, x, y);
2090         return this.resolveObject(label, elementName, attributes);
2091     };
2092     /**
2093      * Sets the attributes of the given <code>label</code>.
2094      * If needed, this method should be called from {@link #endElement}.
2095      * @param {Label} label
2096      * @param {string} elementName
2097      * @param {Object} attributes
2098      */
2099     HomeXMLHandler.prototype.setLabelAttributes = function (label, elementName, attributes) {
2100         this.setProperties(label, elementName, attributes);
2101         label.setStyle(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(/* peek */ (function (a) { return a.length == 0 ? null : a[a.length - 1]; })(this.textStyles), HomeXMLHandler.UNIQUE_ATTRIBUTE));
2102         var angle = this.parseOptionalFloat(attributes, "angle");
2103         if (angle != null) {
2104             label.setAngle(angle);
2105         }
2106         var elevation = this.parseOptionalFloat(attributes, "elevation");
2107         if (elevation != null) {
2108             label.setElevation(elevation);
2109         }
2110         var pitch = this.parseOptionalFloat(attributes, "pitch");
2111         if (pitch != null) {
2112             label.setPitch(pitch);
2113         }
2114         label.setColor(this.parseOptionalColor(attributes, "color"));
2115         label.setOutlineColor(this.parseOptionalColor(attributes, "outlineColor"));
2116     };
2117     /**
2118      * Returns a new {@link Baseboard} instance initialized from the given <code>attributes</code>.
2119      * @param {string} elementName
2120      * @param {Object} attributes
2121      * @return {Baseboard}
2122      * @private
2123      */
2124     HomeXMLHandler.prototype.createBaseboard = function (elementName, attributes) {
2125         var baseboard = Baseboard.getInstance(this.parseFloat(attributes, "thickness"), this.parseFloat(attributes, "height"), this.parseOptionalColor(attributes, "color"), /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.textures, HomeXMLHandler.UNIQUE_ATTRIBUTE));
2126         return this.resolveObject(baseboard, elementName, attributes);
2127     };
2128     /**
2129      * Returns a new {@link TextStyle} instance initialized from the given <code>attributes</code>.
2130      * @param {string} elementName
2131      * @param {Object} attributes
2132      * @return {TextStyle}
2133      * @private
2134      */
2135     HomeXMLHandler.prototype.createTextStyle = function (elementName, attributes) {
2136         var alignment = TextStyle.Alignment.CENTER;
2137         var alignmentString = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "alignment");
2138         if (alignmentString != null) {
2139             try {
2140                 alignment = /* Enum.valueOf */ TextStyle.Alignment[alignmentString];
2141             }
2142             catch (ex) {
2143             }
2144         }
2145         var textStyle = new TextStyle(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "fontName"), this.parseFloat(attributes, "fontSize"), "true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "bold"), "true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "italic"), alignment);
2146         return this.resolveObject(textStyle, elementName, attributes);
2147     };
2148     /**
2149      * Returns a new {@link HomeTexture} instance initialized from the given <code>attributes</code>.
2150      * @param {string} elementName
2151      * @param {Object} attributes
2152      * @return {HomeTexture}
2153      * @private
2154      */
2155     HomeXMLHandler.prototype.createTexture = function (elementName, attributes) {
2156         var catalogId = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "catalogId");
2157         var texture = new HomeTexture(new CatalogTexture(catalogId, /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "name"), this.parseContent(elementName, attributes, "image"), this.parseFloat(attributes, "width"), this.parseFloat(attributes, "height"), /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "creator")), /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "xOffset") != null ? this.parseFloat(attributes, "xOffset") : 0, /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "yOffset") != null ? this.parseFloat(attributes, "yOffset") : 0, /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "angle") != null ? this.parseFloat(attributes, "angle") : 0, /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "scale") != null ? this.parseFloat(attributes, "scale") : 1, "true" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "fittingArea"), !("false" === /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "leftToRightOriented")));
2158         return this.resolveObject(texture, elementName, attributes);
2159     };
2160     /**
2161      * Returns a new {@link HomeMaterial} instance initialized from the given <code>attributes</code>.
2162      * @param {string} elementName
2163      * @param {Object} attributes
2164      * @return {HomeMaterial}
2165      * @private
2166      */
2167     HomeXMLHandler.prototype.createMaterial = function (elementName, attributes) {
2168         var material = new HomeMaterial(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "name"), /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, "key"), this.parseOptionalColor(attributes, "color"), this.materialTexture, this.parseOptionalFloat(attributes, "shininess"));
2169         return this.resolveObject(material, elementName, attributes);
2170     };
2171     /**
2172      * Sets the properties of the given <code>object</code>.
2173      * @param {HomeObject} object
2174      * @param {string} elementName
2175      * @param {Object} attributes
2176      * @private
2177      */
2178     HomeXMLHandler.prototype.setProperties = function (object, elementName, attributes) {
2179         {
2180             var array = /* entrySet */ (function (o) { var s = []; for (var e in o)
2181                 s.push({ k: e, v: o[e], getKey: function () { return this.k; }, getValue: function () { return this.v; } }); return s; })(/* peek */ (function (a) { return a.length == 0 ? null : a[a.length - 1]; })(this.properties));
2182             for (var index = 0; index < array.length; index++) {
2183                 var property = array[index];
2184                 {
2185                     object.setProperty$java_lang_String$java_lang_Object(property.getKey(), property.getValue());
2186                 }
2187             }
2188         }
2189     };
2190     /**
2191      * Returns the color integer from a hexadecimal string.
2192      * @param {Object} attributes
2193      * @param {string} name
2194      * @return {number}
2195      * @private
2196      */
2197     HomeXMLHandler.prototype.parseOptionalColor = function (attributes, name) {
2198         var color = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, name);
2199         if (color != null) {
2200             try {
2201                 return (parseInt(color, 16) | 0);
2202             }
2203             catch (ex) {
2204                 throw new SAXException("Invalid value for color attribute " + name, ex);
2205             }
2206         }
2207         else {
2208             return null;
2209         }
2210     };
2211     HomeXMLHandler.prototype.parseOptionalInteger = function (attributes, name) {
2212         var value = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, name);
2213         if (value != null) {
2214             try {
2215                 return /* parseInt */ parseInt(value);
2216             }
2217             catch (ex) {
2218                 throw new SAXException("Invalid value for integer attribute " + name, ex);
2219             }
2220         }
2221         else {
2222             return null;
2223         }
2224     };
2225     HomeXMLHandler.prototype.parseOptionalLong = function (attributes, name) {
2226         var value = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, name);
2227         if (value != null) {
2228             try {
2229                 return /* parseLong */ parseInt(value);
2230             }
2231             catch (ex) {
2232                 throw new SAXException("Invalid value for long attribute " + name, ex);
2233             }
2234         }
2235         else {
2236             return null;
2237         }
2238     };
2239     HomeXMLHandler.prototype.parseOptionalDecimal = function (attributes, name) {
2240         var value = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, name);
2241         if (value != null) {
2242             try {
2243                 return new Big(value);
2244             }
2245             catch (ex) {
2246                 throw new SAXException("Invalid value for decimal attribute " + name, ex);
2247             }
2248         }
2249         else {
2250             return null;
2251         }
2252     };
2253     HomeXMLHandler.prototype.parseOptionalFloat = function (attributes, name) {
2254         var value = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, name);
2255         if (value != null) {
2256             try {
2257                 return /* parseFloat */ parseFloat(value);
2258             }
2259             catch (ex) {
2260                 throw new SAXException("Invalid value for float attribute " + name, ex);
2261             }
2262         }
2263         else {
2264             return null;
2265         }
2266     };
2267     HomeXMLHandler.prototype.parseFloat = function (attributes, name) {
2268         var value = (function (m, k) { return m[k] === undefined ? null : m[k]; })(attributes, name);
2269         if (value != null) {
2270             try {
2271                 return /* parseFloat */ parseFloat(value);
2272             }
2273             catch (ex) {
2274                 throw new SAXException("Invalid value for float attribute " + name, ex);
2275             }
2276         }
2277         else {
2278             throw new SAXException("Missing float attribute " + name);
2279         }
2280     };
2281     /**
2282      * Returns the content object matching the attribute named <code>attributeName</code> in the given element.
2283      * @param {string} elementName
2284      * @param {Object} attributes
2285      * @param {string} attributeName
2286      * @return {Object}
2287      */
2288     HomeXMLHandler.prototype.parseContent = function (elementName, attributes, attributeName) {
2289         var contentFile = attributes[attributeName];
2290         if (contentFile === undefined) {
2291             return null;
2292         }
2293         else if (contentFile.indexOf('://') >= 0) {
2294             return URLContent.fromURL(contentFile);
2295         }
2296         else {
2297             return new HomeURLContent('jar:' + this['homeUrl'] + '!/' + contentFile);
2298         }
2299     };
2300     /**
2301      * Sets the home that will be updated by this handler.
2302      * If a subclass of this handler uses a root element different from <code>home</code>,
2303      * it should call this method from {@link #startElement} to store the
2304      * {@link Home} subclass instance read from the XML stream.
2305      * @param {Home} home
2306      */
2307     HomeXMLHandler.prototype.setHome = function (home) {
2308         this.home = home;
2309         this.homeElementName = /* peek */ (function (a) { return a.length == 0 ? null : a[a.length - 1]; })(this.elements);
2310     };
2311     /**
2312      * Returns the home read by this handler.
2313      * @return {Home}
2314      */
2315     HomeXMLHandler.prototype.getHome = function () {
2316         return this.home;
2317     };
2318     HomeXMLHandler.UNIQUE_ATTRIBUTE = "@&unique&@";
2319     return HomeXMLHandler;
2320 }(DefaultHandler));
2321 HomeXMLHandler["__class"] = "com.eteks.sweethome3d.io.HomeXMLHandler";
2322 HomeXMLHandler["__interfaces"] = ["org.xml.sax.ErrorHandler", "org.xml.sax.DTDHandler", "org.xml.sax.ContentHandler", "org.xml.sax.EntityResolver"];
2323 (function (HomeXMLHandler) {
2324     /**
2325      * Class storing the ID of the walls connected to a given wall.
2326      * @param {Wall} wall
2327      * @param {string} wallAtStartId
2328      * @param {string} wallAtEndId
2329      * @class
2330      */
2331     var JoinedWall = /** @class */ (function () {
2332         function JoinedWall(wall, wallAtStartId, wallAtEndId) {
2333             if (this.wall === undefined) {
2334                 this.wall = null;
2335             }
2336             if (this.wallAtStartId === undefined) {
2337                 this.wallAtStartId = null;
2338             }
2339             if (this.wallAtEndId === undefined) {
2340                 this.wallAtEndId = null;
2341             }
2342             this.wall = wall;
2343             this.wallAtStartId = wallAtStartId;
2344             this.wallAtEndId = wallAtEndId;
2345         }
2346         JoinedWall.prototype.getWall = function () {
2347             return this.wall;
2348         };
2349         JoinedWall.prototype.getWallAtStartId = function () {
2350             return this.wallAtStartId;
2351         };
2352         JoinedWall.prototype.getWallAtEndId = function () {
2353             return this.wallAtEndId;
2354         };
2355         return JoinedWall;
2356     }());
2357     HomeXMLHandler.JoinedWall = JoinedWall;
2358     JoinedWall["__class"] = "com.eteks.sweethome3d.io.HomeXMLHandler.JoinedWall";
2359 })(HomeXMLHandler || (HomeXMLHandler = {}));
2360 /**
2361  * Creates the bounds of a box from the coordinates of its lower and upper corners.
2362  * @param {number} xLower
2363  * @param {number} yLower
2364  * @param {number} zLower
2365  * @param {number} xUpper
2366  * @param {number} yUpper
2367  * @param {number} zUpper
2368  * @class
2369  * @author Emmanuel Puybaret
2370  */
2371 var BoxBounds = /** @class */ (function () {
2372     function BoxBounds(xLower, yLower, zLower, xUpper, yUpper, zUpper) {
2373         if (this.xLower === undefined) {
2374             this.xLower = 0;
2375         }
2376         if (this.yLower === undefined) {
2377             this.yLower = 0;
2378         }
2379         if (this.zLower === undefined) {
2380             this.zLower = 0;
2381         }
2382         if (this.xUpper === undefined) {
2383             this.xUpper = 0;
2384         }
2385         if (this.yUpper === undefined) {
2386             this.yUpper = 0;
2387         }
2388         if (this.zUpper === undefined) {
2389             this.zUpper = 0;
2390         }
2391         this.xLower = xLower;
2392         this.yLower = yLower;
2393         this.zLower = zLower;
2394         this.xUpper = xUpper;
2395         this.yUpper = yUpper;
2396         this.zUpper = zUpper;
2397     }
2398     /**
2399      * Returns the abscissa of the lower corner of these bounds.
2400      * @return {number}
2401      */
2402     BoxBounds.prototype.getXLower = function () {
2403         return this.xLower;
2404     };
2405     /**
2406      * Returns the ordinate of the lower corner of these bounds.
2407      * @return {number}
2408      */
2409     BoxBounds.prototype.getYLower = function () {
2410         return this.yLower;
2411     };
2412     /**
2413      * Returns the elevation of the lower corner of these bounds.
2414      * @return {number}
2415      */
2416     BoxBounds.prototype.getZLower = function () {
2417         return this.zLower;
2418     };
2419     /**
2420      * Returns the abscissa of the upper corner of these bounds.
2421      * @return {number}
2422      */
2423     BoxBounds.prototype.getXUpper = function () {
2424         return this.xUpper;
2425     };
2426     /**
2427      * Returns the ordinate of the upper corner of these bounds.
2428      * @return {number}
2429      */
2430     BoxBounds.prototype.getYUpper = function () {
2431         return this.yUpper;
2432     };
2433     /**
2434      * Returns the elevation of the upper corner of these bounds.
2435      * @return {number}
2436      */
2437     BoxBounds.prototype.getZUpper = function () {
2438         return this.zUpper;
2439     };
2440     /**
2441      * Returns <code>true</code> if these bounds are equal to <code>object</code>.
2442      * @param {Object} object
2443      * @return {boolean}
2444      */
2445     BoxBounds.prototype.equals = function (object) {
2446         if (object != null && object instanceof BoxBounds) {
2447             var bounds = object;
2448             return bounds.xLower === this.xLower && bounds.yLower === this.yLower && bounds.zLower === this.zLower && bounds.xUpper === this.xUpper && bounds.yUpper === this.yUpper && bounds.zUpper === this.zUpper;
2449         }
2450         return false;
2451     };
2452     /**
2453      * Returns a hash code for these bounds.
2454      * @return {number}
2455      */
2456     BoxBounds.prototype.hashCode = function () {
2457         var hashCode = (function (f) { var buf = new ArrayBuffer(4); (new Float32Array(buf))[0] = f; return (new Uint32Array(buf))[0]; })(this.xLower) + /* floatToIntBits */ (function (f) { var buf = new ArrayBuffer(4); (new Float32Array(buf))[0] = f; return (new Uint32Array(buf))[0]; })(this.yLower) + /* floatToIntBits */ (function (f) { var buf = new ArrayBuffer(4); (new Float32Array(buf))[0] = f; return (new Uint32Array(buf))[0]; })(this.zLower);
2458         hashCode += 31 * ( /* floatToIntBits */(function (f) { var buf = new ArrayBuffer(4); (new Float32Array(buf))[0] = f; return (new Uint32Array(buf))[0]; })(this.xUpper) + /* floatToIntBits */ (function (f) { var buf = new ArrayBuffer(4); (new Float32Array(buf))[0] = f; return (new Uint32Array(buf))[0]; })(this.yUpper) + /* floatToIntBits */ (function (f) { var buf = new ArrayBuffer(4); (new Float32Array(buf))[0] = f; return (new Uint32Array(buf))[0]; })(this.zUpper));
2459         return hashCode;
2460     };
2461     return BoxBounds;
2462 }());
2463 BoxBounds["__class"] = "com.eteks.sweethome3d.model.BoxBounds";
2464 /**
2465  * Creates a patterns catalog.
2466  * @param {*[]} patterns
2467  * @class
2468  * @author Emmanuel Puybaret
2469  */
2470 var PatternsCatalog = /** @class */ (function () {
2471     function PatternsCatalog(patterns) {
2472         if (this.patterns === undefined) {
2473             this.patterns = null;
2474         }
2475         this.patterns = (patterns.slice(0));
2476     }
2477     /**
2478      * Returns the patterns list.
2479      * @return {*[]} a list of furniture.
2480      */
2481     PatternsCatalog.prototype.getPatterns = function () {
2482         return /* unmodifiableList */ this.patterns.slice(0);
2483     };
2484     /**
2485      * Returns the count of patterns in this category.
2486      * @return {number}
2487      */
2488     PatternsCatalog.prototype.getPatternsCount = function () {
2489         return /* size */ this.patterns.length;
2490     };
2491     PatternsCatalog.prototype.getPattern$int = function (index) {
2492         return /* get */ this.patterns[index];
2493     };
2494     PatternsCatalog.prototype.getPattern$java_lang_String = function (name) {
2495         for (var index = 0; index < this.patterns.length; index++) {
2496             var pattern = this.patterns[index];
2497             {
2498                 if (name === pattern.getName()) {
2499                     return pattern;
2500                 }
2501             }
2502         }
2503         throw new IllegalArgumentException("No pattern with name " + name);
2504     };
2505     /**
2506      * Returns the pattern with a given <code>name</code>.
2507      * @throws IllegalArgumentException if no pattern with the given <code>name</code> exists
2508      * @param {string} name
2509      * @return {Object}
2510      */
2511     PatternsCatalog.prototype.getPattern = function (name) {
2512         if (((typeof name === 'string') || name === null)) {
2513             return this.getPattern$java_lang_String(name);
2514         }
2515         else if (((typeof name === 'number') || name === null)) {
2516             return this.getPattern$int(name);
2517         }
2518         else
2519             throw new Error('invalid overload');
2520     };
2521     return PatternsCatalog;
2522 }());
2523 PatternsCatalog["__class"] = "com.eteks.sweethome3d.model.PatternsCatalog";
2524 /**
2525  * Create a print attributes for home from the given parameters.
2526  * @param {HomePrint.PaperOrientation} paperOrientation
2527  * @param {number} paperWidth
2528  * @param {number} paperHeight
2529  * @param {number} paperTopMargin
2530  * @param {number} paperLeftMargin
2531  * @param {number} paperBottomMargin
2532  * @param {number} paperRightMargin
2533  * @param {boolean} furniturePrinted
2534  * @param {boolean} planPrinted
2535  * @param {Level[]} printedLevels
2536  * @param {boolean} view3DPrinted
2537  * @param {number} planScale
2538  * @param {string} headerFormat
2539  * @param {string} footerFormat
2540  * @class
2541  * @author Emmanuel Puybaret
2542  */
2543 var HomePrint = /** @class */ (function () {
2544     function HomePrint(paperOrientation, paperWidth, paperHeight, paperTopMargin, paperLeftMargin, paperBottomMargin, paperRightMargin, furniturePrinted, planPrinted, printedLevels, view3DPrinted, planScale, headerFormat, footerFormat) {
2545         if (((typeof paperOrientation === 'number') || paperOrientation === null) && ((typeof paperWidth === 'number') || paperWidth === null) && ((typeof paperHeight === 'number') || paperHeight === null) && ((typeof paperTopMargin === 'number') || paperTopMargin === null) && ((typeof paperLeftMargin === 'number') || paperLeftMargin === null) && ((typeof paperBottomMargin === 'number') || paperBottomMargin === null) && ((typeof paperRightMargin === 'number') || paperRightMargin === null) && ((typeof furniturePrinted === 'boolean') || furniturePrinted === null) && ((typeof planPrinted === 'boolean') || planPrinted === null) && ((printedLevels != null && (printedLevels instanceof Array)) || printedLevels === null) && ((typeof view3DPrinted === 'boolean') || view3DPrinted === null) && ((typeof planScale === 'number') || planScale === null) && ((typeof headerFormat === 'string') || headerFormat === null) && ((typeof footerFormat === 'string') || footerFormat === null)) {
2546             var __args = arguments;
2547             if (this.paperOrientation === undefined) {
2548                 this.paperOrientation = null;
2549             }
2550             if (this.paperWidth === undefined) {
2551                 this.paperWidth = 0;
2552             }
2553             if (this.paperHeight === undefined) {
2554                 this.paperHeight = 0;
2555             }
2556             if (this.paperTopMargin === undefined) {
2557                 this.paperTopMargin = 0;
2558             }
2559             if (this.paperLeftMargin === undefined) {
2560                 this.paperLeftMargin = 0;
2561             }
2562             if (this.paperBottomMargin === undefined) {
2563                 this.paperBottomMargin = 0;
2564             }
2565             if (this.paperRightMargin === undefined) {
2566                 this.paperRightMargin = 0;
2567             }
2568             if (this.furniturePrinted === undefined) {
2569                 this.furniturePrinted = false;
2570             }
2571             if (this.planPrinted === undefined) {
2572                 this.planPrinted = false;
2573             }
2574             if (this.printedLevels === undefined) {
2575                 this.printedLevels = null;
2576             }
2577             if (this.view3DPrinted === undefined) {
2578                 this.view3DPrinted = false;
2579             }
2580             if (this.planScale === undefined) {
2581                 this.planScale = null;
2582             }
2583             if (this.headerFormat === undefined) {
2584                 this.headerFormat = null;
2585             }
2586             if (this.footerFormat === undefined) {
2587                 this.footerFormat = null;
2588             }
2589             this.paperOrientation = paperOrientation;
2590             this.paperWidth = paperWidth;
2591             this.paperHeight = paperHeight;
2592             this.paperTopMargin = paperTopMargin;
2593             this.paperLeftMargin = paperLeftMargin;
2594             this.paperBottomMargin = paperBottomMargin;
2595             this.paperRightMargin = paperRightMargin;
2596             this.furniturePrinted = furniturePrinted;
2597             this.planPrinted = planPrinted;
2598             this.printedLevels = printedLevels != null ? /* unmodifiableList */ printedLevels.slice(0) : null;
2599             this.view3DPrinted = view3DPrinted;
2600             this.planScale = planScale;
2601             this.headerFormat = headerFormat;
2602             this.footerFormat = footerFormat;
2603         }
2604         else if (((typeof paperOrientation === 'number') || paperOrientation === null) && ((typeof paperWidth === 'number') || paperWidth === null) && ((typeof paperHeight === 'number') || paperHeight === null) && ((typeof paperTopMargin === 'number') || paperTopMargin === null) && ((typeof paperLeftMargin === 'number') || paperLeftMargin === null) && ((typeof paperBottomMargin === 'number') || paperBottomMargin === null) && ((typeof paperRightMargin === 'number') || paperRightMargin === null) && ((typeof furniturePrinted === 'boolean') || furniturePrinted === null) && ((typeof planPrinted === 'boolean') || planPrinted === null) && ((typeof printedLevels === 'boolean') || printedLevels === null) && ((typeof view3DPrinted === 'number') || view3DPrinted === null) && ((typeof planScale === 'string') || planScale === null) && ((typeof headerFormat === 'string') || headerFormat === null) && footerFormat === undefined) {
2605             var __args = arguments;
2606             var view3DPrinted_1 = __args[9];
2607             var planScale_1 = __args[10];
2608             var headerFormat_1 = __args[11];
2609             var footerFormat_1 = __args[12];
2610             {
2611                 var __args_2 = arguments;
2612                 var printedLevels_1 = null;
2613                 if (this.paperOrientation === undefined) {
2614                     this.paperOrientation = null;
2615                 }
2616                 if (this.paperWidth === undefined) {
2617                     this.paperWidth = 0;
2618                 }
2619                 if (this.paperHeight === undefined) {
2620                     this.paperHeight = 0;
2621                 }
2622                 if (this.paperTopMargin === undefined) {
2623                     this.paperTopMargin = 0;
2624                 }
2625                 if (this.paperLeftMargin === undefined) {
2626                     this.paperLeftMargin = 0;
2627                 }
2628                 if (this.paperBottomMargin === undefined) {
2629                     this.paperBottomMargin = 0;
2630                 }
2631                 if (this.paperRightMargin === undefined) {
2632                     this.paperRightMargin = 0;
2633                 }
2634                 if (this.furniturePrinted === undefined) {
2635                     this.furniturePrinted = false;
2636                 }
2637                 if (this.planPrinted === undefined) {
2638                     this.planPrinted = false;
2639                 }
2640                 if (this.printedLevels === undefined) {
2641                     this.printedLevels = null;
2642                 }
2643                 if (this.view3DPrinted === undefined) {
2644                     this.view3DPrinted = false;
2645                 }
2646                 if (this.planScale === undefined) {
2647                     this.planScale = null;
2648                 }
2649                 if (this.headerFormat === undefined) {
2650                     this.headerFormat = null;
2651                 }
2652                 if (this.footerFormat === undefined) {
2653                     this.footerFormat = null;
2654                 }
2655                 this.paperOrientation = paperOrientation;
2656                 this.paperWidth = paperWidth;
2657                 this.paperHeight = paperHeight;
2658                 this.paperTopMargin = paperTopMargin;
2659                 this.paperLeftMargin = paperLeftMargin;
2660                 this.paperBottomMargin = paperBottomMargin;
2661                 this.paperRightMargin = paperRightMargin;
2662                 this.furniturePrinted = furniturePrinted;
2663                 this.planPrinted = planPrinted;
2664                 this.printedLevels = printedLevels_1 != null ? /* unmodifiableList */ printedLevels_1.slice(0) : null;
2665                 this.view3DPrinted = view3DPrinted_1;
2666                 this.planScale = planScale_1;
2667                 this.headerFormat = headerFormat_1;
2668                 this.footerFormat = footerFormat_1;
2669             }
2670             if (this.paperOrientation === undefined) {
2671                 this.paperOrientation = null;
2672             }
2673             if (this.paperWidth === undefined) {
2674                 this.paperWidth = 0;
2675             }
2676             if (this.paperHeight === undefined) {
2677                 this.paperHeight = 0;
2678             }
2679             if (this.paperTopMargin === undefined) {
2680                 this.paperTopMargin = 0;
2681             }
2682             if (this.paperLeftMargin === undefined) {
2683                 this.paperLeftMargin = 0;
2684             }
2685             if (this.paperBottomMargin === undefined) {
2686                 this.paperBottomMargin = 0;
2687             }
2688             if (this.paperRightMargin === undefined) {
2689                 this.paperRightMargin = 0;
2690             }
2691             if (this.furniturePrinted === undefined) {
2692                 this.furniturePrinted = false;
2693             }
2694             if (this.planPrinted === undefined) {
2695                 this.planPrinted = false;
2696             }
2697             if (this.printedLevels === undefined) {
2698                 this.printedLevels = null;
2699             }
2700             if (this.view3DPrinted === undefined) {
2701                 this.view3DPrinted = false;
2702             }
2703             if (this.planScale === undefined) {
2704                 this.planScale = null;
2705             }
2706             if (this.headerFormat === undefined) {
2707                 this.headerFormat = null;
2708             }
2709             if (this.footerFormat === undefined) {
2710                 this.footerFormat = null;
2711             }
2712         }
2713         else
2714             throw new Error('invalid overload');
2715     }
2716     /**
2717      * Returns the paper orientation.
2718      * @return {HomePrint.PaperOrientation}
2719      */
2720     HomePrint.prototype.getPaperOrientation = function () {
2721         return this.paperOrientation;
2722     };
2723     /**
2724      * Returns the margin at paper bottom in 1/72nds of an inch.
2725      * @return {number}
2726      */
2727     HomePrint.prototype.getPaperBottomMargin = function () {
2728         return this.paperBottomMargin;
2729     };
2730     /**
2731      * Returns the paper height in 1/72nds of an inch.
2732      * @return {number}
2733      */
2734     HomePrint.prototype.getPaperHeight = function () {
2735         return this.paperHeight;
2736     };
2737     /**
2738      * Returns the margin at paper left in 1/72nds of an inch.
2739      * @return {number}
2740      */
2741     HomePrint.prototype.getPaperLeftMargin = function () {
2742         return this.paperLeftMargin;
2743     };
2744     /**
2745      * Returns the margin at paper right in 1/72nds of an inch.
2746      * @return {number}
2747      */
2748     HomePrint.prototype.getPaperRightMargin = function () {
2749         return this.paperRightMargin;
2750     };
2751     /**
2752      * Returns the margin at paper top in 1/72nds of an inch.
2753      * @return {number}
2754      */
2755     HomePrint.prototype.getPaperTopMargin = function () {
2756         return this.paperTopMargin;
2757     };
2758     /**
2759      * Returns the paper width in 1/72nds of an inch.
2760      * @return {number}
2761      */
2762     HomePrint.prototype.getPaperWidth = function () {
2763         return this.paperWidth;
2764     };
2765     /**
2766      * Returns whether home furniture should be printed or not.
2767      * @return {boolean}
2768      */
2769     HomePrint.prototype.isFurniturePrinted = function () {
2770         return this.furniturePrinted;
2771     };
2772     /**
2773      * Returns whether home plan should be printed or not.
2774      * @return {boolean}
2775      */
2776     HomePrint.prototype.isPlanPrinted = function () {
2777         return this.planPrinted;
2778     };
2779     /**
2780      * Returns the printed levels or <code>null</code> if all levels should be printed.
2781      * @return {Level[]}
2782      */
2783     HomePrint.prototype.getPrintedLevels = function () {
2784         return this.printedLevels;
2785     };
2786     /**
2787      * Returns whether home 3D view should be printed or not.
2788      * @return {boolean}
2789      */
2790     HomePrint.prototype.isView3DPrinted = function () {
2791         return this.view3DPrinted;
2792     };
2793     /**
2794      * Returns the scale used to print home plan or
2795      * <code>null</code> if no special scale is desired.
2796      * @return {number}
2797      */
2798     HomePrint.prototype.getPlanScale = function () {
2799         return this.planScale;
2800     };
2801     /**
2802      * Returns the string format used to print page headers.
2803      * @return {string}
2804      */
2805     HomePrint.prototype.getHeaderFormat = function () {
2806         return this.headerFormat;
2807     };
2808     /**
2809      * Returns the string format used to print page footers.
2810      * @return {string}
2811      */
2812     HomePrint.prototype.getFooterFormat = function () {
2813         return this.footerFormat;
2814     };
2815     return HomePrint;
2816 }());
2817 HomePrint["__class"] = "com.eteks.sweethome3d.model.HomePrint";
2818 (function (HomePrint) {
2819     /**
2820      * Paper orientation.
2821      * @enum
2822      * @property {HomePrint.PaperOrientation} PORTRAIT
2823      * @property {HomePrint.PaperOrientation} LANDSCAPE
2824      * @property {HomePrint.PaperOrientation} REVERSE_LANDSCAPE
2825      * @class
2826      */
2827     var PaperOrientation;
2828     (function (PaperOrientation) {
2829         PaperOrientation[PaperOrientation["PORTRAIT"] = 0] = "PORTRAIT";
2830         PaperOrientation[PaperOrientation["LANDSCAPE"] = 1] = "LANDSCAPE";
2831         PaperOrientation[PaperOrientation["REVERSE_LANDSCAPE"] = 2] = "REVERSE_LANDSCAPE";
2832     })(PaperOrientation = HomePrint.PaperOrientation || (HomePrint.PaperOrientation = {}));
2833 })(HomePrint || (HomePrint = {}));
2834 /**
2835  * Create a category.
2836  * @param {string} name the name of the category.
2837  * @class
2838  * @author Emmanuel Puybaret
2839  */
2840 var TexturesCategory = /** @class */ (function () {
2841     function TexturesCategory(name) {
2842         if (this.name === undefined) {
2843             this.name = null;
2844         }
2845         if (this.textures === undefined) {
2846             this.textures = null;
2847         }
2848         this.name = name;
2849         this.textures = ([]);
2850     }
2851     TexturesCategory.COMPARATOR_$LI$ = function () { if (TexturesCategory.COMPARATOR == null) {
2852         TexturesCategory.COMPARATOR = /* getInstance */ { compare: function (o1, o2) { return o1.toString().localeCompare(o2.toString()); }, equals: function (o1, o2) { return o1.toString().localeCompare(o2.toString()) === 0; } };
2853     } return TexturesCategory.COMPARATOR; };
2854     /**
2855      * Returns the name of this category.
2856      * @return {string}
2857      */
2858     TexturesCategory.prototype.getName = function () {
2859         return this.name;
2860     };
2861     /**
2862      * Returns the textures list of this category sorted by name.
2863      * @return {CatalogTexture[]} a list of furniture.
2864      */
2865     TexturesCategory.prototype.getTextures = function () {
2866         return /* unmodifiableList */ this.textures.slice(0);
2867     };
2868     /**
2869      * Returns the count of textures in this category.
2870      * @return {number}
2871      */
2872     TexturesCategory.prototype.getTexturesCount = function () {
2873         return /* size */ this.textures.length;
2874     };
2875     /**
2876      * Returns the texture at a given <code>index</code>.
2877      * @param {number} index
2878      * @return {CatalogTexture}
2879      */
2880     TexturesCategory.prototype.getTexture = function (index) {
2881         return /* get */ this.textures[index];
2882     };
2883     /**
2884      * Returns the index of the given <code>texture</code>.
2885      * @param {CatalogTexture} texture
2886      * @return {number}
2887      */
2888     TexturesCategory.prototype.getIndexOfTexture = function (texture) {
2889         return this.textures.indexOf(texture);
2890     };
2891     /**
2892      * Adds a texture to this category.
2893      * @param {CatalogTexture} texture the texture to add.
2894      * @private
2895      */
2896     TexturesCategory.prototype.add = function (texture) {
2897         texture.setCategory(this);
2898         var index = (function (l, key) { var comp = function (a, b) { if (a.compareTo)
2899             return a.compareTo(b);
2900         else
2901             return a.localeCompare(b); }; var low = 0; var high = l.length - 1; while (low <= high) {
2902             var mid = (low + high) >>> 1;
2903             var midVal = l[mid];
2904             var cmp = comp(midVal, key);
2905             if (cmp < 0)
2906                 low = mid + 1;
2907             else if (cmp > 0)
2908                 high = mid - 1;
2909             else
2910                 return mid;
2911         } return -(low + 1); })(this.textures, texture);
2912         if (index < 0) {
2913             index = -index - 1;
2914         }
2915         /* add */ this.textures.splice(index, 0, texture);
2916     };
2917     /**
2918      * Deletes a texture from this category.
2919      * @param {CatalogTexture} texture the texture to remove.
2920      * @throws IllegalArgumentException if the texture doesn't exist in this category.
2921      * @private
2922      */
2923     TexturesCategory.prototype["delete"] = function (texture) {
2924         var textureIndex = this.textures.indexOf(texture);
2925         if (textureIndex === -1) {
2926             throw new IllegalArgumentException(this.name + " doesn\'t contain texture " + texture.getName());
2927         }
2928         this.textures = (this.textures.slice(0));
2929         /* remove */ this.textures.splice(textureIndex, 1)[0];
2930     };
2931     /**
2932      * Returns true if this category and the one in parameter have the same name.
2933      * @param {Object} obj
2934      * @return {boolean}
2935      */
2936     TexturesCategory.prototype.equals = function (obj) {
2937         return (obj != null && obj instanceof TexturesCategory) && TexturesCategory.COMPARATOR_$LI$().equals(this.name, obj.name);
2938     };
2939     /**
2940      *
2941      * @return {number}
2942      */
2943     TexturesCategory.prototype.hashCode = function () {
2944         return /* hashCode */ (function (o) { if (o.hashCode) {
2945             return o.hashCode();
2946         }
2947         else {
2948             return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
2949         } })(this.name);
2950     };
2951     /**
2952      * Compares the names of this category and the one in parameter.
2953      * @param {TexturesCategory} category
2954      * @return {number}
2955      */
2956     TexturesCategory.prototype.compareTo = function (category) {
2957         return TexturesCategory.COMPARATOR_$LI$().compare(this.name, category.name);
2958     };
2959     return TexturesCategory;
2960 }());
2961 TexturesCategory["__class"] = "com.eteks.sweethome3d.model.TexturesCategory";
2962 var HomeRecorder;
2963 (function (HomeRecorder) {
2964     /**
2965      * Recorder type used as a hint to select a home recorder.
2966      * @enum
2967      * @property {HomeRecorder.Type} DEFAULT
2968      * The default recorder type.
2969      * @property {HomeRecorder.Type} COMPRESSED
2970      * A recorder type able to compress home data.
2971      * @class
2972      */
2973     var Type;
2974     (function (Type) {
2975         /**
2976          * The default recorder type.
2977          */
2978         Type[Type["DEFAULT"] = 0] = "DEFAULT";
2979         /**
2980          * A recorder type able to compress home data.
2981          */
2982         Type[Type["COMPRESSED"] = 1] = "COMPRESSED";
2983     })(Type = HomeRecorder.Type || (HomeRecorder.Type = {}));
2984 })(HomeRecorder || (HomeRecorder = {}));
2985 /**
2986  * Creates a catalog texture.
2987  * @param {string} id the ID of this texture
2988  * @param {string} name the name of this texture
2989  * @param {Object} image the content of the image used for this texture
2990  * @param {number} width the width of the texture in centimeters
2991  * @param {number} height the height of the texture in centimeters
2992  * @param {boolean} modifiable <code>true</code> if this texture can be modified
2993  * @param {string} creator
2994  * @class
2995  * @author Emmanuel Puybaret
2996  */
2997 var CatalogTexture = /** @class */ (function () {
2998     function CatalogTexture(id, name, image, width, height, creator, modifiable) {
2999         if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((image != null && (image.constructor != null && image.constructor["__interfaces"] != null && image.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || image === null) && ((typeof width === 'number') || width === null) && ((typeof height === 'number') || height === null) && ((typeof creator === 'string') || creator === null) && ((typeof modifiable === 'boolean') || modifiable === null)) {
3000             var __args = arguments;
3001             if (this.id === undefined) {
3002                 this.id = null;
3003             }
3004             if (this.name === undefined) {
3005                 this.name = null;
3006             }
3007             if (this.image === undefined) {
3008                 this.image = null;
3009             }
3010             if (this.width === undefined) {
3011                 this.width = 0;
3012             }
3013             if (this.height === undefined) {
3014                 this.height = 0;
3015             }
3016             if (this.creator === undefined) {
3017                 this.creator = null;
3018             }
3019             if (this.modifiable === undefined) {
3020                 this.modifiable = false;
3021             }
3022             if (this.category === undefined) {
3023                 this.category = null;
3024             }
3025             if (this.filterCollationKey === undefined) {
3026                 this.filterCollationKey = null;
3027             }
3028             this.id = id;
3029             this.name = name;
3030             this.image = image;
3031             this.width = width;
3032             this.height = height;
3033             this.creator = creator;
3034             this.modifiable = modifiable;
3035         }
3036         else if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((image != null && (image.constructor != null && image.constructor["__interfaces"] != null && image.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || image === null) && ((typeof width === 'number') || width === null) && ((typeof height === 'number') || height === null) && ((typeof creator === 'string') || creator === null) && modifiable === undefined) {
3037             var __args = arguments;
3038             {
3039                 var __args_3 = arguments;
3040                 var modifiable_1 = false;
3041                 if (this.id === undefined) {
3042                     this.id = null;
3043                 }
3044                 if (this.name === undefined) {
3045                     this.name = null;
3046                 }
3047                 if (this.image === undefined) {
3048                     this.image = null;
3049                 }
3050                 if (this.width === undefined) {
3051                     this.width = 0;
3052                 }
3053                 if (this.height === undefined) {
3054                     this.height = 0;
3055                 }
3056                 if (this.creator === undefined) {
3057                     this.creator = null;
3058                 }
3059                 if (this.modifiable === undefined) {
3060                     this.modifiable = false;
3061                 }
3062                 if (this.category === undefined) {
3063                     this.category = null;
3064                 }
3065                 if (this.filterCollationKey === undefined) {
3066                     this.filterCollationKey = null;
3067                 }
3068                 this.id = id;
3069                 this.name = name;
3070                 this.image = image;
3071                 this.width = width;
3072                 this.height = height;
3073                 this.creator = creator;
3074                 this.modifiable = modifiable_1;
3075             }
3076             if (this.id === undefined) {
3077                 this.id = null;
3078             }
3079             if (this.name === undefined) {
3080                 this.name = null;
3081             }
3082             if (this.image === undefined) {
3083                 this.image = null;
3084             }
3085             if (this.width === undefined) {
3086                 this.width = 0;
3087             }
3088             if (this.height === undefined) {
3089                 this.height = 0;
3090             }
3091             if (this.creator === undefined) {
3092                 this.creator = null;
3093             }
3094             if (this.modifiable === undefined) {
3095                 this.modifiable = false;
3096             }
3097             if (this.category === undefined) {
3098                 this.category = null;
3099             }
3100             if (this.filterCollationKey === undefined) {
3101                 this.filterCollationKey = null;
3102             }
3103         }
3104         else if (((typeof id === 'string') || id === null) && ((name != null && (name.constructor != null && name.constructor["__interfaces"] != null && name.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || name === null) && ((typeof image === 'number') || image === null) && ((typeof width === 'number') || width === null) && ((typeof height === 'boolean') || height === null) && creator === undefined && modifiable === undefined) {
3105             var __args = arguments;
3106             var name_1 = __args[0];
3107             var image_1 = __args[1];
3108             var width_1 = __args[2];
3109             var height_1 = __args[3];
3110             var modifiable_2 = __args[4];
3111             {
3112                 var __args_4 = arguments;
3113                 var id_1 = null;
3114                 var creator_1 = null;
3115                 if (this.id === undefined) {
3116                     this.id = null;
3117                 }
3118                 if (this.name === undefined) {
3119                     this.name = null;
3120                 }
3121                 if (this.image === undefined) {
3122                     this.image = null;
3123                 }
3124                 if (this.width === undefined) {
3125                     this.width = 0;
3126                 }
3127                 if (this.height === undefined) {
3128                     this.height = 0;
3129                 }
3130                 if (this.creator === undefined) {
3131                     this.creator = null;
3132                 }
3133                 if (this.modifiable === undefined) {
3134                     this.modifiable = false;
3135                 }
3136                 if (this.category === undefined) {
3137                     this.category = null;
3138                 }
3139                 if (this.filterCollationKey === undefined) {
3140                     this.filterCollationKey = null;
3141                 }
3142                 this.id = id_1;
3143                 this.name = name_1;
3144                 this.image = image_1;
3145                 this.width = width_1;
3146                 this.height = height_1;
3147                 this.creator = creator_1;
3148                 this.modifiable = modifiable_2;
3149             }
3150             if (this.id === undefined) {
3151                 this.id = null;
3152             }
3153             if (this.name === undefined) {
3154                 this.name = null;
3155             }
3156             if (this.image === undefined) {
3157                 this.image = null;
3158             }
3159             if (this.width === undefined) {
3160                 this.width = 0;
3161             }
3162             if (this.height === undefined) {
3163                 this.height = 0;
3164             }
3165             if (this.creator === undefined) {
3166                 this.creator = null;
3167             }
3168             if (this.modifiable === undefined) {
3169                 this.modifiable = false;
3170             }
3171             if (this.category === undefined) {
3172                 this.category = null;
3173             }
3174             if (this.filterCollationKey === undefined) {
3175                 this.filterCollationKey = null;
3176             }
3177         }
3178         else if (((typeof id === 'string') || id === null) && ((name != null && (name.constructor != null && name.constructor["__interfaces"] != null && name.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || name === null) && ((typeof image === 'number') || image === null) && ((typeof width === 'number') || width === null) && height === undefined && creator === undefined && modifiable === undefined) {
3179             var __args = arguments;
3180             var name_2 = __args[0];
3181             var image_2 = __args[1];
3182             var width_2 = __args[2];
3183             var height_2 = __args[3];
3184             {
3185                 var __args_5 = arguments;
3186                 var id_2 = null;
3187                 var creator_2 = null;
3188                 {
3189                     var __args_6 = arguments;
3190                     var modifiable_3 = false;
3191                     if (this.id === undefined) {
3192                         this.id = null;
3193                     }
3194                     if (this.name === undefined) {
3195                         this.name = null;
3196                     }
3197                     if (this.image === undefined) {
3198                         this.image = null;
3199                     }
3200                     if (this.width === undefined) {
3201                         this.width = 0;
3202                     }
3203                     if (this.height === undefined) {
3204                         this.height = 0;
3205                     }
3206                     if (this.creator === undefined) {
3207                         this.creator = null;
3208                     }
3209                     if (this.modifiable === undefined) {
3210                         this.modifiable = false;
3211                     }
3212                     if (this.category === undefined) {
3213                         this.category = null;
3214                     }
3215                     if (this.filterCollationKey === undefined) {
3216                         this.filterCollationKey = null;
3217                     }
3218                     this.id = id_2;
3219                     this.name = name_2;
3220                     this.image = image_2;
3221                     this.width = width_2;
3222                     this.height = height_2;
3223                     this.creator = creator_2;
3224                     this.modifiable = modifiable_3;
3225                 }
3226                 if (this.id === undefined) {
3227                     this.id = null;
3228                 }
3229                 if (this.name === undefined) {
3230                     this.name = null;
3231                 }
3232                 if (this.image === undefined) {
3233                     this.image = null;
3234                 }
3235                 if (this.width === undefined) {
3236                     this.width = 0;
3237                 }
3238                 if (this.height === undefined) {
3239                     this.height = 0;
3240                 }
3241                 if (this.creator === undefined) {
3242                     this.creator = null;
3243                 }
3244                 if (this.modifiable === undefined) {
3245                     this.modifiable = false;
3246                 }
3247                 if (this.category === undefined) {
3248                     this.category = null;
3249                 }
3250                 if (this.filterCollationKey === undefined) {
3251                     this.filterCollationKey = null;
3252                 }
3253             }
3254             if (this.id === undefined) {
3255                 this.id = null;
3256             }
3257             if (this.name === undefined) {
3258                 this.name = null;
3259             }
3260             if (this.image === undefined) {
3261                 this.image = null;
3262             }
3263             if (this.width === undefined) {
3264                 this.width = 0;
3265             }
3266             if (this.height === undefined) {
3267                 this.height = 0;
3268             }
3269             if (this.creator === undefined) {
3270                 this.creator = null;
3271             }
3272             if (this.modifiable === undefined) {
3273                 this.modifiable = false;
3274             }
3275             if (this.category === undefined) {
3276                 this.category = null;
3277             }
3278             if (this.filterCollationKey === undefined) {
3279                 this.filterCollationKey = null;
3280             }
3281         }
3282         else
3283             throw new Error('invalid overload');
3284     }
3285     CatalogTexture.__static_initialize = function () { if (!CatalogTexture.__static_initialized) {
3286         CatalogTexture.__static_initialized = true;
3287         CatalogTexture.__static_initializer_0();
3288     } };
3289     CatalogTexture.EMPTY_CRITERIA_$LI$ = function () { CatalogTexture.__static_initialize(); if (CatalogTexture.EMPTY_CRITERIA == null) {
3290         CatalogTexture.EMPTY_CRITERIA = [];
3291     } return CatalogTexture.EMPTY_CRITERIA; };
3292     CatalogTexture.COMPARATOR_$LI$ = function () { CatalogTexture.__static_initialize(); return CatalogTexture.COMPARATOR; };
3293     CatalogTexture.recentFilters_$LI$ = function () { CatalogTexture.__static_initialize(); return CatalogTexture.recentFilters; };
3294     CatalogTexture.__static_initializer_0 = function () {
3295         CatalogTexture.COMPARATOR = /* getInstance */ { compare: function (o1, o2) { return o1.toString().localeCompare(o2.toString()); }, equals: function (o1, o2) { return o1.toString().localeCompare(o2.toString()) === 0; } };
3296         /* setStrength */ CatalogTexture.COMPARATOR_$LI$();
3297         CatalogTexture.recentFilters = {};
3298     };
3299     /**
3300      * Returns the ID of this texture or <code>null</code>.
3301      * @return {string}
3302      */
3303     CatalogTexture.prototype.getId = function () {
3304         return this.id;
3305     };
3306     /**
3307      * Returns the name of this texture.
3308      * @return {string}
3309      */
3310     CatalogTexture.prototype.getName = function () {
3311         return this.name;
3312     };
3313     /**
3314      * Returns the content of the image used for this texture.
3315      * @return {Object}
3316      */
3317     CatalogTexture.prototype.getImage = function () {
3318         return this.image;
3319     };
3320     /**
3321      * Returns the icon of this texture.
3322      * @return {Object} the image of this texture.
3323      */
3324     CatalogTexture.prototype.getIcon = function () {
3325         return this.getImage();
3326     };
3327     /**
3328      * Returns the width of the image in centimeters.
3329      * @return {number}
3330      */
3331     CatalogTexture.prototype.getWidth = function () {
3332         return this.width;
3333     };
3334     /**
3335      * Returns the height of the image in centimeters.
3336      * @return {number}
3337      */
3338     CatalogTexture.prototype.getHeight = function () {
3339         return this.height;
3340     };
3341     /**
3342      * Returns the creator of this texture or <code>null</code>.
3343      * @return {string}
3344      */
3345     CatalogTexture.prototype.getCreator = function () {
3346         return this.creator;
3347     };
3348     /**
3349      * Returns <code>true</code> if this texture is modifiable (not read from resources).
3350      * @return {boolean}
3351      */
3352     CatalogTexture.prototype.isModifiable = function () {
3353         return this.modifiable;
3354     };
3355     /**
3356      * Returns the category of this texture.
3357      * @return {TexturesCategory}
3358      */
3359     CatalogTexture.prototype.getCategory = function () {
3360         return this.category;
3361     };
3362     /**
3363      * Sets the category of this texture.
3364      * @param {TexturesCategory} category
3365      * @private
3366      */
3367     CatalogTexture.prototype.setCategory = function (category) {
3368         this.category = category;
3369     };
3370     /**
3371      * Returns true if this texture and the one in parameter are the same objects.
3372      * Note that, from version 3.6, two textures can have the same name.
3373      * @param {Object} obj
3374      * @return {boolean}
3375      */
3376     CatalogTexture.prototype.equals = function (obj) {
3377         return /* equals */ (function (o1, o2) { return o1 && o1.equals ? o1.equals(o2) : o1 === o2; })(this, obj);
3378     };
3379     /**
3380      * Returns default hash code.
3381      * @return {number}
3382      */
3383     CatalogTexture.prototype.hashCode = function () {
3384         return /* hashCode */ (function (o) { if (o.hashCode) {
3385             return o.hashCode();
3386         }
3387         else {
3388             return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
3389         } })(this);
3390     };
3391     /**
3392      * Compares the names of this texture and the one in parameter.
3393      * @param {CatalogTexture} texture
3394      * @return {number}
3395      */
3396     CatalogTexture.prototype.compareTo = function (texture) {
3397         var nameComparison = CatalogTexture.COMPARATOR_$LI$().compare(this.name, texture.name);
3398         if (nameComparison !== 0) {
3399             return nameComparison;
3400         }
3401         else {
3402             return this.modifiable === texture.modifiable ? 0 : (this.modifiable ? 1 : -1);
3403         }
3404     };
3405     /**
3406      * Returns <code>true</code> if this texture matches the given <code>filter</code> text.
3407      * Each substring of the <code>filter</code> is considered as a search criterion that can match
3408      * the name, the category name or the creator of this texture.
3409      * @param {string} filter
3410      * @return {boolean}
3411      */
3412     CatalogTexture.prototype.matchesFilter = function (filter) {
3413         var filterCriteriaCollationKeys = this.getFilterCollationKeys(filter);
3414         var checkedCriteria = 0;
3415         if (filterCriteriaCollationKeys.length > 0) {
3416             var furnitureCollationKey = this.getTextureCollationKey();
3417             for (var i = 0; i < filterCriteriaCollationKeys.length; i++) {
3418                 {
3419                     if (this.isSubCollationKey(furnitureCollationKey, filterCriteriaCollationKeys[i], 0)) {
3420                         checkedCriteria++;
3421                     }
3422                     else {
3423                         break;
3424                     }
3425                 }
3426                 ;
3427             }
3428         }
3429         return checkedCriteria === filterCriteriaCollationKeys.length;
3430     };
3431     /**
3432      * Returns the collation key bytes of each criterion in the given <code>filter</code>.
3433      * @param {string} filter
3434      * @return {byte[][]}
3435      * @private
3436      */
3437     /*private*/ CatalogTexture.prototype.getFilterCollationKeys = function (filter) {
3438         if (filter.length === 0) {
3439             return CatalogTexture.EMPTY_CRITERIA_$LI$();
3440         }
3441         var filterCollationKeys = (function (m, k) { return m[k] === undefined ? null : m[k]; })(CatalogTexture.recentFilters_$LI$(), filter);
3442         if (filterCollationKeys == null) {
3443             var filterCriteria = filter.split(/\s|\p{Punct}|\\|/);
3444             var filterCriteriaCollationKeys = ([]);
3445             for (var index = 0; index < filterCriteria.length; index++) {
3446                 var criterion = filterCriteria[index];
3447                 {
3448                     if (criterion.length > 0) {
3449                         /* add */ (filterCriteriaCollationKeys.push(CatalogTexture.COMPARATOR_$LI$().getCollationKey(criterion).toByteArray()) > 0);
3450                     }
3451                 }
3452             }
3453             if ( /* size */filterCriteriaCollationKeys.length === 0) {
3454                 filterCollationKeys = CatalogTexture.EMPTY_CRITERIA_$LI$();
3455             }
3456             else {
3457                 filterCollationKeys = /* toArray */ filterCriteriaCollationKeys.slice(0);
3458             }
3459             /* put */ (CatalogTexture.recentFilters_$LI$()[filter] = filterCollationKeys);
3460         }
3461         return filterCollationKeys;
3462     };
3463     /**
3464      * Returns the collation key bytes used to compare the given <code>texture</code> with filter.
3465      * @return {byte[]}
3466      * @private
3467      */
3468     /*private*/ CatalogTexture.prototype.getTextureCollationKey = function () {
3469         var _this = this;
3470         if (this.filterCollationKey == null) {
3471             var search = { str: "", toString: function () { return this.str; } };
3472             /* append */ (function (sb) { sb.str += _this.getName(); return sb; })(search);
3473             /* append */ (function (sb) { sb.str += '|'; return sb; })(search);
3474             if (this.getCategory() != null) {
3475                 /* append */ (function (sb) { sb.str += _this.getCategory().getName(); return sb; })(search);
3476                 /* append */ (function (sb) { sb.str += '|'; return sb; })(search);
3477             }
3478             if (this.getCreator() != null) {
3479                 /* append */ (function (sb) { sb.str += _this.getCreator(); return sb; })(search);
3480                 /* append */ (function (sb) { sb.str += '|'; return sb; })(search);
3481             }
3482             this.filterCollationKey = CatalogTexture.COMPARATOR_$LI$().getCollationKey(/* toString */ search.str).toByteArray();
3483         }
3484         return this.filterCollationKey;
3485     };
3486     /**
3487      * Returns <code>true</code> if the given filter collation key is a sub part of the first array collator key.
3488      * @param {byte[]} collationKey
3489      * @param {byte[]} filterCollationKey
3490      * @param {number} start
3491      * @return {boolean}
3492      * @private
3493      */
3494     /*private*/ CatalogTexture.prototype.isSubCollationKey = function (collationKey, filterCollationKey, start) {
3495         for (var i = start, n = collationKey.length - 4, m = filterCollationKey.length - 4; i < n && i < n - m + 1; i++) {
3496             {
3497                 if (collationKey[i] === filterCollationKey[0]) {
3498                     for (var j = 1; j < m; j++) {
3499                         {
3500                             if (collationKey[i + j] !== filterCollationKey[j]) {
3501                                 return this.isSubCollationKey(collationKey, filterCollationKey, i + 1);
3502                             }
3503                         }
3504                         ;
3505                     }
3506                     return true;
3507                 }
3508             }
3509             ;
3510         }
3511         return false;
3512     };
3513     CatalogTexture.__static_initialized = false;
3514     return CatalogTexture;
3515 }());
3516 CatalogTexture["__class"] = "com.eteks.sweethome3d.model.CatalogTexture";
3517 CatalogTexture["__interfaces"] = ["com.eteks.sweethome3d.model.CatalogItem", "com.eteks.sweethome3d.model.TextureImage"];
3518 /**
3519  * Creates a material instance from parameters.
3520  * @param {string} name
3521  * @param {float[][]} matrix
3522  * @class
3523  * @author Emmanuel Puybaret
3524  */
3525 var Transformation = /** @class */ (function () {
3526     function Transformation(name, matrix) {
3527         if (this.name === undefined) {
3528             this.name = null;
3529         }
3530         if (this.matrix === undefined) {
3531             this.matrix = null;
3532         }
3533         this.name = name;
3534         this.matrix = matrix;
3535     }
3536     /**
3537      * Returns the name of this transformation.
3538      * @return {string} the name of the transformation.
3539      */
3540     Transformation.prototype.getName = function () {
3541         return this.name;
3542     };
3543     /**
3544      * Returns the matrix of this transformation.
3545      * @return {float[][]} a 4x3 float array.
3546      */
3547     Transformation.prototype.getMatrix = function () {
3548         return [[this.matrix[0][0], this.matrix[0][1], this.matrix[0][2], this.matrix[0][3]], [this.matrix[1][0], this.matrix[1][1], this.matrix[1][2], this.matrix[1][3]], [this.matrix[2][0], this.matrix[2][1], this.matrix[2][2], this.matrix[2][3]]];
3549     };
3550     /**
3551      * Returns <code>true</code> if this transformation is equal to <code>object</code>.
3552      * @param {Object} object
3553      * @return {boolean}
3554      */
3555     Transformation.prototype.equals = function (object) {
3556         if (object != null && object instanceof Transformation) {
3557             var transformation = object;
3558             if (transformation.name === this.name) {
3559                 for (var i = 0; i < this.matrix.length; i++) {
3560                     {
3561                         for (var j = 0; j < this.matrix[i].length; j++) {
3562                             {
3563                                 if (transformation.matrix[i][j] !== this.matrix[i][j]) {
3564                                     return false;
3565                                 }
3566                             }
3567                             ;
3568                         }
3569                     }
3570                     ;
3571                 }
3572                 return true;
3573             }
3574         }
3575         return false;
3576     };
3577     /**
3578      * Returns a hash code for this transformation.
3579      * @return {number}
3580      */
3581     Transformation.prototype.hashCode = function () {
3582         return /* hashCode */ (function (o) { if (o.hashCode) {
3583             return o.hashCode();
3584         }
3585         else {
3586             return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
3587         } })(this.name) + /* deepHashCode */ (function (array) { function deepHashCode(array) { if (array == null)
3588             return 0; var hashCode = 1; for (var i = 0; i < array.length; i++) {
3589             var elementHashCode = 1;
3590             if (Array.isArray(array[i]))
3591                 elementHashCode = deepHashCode(array[i]);
3592             else if (typeof array[i] == 'number')
3593                 elementHashCode = (array[i] * 1000) | 0;
3594             hashCode = 31 * hashCode + elementHashCode;
3595         } return hashCode; } return deepHashCode; })(this.matrix);
3596     };
3597     return Transformation;
3598 }());
3599 Transformation["__class"] = "com.eteks.sweethome3d.model.Transformation";
3600 /**
3601  * Creates a new light source.
3602  * @param {number} x
3603  * @param {number} y
3604  * @param {number} z
3605  * @param {number} color
3606  * @param {number} diameter
3607  * @class
3608  * @author Emmanuel Puybaret
3609  */
3610 var LightSource = /** @class */ (function () {
3611     function LightSource(x, y, z, color, diameter) {
3612         if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof z === 'number') || z === null) && ((typeof color === 'number') || color === null) && ((typeof diameter === 'number') || diameter === null)) {
3613             var __args = arguments;
3614             if (this.x === undefined) {
3615                 this.x = 0;
3616             }
3617             if (this.y === undefined) {
3618                 this.y = 0;
3619             }
3620             if (this.z === undefined) {
3621                 this.z = 0;
3622             }
3623             if (this.color === undefined) {
3624                 this.color = 0;
3625             }
3626             if (this.diameter === undefined) {
3627                 this.diameter = null;
3628             }
3629             this.x = x;
3630             this.y = y;
3631             this.z = z;
3632             this.color = color;
3633             this.diameter = diameter;
3634         }
3635         else if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof z === 'number') || z === null) && ((typeof color === 'number') || color === null) && diameter === undefined) {
3636             var __args = arguments;
3637             {
3638                 var __args_7 = arguments;
3639                 var diameter_1 = null;
3640                 if (this.x === undefined) {
3641                     this.x = 0;
3642                 }
3643                 if (this.y === undefined) {
3644                     this.y = 0;
3645                 }
3646                 if (this.z === undefined) {
3647                     this.z = 0;
3648                 }
3649                 if (this.color === undefined) {
3650                     this.color = 0;
3651                 }
3652                 if (this.diameter === undefined) {
3653                     this.diameter = null;
3654                 }
3655                 this.x = x;
3656                 this.y = y;
3657                 this.z = z;
3658                 this.color = color;
3659                 this.diameter = diameter_1;
3660             }
3661             if (this.x === undefined) {
3662                 this.x = 0;
3663             }
3664             if (this.y === undefined) {
3665                 this.y = 0;
3666             }
3667             if (this.z === undefined) {
3668                 this.z = 0;
3669             }
3670             if (this.color === undefined) {
3671                 this.color = 0;
3672             }
3673             if (this.diameter === undefined) {
3674                 this.diameter = null;
3675             }
3676         }
3677         else
3678             throw new Error('invalid overload');
3679     }
3680     /**
3681      * Returns the abscissa of this source.
3682      * @return {number}
3683      */
3684     LightSource.prototype.getX = function () {
3685         return this.x;
3686     };
3687     /**
3688      * Returns the ordinate of this source.
3689      * @return {number}
3690      */
3691     LightSource.prototype.getY = function () {
3692         return this.y;
3693     };
3694     /**
3695      * Returns the elevation of this source.
3696      * @return {number}
3697      */
3698     LightSource.prototype.getZ = function () {
3699         return this.z;
3700     };
3701     /**
3702      * Returns the RGB color code of this source.
3703      * @return {number}
3704      */
3705     LightSource.prototype.getColor = function () {
3706         return this.color;
3707     };
3708     /**
3709      * Returns the diameter of this source or <code>null</code> if it's not defined.
3710      * @return {number}
3711      */
3712     LightSource.prototype.getDiameter = function () {
3713         return this.diameter;
3714     };
3715     return LightSource;
3716 }());
3717 LightSource["__class"] = "com.eteks.sweethome3d.model.LightSource";
3718 /**
3719  * Creates a text style from its font's name, its size, style and alignment.
3720  * @param {string} fontName
3721  * @param {number} fontSize
3722  * @param {boolean} bold
3723  * @param {boolean} italic
3724  * @param {TextStyle.Alignment} alignment
3725  * @class
3726  * @author Emmanuel Puybaret
3727  */
3728 var TextStyle = /** @class */ (function () {
3729     function TextStyle(fontName, fontSize, bold, italic, alignment, cached) {
3730         if (((typeof fontName === 'string') || fontName === null) && ((typeof fontSize === 'number') || fontSize === null) && ((typeof bold === 'boolean') || bold === null) && ((typeof italic === 'boolean') || italic === null) && ((typeof alignment === 'number') || alignment === null) && ((typeof cached === 'boolean') || cached === null)) {
3731             var __args = arguments;
3732             if (this.fontName === undefined) {
3733                 this.fontName = null;
3734             }
3735             if (this.fontSize === undefined) {
3736                 this.fontSize = 0;
3737             }
3738             if (this.bold === undefined) {
3739                 this.bold = false;
3740             }
3741             if (this.italic === undefined) {
3742                 this.italic = false;
3743             }
3744             if (this.alignment === undefined) {
3745                 this.alignment = null;
3746             }
3747             this.fontName = fontName;
3748             this.fontSize = fontSize;
3749             this.bold = bold;
3750             this.italic = italic;
3751             this.alignment = alignment;
3752             if (cached) {
3753                 /* add */ (TextStyle.textStylesCache_$LI$().push(this) > 0);
3754             }
3755         }
3756         else if (((typeof fontName === 'string') || fontName === null) && ((typeof fontSize === 'number') || fontSize === null) && ((typeof bold === 'boolean') || bold === null) && ((typeof italic === 'boolean') || italic === null) && ((typeof alignment === 'number') || alignment === null) && cached === undefined) {
3757             var __args = arguments;
3758             {
3759                 var __args_8 = arguments;
3760                 var cached_1 = true;
3761                 if (this.fontName === undefined) {
3762                     this.fontName = null;
3763                 }
3764                 if (this.fontSize === undefined) {
3765                     this.fontSize = 0;
3766                 }
3767                 if (this.bold === undefined) {
3768                     this.bold = false;
3769                 }
3770                 if (this.italic === undefined) {
3771                     this.italic = false;
3772                 }
3773                 if (this.alignment === undefined) {
3774                     this.alignment = null;
3775                 }
3776                 this.fontName = fontName;
3777                 this.fontSize = fontSize;
3778                 this.bold = bold;
3779                 this.italic = italic;
3780                 this.alignment = alignment;
3781                 if (cached_1) {
3782                     /* add */ (TextStyle.textStylesCache_$LI$().push(this) > 0);
3783                 }
3784             }
3785             if (this.fontName === undefined) {
3786                 this.fontName = null;
3787             }
3788             if (this.fontSize === undefined) {
3789                 this.fontSize = 0;
3790             }
3791             if (this.bold === undefined) {
3792                 this.bold = false;
3793             }
3794             if (this.italic === undefined) {
3795                 this.italic = false;
3796             }
3797             if (this.alignment === undefined) {
3798                 this.alignment = null;
3799             }
3800         }
3801         else if (((typeof fontName === 'string') || fontName === null) && ((typeof fontSize === 'number') || fontSize === null) && ((typeof bold === 'boolean') || bold === null) && ((typeof italic === 'boolean') || italic === null) && alignment === undefined && cached === undefined) {
3802             var __args = arguments;
3803             {
3804                 var __args_9 = arguments;
3805                 var alignment_1 = TextStyle.Alignment.CENTER;
3806                 {
3807                     var __args_10 = arguments;
3808                     var cached_2 = true;
3809                     if (this.fontName === undefined) {
3810                         this.fontName = null;
3811                     }
3812                     if (this.fontSize === undefined) {
3813                         this.fontSize = 0;
3814                     }
3815                     if (this.bold === undefined) {
3816                         this.bold = false;
3817                     }
3818                     if (this.italic === undefined) {
3819                         this.italic = false;
3820                     }
3821                     if (this.alignment === undefined) {
3822                         this.alignment = null;
3823                     }
3824                     this.fontName = fontName;
3825                     this.fontSize = fontSize;
3826                     this.bold = bold;
3827                     this.italic = italic;
3828                     this.alignment = alignment_1;
3829                     if (cached_2) {
3830                         /* add */ (TextStyle.textStylesCache_$LI$().push(this) > 0);
3831                     }
3832                 }
3833                 if (this.fontName === undefined) {
3834                     this.fontName = null;
3835                 }
3836                 if (this.fontSize === undefined) {
3837                     this.fontSize = 0;
3838                 }
3839                 if (this.bold === undefined) {
3840                     this.bold = false;
3841                 }
3842                 if (this.italic === undefined) {
3843                     this.italic = false;
3844                 }
3845                 if (this.alignment === undefined) {
3846                     this.alignment = null;
3847                 }
3848             }
3849             if (this.fontName === undefined) {
3850                 this.fontName = null;
3851             }
3852             if (this.fontSize === undefined) {
3853                 this.fontSize = 0;
3854             }
3855             if (this.bold === undefined) {
3856                 this.bold = false;
3857             }
3858             if (this.italic === undefined) {
3859                 this.italic = false;
3860             }
3861             if (this.alignment === undefined) {
3862                 this.alignment = null;
3863             }
3864         }
3865         else if (((typeof fontName === 'number') || fontName === null) && ((typeof fontSize === 'boolean') || fontSize === null) && ((typeof bold === 'boolean') || bold === null) && italic === undefined && alignment === undefined && cached === undefined) {
3866             var __args = arguments;
3867             var fontSize_1 = __args[0];
3868             var bold_1 = __args[1];
3869             var italic_1 = __args[2];
3870             {
3871                 var __args_11 = arguments;
3872                 var fontName_1 = null;
3873                 {
3874                     var __args_12 = arguments;
3875                     var alignment_2 = TextStyle.Alignment.CENTER;
3876                     {
3877                         var __args_13 = arguments;
3878                         var cached_3 = true;
3879                         if (this.fontName === undefined) {
3880                             this.fontName = null;
3881                         }
3882                         if (this.fontSize === undefined) {
3883                             this.fontSize = 0;
3884                         }
3885                         if (this.bold === undefined) {
3886                             this.bold = false;
3887                         }
3888                         if (this.italic === undefined) {
3889                             this.italic = false;
3890                         }
3891                         if (this.alignment === undefined) {
3892                             this.alignment = null;
3893                         }
3894                         this.fontName = fontName_1;
3895                         this.fontSize = fontSize_1;
3896                         this.bold = bold_1;
3897                         this.italic = italic_1;
3898                         this.alignment = alignment_2;
3899                         if (cached_3) {
3900                             /* add */ (TextStyle.textStylesCache_$LI$().push(this) > 0);
3901                         }
3902                     }
3903                     if (this.fontName === undefined) {
3904                         this.fontName = null;
3905                     }
3906                     if (this.fontSize === undefined) {
3907                         this.fontSize = 0;
3908                     }
3909                     if (this.bold === undefined) {
3910                         this.bold = false;
3911                     }
3912                     if (this.italic === undefined) {
3913                         this.italic = false;
3914                     }
3915                     if (this.alignment === undefined) {
3916                         this.alignment = null;
3917                     }
3918                 }
3919                 if (this.fontName === undefined) {
3920                     this.fontName = null;
3921                 }
3922                 if (this.fontSize === undefined) {
3923                     this.fontSize = 0;
3924                 }
3925                 if (this.bold === undefined) {
3926                     this.bold = false;
3927                 }
3928                 if (this.italic === undefined) {
3929                     this.italic = false;
3930                 }
3931                 if (this.alignment === undefined) {
3932                     this.alignment = null;
3933                 }
3934             }
3935             if (this.fontName === undefined) {
3936                 this.fontName = null;
3937             }
3938             if (this.fontSize === undefined) {
3939                 this.fontSize = 0;
3940             }
3941             if (this.bold === undefined) {
3942                 this.bold = false;
3943             }
3944             if (this.italic === undefined) {
3945                 this.italic = false;
3946             }
3947             if (this.alignment === undefined) {
3948                 this.alignment = null;
3949             }
3950         }
3951         else if (((typeof fontName === 'number') || fontName === null) && fontSize === undefined && bold === undefined && italic === undefined && alignment === undefined && cached === undefined) {
3952             var __args = arguments;
3953             var fontSize_2 = __args[0];
3954             {
3955                 var __args_14 = arguments;
3956                 var bold_2 = false;
3957                 var italic_2 = false;
3958                 {
3959                     var __args_15 = arguments;
3960                     var fontName_2 = null;
3961                     {
3962                         var __args_16 = arguments;
3963                         var alignment_3 = TextStyle.Alignment.CENTER;
3964                         {
3965                             var __args_17 = arguments;
3966                             var cached_4 = true;
3967                             if (this.fontName === undefined) {
3968                                 this.fontName = null;
3969                             }
3970                             if (this.fontSize === undefined) {
3971                                 this.fontSize = 0;
3972                             }
3973                             if (this.bold === undefined) {
3974                                 this.bold = false;
3975                             }
3976                             if (this.italic === undefined) {
3977                                 this.italic = false;
3978                             }
3979                             if (this.alignment === undefined) {
3980                                 this.alignment = null;
3981                             }
3982                             this.fontName = fontName_2;
3983                             this.fontSize = fontSize_2;
3984                             this.bold = bold_2;
3985                             this.italic = italic_2;
3986                             this.alignment = alignment_3;
3987                             if (cached_4) {
3988                                 /* add */ (TextStyle.textStylesCache_$LI$().push(this) > 0);
3989                             }
3990                         }
3991                         if (this.fontName === undefined) {
3992                             this.fontName = null;
3993                         }
3994                         if (this.fontSize === undefined) {
3995                             this.fontSize = 0;
3996                         }
3997                         if (this.bold === undefined) {
3998                             this.bold = false;
3999                         }
4000                         if (this.italic === undefined) {
4001                             this.italic = false;
4002                         }
4003                         if (this.alignment === undefined) {
4004                             this.alignment = null;
4005                         }
4006                     }
4007                     if (this.fontName === undefined) {
4008                         this.fontName = null;
4009                     }
4010                     if (this.fontSize === undefined) {
4011                         this.fontSize = 0;
4012                     }
4013                     if (this.bold === undefined) {
4014                         this.bold = false;
4015                     }
4016                     if (this.italic === undefined) {
4017                         this.italic = false;
4018                     }
4019                     if (this.alignment === undefined) {
4020                         this.alignment = null;
4021                     }
4022                 }
4023                 if (this.fontName === undefined) {
4024                     this.fontName = null;
4025                 }
4026                 if (this.fontSize === undefined) {
4027                     this.fontSize = 0;
4028                 }
4029                 if (this.bold === undefined) {
4030                     this.bold = false;
4031                 }
4032                 if (this.italic === undefined) {
4033                     this.italic = false;
4034                 }
4035                 if (this.alignment === undefined) {
4036                     this.alignment = null;
4037                 }
4038             }
4039             if (this.fontName === undefined) {
4040                 this.fontName = null;
4041             }
4042             if (this.fontSize === undefined) {
4043                 this.fontSize = 0;
4044             }
4045             if (this.bold === undefined) {
4046                 this.bold = false;
4047             }
4048             if (this.italic === undefined) {
4049                 this.italic = false;
4050             }
4051             if (this.alignment === undefined) {
4052                 this.alignment = null;
4053             }
4054         }
4055         else
4056             throw new Error('invalid overload');
4057     }
4058     TextStyle.textStylesCache_$LI$ = function () { if (TextStyle.textStylesCache == null) {
4059         TextStyle.textStylesCache = [];
4060     } return TextStyle.textStylesCache; };
4061     /**
4062      * Returns the text style instance matching the given parameters.
4063      * @param {string} fontName
4064      * @param {number} fontSize
4065      * @param {boolean} bold
4066      * @param {boolean} italic
4067      * @param {TextStyle.Alignment} alignment
4068      * @return {TextStyle}
4069      * @private
4070      */
4071     TextStyle.prototype.getInstance = function (fontName, fontSize, bold, italic, alignment) {
4072         var textStyle = new TextStyle(fontName, fontSize, bold, italic, alignment, false);
4073         for (var i = TextStyle.textStylesCache_$LI$().length - 1; i >= 0; i--) {
4074             {
4075                 var cachedTextStyle = TextStyle.textStylesCache_$LI$()[i];
4076                 if (cachedTextStyle == null) {
4077                     /* remove */ TextStyle.textStylesCache_$LI$().splice(i, 1)[0];
4078                 }
4079                 else if (cachedTextStyle.equals(textStyle)) {
4080                     return textStyle;
4081                 }
4082             }
4083             ;
4084         }
4085         /* add */ (TextStyle.textStylesCache_$LI$().push(textStyle) > 0);
4086         return textStyle;
4087     };
4088     /**
4089      * Returns the font name of this text style.
4090      * @return {string}
4091      */
4092     TextStyle.prototype.getFontName = function () {
4093         return this.fontName;
4094     };
4095     /**
4096      * Returns the font size of this text style.
4097      * @return {number}
4098      */
4099     TextStyle.prototype.getFontSize = function () {
4100         return this.fontSize;
4101     };
4102     /**
4103      * Returns whether this text style is bold or not.
4104      * @return {boolean}
4105      */
4106     TextStyle.prototype.isBold = function () {
4107         return this.bold;
4108     };
4109     /**
4110      * Returns whether this text style is italic or not.
4111      * @return {boolean}
4112      */
4113     TextStyle.prototype.isItalic = function () {
4114         return this.italic;
4115     };
4116     /**
4117      * Returns the alignment applied on text using this style.
4118      * @return {TextStyle.Alignment}
4119      */
4120     TextStyle.prototype.getAlignment = function () {
4121         return this.alignment;
4122     };
4123     TextStyle.prototype.deriveStyle$java_lang_String = function (fontName) {
4124         if (this.getFontName() === fontName || (fontName != null && (fontName === this.getFontName()))) {
4125             return this;
4126         }
4127         else {
4128             return this.getInstance(fontName, this.getFontSize(), this.isBold(), this.isItalic(), this.getAlignment());
4129         }
4130     };
4131     /**
4132      * Returns a derived style of this text style with a given font name.
4133      * @param {string} fontName
4134      * @return {TextStyle}
4135      */
4136     TextStyle.prototype.deriveStyle = function (fontName) {
4137         if (((typeof fontName === 'string') || fontName === null)) {
4138             return this.deriveStyle$java_lang_String(fontName);
4139         }
4140         else if (((typeof fontName === 'number') || fontName === null)) {
4141             return this.deriveStyle$com_eteks_sweethome3d_model_TextStyle_Alignment(fontName);
4142         }
4143         else if (((typeof fontName === 'number') || fontName === null)) {
4144             return this.deriveStyle$float(fontName);
4145         }
4146         else
4147             throw new Error('invalid overload');
4148     };
4149     TextStyle.prototype.deriveStyle$float = function (fontSize) {
4150         if (this.getFontSize() === fontSize) {
4151             return this;
4152         }
4153         else {
4154             return this.getInstance(this.getFontName(), fontSize, this.isBold(), this.isItalic(), this.getAlignment());
4155         }
4156     };
4157     TextStyle.prototype.deriveStyle$com_eteks_sweethome3d_model_TextStyle_Alignment = function (alignment) {
4158         if (this.getAlignment() === alignment) {
4159             return this;
4160         }
4161         else {
4162             return this.getInstance(this.getFontName(), this.getFontSize(), this.isBold(), this.isItalic(), alignment);
4163         }
4164     };
4165     /**
4166      * Returns a derived style of this text style with a given bold style.
4167      * @param {boolean} bold
4168      * @return {TextStyle}
4169      */
4170     TextStyle.prototype.deriveBoldStyle = function (bold) {
4171         if (this.isBold() === bold) {
4172             return this;
4173         }
4174         else {
4175             return this.getInstance(this.getFontName(), this.getFontSize(), bold, this.isItalic(), this.getAlignment());
4176         }
4177     };
4178     /**
4179      * Returns a derived style of this text style with a given italic style.
4180      * @param {boolean} italic
4181      * @return {TextStyle}
4182      */
4183     TextStyle.prototype.deriveItalicStyle = function (italic) {
4184         if (this.isItalic() === italic) {
4185             return this;
4186         }
4187         else {
4188             return this.getInstance(this.getFontName(), this.getFontSize(), this.isBold(), italic, this.getAlignment());
4189         }
4190     };
4191     /**
4192      * Returns <code>true</code> if this text style is equal to <code>object</code>.
4193      * @param {Object} object
4194      * @return {boolean}
4195      */
4196     TextStyle.prototype.equals = function (object) {
4197         if (object != null && object instanceof TextStyle) {
4198             var textStyle = object;
4199             return (textStyle.fontName === this.fontName || (textStyle.fontName != null && (textStyle.fontName === this.fontName))) && textStyle.fontSize === this.fontSize && textStyle.bold === this.bold && textStyle.italic === this.italic && textStyle.alignment === this.alignment;
4200         }
4201         return false;
4202     };
4203     /**
4204      * Returns a hash code for this text style.
4205      * @return {number}
4206      */
4207     TextStyle.prototype.hashCode = function () {
4208         var hashCode = (function (f) { var buf = new ArrayBuffer(4); (new Float32Array(buf))[0] = f; return (new Uint32Array(buf))[0]; })(this.fontSize);
4209         if (this.fontName != null) {
4210             hashCode += /* hashCode */ (function (o) { if (o.hashCode) {
4211                 return o.hashCode();
4212             }
4213             else {
4214                 return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
4215             } })(this.fontName);
4216         }
4217         if (this.bold) {
4218             hashCode++;
4219         }
4220         if (this.italic) {
4221             hashCode++;
4222         }
4223         hashCode += 0;
4224         return hashCode;
4225     };
4226     return TextStyle;
4227 }());
4228 TextStyle["__class"] = "com.eteks.sweethome3d.model.TextStyle";
4229 (function (TextStyle) {
4230     var Alignment;
4231     (function (Alignment) {
4232         Alignment[Alignment["LEFT"] = 0] = "LEFT";
4233         Alignment[Alignment["CENTER"] = 1] = "CENTER";
4234         Alignment[Alignment["RIGHT"] = 2] = "RIGHT";
4235     })(Alignment = TextStyle.Alignment || (TextStyle.Alignment = {}));
4236 })(TextStyle || (TextStyle = {}));
4237 /**
4238  * Creates a home texture from an existing one with customized parameters.
4239  * @param {Object} texture the texture from which data are copied
4240  * @param {number} xOffset the offset applied to the texture along X axis in percentage of its width
4241  * @param {number} yOffset the offset applied to the texture along Y axis in percentage of its height
4242  * @param {number} angle   the rotation angle applied to the texture
4243  * @param {number} scale   the scale applied to the texture
4244  * @param {boolean} fittingArea if <code>true</code> the texture will fit at its best the area to which it's applied
4245  * @param {boolean} leftToRightOriented orientation used on the texture when applied on objects seen from front
4246  * @class
4247  * @author Emmanuel Puybaret
4248  */
4249 var HomeTexture = /** @class */ (function () {
4250     function HomeTexture(texture, xOffset, yOffset, angle, scale, fittingArea, leftToRightOriented) {
4251         if (((texture != null && (texture.constructor != null && texture.constructor["__interfaces"] != null && texture.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.TextureImage") >= 0)) || texture === null) && ((typeof xOffset === 'number') || xOffset === null) && ((typeof yOffset === 'number') || yOffset === null) && ((typeof angle === 'number') || angle === null) && ((typeof scale === 'number') || scale === null) && ((typeof fittingArea === 'boolean') || fittingArea === null) && ((typeof leftToRightOriented === 'boolean') || leftToRightOriented === null)) {
4252             var __args = arguments;
4253             if (this.catalogId === undefined) {
4254                 this.catalogId = null;
4255             }
4256             if (this.name === undefined) {
4257                 this.name = null;
4258             }
4259             if (this.creator === undefined) {
4260                 this.creator = null;
4261             }
4262             if (this.image === undefined) {
4263                 this.image = null;
4264             }
4265             if (this.width === undefined) {
4266                 this.width = 0;
4267             }
4268             if (this.height === undefined) {
4269                 this.height = 0;
4270             }
4271             if (this.xOffset === undefined) {
4272                 this.xOffset = 0;
4273             }
4274             if (this.yOffset === undefined) {
4275                 this.yOffset = 0;
4276             }
4277             if (this.angle === undefined) {
4278                 this.angle = 0;
4279             }
4280             if (this.scale === undefined) {
4281                 this.scale = 0;
4282             }
4283             if (this.fittingArea === undefined) {
4284                 this.fittingArea = false;
4285             }
4286             if (this.leftToRightOriented === undefined) {
4287                 this.leftToRightOriented = false;
4288             }
4289             this.name = texture.getName();
4290             this.creator = texture.getCreator();
4291             this.image = texture.getImage();
4292             this.width = texture.getWidth();
4293             this.height = texture.getHeight();
4294             this.xOffset = xOffset;
4295             this.yOffset = yOffset;
4296             this.angle = angle;
4297             this.scale = scale;
4298             this.fittingArea = fittingArea;
4299             this.leftToRightOriented = leftToRightOriented;
4300             if (texture != null && texture instanceof HomeTexture) {
4301                 this.catalogId = texture.getCatalogId();
4302             }
4303             else if (texture != null && texture instanceof CatalogTexture) {
4304                 this.catalogId = texture.getId();
4305             }
4306             else {
4307                 this.catalogId = null;
4308             }
4309         }
4310         else if (((texture != null && (texture.constructor != null && texture.constructor["__interfaces"] != null && texture.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.TextureImage") >= 0)) || texture === null) && ((typeof xOffset === 'number') || xOffset === null) && ((typeof yOffset === 'number') || yOffset === null) && ((typeof angle === 'number') || angle === null) && ((typeof scale === 'number') || scale === null) && ((typeof fittingArea === 'boolean') || fittingArea === null) && leftToRightOriented === undefined) {
4311             var __args = arguments;
4312             var leftToRightOriented_1 = __args[5];
4313             {
4314                 var __args_18 = arguments;
4315                 var fittingArea_1 = false;
4316                 if (this.catalogId === undefined) {
4317                     this.catalogId = null;
4318                 }
4319                 if (this.name === undefined) {
4320                     this.name = null;
4321                 }
4322                 if (this.creator === undefined) {
4323                     this.creator = null;
4324                 }
4325                 if (this.image === undefined) {
4326                     this.image = null;
4327                 }
4328                 if (this.width === undefined) {
4329                     this.width = 0;
4330                 }
4331                 if (this.height === undefined) {
4332                     this.height = 0;
4333                 }
4334                 if (this.xOffset === undefined) {
4335                     this.xOffset = 0;
4336                 }
4337                 if (this.yOffset === undefined) {
4338                     this.yOffset = 0;
4339                 }
4340                 if (this.angle === undefined) {
4341                     this.angle = 0;
4342                 }
4343                 if (this.scale === undefined) {
4344                     this.scale = 0;
4345                 }
4346                 if (this.fittingArea === undefined) {
4347                     this.fittingArea = false;
4348                 }
4349                 if (this.leftToRightOriented === undefined) {
4350                     this.leftToRightOriented = false;
4351                 }
4352                 this.name = texture.getName();
4353                 this.creator = texture.getCreator();
4354                 this.image = texture.getImage();
4355                 this.width = texture.getWidth();
4356                 this.height = texture.getHeight();
4357                 this.xOffset = xOffset;
4358                 this.yOffset = yOffset;
4359                 this.angle = angle;
4360                 this.scale = scale;
4361                 this.fittingArea = fittingArea_1;
4362                 this.leftToRightOriented = leftToRightOriented_1;
4363                 if (texture != null && texture instanceof HomeTexture) {
4364                     this.catalogId = texture.getCatalogId();
4365                 }
4366                 else if (texture != null && texture instanceof CatalogTexture) {
4367                     this.catalogId = texture.getId();
4368                 }
4369                 else {
4370                     this.catalogId = null;
4371                 }
4372             }
4373             if (this.catalogId === undefined) {
4374                 this.catalogId = null;
4375             }
4376             if (this.name === undefined) {
4377                 this.name = null;
4378             }
4379             if (this.creator === undefined) {
4380                 this.creator = null;
4381             }
4382             if (this.image === undefined) {
4383                 this.image = null;
4384             }
4385             if (this.width === undefined) {
4386                 this.width = 0;
4387             }
4388             if (this.height === undefined) {
4389                 this.height = 0;
4390             }
4391             if (this.xOffset === undefined) {
4392                 this.xOffset = 0;
4393             }
4394             if (this.yOffset === undefined) {
4395                 this.yOffset = 0;
4396             }
4397             if (this.angle === undefined) {
4398                 this.angle = 0;
4399             }
4400             if (this.scale === undefined) {
4401                 this.scale = 0;
4402             }
4403             if (this.fittingArea === undefined) {
4404                 this.fittingArea = false;
4405             }
4406             if (this.leftToRightOriented === undefined) {
4407                 this.leftToRightOriented = false;
4408             }
4409         }
4410         else if (((texture != null && (texture.constructor != null && texture.constructor["__interfaces"] != null && texture.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.TextureImage") >= 0)) || texture === null) && ((typeof xOffset === 'number') || xOffset === null) && ((typeof yOffset === 'number') || yOffset === null) && ((typeof angle === 'boolean') || angle === null) && scale === undefined && fittingArea === undefined && leftToRightOriented === undefined) {
4411             var __args = arguments;
4412             var angle_1 = __args[1];
4413             var scale_1 = __args[2];
4414             var leftToRightOriented_2 = __args[3];
4415             {
4416                 var __args_19 = arguments;
4417                 var xOffset_1 = 0;
4418                 var yOffset_1 = 0;
4419                 {
4420                     var __args_20 = arguments;
4421                     var fittingArea_2 = false;
4422                     if (this.catalogId === undefined) {
4423                         this.catalogId = null;
4424                     }
4425                     if (this.name === undefined) {
4426                         this.name = null;
4427                     }
4428                     if (this.creator === undefined) {
4429                         this.creator = null;
4430                     }
4431                     if (this.image === undefined) {
4432                         this.image = null;
4433                     }
4434                     if (this.width === undefined) {
4435                         this.width = 0;
4436                     }
4437                     if (this.height === undefined) {
4438                         this.height = 0;
4439                     }
4440                     if (this.xOffset === undefined) {
4441                         this.xOffset = 0;
4442                     }
4443                     if (this.yOffset === undefined) {
4444                         this.yOffset = 0;
4445                     }
4446                     if (this.angle === undefined) {
4447                         this.angle = 0;
4448                     }
4449                     if (this.scale === undefined) {
4450                         this.scale = 0;
4451                     }
4452                     if (this.fittingArea === undefined) {
4453                         this.fittingArea = false;
4454                     }
4455                     if (this.leftToRightOriented === undefined) {
4456                         this.leftToRightOriented = false;
4457                     }
4458                     this.name = texture.getName();
4459                     this.creator = texture.getCreator();
4460                     this.image = texture.getImage();
4461                     this.width = texture.getWidth();
4462                     this.height = texture.getHeight();
4463                     this.xOffset = xOffset_1;
4464                     this.yOffset = yOffset_1;
4465                     this.angle = angle_1;
4466                     this.scale = scale_1;
4467                     this.fittingArea = fittingArea_2;
4468                     this.leftToRightOriented = leftToRightOriented_2;
4469                     if (texture != null && texture instanceof HomeTexture) {
4470                         this.catalogId = texture.getCatalogId();
4471                     }
4472                     else if (texture != null && texture instanceof CatalogTexture) {
4473                         this.catalogId = texture.getId();
4474                     }
4475                     else {
4476                         this.catalogId = null;
4477                     }
4478                 }
4479                 if (this.catalogId === undefined) {
4480                     this.catalogId = null;
4481                 }
4482                 if (this.name === undefined) {
4483                     this.name = null;
4484                 }
4485                 if (this.creator === undefined) {
4486                     this.creator = null;
4487                 }
4488                 if (this.image === undefined) {
4489                     this.image = null;
4490                 }
4491                 if (this.width === undefined) {
4492                     this.width = 0;
4493                 }
4494                 if (this.height === undefined) {
4495                     this.height = 0;
4496                 }
4497                 if (this.xOffset === undefined) {
4498                     this.xOffset = 0;
4499                 }
4500                 if (this.yOffset === undefined) {
4501                     this.yOffset = 0;
4502                 }
4503                 if (this.angle === undefined) {
4504                     this.angle = 0;
4505                 }
4506                 if (this.scale === undefined) {
4507                     this.scale = 0;
4508                 }
4509                 if (this.fittingArea === undefined) {
4510                     this.fittingArea = false;
4511                 }
4512                 if (this.leftToRightOriented === undefined) {
4513                     this.leftToRightOriented = false;
4514                 }
4515             }
4516             if (this.catalogId === undefined) {
4517                 this.catalogId = null;
4518             }
4519             if (this.name === undefined) {
4520                 this.name = null;
4521             }
4522             if (this.creator === undefined) {
4523                 this.creator = null;
4524             }
4525             if (this.image === undefined) {
4526                 this.image = null;
4527             }
4528             if (this.width === undefined) {
4529                 this.width = 0;
4530             }
4531             if (this.height === undefined) {
4532                 this.height = 0;
4533             }
4534             if (this.xOffset === undefined) {
4535                 this.xOffset = 0;
4536             }
4537             if (this.yOffset === undefined) {
4538                 this.yOffset = 0;
4539             }
4540             if (this.angle === undefined) {
4541                 this.angle = 0;
4542             }
4543             if (this.scale === undefined) {
4544                 this.scale = 0;
4545             }
4546             if (this.fittingArea === undefined) {
4547                 this.fittingArea = false;
4548             }
4549             if (this.leftToRightOriented === undefined) {
4550                 this.leftToRightOriented = false;
4551             }
4552         }
4553         else if (((texture != null && (texture.constructor != null && texture.constructor["__interfaces"] != null && texture.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.TextureImage") >= 0)) || texture === null) && ((typeof xOffset === 'number') || xOffset === null) && ((typeof yOffset === 'boolean') || yOffset === null) && angle === undefined && scale === undefined && fittingArea === undefined && leftToRightOriented === undefined) {
4554             var __args = arguments;
4555             var angle_2 = __args[1];
4556             var leftToRightOriented_3 = __args[2];
4557             {
4558                 var __args_21 = arguments;
4559                 var scale_2 = 1;
4560                 {
4561                     var __args_22 = arguments;
4562                     var xOffset_2 = 0;
4563                     var yOffset_2 = 0;
4564                     {
4565                         var __args_23 = arguments;
4566                         var fittingArea_3 = false;
4567                         if (this.catalogId === undefined) {
4568                             this.catalogId = null;
4569                         }
4570                         if (this.name === undefined) {
4571                             this.name = null;
4572                         }
4573                         if (this.creator === undefined) {
4574                             this.creator = null;
4575                         }
4576                         if (this.image === undefined) {
4577                             this.image = null;
4578                         }
4579                         if (this.width === undefined) {
4580                             this.width = 0;
4581                         }
4582                         if (this.height === undefined) {
4583                             this.height = 0;
4584                         }
4585                         if (this.xOffset === undefined) {
4586                             this.xOffset = 0;
4587                         }
4588                         if (this.yOffset === undefined) {
4589                             this.yOffset = 0;
4590                         }
4591                         if (this.angle === undefined) {
4592                             this.angle = 0;
4593                         }
4594                         if (this.scale === undefined) {
4595                             this.scale = 0;
4596                         }
4597                         if (this.fittingArea === undefined) {
4598                             this.fittingArea = false;
4599                         }
4600                         if (this.leftToRightOriented === undefined) {
4601                             this.leftToRightOriented = false;
4602                         }
4603                         this.name = texture.getName();
4604                         this.creator = texture.getCreator();
4605                         this.image = texture.getImage();
4606                         this.width = texture.getWidth();
4607                         this.height = texture.getHeight();
4608                         this.xOffset = xOffset_2;
4609                         this.yOffset = yOffset_2;
4610                         this.angle = angle_2;
4611                         this.scale = scale_2;
4612                         this.fittingArea = fittingArea_3;
4613                         this.leftToRightOriented = leftToRightOriented_3;
4614                         if (texture != null && texture instanceof HomeTexture) {
4615                             this.catalogId = texture.getCatalogId();
4616                         }
4617                         else if (texture != null && texture instanceof CatalogTexture) {
4618                             this.catalogId = texture.getId();
4619                         }
4620                         else {
4621                             this.catalogId = null;
4622                         }
4623                     }
4624                     if (this.catalogId === undefined) {
4625                         this.catalogId = null;
4626                     }
4627                     if (this.name === undefined) {
4628                         this.name = null;
4629                     }
4630                     if (this.creator === undefined) {
4631                         this.creator = null;
4632                     }
4633                     if (this.image === undefined) {
4634                         this.image = null;
4635                     }
4636                     if (this.width === undefined) {
4637                         this.width = 0;
4638                     }
4639                     if (this.height === undefined) {
4640                         this.height = 0;
4641                     }
4642                     if (this.xOffset === undefined) {
4643                         this.xOffset = 0;
4644                     }
4645                     if (this.yOffset === undefined) {
4646                         this.yOffset = 0;
4647                     }
4648                     if (this.angle === undefined) {
4649                         this.angle = 0;
4650                     }
4651                     if (this.scale === undefined) {
4652                         this.scale = 0;
4653                     }
4654                     if (this.fittingArea === undefined) {
4655                         this.fittingArea = false;
4656                     }
4657                     if (this.leftToRightOriented === undefined) {
4658                         this.leftToRightOriented = false;
4659                     }
4660                 }
4661                 if (this.catalogId === undefined) {
4662                     this.catalogId = null;
4663                 }
4664                 if (this.name === undefined) {
4665                     this.name = null;
4666                 }
4667                 if (this.creator === undefined) {
4668                     this.creator = null;
4669                 }
4670                 if (this.image === undefined) {
4671                     this.image = null;
4672                 }
4673                 if (this.width === undefined) {
4674                     this.width = 0;
4675                 }
4676                 if (this.height === undefined) {
4677                     this.height = 0;
4678                 }
4679                 if (this.xOffset === undefined) {
4680                     this.xOffset = 0;
4681                 }
4682                 if (this.yOffset === undefined) {
4683                     this.yOffset = 0;
4684                 }
4685                 if (this.angle === undefined) {
4686                     this.angle = 0;
4687                 }
4688                 if (this.scale === undefined) {
4689                     this.scale = 0;
4690                 }
4691                 if (this.fittingArea === undefined) {
4692                     this.fittingArea = false;
4693                 }
4694                 if (this.leftToRightOriented === undefined) {
4695                     this.leftToRightOriented = false;
4696                 }
4697             }
4698             if (this.catalogId === undefined) {
4699                 this.catalogId = null;
4700             }
4701             if (this.name === undefined) {
4702                 this.name = null;
4703             }
4704             if (this.creator === undefined) {
4705                 this.creator = null;
4706             }
4707             if (this.image === undefined) {
4708                 this.image = null;
4709             }
4710             if (this.width === undefined) {
4711                 this.width = 0;
4712             }
4713             if (this.height === undefined) {
4714                 this.height = 0;
4715             }
4716             if (this.xOffset === undefined) {
4717                 this.xOffset = 0;
4718             }
4719             if (this.yOffset === undefined) {
4720                 this.yOffset = 0;
4721             }
4722             if (this.angle === undefined) {
4723                 this.angle = 0;
4724             }
4725             if (this.scale === undefined) {
4726                 this.scale = 0;
4727             }
4728             if (this.fittingArea === undefined) {
4729                 this.fittingArea = false;
4730             }
4731             if (this.leftToRightOriented === undefined) {
4732                 this.leftToRightOriented = false;
4733             }
4734         }
4735         else if (((texture != null && (texture.constructor != null && texture.constructor["__interfaces"] != null && texture.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.TextureImage") >= 0)) || texture === null) && ((typeof xOffset === 'number') || xOffset === null) && yOffset === undefined && angle === undefined && scale === undefined && fittingArea === undefined && leftToRightOriented === undefined) {
4736             var __args = arguments;
4737             var angle_3 = __args[1];
4738             {
4739                 var __args_24 = arguments;
4740                 var leftToRightOriented_4 = true;
4741                 {
4742                     var __args_25 = arguments;
4743                     var scale_3 = 1;
4744                     {
4745                         var __args_26 = arguments;
4746                         var xOffset_3 = 0;
4747                         var yOffset_3 = 0;
4748                         {
4749                             var __args_27 = arguments;
4750                             var fittingArea_4 = false;
4751                             if (this.catalogId === undefined) {
4752                                 this.catalogId = null;
4753                             }
4754                             if (this.name === undefined) {
4755                                 this.name = null;
4756                             }
4757                             if (this.creator === undefined) {
4758                                 this.creator = null;
4759                             }
4760                             if (this.image === undefined) {
4761                                 this.image = null;
4762                             }
4763                             if (this.width === undefined) {
4764                                 this.width = 0;
4765                             }
4766                             if (this.height === undefined) {
4767                                 this.height = 0;
4768                             }
4769                             if (this.xOffset === undefined) {
4770                                 this.xOffset = 0;
4771                             }
4772                             if (this.yOffset === undefined) {
4773                                 this.yOffset = 0;
4774                             }
4775                             if (this.angle === undefined) {
4776                                 this.angle = 0;
4777                             }
4778                             if (this.scale === undefined) {
4779                                 this.scale = 0;
4780                             }
4781                             if (this.fittingArea === undefined) {
4782                                 this.fittingArea = false;
4783                             }
4784                             if (this.leftToRightOriented === undefined) {
4785                                 this.leftToRightOriented = false;
4786                             }
4787                             this.name = texture.getName();
4788                             this.creator = texture.getCreator();
4789                             this.image = texture.getImage();
4790                             this.width = texture.getWidth();
4791                             this.height = texture.getHeight();
4792                             this.xOffset = xOffset_3;
4793                             this.yOffset = yOffset_3;
4794                             this.angle = angle_3;
4795                             this.scale = scale_3;
4796                             this.fittingArea = fittingArea_4;
4797                             this.leftToRightOriented = leftToRightOriented_4;
4798                             if (texture != null && texture instanceof HomeTexture) {
4799                                 this.catalogId = texture.getCatalogId();
4800                             }
4801                             else if (texture != null && texture instanceof CatalogTexture) {
4802                                 this.catalogId = texture.getId();
4803                             }
4804                             else {
4805                                 this.catalogId = null;
4806                             }
4807                         }
4808                         if (this.catalogId === undefined) {
4809                             this.catalogId = null;
4810                         }
4811                         if (this.name === undefined) {
4812                             this.name = null;
4813                         }
4814                         if (this.creator === undefined) {
4815                             this.creator = null;
4816                         }
4817                         if (this.image === undefined) {
4818                             this.image = null;
4819                         }
4820                         if (this.width === undefined) {
4821                             this.width = 0;
4822                         }
4823                         if (this.height === undefined) {
4824                             this.height = 0;
4825                         }
4826                         if (this.xOffset === undefined) {
4827                             this.xOffset = 0;
4828                         }
4829                         if (this.yOffset === undefined) {
4830                             this.yOffset = 0;
4831                         }
4832                         if (this.angle === undefined) {
4833                             this.angle = 0;
4834                         }
4835                         if (this.scale === undefined) {
4836                             this.scale = 0;
4837                         }
4838                         if (this.fittingArea === undefined) {
4839                             this.fittingArea = false;
4840                         }
4841                         if (this.leftToRightOriented === undefined) {
4842                             this.leftToRightOriented = false;
4843                         }
4844                     }
4845                     if (this.catalogId === undefined) {
4846                         this.catalogId = null;
4847                     }
4848                     if (this.name === undefined) {
4849                         this.name = null;
4850                     }
4851                     if (this.creator === undefined) {
4852                         this.creator = null;
4853                     }
4854                     if (this.image === undefined) {
4855                         this.image = null;
4856                     }
4857                     if (this.width === undefined) {
4858                         this.width = 0;
4859                     }
4860                     if (this.height === undefined) {
4861                         this.height = 0;
4862                     }
4863                     if (this.xOffset === undefined) {
4864                         this.xOffset = 0;
4865                     }
4866                     if (this.yOffset === undefined) {
4867                         this.yOffset = 0;
4868                     }
4869                     if (this.angle === undefined) {
4870                         this.angle = 0;
4871                     }
4872                     if (this.scale === undefined) {
4873                         this.scale = 0;
4874                     }
4875                     if (this.fittingArea === undefined) {
4876                         this.fittingArea = false;
4877                     }
4878                     if (this.leftToRightOriented === undefined) {
4879                         this.leftToRightOriented = false;
4880                     }
4881                 }
4882                 if (this.catalogId === undefined) {
4883                     this.catalogId = null;
4884                 }
4885                 if (this.name === undefined) {
4886                     this.name = null;
4887                 }
4888                 if (this.creator === undefined) {
4889                     this.creator = null;
4890                 }
4891                 if (this.image === undefined) {
4892                     this.image = null;
4893                 }
4894                 if (this.width === undefined) {
4895                     this.width = 0;
4896                 }
4897                 if (this.height === undefined) {
4898                     this.height = 0;
4899                 }
4900                 if (this.xOffset === undefined) {
4901                     this.xOffset = 0;
4902                 }
4903                 if (this.yOffset === undefined) {
4904                     this.yOffset = 0;
4905                 }
4906                 if (this.angle === undefined) {
4907                     this.angle = 0;
4908                 }
4909                 if (this.scale === undefined) {
4910                     this.scale = 0;
4911                 }
4912                 if (this.fittingArea === undefined) {
4913                     this.fittingArea = false;
4914                 }
4915                 if (this.leftToRightOriented === undefined) {
4916                     this.leftToRightOriented = false;
4917                 }
4918             }
4919             if (this.catalogId === undefined) {
4920                 this.catalogId = null;
4921             }
4922             if (this.name === undefined) {
4923                 this.name = null;
4924             }
4925             if (this.creator === undefined) {
4926                 this.creator = null;
4927             }
4928             if (this.image === undefined) {
4929                 this.image = null;
4930             }
4931             if (this.width === undefined) {
4932                 this.width = 0;
4933             }
4934             if (this.height === undefined) {
4935                 this.height = 0;
4936             }
4937             if (this.xOffset === undefined) {
4938                 this.xOffset = 0;
4939             }
4940             if (this.yOffset === undefined) {
4941                 this.yOffset = 0;
4942             }
4943             if (this.angle === undefined) {
4944                 this.angle = 0;
4945             }
4946             if (this.scale === undefined) {
4947                 this.scale = 0;
4948             }
4949             if (this.fittingArea === undefined) {
4950                 this.fittingArea = false;
4951             }
4952             if (this.leftToRightOriented === undefined) {
4953                 this.leftToRightOriented = false;
4954             }
4955         }
4956         else if (((texture != null && (texture.constructor != null && texture.constructor["__interfaces"] != null && texture.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.TextureImage") >= 0)) || texture === null) && xOffset === undefined && yOffset === undefined && angle === undefined && scale === undefined && fittingArea === undefined && leftToRightOriented === undefined) {
4957             var __args = arguments;
4958             {
4959                 var __args_28 = arguments;
4960                 var angle_4 = 0;
4961                 {
4962                     var __args_29 = arguments;
4963                     var leftToRightOriented_5 = true;
4964                     {
4965                         var __args_30 = arguments;
4966                         var scale_4 = 1;
4967                         {
4968                             var __args_31 = arguments;
4969                             var xOffset_4 = 0;
4970                             var yOffset_4 = 0;
4971                             {
4972                                 var __args_32 = arguments;
4973                                 var fittingArea_5 = false;
4974                                 if (this.catalogId === undefined) {
4975                                     this.catalogId = null;
4976                                 }
4977                                 if (this.name === undefined) {
4978                                     this.name = null;
4979                                 }
4980                                 if (this.creator === undefined) {
4981                                     this.creator = null;
4982                                 }
4983                                 if (this.image === undefined) {
4984                                     this.image = null;
4985                                 }
4986                                 if (this.width === undefined) {
4987                                     this.width = 0;
4988                                 }
4989                                 if (this.height === undefined) {
4990                                     this.height = 0;
4991                                 }
4992                                 if (this.xOffset === undefined) {
4993                                     this.xOffset = 0;
4994                                 }
4995                                 if (this.yOffset === undefined) {
4996                                     this.yOffset = 0;
4997                                 }
4998                                 if (this.angle === undefined) {
4999                                     this.angle = 0;
5000                                 }
5001                                 if (this.scale === undefined) {
5002                                     this.scale = 0;
5003                                 }
5004                                 if (this.fittingArea === undefined) {
5005                                     this.fittingArea = false;
5006                                 }
5007                                 if (this.leftToRightOriented === undefined) {
5008                                     this.leftToRightOriented = false;
5009                                 }
5010                                 this.name = texture.getName();
5011                                 this.creator = texture.getCreator();
5012                                 this.image = texture.getImage();
5013                                 this.width = texture.getWidth();
5014                                 this.height = texture.getHeight();
5015                                 this.xOffset = xOffset_4;
5016                                 this.yOffset = yOffset_4;
5017                                 this.angle = angle_4;
5018                                 this.scale = scale_4;
5019                                 this.fittingArea = fittingArea_5;
5020                                 this.leftToRightOriented = leftToRightOriented_5;
5021                                 if (texture != null && texture instanceof HomeTexture) {
5022                                     this.catalogId = texture.getCatalogId();
5023                                 }
5024                                 else if (texture != null && texture instanceof CatalogTexture) {
5025                                     this.catalogId = texture.getId();
5026                                 }
5027                                 else {
5028                                     this.catalogId = null;
5029                                 }
5030                             }
5031                             if (this.catalogId === undefined) {
5032                                 this.catalogId = null;
5033                             }
5034                             if (this.name === undefined) {
5035                                 this.name = null;
5036                             }
5037                             if (this.creator === undefined) {
5038                                 this.creator = null;
5039                             }
5040                             if (this.image === undefined) {
5041                                 this.image = null;
5042                             }
5043                             if (this.width === undefined) {
5044                                 this.width = 0;
5045                             }
5046                             if (this.height === undefined) {
5047                                 this.height = 0;
5048                             }
5049                             if (this.xOffset === undefined) {
5050                                 this.xOffset = 0;
5051                             }
5052                             if (this.yOffset === undefined) {
5053                                 this.yOffset = 0;
5054                             }
5055                             if (this.angle === undefined) {
5056                                 this.angle = 0;
5057                             }
5058                             if (this.scale === undefined) {
5059                                 this.scale = 0;
5060                             }
5061                             if (this.fittingArea === undefined) {
5062                                 this.fittingArea = false;
5063                             }
5064                             if (this.leftToRightOriented === undefined) {
5065                                 this.leftToRightOriented = false;
5066                             }
5067                         }
5068                         if (this.catalogId === undefined) {
5069                             this.catalogId = null;
5070                         }
5071                         if (this.name === undefined) {
5072                             this.name = null;
5073                         }
5074                         if (this.creator === undefined) {
5075                             this.creator = null;
5076                         }
5077                         if (this.image === undefined) {
5078                             this.image = null;
5079                         }
5080                         if (this.width === undefined) {
5081                             this.width = 0;
5082                         }
5083                         if (this.height === undefined) {
5084                             this.height = 0;
5085                         }
5086                         if (this.xOffset === undefined) {
5087                             this.xOffset = 0;
5088                         }
5089                         if (this.yOffset === undefined) {
5090                             this.yOffset = 0;
5091                         }
5092                         if (this.angle === undefined) {
5093                             this.angle = 0;
5094                         }
5095                         if (this.scale === undefined) {
5096                             this.scale = 0;
5097                         }
5098                         if (this.fittingArea === undefined) {
5099                             this.fittingArea = false;
5100                         }
5101                         if (this.leftToRightOriented === undefined) {
5102                             this.leftToRightOriented = false;
5103                         }
5104                     }
5105                     if (this.catalogId === undefined) {
5106                         this.catalogId = null;
5107                     }
5108                     if (this.name === undefined) {
5109                         this.name = null;
5110                     }
5111                     if (this.creator === undefined) {
5112                         this.creator = null;
5113                     }
5114                     if (this.image === undefined) {
5115                         this.image = null;
5116                     }
5117                     if (this.width === undefined) {
5118                         this.width = 0;
5119                     }
5120                     if (this.height === undefined) {
5121                         this.height = 0;
5122                     }
5123                     if (this.xOffset === undefined) {
5124                         this.xOffset = 0;
5125                     }
5126                     if (this.yOffset === undefined) {
5127                         this.yOffset = 0;
5128                     }
5129                     if (this.angle === undefined) {
5130                         this.angle = 0;
5131                     }
5132                     if (this.scale === undefined) {
5133                         this.scale = 0;
5134                     }
5135                     if (this.fittingArea === undefined) {
5136                         this.fittingArea = false;
5137                     }
5138                     if (this.leftToRightOriented === undefined) {
5139                         this.leftToRightOriented = false;
5140                     }
5141                 }
5142                 if (this.catalogId === undefined) {
5143                     this.catalogId = null;
5144                 }
5145                 if (this.name === undefined) {
5146                     this.name = null;
5147                 }
5148                 if (this.creator === undefined) {
5149                     this.creator = null;
5150                 }
5151                 if (this.image === undefined) {
5152                     this.image = null;
5153                 }
5154                 if (this.width === undefined) {
5155                     this.width = 0;
5156                 }
5157                 if (this.height === undefined) {
5158                     this.height = 0;
5159                 }
5160                 if (this.xOffset === undefined) {
5161                     this.xOffset = 0;
5162                 }
5163                 if (this.yOffset === undefined) {
5164                     this.yOffset = 0;
5165                 }
5166                 if (this.angle === undefined) {
5167                     this.angle = 0;
5168                 }
5169                 if (this.scale === undefined) {
5170                     this.scale = 0;
5171                 }
5172                 if (this.fittingArea === undefined) {
5173                     this.fittingArea = false;
5174                 }
5175                 if (this.leftToRightOriented === undefined) {
5176                     this.leftToRightOriented = false;
5177                 }
5178             }
5179             if (this.catalogId === undefined) {
5180                 this.catalogId = null;
5181             }
5182             if (this.name === undefined) {
5183                 this.name = null;
5184             }
5185             if (this.creator === undefined) {
5186                 this.creator = null;
5187             }
5188             if (this.image === undefined) {
5189                 this.image = null;
5190             }
5191             if (this.width === undefined) {
5192                 this.width = 0;
5193             }
5194             if (this.height === undefined) {
5195                 this.height = 0;
5196             }
5197             if (this.xOffset === undefined) {
5198                 this.xOffset = 0;
5199             }
5200             if (this.yOffset === undefined) {
5201                 this.yOffset = 0;
5202             }
5203             if (this.angle === undefined) {
5204                 this.angle = 0;
5205             }
5206             if (this.scale === undefined) {
5207                 this.scale = 0;
5208             }
5209             if (this.fittingArea === undefined) {
5210                 this.fittingArea = false;
5211             }
5212             if (this.leftToRightOriented === undefined) {
5213                 this.leftToRightOriented = false;
5214             }
5215         }
5216         else
5217             throw new Error('invalid overload');
5218     }
5219     /**
5220      * Returns the catalog ID of this texture or <code>null</code> if it doesn't exist.
5221      * @return {string}
5222      */
5223     HomeTexture.prototype.getCatalogId = function () {
5224         return this.catalogId;
5225     };
5226     /**
5227      * Returns the name of this texture.
5228      * @return {string}
5229      */
5230     HomeTexture.prototype.getName = function () {
5231         return this.name;
5232     };
5233     /**
5234      * Returns the creator of this texture.
5235      * @return {string}
5236      */
5237     HomeTexture.prototype.getCreator = function () {
5238         return this.creator;
5239     };
5240     /**
5241      * Returns the content of the image used for this texture.
5242      * @return {Object}
5243      */
5244     HomeTexture.prototype.getImage = function () {
5245         return this.image;
5246     };
5247     /**
5248      * Returns the width of the image in centimeters.
5249      * @return {number}
5250      */
5251     HomeTexture.prototype.getWidth = function () {
5252         return this.width;
5253     };
5254     /**
5255      * Returns the height of the image in centimeters.
5256      * @return {number}
5257      */
5258     HomeTexture.prototype.getHeight = function () {
5259         return this.height;
5260     };
5261     /**
5262      * Returns the offset applied to the texture along X axis in percentage of its width.
5263      * @return {number}
5264      */
5265     HomeTexture.prototype.getXOffset = function () {
5266         return this.xOffset;
5267     };
5268     /**
5269      * Returns the offset applied to the texture along Y axis in percentage of its height.
5270      * @return {number}
5271      */
5272     HomeTexture.prototype.getYOffset = function () {
5273         return this.yOffset;
5274     };
5275     /**
5276      * Returns the angle of rotation in radians applied to this texture.
5277      * @return {number}
5278      */
5279     HomeTexture.prototype.getAngle = function () {
5280         return this.angle;
5281     };
5282     /**
5283      * Returns the scale applied to this texture.
5284      * @return {number}
5285      */
5286     HomeTexture.prototype.getScale = function () {
5287         return this.scale;
5288     };
5289     /**
5290      * Returns <code>true</code> the texture should fit the area to which it's applied.
5291      * @return {boolean}
5292      */
5293     HomeTexture.prototype.isFittingArea = function () {
5294         return this.fittingArea;
5295     };
5296     /**
5297      * Sets whether the texture should fit the area to which it's applied.
5298      * @param {boolean} fittingArea
5299      */
5300     HomeTexture.prototype.setFittingArea = function (fittingArea) {
5301         this.fittingArea = fittingArea;
5302     };
5303     /**
5304      * Returns <code>true</code> if the objects using this texture should take into account
5305      * the orientation of the texture.
5306      * @return {boolean}
5307      */
5308     HomeTexture.prototype.isLeftToRightOriented = function () {
5309         return this.leftToRightOriented;
5310     };
5311     /**
5312      * Returns <code>true</code> if the object in parameter is equal to this texture.
5313      * @param {Object} obj
5314      * @return {boolean}
5315      */
5316     HomeTexture.prototype.equals = function (obj) {
5317         if (obj === this) {
5318             return true;
5319         }
5320         else if (obj != null && obj instanceof HomeTexture) {
5321             var texture = obj;
5322             return (texture.name === this.name || texture.name != null && (texture.name === this.name)) && (texture.image === this.image || texture.image != null && /* equals */ (function (o1, o2) { if (o1 && o1.equals) {
5323                 return o1.equals(o2);
5324             }
5325             else {
5326                 return o1 === o2;
5327             } })(texture.image, this.image)) && texture.width === this.width && texture.height === this.height && texture.xOffset === this.xOffset && texture.yOffset === this.yOffset && texture.fittingArea === this.fittingArea && texture.leftToRightOriented === this.leftToRightOriented && texture.angle === this.angle && texture.scale === this.scale;
5328         }
5329         else {
5330             return false;
5331         }
5332     };
5333     /**
5334      * Returns a hash code for this texture.
5335      * @return {number}
5336      */
5337     HomeTexture.prototype.hashCode = function () {
5338         return (this.name != null ? /* hashCode */ (function (o) { if (o.hashCode) {
5339             return o.hashCode();
5340         }
5341         else {
5342             return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
5343         } })(this.name) : 0) + (this.image != null ? /* hashCode */ (function (o) { if (o.hashCode) {
5344             return o.hashCode();
5345         }
5346         else {
5347             return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
5348         } })(this.image) : 0) + /* floatToIntBits */ (function (f) { var buf = new ArrayBuffer(4); (new Float32Array(buf))[0] = f; return (new Uint32Array(buf))[0]; })(this.width) + /* floatToIntBits */ (function (f) { var buf = new ArrayBuffer(4); (new Float32Array(buf))[0] = f; return (new Uint32Array(buf))[0]; })(this.height) + /* floatToIntBits */ (function (f) { var buf = new ArrayBuffer(4); (new Float32Array(buf))[0] = f; return (new Uint32Array(buf))[0]; })(this.xOffset) + /* floatToIntBits */ (function (f) { var buf = new ArrayBuffer(4); (new Float32Array(buf))[0] = f; return (new Uint32Array(buf))[0]; })(this.yOffset) + /* floatToIntBits */ (function (f) { var buf = new ArrayBuffer(4); (new Float32Array(buf))[0] = f; return (new Uint32Array(buf))[0]; })(this.angle) + /* floatToIntBits */ (function (f) { var buf = new ArrayBuffer(4); (new Float32Array(buf))[0] = f; return (new Uint32Array(buf))[0]; })(this.scale);
5349     };
5350     return HomeTexture;
5351 }());
5352 HomeTexture["__class"] = "com.eteks.sweethome3d.model.HomeTexture";
5353 HomeTexture["__interfaces"] = ["com.eteks.sweethome3d.model.TextureImage"];
5354 /**
5355  * Creates a <code>IllegalHomonymException</code> with its message.
5356  * @param {string} s
5357  * @class
5358  * @extends Error
5359  * @author Emmanuel Puybaret
5360  * @ignore
5361  */
5362 var IllegalHomonymException = /** @class */ (function () {
5363     function IllegalHomonymException(s) {
5364         if (((typeof s === 'string') || s === null)) {
5365             var __args = arguments;
5366         }
5367         else if (s === undefined) {
5368             var __args = arguments;
5369         }
5370         else
5371             throw new Error('invalid overload');
5372     }
5373     return IllegalHomonymException;
5374 }());
5375 IllegalHomonymException["__class"] = "com.eteks.sweethome3d.model.IllegalHomonymException";
5376 /**
5377  * The aspect ratio of pictures.
5378  * @enum
5379  * @property {AspectRatio} FREE_RATIO
5380  * @property {AspectRatio} VIEW_3D_RATIO
5381  * @property {AspectRatio} RATIO_4_3
5382  * @property {AspectRatio} RATIO_3_2
5383  * @property {AspectRatio} RATIO_16_9
5384  * @property {AspectRatio} RATIO_2_1
5385  * @property {AspectRatio} RATIO_24_10
5386  * @property {AspectRatio} SQUARE_RATIO
5387  * @class
5388  */
5389 var AspectRatio;
5390 (function (AspectRatio) {
5391     AspectRatio[AspectRatio["FREE_RATIO"] = 0] = "FREE_RATIO";
5392     AspectRatio[AspectRatio["VIEW_3D_RATIO"] = 1] = "VIEW_3D_RATIO";
5393     AspectRatio[AspectRatio["RATIO_4_3"] = 2] = "RATIO_4_3";
5394     AspectRatio[AspectRatio["RATIO_3_2"] = 3] = "RATIO_3_2";
5395     AspectRatio[AspectRatio["RATIO_16_9"] = 4] = "RATIO_16_9";
5396     AspectRatio[AspectRatio["RATIO_2_1"] = 5] = "RATIO_2_1";
5397     AspectRatio[AspectRatio["RATIO_24_10"] = 6] = "RATIO_24_10";
5398     AspectRatio[AspectRatio["SQUARE_RATIO"] = 7] = "SQUARE_RATIO";
5399 })(AspectRatio || (AspectRatio = {}));
5400 /** @ignore */
5401 var AspectRatio_$WRAPPER = /** @class */ (function () {
5402     function AspectRatio_$WRAPPER(_$ordinal, _$name, value) {
5403         this._$ordinal = _$ordinal;
5404         this._$name = _$name;
5405         if (this.value === undefined) {
5406             this.value = null;
5407         }
5408         this.value = value;
5409     }
5410     /**
5411      * Returns the value of this aspect ratio (width / height) or <code>null</code> if it's not known.
5412      * @return {number}
5413      */
5414     AspectRatio_$WRAPPER.prototype.getValue = function () {
5415         return this.value;
5416     };
5417     AspectRatio_$WRAPPER.prototype.name = function () { return this._$name; };
5418     AspectRatio_$WRAPPER.prototype.ordinal = function () { return this._$ordinal; };
5419     AspectRatio_$WRAPPER.prototype.compareTo = function (other) { return this._$ordinal - (isNaN(other) ? other._$ordinal : other); };
5420     return AspectRatio_$WRAPPER;
5421 }());
5422 AspectRatio["__class"] = "com.eteks.sweethome3d.model.AspectRatio";
5423 AspectRatio["_$wrappers"] = { 0: new AspectRatio_$WRAPPER(0, "FREE_RATIO", null), 1: new AspectRatio_$WRAPPER(1, "VIEW_3D_RATIO", null), 2: new AspectRatio_$WRAPPER(2, "RATIO_4_3", 4.0 / 3), 3: new AspectRatio_$WRAPPER(3, "RATIO_3_2", 1.5), 4: new AspectRatio_$WRAPPER(4, "RATIO_16_9", 16.0 / 9), 5: new AspectRatio_$WRAPPER(5, "RATIO_2_1", 2.0 / 1.0), 6: new AspectRatio_$WRAPPER(6, "RATIO_24_10", 2.4), 7: new AspectRatio_$WRAPPER(7, "SQUARE_RATIO", 1.0) };
5424 /**
5425  * Creates a baseboard.
5426  * @param {number} thickness
5427  * @param {number} height
5428  * @param {number} color
5429  * @param {HomeTexture} texture
5430  * @class
5431  * @author Emmanuel Puybaret
5432  */
5433 var Baseboard = /** @class */ (function () {
5434     function Baseboard(thickness, height, color, texture, cached) {
5435         if (((typeof thickness === 'number') || thickness === null) && ((typeof height === 'number') || height === null) && ((typeof color === 'number') || color === null) && ((texture != null && texture instanceof HomeTexture) || texture === null) && ((typeof cached === 'boolean') || cached === null)) {
5436             var __args = arguments;
5437             if (this.thickness === undefined) {
5438                 this.thickness = 0;
5439             }
5440             if (this.height === undefined) {
5441                 this.height = 0;
5442             }
5443             if (this.color === undefined) {
5444                 this.color = null;
5445             }
5446             if (this.texture === undefined) {
5447                 this.texture = null;
5448             }
5449             this.height = height;
5450             this.thickness = thickness;
5451             this.color = color;
5452             this.texture = texture;
5453             if (cached) {
5454                 /* add */ (Baseboard.baseboardsCache_$LI$().push(this) > 0);
5455             }
5456         }
5457         else if (((typeof thickness === 'number') || thickness === null) && ((typeof height === 'number') || height === null) && ((typeof color === 'number') || color === null) && ((texture != null && texture instanceof HomeTexture) || texture === null) && cached === undefined) {
5458             var __args = arguments;
5459             {
5460                 var __args_33 = arguments;
5461                 var thickness_1 = __args_33[1];
5462                 var height_3 = __args_33[0];
5463                 var cached_5 = true;
5464                 if (this.thickness === undefined) {
5465                     this.thickness = 0;
5466                 }
5467                 if (this.height === undefined) {
5468                     this.height = 0;
5469                 }
5470                 if (this.color === undefined) {
5471                     this.color = null;
5472                 }
5473                 if (this.texture === undefined) {
5474                     this.texture = null;
5475                 }
5476                 this.height = height_3;
5477                 this.thickness = thickness_1;
5478                 this.color = color;
5479                 this.texture = texture;
5480                 if (cached_5) {
5481                     /* add */ (Baseboard.baseboardsCache_$LI$().push(this) > 0);
5482                 }
5483             }
5484             if (this.thickness === undefined) {
5485                 this.thickness = 0;
5486             }
5487             if (this.height === undefined) {
5488                 this.height = 0;
5489             }
5490             if (this.color === undefined) {
5491                 this.color = null;
5492             }
5493             if (this.texture === undefined) {
5494                 this.texture = null;
5495             }
5496         }
5497         else
5498             throw new Error('invalid overload');
5499     }
5500     Baseboard.baseboardsCache_$LI$ = function () { if (Baseboard.baseboardsCache == null) {
5501         Baseboard.baseboardsCache = [];
5502     } return Baseboard.baseboardsCache; };
5503     /**
5504      * Returns an instance of this class matching the given parameters.
5505      * @param {number} thickness
5506      * @param {number} height
5507      * @param {number} color
5508      * @param {HomeTexture} texture
5509      * @return {Baseboard}
5510      */
5511     Baseboard.getInstance = function (thickness, height, color, texture) {
5512         var baseboard = new Baseboard(thickness, height, color, texture, false);
5513         for (var i = Baseboard.baseboardsCache_$LI$().length - 1; i >= 0; i--) {
5514             {
5515                 var cachedBaseboard = Baseboard.baseboardsCache_$LI$()[i];
5516                 if (cachedBaseboard == null) {
5517                     /* remove */ Baseboard.baseboardsCache_$LI$().splice(i, 1)[0];
5518                 }
5519                 else if (cachedBaseboard.equals(baseboard)) {
5520                     return baseboard;
5521                 }
5522             }
5523             ;
5524         }
5525         /* add */ (Baseboard.baseboardsCache_$LI$().push(baseboard) > 0);
5526         return baseboard;
5527     };
5528     /**
5529      * Returns the thickness of this baseboard.
5530      * @return {number}
5531      */
5532     Baseboard.prototype.getThickness = function () {
5533         return this.thickness;
5534     };
5535     /**
5536      * Returns the height of this baseboard.
5537      * @return {number}
5538      */
5539     Baseboard.prototype.getHeight = function () {
5540         return this.height;
5541     };
5542     /**
5543      * Returns the color of this baseboard.
5544      * @return {number}
5545      */
5546     Baseboard.prototype.getColor = function () {
5547         return this.color;
5548     };
5549     /**
5550      * Returns the texture of this baseboard.
5551      * @return {HomeTexture}
5552      */
5553     Baseboard.prototype.getTexture = function () {
5554         return this.texture;
5555     };
5556     /**
5557      * Returns <code>true</code> if this baseboard is equal to <code>object</code>.
5558      * @param {Object} object
5559      * @return {boolean}
5560      */
5561     Baseboard.prototype.equals = function (object) {
5562         if (object != null && object instanceof Baseboard) {
5563             var baseboard = object;
5564             return baseboard.thickness === this.thickness && baseboard.height === this.height && (baseboard.color === this.color || baseboard.color != null && (baseboard.color === this.color)) && (baseboard.texture === this.texture || baseboard.texture != null && baseboard.texture.equals(this.texture));
5565         }
5566         return false;
5567     };
5568     /**
5569      * Returns a hash code for this baseboard.
5570      * @return {number}
5571      */
5572     Baseboard.prototype.hashCode = function () {
5573         var hashCode = (function (f) { var buf = new ArrayBuffer(4); (new Float32Array(buf))[0] = f; return (new Uint32Array(buf))[0]; })(this.thickness) + /* floatToIntBits */ (function (f) { var buf = new ArrayBuffer(4); (new Float32Array(buf))[0] = f; return (new Uint32Array(buf))[0]; })(this.height);
5574         if (this.color != null) {
5575             hashCode += /* hashCode */ (function (o) { if (o.hashCode) {
5576                 return o.hashCode();
5577             }
5578             else {
5579                 return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
5580             } })(this.color);
5581         }
5582         if (this.texture != null) {
5583             hashCode += /* hashCode */ (function (o) { if (o.hashCode) {
5584                 return o.hashCode();
5585             }
5586             else {
5587                 return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
5588             } })(this.texture);
5589         }
5590         return hashCode;
5591     };
5592     return Baseboard;
5593 }());
5594 Baseboard["__class"] = "com.eteks.sweethome3d.model.Baseboard";
5595 /**
5596  * Furniture catalog.
5597  * @author Emmanuel Puybaret
5598  * @class
5599  */
5600 var FurnitureCatalog = /** @class */ (function () {
5601     function FurnitureCatalog() {
5602         this.categories = ([]);
5603         this.furnitureChangeSupport = (new CollectionChangeSupport(this));
5604     }
5605     /**
5606      * Returns the categories list sorted by name.
5607      * @return {FurnitureCategory[]} a list of categories.
5608      */
5609     FurnitureCatalog.prototype.getCategories = function () {
5610         return /* unmodifiableList */ this.categories.slice(0);
5611     };
5612     /**
5613      * Returns the count of categories in this catalog.
5614      * @return {number}
5615      */
5616     FurnitureCatalog.prototype.getCategoriesCount = function () {
5617         return /* size */ this.categories.length;
5618     };
5619     /**
5620      * Returns the category at a given <code>index</code>.
5621      * @param {number} index
5622      * @return {FurnitureCategory}
5623      */
5624     FurnitureCatalog.prototype.getCategory = function (index) {
5625         return /* get */ this.categories[index];
5626     };
5627     /**
5628      * Adds the furniture <code>listener</code> in parameter to this catalog.
5629      * @param {Object} listener
5630      */
5631     FurnitureCatalog.prototype.addFurnitureListener = function (listener) {
5632         this.furnitureChangeSupport.addCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
5633             return funcInst;
5634         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
5635     };
5636     /**
5637      * Removes the furniture <code>listener</code> in parameter from this catalog.
5638      * @param {Object} listener
5639      */
5640     FurnitureCatalog.prototype.removeFurnitureListener = function (listener) {
5641         this.furnitureChangeSupport.removeCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
5642             return funcInst;
5643         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
5644     };
5645     /**
5646      * Adds <code>piece</code> of a given <code>category</code> to this catalog.
5647      * Once the <code>piece</code> is added, furniture listeners added to this catalog will receive a
5648      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
5649      * notification.
5650      * @param {FurnitureCategory} category the category of the piece.
5651      * @param {CatalogPieceOfFurniture} piece    a piece of furniture.
5652      */
5653     FurnitureCatalog.prototype.add = function (category, piece) {
5654         var index = (function (l, key) { var comp = function (a, b) { if (a.compareTo)
5655             return a.compareTo(b);
5656         else
5657             return a.localeCompare(b); }; var low = 0; var high = l.length - 1; while (low <= high) {
5658             var mid = (low + high) >>> 1;
5659             var midVal = l[mid];
5660             var cmp = comp(midVal, key);
5661             if (cmp < 0)
5662                 low = mid + 1;
5663             else if (cmp > 0)
5664                 high = mid - 1;
5665             else
5666                 return mid;
5667         } return -(low + 1); })(this.categories, category);
5668         if (index < 0) {
5669             category = new FurnitureCategory(category.getName());
5670             /* add */ this.categories.splice(-index - 1, 0, category);
5671         }
5672         else {
5673             category = /* get */ this.categories[index];
5674         }
5675         category.add(piece);
5676         this.furnitureChangeSupport.fireCollectionChanged(piece, category.getIndexOfPieceOfFurniture(piece), CollectionEvent.Type.ADD);
5677     };
5678     /**
5679      * Deletes the <code>piece</code> from this catalog.
5680      * If then piece category is empty, it will be removed from the categories of this catalog.
5681      * Once the <code>piece</code> is deleted, furniture listeners added to this catalog will receive a
5682      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
5683      * notification.
5684      * @param {CatalogPieceOfFurniture} piece a piece of furniture in that category.
5685      */
5686     FurnitureCatalog.prototype["delete"] = function (piece) {
5687         var category = piece.getCategory();
5688         if (category != null) {
5689             var pieceIndex = category.getIndexOfPieceOfFurniture(piece);
5690             if (pieceIndex >= 0) {
5691                 category["delete"](piece);
5692                 if (category.getFurnitureCount() === 0) {
5693                     this.categories = (this.categories.slice(0));
5694                     /* remove */ (function (a) { var index = a.indexOf(category); if (index >= 0) {
5695                         a.splice(index, 1);
5696                         return true;
5697                     }
5698                     else {
5699                         return false;
5700                     } })(this.categories);
5701                 }
5702                 this.furnitureChangeSupport.fireCollectionChanged(piece, pieceIndex, CollectionEvent.Type.DELETE);
5703                 return;
5704             }
5705         }
5706         throw new IllegalArgumentException("catalog doesn\'t contain piece " + piece.getName());
5707     };
5708     /**
5709      * Returns the piece of furniture with the given <code>id</code> if it exists.
5710      * @param {string} id
5711      * @return {CatalogPieceOfFurniture}
5712      */
5713     FurnitureCatalog.prototype.getPieceOfFurnitureWithId = function (id) {
5714         for (var index = 0; index < this.categories.length; index++) {
5715             var category = this.categories[index];
5716             {
5717                 {
5718                     var array = category.getFurniture();
5719                     for (var index1 = 0; index1 < array.length; index1++) {
5720                         var piece = array[index1];
5721                         {
5722                             if (id === piece.getId()) {
5723                                 return piece;
5724                             }
5725                         }
5726                     }
5727                 }
5728             }
5729         }
5730         return null;
5731     };
5732     return FurnitureCatalog;
5733 }());
5734 FurnitureCatalog["__class"] = "com.eteks.sweethome3d.model.FurnitureCatalog";
5735 /**
5736  * Creates a home descriptor.
5737  * @param {string} name name of the home
5738  * @param {Object} content content that allows to read home data
5739  * @param {Object} icon icon of the home
5740  * @class
5741  * @author Emmanuel Puybaret
5742  */
5743 var HomeDescriptor = /** @class */ (function () {
5744     function HomeDescriptor(name, content, icon) {
5745         if (this.name === undefined) {
5746             this.name = null;
5747         }
5748         if (this.content === undefined) {
5749             this.content = null;
5750         }
5751         if (this.icon === undefined) {
5752             this.icon = null;
5753         }
5754         this.name = name;
5755         this.content = content;
5756         this.icon = icon;
5757     }
5758     /**
5759      * Returns the name of this home.
5760      * @return {string}
5761      */
5762     HomeDescriptor.prototype.getName = function () {
5763         return this.name;
5764     };
5765     /**
5766      * Returns the content to read this home.
5767      * @return {Object}
5768      */
5769     HomeDescriptor.prototype.getContent = function () {
5770         return this.content;
5771     };
5772     /**
5773      * Returns the icon of this home.
5774      * @return {Object}
5775      */
5776     HomeDescriptor.prototype.getIcon = function () {
5777         return this.icon;
5778     };
5779     return HomeDescriptor;
5780 }());
5781 HomeDescriptor["__class"] = "com.eteks.sweethome3d.model.HomeDescriptor";
5782 /**
5783  * Application managing a list of homes displayed at screen.
5784  * @author Emmanuel Puybaret
5785  * @class
5786  */
5787 var HomeApplication = /** @class */ (function () {
5788     function HomeApplication() {
5789         this.homes = ([]);
5790         this.homesChangeSupport = (new CollectionChangeSupport(this));
5791     }
5792     /**
5793      * Adds the home <code>listener</code> in parameter to this application.
5794      * @param {Object} listener
5795      */
5796     HomeApplication.prototype.addHomesListener = function (listener) {
5797         this.homesChangeSupport.addCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
5798             return funcInst;
5799         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
5800     };
5801     /**
5802      * Removes the home <code>listener</code> in parameter from this application.
5803      * @param {Object} listener
5804      */
5805     HomeApplication.prototype.removeHomesListener = function (listener) {
5806         this.homesChangeSupport.removeCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
5807             return funcInst;
5808         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
5809     };
5810     /**
5811      * Returns a new home.
5812      * @return {Home} a new home with wall heights equal to the one in user preferences.
5813      */
5814     HomeApplication.prototype.createHome = function () {
5815         return new Home(this.getUserPreferences().getNewWallHeight());
5816     };
5817     /**
5818      * Returns a collection of the homes of this application.
5819      * @return {Home[]}
5820      */
5821     HomeApplication.prototype.getHomes = function () {
5822         return /* unmodifiableList */ this.homes.slice(0);
5823     };
5824     /**
5825      * Adds a given <code>home</code> to the homes list of this application.
5826      * Once the <code>home</code> is added, home listeners added
5827      * to this application will receive a
5828      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
5829      * notification, with an {@link CollectionEvent#getType() event type}
5830      * equal to {@link CollectionEvent.Type#ADD}.
5831      * @param {Home} home
5832      */
5833     HomeApplication.prototype.addHome = function (home) {
5834         this.homes = (this.homes.slice(0));
5835         /* add */ (this.homes.push(home) > 0);
5836         this.homesChangeSupport.fireCollectionChanged(home, /* size */ this.homes.length - 1, CollectionEvent.Type.ADD);
5837     };
5838     /**
5839      * Removes a given <code>home</code> from the homes list  of this application.
5840      * Once the <code>home</code> is removed, home listeners added
5841      * to this application will receive a
5842      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
5843      * notification, with an {@link CollectionEvent#getType() event type}
5844      * equal to {@link CollectionEvent.Type#DELETE}.
5845      * @param {Home} home
5846      */
5847     HomeApplication.prototype.deleteHome = function (home) {
5848         var index = this.homes.indexOf(home);
5849         if (index !== -1) {
5850             this.homes = (this.homes.slice(0));
5851             /* remove */ this.homes.splice(index, 1)[0];
5852             this.homesChangeSupport.fireCollectionChanged(home, index, CollectionEvent.Type.DELETE);
5853         }
5854     };
5855     HomeApplication.prototype.getHomeRecorder$ = function () { throw new Error('cannot invoke abstract overloaded method... check your argument(s) type(s)'); };
5856     HomeApplication.prototype.getHomeRecorder$com_eteks_sweethome3d_model_HomeRecorder_Type = function (type) {
5857         return this.getHomeRecorder$();
5858     };
5859     /**
5860      * Returns a recorder of a given <code>type</code> able to write and read homes.
5861      * Subclasses may override this method to return a recorder matching <code>type</code>.
5862      * @param {HomeRecorder.Type} type  a hint for the application to choose the returned recorder.
5863      * @return {Object} the default recorder able to write and read homes.
5864      */
5865     HomeApplication.prototype.getHomeRecorder = function (type) {
5866         if (((typeof type === 'number') || type === null)) {
5867             return this.getHomeRecorder$com_eteks_sweethome3d_model_HomeRecorder_Type(type);
5868         }
5869         else if (type === undefined) {
5870             return this.getHomeRecorder$();
5871         }
5872         else
5873             throw new Error('invalid overload');
5874     };
5875     /**
5876      * Returns the name of this application. Default implementation returns <i>Sweet Home 3D</i>.
5877      * @return {string}
5878      */
5879     HomeApplication.prototype.getName = function () {
5880         return "Sweet Home 3D";
5881     };
5882     /**
5883      * Returns information about the version of this application.
5884      * Default implementation returns an empty string.
5885      * @return {string}
5886      */
5887     HomeApplication.prototype.getVersion = function () {
5888         return "";
5889     };
5890     /**
5891      * Returns the id of this application.
5892      * Default implementation returns null.
5893      * @return {string}
5894      */
5895     HomeApplication.prototype.getId = function () {
5896         return null;
5897     };
5898     return HomeApplication;
5899 }());
5900 HomeApplication["__class"] = "com.eteks.sweethome3d.model.HomeApplication";
5901 /**
5902  * Creates a background image.
5903  * @param {Object} image
5904  * @param {number} scaleDistance
5905  * @param {number} scaleDistanceXStart
5906  * @param {number} scaleDistanceYStart
5907  * @param {number} scaleDistanceXEnd
5908  * @param {number} scaleDistanceYEnd
5909  * @param {number} xOrigin
5910  * @param {number} yOrigin
5911  * @param {boolean} visible
5912  * @class
5913  * @author Emmanuel Puybaret
5914  */
5915 var BackgroundImage = /** @class */ (function () {
5916     function BackgroundImage(image, scaleDistance, scaleDistanceXStart, scaleDistanceYStart, scaleDistanceXEnd, scaleDistanceYEnd, xOrigin, yOrigin, visible) {
5917         if (((image != null && (image.constructor != null && image.constructor["__interfaces"] != null && image.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || image === null) && ((typeof scaleDistance === 'number') || scaleDistance === null) && ((typeof scaleDistanceXStart === 'number') || scaleDistanceXStart === null) && ((typeof scaleDistanceYStart === 'number') || scaleDistanceYStart === null) && ((typeof scaleDistanceXEnd === 'number') || scaleDistanceXEnd === null) && ((typeof scaleDistanceYEnd === 'number') || scaleDistanceYEnd === null) && ((typeof xOrigin === 'number') || xOrigin === null) && ((typeof yOrigin === 'number') || yOrigin === null) && ((typeof visible === 'boolean') || visible === null)) {
5918             var __args = arguments;
5919             if (this.image === undefined) {
5920                 this.image = null;
5921             }
5922             if (this.scaleDistance === undefined) {
5923                 this.scaleDistance = 0;
5924             }
5925             if (this.scaleDistanceXStart === undefined) {
5926                 this.scaleDistanceXStart = 0;
5927             }
5928             if (this.scaleDistanceYStart === undefined) {
5929                 this.scaleDistanceYStart = 0;
5930             }
5931             if (this.scaleDistanceXEnd === undefined) {
5932                 this.scaleDistanceXEnd = 0;
5933             }
5934             if (this.scaleDistanceYEnd === undefined) {
5935                 this.scaleDistanceYEnd = 0;
5936             }
5937             if (this.xOrigin === undefined) {
5938                 this.xOrigin = 0;
5939             }
5940             if (this.yOrigin === undefined) {
5941                 this.yOrigin = 0;
5942             }
5943             if (this.invisible === undefined) {
5944                 this.invisible = false;
5945             }
5946             this.image = image;
5947             this.scaleDistance = scaleDistance;
5948             this.scaleDistanceXStart = scaleDistanceXStart;
5949             this.scaleDistanceYStart = scaleDistanceYStart;
5950             this.scaleDistanceXEnd = scaleDistanceXEnd;
5951             this.scaleDistanceYEnd = scaleDistanceYEnd;
5952             this.xOrigin = xOrigin;
5953             this.yOrigin = yOrigin;
5954             this.invisible = !visible;
5955         }
5956         else if (((image != null && (image.constructor != null && image.constructor["__interfaces"] != null && image.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || image === null) && ((typeof scaleDistance === 'number') || scaleDistance === null) && ((typeof scaleDistanceXStart === 'number') || scaleDistanceXStart === null) && ((typeof scaleDistanceYStart === 'number') || scaleDistanceYStart === null) && ((typeof scaleDistanceXEnd === 'number') || scaleDistanceXEnd === null) && ((typeof scaleDistanceYEnd === 'number') || scaleDistanceYEnd === null) && ((typeof xOrigin === 'number') || xOrigin === null) && ((typeof yOrigin === 'number') || yOrigin === null) && visible === undefined) {
5957             var __args = arguments;
5958             {
5959                 var __args_34 = arguments;
5960                 var visible_1 = true;
5961                 if (this.image === undefined) {
5962                     this.image = null;
5963                 }
5964                 if (this.scaleDistance === undefined) {
5965                     this.scaleDistance = 0;
5966                 }
5967                 if (this.scaleDistanceXStart === undefined) {
5968                     this.scaleDistanceXStart = 0;
5969                 }
5970                 if (this.scaleDistanceYStart === undefined) {
5971                     this.scaleDistanceYStart = 0;
5972                 }
5973                 if (this.scaleDistanceXEnd === undefined) {
5974                     this.scaleDistanceXEnd = 0;
5975                 }
5976                 if (this.scaleDistanceYEnd === undefined) {
5977                     this.scaleDistanceYEnd = 0;
5978                 }
5979                 if (this.xOrigin === undefined) {
5980                     this.xOrigin = 0;
5981                 }
5982                 if (this.yOrigin === undefined) {
5983                     this.yOrigin = 0;
5984                 }
5985                 if (this.invisible === undefined) {
5986                     this.invisible = false;
5987                 }
5988                 this.image = image;
5989                 this.scaleDistance = scaleDistance;
5990                 this.scaleDistanceXStart = scaleDistanceXStart;
5991                 this.scaleDistanceYStart = scaleDistanceYStart;
5992                 this.scaleDistanceXEnd = scaleDistanceXEnd;
5993                 this.scaleDistanceYEnd = scaleDistanceYEnd;
5994                 this.xOrigin = xOrigin;
5995                 this.yOrigin = yOrigin;
5996                 this.invisible = !visible_1;
5997             }
5998             if (this.image === undefined) {
5999                 this.image = null;
6000             }
6001             if (this.scaleDistance === undefined) {
6002                 this.scaleDistance = 0;
6003             }
6004             if (this.scaleDistanceXStart === undefined) {
6005                 this.scaleDistanceXStart = 0;
6006             }
6007             if (this.scaleDistanceYStart === undefined) {
6008                 this.scaleDistanceYStart = 0;
6009             }
6010             if (this.scaleDistanceXEnd === undefined) {
6011                 this.scaleDistanceXEnd = 0;
6012             }
6013             if (this.scaleDistanceYEnd === undefined) {
6014                 this.scaleDistanceYEnd = 0;
6015             }
6016             if (this.xOrigin === undefined) {
6017                 this.xOrigin = 0;
6018             }
6019             if (this.yOrigin === undefined) {
6020                 this.yOrigin = 0;
6021             }
6022             if (this.invisible === undefined) {
6023                 this.invisible = false;
6024             }
6025         }
6026         else
6027             throw new Error('invalid overload');
6028     }
6029     /**
6030      * Returns the image content of this background image.
6031      * @return {Object}
6032      */
6033     BackgroundImage.prototype.getImage = function () {
6034         return this.image;
6035     };
6036     /**
6037      * Returns the distance used to compute the scale of this image.
6038      * @return {number}
6039      */
6040     BackgroundImage.prototype.getScaleDistance = function () {
6041         return this.scaleDistance;
6042     };
6043     /**
6044      * Returns the abscissa of the start point used to compute
6045      * the scale of this image.
6046      * @return {number}
6047      */
6048     BackgroundImage.prototype.getScaleDistanceXStart = function () {
6049         return this.scaleDistanceXStart;
6050     };
6051     /**
6052      * Returns the ordinate of the start point used to compute
6053      * the scale of this image.
6054      * @return {number}
6055      */
6056     BackgroundImage.prototype.getScaleDistanceYStart = function () {
6057         return this.scaleDistanceYStart;
6058     };
6059     /**
6060      * Returns the abscissa of the end point used to compute
6061      * the scale of this image.
6062      * @return {number}
6063      */
6064     BackgroundImage.prototype.getScaleDistanceXEnd = function () {
6065         return this.scaleDistanceXEnd;
6066     };
6067     /**
6068      * Returns the ordinate of the end point used to compute
6069      * the scale of this image.
6070      * @return {number}
6071      */
6072     BackgroundImage.prototype.getScaleDistanceYEnd = function () {
6073         return this.scaleDistanceYEnd;
6074     };
6075     /**
6076      * Returns the scale of this image.
6077      * @return {number}
6078      */
6079     BackgroundImage.prototype.getScale = function () {
6080         return BackgroundImage.getScale(this.scaleDistance, this.scaleDistanceXStart, this.scaleDistanceYStart, this.scaleDistanceXEnd, this.scaleDistanceYEnd);
6081     };
6082     /**
6083      * Returns the scale equal to <code>scaleDistance</code> divided
6084      * by the distance between the points
6085      * (<code>scaleDistanceXStart</code>, <code>scaleDistanceYStart</code>)
6086      * and (<code>scaleDistanceXEnd</code>, <code>scaleDistanceYEnd</code>).
6087      * @param {number} scaleDistance
6088      * @param {number} scaleDistanceXStart
6089      * @param {number} scaleDistanceYStart
6090      * @param {number} scaleDistanceXEnd
6091      * @param {number} scaleDistanceYEnd
6092      * @return {number}
6093      */
6094     BackgroundImage.getScale = function (scaleDistance, scaleDistanceXStart, scaleDistanceYStart, scaleDistanceXEnd, scaleDistanceYEnd) {
6095         return (scaleDistance / java.awt.geom.Point2D.distance(scaleDistanceXStart, scaleDistanceYStart, scaleDistanceXEnd, scaleDistanceYEnd));
6096     };
6097     /**
6098      * Returns the origin abscissa of this image.
6099      * @return {number}
6100      */
6101     BackgroundImage.prototype.getXOrigin = function () {
6102         return this.xOrigin;
6103     };
6104     /**
6105      * Returns the origin ordinate of this image.
6106      * @return {number}
6107      */
6108     BackgroundImage.prototype.getYOrigin = function () {
6109         return this.yOrigin;
6110     };
6111     /**
6112      * Returns <code>true</code> if this image is visible in plan.
6113      * @return {boolean}
6114      */
6115     BackgroundImage.prototype.isVisible = function () {
6116         return !this.invisible;
6117     };
6118     return BackgroundImage;
6119 }());
6120 BackgroundImage["__class"] = "com.eteks.sweethome3d.model.BackgroundImage";
6121 /**
6122  * Creates a <code>RecorderException</code> with its message
6123  * and the internal cause that initiated this exception.
6124  * @param {string} message
6125  * @param {Error} cause
6126  * @class
6127  * @extends Error
6128  * @author Emmanuel Puybaret
6129  * @ignore
6130  */
6131 var RecorderException = /** @class */ (function (_super) {
6132     __extends(RecorderException, _super);
6133     function RecorderException(message, cause) {
6134         var _this = this;
6135         if (((typeof message === 'string') || message === null) && ((cause != null && (cause["__classes"] && cause["__classes"].indexOf("java.lang.Throwable") >= 0) || cause != null && cause instanceof Error) || cause === null)) {
6136             var __args = arguments;
6137             _this = _super.call(this, message) || this;
6138             _this.message = message;
6139         }
6140         else if (((typeof message === 'string') || message === null) && cause === undefined) {
6141             var __args = arguments;
6142             _this = _super.call(this, message) || this;
6143             _this.message = message;
6144         }
6145         else if (message === undefined && cause === undefined) {
6146             var __args = arguments;
6147             _this = _super.call(this) || this;
6148         }
6149         else
6150             throw new Error('invalid overload');
6151         return _this;
6152     }
6153     return RecorderException;
6154 }(Error));
6155 RecorderException["__class"] = "com.eteks.sweethome3d.model.RecorderException";
6156 /**
6157  * Creates a new object with a unique ID prefixed by <code>object-</code>.
6158  * @class
6159  * @author Emmanuel Puybaret
6160  */
6161 var HomeObject = /** @class */ (function () {
6162     function HomeObject(id) {
6163         if (((typeof id === 'string') || id === null)) {
6164             var __args = arguments;
6165             if (this.id === undefined) {
6166                 this.id = null;
6167             }
6168             if (this.properties === undefined) {
6169                 this.properties = null;
6170             }
6171             if (this.propertyChangeSupport === undefined) {
6172                 this.propertyChangeSupport = null;
6173             }
6174             if (id == null) {
6175                 throw new IllegalArgumentException("ID must exist");
6176             }
6177             this.id = id;
6178         }
6179         else if (id === undefined) {
6180             var __args = arguments;
6181             {
6182                 var __args_35 = arguments;
6183                 var id_3 = HomeObject.createId(HomeObject.ID_DEFAULT_PREFIX);
6184                 if (this.id === undefined) {
6185                     this.id = null;
6186                 }
6187                 if (this.properties === undefined) {
6188                     this.properties = null;
6189                 }
6190                 if (this.propertyChangeSupport === undefined) {
6191                     this.propertyChangeSupport = null;
6192                 }
6193                 if (id_3 == null) {
6194                     throw new IllegalArgumentException("ID must exist");
6195                 }
6196                 this.id = id_3;
6197             }
6198             if (this.id === undefined) {
6199                 this.id = null;
6200             }
6201             if (this.properties === undefined) {
6202                 this.properties = null;
6203             }
6204             if (this.propertyChangeSupport === undefined) {
6205                 this.propertyChangeSupport = null;
6206             }
6207         }
6208         else
6209             throw new Error('invalid overload');
6210     }
6211     /**
6212      * Returns a new ID prefixed by the given string.
6213      * @param {string} prefix
6214      * @return {string}
6215      */
6216     HomeObject.createId = function (prefix) {
6217         return prefix + "-" + UUID.randomUUID();
6218     };
6219     HomeObject.prototype.addPropertyChangeListener = function (propertyName, listener) { if (this.propertyChangeSupport == null) {
6220         this.propertyChangeSupport = new PropertyChangeSupport(this);
6221     } if (listener === undefined) {
6222         this.propertyChangeSupport.addPropertyChangeListener(propertyName);
6223     }
6224     else {
6225         this.propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
6226     } };
6227     HomeObject.prototype.removePropertyChangeListener = function (propertyName, listener) { if (this.propertyChangeSupport != null) {
6228         if (listener === undefined) {
6229             this.propertyChangeSupport.removePropertyChangeListener(propertyName);
6230         }
6231         else {
6232             this.propertyChangeSupport.removePropertyChangeListener(propertyName, listener);
6233         }
6234         if (this.propertyChangeSupport.getPropertyChangeListeners().length === 0) {
6235             this.propertyChangeSupport = null;
6236         }
6237     } };
6238     /**
6239      * Fires a property change of {@link PropertyChangeEvent} class to listeners.
6240      * @param {string} propertyName
6241      * @param {Object} oldValue
6242      * @param {Object} newValue
6243      */
6244     HomeObject.prototype.firePropertyChange = function (propertyName, oldValue, newValue) {
6245         if (this.propertyChangeSupport != null) {
6246             this.propertyChangeSupport.firePropertyChange(propertyName, oldValue, newValue);
6247         }
6248     };
6249     /**
6250      * Returns the ID of this object.
6251      * @return {string} a unique ID
6252      */
6253     HomeObject.prototype.getId = function () {
6254         return this.id;
6255     };
6256     /**
6257      * Returns the value of the property <code>name</code> associated with this object.
6258      * @return {string} the value of the property or <code>null</code> if it doesn't exist.
6259      * @param {string} name
6260      */
6261     HomeObject.prototype.getProperty = function (name) {
6262         if (this.properties != null) {
6263             var propertyValue = (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, name);
6264             if (typeof propertyValue === 'string') {
6265                 return propertyValue;
6266             }
6267         }
6268         return null;
6269     };
6270     /**
6271      * Returns the value of the content <code>name</code> associated to this object.
6272      * @return {Object} the value of the content or <code>null</code> if it doesn't exist or if it's not a content.
6273      * @param {string} name
6274      */
6275     HomeObject.prototype.getContentProperty = function (name) {
6276         if (this.properties != null) {
6277             var propertyValue = (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, name);
6278             if (propertyValue != null && (propertyValue.constructor != null && propertyValue.constructor["__interfaces"] != null && propertyValue.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) {
6279                 return propertyValue;
6280             }
6281         }
6282         return null;
6283     };
6284     /**
6285      * Returns <code>true</code> if the type of given property is a content.
6286      * @param {string} name
6287      * @return {boolean}
6288      */
6289     HomeObject.prototype.isContentProperty = function (name) {
6290         return this.properties != null && ( /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, name) != null && ( /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, name).constructor != null && /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, name).constructor["__interfaces"] != null && /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, name).constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0));
6291     };
6292     HomeObject.prototype.setProperty$java_lang_String$java_lang_String = function (name, value) {
6293         this.setProperty$java_lang_String$java_lang_Object(name, value);
6294     };
6295     /**
6296      * Sets the value of a property associated with this object. Once the property is updated,
6297      * listeners added to this object will receive a change event of {@link PropertyChangeEvent} class.<br>
6298      * To avoid any issue with existing or future properties of Sweet Home 3D classes,
6299      * do not use property names written with only upper case letters.
6300      * @param {string} name   the name of the property to set
6301      * @param {string} value  the new value of the property or <code>null</code> to remove an existing property
6302      */
6303     HomeObject.prototype.setProperty = function (name, value) {
6304         if (((typeof name === 'string') || name === null) && ((typeof value === 'string') || value === null)) {
6305             return this.setProperty$java_lang_String$java_lang_String(name, value);
6306         }
6307         else if (((typeof name === 'string') || name === null) && ((value != null) || value === null)) {
6308             return this.setProperty$java_lang_String$java_lang_Object(name, value);
6309         }
6310         else
6311             throw new Error('invalid overload');
6312     };
6313     HomeObject.prototype.setProperty$java_lang_String$java_lang_Object = function (name, value) {
6314         var _this = this;
6315         if (value != null && !((typeof value === 'string') || (value != null && (value.constructor != null && value.constructor["__interfaces"] != null && value.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)))) {
6316             throw new IllegalArgumentException("Property value can be only a string or a content, not an instance of " + value.constructor);
6317         }
6318         var oldValue = this.properties != null ? /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, name) : null;
6319         if (value == null) {
6320             if (this.properties != null && oldValue != null) {
6321                 try {
6322                     /* remove */ (function (map) { var deleted = _this.properties[name]; delete _this.properties[name]; return deleted; })(this.properties);
6323                     if ( /* size */Object.keys(this.properties).length === 0) {
6324                         this.properties = null;
6325                     }
6326                 }
6327                 catch (ex) {
6328                     this.properties = null;
6329                 }
6330                 this.firePropertyChange(name, oldValue, null);
6331             }
6332         }
6333         else {
6334             if (this.properties == null || ( /* size */Object.keys(this.properties).length === 1 && oldValue != null)) {
6335                 this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = value; return o; })(name);
6336             }
6337             else {
6338                 if ( /* size */Object.keys(this.properties).length === 1) {
6339                     this.properties = ((function (o) { var r = {}; for (var p in o)
6340                         r[p] = o[p]; return r; })(this.properties));
6341                 }
6342                 /* put */ (this.properties[name] = value);
6343             }
6344             this.firePropertyChange(name, oldValue, value);
6345         }
6346     };
6347     /**
6348      * Returns the property names.
6349      * @return {string[]} a collection of all the names of the properties set with {@link #setProperty(String, String) setProperty}
6350      */
6351     HomeObject.prototype.getPropertyNames = function () {
6352         if (this.properties != null) {
6353             return /* keySet */ Object.keys(this.properties);
6354         }
6355         else {
6356             return /* emptySet */ [];
6357         }
6358     };
6359     /**
6360      * Returns a copy of this object with a new id.
6361      * @return {HomeObject}
6362      */
6363     HomeObject.prototype.duplicate = function () {
6364         var copy = (function (o) { if (o.clone != undefined) {
6365             return o.clone();
6366         }
6367         else {
6368             var clone = Object.create(o);
6369             for (var p in o) {
6370                 if (o.hasOwnProperty(p))
6371                     clone[p] = o[p];
6372             }
6373             return clone;
6374         } })(this);
6375         var index = 0;
6376         var c;
6377         while ((index < this.id.length && (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })((c = /* toLowerCase */ this.id.charAt(index).toLowerCase())) >= 'a'.charCodeAt(0) && (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) <= 'z'.charCodeAt(0))) {
6378             {
6379                 index++;
6380             }
6381         }
6382         ;
6383         var prefix = index >= 0 ? this.id.substring(0, index) : HomeObject.ID_DEFAULT_PREFIX;
6384         copy.id = HomeObject.createId(prefix);
6385         return copy;
6386     };
6387     /**
6388      * Returns a clone of this object.
6389      * The returned object has the same id as this object.
6390      * @return {HomeObject}
6391      */
6392     HomeObject.prototype.clone = function () {
6393         var _this = this;
6394         try {
6395             var clone = (function (o) { var clone = Object.create(o); for (var p in o) {
6396                 if (o.hasOwnProperty(p))
6397                     clone[p] = o[p];
6398             } return clone; })(this);
6399             if (this.properties != null) {
6400                 clone.properties = /* size */ Object.keys(clone.properties).length === 1 ? /* singletonMap */ (function (k) { var o = {}; o[k] = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(_this.properties)).next(); return o; })(/* iterator */ (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(this.properties)).next()) : ((function (o) { var r = {}; for (var p in o)
6401                     r[p] = o[p]; return r; })(this.properties));
6402             }
6403             clone.propertyChangeSupport = null;
6404             return clone;
6405         }
6406         catch (ex) {
6407             throw new IllegalStateException("Super class isn\'t cloneable");
6408         }
6409     };
6410     HomeObject.ID_DEFAULT_PREFIX = "object";
6411     return HomeObject;
6412 }());
6413 HomeObject["__class"] = "com.eteks.sweethome3d.model.HomeObject";
6414 HomeObject['__transients'] = ['propertyChangeSupport'];
6415 /**
6416  * Information about additional property.
6417  * @author Emmanuel Puybaret
6418  * @param {string} name
6419  * @param {string} displayedName
6420  * @param {ObjectProperty.Type} type
6421  * @param {boolean} displayable
6422  * @param {boolean} modifiable
6423  * @param {boolean} exportable
6424  * @class
6425  */
6426 var ObjectProperty = /** @class */ (function () {
6427     function ObjectProperty(name, displayedName, type, displayable, modifiable, exportable) {
6428         if (((typeof name === 'string') || name === null) && ((typeof displayedName === 'string') || displayedName === null) && ((typeof type === 'number') || type === null) && ((typeof displayable === 'boolean') || displayable === null) && ((typeof modifiable === 'boolean') || modifiable === null) && ((typeof exportable === 'boolean') || exportable === null)) {
6429             var __args = arguments;
6430             if (this.name === undefined) {
6431                 this.name = null;
6432             }
6433             if (this.displayedName === undefined) {
6434                 this.displayedName = null;
6435             }
6436             if (this.type === undefined) {
6437                 this.type = null;
6438             }
6439             if (this.typeName === undefined) {
6440                 this.typeName = null;
6441             }
6442             if (this.displayable === undefined) {
6443                 this.displayable = false;
6444             }
6445             if (this.modifiable === undefined) {
6446                 this.modifiable = false;
6447             }
6448             if (this.exportable === undefined) {
6449                 this.exportable = false;
6450             }
6451             this.name = name;
6452             this.displayedName = displayedName;
6453             this.type = type;
6454             this.typeName = type != null ? /* Enum.name */ ObjectProperty.Type[type] : null;
6455             this.displayable = displayable;
6456             this.modifiable = modifiable;
6457             this.exportable = exportable;
6458         }
6459         else if (((typeof name === 'string') || name === null) && ((typeof displayedName === 'number') || displayedName === null) && ((typeof type === 'boolean') || type === null) && ((typeof displayable === 'boolean') || displayable === null) && ((typeof modifiable === 'boolean') || modifiable === null) && exportable === undefined) {
6460             var __args = arguments;
6461             var type_1 = __args[1];
6462             var displayable_1 = __args[2];
6463             var modifiable_4 = __args[3];
6464             var exportable_1 = __args[4];
6465             {
6466                 var __args_36 = arguments;
6467                 var displayedName_1 = null;
6468                 var displayable_2 = true;
6469                 var modifiable_5 = true;
6470                 var exportable_2 = true;
6471                 if (this.name === undefined) {
6472                     this.name = null;
6473                 }
6474                 if (this.displayedName === undefined) {
6475                     this.displayedName = null;
6476                 }
6477                 if (this.type === undefined) {
6478                     this.type = null;
6479                 }
6480                 if (this.typeName === undefined) {
6481                     this.typeName = null;
6482                 }
6483                 if (this.displayable === undefined) {
6484                     this.displayable = false;
6485                 }
6486                 if (this.modifiable === undefined) {
6487                     this.modifiable = false;
6488                 }
6489                 if (this.exportable === undefined) {
6490                     this.exportable = false;
6491                 }
6492                 this.name = name;
6493                 this.displayedName = displayedName_1;
6494                 this.type = type_1;
6495                 this.typeName = type_1 != null ? /* Enum.name */ ObjectProperty.Type[type_1] : null;
6496                 this.displayable = displayable_2;
6497                 this.modifiable = modifiable_5;
6498                 this.exportable = exportable_2;
6499             }
6500             if (this.name === undefined) {
6501                 this.name = null;
6502             }
6503             if (this.displayedName === undefined) {
6504                 this.displayedName = null;
6505             }
6506             if (this.type === undefined) {
6507                 this.type = null;
6508             }
6509             if (this.typeName === undefined) {
6510                 this.typeName = null;
6511             }
6512             if (this.displayable === undefined) {
6513                 this.displayable = false;
6514             }
6515             if (this.modifiable === undefined) {
6516                 this.modifiable = false;
6517             }
6518             if (this.exportable === undefined) {
6519                 this.exportable = false;
6520             }
6521         }
6522         else if (((typeof name === 'string') || name === null) && ((typeof displayedName === 'number') || displayedName === null) && type === undefined && displayable === undefined && modifiable === undefined && exportable === undefined) {
6523             var __args = arguments;
6524             var type_2 = __args[1];
6525             {
6526                 var __args_37 = arguments;
6527                 var displayedName_2 = null;
6528                 var displayable_3 = true;
6529                 var modifiable_6 = true;
6530                 var exportable_3 = true;
6531                 if (this.name === undefined) {
6532                     this.name = null;
6533                 }
6534                 if (this.displayedName === undefined) {
6535                     this.displayedName = null;
6536                 }
6537                 if (this.type === undefined) {
6538                     this.type = null;
6539                 }
6540                 if (this.typeName === undefined) {
6541                     this.typeName = null;
6542                 }
6543                 if (this.displayable === undefined) {
6544                     this.displayable = false;
6545                 }
6546                 if (this.modifiable === undefined) {
6547                     this.modifiable = false;
6548                 }
6549                 if (this.exportable === undefined) {
6550                     this.exportable = false;
6551                 }
6552                 this.name = name;
6553                 this.displayedName = displayedName_2;
6554                 this.type = type_2;
6555                 this.typeName = type_2 != null ? /* Enum.name */ ObjectProperty.Type[type_2] : null;
6556                 this.displayable = displayable_3;
6557                 this.modifiable = modifiable_6;
6558                 this.exportable = exportable_3;
6559             }
6560             if (this.name === undefined) {
6561                 this.name = null;
6562             }
6563             if (this.displayedName === undefined) {
6564                 this.displayedName = null;
6565             }
6566             if (this.type === undefined) {
6567                 this.type = null;
6568             }
6569             if (this.typeName === undefined) {
6570                 this.typeName = null;
6571             }
6572             if (this.displayable === undefined) {
6573                 this.displayable = false;
6574             }
6575             if (this.modifiable === undefined) {
6576                 this.modifiable = false;
6577             }
6578             if (this.exportable === undefined) {
6579                 this.exportable = false;
6580             }
6581         }
6582         else if (((typeof name === 'string') || name === null) && displayedName === undefined && type === undefined && displayable === undefined && modifiable === undefined && exportable === undefined) {
6583             var __args = arguments;
6584             {
6585                 var __args_38 = arguments;
6586                 var type_3 = null;
6587                 {
6588                     var __args_39 = arguments;
6589                     var displayedName_3 = null;
6590                     var displayable_4 = true;
6591                     var modifiable_7 = true;
6592                     var exportable_4 = true;
6593                     if (this.name === undefined) {
6594                         this.name = null;
6595                     }
6596                     if (this.displayedName === undefined) {
6597                         this.displayedName = null;
6598                     }
6599                     if (this.type === undefined) {
6600                         this.type = null;
6601                     }
6602                     if (this.typeName === undefined) {
6603                         this.typeName = null;
6604                     }
6605                     if (this.displayable === undefined) {
6606                         this.displayable = false;
6607                     }
6608                     if (this.modifiable === undefined) {
6609                         this.modifiable = false;
6610                     }
6611                     if (this.exportable === undefined) {
6612                         this.exportable = false;
6613                     }
6614                     this.name = name;
6615                     this.displayedName = displayedName_3;
6616                     this.type = type_3;
6617                     this.typeName = type_3 != null ? /* Enum.name */ ObjectProperty.Type[type_3] : null;
6618                     this.displayable = displayable_4;
6619                     this.modifiable = modifiable_7;
6620                     this.exportable = exportable_4;
6621                 }
6622                 if (this.name === undefined) {
6623                     this.name = null;
6624                 }
6625                 if (this.displayedName === undefined) {
6626                     this.displayedName = null;
6627                 }
6628                 if (this.type === undefined) {
6629                     this.type = null;
6630                 }
6631                 if (this.typeName === undefined) {
6632                     this.typeName = null;
6633                 }
6634                 if (this.displayable === undefined) {
6635                     this.displayable = false;
6636                 }
6637                 if (this.modifiable === undefined) {
6638                     this.modifiable = false;
6639                 }
6640                 if (this.exportable === undefined) {
6641                     this.exportable = false;
6642                 }
6643             }
6644             if (this.name === undefined) {
6645                 this.name = null;
6646             }
6647             if (this.displayedName === undefined) {
6648                 this.displayedName = null;
6649             }
6650             if (this.type === undefined) {
6651                 this.type = null;
6652             }
6653             if (this.typeName === undefined) {
6654                 this.typeName = null;
6655             }
6656             if (this.displayable === undefined) {
6657                 this.displayable = false;
6658             }
6659             if (this.modifiable === undefined) {
6660                 this.modifiable = false;
6661             }
6662             if (this.exportable === undefined) {
6663                 this.exportable = false;
6664             }
6665         }
6666         else
6667             throw new Error('invalid overload');
6668     }
6669     /**
6670      * Returns an <code>ObjectProperty</code> instance built from the given <code>description</code>.
6671      * @param {string} description a string containing property name possibly followed by a
6672      * colon, the property type and displayable modifiable exportable displayedName attributes
6673      * name:(ANY|STRING|DATE|BOOLEAN|INTEGER|NUMBER|PRICE|LENGTH|PERCENTAGE|CONTENT) displayable=(true|false) modifiable=(true|false) exportable=(true|false) displayedName=text
6674      * @return {ObjectProperty}
6675      */
6676     ObjectProperty.fromDescription = function (description) {
6677         if (description.length === 0) {
6678             throw new IllegalArgumentException("Description empty");
6679         }
6680         var colonIndex = description.indexOf(':');
6681         var propertyName = description.substring(0, colonIndex > 0 ? colonIndex : description.length).trim();
6682         var type = null;
6683         var displayable = true;
6684         var modifiable = true;
6685         var exportable = true;
6686         var displayedName = null;
6687         if (colonIndex > 0) {
6688             var attributes = description.substring(colonIndex + 1).trim().split(/ /);
6689             if (attributes.length > 0) {
6690                 type = /* Enum.valueOf */ ObjectProperty.Type[attributes[0]];
6691                 for (var i = 1; i < attributes.length; i++) {
6692                     {
6693                         if ( /* startsWith */(function (str, searchString, position) {
6694                             if (position === void 0) { position = 0; }
6695                             return str.substr(position, searchString.length) === searchString;
6696                         })(attributes[i], "displayable=")) {
6697                             displayable = /* equalsIgnoreCase */ (function (o1, o2) { return o1.toUpperCase() === (o2 === null ? o2 : o2.toUpperCase()); })("true", attributes[i].substring("displayable=".length + 1));
6698                         }
6699                         else if ( /* startsWith */(function (str, searchString, position) {
6700                             if (position === void 0) { position = 0; }
6701                             return str.substr(position, searchString.length) === searchString;
6702                         })(attributes[i], "modifiable=")) {
6703                             modifiable = /* equalsIgnoreCase */ (function (o1, o2) { return o1.toUpperCase() === (o2 === null ? o2 : o2.toUpperCase()); })("true", attributes[i].substring("modifiable=".length + 1));
6704                         }
6705                         else if ( /* startsWith */(function (str, searchString, position) {
6706                             if (position === void 0) { position = 0; }
6707                             return str.substr(position, searchString.length) === searchString;
6708                         })(attributes[i], "exportable=")) {
6709                             exportable = /* equalsIgnoreCase */ (function (o1, o2) { return o1.toUpperCase() === (o2 === null ? o2 : o2.toUpperCase()); })("true", attributes[i].substring("exportable=".length + 1));
6710                         }
6711                         else if ( /* startsWith */(function (str, searchString, position) {
6712                             if (position === void 0) { position = 0; }
6713                             return str.substr(position, searchString.length) === searchString;
6714                         })(attributes[i], "displayedName=")) {
6715                             displayedName = description.substring(description.indexOf("displayedName=") + "displayedName=".length);
6716                         }
6717                     }
6718                     ;
6719                 }
6720             }
6721         }
6722         return new ObjectProperty(propertyName, displayedName, type, displayable, modifiable, exportable);
6723     };
6724     /**
6725      * Returns the name of this property.
6726      * @return {string}
6727      */
6728     ObjectProperty.prototype.getName = function () {
6729         return this.name;
6730     };
6731     /**
6732      * Returns the type of this property.
6733      * @return {ObjectProperty.Type}
6734      */
6735     ObjectProperty.prototype.getType = function () {
6736         return this.type;
6737     };
6738     /**
6739      * Returns whether the value of this property is displayable.
6740      * @return {boolean}
6741      */
6742     ObjectProperty.prototype.isDisplayable = function () {
6743         return this.displayable;
6744     };
6745     /**
6746      * Returns whether the value of this property is modifiable.
6747      * @return {boolean}
6748      */
6749     ObjectProperty.prototype.isModifiable = function () {
6750         return this.modifiable;
6751     };
6752     /**
6753      * Returns whether the value of this property is exportable.
6754      * @return {boolean}
6755      */
6756     ObjectProperty.prototype.isExportable = function () {
6757         return this.exportable;
6758     };
6759     /**
6760      * Returns a text used for label and header.
6761      * @return {string}
6762      */
6763     ObjectProperty.prototype.getDisplayedName = function () {
6764         if (this.displayedName != null) {
6765             return this.displayedName;
6766         }
6767         else {
6768             var displayedName = this.name.split('_').join(' ').toLowerCase();
6769             return /* toUpperCase */ displayedName.charAt(0).toUpperCase() + (displayedName.length > 1 ? displayedName.substring(1) : "");
6770         }
6771     };
6772     /**
6773      *
6774      * @return {number}
6775      */
6776     ObjectProperty.prototype.hashCode = function () {
6777         return this.name == null ? 0 : /* hashCode */ (function (o) { if (o.hashCode) {
6778             return o.hashCode();
6779         }
6780         else {
6781             return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
6782         } })(this.name);
6783     };
6784     /**
6785      *
6786      * @param {Object} obj
6787      * @return {boolean}
6788      */
6789     ObjectProperty.prototype.equals = function (obj) {
6790         if (this === obj) {
6791             return true;
6792         }
6793         else if (obj != null && obj instanceof ObjectProperty) {
6794             return this.name === obj.name;
6795         }
6796         return false;
6797     };
6798     return ObjectProperty;
6799 }());
6800 ObjectProperty["__class"] = "com.eteks.sweethome3d.model.ObjectProperty";
6801 (function (ObjectProperty) {
6802     /**
6803      * Property type.
6804      * @enum
6805      * @property {ObjectProperty.Type} ANY
6806      * @property {ObjectProperty.Type} STRING
6807      * @property {ObjectProperty.Type} BOOLEAN
6808      * @property {ObjectProperty.Type} INTEGER
6809      * @property {ObjectProperty.Type} NUMBER
6810      * @property {ObjectProperty.Type} PRICE
6811      * @property {ObjectProperty.Type} LENGTH
6812      * @property {ObjectProperty.Type} PERCENTAGE
6813      * @property {ObjectProperty.Type} DATE
6814      * @property {ObjectProperty.Type} CONTENT
6815      * @class
6816      */
6817     var Type;
6818     (function (Type) {
6819         Type[Type["ANY"] = 0] = "ANY";
6820         Type[Type["STRING"] = 1] = "STRING";
6821         Type[Type["BOOLEAN"] = 2] = "BOOLEAN";
6822         Type[Type["INTEGER"] = 3] = "INTEGER";
6823         Type[Type["NUMBER"] = 4] = "NUMBER";
6824         Type[Type["PRICE"] = 5] = "PRICE";
6825         Type[Type["LENGTH"] = 6] = "LENGTH";
6826         Type[Type["PERCENTAGE"] = 7] = "PERCENTAGE";
6827         Type[Type["DATE"] = 8] = "DATE";
6828         Type[Type["CONTENT"] = 9] = "CONTENT";
6829     })(Type = ObjectProperty.Type || (ObjectProperty.Type = {}));
6830 })(ObjectProperty || (ObjectProperty = {}));
6831 ObjectProperty['__transients'] = ['type'];
6832 /**
6833  * Textures catalog.
6834  * @author Emmanuel Puybaret
6835  * @class
6836  */
6837 var TexturesCatalog = /** @class */ (function () {
6838     function TexturesCatalog() {
6839         this.categories = ([]);
6840         this.texturesChangeSupport = (new CollectionChangeSupport(this));
6841     }
6842     /**
6843      * Returns the categories list sorted by name.
6844      * @return {TexturesCategory[]} a list of categories.
6845      */
6846     TexturesCatalog.prototype.getCategories = function () {
6847         return /* unmodifiableList */ this.categories.slice(0);
6848     };
6849     /**
6850      * Returns the count of categories in this catalog.
6851      * @return {number}
6852      */
6853     TexturesCatalog.prototype.getCategoriesCount = function () {
6854         return /* size */ this.categories.length;
6855     };
6856     /**
6857      * Returns the category at a given <code>index</code>.
6858      * @param {number} index
6859      * @return {TexturesCategory}
6860      */
6861     TexturesCatalog.prototype.getCategory = function (index) {
6862         return /* get */ this.categories[index];
6863     };
6864     /**
6865      * Adds the texture <code>listener</code> in parameter to this catalog.
6866      * @param {Object} listener
6867      */
6868     TexturesCatalog.prototype.addTexturesListener = function (listener) {
6869         this.texturesChangeSupport.addCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
6870             return funcInst;
6871         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
6872     };
6873     /**
6874      * Removes the texture <code>listener</code> in parameter from this catalog.
6875      * @param {Object} listener
6876      */
6877     TexturesCatalog.prototype.removeTexturesListener = function (listener) {
6878         this.texturesChangeSupport.removeCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
6879             return funcInst;
6880         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
6881     };
6882     /**
6883      * Adds <code>texture</code> of a given <code>category</code> to this catalog.
6884      * Once the <code>texture</code> is added, texture listeners added to this catalog will receive a
6885      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged} notification.
6886      * @param {TexturesCategory} category the category of the texture.
6887      * @param {CatalogTexture} texture  a texture.
6888      */
6889     TexturesCatalog.prototype.add = function (category, texture) {
6890         var index = (function (l, key) { var comp = function (a, b) { if (a.compareTo)
6891             return a.compareTo(b);
6892         else
6893             return a.localeCompare(b); }; var low = 0; var high = l.length - 1; while (low <= high) {
6894             var mid = (low + high) >>> 1;
6895             var midVal = l[mid];
6896             var cmp = comp(midVal, key);
6897             if (cmp < 0)
6898                 low = mid + 1;
6899             else if (cmp > 0)
6900                 high = mid - 1;
6901             else
6902                 return mid;
6903         } return -(low + 1); })(this.categories, category);
6904         if (index < 0) {
6905             category = new TexturesCategory(category.getName());
6906             /* add */ this.categories.splice(-index - 1, 0, category);
6907         }
6908         else {
6909             category = /* get */ this.categories[index];
6910         }
6911         category.add(texture);
6912         this.texturesChangeSupport.fireCollectionChanged(texture, category.getIndexOfTexture(texture), CollectionEvent.Type.ADD);
6913     };
6914     /**
6915      * Deletes the <code>texture</code> from this catalog.
6916      * If then texture category is empty, it will be removed from the categories of this catalog.
6917      * Once the <code>texture</code> is deleted, texture listeners added to this catalog will receive a
6918      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged} notification.
6919      * @param {CatalogTexture} texture a texture.
6920      */
6921     TexturesCatalog.prototype["delete"] = function (texture) {
6922         var category = texture.getCategory();
6923         if (category != null) {
6924             var textureIndex = category.getIndexOfTexture(texture);
6925             if (textureIndex >= 0) {
6926                 category["delete"](texture);
6927                 if (category.getTexturesCount() === 0) {
6928                     this.categories = (this.categories.slice(0));
6929                     /* remove */ (function (a) { var index = a.indexOf(category); if (index >= 0) {
6930                         a.splice(index, 1);
6931                         return true;
6932                     }
6933                     else {
6934                         return false;
6935                     } })(this.categories);
6936                 }
6937                 this.texturesChangeSupport.fireCollectionChanged(texture, textureIndex, CollectionEvent.Type.DELETE);
6938                 return;
6939             }
6940         }
6941         throw new IllegalArgumentException("catalog doesn\'t contain texture " + texture.getName());
6942     };
6943     return TexturesCatalog;
6944 }());
6945 TexturesCatalog["__class"] = "com.eteks.sweethome3d.model.TexturesCatalog";
6946 /**
6947  * Creates a catalog piece of furniture of the default catalog.
6948  * <br>Caution: The constructor of <code>CatalogPieceOfFurniture</code> was modified in version 5.5 with incompatible changes with previous versions and might require some changes in your program.
6949  * @param {string} id    the id of the new piece or <code>null</code>
6950  * @param {string} name  the name of the new piece
6951  * @param {string} description the description of the new piece
6952  * @param {string} information additional information associated to the new piece
6953  * @param {string} license license of the new piece
6954  * @param {java.lang.String[]} tags tags associated to the new piece
6955  * @param {number} creationDate creation date of the new piece in milliseconds since the epoch
6956  * @param {number} grade grade of the piece of furniture or <code>null</code>
6957  * @param {Object} icon content of the icon of the new piece
6958  * @param {Object} planIcon content of the icon of the new piece displayed in plan
6959  * @param {Object} model content of the 3D model of the new piece
6960  * @param {number} width  the width in centimeters of the new piece
6961  * @param {number} depth  the depth in centimeters of the new piece
6962  * @param {number} height  the height in centimeters of the new piece
6963  * @param {number} elevation  the elevation in centimeters of the new piece
6964  * @param {number} dropOnTopElevation  a percentage of the height at which should be placed
6965  * an object dropped on the new piece
6966  * @param {boolean} movable if <code>true</code>, the new piece is movable
6967  * @param {string} staircaseCutOutShape the shape used to cut out upper levels when they intersect
6968  * with the piece like a staircase
6969  * @param {float[][]} modelRotation the rotation 3 by 3 matrix applied to the piece model
6970  * @param {number} modelFlags flags which should be applied to piece model
6971  * @param {number} modelSize size of the 3D model of the new piece
6972  * @param {string} creator the creator of the model
6973  * @param {boolean} resizable if <code>true</code>, the size of the new piece may be edited
6974  * @param {boolean} deformable if <code>true</code>, the width, depth and height of the new piece may
6975  * change independently from each other
6976  * @param {boolean} texturable if <code>false</code> this piece should always keep the same color or texture
6977  * @param {boolean} horizontallyRotatable if <code>false</code> this piece
6978  * should not rotate around an horizontal axis
6979  * @param {Big} price the price of the new piece or <code>null</code>
6980  * @param {Big} valueAddedTaxPercentage the Value Added Tax percentage applied to the
6981  * price of the new piece or <code>null</code>
6982  * @param {string} currency the price currency, noted with ISO 4217 code, or <code>null</code>
6983  * @param {Object} properties additional properties associating a key to a value or <code>null</code>
6984  * @param {Object} contents   additional contents associating a key to a value or <code>null</code>
6985  * @class
6986  * @author Emmanuel Puybaret
6987  */
6988 var CatalogPieceOfFurniture = /** @class */ (function () {
6989     function CatalogPieceOfFurniture(id, name, description, information, license, tags, creationDate, grade, icon, planIcon, model, width, depth, height, elevation, dropOnTopElevation, movable, doorOrWindow, staircaseCutOutShape, color, modelRotation, modelFlags, modelSize, creator, resizable, deformable, texturable, horizontallyRotatable, price, valueAddedTaxPercentage, currency, properties, contents, iconYaw, iconPitch, iconScale, proportional, modifiable) {
6990         if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((typeof information === 'string') || information === null) && ((typeof license === 'string') || license === null) && ((tags != null && tags instanceof Array && (tags.length == 0 || tags[0] == null || (typeof tags[0] === 'string'))) || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((typeof grade === 'number') || grade === null) && ((icon != null && (icon.constructor != null && icon.constructor["__interfaces"] != null && icon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || icon === null) && ((planIcon != null && (planIcon.constructor != null && planIcon.constructor["__interfaces"] != null && planIcon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || planIcon === null) && ((model != null && (model.constructor != null && model.constructor["__interfaces"] != null && model.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || model === null) && ((typeof width === 'number') || width === null) && ((typeof depth === 'number') || depth === null) && ((typeof height === 'number') || height === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof dropOnTopElevation === 'number') || dropOnTopElevation === null) && ((typeof movable === 'boolean') || movable === null) && ((typeof doorOrWindow === 'boolean') || doorOrWindow === null) && ((typeof staircaseCutOutShape === 'string') || staircaseCutOutShape === null) && ((typeof color === 'number') || color === null) && ((modelRotation != null && modelRotation instanceof Array && (modelRotation.length == 0 || modelRotation[0] == null || modelRotation[0] instanceof Array)) || modelRotation === null) && ((typeof modelFlags === 'number') || modelFlags === null) && ((typeof modelSize === 'number') || modelSize === null) && ((typeof creator === 'string') || creator === null) && ((typeof resizable === 'boolean') || resizable === null) && ((typeof deformable === 'boolean') || deformable === null) && ((typeof texturable === 'boolean') || texturable === null) && ((typeof horizontallyRotatable === 'boolean') || horizontallyRotatable === null) && ((price != null && price instanceof Big) || price === null) && ((valueAddedTaxPercentage != null && valueAddedTaxPercentage instanceof Big) || valueAddedTaxPercentage === null) && ((typeof currency === 'string') || currency === null) && ((properties != null && (properties instanceof Object)) || properties === null) && ((contents != null && (contents instanceof Object)) || contents === null) && ((typeof iconYaw === 'number') || iconYaw === null) && ((typeof iconPitch === 'number') || iconPitch === null) && ((typeof iconScale === 'number') || iconScale === null) && ((typeof proportional === 'boolean') || proportional === null) && ((typeof modifiable === 'boolean') || modifiable === null)) {
6991             var __args = arguments;
6992             if (this.id === undefined) {
6993                 this.id = null;
6994             }
6995             if (this.name === undefined) {
6996                 this.name = null;
6997             }
6998             if (this.description === undefined) {
6999                 this.description = null;
7000             }
7001             if (this.information === undefined) {
7002                 this.information = null;
7003             }
7004             if (this.license === undefined) {
7005                 this.license = null;
7006             }
7007             if (this.tags === undefined) {
7008                 this.tags = null;
7009             }
7010             if (this.creationDate === undefined) {
7011                 this.creationDate = null;
7012             }
7013             if (this.grade === undefined) {
7014                 this.grade = null;
7015             }
7016             if (this.icon === undefined) {
7017                 this.icon = null;
7018             }
7019             if (this.planIcon === undefined) {
7020                 this.planIcon = null;
7021             }
7022             if (this.model === undefined) {
7023                 this.model = null;
7024             }
7025             if (this.width === undefined) {
7026                 this.width = 0;
7027             }
7028             if (this.depth === undefined) {
7029                 this.depth = 0;
7030             }
7031             if (this.height === undefined) {
7032                 this.height = 0;
7033             }
7034             if (this.proportional === undefined) {
7035                 this.proportional = false;
7036             }
7037             if (this.elevation === undefined) {
7038                 this.elevation = 0;
7039             }
7040             if (this.dropOnTopElevation === undefined) {
7041                 this.dropOnTopElevation = 0;
7042             }
7043             if (this.movable === undefined) {
7044                 this.movable = false;
7045             }
7046             if (this.doorOrWindow === undefined) {
7047                 this.doorOrWindow = false;
7048             }
7049             if (this.staircaseCutOutShape === undefined) {
7050                 this.staircaseCutOutShape = null;
7051             }
7052             if (this.modelRotation === undefined) {
7053                 this.modelRotation = null;
7054             }
7055             if (this.modelFlags === undefined) {
7056                 this.modelFlags = 0;
7057             }
7058             if (this.modelSize === undefined) {
7059                 this.modelSize = null;
7060             }
7061             if (this.creator === undefined) {
7062                 this.creator = null;
7063             }
7064             if (this.color === undefined) {
7065                 this.color = null;
7066             }
7067             if (this.iconYaw === undefined) {
7068                 this.iconYaw = 0;
7069             }
7070             if (this.iconPitch === undefined) {
7071                 this.iconPitch = 0;
7072             }
7073             if (this.iconScale === undefined) {
7074                 this.iconScale = 0;
7075             }
7076             if (this.modifiable === undefined) {
7077                 this.modifiable = false;
7078             }
7079             if (this.resizable === undefined) {
7080                 this.resizable = false;
7081             }
7082             if (this.deformable === undefined) {
7083                 this.deformable = false;
7084             }
7085             if (this.texturable === undefined) {
7086                 this.texturable = false;
7087             }
7088             if (this.horizontallyRotatable === undefined) {
7089                 this.horizontallyRotatable = false;
7090             }
7091             if (this.price === undefined) {
7092                 this.price = null;
7093             }
7094             if (this.valueAddedTaxPercentage === undefined) {
7095                 this.valueAddedTaxPercentage = null;
7096             }
7097             if (this.currency === undefined) {
7098                 this.currency = null;
7099             }
7100             if (this.properties === undefined) {
7101                 this.properties = null;
7102             }
7103             if (this.category === undefined) {
7104                 this.category = null;
7105             }
7106             if (this.filterCollationKey === undefined) {
7107                 this.filterCollationKey = null;
7108             }
7109             this.id = id;
7110             this.name = name;
7111             this.description = description;
7112             this.information = information;
7113             this.license = license;
7114             this.tags = tags;
7115             this.creationDate = creationDate;
7116             this.grade = grade;
7117             this.icon = icon;
7118             this.planIcon = planIcon;
7119             this.model = model;
7120             this.width = width;
7121             this.depth = depth;
7122             this.height = height;
7123             this.elevation = elevation;
7124             this.dropOnTopElevation = dropOnTopElevation;
7125             this.movable = movable;
7126             this.doorOrWindow = doorOrWindow;
7127             this.color = color;
7128             this.staircaseCutOutShape = staircaseCutOutShape;
7129             this.creator = creator;
7130             this.horizontallyRotatable = horizontallyRotatable;
7131             this.price = price;
7132             this.valueAddedTaxPercentage = valueAddedTaxPercentage;
7133             this.currency = currency;
7134             if (properties == null || /* size */ Object.keys(properties).length === 0) {
7135                 if (contents == null || /* size */ Object.keys(contents).length === 0) {
7136                     this.properties = /* emptyMap */ {};
7137                 }
7138                 else if ( /* size */Object.keys(contents).length === 1) {
7139                     this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(contents)).next(); return o; })(/* iterator */ (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(contents)).next());
7140                 }
7141                 else {
7142                     this.properties = ((function (o) { var r = {}; for (var p in o)
7143                         r[p] = o[p]; return r; })(contents));
7144                 }
7145             }
7146             else if ( /* size */Object.keys(properties).length === 1 && (contents == null || /* size */ Object.keys(contents).length === 0)) {
7147                 this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(properties)).next(); return o; })(/* iterator */ (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(properties)).next());
7148             }
7149             else {
7150                 this.properties = ((function (o) { var r = {}; for (var p in o)
7151                     r[p] = o[p]; return r; })(properties));
7152                 if (contents != null) {
7153                     /* putAll */ (function (m, n) { for (var i in n)
7154                         m[i] = n[i]; })(this.properties, contents);
7155                 }
7156             }
7157             if (modelRotation == null) {
7158                 this.modelRotation = PieceOfFurniture.IDENTITY_ROTATION_$LI$();
7159             }
7160             else {
7161                 this.modelRotation = CatalogPieceOfFurniture.deepClone(modelRotation);
7162             }
7163             this.modelFlags = modelFlags;
7164             this.modelSize = modelSize;
7165             this.resizable = resizable;
7166             this.deformable = deformable;
7167             this.texturable = texturable;
7168             this.iconYaw = iconYaw;
7169             this.iconPitch = iconPitch;
7170             this.iconScale = iconScale;
7171             this.proportional = proportional;
7172             this.modifiable = modifiable;
7173         }
7174         else if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((typeof information === 'string') || information === null) && ((typeof license === 'string') || license === null) && ((tags != null && tags instanceof Array && (tags.length == 0 || tags[0] == null || (typeof tags[0] === 'string'))) || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((typeof grade === 'number') || grade === null) && ((icon != null && (icon.constructor != null && icon.constructor["__interfaces"] != null && icon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || icon === null) && ((planIcon != null && (planIcon.constructor != null && planIcon.constructor["__interfaces"] != null && planIcon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || planIcon === null) && ((model != null && (model.constructor != null && model.constructor["__interfaces"] != null && model.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || model === null) && ((typeof width === 'number') || width === null) && ((typeof depth === 'number') || depth === null) && ((typeof height === 'number') || height === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof dropOnTopElevation === 'number') || dropOnTopElevation === null) && ((typeof movable === 'boolean') || movable === null) && ((typeof doorOrWindow === 'string') || doorOrWindow === null) && ((staircaseCutOutShape != null && staircaseCutOutShape instanceof Array && (staircaseCutOutShape.length == 0 || staircaseCutOutShape[0] == null || staircaseCutOutShape[0] instanceof Array)) || staircaseCutOutShape === null) && ((typeof color === 'number') || color === null) && ((typeof modelRotation === 'number') || modelRotation === null) && ((typeof modelFlags === 'string') || modelFlags === null) && ((typeof modelSize === 'boolean') || modelSize === null) && ((typeof creator === 'boolean') || creator === null) && ((typeof resizable === 'boolean') || resizable === null) && ((typeof deformable === 'boolean') || deformable === null) && ((texturable != null && texturable instanceof Big) || texturable === null) && ((horizontallyRotatable != null && horizontallyRotatable instanceof Big) || horizontallyRotatable === null) && ((typeof price === 'string') || price === null) && ((valueAddedTaxPercentage != null && (valueAddedTaxPercentage instanceof Object)) || valueAddedTaxPercentage === null) && ((currency != null && (currency instanceof Object)) || currency === null) && properties === undefined && contents === undefined && iconYaw === undefined && iconPitch === undefined && iconScale === undefined && proportional === undefined && modifiable === undefined) {
7175             var __args = arguments;
7176             var staircaseCutOutShape_1 = __args[17];
7177             var modelRotation_1 = __args[18];
7178             var modelFlags_1 = __args[19];
7179             var modelSize_1 = __args[20];
7180             var creator_3 = __args[21];
7181             var resizable_1 = __args[22];
7182             var deformable_1 = __args[23];
7183             var texturable_1 = __args[24];
7184             var horizontallyRotatable_1 = __args[25];
7185             var price_1 = __args[26];
7186             var valueAddedTaxPercentage_1 = __args[27];
7187             var currency_1 = __args[28];
7188             var properties_1 = __args[29];
7189             var contents_1 = __args[30];
7190             {
7191                 var __args_40 = arguments;
7192                 var doorOrWindow_1 = false;
7193                 var color_1 = null;
7194                 var iconYaw_1 = Math.PI / 8;
7195                 var iconPitch_1 = 0;
7196                 var iconScale_1 = 1;
7197                 var proportional_1 = true;
7198                 var modifiable_8 = false;
7199                 if (this.id === undefined) {
7200                     this.id = null;
7201                 }
7202                 if (this.name === undefined) {
7203                     this.name = null;
7204                 }
7205                 if (this.description === undefined) {
7206                     this.description = null;
7207                 }
7208                 if (this.information === undefined) {
7209                     this.information = null;
7210                 }
7211                 if (this.license === undefined) {
7212                     this.license = null;
7213                 }
7214                 if (this.tags === undefined) {
7215                     this.tags = null;
7216                 }
7217                 if (this.creationDate === undefined) {
7218                     this.creationDate = null;
7219                 }
7220                 if (this.grade === undefined) {
7221                     this.grade = null;
7222                 }
7223                 if (this.icon === undefined) {
7224                     this.icon = null;
7225                 }
7226                 if (this.planIcon === undefined) {
7227                     this.planIcon = null;
7228                 }
7229                 if (this.model === undefined) {
7230                     this.model = null;
7231                 }
7232                 if (this.width === undefined) {
7233                     this.width = 0;
7234                 }
7235                 if (this.depth === undefined) {
7236                     this.depth = 0;
7237                 }
7238                 if (this.height === undefined) {
7239                     this.height = 0;
7240                 }
7241                 if (this.proportional === undefined) {
7242                     this.proportional = false;
7243                 }
7244                 if (this.elevation === undefined) {
7245                     this.elevation = 0;
7246                 }
7247                 if (this.dropOnTopElevation === undefined) {
7248                     this.dropOnTopElevation = 0;
7249                 }
7250                 if (this.movable === undefined) {
7251                     this.movable = false;
7252                 }
7253                 if (this.doorOrWindow === undefined) {
7254                     this.doorOrWindow = false;
7255                 }
7256                 if (this.staircaseCutOutShape === undefined) {
7257                     this.staircaseCutOutShape = null;
7258                 }
7259                 if (this.modelRotation === undefined) {
7260                     this.modelRotation = null;
7261                 }
7262                 if (this.modelFlags === undefined) {
7263                     this.modelFlags = 0;
7264                 }
7265                 if (this.modelSize === undefined) {
7266                     this.modelSize = null;
7267                 }
7268                 if (this.creator === undefined) {
7269                     this.creator = null;
7270                 }
7271                 if (this.color === undefined) {
7272                     this.color = null;
7273                 }
7274                 if (this.iconYaw === undefined) {
7275                     this.iconYaw = 0;
7276                 }
7277                 if (this.iconPitch === undefined) {
7278                     this.iconPitch = 0;
7279                 }
7280                 if (this.iconScale === undefined) {
7281                     this.iconScale = 0;
7282                 }
7283                 if (this.modifiable === undefined) {
7284                     this.modifiable = false;
7285                 }
7286                 if (this.resizable === undefined) {
7287                     this.resizable = false;
7288                 }
7289                 if (this.deformable === undefined) {
7290                     this.deformable = false;
7291                 }
7292                 if (this.texturable === undefined) {
7293                     this.texturable = false;
7294                 }
7295                 if (this.horizontallyRotatable === undefined) {
7296                     this.horizontallyRotatable = false;
7297                 }
7298                 if (this.price === undefined) {
7299                     this.price = null;
7300                 }
7301                 if (this.valueAddedTaxPercentage === undefined) {
7302                     this.valueAddedTaxPercentage = null;
7303                 }
7304                 if (this.currency === undefined) {
7305                     this.currency = null;
7306                 }
7307                 if (this.properties === undefined) {
7308                     this.properties = null;
7309                 }
7310                 if (this.category === undefined) {
7311                     this.category = null;
7312                 }
7313                 if (this.filterCollationKey === undefined) {
7314                     this.filterCollationKey = null;
7315                 }
7316                 this.id = id;
7317                 this.name = name;
7318                 this.description = description;
7319                 this.information = information;
7320                 this.license = license;
7321                 this.tags = tags;
7322                 this.creationDate = creationDate;
7323                 this.grade = grade;
7324                 this.icon = icon;
7325                 this.planIcon = planIcon;
7326                 this.model = model;
7327                 this.width = width;
7328                 this.depth = depth;
7329                 this.height = height;
7330                 this.elevation = elevation;
7331                 this.dropOnTopElevation = dropOnTopElevation;
7332                 this.movable = movable;
7333                 this.doorOrWindow = doorOrWindow_1;
7334                 this.color = color_1;
7335                 this.staircaseCutOutShape = staircaseCutOutShape_1;
7336                 this.creator = creator_3;
7337                 this.horizontallyRotatable = horizontallyRotatable_1;
7338                 this.price = price_1;
7339                 this.valueAddedTaxPercentage = valueAddedTaxPercentage_1;
7340                 this.currency = currency_1;
7341                 if (properties_1 == null || /* size */ Object.keys(properties_1).length === 0) {
7342                     if (contents_1 == null || /* size */ Object.keys(contents_1).length === 0) {
7343                         this.properties = /* emptyMap */ {};
7344                     }
7345                     else if ( /* size */Object.keys(contents_1).length === 1) {
7346                         this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(contents_1)).next(); return o; })(/* iterator */ (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(contents_1)).next());
7347                     }
7348                     else {
7349                         this.properties = ((function (o) { var r = {}; for (var p in o)
7350                             r[p] = o[p]; return r; })(contents_1));
7351                     }
7352                 }
7353                 else if ( /* size */Object.keys(properties_1).length === 1 && (contents_1 == null || /* size */ Object.keys(contents_1).length === 0)) {
7354                     this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(properties_1)).next(); return o; })(/* iterator */ (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(properties_1)).next());
7355                 }
7356                 else {
7357                     this.properties = ((function (o) { var r = {}; for (var p in o)
7358                         r[p] = o[p]; return r; })(properties_1));
7359                     if (contents_1 != null) {
7360                         /* putAll */ (function (m, n) { for (var i in n)
7361                             m[i] = n[i]; })(this.properties, contents_1);
7362                     }
7363                 }
7364                 if (modelRotation_1 == null) {
7365                     this.modelRotation = PieceOfFurniture.IDENTITY_ROTATION_$LI$();
7366                 }
7367                 else {
7368                     this.modelRotation = CatalogPieceOfFurniture.deepClone(modelRotation_1);
7369                 }
7370                 this.modelFlags = modelFlags_1;
7371                 this.modelSize = modelSize_1;
7372                 this.resizable = resizable_1;
7373                 this.deformable = deformable_1;
7374                 this.texturable = texturable_1;
7375                 this.iconYaw = iconYaw_1;
7376                 this.iconPitch = iconPitch_1;
7377                 this.iconScale = iconScale_1;
7378                 this.proportional = proportional_1;
7379                 this.modifiable = modifiable_8;
7380             }
7381             if (this.id === undefined) {
7382                 this.id = null;
7383             }
7384             if (this.name === undefined) {
7385                 this.name = null;
7386             }
7387             if (this.description === undefined) {
7388                 this.description = null;
7389             }
7390             if (this.information === undefined) {
7391                 this.information = null;
7392             }
7393             if (this.license === undefined) {
7394                 this.license = null;
7395             }
7396             if (this.tags === undefined) {
7397                 this.tags = null;
7398             }
7399             if (this.creationDate === undefined) {
7400                 this.creationDate = null;
7401             }
7402             if (this.grade === undefined) {
7403                 this.grade = null;
7404             }
7405             if (this.icon === undefined) {
7406                 this.icon = null;
7407             }
7408             if (this.planIcon === undefined) {
7409                 this.planIcon = null;
7410             }
7411             if (this.model === undefined) {
7412                 this.model = null;
7413             }
7414             if (this.width === undefined) {
7415                 this.width = 0;
7416             }
7417             if (this.depth === undefined) {
7418                 this.depth = 0;
7419             }
7420             if (this.height === undefined) {
7421                 this.height = 0;
7422             }
7423             if (this.proportional === undefined) {
7424                 this.proportional = false;
7425             }
7426             if (this.elevation === undefined) {
7427                 this.elevation = 0;
7428             }
7429             if (this.dropOnTopElevation === undefined) {
7430                 this.dropOnTopElevation = 0;
7431             }
7432             if (this.movable === undefined) {
7433                 this.movable = false;
7434             }
7435             if (this.doorOrWindow === undefined) {
7436                 this.doorOrWindow = false;
7437             }
7438             if (this.staircaseCutOutShape === undefined) {
7439                 this.staircaseCutOutShape = null;
7440             }
7441             if (this.modelRotation === undefined) {
7442                 this.modelRotation = null;
7443             }
7444             if (this.modelFlags === undefined) {
7445                 this.modelFlags = 0;
7446             }
7447             if (this.modelSize === undefined) {
7448                 this.modelSize = null;
7449             }
7450             if (this.creator === undefined) {
7451                 this.creator = null;
7452             }
7453             if (this.color === undefined) {
7454                 this.color = null;
7455             }
7456             if (this.iconYaw === undefined) {
7457                 this.iconYaw = 0;
7458             }
7459             if (this.iconPitch === undefined) {
7460                 this.iconPitch = 0;
7461             }
7462             if (this.iconScale === undefined) {
7463                 this.iconScale = 0;
7464             }
7465             if (this.modifiable === undefined) {
7466                 this.modifiable = false;
7467             }
7468             if (this.resizable === undefined) {
7469                 this.resizable = false;
7470             }
7471             if (this.deformable === undefined) {
7472                 this.deformable = false;
7473             }
7474             if (this.texturable === undefined) {
7475                 this.texturable = false;
7476             }
7477             if (this.horizontallyRotatable === undefined) {
7478                 this.horizontallyRotatable = false;
7479             }
7480             if (this.price === undefined) {
7481                 this.price = null;
7482             }
7483             if (this.valueAddedTaxPercentage === undefined) {
7484                 this.valueAddedTaxPercentage = null;
7485             }
7486             if (this.currency === undefined) {
7487                 this.currency = null;
7488             }
7489             if (this.properties === undefined) {
7490                 this.properties = null;
7491             }
7492             if (this.category === undefined) {
7493                 this.category = null;
7494             }
7495             if (this.filterCollationKey === undefined) {
7496                 this.filterCollationKey = null;
7497             }
7498         }
7499         else if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((typeof information === 'string') || information === null) && ((license != null && license instanceof Array && (license.length == 0 || license[0] == null || (typeof license[0] === 'string'))) || license === null) && ((typeof tags === 'number') || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((grade != null && (grade.constructor != null && grade.constructor["__interfaces"] != null && grade.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || grade === null) && ((icon != null && (icon.constructor != null && icon.constructor["__interfaces"] != null && icon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || icon === null) && ((planIcon != null && (planIcon.constructor != null && planIcon.constructor["__interfaces"] != null && planIcon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || planIcon === null) && ((typeof model === 'number') || model === null) && ((typeof width === 'number') || width === null) && ((typeof depth === 'number') || depth === null) && ((typeof height === 'number') || height === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof dropOnTopElevation === 'boolean') || dropOnTopElevation === null) && ((typeof movable === 'string') || movable === null) && ((doorOrWindow != null && doorOrWindow instanceof Array && (doorOrWindow.length == 0 || doorOrWindow[0] == null || doorOrWindow[0] instanceof Array)) || doorOrWindow === null) && ((typeof staircaseCutOutShape === 'boolean') || staircaseCutOutShape === null) && ((typeof color === 'number') || color === null) && ((typeof modelRotation === 'string') || modelRotation === null) && ((typeof modelFlags === 'boolean') || modelFlags === null) && ((typeof modelSize === 'boolean') || modelSize === null) && ((typeof creator === 'boolean') || creator === null) && ((typeof resizable === 'boolean') || resizable === null) && ((deformable != null && deformable instanceof Big) || deformable === null) && ((texturable != null && texturable instanceof Big) || texturable === null) && ((typeof horizontallyRotatable === 'string') || horizontallyRotatable === null) && ((price != null && (price instanceof Object)) || price === null) && valueAddedTaxPercentage === undefined && currency === undefined && properties === undefined && contents === undefined && iconYaw === undefined && iconPitch === undefined && iconScale === undefined && proportional === undefined && modifiable === undefined) {
7500             var __args = arguments;
7501             var tags_1 = __args[4];
7502             var creationDate_1 = __args[5];
7503             var grade_1 = __args[6];
7504             var icon_1 = __args[7];
7505             var planIcon_1 = __args[8];
7506             var model_1 = __args[9];
7507             var width_3 = __args[10];
7508             var depth_1 = __args[11];
7509             var height_4 = __args[12];
7510             var elevation_1 = __args[13];
7511             var dropOnTopElevation_1 = __args[14];
7512             var movable_1 = __args[15];
7513             var staircaseCutOutShape_2 = __args[16];
7514             var modelRotation_2 = __args[17];
7515             var backFaceShown = __args[18];
7516             var modelSize_2 = __args[19];
7517             var creator_4 = __args[20];
7518             var resizable_2 = __args[21];
7519             var deformable_2 = __args[22];
7520             var texturable_2 = __args[23];
7521             var horizontallyRotatable_2 = __args[24];
7522             var price_2 = __args[25];
7523             var valueAddedTaxPercentage_2 = __args[26];
7524             var currency_2 = __args[27];
7525             var properties_2 = __args[28];
7526             {
7527                 var __args_41 = arguments;
7528                 var modelFlags_2 = backFaceShown ? PieceOfFurniture.SHOW_BACK_FACE : 0;
7529                 {
7530                     var __args_42 = arguments;
7531                     var license_1 = null;
7532                     var contents_2 = null;
7533                     {
7534                         var __args_43 = arguments;
7535                         var doorOrWindow_2 = false;
7536                         var color_2 = null;
7537                         var iconYaw_2 = Math.PI / 8;
7538                         var iconPitch_2 = 0;
7539                         var iconScale_2 = 1;
7540                         var proportional_2 = true;
7541                         var modifiable_9 = false;
7542                         if (this.id === undefined) {
7543                             this.id = null;
7544                         }
7545                         if (this.name === undefined) {
7546                             this.name = null;
7547                         }
7548                         if (this.description === undefined) {
7549                             this.description = null;
7550                         }
7551                         if (this.information === undefined) {
7552                             this.information = null;
7553                         }
7554                         if (this.license === undefined) {
7555                             this.license = null;
7556                         }
7557                         if (this.tags === undefined) {
7558                             this.tags = null;
7559                         }
7560                         if (this.creationDate === undefined) {
7561                             this.creationDate = null;
7562                         }
7563                         if (this.grade === undefined) {
7564                             this.grade = null;
7565                         }
7566                         if (this.icon === undefined) {
7567                             this.icon = null;
7568                         }
7569                         if (this.planIcon === undefined) {
7570                             this.planIcon = null;
7571                         }
7572                         if (this.model === undefined) {
7573                             this.model = null;
7574                         }
7575                         if (this.width === undefined) {
7576                             this.width = 0;
7577                         }
7578                         if (this.depth === undefined) {
7579                             this.depth = 0;
7580                         }
7581                         if (this.height === undefined) {
7582                             this.height = 0;
7583                         }
7584                         if (this.proportional === undefined) {
7585                             this.proportional = false;
7586                         }
7587                         if (this.elevation === undefined) {
7588                             this.elevation = 0;
7589                         }
7590                         if (this.dropOnTopElevation === undefined) {
7591                             this.dropOnTopElevation = 0;
7592                         }
7593                         if (this.movable === undefined) {
7594                             this.movable = false;
7595                         }
7596                         if (this.doorOrWindow === undefined) {
7597                             this.doorOrWindow = false;
7598                         }
7599                         if (this.staircaseCutOutShape === undefined) {
7600                             this.staircaseCutOutShape = null;
7601                         }
7602                         if (this.modelRotation === undefined) {
7603                             this.modelRotation = null;
7604                         }
7605                         if (this.modelFlags === undefined) {
7606                             this.modelFlags = 0;
7607                         }
7608                         if (this.modelSize === undefined) {
7609                             this.modelSize = null;
7610                         }
7611                         if (this.creator === undefined) {
7612                             this.creator = null;
7613                         }
7614                         if (this.color === undefined) {
7615                             this.color = null;
7616                         }
7617                         if (this.iconYaw === undefined) {
7618                             this.iconYaw = 0;
7619                         }
7620                         if (this.iconPitch === undefined) {
7621                             this.iconPitch = 0;
7622                         }
7623                         if (this.iconScale === undefined) {
7624                             this.iconScale = 0;
7625                         }
7626                         if (this.modifiable === undefined) {
7627                             this.modifiable = false;
7628                         }
7629                         if (this.resizable === undefined) {
7630                             this.resizable = false;
7631                         }
7632                         if (this.deformable === undefined) {
7633                             this.deformable = false;
7634                         }
7635                         if (this.texturable === undefined) {
7636                             this.texturable = false;
7637                         }
7638                         if (this.horizontallyRotatable === undefined) {
7639                             this.horizontallyRotatable = false;
7640                         }
7641                         if (this.price === undefined) {
7642                             this.price = null;
7643                         }
7644                         if (this.valueAddedTaxPercentage === undefined) {
7645                             this.valueAddedTaxPercentage = null;
7646                         }
7647                         if (this.currency === undefined) {
7648                             this.currency = null;
7649                         }
7650                         if (this.properties === undefined) {
7651                             this.properties = null;
7652                         }
7653                         if (this.category === undefined) {
7654                             this.category = null;
7655                         }
7656                         if (this.filterCollationKey === undefined) {
7657                             this.filterCollationKey = null;
7658                         }
7659                         this.id = id;
7660                         this.name = name;
7661                         this.description = description;
7662                         this.information = information;
7663                         this.license = license_1;
7664                         this.tags = tags_1;
7665                         this.creationDate = creationDate_1;
7666                         this.grade = grade_1;
7667                         this.icon = icon_1;
7668                         this.planIcon = planIcon_1;
7669                         this.model = model_1;
7670                         this.width = width_3;
7671                         this.depth = depth_1;
7672                         this.height = height_4;
7673                         this.elevation = elevation_1;
7674                         this.dropOnTopElevation = dropOnTopElevation_1;
7675                         this.movable = movable_1;
7676                         this.doorOrWindow = doorOrWindow_2;
7677                         this.color = color_2;
7678                         this.staircaseCutOutShape = staircaseCutOutShape_2;
7679                         this.creator = creator_4;
7680                         this.horizontallyRotatable = horizontallyRotatable_2;
7681                         this.price = price_2;
7682                         this.valueAddedTaxPercentage = valueAddedTaxPercentage_2;
7683                         this.currency = currency_2;
7684                         if (properties_2 == null || /* size */ Object.keys(properties_2).length === 0) {
7685                             if (contents_2 == null || /* size */ Object.keys(contents_2).length === 0) {
7686                                 this.properties = /* emptyMap */ {};
7687                             }
7688                             else if ( /* size */Object.keys(contents_2).length === 1) {
7689                                 this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(contents_2)).next(); return o; })(/* iterator */ (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(contents_2)).next());
7690                             }
7691                             else {
7692                                 this.properties = ((function (o) { var r = {}; for (var p in o)
7693                                     r[p] = o[p]; return r; })(contents_2));
7694                             }
7695                         }
7696                         else if ( /* size */Object.keys(properties_2).length === 1 && (contents_2 == null || /* size */ Object.keys(contents_2).length === 0)) {
7697                             this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(properties_2)).next(); return o; })(/* iterator */ (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(properties_2)).next());
7698                         }
7699                         else {
7700                             this.properties = ((function (o) { var r = {}; for (var p in o)
7701                                 r[p] = o[p]; return r; })(properties_2));
7702                             if (contents_2 != null) {
7703                                 /* putAll */ (function (m, n) { for (var i in n)
7704                                     m[i] = n[i]; })(this.properties, contents_2);
7705                             }
7706                         }
7707                         if (modelRotation_2 == null) {
7708                             this.modelRotation = PieceOfFurniture.IDENTITY_ROTATION_$LI$();
7709                         }
7710                         else {
7711                             this.modelRotation = CatalogPieceOfFurniture.deepClone(modelRotation_2);
7712                         }
7713                         this.modelFlags = modelFlags_2;
7714                         this.modelSize = modelSize_2;
7715                         this.resizable = resizable_2;
7716                         this.deformable = deformable_2;
7717                         this.texturable = texturable_2;
7718                         this.iconYaw = iconYaw_2;
7719                         this.iconPitch = iconPitch_2;
7720                         this.iconScale = iconScale_2;
7721                         this.proportional = proportional_2;
7722                         this.modifiable = modifiable_9;
7723                     }
7724                     if (this.id === undefined) {
7725                         this.id = null;
7726                     }
7727                     if (this.name === undefined) {
7728                         this.name = null;
7729                     }
7730                     if (this.description === undefined) {
7731                         this.description = null;
7732                     }
7733                     if (this.information === undefined) {
7734                         this.information = null;
7735                     }
7736                     if (this.license === undefined) {
7737                         this.license = null;
7738                     }
7739                     if (this.tags === undefined) {
7740                         this.tags = null;
7741                     }
7742                     if (this.creationDate === undefined) {
7743                         this.creationDate = null;
7744                     }
7745                     if (this.grade === undefined) {
7746                         this.grade = null;
7747                     }
7748                     if (this.icon === undefined) {
7749                         this.icon = null;
7750                     }
7751                     if (this.planIcon === undefined) {
7752                         this.planIcon = null;
7753                     }
7754                     if (this.model === undefined) {
7755                         this.model = null;
7756                     }
7757                     if (this.width === undefined) {
7758                         this.width = 0;
7759                     }
7760                     if (this.depth === undefined) {
7761                         this.depth = 0;
7762                     }
7763                     if (this.height === undefined) {
7764                         this.height = 0;
7765                     }
7766                     if (this.proportional === undefined) {
7767                         this.proportional = false;
7768                     }
7769                     if (this.elevation === undefined) {
7770                         this.elevation = 0;
7771                     }
7772                     if (this.dropOnTopElevation === undefined) {
7773                         this.dropOnTopElevation = 0;
7774                     }
7775                     if (this.movable === undefined) {
7776                         this.movable = false;
7777                     }
7778                     if (this.doorOrWindow === undefined) {
7779                         this.doorOrWindow = false;
7780                     }
7781                     if (this.staircaseCutOutShape === undefined) {
7782                         this.staircaseCutOutShape = null;
7783                     }
7784                     if (this.modelRotation === undefined) {
7785                         this.modelRotation = null;
7786                     }
7787                     if (this.modelFlags === undefined) {
7788                         this.modelFlags = 0;
7789                     }
7790                     if (this.modelSize === undefined) {
7791                         this.modelSize = null;
7792                     }
7793                     if (this.creator === undefined) {
7794                         this.creator = null;
7795                     }
7796                     if (this.color === undefined) {
7797                         this.color = null;
7798                     }
7799                     if (this.iconYaw === undefined) {
7800                         this.iconYaw = 0;
7801                     }
7802                     if (this.iconPitch === undefined) {
7803                         this.iconPitch = 0;
7804                     }
7805                     if (this.iconScale === undefined) {
7806                         this.iconScale = 0;
7807                     }
7808                     if (this.modifiable === undefined) {
7809                         this.modifiable = false;
7810                     }
7811                     if (this.resizable === undefined) {
7812                         this.resizable = false;
7813                     }
7814                     if (this.deformable === undefined) {
7815                         this.deformable = false;
7816                     }
7817                     if (this.texturable === undefined) {
7818                         this.texturable = false;
7819                     }
7820                     if (this.horizontallyRotatable === undefined) {
7821                         this.horizontallyRotatable = false;
7822                     }
7823                     if (this.price === undefined) {
7824                         this.price = null;
7825                     }
7826                     if (this.valueAddedTaxPercentage === undefined) {
7827                         this.valueAddedTaxPercentage = null;
7828                     }
7829                     if (this.currency === undefined) {
7830                         this.currency = null;
7831                     }
7832                     if (this.properties === undefined) {
7833                         this.properties = null;
7834                     }
7835                     if (this.category === undefined) {
7836                         this.category = null;
7837                     }
7838                     if (this.filterCollationKey === undefined) {
7839                         this.filterCollationKey = null;
7840                     }
7841                 }
7842                 if (this.id === undefined) {
7843                     this.id = null;
7844                 }
7845                 if (this.name === undefined) {
7846                     this.name = null;
7847                 }
7848                 if (this.description === undefined) {
7849                     this.description = null;
7850                 }
7851                 if (this.information === undefined) {
7852                     this.information = null;
7853                 }
7854                 if (this.license === undefined) {
7855                     this.license = null;
7856                 }
7857                 if (this.tags === undefined) {
7858                     this.tags = null;
7859                 }
7860                 if (this.creationDate === undefined) {
7861                     this.creationDate = null;
7862                 }
7863                 if (this.grade === undefined) {
7864                     this.grade = null;
7865                 }
7866                 if (this.icon === undefined) {
7867                     this.icon = null;
7868                 }
7869                 if (this.planIcon === undefined) {
7870                     this.planIcon = null;
7871                 }
7872                 if (this.model === undefined) {
7873                     this.model = null;
7874                 }
7875                 if (this.width === undefined) {
7876                     this.width = 0;
7877                 }
7878                 if (this.depth === undefined) {
7879                     this.depth = 0;
7880                 }
7881                 if (this.height === undefined) {
7882                     this.height = 0;
7883                 }
7884                 if (this.proportional === undefined) {
7885                     this.proportional = false;
7886                 }
7887                 if (this.elevation === undefined) {
7888                     this.elevation = 0;
7889                 }
7890                 if (this.dropOnTopElevation === undefined) {
7891                     this.dropOnTopElevation = 0;
7892                 }
7893                 if (this.movable === undefined) {
7894                     this.movable = false;
7895                 }
7896                 if (this.doorOrWindow === undefined) {
7897                     this.doorOrWindow = false;
7898                 }
7899                 if (this.staircaseCutOutShape === undefined) {
7900                     this.staircaseCutOutShape = null;
7901                 }
7902                 if (this.modelRotation === undefined) {
7903                     this.modelRotation = null;
7904                 }
7905                 if (this.modelFlags === undefined) {
7906                     this.modelFlags = 0;
7907                 }
7908                 if (this.modelSize === undefined) {
7909                     this.modelSize = null;
7910                 }
7911                 if (this.creator === undefined) {
7912                     this.creator = null;
7913                 }
7914                 if (this.color === undefined) {
7915                     this.color = null;
7916                 }
7917                 if (this.iconYaw === undefined) {
7918                     this.iconYaw = 0;
7919                 }
7920                 if (this.iconPitch === undefined) {
7921                     this.iconPitch = 0;
7922                 }
7923                 if (this.iconScale === undefined) {
7924                     this.iconScale = 0;
7925                 }
7926                 if (this.modifiable === undefined) {
7927                     this.modifiable = false;
7928                 }
7929                 if (this.resizable === undefined) {
7930                     this.resizable = false;
7931                 }
7932                 if (this.deformable === undefined) {
7933                     this.deformable = false;
7934                 }
7935                 if (this.texturable === undefined) {
7936                     this.texturable = false;
7937                 }
7938                 if (this.horizontallyRotatable === undefined) {
7939                     this.horizontallyRotatable = false;
7940                 }
7941                 if (this.price === undefined) {
7942                     this.price = null;
7943                 }
7944                 if (this.valueAddedTaxPercentage === undefined) {
7945                     this.valueAddedTaxPercentage = null;
7946                 }
7947                 if (this.currency === undefined) {
7948                     this.currency = null;
7949                 }
7950                 if (this.properties === undefined) {
7951                     this.properties = null;
7952                 }
7953                 if (this.category === undefined) {
7954                     this.category = null;
7955                 }
7956                 if (this.filterCollationKey === undefined) {
7957                     this.filterCollationKey = null;
7958                 }
7959             }
7960             if (this.id === undefined) {
7961                 this.id = null;
7962             }
7963             if (this.name === undefined) {
7964                 this.name = null;
7965             }
7966             if (this.description === undefined) {
7967                 this.description = null;
7968             }
7969             if (this.information === undefined) {
7970                 this.information = null;
7971             }
7972             if (this.license === undefined) {
7973                 this.license = null;
7974             }
7975             if (this.tags === undefined) {
7976                 this.tags = null;
7977             }
7978             if (this.creationDate === undefined) {
7979                 this.creationDate = null;
7980             }
7981             if (this.grade === undefined) {
7982                 this.grade = null;
7983             }
7984             if (this.icon === undefined) {
7985                 this.icon = null;
7986             }
7987             if (this.planIcon === undefined) {
7988                 this.planIcon = null;
7989             }
7990             if (this.model === undefined) {
7991                 this.model = null;
7992             }
7993             if (this.width === undefined) {
7994                 this.width = 0;
7995             }
7996             if (this.depth === undefined) {
7997                 this.depth = 0;
7998             }
7999             if (this.height === undefined) {
8000                 this.height = 0;
8001             }
8002             if (this.proportional === undefined) {
8003                 this.proportional = false;
8004             }
8005             if (this.elevation === undefined) {
8006                 this.elevation = 0;
8007             }
8008             if (this.dropOnTopElevation === undefined) {
8009                 this.dropOnTopElevation = 0;
8010             }
8011             if (this.movable === undefined) {
8012                 this.movable = false;
8013             }
8014             if (this.doorOrWindow === undefined) {
8015                 this.doorOrWindow = false;
8016             }
8017             if (this.staircaseCutOutShape === undefined) {
8018                 this.staircaseCutOutShape = null;
8019             }
8020             if (this.modelRotation === undefined) {
8021                 this.modelRotation = null;
8022             }
8023             if (this.modelFlags === undefined) {
8024                 this.modelFlags = 0;
8025             }
8026             if (this.modelSize === undefined) {
8027                 this.modelSize = null;
8028             }
8029             if (this.creator === undefined) {
8030                 this.creator = null;
8031             }
8032             if (this.color === undefined) {
8033                 this.color = null;
8034             }
8035             if (this.iconYaw === undefined) {
8036                 this.iconYaw = 0;
8037             }
8038             if (this.iconPitch === undefined) {
8039                 this.iconPitch = 0;
8040             }
8041             if (this.iconScale === undefined) {
8042                 this.iconScale = 0;
8043             }
8044             if (this.modifiable === undefined) {
8045                 this.modifiable = false;
8046             }
8047             if (this.resizable === undefined) {
8048                 this.resizable = false;
8049             }
8050             if (this.deformable === undefined) {
8051                 this.deformable = false;
8052             }
8053             if (this.texturable === undefined) {
8054                 this.texturable = false;
8055             }
8056             if (this.horizontallyRotatable === undefined) {
8057                 this.horizontallyRotatable = false;
8058             }
8059             if (this.price === undefined) {
8060                 this.price = null;
8061             }
8062             if (this.valueAddedTaxPercentage === undefined) {
8063                 this.valueAddedTaxPercentage = null;
8064             }
8065             if (this.currency === undefined) {
8066                 this.currency = null;
8067             }
8068             if (this.properties === undefined) {
8069                 this.properties = null;
8070             }
8071             if (this.category === undefined) {
8072                 this.category = null;
8073             }
8074             if (this.filterCollationKey === undefined) {
8075                 this.filterCollationKey = null;
8076             }
8077         }
8078         else if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((typeof information === 'string') || information === null) && ((license != null && license instanceof Array && (license.length == 0 || license[0] == null || (typeof license[0] === 'string'))) || license === null) && ((typeof tags === 'number') || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((grade != null && (grade.constructor != null && grade.constructor["__interfaces"] != null && grade.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || grade === null) && ((icon != null && (icon.constructor != null && icon.constructor["__interfaces"] != null && icon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || icon === null) && ((planIcon != null && (planIcon.constructor != null && planIcon.constructor["__interfaces"] != null && planIcon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || planIcon === null) && ((typeof model === 'number') || model === null) && ((typeof width === 'number') || width === null) && ((typeof depth === 'number') || depth === null) && ((typeof height === 'number') || height === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof dropOnTopElevation === 'boolean') || dropOnTopElevation === null) && ((typeof movable === 'string') || movable === null) && ((doorOrWindow != null && doorOrWindow instanceof Array && (doorOrWindow.length == 0 || doorOrWindow[0] == null || doorOrWindow[0] instanceof Array)) || doorOrWindow === null) && ((typeof staircaseCutOutShape === 'number') || staircaseCutOutShape === null) && ((typeof color === 'number') || color === null) && ((typeof modelRotation === 'string') || modelRotation === null) && ((typeof modelFlags === 'boolean') || modelFlags === null) && ((typeof modelSize === 'boolean') || modelSize === null) && ((typeof creator === 'boolean') || creator === null) && ((typeof resizable === 'boolean') || resizable === null) && ((deformable != null && deformable instanceof Big) || deformable === null) && ((texturable != null && texturable instanceof Big) || texturable === null) && ((typeof horizontallyRotatable === 'string') || horizontallyRotatable === null) && ((price != null && (price instanceof Object)) || price === null) && valueAddedTaxPercentage === undefined && currency === undefined && properties === undefined && contents === undefined && iconYaw === undefined && iconPitch === undefined && iconScale === undefined && proportional === undefined && modifiable === undefined) {
8079             var __args = arguments;
8080             var tags_2 = __args[4];
8081             var creationDate_2 = __args[5];
8082             var grade_2 = __args[6];
8083             var icon_2 = __args[7];
8084             var planIcon_2 = __args[8];
8085             var model_2 = __args[9];
8086             var width_4 = __args[10];
8087             var depth_2 = __args[11];
8088             var height_5 = __args[12];
8089             var elevation_2 = __args[13];
8090             var dropOnTopElevation_2 = __args[14];
8091             var movable_2 = __args[15];
8092             var staircaseCutOutShape_3 = __args[16];
8093             var modelRotation_3 = __args[17];
8094             var modelFlags_3 = __args[18];
8095             var modelSize_3 = __args[19];
8096             var creator_5 = __args[20];
8097             var resizable_3 = __args[21];
8098             var deformable_3 = __args[22];
8099             var texturable_3 = __args[23];
8100             var horizontallyRotatable_3 = __args[24];
8101             var price_3 = __args[25];
8102             var valueAddedTaxPercentage_3 = __args[26];
8103             var currency_3 = __args[27];
8104             var properties_3 = __args[28];
8105             {
8106                 var __args_44 = arguments;
8107                 var license_2 = null;
8108                 var contents_3 = null;
8109                 {
8110                     var __args_45 = arguments;
8111                     var doorOrWindow_3 = false;
8112                     var color_3 = null;
8113                     var iconYaw_3 = Math.PI / 8;
8114                     var iconPitch_3 = 0;
8115                     var iconScale_3 = 1;
8116                     var proportional_3 = true;
8117                     var modifiable_10 = false;
8118                     if (this.id === undefined) {
8119                         this.id = null;
8120                     }
8121                     if (this.name === undefined) {
8122                         this.name = null;
8123                     }
8124                     if (this.description === undefined) {
8125                         this.description = null;
8126                     }
8127                     if (this.information === undefined) {
8128                         this.information = null;
8129                     }
8130                     if (this.license === undefined) {
8131                         this.license = null;
8132                     }
8133                     if (this.tags === undefined) {
8134                         this.tags = null;
8135                     }
8136                     if (this.creationDate === undefined) {
8137                         this.creationDate = null;
8138                     }
8139                     if (this.grade === undefined) {
8140                         this.grade = null;
8141                     }
8142                     if (this.icon === undefined) {
8143                         this.icon = null;
8144                     }
8145                     if (this.planIcon === undefined) {
8146                         this.planIcon = null;
8147                     }
8148                     if (this.model === undefined) {
8149                         this.model = null;
8150                     }
8151                     if (this.width === undefined) {
8152                         this.width = 0;
8153                     }
8154                     if (this.depth === undefined) {
8155                         this.depth = 0;
8156                     }
8157                     if (this.height === undefined) {
8158                         this.height = 0;
8159                     }
8160                     if (this.proportional === undefined) {
8161                         this.proportional = false;
8162                     }
8163                     if (this.elevation === undefined) {
8164                         this.elevation = 0;
8165                     }
8166                     if (this.dropOnTopElevation === undefined) {
8167                         this.dropOnTopElevation = 0;
8168                     }
8169                     if (this.movable === undefined) {
8170                         this.movable = false;
8171                     }
8172                     if (this.doorOrWindow === undefined) {
8173                         this.doorOrWindow = false;
8174                     }
8175                     if (this.staircaseCutOutShape === undefined) {
8176                         this.staircaseCutOutShape = null;
8177                     }
8178                     if (this.modelRotation === undefined) {
8179                         this.modelRotation = null;
8180                     }
8181                     if (this.modelFlags === undefined) {
8182                         this.modelFlags = 0;
8183                     }
8184                     if (this.modelSize === undefined) {
8185                         this.modelSize = null;
8186                     }
8187                     if (this.creator === undefined) {
8188                         this.creator = null;
8189                     }
8190                     if (this.color === undefined) {
8191                         this.color = null;
8192                     }
8193                     if (this.iconYaw === undefined) {
8194                         this.iconYaw = 0;
8195                     }
8196                     if (this.iconPitch === undefined) {
8197                         this.iconPitch = 0;
8198                     }
8199                     if (this.iconScale === undefined) {
8200                         this.iconScale = 0;
8201                     }
8202                     if (this.modifiable === undefined) {
8203                         this.modifiable = false;
8204                     }
8205                     if (this.resizable === undefined) {
8206                         this.resizable = false;
8207                     }
8208                     if (this.deformable === undefined) {
8209                         this.deformable = false;
8210                     }
8211                     if (this.texturable === undefined) {
8212                         this.texturable = false;
8213                     }
8214                     if (this.horizontallyRotatable === undefined) {
8215                         this.horizontallyRotatable = false;
8216                     }
8217                     if (this.price === undefined) {
8218                         this.price = null;
8219                     }
8220                     if (this.valueAddedTaxPercentage === undefined) {
8221                         this.valueAddedTaxPercentage = null;
8222                     }
8223                     if (this.currency === undefined) {
8224                         this.currency = null;
8225                     }
8226                     if (this.properties === undefined) {
8227                         this.properties = null;
8228                     }
8229                     if (this.category === undefined) {
8230                         this.category = null;
8231                     }
8232                     if (this.filterCollationKey === undefined) {
8233                         this.filterCollationKey = null;
8234                     }
8235                     this.id = id;
8236                     this.name = name;
8237                     this.description = description;
8238                     this.information = information;
8239                     this.license = license_2;
8240                     this.tags = tags_2;
8241                     this.creationDate = creationDate_2;
8242                     this.grade = grade_2;
8243                     this.icon = icon_2;
8244                     this.planIcon = planIcon_2;
8245                     this.model = model_2;
8246                     this.width = width_4;
8247                     this.depth = depth_2;
8248                     this.height = height_5;
8249                     this.elevation = elevation_2;
8250                     this.dropOnTopElevation = dropOnTopElevation_2;
8251                     this.movable = movable_2;
8252                     this.doorOrWindow = doorOrWindow_3;
8253                     this.color = color_3;
8254                     this.staircaseCutOutShape = staircaseCutOutShape_3;
8255                     this.creator = creator_5;
8256                     this.horizontallyRotatable = horizontallyRotatable_3;
8257                     this.price = price_3;
8258                     this.valueAddedTaxPercentage = valueAddedTaxPercentage_3;
8259                     this.currency = currency_3;
8260                     if (properties_3 == null || /* size */ Object.keys(properties_3).length === 0) {
8261                         if (contents_3 == null || /* size */ Object.keys(contents_3).length === 0) {
8262                             this.properties = /* emptyMap */ {};
8263                         }
8264                         else if ( /* size */Object.keys(contents_3).length === 1) {
8265                             this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(contents_3)).next(); return o; })(/* iterator */ (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(contents_3)).next());
8266                         }
8267                         else {
8268                             this.properties = ((function (o) { var r = {}; for (var p in o)
8269                                 r[p] = o[p]; return r; })(contents_3));
8270                         }
8271                     }
8272                     else if ( /* size */Object.keys(properties_3).length === 1 && (contents_3 == null || /* size */ Object.keys(contents_3).length === 0)) {
8273                         this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(properties_3)).next(); return o; })(/* iterator */ (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(properties_3)).next());
8274                     }
8275                     else {
8276                         this.properties = ((function (o) { var r = {}; for (var p in o)
8277                             r[p] = o[p]; return r; })(properties_3));
8278                         if (contents_3 != null) {
8279                             /* putAll */ (function (m, n) { for (var i in n)
8280                                 m[i] = n[i]; })(this.properties, contents_3);
8281                         }
8282                     }
8283                     if (modelRotation_3 == null) {
8284                         this.modelRotation = PieceOfFurniture.IDENTITY_ROTATION_$LI$();
8285                     }
8286                     else {
8287                         this.modelRotation = CatalogPieceOfFurniture.deepClone(modelRotation_3);
8288                     }
8289                     this.modelFlags = modelFlags_3;
8290                     this.modelSize = modelSize_3;
8291                     this.resizable = resizable_3;
8292                     this.deformable = deformable_3;
8293                     this.texturable = texturable_3;
8294                     this.iconYaw = iconYaw_3;
8295                     this.iconPitch = iconPitch_3;
8296                     this.iconScale = iconScale_3;
8297                     this.proportional = proportional_3;
8298                     this.modifiable = modifiable_10;
8299                 }
8300                 if (this.id === undefined) {
8301                     this.id = null;
8302                 }
8303                 if (this.name === undefined) {
8304                     this.name = null;
8305                 }
8306                 if (this.description === undefined) {
8307                     this.description = null;
8308                 }
8309                 if (this.information === undefined) {
8310                     this.information = null;
8311                 }
8312                 if (this.license === undefined) {
8313                     this.license = null;
8314                 }
8315                 if (this.tags === undefined) {
8316                     this.tags = null;
8317                 }
8318                 if (this.creationDate === undefined) {
8319                     this.creationDate = null;
8320                 }
8321                 if (this.grade === undefined) {
8322                     this.grade = null;
8323                 }
8324                 if (this.icon === undefined) {
8325                     this.icon = null;
8326                 }
8327                 if (this.planIcon === undefined) {
8328                     this.planIcon = null;
8329                 }
8330                 if (this.model === undefined) {
8331                     this.model = null;
8332                 }
8333                 if (this.width === undefined) {
8334                     this.width = 0;
8335                 }
8336                 if (this.depth === undefined) {
8337                     this.depth = 0;
8338                 }
8339                 if (this.height === undefined) {
8340                     this.height = 0;
8341                 }
8342                 if (this.proportional === undefined) {
8343                     this.proportional = false;
8344                 }
8345                 if (this.elevation === undefined) {
8346                     this.elevation = 0;
8347                 }
8348                 if (this.dropOnTopElevation === undefined) {
8349                     this.dropOnTopElevation = 0;
8350                 }
8351                 if (this.movable === undefined) {
8352                     this.movable = false;
8353                 }
8354                 if (this.doorOrWindow === undefined) {
8355                     this.doorOrWindow = false;
8356                 }
8357                 if (this.staircaseCutOutShape === undefined) {
8358                     this.staircaseCutOutShape = null;
8359                 }
8360                 if (this.modelRotation === undefined) {
8361                     this.modelRotation = null;
8362                 }
8363                 if (this.modelFlags === undefined) {
8364                     this.modelFlags = 0;
8365                 }
8366                 if (this.modelSize === undefined) {
8367                     this.modelSize = null;
8368                 }
8369                 if (this.creator === undefined) {
8370                     this.creator = null;
8371                 }
8372                 if (this.color === undefined) {
8373                     this.color = null;
8374                 }
8375                 if (this.iconYaw === undefined) {
8376                     this.iconYaw = 0;
8377                 }
8378                 if (this.iconPitch === undefined) {
8379                     this.iconPitch = 0;
8380                 }
8381                 if (this.iconScale === undefined) {
8382                     this.iconScale = 0;
8383                 }
8384                 if (this.modifiable === undefined) {
8385                     this.modifiable = false;
8386                 }
8387                 if (this.resizable === undefined) {
8388                     this.resizable = false;
8389                 }
8390                 if (this.deformable === undefined) {
8391                     this.deformable = false;
8392                 }
8393                 if (this.texturable === undefined) {
8394                     this.texturable = false;
8395                 }
8396                 if (this.horizontallyRotatable === undefined) {
8397                     this.horizontallyRotatable = false;
8398                 }
8399                 if (this.price === undefined) {
8400                     this.price = null;
8401                 }
8402                 if (this.valueAddedTaxPercentage === undefined) {
8403                     this.valueAddedTaxPercentage = null;
8404                 }
8405                 if (this.currency === undefined) {
8406                     this.currency = null;
8407                 }
8408                 if (this.properties === undefined) {
8409                     this.properties = null;
8410                 }
8411                 if (this.category === undefined) {
8412                     this.category = null;
8413                 }
8414                 if (this.filterCollationKey === undefined) {
8415                     this.filterCollationKey = null;
8416                 }
8417             }
8418             if (this.id === undefined) {
8419                 this.id = null;
8420             }
8421             if (this.name === undefined) {
8422                 this.name = null;
8423             }
8424             if (this.description === undefined) {
8425                 this.description = null;
8426             }
8427             if (this.information === undefined) {
8428                 this.information = null;
8429             }
8430             if (this.license === undefined) {
8431                 this.license = null;
8432             }
8433             if (this.tags === undefined) {
8434                 this.tags = null;
8435             }
8436             if (this.creationDate === undefined) {
8437                 this.creationDate = null;
8438             }
8439             if (this.grade === undefined) {
8440                 this.grade = null;
8441             }
8442             if (this.icon === undefined) {
8443                 this.icon = null;
8444             }
8445             if (this.planIcon === undefined) {
8446                 this.planIcon = null;
8447             }
8448             if (this.model === undefined) {
8449                 this.model = null;
8450             }
8451             if (this.width === undefined) {
8452                 this.width = 0;
8453             }
8454             if (this.depth === undefined) {
8455                 this.depth = 0;
8456             }
8457             if (this.height === undefined) {
8458                 this.height = 0;
8459             }
8460             if (this.proportional === undefined) {
8461                 this.proportional = false;
8462             }
8463             if (this.elevation === undefined) {
8464                 this.elevation = 0;
8465             }
8466             if (this.dropOnTopElevation === undefined) {
8467                 this.dropOnTopElevation = 0;
8468             }
8469             if (this.movable === undefined) {
8470                 this.movable = false;
8471             }
8472             if (this.doorOrWindow === undefined) {
8473                 this.doorOrWindow = false;
8474             }
8475             if (this.staircaseCutOutShape === undefined) {
8476                 this.staircaseCutOutShape = null;
8477             }
8478             if (this.modelRotation === undefined) {
8479                 this.modelRotation = null;
8480             }
8481             if (this.modelFlags === undefined) {
8482                 this.modelFlags = 0;
8483             }
8484             if (this.modelSize === undefined) {
8485                 this.modelSize = null;
8486             }
8487             if (this.creator === undefined) {
8488                 this.creator = null;
8489             }
8490             if (this.color === undefined) {
8491                 this.color = null;
8492             }
8493             if (this.iconYaw === undefined) {
8494                 this.iconYaw = 0;
8495             }
8496             if (this.iconPitch === undefined) {
8497                 this.iconPitch = 0;
8498             }
8499             if (this.iconScale === undefined) {
8500                 this.iconScale = 0;
8501             }
8502             if (this.modifiable === undefined) {
8503                 this.modifiable = false;
8504             }
8505             if (this.resizable === undefined) {
8506                 this.resizable = false;
8507             }
8508             if (this.deformable === undefined) {
8509                 this.deformable = false;
8510             }
8511             if (this.texturable === undefined) {
8512                 this.texturable = false;
8513             }
8514             if (this.horizontallyRotatable === undefined) {
8515                 this.horizontallyRotatable = false;
8516             }
8517             if (this.price === undefined) {
8518                 this.price = null;
8519             }
8520             if (this.valueAddedTaxPercentage === undefined) {
8521                 this.valueAddedTaxPercentage = null;
8522             }
8523             if (this.currency === undefined) {
8524                 this.currency = null;
8525             }
8526             if (this.properties === undefined) {
8527                 this.properties = null;
8528             }
8529             if (this.category === undefined) {
8530                 this.category = null;
8531             }
8532             if (this.filterCollationKey === undefined) {
8533                 this.filterCollationKey = null;
8534             }
8535         }
8536         else if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((typeof information === 'string') || information === null) && ((license != null && license instanceof Array && (license.length == 0 || license[0] == null || (typeof license[0] === 'string'))) || license === null) && ((typeof tags === 'number') || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((grade != null && (grade.constructor != null && grade.constructor["__interfaces"] != null && grade.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || grade === null) && ((icon != null && (icon.constructor != null && icon.constructor["__interfaces"] != null && icon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || icon === null) && ((planIcon != null && (planIcon.constructor != null && planIcon.constructor["__interfaces"] != null && planIcon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || planIcon === null) && ((typeof model === 'number') || model === null) && ((typeof width === 'number') || width === null) && ((typeof depth === 'number') || depth === null) && ((typeof height === 'number') || height === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof dropOnTopElevation === 'boolean') || dropOnTopElevation === null) && ((typeof movable === 'string') || movable === null) && ((doorOrWindow != null && doorOrWindow instanceof Array && (doorOrWindow.length == 0 || doorOrWindow[0] == null || doorOrWindow[0] instanceof Array)) || doorOrWindow === null) && ((typeof staircaseCutOutShape === 'boolean') || staircaseCutOutShape === null) && ((typeof color === 'number') || color === null) && ((typeof modelRotation === 'string') || modelRotation === null) && ((typeof modelFlags === 'boolean') || modelFlags === null) && ((typeof modelSize === 'boolean') || modelSize === null) && ((typeof creator === 'boolean') || creator === null) && ((typeof resizable === 'boolean') || resizable === null) && ((deformable != null && deformable instanceof Big) || deformable === null) && ((texturable != null && texturable instanceof Big) || texturable === null) && ((typeof horizontallyRotatable === 'string') || horizontallyRotatable === null) && price === undefined && valueAddedTaxPercentage === undefined && currency === undefined && properties === undefined && contents === undefined && iconYaw === undefined && iconPitch === undefined && iconScale === undefined && proportional === undefined && modifiable === undefined) {
8537             var __args = arguments;
8538             var tags_3 = __args[4];
8539             var creationDate_3 = __args[5];
8540             var grade_3 = __args[6];
8541             var icon_3 = __args[7];
8542             var planIcon_3 = __args[8];
8543             var model_3 = __args[9];
8544             var width_5 = __args[10];
8545             var depth_3 = __args[11];
8546             var height_6 = __args[12];
8547             var elevation_3 = __args[13];
8548             var dropOnTopElevation_3 = __args[14];
8549             var movable_3 = __args[15];
8550             var staircaseCutOutShape_4 = __args[16];
8551             var modelRotation_4 = __args[17];
8552             var backFaceShown = __args[18];
8553             var modelSize_4 = __args[19];
8554             var creator_6 = __args[20];
8555             var resizable_4 = __args[21];
8556             var deformable_4 = __args[22];
8557             var texturable_4 = __args[23];
8558             var horizontallyRotatable_4 = __args[24];
8559             var price_4 = __args[25];
8560             var valueAddedTaxPercentage_4 = __args[26];
8561             var currency_4 = __args[27];
8562             {
8563                 var __args_46 = arguments;
8564                 var properties_4 = null;
8565                 {
8566                     var __args_47 = arguments;
8567                     var modelFlags_4 = backFaceShown ? PieceOfFurniture.SHOW_BACK_FACE : 0;
8568                     {
8569                         var __args_48 = arguments;
8570                         var license_3 = null;
8571                         var contents_4 = null;
8572                         {
8573                             var __args_49 = arguments;
8574                             var doorOrWindow_4 = false;
8575                             var color_4 = null;
8576                             var iconYaw_4 = Math.PI / 8;
8577                             var iconPitch_4 = 0;
8578                             var iconScale_4 = 1;
8579                             var proportional_4 = true;
8580                             var modifiable_11 = false;
8581                             if (this.id === undefined) {
8582                                 this.id = null;
8583                             }
8584                             if (this.name === undefined) {
8585                                 this.name = null;
8586                             }
8587                             if (this.description === undefined) {
8588                                 this.description = null;
8589                             }
8590                             if (this.information === undefined) {
8591                                 this.information = null;
8592                             }
8593                             if (this.license === undefined) {
8594                                 this.license = null;
8595                             }
8596                             if (this.tags === undefined) {
8597                                 this.tags = null;
8598                             }
8599                             if (this.creationDate === undefined) {
8600                                 this.creationDate = null;
8601                             }
8602                             if (this.grade === undefined) {
8603                                 this.grade = null;
8604                             }
8605                             if (this.icon === undefined) {
8606                                 this.icon = null;
8607                             }
8608                             if (this.planIcon === undefined) {
8609                                 this.planIcon = null;
8610                             }
8611                             if (this.model === undefined) {
8612                                 this.model = null;
8613                             }
8614                             if (this.width === undefined) {
8615                                 this.width = 0;
8616                             }
8617                             if (this.depth === undefined) {
8618                                 this.depth = 0;
8619                             }
8620                             if (this.height === undefined) {
8621                                 this.height = 0;
8622                             }
8623                             if (this.proportional === undefined) {
8624                                 this.proportional = false;
8625                             }
8626                             if (this.elevation === undefined) {
8627                                 this.elevation = 0;
8628                             }
8629                             if (this.dropOnTopElevation === undefined) {
8630                                 this.dropOnTopElevation = 0;
8631                             }
8632                             if (this.movable === undefined) {
8633                                 this.movable = false;
8634                             }
8635                             if (this.doorOrWindow === undefined) {
8636                                 this.doorOrWindow = false;
8637                             }
8638                             if (this.staircaseCutOutShape === undefined) {
8639                                 this.staircaseCutOutShape = null;
8640                             }
8641                             if (this.modelRotation === undefined) {
8642                                 this.modelRotation = null;
8643                             }
8644                             if (this.modelFlags === undefined) {
8645                                 this.modelFlags = 0;
8646                             }
8647                             if (this.modelSize === undefined) {
8648                                 this.modelSize = null;
8649                             }
8650                             if (this.creator === undefined) {
8651                                 this.creator = null;
8652                             }
8653                             if (this.color === undefined) {
8654                                 this.color = null;
8655                             }
8656                             if (this.iconYaw === undefined) {
8657                                 this.iconYaw = 0;
8658                             }
8659                             if (this.iconPitch === undefined) {
8660                                 this.iconPitch = 0;
8661                             }
8662                             if (this.iconScale === undefined) {
8663                                 this.iconScale = 0;
8664                             }
8665                             if (this.modifiable === undefined) {
8666                                 this.modifiable = false;
8667                             }
8668                             if (this.resizable === undefined) {
8669                                 this.resizable = false;
8670                             }
8671                             if (this.deformable === undefined) {
8672                                 this.deformable = false;
8673                             }
8674                             if (this.texturable === undefined) {
8675                                 this.texturable = false;
8676                             }
8677                             if (this.horizontallyRotatable === undefined) {
8678                                 this.horizontallyRotatable = false;
8679                             }
8680                             if (this.price === undefined) {
8681                                 this.price = null;
8682                             }
8683                             if (this.valueAddedTaxPercentage === undefined) {
8684                                 this.valueAddedTaxPercentage = null;
8685                             }
8686                             if (this.currency === undefined) {
8687                                 this.currency = null;
8688                             }
8689                             if (this.properties === undefined) {
8690                                 this.properties = null;
8691                             }
8692                             if (this.category === undefined) {
8693                                 this.category = null;
8694                             }
8695                             if (this.filterCollationKey === undefined) {
8696                                 this.filterCollationKey = null;
8697                             }
8698                             this.id = id;
8699                             this.name = name;
8700                             this.description = description;
8701                             this.information = information;
8702                             this.license = license_3;
8703                             this.tags = tags_3;
8704                             this.creationDate = creationDate_3;
8705                             this.grade = grade_3;
8706                             this.icon = icon_3;
8707                             this.planIcon = planIcon_3;
8708                             this.model = model_3;
8709                             this.width = width_5;
8710                             this.depth = depth_3;
8711                             this.height = height_6;
8712                             this.elevation = elevation_3;
8713                             this.dropOnTopElevation = dropOnTopElevation_3;
8714                             this.movable = movable_3;
8715                             this.doorOrWindow = doorOrWindow_4;
8716                             this.color = color_4;
8717                             this.staircaseCutOutShape = staircaseCutOutShape_4;
8718                             this.creator = creator_6;
8719                             this.horizontallyRotatable = horizontallyRotatable_4;
8720                             this.price = price_4;
8721                             this.valueAddedTaxPercentage = valueAddedTaxPercentage_4;
8722                             this.currency = currency_4;
8723                             if (properties_4 == null || /* size */ Object.keys(properties_4).length === 0) {
8724                                 if (contents_4 == null || /* size */ Object.keys(contents_4).length === 0) {
8725                                     this.properties = /* emptyMap */ {};
8726                                 }
8727                                 else if ( /* size */Object.keys(contents_4).length === 1) {
8728                                     this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(contents_4)).next(); return o; })(/* iterator */ (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(contents_4)).next());
8729                                 }
8730                                 else {
8731                                     this.properties = ((function (o) { var r = {}; for (var p in o)
8732                                         r[p] = o[p]; return r; })(contents_4));
8733                                 }
8734                             }
8735                             else if ( /* size */Object.keys(properties_4).length === 1 && (contents_4 == null || /* size */ Object.keys(contents_4).length === 0)) {
8736                                 this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(properties_4)).next(); return o; })(/* iterator */ (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(properties_4)).next());
8737                             }
8738                             else {
8739                                 this.properties = ((function (o) { var r = {}; for (var p in o)
8740                                     r[p] = o[p]; return r; })(properties_4));
8741                                 if (contents_4 != null) {
8742                                     /* putAll */ (function (m, n) { for (var i in n)
8743                                         m[i] = n[i]; })(this.properties, contents_4);
8744                                 }
8745                             }
8746                             if (modelRotation_4 == null) {
8747                                 this.modelRotation = PieceOfFurniture.IDENTITY_ROTATION_$LI$();
8748                             }
8749                             else {
8750                                 this.modelRotation = CatalogPieceOfFurniture.deepClone(modelRotation_4);
8751                             }
8752                             this.modelFlags = modelFlags_4;
8753                             this.modelSize = modelSize_4;
8754                             this.resizable = resizable_4;
8755                             this.deformable = deformable_4;
8756                             this.texturable = texturable_4;
8757                             this.iconYaw = iconYaw_4;
8758                             this.iconPitch = iconPitch_4;
8759                             this.iconScale = iconScale_4;
8760                             this.proportional = proportional_4;
8761                             this.modifiable = modifiable_11;
8762                         }
8763                         if (this.id === undefined) {
8764                             this.id = null;
8765                         }
8766                         if (this.name === undefined) {
8767                             this.name = null;
8768                         }
8769                         if (this.description === undefined) {
8770                             this.description = null;
8771                         }
8772                         if (this.information === undefined) {
8773                             this.information = null;
8774                         }
8775                         if (this.license === undefined) {
8776                             this.license = null;
8777                         }
8778                         if (this.tags === undefined) {
8779                             this.tags = null;
8780                         }
8781                         if (this.creationDate === undefined) {
8782                             this.creationDate = null;
8783                         }
8784                         if (this.grade === undefined) {
8785                             this.grade = null;
8786                         }
8787                         if (this.icon === undefined) {
8788                             this.icon = null;
8789                         }
8790                         if (this.planIcon === undefined) {
8791                             this.planIcon = null;
8792                         }
8793                         if (this.model === undefined) {
8794                             this.model = null;
8795                         }
8796                         if (this.width === undefined) {
8797                             this.width = 0;
8798                         }
8799                         if (this.depth === undefined) {
8800                             this.depth = 0;
8801                         }
8802                         if (this.height === undefined) {
8803                             this.height = 0;
8804                         }
8805                         if (this.proportional === undefined) {
8806                             this.proportional = false;
8807                         }
8808                         if (this.elevation === undefined) {
8809                             this.elevation = 0;
8810                         }
8811                         if (this.dropOnTopElevation === undefined) {
8812                             this.dropOnTopElevation = 0;
8813                         }
8814                         if (this.movable === undefined) {
8815                             this.movable = false;
8816                         }
8817                         if (this.doorOrWindow === undefined) {
8818                             this.doorOrWindow = false;
8819                         }
8820                         if (this.staircaseCutOutShape === undefined) {
8821                             this.staircaseCutOutShape = null;
8822                         }
8823                         if (this.modelRotation === undefined) {
8824                             this.modelRotation = null;
8825                         }
8826                         if (this.modelFlags === undefined) {
8827                             this.modelFlags = 0;
8828                         }
8829                         if (this.modelSize === undefined) {
8830                             this.modelSize = null;
8831                         }
8832                         if (this.creator === undefined) {
8833                             this.creator = null;
8834                         }
8835                         if (this.color === undefined) {
8836                             this.color = null;
8837                         }
8838                         if (this.iconYaw === undefined) {
8839                             this.iconYaw = 0;
8840                         }
8841                         if (this.iconPitch === undefined) {
8842                             this.iconPitch = 0;
8843                         }
8844                         if (this.iconScale === undefined) {
8845                             this.iconScale = 0;
8846                         }
8847                         if (this.modifiable === undefined) {
8848                             this.modifiable = false;
8849                         }
8850                         if (this.resizable === undefined) {
8851                             this.resizable = false;
8852                         }
8853                         if (this.deformable === undefined) {
8854                             this.deformable = false;
8855                         }
8856                         if (this.texturable === undefined) {
8857                             this.texturable = false;
8858                         }
8859                         if (this.horizontallyRotatable === undefined) {
8860                             this.horizontallyRotatable = false;
8861                         }
8862                         if (this.price === undefined) {
8863                             this.price = null;
8864                         }
8865                         if (this.valueAddedTaxPercentage === undefined) {
8866                             this.valueAddedTaxPercentage = null;
8867                         }
8868                         if (this.currency === undefined) {
8869                             this.currency = null;
8870                         }
8871                         if (this.properties === undefined) {
8872                             this.properties = null;
8873                         }
8874                         if (this.category === undefined) {
8875                             this.category = null;
8876                         }
8877                         if (this.filterCollationKey === undefined) {
8878                             this.filterCollationKey = null;
8879                         }
8880                     }
8881                     if (this.id === undefined) {
8882                         this.id = null;
8883                     }
8884                     if (this.name === undefined) {
8885                         this.name = null;
8886                     }
8887                     if (this.description === undefined) {
8888                         this.description = null;
8889                     }
8890                     if (this.information === undefined) {
8891                         this.information = null;
8892                     }
8893                     if (this.license === undefined) {
8894                         this.license = null;
8895                     }
8896                     if (this.tags === undefined) {
8897                         this.tags = null;
8898                     }
8899                     if (this.creationDate === undefined) {
8900                         this.creationDate = null;
8901                     }
8902                     if (this.grade === undefined) {
8903                         this.grade = null;
8904                     }
8905                     if (this.icon === undefined) {
8906                         this.icon = null;
8907                     }
8908                     if (this.planIcon === undefined) {
8909                         this.planIcon = null;
8910                     }
8911                     if (this.model === undefined) {
8912                         this.model = null;
8913                     }
8914                     if (this.width === undefined) {
8915                         this.width = 0;
8916                     }
8917                     if (this.depth === undefined) {
8918                         this.depth = 0;
8919                     }
8920                     if (this.height === undefined) {
8921                         this.height = 0;
8922                     }
8923                     if (this.proportional === undefined) {
8924                         this.proportional = false;
8925                     }
8926                     if (this.elevation === undefined) {
8927                         this.elevation = 0;
8928                     }
8929                     if (this.dropOnTopElevation === undefined) {
8930                         this.dropOnTopElevation = 0;
8931                     }
8932                     if (this.movable === undefined) {
8933                         this.movable = false;
8934                     }
8935                     if (this.doorOrWindow === undefined) {
8936                         this.doorOrWindow = false;
8937                     }
8938                     if (this.staircaseCutOutShape === undefined) {
8939                         this.staircaseCutOutShape = null;
8940                     }
8941                     if (this.modelRotation === undefined) {
8942                         this.modelRotation = null;
8943                     }
8944                     if (this.modelFlags === undefined) {
8945                         this.modelFlags = 0;
8946                     }
8947                     if (this.modelSize === undefined) {
8948                         this.modelSize = null;
8949                     }
8950                     if (this.creator === undefined) {
8951                         this.creator = null;
8952                     }
8953                     if (this.color === undefined) {
8954                         this.color = null;
8955                     }
8956                     if (this.iconYaw === undefined) {
8957                         this.iconYaw = 0;
8958                     }
8959                     if (this.iconPitch === undefined) {
8960                         this.iconPitch = 0;
8961                     }
8962                     if (this.iconScale === undefined) {
8963                         this.iconScale = 0;
8964                     }
8965                     if (this.modifiable === undefined) {
8966                         this.modifiable = false;
8967                     }
8968                     if (this.resizable === undefined) {
8969                         this.resizable = false;
8970                     }
8971                     if (this.deformable === undefined) {
8972                         this.deformable = false;
8973                     }
8974                     if (this.texturable === undefined) {
8975                         this.texturable = false;
8976                     }
8977                     if (this.horizontallyRotatable === undefined) {
8978                         this.horizontallyRotatable = false;
8979                     }
8980                     if (this.price === undefined) {
8981                         this.price = null;
8982                     }
8983                     if (this.valueAddedTaxPercentage === undefined) {
8984                         this.valueAddedTaxPercentage = null;
8985                     }
8986                     if (this.currency === undefined) {
8987                         this.currency = null;
8988                     }
8989                     if (this.properties === undefined) {
8990                         this.properties = null;
8991                     }
8992                     if (this.category === undefined) {
8993                         this.category = null;
8994                     }
8995                     if (this.filterCollationKey === undefined) {
8996                         this.filterCollationKey = null;
8997                     }
8998                 }
8999                 if (this.id === undefined) {
9000                     this.id = null;
9001                 }
9002                 if (this.name === undefined) {
9003                     this.name = null;
9004                 }
9005                 if (this.description === undefined) {
9006                     this.description = null;
9007                 }
9008                 if (this.information === undefined) {
9009                     this.information = null;
9010                 }
9011                 if (this.license === undefined) {
9012                     this.license = null;
9013                 }
9014                 if (this.tags === undefined) {
9015                     this.tags = null;
9016                 }
9017                 if (this.creationDate === undefined) {
9018                     this.creationDate = null;
9019                 }
9020                 if (this.grade === undefined) {
9021                     this.grade = null;
9022                 }
9023                 if (this.icon === undefined) {
9024                     this.icon = null;
9025                 }
9026                 if (this.planIcon === undefined) {
9027                     this.planIcon = null;
9028                 }
9029                 if (this.model === undefined) {
9030                     this.model = null;
9031                 }
9032                 if (this.width === undefined) {
9033                     this.width = 0;
9034                 }
9035                 if (this.depth === undefined) {
9036                     this.depth = 0;
9037                 }
9038                 if (this.height === undefined) {
9039                     this.height = 0;
9040                 }
9041                 if (this.proportional === undefined) {
9042                     this.proportional = false;
9043                 }
9044                 if (this.elevation === undefined) {
9045                     this.elevation = 0;
9046                 }
9047                 if (this.dropOnTopElevation === undefined) {
9048                     this.dropOnTopElevation = 0;
9049                 }
9050                 if (this.movable === undefined) {
9051                     this.movable = false;
9052                 }
9053                 if (this.doorOrWindow === undefined) {
9054                     this.doorOrWindow = false;
9055                 }
9056                 if (this.staircaseCutOutShape === undefined) {
9057                     this.staircaseCutOutShape = null;
9058                 }
9059                 if (this.modelRotation === undefined) {
9060                     this.modelRotation = null;
9061                 }
9062                 if (this.modelFlags === undefined) {
9063                     this.modelFlags = 0;
9064                 }
9065                 if (this.modelSize === undefined) {
9066                     this.modelSize = null;
9067                 }
9068                 if (this.creator === undefined) {
9069                     this.creator = null;
9070                 }
9071                 if (this.color === undefined) {
9072                     this.color = null;
9073                 }
9074                 if (this.iconYaw === undefined) {
9075                     this.iconYaw = 0;
9076                 }
9077                 if (this.iconPitch === undefined) {
9078                     this.iconPitch = 0;
9079                 }
9080                 if (this.iconScale === undefined) {
9081                     this.iconScale = 0;
9082                 }
9083                 if (this.modifiable === undefined) {
9084                     this.modifiable = false;
9085                 }
9086                 if (this.resizable === undefined) {
9087                     this.resizable = false;
9088                 }
9089                 if (this.deformable === undefined) {
9090                     this.deformable = false;
9091                 }
9092                 if (this.texturable === undefined) {
9093                     this.texturable = false;
9094                 }
9095                 if (this.horizontallyRotatable === undefined) {
9096                     this.horizontallyRotatable = false;
9097                 }
9098                 if (this.price === undefined) {
9099                     this.price = null;
9100                 }
9101                 if (this.valueAddedTaxPercentage === undefined) {
9102                     this.valueAddedTaxPercentage = null;
9103                 }
9104                 if (this.currency === undefined) {
9105                     this.currency = null;
9106                 }
9107                 if (this.properties === undefined) {
9108                     this.properties = null;
9109                 }
9110                 if (this.category === undefined) {
9111                     this.category = null;
9112                 }
9113                 if (this.filterCollationKey === undefined) {
9114                     this.filterCollationKey = null;
9115                 }
9116             }
9117             if (this.id === undefined) {
9118                 this.id = null;
9119             }
9120             if (this.name === undefined) {
9121                 this.name = null;
9122             }
9123             if (this.description === undefined) {
9124                 this.description = null;
9125             }
9126             if (this.information === undefined) {
9127                 this.information = null;
9128             }
9129             if (this.license === undefined) {
9130                 this.license = null;
9131             }
9132             if (this.tags === undefined) {
9133                 this.tags = null;
9134             }
9135             if (this.creationDate === undefined) {
9136                 this.creationDate = null;
9137             }
9138             if (this.grade === undefined) {
9139                 this.grade = null;
9140             }
9141             if (this.icon === undefined) {
9142                 this.icon = null;
9143             }
9144             if (this.planIcon === undefined) {
9145                 this.planIcon = null;
9146             }
9147             if (this.model === undefined) {
9148                 this.model = null;
9149             }
9150             if (this.width === undefined) {
9151                 this.width = 0;
9152             }
9153             if (this.depth === undefined) {
9154                 this.depth = 0;
9155             }
9156             if (this.height === undefined) {
9157                 this.height = 0;
9158             }
9159             if (this.proportional === undefined) {
9160                 this.proportional = false;
9161             }
9162             if (this.elevation === undefined) {
9163                 this.elevation = 0;
9164             }
9165             if (this.dropOnTopElevation === undefined) {
9166                 this.dropOnTopElevation = 0;
9167             }
9168             if (this.movable === undefined) {
9169                 this.movable = false;
9170             }
9171             if (this.doorOrWindow === undefined) {
9172                 this.doorOrWindow = false;
9173             }
9174             if (this.staircaseCutOutShape === undefined) {
9175                 this.staircaseCutOutShape = null;
9176             }
9177             if (this.modelRotation === undefined) {
9178                 this.modelRotation = null;
9179             }
9180             if (this.modelFlags === undefined) {
9181                 this.modelFlags = 0;
9182             }
9183             if (this.modelSize === undefined) {
9184                 this.modelSize = null;
9185             }
9186             if (this.creator === undefined) {
9187                 this.creator = null;
9188             }
9189             if (this.color === undefined) {
9190                 this.color = null;
9191             }
9192             if (this.iconYaw === undefined) {
9193                 this.iconYaw = 0;
9194             }
9195             if (this.iconPitch === undefined) {
9196                 this.iconPitch = 0;
9197             }
9198             if (this.iconScale === undefined) {
9199                 this.iconScale = 0;
9200             }
9201             if (this.modifiable === undefined) {
9202                 this.modifiable = false;
9203             }
9204             if (this.resizable === undefined) {
9205                 this.resizable = false;
9206             }
9207             if (this.deformable === undefined) {
9208                 this.deformable = false;
9209             }
9210             if (this.texturable === undefined) {
9211                 this.texturable = false;
9212             }
9213             if (this.horizontallyRotatable === undefined) {
9214                 this.horizontallyRotatable = false;
9215             }
9216             if (this.price === undefined) {
9217                 this.price = null;
9218             }
9219             if (this.valueAddedTaxPercentage === undefined) {
9220                 this.valueAddedTaxPercentage = null;
9221             }
9222             if (this.currency === undefined) {
9223                 this.currency = null;
9224             }
9225             if (this.properties === undefined) {
9226                 this.properties = null;
9227             }
9228             if (this.category === undefined) {
9229                 this.category = null;
9230             }
9231             if (this.filterCollationKey === undefined) {
9232                 this.filterCollationKey = null;
9233             }
9234         }
9235         else if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((typeof information === 'string') || information === null) && ((license != null && license instanceof Array && (license.length == 0 || license[0] == null || (typeof license[0] === 'string'))) || license === null) && ((typeof tags === 'number') || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((grade != null && (grade.constructor != null && grade.constructor["__interfaces"] != null && grade.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || grade === null) && ((icon != null && (icon.constructor != null && icon.constructor["__interfaces"] != null && icon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || icon === null) && ((planIcon != null && (planIcon.constructor != null && planIcon.constructor["__interfaces"] != null && planIcon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || planIcon === null) && ((typeof model === 'number') || model === null) && ((typeof width === 'number') || width === null) && ((typeof depth === 'number') || depth === null) && ((typeof height === 'number') || height === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof dropOnTopElevation === 'boolean') || dropOnTopElevation === null) && ((typeof movable === 'string') || movable === null) && ((doorOrWindow != null && doorOrWindow instanceof Array && (doorOrWindow.length == 0 || doorOrWindow[0] == null || doorOrWindow[0] instanceof Array)) || doorOrWindow === null) && ((typeof staircaseCutOutShape === 'boolean') || staircaseCutOutShape === null) && ((typeof color === 'string') || color === null) && ((typeof modelRotation === 'boolean') || modelRotation === null) && ((typeof modelFlags === 'boolean') || modelFlags === null) && ((typeof modelSize === 'boolean') || modelSize === null) && ((creator != null && creator instanceof Big) || creator === null) && ((resizable != null && resizable instanceof Big) || resizable === null) && ((typeof deformable === 'string') || deformable === null) && texturable === undefined && horizontallyRotatable === undefined && price === undefined && valueAddedTaxPercentage === undefined && currency === undefined && properties === undefined && contents === undefined && iconYaw === undefined && iconPitch === undefined && iconScale === undefined && proportional === undefined && modifiable === undefined) {
9236             var __args = arguments;
9237             var tags_4 = __args[4];
9238             var creationDate_4 = __args[5];
9239             var grade_4 = __args[6];
9240             var icon_4 = __args[7];
9241             var planIcon_4 = __args[8];
9242             var model_4 = __args[9];
9243             var width_6 = __args[10];
9244             var depth_4 = __args[11];
9245             var height_7 = __args[12];
9246             var elevation_4 = __args[13];
9247             var dropOnTopElevation_4 = __args[14];
9248             var movable_4 = __args[15];
9249             var staircaseCutOutShape_5 = __args[16];
9250             var modelRotation_5 = __args[17];
9251             var backFaceShown = __args[18];
9252             var creator_7 = __args[19];
9253             var resizable_5 = __args[20];
9254             var deformable_5 = __args[21];
9255             var texturable_5 = __args[22];
9256             var price_5 = __args[23];
9257             var valueAddedTaxPercentage_5 = __args[24];
9258             var currency_5 = __args[25];
9259             {
9260                 var __args_50 = arguments;
9261                 var modelSize_5 = null;
9262                 var horizontallyRotatable_5 = true;
9263                 {
9264                     var __args_51 = arguments;
9265                     var properties_5 = null;
9266                     {
9267                         var __args_52 = arguments;
9268                         var modelFlags_5 = backFaceShown ? PieceOfFurniture.SHOW_BACK_FACE : 0;
9269                         {
9270                             var __args_53 = arguments;
9271                             var license_4 = null;
9272                             var contents_5 = null;
9273                             {
9274                                 var __args_54 = arguments;
9275                                 var doorOrWindow_5 = false;
9276                                 var color_5 = null;
9277                                 var iconYaw_5 = Math.PI / 8;
9278                                 var iconPitch_5 = 0;
9279                                 var iconScale_5 = 1;
9280                                 var proportional_5 = true;
9281                                 var modifiable_12 = false;
9282                                 if (this.id === undefined) {
9283                                     this.id = null;
9284                                 }
9285                                 if (this.name === undefined) {
9286                                     this.name = null;
9287                                 }
9288                                 if (this.description === undefined) {
9289                                     this.description = null;
9290                                 }
9291                                 if (this.information === undefined) {
9292                                     this.information = null;
9293                                 }
9294                                 if (this.license === undefined) {
9295                                     this.license = null;
9296                                 }
9297                                 if (this.tags === undefined) {
9298                                     this.tags = null;
9299                                 }
9300                                 if (this.creationDate === undefined) {
9301                                     this.creationDate = null;
9302                                 }
9303                                 if (this.grade === undefined) {
9304                                     this.grade = null;
9305                                 }
9306                                 if (this.icon === undefined) {
9307                                     this.icon = null;
9308                                 }
9309                                 if (this.planIcon === undefined) {
9310                                     this.planIcon = null;
9311                                 }
9312                                 if (this.model === undefined) {
9313                                     this.model = null;
9314                                 }
9315                                 if (this.width === undefined) {
9316                                     this.width = 0;
9317                                 }
9318                                 if (this.depth === undefined) {
9319                                     this.depth = 0;
9320                                 }
9321                                 if (this.height === undefined) {
9322                                     this.height = 0;
9323                                 }
9324                                 if (this.proportional === undefined) {
9325                                     this.proportional = false;
9326                                 }
9327                                 if (this.elevation === undefined) {
9328                                     this.elevation = 0;
9329                                 }
9330                                 if (this.dropOnTopElevation === undefined) {
9331                                     this.dropOnTopElevation = 0;
9332                                 }
9333                                 if (this.movable === undefined) {
9334                                     this.movable = false;
9335                                 }
9336                                 if (this.doorOrWindow === undefined) {
9337                                     this.doorOrWindow = false;
9338                                 }
9339                                 if (this.staircaseCutOutShape === undefined) {
9340                                     this.staircaseCutOutShape = null;
9341                                 }
9342                                 if (this.modelRotation === undefined) {
9343                                     this.modelRotation = null;
9344                                 }
9345                                 if (this.modelFlags === undefined) {
9346                                     this.modelFlags = 0;
9347                                 }
9348                                 if (this.modelSize === undefined) {
9349                                     this.modelSize = null;
9350                                 }
9351                                 if (this.creator === undefined) {
9352                                     this.creator = null;
9353                                 }
9354                                 if (this.color === undefined) {
9355                                     this.color = null;
9356                                 }
9357                                 if (this.iconYaw === undefined) {
9358                                     this.iconYaw = 0;
9359                                 }
9360                                 if (this.iconPitch === undefined) {
9361                                     this.iconPitch = 0;
9362                                 }
9363                                 if (this.iconScale === undefined) {
9364                                     this.iconScale = 0;
9365                                 }
9366                                 if (this.modifiable === undefined) {
9367                                     this.modifiable = false;
9368                                 }
9369                                 if (this.resizable === undefined) {
9370                                     this.resizable = false;
9371                                 }
9372                                 if (this.deformable === undefined) {
9373                                     this.deformable = false;
9374                                 }
9375                                 if (this.texturable === undefined) {
9376                                     this.texturable = false;
9377                                 }
9378                                 if (this.horizontallyRotatable === undefined) {
9379                                     this.horizontallyRotatable = false;
9380                                 }
9381                                 if (this.price === undefined) {
9382                                     this.price = null;
9383                                 }
9384                                 if (this.valueAddedTaxPercentage === undefined) {
9385                                     this.valueAddedTaxPercentage = null;
9386                                 }
9387                                 if (this.currency === undefined) {
9388                                     this.currency = null;
9389                                 }
9390                                 if (this.properties === undefined) {
9391                                     this.properties = null;
9392                                 }
9393                                 if (this.category === undefined) {
9394                                     this.category = null;
9395                                 }
9396                                 if (this.filterCollationKey === undefined) {
9397                                     this.filterCollationKey = null;
9398                                 }
9399                                 this.id = id;
9400                                 this.name = name;
9401                                 this.description = description;
9402                                 this.information = information;
9403                                 this.license = license_4;
9404                                 this.tags = tags_4;
9405                                 this.creationDate = creationDate_4;
9406                                 this.grade = grade_4;
9407                                 this.icon = icon_4;
9408                                 this.planIcon = planIcon_4;
9409                                 this.model = model_4;
9410                                 this.width = width_6;
9411                                 this.depth = depth_4;
9412                                 this.height = height_7;
9413                                 this.elevation = elevation_4;
9414                                 this.dropOnTopElevation = dropOnTopElevation_4;
9415                                 this.movable = movable_4;
9416                                 this.doorOrWindow = doorOrWindow_5;
9417                                 this.color = color_5;
9418                                 this.staircaseCutOutShape = staircaseCutOutShape_5;
9419                                 this.creator = creator_7;
9420                                 this.horizontallyRotatable = horizontallyRotatable_5;
9421                                 this.price = price_5;
9422                                 this.valueAddedTaxPercentage = valueAddedTaxPercentage_5;
9423                                 this.currency = currency_5;
9424                                 if (properties_5 == null || /* size */ Object.keys(properties_5).length === 0) {
9425                                     if (contents_5 == null || /* size */ Object.keys(contents_5).length === 0) {
9426                                         this.properties = /* emptyMap */ {};
9427                                     }
9428                                     else if ( /* size */Object.keys(contents_5).length === 1) {
9429                                         this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(contents_5)).next(); return o; })(/* iterator */ (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(contents_5)).next());
9430                                     }
9431                                     else {
9432                                         this.properties = ((function (o) { var r = {}; for (var p in o)
9433                                             r[p] = o[p]; return r; })(contents_5));
9434                                     }
9435                                 }
9436                                 else if ( /* size */Object.keys(properties_5).length === 1 && (contents_5 == null || /* size */ Object.keys(contents_5).length === 0)) {
9437                                     this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(properties_5)).next(); return o; })(/* iterator */ (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(properties_5)).next());
9438                                 }
9439                                 else {
9440                                     this.properties = ((function (o) { var r = {}; for (var p in o)
9441                                         r[p] = o[p]; return r; })(properties_5));
9442                                     if (contents_5 != null) {
9443                                         /* putAll */ (function (m, n) { for (var i in n)
9444                                             m[i] = n[i]; })(this.properties, contents_5);
9445                                     }
9446                                 }
9447                                 if (modelRotation_5 == null) {
9448                                     this.modelRotation = PieceOfFurniture.IDENTITY_ROTATION_$LI$();
9449                                 }
9450                                 else {
9451                                     this.modelRotation = CatalogPieceOfFurniture.deepClone(modelRotation_5);
9452                                 }
9453                                 this.modelFlags = modelFlags_5;
9454                                 this.modelSize = modelSize_5;
9455                                 this.resizable = resizable_5;
9456                                 this.deformable = deformable_5;
9457                                 this.texturable = texturable_5;
9458                                 this.iconYaw = iconYaw_5;
9459                                 this.iconPitch = iconPitch_5;
9460                                 this.iconScale = iconScale_5;
9461                                 this.proportional = proportional_5;
9462                                 this.modifiable = modifiable_12;
9463                             }
9464                             if (this.id === undefined) {
9465                                 this.id = null;
9466                             }
9467                             if (this.name === undefined) {
9468                                 this.name = null;
9469                             }
9470                             if (this.description === undefined) {
9471                                 this.description = null;
9472                             }
9473                             if (this.information === undefined) {
9474                                 this.information = null;
9475                             }
9476                             if (this.license === undefined) {
9477                                 this.license = null;
9478                             }
9479                             if (this.tags === undefined) {
9480                                 this.tags = null;
9481                             }
9482                             if (this.creationDate === undefined) {
9483                                 this.creationDate = null;
9484                             }
9485                             if (this.grade === undefined) {
9486                                 this.grade = null;
9487                             }
9488                             if (this.icon === undefined) {
9489                                 this.icon = null;
9490                             }
9491                             if (this.planIcon === undefined) {
9492                                 this.planIcon = null;
9493                             }
9494                             if (this.model === undefined) {
9495                                 this.model = null;
9496                             }
9497                             if (this.width === undefined) {
9498                                 this.width = 0;
9499                             }
9500                             if (this.depth === undefined) {
9501                                 this.depth = 0;
9502                             }
9503                             if (this.height === undefined) {
9504                                 this.height = 0;
9505                             }
9506                             if (this.proportional === undefined) {
9507                                 this.proportional = false;
9508                             }
9509                             if (this.elevation === undefined) {
9510                                 this.elevation = 0;
9511                             }
9512                             if (this.dropOnTopElevation === undefined) {
9513                                 this.dropOnTopElevation = 0;
9514                             }
9515                             if (this.movable === undefined) {
9516                                 this.movable = false;
9517                             }
9518                             if (this.doorOrWindow === undefined) {
9519                                 this.doorOrWindow = false;
9520                             }
9521                             if (this.staircaseCutOutShape === undefined) {
9522                                 this.staircaseCutOutShape = null;
9523                             }
9524                             if (this.modelRotation === undefined) {
9525                                 this.modelRotation = null;
9526                             }
9527                             if (this.modelFlags === undefined) {
9528                                 this.modelFlags = 0;
9529                             }
9530                             if (this.modelSize === undefined) {
9531                                 this.modelSize = null;
9532                             }
9533                             if (this.creator === undefined) {
9534                                 this.creator = null;
9535                             }
9536                             if (this.color === undefined) {
9537                                 this.color = null;
9538                             }
9539                             if (this.iconYaw === undefined) {
9540                                 this.iconYaw = 0;
9541                             }
9542                             if (this.iconPitch === undefined) {
9543                                 this.iconPitch = 0;
9544                             }
9545                             if (this.iconScale === undefined) {
9546                                 this.iconScale = 0;
9547                             }
9548                             if (this.modifiable === undefined) {
9549                                 this.modifiable = false;
9550                             }
9551                             if (this.resizable === undefined) {
9552                                 this.resizable = false;
9553                             }
9554                             if (this.deformable === undefined) {
9555                                 this.deformable = false;
9556                             }
9557                             if (this.texturable === undefined) {
9558                                 this.texturable = false;
9559                             }
9560                             if (this.horizontallyRotatable === undefined) {
9561                                 this.horizontallyRotatable = false;
9562                             }
9563                             if (this.price === undefined) {
9564                                 this.price = null;
9565                             }
9566                             if (this.valueAddedTaxPercentage === undefined) {
9567                                 this.valueAddedTaxPercentage = null;
9568                             }
9569                             if (this.currency === undefined) {
9570                                 this.currency = null;
9571                             }
9572                             if (this.properties === undefined) {
9573                                 this.properties = null;
9574                             }
9575                             if (this.category === undefined) {
9576                                 this.category = null;
9577                             }
9578                             if (this.filterCollationKey === undefined) {
9579                                 this.filterCollationKey = null;
9580                             }
9581                         }
9582                         if (this.id === undefined) {
9583                             this.id = null;
9584                         }
9585                         if (this.name === undefined) {
9586                             this.name = null;
9587                         }
9588                         if (this.description === undefined) {
9589                             this.description = null;
9590                         }
9591                         if (this.information === undefined) {
9592                             this.information = null;
9593                         }
9594                         if (this.license === undefined) {
9595                             this.license = null;
9596                         }
9597                         if (this.tags === undefined) {
9598                             this.tags = null;
9599                         }
9600                         if (this.creationDate === undefined) {
9601                             this.creationDate = null;
9602                         }
9603                         if (this.grade === undefined) {
9604                             this.grade = null;
9605                         }
9606                         if (this.icon === undefined) {
9607                             this.icon = null;
9608                         }
9609                         if (this.planIcon === undefined) {
9610                             this.planIcon = null;
9611                         }
9612                         if (this.model === undefined) {
9613                             this.model = null;
9614                         }
9615                         if (this.width === undefined) {
9616                             this.width = 0;
9617                         }
9618                         if (this.depth === undefined) {
9619                             this.depth = 0;
9620                         }
9621                         if (this.height === undefined) {
9622                             this.height = 0;
9623                         }
9624                         if (this.proportional === undefined) {
9625                             this.proportional = false;
9626                         }
9627                         if (this.elevation === undefined) {
9628                             this.elevation = 0;
9629                         }
9630                         if (this.dropOnTopElevation === undefined) {
9631                             this.dropOnTopElevation = 0;
9632                         }
9633                         if (this.movable === undefined) {
9634                             this.movable = false;
9635                         }
9636                         if (this.doorOrWindow === undefined) {
9637                             this.doorOrWindow = false;
9638                         }
9639                         if (this.staircaseCutOutShape === undefined) {
9640                             this.staircaseCutOutShape = null;
9641                         }
9642                         if (this.modelRotation === undefined) {
9643                             this.modelRotation = null;
9644                         }
9645                         if (this.modelFlags === undefined) {
9646                             this.modelFlags = 0;
9647                         }
9648                         if (this.modelSize === undefined) {
9649                             this.modelSize = null;
9650                         }
9651                         if (this.creator === undefined) {
9652                             this.creator = null;
9653                         }
9654                         if (this.color === undefined) {
9655                             this.color = null;
9656                         }
9657                         if (this.iconYaw === undefined) {
9658                             this.iconYaw = 0;
9659                         }
9660                         if (this.iconPitch === undefined) {
9661                             this.iconPitch = 0;
9662                         }
9663                         if (this.iconScale === undefined) {
9664                             this.iconScale = 0;
9665                         }
9666                         if (this.modifiable === undefined) {
9667                             this.modifiable = false;
9668                         }
9669                         if (this.resizable === undefined) {
9670                             this.resizable = false;
9671                         }
9672                         if (this.deformable === undefined) {
9673                             this.deformable = false;
9674                         }
9675                         if (this.texturable === undefined) {
9676                             this.texturable = false;
9677                         }
9678                         if (this.horizontallyRotatable === undefined) {
9679                             this.horizontallyRotatable = false;
9680                         }
9681                         if (this.price === undefined) {
9682                             this.price = null;
9683                         }
9684                         if (this.valueAddedTaxPercentage === undefined) {
9685                             this.valueAddedTaxPercentage = null;
9686                         }
9687                         if (this.currency === undefined) {
9688                             this.currency = null;
9689                         }
9690                         if (this.properties === undefined) {
9691                             this.properties = null;
9692                         }
9693                         if (this.category === undefined) {
9694                             this.category = null;
9695                         }
9696                         if (this.filterCollationKey === undefined) {
9697                             this.filterCollationKey = null;
9698                         }
9699                     }
9700                     if (this.id === undefined) {
9701                         this.id = null;
9702                     }
9703                     if (this.name === undefined) {
9704                         this.name = null;
9705                     }
9706                     if (this.description === undefined) {
9707                         this.description = null;
9708                     }
9709                     if (this.information === undefined) {
9710                         this.information = null;
9711                     }
9712                     if (this.license === undefined) {
9713                         this.license = null;
9714                     }
9715                     if (this.tags === undefined) {
9716                         this.tags = null;
9717                     }
9718                     if (this.creationDate === undefined) {
9719                         this.creationDate = null;
9720                     }
9721                     if (this.grade === undefined) {
9722                         this.grade = null;
9723                     }
9724                     if (this.icon === undefined) {
9725                         this.icon = null;
9726                     }
9727                     if (this.planIcon === undefined) {
9728                         this.planIcon = null;
9729                     }
9730                     if (this.model === undefined) {
9731                         this.model = null;
9732                     }
9733                     if (this.width === undefined) {
9734                         this.width = 0;
9735                     }
9736                     if (this.depth === undefined) {
9737                         this.depth = 0;
9738                     }
9739                     if (this.height === undefined) {
9740                         this.height = 0;
9741                     }
9742                     if (this.proportional === undefined) {
9743                         this.proportional = false;
9744                     }
9745                     if (this.elevation === undefined) {
9746                         this.elevation = 0;
9747                     }
9748                     if (this.dropOnTopElevation === undefined) {
9749                         this.dropOnTopElevation = 0;
9750                     }
9751                     if (this.movable === undefined) {
9752                         this.movable = false;
9753                     }
9754                     if (this.doorOrWindow === undefined) {
9755                         this.doorOrWindow = false;
9756                     }
9757                     if (this.staircaseCutOutShape === undefined) {
9758                         this.staircaseCutOutShape = null;
9759                     }
9760                     if (this.modelRotation === undefined) {
9761                         this.modelRotation = null;
9762                     }
9763                     if (this.modelFlags === undefined) {
9764                         this.modelFlags = 0;
9765                     }
9766                     if (this.modelSize === undefined) {
9767                         this.modelSize = null;
9768                     }
9769                     if (this.creator === undefined) {
9770                         this.creator = null;
9771                     }
9772                     if (this.color === undefined) {
9773                         this.color = null;
9774                     }
9775                     if (this.iconYaw === undefined) {
9776                         this.iconYaw = 0;
9777                     }
9778                     if (this.iconPitch === undefined) {
9779                         this.iconPitch = 0;
9780                     }
9781                     if (this.iconScale === undefined) {
9782                         this.iconScale = 0;
9783                     }
9784                     if (this.modifiable === undefined) {
9785                         this.modifiable = false;
9786                     }
9787                     if (this.resizable === undefined) {
9788                         this.resizable = false;
9789                     }
9790                     if (this.deformable === undefined) {
9791                         this.deformable = false;
9792                     }
9793                     if (this.texturable === undefined) {
9794                         this.texturable = false;
9795                     }
9796                     if (this.horizontallyRotatable === undefined) {
9797                         this.horizontallyRotatable = false;
9798                     }
9799                     if (this.price === undefined) {
9800                         this.price = null;
9801                     }
9802                     if (this.valueAddedTaxPercentage === undefined) {
9803                         this.valueAddedTaxPercentage = null;
9804                     }
9805                     if (this.currency === undefined) {
9806                         this.currency = null;
9807                     }
9808                     if (this.properties === undefined) {
9809                         this.properties = null;
9810                     }
9811                     if (this.category === undefined) {
9812                         this.category = null;
9813                     }
9814                     if (this.filterCollationKey === undefined) {
9815                         this.filterCollationKey = null;
9816                     }
9817                 }
9818                 if (this.id === undefined) {
9819                     this.id = null;
9820                 }
9821                 if (this.name === undefined) {
9822                     this.name = null;
9823                 }
9824                 if (this.description === undefined) {
9825                     this.description = null;
9826                 }
9827                 if (this.information === undefined) {
9828                     this.information = null;
9829                 }
9830                 if (this.license === undefined) {
9831                     this.license = null;
9832                 }
9833                 if (this.tags === undefined) {
9834                     this.tags = null;
9835                 }
9836                 if (this.creationDate === undefined) {
9837                     this.creationDate = null;
9838                 }
9839                 if (this.grade === undefined) {
9840                     this.grade = null;
9841                 }
9842                 if (this.icon === undefined) {
9843                     this.icon = null;
9844                 }
9845                 if (this.planIcon === undefined) {
9846                     this.planIcon = null;
9847                 }
9848                 if (this.model === undefined) {
9849                     this.model = null;
9850                 }
9851                 if (this.width === undefined) {
9852                     this.width = 0;
9853                 }
9854                 if (this.depth === undefined) {
9855                     this.depth = 0;
9856                 }
9857                 if (this.height === undefined) {
9858                     this.height = 0;
9859                 }
9860                 if (this.proportional === undefined) {
9861                     this.proportional = false;
9862                 }
9863                 if (this.elevation === undefined) {
9864                     this.elevation = 0;
9865                 }
9866                 if (this.dropOnTopElevation === undefined) {
9867                     this.dropOnTopElevation = 0;
9868                 }
9869                 if (this.movable === undefined) {
9870                     this.movable = false;
9871                 }
9872                 if (this.doorOrWindow === undefined) {
9873                     this.doorOrWindow = false;
9874                 }
9875                 if (this.staircaseCutOutShape === undefined) {
9876                     this.staircaseCutOutShape = null;
9877                 }
9878                 if (this.modelRotation === undefined) {
9879                     this.modelRotation = null;
9880                 }
9881                 if (this.modelFlags === undefined) {
9882                     this.modelFlags = 0;
9883                 }
9884                 if (this.modelSize === undefined) {
9885                     this.modelSize = null;
9886                 }
9887                 if (this.creator === undefined) {
9888                     this.creator = null;
9889                 }
9890                 if (this.color === undefined) {
9891                     this.color = null;
9892                 }
9893                 if (this.iconYaw === undefined) {
9894                     this.iconYaw = 0;
9895                 }
9896                 if (this.iconPitch === undefined) {
9897                     this.iconPitch = 0;
9898                 }
9899                 if (this.iconScale === undefined) {
9900                     this.iconScale = 0;
9901                 }
9902                 if (this.modifiable === undefined) {
9903                     this.modifiable = false;
9904                 }
9905                 if (this.resizable === undefined) {
9906                     this.resizable = false;
9907                 }
9908                 if (this.deformable === undefined) {
9909                     this.deformable = false;
9910                 }
9911                 if (this.texturable === undefined) {
9912                     this.texturable = false;
9913                 }
9914                 if (this.horizontallyRotatable === undefined) {
9915                     this.horizontallyRotatable = false;
9916                 }
9917                 if (this.price === undefined) {
9918                     this.price = null;
9919                 }
9920                 if (this.valueAddedTaxPercentage === undefined) {
9921                     this.valueAddedTaxPercentage = null;
9922                 }
9923                 if (this.currency === undefined) {
9924                     this.currency = null;
9925                 }
9926                 if (this.properties === undefined) {
9927                     this.properties = null;
9928                 }
9929                 if (this.category === undefined) {
9930                     this.category = null;
9931                 }
9932                 if (this.filterCollationKey === undefined) {
9933                     this.filterCollationKey = null;
9934                 }
9935             }
9936             if (this.id === undefined) {
9937                 this.id = null;
9938             }
9939             if (this.name === undefined) {
9940                 this.name = null;
9941             }
9942             if (this.description === undefined) {
9943                 this.description = null;
9944             }
9945             if (this.information === undefined) {
9946                 this.information = null;
9947             }
9948             if (this.license === undefined) {
9949                 this.license = null;
9950             }
9951             if (this.tags === undefined) {
9952                 this.tags = null;
9953             }
9954             if (this.creationDate === undefined) {
9955                 this.creationDate = null;
9956             }
9957             if (this.grade === undefined) {
9958                 this.grade = null;
9959             }
9960             if (this.icon === undefined) {
9961                 this.icon = null;
9962             }
9963             if (this.planIcon === undefined) {
9964                 this.planIcon = null;
9965             }
9966             if (this.model === undefined) {
9967                 this.model = null;
9968             }
9969             if (this.width === undefined) {
9970                 this.width = 0;
9971             }
9972             if (this.depth === undefined) {
9973                 this.depth = 0;
9974             }
9975             if (this.height === undefined) {
9976                 this.height = 0;
9977             }
9978             if (this.proportional === undefined) {
9979                 this.proportional = false;
9980             }
9981             if (this.elevation === undefined) {
9982                 this.elevation = 0;
9983             }
9984             if (this.dropOnTopElevation === undefined) {
9985                 this.dropOnTopElevation = 0;
9986             }
9987             if (this.movable === undefined) {
9988                 this.movable = false;
9989             }
9990             if (this.doorOrWindow === undefined) {
9991                 this.doorOrWindow = false;
9992             }
9993             if (this.staircaseCutOutShape === undefined) {
9994                 this.staircaseCutOutShape = null;
9995             }
9996             if (this.modelRotation === undefined) {
9997                 this.modelRotation = null;
9998             }
9999             if (this.modelFlags === undefined) {
10000                 this.modelFlags = 0;
10001             }
10002             if (this.modelSize === undefined) {
10003                 this.modelSize = null;
10004             }
10005             if (this.creator === undefined) {
10006                 this.creator = null;
10007             }
10008             if (this.color === undefined) {
10009                 this.color = null;
10010             }
10011             if (this.iconYaw === undefined) {
10012                 this.iconYaw = 0;
10013             }
10014             if (this.iconPitch === undefined) {
10015                 this.iconPitch = 0;
10016             }
10017             if (this.iconScale === undefined) {
10018                 this.iconScale = 0;
10019             }
10020             if (this.modifiable === undefined) {
10021                 this.modifiable = false;
10022             }
10023             if (this.resizable === undefined) {
10024                 this.resizable = false;
10025             }
10026             if (this.deformable === undefined) {
10027                 this.deformable = false;
10028             }
10029             if (this.texturable === undefined) {
10030                 this.texturable = false;
10031             }
10032             if (this.horizontallyRotatable === undefined) {
10033                 this.horizontallyRotatable = false;
10034             }
10035             if (this.price === undefined) {
10036                 this.price = null;
10037             }
10038             if (this.valueAddedTaxPercentage === undefined) {
10039                 this.valueAddedTaxPercentage = null;
10040             }
10041             if (this.currency === undefined) {
10042                 this.currency = null;
10043             }
10044             if (this.properties === undefined) {
10045                 this.properties = null;
10046             }
10047             if (this.category === undefined) {
10048                 this.category = null;
10049             }
10050             if (this.filterCollationKey === undefined) {
10051                 this.filterCollationKey = null;
10052             }
10053         }
10054         else if (((typeof id === 'string') || id === null) && ((name != null && (name.constructor != null && name.constructor["__interfaces"] != null && name.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || name === null) && ((description != null && (description.constructor != null && description.constructor["__interfaces"] != null && description.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || description === null) && ((typeof information === 'number') || information === null) && ((typeof license === 'number') || license === null) && ((typeof tags === 'number') || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((typeof grade === 'boolean') || grade === null) && ((typeof icon === 'string') || icon === null) && ((typeof planIcon === 'number') || planIcon === null) && ((model != null && model instanceof Array && (model.length == 0 || model[0] == null || model[0] instanceof Array)) || model === null) && ((typeof width === 'number') || width === null) && ((typeof depth === 'number') || depth === null) && ((typeof height === 'string') || height === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof dropOnTopElevation === 'number') || dropOnTopElevation === null) && ((typeof movable === 'number') || movable === null) && ((typeof doorOrWindow === 'boolean') || doorOrWindow === null) && staircaseCutOutShape === undefined && color === undefined && modelRotation === undefined && modelFlags === undefined && modelSize === undefined && creator === undefined && resizable === undefined && deformable === undefined && texturable === undefined && horizontallyRotatable === undefined && price === undefined && valueAddedTaxPercentage === undefined && currency === undefined && properties === undefined && contents === undefined && iconYaw === undefined && iconPitch === undefined && iconScale === undefined && proportional === undefined && modifiable === undefined) {
10055             var __args = arguments;
10056             var name_3 = __args[0];
10057             var icon_5 = __args[1];
10058             var model_5 = __args[2];
10059             var width_7 = __args[3];
10060             var depth_5 = __args[4];
10061             var height_8 = __args[5];
10062             var elevation_5 = __args[6];
10063             var movable_5 = __args[7];
10064             var staircaseCutOutShape_6 = __args[8];
10065             var color_6 = __args[9];
10066             var modelRotation_6 = __args[10];
10067             var modelFlags_6 = __args[11];
10068             var modelSize_6 = __args[12];
10069             var creator_8 = __args[13];
10070             var iconYaw_6 = __args[14];
10071             var iconPitch_6 = __args[15];
10072             var iconScale_6 = __args[16];
10073             var proportional_6 = __args[17];
10074             {
10075                 var __args_55 = arguments;
10076                 var id_4 = null;
10077                 var description_1 = null;
10078                 var information_1 = null;
10079                 var license_5 = null;
10080                 var tags_5 = [];
10081                 var creationDate_5 = Date.now();
10082                 var grade_5 = null;
10083                 var planIcon_5 = null;
10084                 var dropOnTopElevation_5 = 1.0;
10085                 var doorOrWindow_6 = false;
10086                 var resizable_6 = true;
10087                 var deformable_6 = true;
10088                 var texturable_6 = true;
10089                 var horizontallyRotatable_6 = true;
10090                 var price_6 = null;
10091                 var valueAddedTaxPercentage_6 = null;
10092                 var currency_6 = null;
10093                 var properties_6 = null;
10094                 var contents_6 = null;
10095                 var modifiable_13 = true;
10096                 if (this.id === undefined) {
10097                     this.id = null;
10098                 }
10099                 if (this.name === undefined) {
10100                     this.name = null;
10101                 }
10102                 if (this.description === undefined) {
10103                     this.description = null;
10104                 }
10105                 if (this.information === undefined) {
10106                     this.information = null;
10107                 }
10108                 if (this.license === undefined) {
10109                     this.license = null;
10110                 }
10111                 if (this.tags === undefined) {
10112                     this.tags = null;
10113                 }
10114                 if (this.creationDate === undefined) {
10115                     this.creationDate = null;
10116                 }
10117                 if (this.grade === undefined) {
10118                     this.grade = null;
10119                 }
10120                 if (this.icon === undefined) {
10121                     this.icon = null;
10122                 }
10123                 if (this.planIcon === undefined) {
10124                     this.planIcon = null;
10125                 }
10126                 if (this.model === undefined) {
10127                     this.model = null;
10128                 }
10129                 if (this.width === undefined) {
10130                     this.width = 0;
10131                 }
10132                 if (this.depth === undefined) {
10133                     this.depth = 0;
10134                 }
10135                 if (this.height === undefined) {
10136                     this.height = 0;
10137                 }
10138                 if (this.proportional === undefined) {
10139                     this.proportional = false;
10140                 }
10141                 if (this.elevation === undefined) {
10142                     this.elevation = 0;
10143                 }
10144                 if (this.dropOnTopElevation === undefined) {
10145                     this.dropOnTopElevation = 0;
10146                 }
10147                 if (this.movable === undefined) {
10148                     this.movable = false;
10149                 }
10150                 if (this.doorOrWindow === undefined) {
10151                     this.doorOrWindow = false;
10152                 }
10153                 if (this.staircaseCutOutShape === undefined) {
10154                     this.staircaseCutOutShape = null;
10155                 }
10156                 if (this.modelRotation === undefined) {
10157                     this.modelRotation = null;
10158                 }
10159                 if (this.modelFlags === undefined) {
10160                     this.modelFlags = 0;
10161                 }
10162                 if (this.modelSize === undefined) {
10163                     this.modelSize = null;
10164                 }
10165                 if (this.creator === undefined) {
10166                     this.creator = null;
10167                 }
10168                 if (this.color === undefined) {
10169                     this.color = null;
10170                 }
10171                 if (this.iconYaw === undefined) {
10172                     this.iconYaw = 0;
10173                 }
10174                 if (this.iconPitch === undefined) {
10175                     this.iconPitch = 0;
10176                 }
10177                 if (this.iconScale === undefined) {
10178                     this.iconScale = 0;
10179                 }
10180                 if (this.modifiable === undefined) {
10181                     this.modifiable = false;
10182                 }
10183                 if (this.resizable === undefined) {
10184                     this.resizable = false;
10185                 }
10186                 if (this.deformable === undefined) {
10187                     this.deformable = false;
10188                 }
10189                 if (this.texturable === undefined) {
10190                     this.texturable = false;
10191                 }
10192                 if (this.horizontallyRotatable === undefined) {
10193                     this.horizontallyRotatable = false;
10194                 }
10195                 if (this.price === undefined) {
10196                     this.price = null;
10197                 }
10198                 if (this.valueAddedTaxPercentage === undefined) {
10199                     this.valueAddedTaxPercentage = null;
10200                 }
10201                 if (this.currency === undefined) {
10202                     this.currency = null;
10203                 }
10204                 if (this.properties === undefined) {
10205                     this.properties = null;
10206                 }
10207                 if (this.category === undefined) {
10208                     this.category = null;
10209                 }
10210                 if (this.filterCollationKey === undefined) {
10211                     this.filterCollationKey = null;
10212                 }
10213                 this.id = id_4;
10214                 this.name = name_3;
10215                 this.description = description_1;
10216                 this.information = information_1;
10217                 this.license = license_5;
10218                 this.tags = tags_5;
10219                 this.creationDate = creationDate_5;
10220                 this.grade = grade_5;
10221                 this.icon = icon_5;
10222                 this.planIcon = planIcon_5;
10223                 this.model = model_5;
10224                 this.width = width_7;
10225                 this.depth = depth_5;
10226                 this.height = height_8;
10227                 this.elevation = elevation_5;
10228                 this.dropOnTopElevation = dropOnTopElevation_5;
10229                 this.movable = movable_5;
10230                 this.doorOrWindow = doorOrWindow_6;
10231                 this.color = color_6;
10232                 this.staircaseCutOutShape = staircaseCutOutShape_6;
10233                 this.creator = creator_8;
10234                 this.horizontallyRotatable = horizontallyRotatable_6;
10235                 this.price = price_6;
10236                 this.valueAddedTaxPercentage = valueAddedTaxPercentage_6;
10237                 this.currency = currency_6;
10238                 if (properties_6 == null || /* size */ Object.keys(properties_6).length === 0) {
10239                     if (contents_6 == null || /* size */ Object.keys(contents_6).length === 0) {
10240                         this.properties = /* emptyMap */ {};
10241                     }
10242                     else if ( /* size */Object.keys(contents_6).length === 1) {
10243                         this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(contents_6)).next(); return o; })(/* iterator */ (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(contents_6)).next());
10244                     }
10245                     else {
10246                         this.properties = ((function (o) { var r = {}; for (var p in o)
10247                             r[p] = o[p]; return r; })(contents_6));
10248                     }
10249                 }
10250                 else if ( /* size */Object.keys(properties_6).length === 1 && (contents_6 == null || /* size */ Object.keys(contents_6).length === 0)) {
10251                     this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(properties_6)).next(); return o; })(/* iterator */ (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(properties_6)).next());
10252                 }
10253                 else {
10254                     this.properties = ((function (o) { var r = {}; for (var p in o)
10255                         r[p] = o[p]; return r; })(properties_6));
10256                     if (contents_6 != null) {
10257                         /* putAll */ (function (m, n) { for (var i in n)
10258                             m[i] = n[i]; })(this.properties, contents_6);
10259                     }
10260                 }
10261                 if (modelRotation_6 == null) {
10262                     this.modelRotation = PieceOfFurniture.IDENTITY_ROTATION_$LI$();
10263                 }
10264                 else {
10265                     this.modelRotation = CatalogPieceOfFurniture.deepClone(modelRotation_6);
10266                 }
10267                 this.modelFlags = modelFlags_6;
10268                 this.modelSize = modelSize_6;
10269                 this.resizable = resizable_6;
10270                 this.deformable = deformable_6;
10271                 this.texturable = texturable_6;
10272                 this.iconYaw = iconYaw_6;
10273                 this.iconPitch = iconPitch_6;
10274                 this.iconScale = iconScale_6;
10275                 this.proportional = proportional_6;
10276                 this.modifiable = modifiable_13;
10277             }
10278             if (this.id === undefined) {
10279                 this.id = null;
10280             }
10281             if (this.name === undefined) {
10282                 this.name = null;
10283             }
10284             if (this.description === undefined) {
10285                 this.description = null;
10286             }
10287             if (this.information === undefined) {
10288                 this.information = null;
10289             }
10290             if (this.license === undefined) {
10291                 this.license = null;
10292             }
10293             if (this.tags === undefined) {
10294                 this.tags = null;
10295             }
10296             if (this.creationDate === undefined) {
10297                 this.creationDate = null;
10298             }
10299             if (this.grade === undefined) {
10300                 this.grade = null;
10301             }
10302             if (this.icon === undefined) {
10303                 this.icon = null;
10304             }
10305             if (this.planIcon === undefined) {
10306                 this.planIcon = null;
10307             }
10308             if (this.model === undefined) {
10309                 this.model = null;
10310             }
10311             if (this.width === undefined) {
10312                 this.width = 0;
10313             }
10314             if (this.depth === undefined) {
10315                 this.depth = 0;
10316             }
10317             if (this.height === undefined) {
10318                 this.height = 0;
10319             }
10320             if (this.proportional === undefined) {
10321                 this.proportional = false;
10322             }
10323             if (this.elevation === undefined) {
10324                 this.elevation = 0;
10325             }
10326             if (this.dropOnTopElevation === undefined) {
10327                 this.dropOnTopElevation = 0;
10328             }
10329             if (this.movable === undefined) {
10330                 this.movable = false;
10331             }
10332             if (this.doorOrWindow === undefined) {
10333                 this.doorOrWindow = false;
10334             }
10335             if (this.staircaseCutOutShape === undefined) {
10336                 this.staircaseCutOutShape = null;
10337             }
10338             if (this.modelRotation === undefined) {
10339                 this.modelRotation = null;
10340             }
10341             if (this.modelFlags === undefined) {
10342                 this.modelFlags = 0;
10343             }
10344             if (this.modelSize === undefined) {
10345                 this.modelSize = null;
10346             }
10347             if (this.creator === undefined) {
10348                 this.creator = null;
10349             }
10350             if (this.color === undefined) {
10351                 this.color = null;
10352             }
10353             if (this.iconYaw === undefined) {
10354                 this.iconYaw = 0;
10355             }
10356             if (this.iconPitch === undefined) {
10357                 this.iconPitch = 0;
10358             }
10359             if (this.iconScale === undefined) {
10360                 this.iconScale = 0;
10361             }
10362             if (this.modifiable === undefined) {
10363                 this.modifiable = false;
10364             }
10365             if (this.resizable === undefined) {
10366                 this.resizable = false;
10367             }
10368             if (this.deformable === undefined) {
10369                 this.deformable = false;
10370             }
10371             if (this.texturable === undefined) {
10372                 this.texturable = false;
10373             }
10374             if (this.horizontallyRotatable === undefined) {
10375                 this.horizontallyRotatable = false;
10376             }
10377             if (this.price === undefined) {
10378                 this.price = null;
10379             }
10380             if (this.valueAddedTaxPercentage === undefined) {
10381                 this.valueAddedTaxPercentage = null;
10382             }
10383             if (this.currency === undefined) {
10384                 this.currency = null;
10385             }
10386             if (this.properties === undefined) {
10387                 this.properties = null;
10388             }
10389             if (this.category === undefined) {
10390                 this.category = null;
10391             }
10392             if (this.filterCollationKey === undefined) {
10393                 this.filterCollationKey = null;
10394             }
10395         }
10396         else if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((information != null && (information.constructor != null && information.constructor["__interfaces"] != null && information.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || information === null) && ((license != null && (license.constructor != null && license.constructor["__interfaces"] != null && license.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || license === null) && ((tags != null && (tags.constructor != null && tags.constructor["__interfaces"] != null && tags.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((typeof grade === 'number') || grade === null) && ((typeof icon === 'number') || icon === null) && ((typeof planIcon === 'number') || planIcon === null) && ((typeof model === 'boolean') || model === null) && ((width != null && width instanceof Array && (width.length == 0 || width[0] == null || width[0] instanceof Array)) || width === null) && ((typeof depth === 'string') || depth === null) && ((typeof height === 'boolean') || height === null) && ((typeof elevation === 'boolean') || elevation === null) && ((typeof dropOnTopElevation === 'boolean') || dropOnTopElevation === null) && ((movable != null && movable instanceof Big) || movable === null) && ((doorOrWindow != null && doorOrWindow instanceof Big) || doorOrWindow === null) && staircaseCutOutShape === undefined && color === undefined && modelRotation === undefined && modelFlags === undefined && modelSize === undefined && creator === undefined && resizable === undefined && deformable === undefined && texturable === undefined && horizontallyRotatable === undefined && price === undefined && valueAddedTaxPercentage === undefined && currency === undefined && properties === undefined && contents === undefined && iconYaw === undefined && iconPitch === undefined && iconScale === undefined && proportional === undefined && modifiable === undefined) {
10397             var __args = arguments;
10398             var icon_6 = __args[3];
10399             var planIcon_6 = __args[4];
10400             var model_6 = __args[5];
10401             var width_8 = __args[6];
10402             var depth_6 = __args[7];
10403             var height_9 = __args[8];
10404             var elevation_6 = __args[9];
10405             var movable_6 = __args[10];
10406             var modelRotation_7 = __args[11];
10407             var creator_9 = __args[12];
10408             var resizable_7 = __args[13];
10409             var deformable_7 = __args[14];
10410             var texturable_7 = __args[15];
10411             var price_7 = __args[16];
10412             var valueAddedTaxPercentage_7 = __args[17];
10413             if (this.id === undefined) {
10414                 this.id = null;
10415             }
10416             if (this.name === undefined) {
10417                 this.name = null;
10418             }
10419             if (this.description === undefined) {
10420                 this.description = null;
10421             }
10422             if (this.information === undefined) {
10423                 this.information = null;
10424             }
10425             if (this.license === undefined) {
10426                 this.license = null;
10427             }
10428             if (this.tags === undefined) {
10429                 this.tags = null;
10430             }
10431             if (this.creationDate === undefined) {
10432                 this.creationDate = null;
10433             }
10434             if (this.grade === undefined) {
10435                 this.grade = null;
10436             }
10437             if (this.icon === undefined) {
10438                 this.icon = null;
10439             }
10440             if (this.planIcon === undefined) {
10441                 this.planIcon = null;
10442             }
10443             if (this.model === undefined) {
10444                 this.model = null;
10445             }
10446             if (this.width === undefined) {
10447                 this.width = 0;
10448             }
10449             if (this.depth === undefined) {
10450                 this.depth = 0;
10451             }
10452             if (this.height === undefined) {
10453                 this.height = 0;
10454             }
10455             if (this.proportional === undefined) {
10456                 this.proportional = false;
10457             }
10458             if (this.elevation === undefined) {
10459                 this.elevation = 0;
10460             }
10461             if (this.dropOnTopElevation === undefined) {
10462                 this.dropOnTopElevation = 0;
10463             }
10464             if (this.movable === undefined) {
10465                 this.movable = false;
10466             }
10467             if (this.doorOrWindow === undefined) {
10468                 this.doorOrWindow = false;
10469             }
10470             if (this.staircaseCutOutShape === undefined) {
10471                 this.staircaseCutOutShape = null;
10472             }
10473             if (this.modelRotation === undefined) {
10474                 this.modelRotation = null;
10475             }
10476             if (this.modelFlags === undefined) {
10477                 this.modelFlags = 0;
10478             }
10479             if (this.modelSize === undefined) {
10480                 this.modelSize = null;
10481             }
10482             if (this.creator === undefined) {
10483                 this.creator = null;
10484             }
10485             if (this.color === undefined) {
10486                 this.color = null;
10487             }
10488             if (this.iconYaw === undefined) {
10489                 this.iconYaw = 0;
10490             }
10491             if (this.iconPitch === undefined) {
10492                 this.iconPitch = 0;
10493             }
10494             if (this.iconScale === undefined) {
10495                 this.iconScale = 0;
10496             }
10497             if (this.modifiable === undefined) {
10498                 this.modifiable = false;
10499             }
10500             if (this.resizable === undefined) {
10501                 this.resizable = false;
10502             }
10503             if (this.deformable === undefined) {
10504                 this.deformable = false;
10505             }
10506             if (this.texturable === undefined) {
10507                 this.texturable = false;
10508             }
10509             if (this.horizontallyRotatable === undefined) {
10510                 this.horizontallyRotatable = false;
10511             }
10512             if (this.price === undefined) {
10513                 this.price = null;
10514             }
10515             if (this.valueAddedTaxPercentage === undefined) {
10516                 this.valueAddedTaxPercentage = null;
10517             }
10518             if (this.currency === undefined) {
10519                 this.currency = null;
10520             }
10521             if (this.properties === undefined) {
10522                 this.properties = null;
10523             }
10524             if (this.category === undefined) {
10525                 this.category = null;
10526             }
10527             if (this.filterCollationKey === undefined) {
10528                 this.filterCollationKey = null;
10529             }
10530         }
10531         else if (((typeof id === 'string') || id === null) && ((name != null && (name.constructor != null && name.constructor["__interfaces"] != null && name.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || name === null) && ((description != null && (description.constructor != null && description.constructor["__interfaces"] != null && description.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || description === null) && ((typeof information === 'number') || information === null) && ((typeof license === 'number') || license === null) && ((typeof tags === 'number') || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((typeof grade === 'boolean') || grade === null) && ((typeof icon === 'string') || icon === null) && ((typeof planIcon === 'number') || planIcon === null) && ((model != null && model instanceof Array && (model.length == 0 || model[0] == null || model[0] instanceof Array)) || model === null) && ((typeof width === 'boolean') || width === null) && ((typeof depth === 'number') || depth === null) && ((typeof height === 'string') || height === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof dropOnTopElevation === 'boolean') || dropOnTopElevation === null) && movable === undefined && doorOrWindow === undefined && staircaseCutOutShape === undefined && color === undefined && modelRotation === undefined && modelFlags === undefined && modelSize === undefined && creator === undefined && resizable === undefined && deformable === undefined && texturable === undefined && horizontallyRotatable === undefined && price === undefined && valueAddedTaxPercentage === undefined && currency === undefined && properties === undefined && contents === undefined && iconYaw === undefined && iconPitch === undefined && iconScale === undefined && proportional === undefined && modifiable === undefined) {
10532             var __args = arguments;
10533             var name_4 = __args[0];
10534             var icon_7 = __args[1];
10535             var model_7 = __args[2];
10536             var width_9 = __args[3];
10537             var depth_7 = __args[4];
10538             var height_10 = __args[5];
10539             var elevation_7 = __args[6];
10540             var movable_7 = __args[7];
10541             var staircaseCutOutShape_7 = __args[8];
10542             var color_7 = __args[9];
10543             var modelRotation_8 = __args[10];
10544             var backFaceShown = __args[11];
10545             var modelSize_7 = __args[12];
10546             var creator_10 = __args[13];
10547             var iconYaw_7 = __args[14];
10548             var proportional_7 = __args[15];
10549             {
10550                 var __args_56 = arguments;
10551                 var id_5 = null;
10552                 var description_2 = null;
10553                 var information_2 = null;
10554                 var license_6 = null;
10555                 var tags_6 = [];
10556                 var creationDate_6 = Date.now();
10557                 var grade_6 = null;
10558                 var planIcon_7 = null;
10559                 var dropOnTopElevation_6 = 1.0;
10560                 var doorOrWindow_7 = false;
10561                 var modelFlags_7 = backFaceShown ? PieceOfFurniture.SHOW_BACK_FACE : 0;
10562                 var resizable_8 = true;
10563                 var deformable_8 = true;
10564                 var texturable_8 = true;
10565                 var horizontallyRotatable_7 = true;
10566                 var price_8 = null;
10567                 var valueAddedTaxPercentage_8 = null;
10568                 var currency_7 = null;
10569                 var properties_7 = null;
10570                 var contents_7 = null;
10571                 var iconPitch_7 = (-Math.PI / 16);
10572                 var iconScale_7 = 1;
10573                 var modifiable_14 = true;
10574                 if (this.id === undefined) {
10575                     this.id = null;
10576                 }
10577                 if (this.name === undefined) {
10578                     this.name = null;
10579                 }
10580                 if (this.description === undefined) {
10581                     this.description = null;
10582                 }
10583                 if (this.information === undefined) {
10584                     this.information = null;
10585                 }
10586                 if (this.license === undefined) {
10587                     this.license = null;
10588                 }
10589                 if (this.tags === undefined) {
10590                     this.tags = null;
10591                 }
10592                 if (this.creationDate === undefined) {
10593                     this.creationDate = null;
10594                 }
10595                 if (this.grade === undefined) {
10596                     this.grade = null;
10597                 }
10598                 if (this.icon === undefined) {
10599                     this.icon = null;
10600                 }
10601                 if (this.planIcon === undefined) {
10602                     this.planIcon = null;
10603                 }
10604                 if (this.model === undefined) {
10605                     this.model = null;
10606                 }
10607                 if (this.width === undefined) {
10608                     this.width = 0;
10609                 }
10610                 if (this.depth === undefined) {
10611                     this.depth = 0;
10612                 }
10613                 if (this.height === undefined) {
10614                     this.height = 0;
10615                 }
10616                 if (this.proportional === undefined) {
10617                     this.proportional = false;
10618                 }
10619                 if (this.elevation === undefined) {
10620                     this.elevation = 0;
10621                 }
10622                 if (this.dropOnTopElevation === undefined) {
10623                     this.dropOnTopElevation = 0;
10624                 }
10625                 if (this.movable === undefined) {
10626                     this.movable = false;
10627                 }
10628                 if (this.doorOrWindow === undefined) {
10629                     this.doorOrWindow = false;
10630                 }
10631                 if (this.staircaseCutOutShape === undefined) {
10632                     this.staircaseCutOutShape = null;
10633                 }
10634                 if (this.modelRotation === undefined) {
10635                     this.modelRotation = null;
10636                 }
10637                 if (this.modelFlags === undefined) {
10638                     this.modelFlags = 0;
10639                 }
10640                 if (this.modelSize === undefined) {
10641                     this.modelSize = null;
10642                 }
10643                 if (this.creator === undefined) {
10644                     this.creator = null;
10645                 }
10646                 if (this.color === undefined) {
10647                     this.color = null;
10648                 }
10649                 if (this.iconYaw === undefined) {
10650                     this.iconYaw = 0;
10651                 }
10652                 if (this.iconPitch === undefined) {
10653                     this.iconPitch = 0;
10654                 }
10655                 if (this.iconScale === undefined) {
10656                     this.iconScale = 0;
10657                 }
10658                 if (this.modifiable === undefined) {
10659                     this.modifiable = false;
10660                 }
10661                 if (this.resizable === undefined) {
10662                     this.resizable = false;
10663                 }
10664                 if (this.deformable === undefined) {
10665                     this.deformable = false;
10666                 }
10667                 if (this.texturable === undefined) {
10668                     this.texturable = false;
10669                 }
10670                 if (this.horizontallyRotatable === undefined) {
10671                     this.horizontallyRotatable = false;
10672                 }
10673                 if (this.price === undefined) {
10674                     this.price = null;
10675                 }
10676                 if (this.valueAddedTaxPercentage === undefined) {
10677                     this.valueAddedTaxPercentage = null;
10678                 }
10679                 if (this.currency === undefined) {
10680                     this.currency = null;
10681                 }
10682                 if (this.properties === undefined) {
10683                     this.properties = null;
10684                 }
10685                 if (this.category === undefined) {
10686                     this.category = null;
10687                 }
10688                 if (this.filterCollationKey === undefined) {
10689                     this.filterCollationKey = null;
10690                 }
10691                 this.id = id_5;
10692                 this.name = name_4;
10693                 this.description = description_2;
10694                 this.information = information_2;
10695                 this.license = license_6;
10696                 this.tags = tags_6;
10697                 this.creationDate = creationDate_6;
10698                 this.grade = grade_6;
10699                 this.icon = icon_7;
10700                 this.planIcon = planIcon_7;
10701                 this.model = model_7;
10702                 this.width = width_9;
10703                 this.depth = depth_7;
10704                 this.height = height_10;
10705                 this.elevation = elevation_7;
10706                 this.dropOnTopElevation = dropOnTopElevation_6;
10707                 this.movable = movable_7;
10708                 this.doorOrWindow = doorOrWindow_7;
10709                 this.color = color_7;
10710                 this.staircaseCutOutShape = staircaseCutOutShape_7;
10711                 this.creator = creator_10;
10712                 this.horizontallyRotatable = horizontallyRotatable_7;
10713                 this.price = price_8;
10714                 this.valueAddedTaxPercentage = valueAddedTaxPercentage_8;
10715                 this.currency = currency_7;
10716                 if (properties_7 == null || /* size */ Object.keys(properties_7).length === 0) {
10717                     if (contents_7 == null || /* size */ Object.keys(contents_7).length === 0) {
10718                         this.properties = /* emptyMap */ {};
10719                     }
10720                     else if ( /* size */Object.keys(contents_7).length === 1) {
10721                         this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(contents_7)).next(); return o; })(/* iterator */ (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(contents_7)).next());
10722                     }
10723                     else {
10724                         this.properties = ((function (o) { var r = {}; for (var p in o)
10725                             r[p] = o[p]; return r; })(contents_7));
10726                     }
10727                 }
10728                 else if ( /* size */Object.keys(properties_7).length === 1 && (contents_7 == null || /* size */ Object.keys(contents_7).length === 0)) {
10729                     this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(properties_7)).next(); return o; })(/* iterator */ (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(properties_7)).next());
10730                 }
10731                 else {
10732                     this.properties = ((function (o) { var r = {}; for (var p in o)
10733                         r[p] = o[p]; return r; })(properties_7));
10734                     if (contents_7 != null) {
10735                         /* putAll */ (function (m, n) { for (var i in n)
10736                             m[i] = n[i]; })(this.properties, contents_7);
10737                     }
10738                 }
10739                 if (modelRotation_8 == null) {
10740                     this.modelRotation = PieceOfFurniture.IDENTITY_ROTATION_$LI$();
10741                 }
10742                 else {
10743                     this.modelRotation = CatalogPieceOfFurniture.deepClone(modelRotation_8);
10744                 }
10745                 this.modelFlags = modelFlags_7;
10746                 this.modelSize = modelSize_7;
10747                 this.resizable = resizable_8;
10748                 this.deformable = deformable_8;
10749                 this.texturable = texturable_8;
10750                 this.iconYaw = iconYaw_7;
10751                 this.iconPitch = iconPitch_7;
10752                 this.iconScale = iconScale_7;
10753                 this.proportional = proportional_7;
10754                 this.modifiable = modifiable_14;
10755             }
10756             if (this.id === undefined) {
10757                 this.id = null;
10758             }
10759             if (this.name === undefined) {
10760                 this.name = null;
10761             }
10762             if (this.description === undefined) {
10763                 this.description = null;
10764             }
10765             if (this.information === undefined) {
10766                 this.information = null;
10767             }
10768             if (this.license === undefined) {
10769                 this.license = null;
10770             }
10771             if (this.tags === undefined) {
10772                 this.tags = null;
10773             }
10774             if (this.creationDate === undefined) {
10775                 this.creationDate = null;
10776             }
10777             if (this.grade === undefined) {
10778                 this.grade = null;
10779             }
10780             if (this.icon === undefined) {
10781                 this.icon = null;
10782             }
10783             if (this.planIcon === undefined) {
10784                 this.planIcon = null;
10785             }
10786             if (this.model === undefined) {
10787                 this.model = null;
10788             }
10789             if (this.width === undefined) {
10790                 this.width = 0;
10791             }
10792             if (this.depth === undefined) {
10793                 this.depth = 0;
10794             }
10795             if (this.height === undefined) {
10796                 this.height = 0;
10797             }
10798             if (this.proportional === undefined) {
10799                 this.proportional = false;
10800             }
10801             if (this.elevation === undefined) {
10802                 this.elevation = 0;
10803             }
10804             if (this.dropOnTopElevation === undefined) {
10805                 this.dropOnTopElevation = 0;
10806             }
10807             if (this.movable === undefined) {
10808                 this.movable = false;
10809             }
10810             if (this.doorOrWindow === undefined) {
10811                 this.doorOrWindow = false;
10812             }
10813             if (this.staircaseCutOutShape === undefined) {
10814                 this.staircaseCutOutShape = null;
10815             }
10816             if (this.modelRotation === undefined) {
10817                 this.modelRotation = null;
10818             }
10819             if (this.modelFlags === undefined) {
10820                 this.modelFlags = 0;
10821             }
10822             if (this.modelSize === undefined) {
10823                 this.modelSize = null;
10824             }
10825             if (this.creator === undefined) {
10826                 this.creator = null;
10827             }
10828             if (this.color === undefined) {
10829                 this.color = null;
10830             }
10831             if (this.iconYaw === undefined) {
10832                 this.iconYaw = 0;
10833             }
10834             if (this.iconPitch === undefined) {
10835                 this.iconPitch = 0;
10836             }
10837             if (this.iconScale === undefined) {
10838                 this.iconScale = 0;
10839             }
10840             if (this.modifiable === undefined) {
10841                 this.modifiable = false;
10842             }
10843             if (this.resizable === undefined) {
10844                 this.resizable = false;
10845             }
10846             if (this.deformable === undefined) {
10847                 this.deformable = false;
10848             }
10849             if (this.texturable === undefined) {
10850                 this.texturable = false;
10851             }
10852             if (this.horizontallyRotatable === undefined) {
10853                 this.horizontallyRotatable = false;
10854             }
10855             if (this.price === undefined) {
10856                 this.price = null;
10857             }
10858             if (this.valueAddedTaxPercentage === undefined) {
10859                 this.valueAddedTaxPercentage = null;
10860             }
10861             if (this.currency === undefined) {
10862                 this.currency = null;
10863             }
10864             if (this.properties === undefined) {
10865                 this.properties = null;
10866             }
10867             if (this.category === undefined) {
10868                 this.category = null;
10869             }
10870             if (this.filterCollationKey === undefined) {
10871                 this.filterCollationKey = null;
10872             }
10873         }
10874         else if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((information != null && (information.constructor != null && information.constructor["__interfaces"] != null && information.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || information === null) && ((license != null && (license.constructor != null && license.constructor["__interfaces"] != null && license.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || license === null) && ((tags != null && (tags.constructor != null && tags.constructor["__interfaces"] != null && tags.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((typeof grade === 'number') || grade === null) && ((typeof icon === 'number') || icon === null) && ((typeof planIcon === 'number') || planIcon === null) && ((typeof model === 'boolean') || model === null) && ((width != null && width instanceof Array && (width.length == 0 || width[0] == null || width[0] instanceof Array)) || width === null) && ((typeof depth === 'string') || depth === null) && ((typeof height === 'boolean') || height === null) && ((elevation != null && elevation instanceof Big) || elevation === null) && ((dropOnTopElevation != null && dropOnTopElevation instanceof Big) || dropOnTopElevation === null) && movable === undefined && doorOrWindow === undefined && staircaseCutOutShape === undefined && color === undefined && modelRotation === undefined && modelFlags === undefined && modelSize === undefined && creator === undefined && resizable === undefined && deformable === undefined && texturable === undefined && horizontallyRotatable === undefined && price === undefined && valueAddedTaxPercentage === undefined && currency === undefined && properties === undefined && contents === undefined && iconYaw === undefined && iconPitch === undefined && iconScale === undefined && proportional === undefined && modifiable === undefined) {
10875             var __args = arguments;
10876             var icon_8 = __args[3];
10877             var planIcon_8 = __args[4];
10878             var model_8 = __args[5];
10879             var width_10 = __args[6];
10880             var depth_8 = __args[7];
10881             var height_11 = __args[8];
10882             var elevation_8 = __args[9];
10883             var movable_8 = __args[10];
10884             var modelRotation_9 = __args[11];
10885             var creator_11 = __args[12];
10886             var resizable_9 = __args[13];
10887             var price_9 = __args[14];
10888             var valueAddedTaxPercentage_9 = __args[15];
10889             {
10890                 var __args_57 = arguments;
10891                 var deformable_9 = true;
10892                 var texturable_9 = true;
10893                 if (this.id === undefined) {
10894                     this.id = null;
10895                 }
10896                 if (this.name === undefined) {
10897                     this.name = null;
10898                 }
10899                 if (this.description === undefined) {
10900                     this.description = null;
10901                 }
10902                 if (this.information === undefined) {
10903                     this.information = null;
10904                 }
10905                 if (this.license === undefined) {
10906                     this.license = null;
10907                 }
10908                 if (this.tags === undefined) {
10909                     this.tags = null;
10910                 }
10911                 if (this.creationDate === undefined) {
10912                     this.creationDate = null;
10913                 }
10914                 if (this.grade === undefined) {
10915                     this.grade = null;
10916                 }
10917                 if (this.icon === undefined) {
10918                     this.icon = null;
10919                 }
10920                 if (this.planIcon === undefined) {
10921                     this.planIcon = null;
10922                 }
10923                 if (this.model === undefined) {
10924                     this.model = null;
10925                 }
10926                 if (this.width === undefined) {
10927                     this.width = 0;
10928                 }
10929                 if (this.depth === undefined) {
10930                     this.depth = 0;
10931                 }
10932                 if (this.height === undefined) {
10933                     this.height = 0;
10934                 }
10935                 if (this.proportional === undefined) {
10936                     this.proportional = false;
10937                 }
10938                 if (this.elevation === undefined) {
10939                     this.elevation = 0;
10940                 }
10941                 if (this.dropOnTopElevation === undefined) {
10942                     this.dropOnTopElevation = 0;
10943                 }
10944                 if (this.movable === undefined) {
10945                     this.movable = false;
10946                 }
10947                 if (this.doorOrWindow === undefined) {
10948                     this.doorOrWindow = false;
10949                 }
10950                 if (this.staircaseCutOutShape === undefined) {
10951                     this.staircaseCutOutShape = null;
10952                 }
10953                 if (this.modelRotation === undefined) {
10954                     this.modelRotation = null;
10955                 }
10956                 if (this.modelFlags === undefined) {
10957                     this.modelFlags = 0;
10958                 }
10959                 if (this.modelSize === undefined) {
10960                     this.modelSize = null;
10961                 }
10962                 if (this.creator === undefined) {
10963                     this.creator = null;
10964                 }
10965                 if (this.color === undefined) {
10966                     this.color = null;
10967                 }
10968                 if (this.iconYaw === undefined) {
10969                     this.iconYaw = 0;
10970                 }
10971                 if (this.iconPitch === undefined) {
10972                     this.iconPitch = 0;
10973                 }
10974                 if (this.iconScale === undefined) {
10975                     this.iconScale = 0;
10976                 }
10977                 if (this.modifiable === undefined) {
10978                     this.modifiable = false;
10979                 }
10980                 if (this.resizable === undefined) {
10981                     this.resizable = false;
10982                 }
10983                 if (this.deformable === undefined) {
10984                     this.deformable = false;
10985                 }
10986                 if (this.texturable === undefined) {
10987                     this.texturable = false;
10988                 }
10989                 if (this.horizontallyRotatable === undefined) {
10990                     this.horizontallyRotatable = false;
10991                 }
10992                 if (this.price === undefined) {
10993                     this.price = null;
10994                 }
10995                 if (this.valueAddedTaxPercentage === undefined) {
10996                     this.valueAddedTaxPercentage = null;
10997                 }
10998                 if (this.currency === undefined) {
10999                     this.currency = null;
11000                 }
11001                 if (this.properties === undefined) {
11002                     this.properties = null;
11003                 }
11004                 if (this.category === undefined) {
11005                     this.category = null;
11006                 }
11007                 if (this.filterCollationKey === undefined) {
11008                     this.filterCollationKey = null;
11009                 }
11010             }
11011             if (this.id === undefined) {
11012                 this.id = null;
11013             }
11014             if (this.name === undefined) {
11015                 this.name = null;
11016             }
11017             if (this.description === undefined) {
11018                 this.description = null;
11019             }
11020             if (this.information === undefined) {
11021                 this.information = null;
11022             }
11023             if (this.license === undefined) {
11024                 this.license = null;
11025             }
11026             if (this.tags === undefined) {
11027                 this.tags = null;
11028             }
11029             if (this.creationDate === undefined) {
11030                 this.creationDate = null;
11031             }
11032             if (this.grade === undefined) {
11033                 this.grade = null;
11034             }
11035             if (this.icon === undefined) {
11036                 this.icon = null;
11037             }
11038             if (this.planIcon === undefined) {
11039                 this.planIcon = null;
11040             }
11041             if (this.model === undefined) {
11042                 this.model = null;
11043             }
11044             if (this.width === undefined) {
11045                 this.width = 0;
11046             }
11047             if (this.depth === undefined) {
11048                 this.depth = 0;
11049             }
11050             if (this.height === undefined) {
11051                 this.height = 0;
11052             }
11053             if (this.proportional === undefined) {
11054                 this.proportional = false;
11055             }
11056             if (this.elevation === undefined) {
11057                 this.elevation = 0;
11058             }
11059             if (this.dropOnTopElevation === undefined) {
11060                 this.dropOnTopElevation = 0;
11061             }
11062             if (this.movable === undefined) {
11063                 this.movable = false;
11064             }
11065             if (this.doorOrWindow === undefined) {
11066                 this.doorOrWindow = false;
11067             }
11068             if (this.staircaseCutOutShape === undefined) {
11069                 this.staircaseCutOutShape = null;
11070             }
11071             if (this.modelRotation === undefined) {
11072                 this.modelRotation = null;
11073             }
11074             if (this.modelFlags === undefined) {
11075                 this.modelFlags = 0;
11076             }
11077             if (this.modelSize === undefined) {
11078                 this.modelSize = null;
11079             }
11080             if (this.creator === undefined) {
11081                 this.creator = null;
11082             }
11083             if (this.color === undefined) {
11084                 this.color = null;
11085             }
11086             if (this.iconYaw === undefined) {
11087                 this.iconYaw = 0;
11088             }
11089             if (this.iconPitch === undefined) {
11090                 this.iconPitch = 0;
11091             }
11092             if (this.iconScale === undefined) {
11093                 this.iconScale = 0;
11094             }
11095             if (this.modifiable === undefined) {
11096                 this.modifiable = false;
11097             }
11098             if (this.resizable === undefined) {
11099                 this.resizable = false;
11100             }
11101             if (this.deformable === undefined) {
11102                 this.deformable = false;
11103             }
11104             if (this.texturable === undefined) {
11105                 this.texturable = false;
11106             }
11107             if (this.horizontallyRotatable === undefined) {
11108                 this.horizontallyRotatable = false;
11109             }
11110             if (this.price === undefined) {
11111                 this.price = null;
11112             }
11113             if (this.valueAddedTaxPercentage === undefined) {
11114                 this.valueAddedTaxPercentage = null;
11115             }
11116             if (this.currency === undefined) {
11117                 this.currency = null;
11118             }
11119             if (this.properties === undefined) {
11120                 this.properties = null;
11121             }
11122             if (this.category === undefined) {
11123                 this.category = null;
11124             }
11125             if (this.filterCollationKey === undefined) {
11126                 this.filterCollationKey = null;
11127             }
11128         }
11129         else if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((information != null && (information.constructor != null && information.constructor["__interfaces"] != null && information.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || information === null) && ((license != null && (license.constructor != null && license.constructor["__interfaces"] != null && license.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || license === null) && ((typeof tags === 'number') || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((typeof grade === 'number') || grade === null) && ((typeof icon === 'number') || icon === null) && ((typeof planIcon === 'boolean') || planIcon === null) && ((typeof model === 'boolean') || model === null) && ((width != null && width instanceof Array && (width.length == 0 || width[0] == null || width[0] instanceof Array)) || width === null) && ((typeof depth === 'string') || depth === null) && ((typeof height === 'boolean') || height === null) && ((elevation != null && elevation instanceof Big) || elevation === null) && ((dropOnTopElevation != null && dropOnTopElevation instanceof Big) || dropOnTopElevation === null) && movable === undefined && doorOrWindow === undefined && staircaseCutOutShape === undefined && color === undefined && modelRotation === undefined && modelFlags === undefined && modelSize === undefined && creator === undefined && resizable === undefined && deformable === undefined && texturable === undefined && horizontallyRotatable === undefined && price === undefined && valueAddedTaxPercentage === undefined && currency === undefined && properties === undefined && contents === undefined && iconYaw === undefined && iconPitch === undefined && iconScale === undefined && proportional === undefined && modifiable === undefined) {
11130             var __args = arguments;
11131             var icon_9 = __args[3];
11132             var model_9 = __args[4];
11133             var width_11 = __args[5];
11134             var depth_9 = __args[6];
11135             var height_12 = __args[7];
11136             var elevation_9 = __args[8];
11137             var movable_9 = __args[9];
11138             var doorOrWindow_8 = __args[10];
11139             var modelRotation_10 = __args[11];
11140             var creator_12 = __args[12];
11141             var resizable_10 = __args[13];
11142             var price_10 = __args[14];
11143             var valueAddedTaxPercentage_10 = __args[15];
11144             if (this.id === undefined) {
11145                 this.id = null;
11146             }
11147             if (this.name === undefined) {
11148                 this.name = null;
11149             }
11150             if (this.description === undefined) {
11151                 this.description = null;
11152             }
11153             if (this.information === undefined) {
11154                 this.information = null;
11155             }
11156             if (this.license === undefined) {
11157                 this.license = null;
11158             }
11159             if (this.tags === undefined) {
11160                 this.tags = null;
11161             }
11162             if (this.creationDate === undefined) {
11163                 this.creationDate = null;
11164             }
11165             if (this.grade === undefined) {
11166                 this.grade = null;
11167             }
11168             if (this.icon === undefined) {
11169                 this.icon = null;
11170             }
11171             if (this.planIcon === undefined) {
11172                 this.planIcon = null;
11173             }
11174             if (this.model === undefined) {
11175                 this.model = null;
11176             }
11177             if (this.width === undefined) {
11178                 this.width = 0;
11179             }
11180             if (this.depth === undefined) {
11181                 this.depth = 0;
11182             }
11183             if (this.height === undefined) {
11184                 this.height = 0;
11185             }
11186             if (this.proportional === undefined) {
11187                 this.proportional = false;
11188             }
11189             if (this.elevation === undefined) {
11190                 this.elevation = 0;
11191             }
11192             if (this.dropOnTopElevation === undefined) {
11193                 this.dropOnTopElevation = 0;
11194             }
11195             if (this.movable === undefined) {
11196                 this.movable = false;
11197             }
11198             if (this.doorOrWindow === undefined) {
11199                 this.doorOrWindow = false;
11200             }
11201             if (this.staircaseCutOutShape === undefined) {
11202                 this.staircaseCutOutShape = null;
11203             }
11204             if (this.modelRotation === undefined) {
11205                 this.modelRotation = null;
11206             }
11207             if (this.modelFlags === undefined) {
11208                 this.modelFlags = 0;
11209             }
11210             if (this.modelSize === undefined) {
11211                 this.modelSize = null;
11212             }
11213             if (this.creator === undefined) {
11214                 this.creator = null;
11215             }
11216             if (this.color === undefined) {
11217                 this.color = null;
11218             }
11219             if (this.iconYaw === undefined) {
11220                 this.iconYaw = 0;
11221             }
11222             if (this.iconPitch === undefined) {
11223                 this.iconPitch = 0;
11224             }
11225             if (this.iconScale === undefined) {
11226                 this.iconScale = 0;
11227             }
11228             if (this.modifiable === undefined) {
11229                 this.modifiable = false;
11230             }
11231             if (this.resizable === undefined) {
11232                 this.resizable = false;
11233             }
11234             if (this.deformable === undefined) {
11235                 this.deformable = false;
11236             }
11237             if (this.texturable === undefined) {
11238                 this.texturable = false;
11239             }
11240             if (this.horizontallyRotatable === undefined) {
11241                 this.horizontallyRotatable = false;
11242             }
11243             if (this.price === undefined) {
11244                 this.price = null;
11245             }
11246             if (this.valueAddedTaxPercentage === undefined) {
11247                 this.valueAddedTaxPercentage = null;
11248             }
11249             if (this.currency === undefined) {
11250                 this.currency = null;
11251             }
11252             if (this.properties === undefined) {
11253                 this.properties = null;
11254             }
11255             if (this.category === undefined) {
11256                 this.category = null;
11257             }
11258             if (this.filterCollationKey === undefined) {
11259                 this.filterCollationKey = null;
11260             }
11261         }
11262         else
11263             throw new Error('invalid overload');
11264     }
11265     CatalogPieceOfFurniture.__static_initialize = function () { if (!CatalogPieceOfFurniture.__static_initialized) {
11266         CatalogPieceOfFurniture.__static_initialized = true;
11267         CatalogPieceOfFurniture.__static_initializer_0();
11268     } };
11269     CatalogPieceOfFurniture.EMPTY_CRITERIA_$LI$ = function () { CatalogPieceOfFurniture.__static_initialize(); if (CatalogPieceOfFurniture.EMPTY_CRITERIA == null) {
11270         CatalogPieceOfFurniture.EMPTY_CRITERIA = [];
11271     } return CatalogPieceOfFurniture.EMPTY_CRITERIA; };
11272     CatalogPieceOfFurniture.COMPARATOR_$LI$ = function () { CatalogPieceOfFurniture.__static_initialize(); return CatalogPieceOfFurniture.COMPARATOR; };
11273     CatalogPieceOfFurniture.recentFilters_$LI$ = function () { CatalogPieceOfFurniture.__static_initialize(); return CatalogPieceOfFurniture.recentFilters; };
11274     CatalogPieceOfFurniture.__static_initializer_0 = function () {
11275         CatalogPieceOfFurniture.COMPARATOR = /* getInstance */ { compare: function (o1, o2) { return o1.toString().localeCompare(o2.toString()); }, equals: function (o1, o2) { return o1.toString().localeCompare(o2.toString()) === 0; } };
11276         /* setStrength */ CatalogPieceOfFurniture.COMPARATOR_$LI$();
11277         CatalogPieceOfFurniture.recentFilters = {};
11278     };
11279     /**
11280      * Returns the ID of this piece of furniture or <code>null</code>.
11281      * @return {string}
11282      */
11283     CatalogPieceOfFurniture.prototype.getId = function () {
11284         return this.id;
11285     };
11286     /**
11287      * Returns the name of this piece of furniture.
11288      * @return {string}
11289      */
11290     CatalogPieceOfFurniture.prototype.getName = function () {
11291         return this.name;
11292     };
11293     /**
11294      * Returns the description of this piece of furniture.
11295      * The returned value may be <code>null</code>.
11296      * @return {string}
11297      */
11298     CatalogPieceOfFurniture.prototype.getDescription = function () {
11299         return this.description;
11300     };
11301     /**
11302      * Returns the additional information associated to this piece, or <code>null</code>.
11303      * @return {string}
11304      */
11305     CatalogPieceOfFurniture.prototype.getInformation = function () {
11306         return this.information;
11307     };
11308     /**
11309      * Returns the license associated to this piece, or <code>null</code>.
11310      * @return {string}
11311      */
11312     CatalogPieceOfFurniture.prototype.getLicense = function () {
11313         return this.license;
11314     };
11315     /**
11316      * Returns the tags associated to this piece.
11317      * @return {java.lang.String[]}
11318      */
11319     CatalogPieceOfFurniture.prototype.getTags = function () {
11320         return this.tags;
11321     };
11322     /**
11323      * Returns the creation date of this piece in milliseconds since the epoch,
11324      * or <code>null</code> if no date is given to this piece.
11325      * @return {number}
11326      */
11327     CatalogPieceOfFurniture.prototype.getCreationDate = function () {
11328         return this.creationDate;
11329     };
11330     /**
11331      * Returns the grade of this piece, or <code>null</code> if no grade is given to this piece.
11332      * @return {number}
11333      */
11334     CatalogPieceOfFurniture.prototype.getGrade = function () {
11335         return this.grade;
11336     };
11337     /**
11338      * Returns the depth of this piece of furniture.
11339      * @return {number}
11340      */
11341     CatalogPieceOfFurniture.prototype.getDepth = function () {
11342         return this.depth;
11343     };
11344     /**
11345      * Returns the height of this piece of furniture.
11346      * @return {number}
11347      */
11348     CatalogPieceOfFurniture.prototype.getHeight = function () {
11349         return this.height;
11350     };
11351     /**
11352      * Returns the width of this piece of furniture.
11353      * @return {number}
11354      */
11355     CatalogPieceOfFurniture.prototype.getWidth = function () {
11356         return this.width;
11357     };
11358     /**
11359      * Returns the elevation of this piece of furniture.
11360      * @return {number}
11361      */
11362     CatalogPieceOfFurniture.prototype.getElevation = function () {
11363         return this.elevation;
11364     };
11365     /**
11366      * Returns the elevation at which should be placed an object dropped on this piece.
11367      * @return {number} a percentage of the height of this piece. A negative value means that the piece
11368      * should be ignored when an object is dropped on it.
11369      */
11370     CatalogPieceOfFurniture.prototype.getDropOnTopElevation = function () {
11371         return this.dropOnTopElevation;
11372     };
11373     /**
11374      * Returns <code>true</code> if this piece of furniture is movable.
11375      * @return {boolean}
11376      */
11377     CatalogPieceOfFurniture.prototype.isMovable = function () {
11378         return this.movable;
11379     };
11380     /**
11381      * Returns <code>true</code> if this piece of furniture is a door or a window.
11382      * As this method existed before {@linkplain CatalogDoorOrWindow CatalogDoorOrWindow} class,
11383      * you shouldn't rely on the value returned by this method to guess if a piece
11384      * is an instance of <code>DoorOrWindow</code> class.
11385      * @return {boolean}
11386      */
11387     CatalogPieceOfFurniture.prototype.isDoorOrWindow = function () {
11388         return this.doorOrWindow;
11389     };
11390     /**
11391      * Returns the icon of this piece of furniture.
11392      * @return {Object}
11393      */
11394     CatalogPieceOfFurniture.prototype.getIcon = function () {
11395         return this.icon;
11396     };
11397     /**
11398      * Returns the icon of this piece of furniture displayed in plan or <code>null</code>.
11399      * @return {Object}
11400      */
11401     CatalogPieceOfFurniture.prototype.getPlanIcon = function () {
11402         return this.planIcon;
11403     };
11404     /**
11405      * Returns the 3D model of this piece of furniture.
11406      * @return {Object}
11407      */
11408     CatalogPieceOfFurniture.prototype.getModel = function () {
11409         return this.model;
11410     };
11411     /**
11412      * Returns the flags which should be applied to the 3D model of this piece of furniture.
11413      * @return {number}
11414      */
11415     CatalogPieceOfFurniture.prototype.getModelFlags = function () {
11416         return this.modelFlags;
11417     };
11418     /**
11419      * Returns the size of the 3D model of this piece of furniture.
11420      * @return {number}
11421      */
11422     CatalogPieceOfFurniture.prototype.getModelSize = function () {
11423         return this.modelSize;
11424     };
11425     /**
11426      * Returns the rotation 3 by 3 matrix of this piece of furniture that ensures
11427      * its model is correctly oriented.
11428      * @return {float[][]}
11429      */
11430     CatalogPieceOfFurniture.prototype.getModelRotation = function () {
11431         return CatalogPieceOfFurniture.deepClone(this.modelRotation);
11432     };
11433     /**
11434      * Returns a deep copy of the given array.
11435      * @param {float[][]} array
11436      * @return {float[][]}
11437      * @private
11438      */
11439     CatalogPieceOfFurniture.deepClone = function (array) {
11440         var clone = (function (s) { var a = []; while (s-- > 0)
11441             a.push(null); return a; })(array.length);
11442         for (var i = 0; i < array.length; i++) {
11443             {
11444                 clone[i] = /* clone */ array[i].slice(0);
11445             }
11446             ;
11447         }
11448         return clone;
11449     };
11450     /**
11451      * Returns the shape used to cut out upper levels when they intersect with the piece
11452      * like a staircase.
11453      * @return {string}
11454      */
11455     CatalogPieceOfFurniture.prototype.getStaircaseCutOutShape = function () {
11456         return this.staircaseCutOutShape;
11457     };
11458     /**
11459      * Returns the creator of this piece.
11460      * @return {string}
11461      */
11462     CatalogPieceOfFurniture.prototype.getCreator = function () {
11463         return this.creator;
11464     };
11465     /**
11466      * Returns <code>true</code> if the back face of the piece of furniture
11467      * model should be displayed.
11468      * @return {boolean}
11469      */
11470     CatalogPieceOfFurniture.prototype.isBackFaceShown = function () {
11471         return (this.modelFlags & PieceOfFurniture.SHOW_BACK_FACE) === PieceOfFurniture.SHOW_BACK_FACE;
11472     };
11473     /**
11474      * Returns the color of this piece of furniture.
11475      * @return {number}
11476      */
11477     CatalogPieceOfFurniture.prototype.getColor = function () {
11478         return this.color;
11479     };
11480     /**
11481      * Returns the yaw angle used to create the piece icon.
11482      * @return {number}
11483      */
11484     CatalogPieceOfFurniture.prototype.getIconYaw = function () {
11485         return this.iconYaw;
11486     };
11487     /**
11488      * Returns the pitch angle used to create the piece icon.
11489      * @return {number}
11490      */
11491     CatalogPieceOfFurniture.prototype.getIconPitch = function () {
11492         return this.iconPitch;
11493     };
11494     /**
11495      * Returns the scale used to create the piece icon.
11496      * @return {number}
11497      */
11498     CatalogPieceOfFurniture.prototype.getIconScale = function () {
11499         return this.iconScale;
11500     };
11501     /**
11502      * Returns <code>true</code> if size proportions should be kept.
11503      * @return {boolean}
11504      */
11505     CatalogPieceOfFurniture.prototype.isProportional = function () {
11506         return this.proportional;
11507     };
11508     /**
11509      * Returns <code>true</code> if this piece is modifiable (not read from resources).
11510      * @return {boolean}
11511      */
11512     CatalogPieceOfFurniture.prototype.isModifiable = function () {
11513         return this.modifiable;
11514     };
11515     /**
11516      * Returns <code>true</code> if this piece is resizable.
11517      * @return {boolean}
11518      */
11519     CatalogPieceOfFurniture.prototype.isResizable = function () {
11520         return this.resizable;
11521     };
11522     /**
11523      * Returns <code>true</code> if this piece is deformable.
11524      * @return {boolean}
11525      */
11526     CatalogPieceOfFurniture.prototype.isDeformable = function () {
11527         return this.deformable;
11528     };
11529     /**
11530      * Returns <code>true</code> if this piece is deformable.
11531      * @return {boolean}
11532      */
11533     CatalogPieceOfFurniture.prototype.isWidthDepthDeformable = function () {
11534         return this.isDeformable();
11535     };
11536     /**
11537      * Returns <code>false</code> if this piece should always keep the same color or texture.
11538      * @return {boolean}
11539      */
11540     CatalogPieceOfFurniture.prototype.isTexturable = function () {
11541         return this.texturable;
11542     };
11543     /**
11544      * Returns <code>false</code> if this piece should not rotate around an horizontal axis.
11545      * @return {boolean}
11546      */
11547     CatalogPieceOfFurniture.prototype.isHorizontallyRotatable = function () {
11548         return this.horizontallyRotatable;
11549     };
11550     /**
11551      * Returns the price of this piece of furniture or <code>null</code>.
11552      * @return {Big}
11553      */
11554     CatalogPieceOfFurniture.prototype.getPrice = function () {
11555         return this.price;
11556     };
11557     /**
11558      * Returns the Value Added Tax percentage applied to the price of this piece of furniture.
11559      * @return {Big}
11560      */
11561     CatalogPieceOfFurniture.prototype.getValueAddedTaxPercentage = function () {
11562         return this.valueAddedTaxPercentage;
11563     };
11564     /**
11565      * Returns the price currency, noted with ISO 4217 code, or <code>null</code>
11566      * if it has no price or default currency should be used.
11567      * @return {string}
11568      */
11569     CatalogPieceOfFurniture.prototype.getCurrency = function () {
11570         return this.currency;
11571     };
11572     /**
11573      * Returns the value of an additional property <code>name</code> of this piece.
11574      * @return {string} the value of the property or <code>null</code> if it doesn't exist or if it's not a string.
11575      * @param {string} name
11576      */
11577     CatalogPieceOfFurniture.prototype.getProperty = function (name) {
11578         var propertyValue = (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, name);
11579         if (typeof propertyValue === 'string') {
11580             return propertyValue;
11581         }
11582         else {
11583             return null;
11584         }
11585     };
11586     /**
11587      * Returns the names of the additional properties of this piece.
11588      * @return {string[]} a collection of all the names of the properties
11589      */
11590     CatalogPieceOfFurniture.prototype.getPropertyNames = function () {
11591         return /* keySet */ Object.keys(this.properties);
11592     };
11593     /**
11594      * Returns the value of an additional content <code>name</code> associated to this piece.
11595      * @return {Object} the value of the content or <code>null</code> if it doesn't exist or if it's not a content.
11596      * @param {string} name
11597      */
11598     CatalogPieceOfFurniture.prototype.getContentProperty = function (name) {
11599         var propertyValue = (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, name);
11600         if (propertyValue != null && (propertyValue.constructor != null && propertyValue.constructor["__interfaces"] != null && propertyValue.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) {
11601             return propertyValue;
11602         }
11603         else {
11604             return null;
11605         }
11606     };
11607     /**
11608      * Returns <code>true</code> if the type of given additional property is a content.
11609      * @param {string} name
11610      * @return {boolean}
11611      */
11612     CatalogPieceOfFurniture.prototype.isContentProperty = function (name) {
11613         return ( /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, name) != null && ( /* get */(function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, name).constructor != null && /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, name).constructor["__interfaces"] != null && /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, name).constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0));
11614     };
11615     /**
11616      * Returns the category of this piece of furniture.
11617      * @return {FurnitureCategory}
11618      */
11619     CatalogPieceOfFurniture.prototype.getCategory = function () {
11620         return this.category;
11621     };
11622     /**
11623      * Sets the category of this piece of furniture.
11624      * @param {FurnitureCategory} category
11625      * @private
11626      */
11627     CatalogPieceOfFurniture.prototype.setCategory = function (category) {
11628         this.category = category;
11629     };
11630     /**
11631      * Returns <code>true</code> if this piece and the one in parameter are the same objects.
11632      * Note that, from version 3.6, two pieces of furniture can have the same name.
11633      * @param {Object} obj
11634      * @return {boolean}
11635      */
11636     CatalogPieceOfFurniture.prototype.equals = function (obj) {
11637         return /* equals */ (function (o1, o2) { return o1 && o1.equals ? o1.equals(o2) : o1 === o2; })(this, obj);
11638     };
11639     /**
11640      * Returns default hash code.
11641      * @return {number}
11642      */
11643     CatalogPieceOfFurniture.prototype.hashCode = function () {
11644         return /* hashCode */ (function (o) { if (o.hashCode) {
11645             return o.hashCode();
11646         }
11647         else {
11648             return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
11649         } })(this);
11650     };
11651     /**
11652      * Compares the names of this piece and the one in parameter.
11653      * @param {CatalogPieceOfFurniture} piece
11654      * @return {number}
11655      */
11656     CatalogPieceOfFurniture.prototype.compareTo = function (piece) {
11657         var nameComparison = CatalogPieceOfFurniture.COMPARATOR_$LI$().compare(this.name, piece.name);
11658         if (nameComparison !== 0) {
11659             return nameComparison;
11660         }
11661         else {
11662             return this.modifiable === piece.modifiable ? 0 : (this.modifiable ? 1 : -1);
11663         }
11664     };
11665     /**
11666      * Returns <code>true</code> if this piece matches the given <code>filter</code> text.
11667      * Each substring of the <code>filter</code> is considered as a search criterion that can match
11668      * the name, the category name, the creator, the license, the description or the tags of this piece.
11669      * @param {string} filter
11670      * @return {boolean}
11671      */
11672     CatalogPieceOfFurniture.prototype.matchesFilter = function (filter) {
11673         var filterCriteriaCollationKeys = this.getFilterCollationKeys(filter);
11674         var checkedCriteria = 0;
11675         if (filterCriteriaCollationKeys.length > 0) {
11676             var furnitureCollationKey = this.getPieceOfFurnitureCollationKey();
11677             for (var i = 0; i < filterCriteriaCollationKeys.length; i++) {
11678                 {
11679                     if (this.isSubCollationKey(furnitureCollationKey, filterCriteriaCollationKeys[i], 0)) {
11680                         checkedCriteria++;
11681                     }
11682                     else {
11683                         break;
11684                     }
11685                 }
11686                 ;
11687             }
11688         }
11689         return checkedCriteria === filterCriteriaCollationKeys.length;
11690     };
11691     /**
11692      * Returns the collation key bytes of each criterion in the given <code>filter</code>.
11693      * @param {string} filter
11694      * @return {byte[][]}
11695      * @private
11696      */
11697     /*private*/ CatalogPieceOfFurniture.prototype.getFilterCollationKeys = function (filter) {
11698         if (filter.length === 0) {
11699             return CatalogPieceOfFurniture.EMPTY_CRITERIA_$LI$();
11700         }
11701         var filterCollationKeys = (function (m, k) { return m[k] === undefined ? null : m[k]; })(CatalogPieceOfFurniture.recentFilters_$LI$(), filter);
11702         if (filterCollationKeys == null) {
11703             var filterCriteria = filter.split(/\s|\p{Punct}|\\|/);
11704             var filterCriteriaCollationKeys = ([]);
11705             for (var index = 0; index < filterCriteria.length; index++) {
11706                 var criterion = filterCriteria[index];
11707                 {
11708                     if (criterion.length > 0) {
11709                         /* add */ (filterCriteriaCollationKeys.push(CatalogPieceOfFurniture.COMPARATOR_$LI$().getCollationKey(criterion).toByteArray()) > 0);
11710                     }
11711                 }
11712             }
11713             if ( /* size */filterCriteriaCollationKeys.length === 0) {
11714                 filterCollationKeys = CatalogPieceOfFurniture.EMPTY_CRITERIA_$LI$();
11715             }
11716             else {
11717                 filterCollationKeys = /* toArray */ filterCriteriaCollationKeys.slice(0);
11718             }
11719             /* put */ (CatalogPieceOfFurniture.recentFilters_$LI$()[filter] = filterCollationKeys);
11720         }
11721         return filterCollationKeys;
11722     };
11723     /**
11724      * Returns the collation key bytes used to compare the given <code>piece</code> with filter.
11725      * @return {byte[]}
11726      * @private
11727      */
11728     /*private*/ CatalogPieceOfFurniture.prototype.getPieceOfFurnitureCollationKey = function () {
11729         if (this.filterCollationKey == null) {
11730             var search = { str: "", toString: function () { return this.str; } };
11731             {
11732                 var array = this.getFilterCriteria();
11733                 var _loop_1 = function (index) {
11734                     var criterion = array[index];
11735                     {
11736                         if ( /* length */search.str.length !== 0) {
11737                             /* append */ (function (sb) { sb.str += '|'; return sb; })(search);
11738                         }
11739                         /* append */ (function (sb) { sb.str += criterion; return sb; })(search);
11740                     }
11741                 };
11742                 for (var index = 0; index < array.length; index++) {
11743                     _loop_1(index);
11744                 }
11745             }
11746             this.filterCollationKey = CatalogPieceOfFurniture.COMPARATOR_$LI$().getCollationKey(/* toString */ search.str).toByteArray();
11747         }
11748         return this.filterCollationKey;
11749     };
11750     /**
11751      * Returns the strings used as criteria for filtering (name, category, creator, license, description and tags).
11752      * @see CatalogPieceOfFurniture#matchesFilter(String)
11753      * @return {java.lang.String[]}
11754      */
11755     CatalogPieceOfFurniture.prototype.getFilterCriteria = function () {
11756         var criteria = ([]);
11757         /* add */ (criteria.push(this.getName()) > 0);
11758         if (this.getCategory() != null) {
11759             /* add */ (criteria.push(this.getCategory().getName()) > 0);
11760         }
11761         if (this.getCreator() != null) {
11762             /* add */ (criteria.push(this.getCreator()) > 0);
11763         }
11764         if (this.getDescription() != null) {
11765             /* add */ (criteria.push(this.getDescription()) > 0);
11766         }
11767         if (this.getLicense() != null) {
11768             /* add */ (criteria.push(this.getLicense()) > 0);
11769         }
11770         {
11771             var array = this.getTags();
11772             for (var index = 0; index < array.length; index++) {
11773                 var tag = array[index];
11774                 {
11775                     /* add */ (criteria.push(tag) > 0);
11776                 }
11777             }
11778         }
11779         return /* toArray */ criteria.slice(0);
11780     };
11781     /**
11782      * Returns <code>true</code> if the given filter collation key is a sub part of the first array collator key.
11783      * @param {byte[]} collationKey
11784      * @param {byte[]} filterCollationKey
11785      * @param {number} start
11786      * @return {boolean}
11787      * @private
11788      */
11789     /*private*/ CatalogPieceOfFurniture.prototype.isSubCollationKey = function (collationKey, filterCollationKey, start) {
11790         for (var i = start, n = collationKey.length - 4, m = filterCollationKey.length - 4; i < n && i < n - m + 1; i++) {
11791             {
11792                 if (collationKey[i] === filterCollationKey[0]) {
11793                     for (var j = 1; j < m; j++) {
11794                         {
11795                             if (collationKey[i + j] !== filterCollationKey[j]) {
11796                                 return this.isSubCollationKey(collationKey, filterCollationKey, i + 1);
11797                             }
11798                         }
11799                         ;
11800                     }
11801                     return true;
11802                 }
11803             }
11804             ;
11805         }
11806         return false;
11807     };
11808     /**
11809      * Returns a clone of this piece.
11810      * @return {CatalogPieceOfFurniture}
11811      */
11812     CatalogPieceOfFurniture.prototype.clone = function () {
11813         try {
11814             var clone = (function (o) { var clone = Object.create(o); for (var p in o) {
11815                 if (o.hasOwnProperty(p))
11816                     clone[p] = o[p];
11817             } return clone; })(this);
11818             clone.category = null;
11819             return clone;
11820         }
11821         catch (ex) {
11822             throw new IllegalStateException("Super class isn\'t cloneable");
11823         }
11824     };
11825     CatalogPieceOfFurniture.__static_initialized = false;
11826     return CatalogPieceOfFurniture;
11827 }());
11828 CatalogPieceOfFurniture["__class"] = "com.eteks.sweethome3d.model.CatalogPieceOfFurniture";
11829 CatalogPieceOfFurniture["__interfaces"] = ["com.eteks.sweethome3d.model.CatalogItem", "com.eteks.sweethome3d.model.PieceOfFurniture"];
11830 /**
11831  * Creates a collection change support.
11832  * @param {Object} source  the collection to which data will be added.
11833  * @class
11834  * @author Emmanuel Puybaret
11835  */
11836 var CollectionChangeSupport = /** @class */ (function () {
11837     function CollectionChangeSupport(source) {
11838         if (this.source === undefined) {
11839             this.source = null;
11840         }
11841         if (this.collectionListeners === undefined) {
11842             this.collectionListeners = null;
11843         }
11844         this.source = source;
11845         this.collectionListeners = ([]);
11846     }
11847     /**
11848      * Adds the <code>listener</code> in parameter to the list of listeners that may be notified.
11849      * @param {Object} listener  the listener to add
11850      */
11851     CollectionChangeSupport.prototype.addCollectionListener = function (listener) {
11852         /* add */ (this.collectionListeners.push(listener) > 0);
11853     };
11854     /**
11855      * Removes the <code>listener</code> in parameter to the list of listeners that may be notified.
11856      * @param {Object} listener  the listener to remove. If it doesn't exist, it's simply ignored.
11857      */
11858     CollectionChangeSupport.prototype.removeCollectionListener = function (listener) {
11859         /* remove */ (function (a) { var index = a.indexOf(listener); if (index >= 0) {
11860             a.splice(index, 1);
11861             return true;
11862         }
11863         else {
11864             return false;
11865         } })(this.collectionListeners);
11866     };
11867     CollectionChangeSupport.prototype.fireCollectionChanged$java_lang_Object$com_eteks_sweethome3d_model_CollectionEvent_Type = function (item, eventType) {
11868         this.fireCollectionChanged(item, -1, eventType);
11869     };
11870     CollectionChangeSupport.prototype.fireCollectionChanged$java_lang_Object$int$com_eteks_sweethome3d_model_CollectionEvent_Type = function (item, index, eventType) {
11871         if (!(this.collectionListeners.length == 0)) {
11872             var event_1 = (new CollectionEvent(this.source, item, index, eventType));
11873             var listeners = this.collectionListeners.slice(0);
11874             for (var index1 = 0; index1 < listeners.length; index1++) {
11875                 var listener = listeners[index1];
11876                 {
11877                     listener(event_1);
11878                 }
11879             }
11880         }
11881     };
11882     /**
11883      * Fires a collection event about <code>item</code> at a given <code>index</code>.
11884      * @param {Object} item     the added ore deleted item
11885      * @param {number} index    the optional index at which the item was added or deleted
11886      * @param {CollectionEvent.Type} eventType <code>CollectionEvent.Type.ADD</code> or <code>CollectionEvent.Type.DELETE</code>
11887      */
11888     CollectionChangeSupport.prototype.fireCollectionChanged = function (item, index, eventType) {
11889         if (((item != null) || item === null) && ((typeof index === 'number') || index === null) && ((typeof eventType === 'number') || eventType === null)) {
11890             return this.fireCollectionChanged$java_lang_Object$int$com_eteks_sweethome3d_model_CollectionEvent_Type(item, index, eventType);
11891         }
11892         else if (((item != null) || item === null) && ((typeof index === 'number') || index === null) && eventType === undefined) {
11893             return this.fireCollectionChanged$java_lang_Object$com_eteks_sweethome3d_model_CollectionEvent_Type(item, index);
11894         }
11895         else
11896             throw new Error('invalid overload');
11897     };
11898     return CollectionChangeSupport;
11899 }());
11900 CollectionChangeSupport["__class"] = "com.eteks.sweethome3d.model.CollectionChangeSupport";
11901 /**
11902  * Creates an event for an item with its index.
11903  * @param {Object} source the object to which an item was added or deleted
11904  * @param {Object} item   the added or deleted item
11905  * @param {number} index  the index at which the item was added or deleted, or -1 if unknown
11906  * @param {CollectionEvent.Type} type   <code>CollectionEvent.Type.ADD</code> or <code>CollectionEvent.Type.DELETE</code>
11907  * @class
11908  * @extends EventObject
11909  * @author Emmanuel Puybaret
11910  */
11911 var CollectionEvent = /** @class */ (function (_super) {
11912     __extends(CollectionEvent, _super);
11913     function CollectionEvent(source, item, index, type) {
11914         var _this = this;
11915         if (((source != null) || source === null) && ((item != null) || item === null) && ((typeof index === 'number') || index === null) && ((typeof type === 'number') || type === null)) {
11916             var __args = arguments;
11917             _this = _super.call(this, source) || this;
11918             if (_this.item === undefined) {
11919                 _this.item = null;
11920             }
11921             if (_this.index === undefined) {
11922                 _this.index = 0;
11923             }
11924             if (_this.type === undefined) {
11925                 _this.type = null;
11926             }
11927             _this.item = item;
11928             _this.index = index;
11929             _this.type = type;
11930         }
11931         else if (((source != null) || source === null) && ((item != null) || item === null) && ((typeof index === 'number') || index === null) && type === undefined) {
11932             var __args = arguments;
11933             var type_4 = __args[2];
11934             {
11935                 var __args_58 = arguments;
11936                 var index_1 = -1;
11937                 _this = _super.call(this, source) || this;
11938                 if (_this.item === undefined) {
11939                     _this.item = null;
11940                 }
11941                 if (_this.index === undefined) {
11942                     _this.index = 0;
11943                 }
11944                 if (_this.type === undefined) {
11945                     _this.type = null;
11946                 }
11947                 _this.item = item;
11948                 _this.index = index_1;
11949                 _this.type = type_4;
11950             }
11951             if (_this.item === undefined) {
11952                 _this.item = null;
11953             }
11954             if (_this.index === undefined) {
11955                 _this.index = 0;
11956             }
11957             if (_this.type === undefined) {
11958                 _this.type = null;
11959             }
11960         }
11961         else
11962             throw new Error('invalid overload');
11963         return _this;
11964     }
11965     /**
11966      * Returns the added or deleted item.
11967      * @return {Object}
11968      */
11969     CollectionEvent.prototype.getItem = function () {
11970         return this.item;
11971     };
11972     /**
11973      * Returns the index of the item in collection or -1 if this index is unknown.
11974      * @return {number}
11975      */
11976     CollectionEvent.prototype.getIndex = function () {
11977         return this.index;
11978     };
11979     /**
11980      * Returns the type of event.
11981      * @return {CollectionEvent.Type}
11982      */
11983     CollectionEvent.prototype.getType = function () {
11984         return this.type;
11985     };
11986     return CollectionEvent;
11987 }(EventObject));
11988 CollectionEvent["__class"] = "com.eteks.sweethome3d.model.CollectionEvent";
11989 (function (CollectionEvent) {
11990     /**
11991      * The type of change in the collection.
11992      * @enum
11993      * @property {CollectionEvent.Type} ADD
11994      * @property {CollectionEvent.Type} DELETE
11995      * @class
11996      */
11997     var Type;
11998     (function (Type) {
11999         Type[Type["ADD"] = 0] = "ADD";
12000         Type[Type["DELETE"] = 1] = "DELETE";
12001     })(Type = CollectionEvent.Type || (CollectionEvent.Type = {}));
12002 })(CollectionEvent || (CollectionEvent = {}));
12003 CollectionEvent['__transients'] = ['source'];
12004 /**
12005  * Creates an event with an associated list of selected items.
12006  * @param {Object} source
12007  * @param {? extends java.lang.Object[]} oldSelectedItems
12008  * @param {? extends java.lang.Object[]} selectedItems
12009  * @class
12010  * @extends EventObject
12011  * @author Emmanuel Puybaret
12012  */
12013 var SelectionEvent = /** @class */ (function (_super) {
12014     __extends(SelectionEvent, _super);
12015     function SelectionEvent(source, oldSelectedItems, selectedItems) {
12016         var _this = this;
12017         if (((source != null) || source === null) && ((oldSelectedItems != null && (oldSelectedItems instanceof Array)) || oldSelectedItems === null) && ((selectedItems != null && (selectedItems instanceof Array)) || selectedItems === null)) {
12018             var __args = arguments;
12019             _this = _super.call(this, source) || this;
12020             if (_this.oldSelectedItems === undefined) {
12021                 _this.oldSelectedItems = null;
12022             }
12023             if (_this.selectedItems === undefined) {
12024                 _this.selectedItems = null;
12025             }
12026             _this.oldSelectedItems = oldSelectedItems;
12027             _this.selectedItems = selectedItems;
12028         }
12029         else if (((source != null) || source === null) && ((oldSelectedItems != null && (oldSelectedItems instanceof Array)) || oldSelectedItems === null) && selectedItems === undefined) {
12030             var __args = arguments;
12031             var selectedItems_1 = __args[1];
12032             {
12033                 var __args_59 = arguments;
12034                 var oldSelectedItems_1 = null;
12035                 _this = _super.call(this, source) || this;
12036                 if (_this.oldSelectedItems === undefined) {
12037                     _this.oldSelectedItems = null;
12038                 }
12039                 if (_this.selectedItems === undefined) {
12040                     _this.selectedItems = null;
12041                 }
12042                 _this.oldSelectedItems = oldSelectedItems_1;
12043                 _this.selectedItems = selectedItems_1;
12044             }
12045             if (_this.oldSelectedItems === undefined) {
12046                 _this.oldSelectedItems = null;
12047             }
12048             if (_this.selectedItems === undefined) {
12049                 _this.selectedItems = null;
12050             }
12051         }
12052         else
12053             throw new Error('invalid overload');
12054         return _this;
12055     }
12056     /**
12057      * Returns the previously selected items or <code>null</code> if not known.
12058      * @return {? extends java.lang.Object[]}
12059      */
12060     SelectionEvent.prototype.getOldSelectedItems = function () {
12061         return this.oldSelectedItems;
12062     };
12063     /**
12064      * Returns the selected items.
12065      * @return {? extends java.lang.Object[]}
12066      */
12067     SelectionEvent.prototype.getSelectedItems = function () {
12068         return this.selectedItems;
12069     };
12070     return SelectionEvent;
12071 }(EventObject));
12072 SelectionEvent["__class"] = "com.eteks.sweethome3d.model.SelectionEvent";
12073 SelectionEvent['__transients'] = ['source'];
12074 /**
12075  * Create a category.
12076  * @param {string} name the name of the category.
12077  * @class
12078  * @author Emmanuel Puybaret
12079  */
12080 var FurnitureCategory = /** @class */ (function () {
12081     function FurnitureCategory(name) {
12082         if (this.name === undefined) {
12083             this.name = null;
12084         }
12085         if (this.furniture === undefined) {
12086             this.furniture = null;
12087         }
12088         this.name = name;
12089         this.furniture = ([]);
12090     }
12091     FurnitureCategory.COMPARATOR_$LI$ = function () { if (FurnitureCategory.COMPARATOR == null) {
12092         FurnitureCategory.COMPARATOR = /* getInstance */ { compare: function (o1, o2) { return o1.toString().localeCompare(o2.toString()); }, equals: function (o1, o2) { return o1.toString().localeCompare(o2.toString()) === 0; } };
12093     } return FurnitureCategory.COMPARATOR; };
12094     /**
12095      * Returns the name of this category.
12096      * @return {string}
12097      */
12098     FurnitureCategory.prototype.getName = function () {
12099         return this.name;
12100     };
12101     /**
12102      * Returns the furniture list of this category sorted by name.
12103      * @return {CatalogPieceOfFurniture[]} a list of furniture.
12104      */
12105     FurnitureCategory.prototype.getFurniture = function () {
12106         return /* unmodifiableList */ this.furniture.slice(0);
12107     };
12108     /**
12109      * Returns the count of furniture in this category.
12110      * @return {number}
12111      */
12112     FurnitureCategory.prototype.getFurnitureCount = function () {
12113         return /* size */ this.furniture.length;
12114     };
12115     /**
12116      * Returns the piece of furniture at a given <code>index</code>.
12117      * @param {number} index
12118      * @return {CatalogPieceOfFurniture}
12119      */
12120     FurnitureCategory.prototype.getPieceOfFurniture = function (index) {
12121         return /* get */ this.furniture[index];
12122     };
12123     /**
12124      * Returns the index of the given <code>piece</code> of furniture.
12125      * @param {CatalogPieceOfFurniture} piece
12126      * @return {number}
12127      */
12128     FurnitureCategory.prototype.getIndexOfPieceOfFurniture = function (piece) {
12129         return this.furniture.indexOf(piece);
12130     };
12131     /**
12132      * Adds a piece of furniture to this category.
12133      * @param {CatalogPieceOfFurniture} piece the piece to add.
12134      * @private
12135      */
12136     FurnitureCategory.prototype.add = function (piece) {
12137         piece.setCategory(this);
12138         var index = (function (l, key) { var comp = function (a, b) { if (a.compareTo)
12139             return a.compareTo(b);
12140         else
12141             return a.localeCompare(b); }; var low = 0; var high = l.length - 1; while (low <= high) {
12142             var mid = (low + high) >>> 1;
12143             var midVal = l[mid];
12144             var cmp = comp(midVal, key);
12145             if (cmp < 0)
12146                 low = mid + 1;
12147             else if (cmp > 0)
12148                 high = mid - 1;
12149             else
12150                 return mid;
12151         } return -(low + 1); })(this.furniture, piece);
12152         if (index < 0) {
12153             index = -index - 1;
12154         }
12155         /* add */ this.furniture.splice(index, 0, piece);
12156     };
12157     /**
12158      * Deletes a piece of furniture from this category.
12159      * @param {CatalogPieceOfFurniture} piece the piece to remove.
12160      * @throws IllegalArgumentException if the piece doesn't exist in this category.
12161      * @private
12162      */
12163     FurnitureCategory.prototype["delete"] = function (piece) {
12164         var pieceIndex = this.furniture.indexOf(piece);
12165         if (pieceIndex === -1) {
12166             throw new IllegalArgumentException(this.name + " doesn\'t contain piece " + piece.getName());
12167         }
12168         this.furniture = (this.furniture.slice(0));
12169         /* remove */ this.furniture.splice(pieceIndex, 1)[0];
12170     };
12171     /**
12172      * Returns <code>true</code> if this category and the one in parameter have the same name.
12173      * @param {Object} obj
12174      * @return {boolean}
12175      */
12176     FurnitureCategory.prototype.equals = function (obj) {
12177         return (obj != null && obj instanceof FurnitureCategory) && FurnitureCategory.COMPARATOR_$LI$().equals(this.name, obj.name);
12178     };
12179     /**
12180      *
12181      * @return {number}
12182      */
12183     FurnitureCategory.prototype.hashCode = function () {
12184         return /* hashCode */ (function (o) { if (o.hashCode) {
12185             return o.hashCode();
12186         }
12187         else {
12188             return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
12189         } })(this.name);
12190     };
12191     /**
12192      * Compares the names of this category and the one in parameter.
12193      * @param {FurnitureCategory} category
12194      * @return {number}
12195      */
12196     FurnitureCategory.prototype.compareTo = function (category) {
12197         return FurnitureCategory.COMPARATOR_$LI$().compare(this.name, category.name);
12198     };
12199     return FurnitureCategory;
12200 }());
12201 FurnitureCategory["__class"] = "com.eteks.sweethome3d.model.FurnitureCategory";
12202 /**
12203  * Creates a material instance from parameters.
12204  * @param {string} name
12205  * @param {string} key
12206  * @param {number} color
12207  * @param {HomeTexture} texture
12208  * @param {number} shininess
12209  * @class
12210  * @author Emmanuel Puybaret
12211  */
12212 var HomeMaterial = /** @class */ (function () {
12213     function HomeMaterial(name, key, color, texture, shininess) {
12214         if (((typeof name === 'string') || name === null) && ((typeof key === 'string') || key === null) && ((typeof color === 'number') || color === null) && ((texture != null && texture instanceof HomeTexture) || texture === null) && ((typeof shininess === 'number') || shininess === null)) {
12215             var __args = arguments;
12216             if (this.name === undefined) {
12217                 this.name = null;
12218             }
12219             if (this.key === undefined) {
12220                 this.key = null;
12221             }
12222             if (this.color === undefined) {
12223                 this.color = null;
12224             }
12225             if (this.texture === undefined) {
12226                 this.texture = null;
12227             }
12228             if (this.shininess === undefined) {
12229                 this.shininess = null;
12230             }
12231             this.name = name;
12232             this.key = key;
12233             this.color = color;
12234             this.texture = texture;
12235             this.shininess = shininess;
12236         }
12237         else if (((typeof name === 'string') || name === null) && ((typeof key === 'number') || key === null) && ((color != null && color instanceof HomeTexture) || color === null) && ((typeof texture === 'number') || texture === null) && shininess === undefined) {
12238             var __args = arguments;
12239             var color_8 = __args[1];
12240             var texture_1 = __args[2];
12241             var shininess_1 = __args[3];
12242             {
12243                 var __args_60 = arguments;
12244                 var key_1 = null;
12245                 if (this.name === undefined) {
12246                     this.name = null;
12247                 }
12248                 if (this.key === undefined) {
12249                     this.key = null;
12250                 }
12251                 if (this.color === undefined) {
12252                     this.color = null;
12253                 }
12254                 if (this.texture === undefined) {
12255                     this.texture = null;
12256                 }
12257                 if (this.shininess === undefined) {
12258                     this.shininess = null;
12259                 }
12260                 this.name = name;
12261                 this.key = key_1;
12262                 this.color = color_8;
12263                 this.texture = texture_1;
12264                 this.shininess = shininess_1;
12265             }
12266             if (this.name === undefined) {
12267                 this.name = null;
12268             }
12269             if (this.key === undefined) {
12270                 this.key = null;
12271             }
12272             if (this.color === undefined) {
12273                 this.color = null;
12274             }
12275             if (this.texture === undefined) {
12276                 this.texture = null;
12277             }
12278             if (this.shininess === undefined) {
12279                 this.shininess = null;
12280             }
12281         }
12282         else
12283             throw new Error('invalid overload');
12284     }
12285     /**
12286      * Returns the name of this material.
12287      * @return {string} the name of the material or <code>null</code> if material has no name.
12288      */
12289     HomeMaterial.prototype.getName = function () {
12290         return this.name;
12291     };
12292     /**
12293      * Returns the key of this material. If not <code>null</code>, this key should be used
12294      * as the unique identifier to find this material among the ones available on a model,
12295      * rather than the name of this material.
12296      * @return {string} the key of the material or <code>null</code> if material has no key.
12297      */
12298     HomeMaterial.prototype.getKey = function () {
12299         return this.key;
12300     };
12301     /**
12302      * Returns the color of this material.
12303      * @return {number} the color of the material as RGB code or <code>null</code> if material color is unchanged.
12304      */
12305     HomeMaterial.prototype.getColor = function () {
12306         return this.color;
12307     };
12308     /**
12309      * Returns the texture of this material.
12310      * @return {HomeTexture} the texture of the material or <code>null</code> if material texture is unchanged.
12311      */
12312     HomeMaterial.prototype.getTexture = function () {
12313         return this.texture;
12314     };
12315     /**
12316      * Returns the shininess of this material.
12317      * @return {number} a value between 0 (matt) and 1 (very shiny) or <code>null</code> if material shininess is unchanged.
12318      */
12319     HomeMaterial.prototype.getShininess = function () {
12320         return this.shininess;
12321     };
12322     /**
12323      * Returns <code>true</code> if this material is equal to <code>object</code>.
12324      * @param {Object} object
12325      * @return {boolean}
12326      */
12327     HomeMaterial.prototype.equals = function (object) {
12328         if (object != null && object instanceof HomeMaterial) {
12329             var material = object;
12330             return (material.name === this.name || (material.name != null && (material.name === this.name))) && (material.key === this.key || (material.key != null && (material.key === this.name))) && (material.color === this.color || (material.color != null && (material.color === this.color))) && (material.texture === this.texture || (material.texture != null && material.texture.equals(this.texture))) && (material.shininess === this.shininess || (material.shininess != null && (material.shininess === this.shininess)));
12331         }
12332         return false;
12333     };
12334     /**
12335      * Returns a hash code for this material.
12336      * @return {number}
12337      */
12338     HomeMaterial.prototype.hashCode = function () {
12339         var hashCode = 0;
12340         if (this.name != null) {
12341             hashCode += /* hashCode */ (function (o) { if (o.hashCode) {
12342                 return o.hashCode();
12343             }
12344             else {
12345                 return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
12346             } })(this.name);
12347         }
12348         if (this.key != null) {
12349             hashCode += /* hashCode */ (function (o) { if (o.hashCode) {
12350                 return o.hashCode();
12351             }
12352             else {
12353                 return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
12354             } })(this.key);
12355         }
12356         if (this.color != null) {
12357             hashCode += /* hashCode */ (function (o) { if (o.hashCode) {
12358                 return o.hashCode();
12359             }
12360             else {
12361                 return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
12362             } })(this.color);
12363         }
12364         if (this.texture != null) {
12365             hashCode += /* hashCode */ (function (o) { if (o.hashCode) {
12366                 return o.hashCode();
12367             }
12368             else {
12369                 return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
12370             } })(this.texture);
12371         }
12372         if (this.shininess != null) {
12373             hashCode += /* hashCode */ (function (o) { if (o.hashCode) {
12374                 return o.hashCode();
12375             }
12376             else {
12377                 return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0);
12378             } })(this.shininess);
12379         }
12380         return hashCode;
12381     };
12382     return HomeMaterial;
12383 }());
12384 HomeMaterial["__class"] = "com.eteks.sweethome3d.model.HomeMaterial";
12385 /**
12386  * Creates a window sash.
12387  * @param {number} xAxis
12388  * @param {number} yAxis
12389  * @param {number} width
12390  * @param {number} startAngle
12391  * @param {number} endAngle
12392  * @class
12393  * @author Emmanuel Puybaret
12394  */
12395 var Sash = /** @class */ (function () {
12396     function Sash(xAxis, yAxis, width, startAngle, endAngle) {
12397         if (this.xAxis === undefined) {
12398             this.xAxis = 0;
12399         }
12400         if (this.yAxis === undefined) {
12401             this.yAxis = 0;
12402         }
12403         if (this.width === undefined) {
12404             this.width = 0;
12405         }
12406         if (this.startAngle === undefined) {
12407             this.startAngle = 0;
12408         }
12409         if (this.endAngle === undefined) {
12410             this.endAngle = 0;
12411         }
12412         this.xAxis = xAxis;
12413         this.yAxis = yAxis;
12414         this.width = width;
12415         this.startAngle = startAngle;
12416         this.endAngle = endAngle;
12417     }
12418     /**
12419      * Returns the abscissa of the axis around which this sash turns, relatively to
12420      * the top left corner of the window or the door.
12421      * @return {number} a value in percentage of the width of the door or the window.
12422      */
12423     Sash.prototype.getXAxis = function () {
12424         return this.xAxis;
12425     };
12426     /**
12427      * Returns the ordinate of the axis around which this sash turns, relatively to
12428      * the top left corner of the window or the door.
12429      * @return {number} a value in percentage of the depth of the door or the window.
12430      */
12431     Sash.prototype.getYAxis = function () {
12432         return this.yAxis;
12433     };
12434     /**
12435      * Returns the width of this sash.
12436      * @return {number} a value in percentage of the width of the door or the window.
12437      */
12438     Sash.prototype.getWidth = function () {
12439         return this.width;
12440     };
12441     /**
12442      * Returns the opening start angle of this sash.
12443      * @return {number} an angle in radians.
12444      */
12445     Sash.prototype.getStartAngle = function () {
12446         return this.startAngle;
12447     };
12448     /**
12449      * Returns the opening end angle of this sash.
12450      * @return {number} an angle in radians.
12451      */
12452     Sash.prototype.getEndAngle = function () {
12453         return this.endAngle;
12454     };
12455     return Sash;
12456 }());
12457 Sash["__class"] = "com.eteks.sweethome3d.model.Sash";
12458 var PieceOfFurniture;
12459 (function (PieceOfFurniture) {
12460     /**
12461      * The default cut out shape that covers a 1 unit wide square.
12462      */
12463     PieceOfFurniture.DEFAULT_CUT_OUT_SHAPE = "M0,0 v1 h1 v-1 z";
12464     function IDENTITY_ROTATION_$LI$() { if (PieceOfFurniture.IDENTITY_ROTATION == null) {
12465         PieceOfFurniture.IDENTITY_ROTATION = [[1, 0, 0], [0, 1, 0], [0, 0, 1]];
12466     } return PieceOfFurniture.IDENTITY_ROTATION; }
12467     PieceOfFurniture.IDENTITY_ROTATION_$LI$ = IDENTITY_ROTATION_$LI$;
12468     ;
12469     /**
12470      * The flag used to specify that the back faces of a 3D model should be shown.
12471      */
12472     PieceOfFurniture.SHOW_BACK_FACE = 1;
12473     /**
12474      * The flag used to specify that the shapes of a 3D model which uses a material prefixed by "edge_color" should be hidden.
12475      */
12476     PieceOfFurniture.HIDE_EDGE_COLOR_MATERIAL = 2;
12477 })(PieceOfFurniture || (PieceOfFurniture = {}));
12478 /**
12479  * Creates the controller of home 3D view.
12480  * @param {Home} home the home edited by this controller and its view
12481  * @param {PlanController} planController
12482  * @param {UserPreferences} preferences
12483  * @param {Object} viewFactory
12484  * @param {Object} contentManager
12485  * @param {javax.swing.undo.UndoableEditSupport} undoSupport
12486  * @class
12487  * @author Emmanuel Puybaret
12488  */
12489 var HomeController3D = /** @class */ (function () {
12490     function HomeController3D(home, planController, preferences, viewFactory, contentManager, undoSupport) {
12491         var _this = this;
12492         if (((home != null && home instanceof Home) || home === null) && ((planController != null && planController instanceof PlanController) || planController === null) && ((preferences != null && preferences instanceof UserPreferences) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || viewFactory === null) && ((contentManager != null && (contentManager.constructor != null && contentManager.constructor["__interfaces"] != null && contentManager.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || contentManager === null) && ((undoSupport != null && undoSupport instanceof javax.swing.undo.UndoableEditSupport) || undoSupport === null)) {
12493             var __args = arguments;
12494             {
12495                 var __args_61 = arguments;
12496                 if (this.home === undefined) {
12497                     this.home = null;
12498                 }
12499                 if (this.preferences === undefined) {
12500                     this.preferences = null;
12501                 }
12502                 if (this.viewFactory === undefined) {
12503                     this.viewFactory = null;
12504                 }
12505                 if (this.contentManager === undefined) {
12506                     this.contentManager = null;
12507                 }
12508                 if (this.undoSupport === undefined) {
12509                     this.undoSupport = null;
12510                 }
12511                 if (this.planController === undefined) {
12512                     this.planController = null;
12513                 }
12514                 if (this.home3DView === undefined) {
12515                     this.home3DView = null;
12516                 }
12517                 if (this.topCameraState === undefined) {
12518                     this.topCameraState = null;
12519                 }
12520                 if (this.observerCameraState === undefined) {
12521                     this.observerCameraState = null;
12522                 }
12523                 if (this.cameraState === undefined) {
12524                     this.cameraState = null;
12525                 }
12526                 this.home = home;
12527                 this.preferences = preferences;
12528                 this.viewFactory = viewFactory;
12529                 this.contentManager = contentManager;
12530                 this.undoSupport = undoSupport;
12531                 this.topCameraState = new HomeController3D.TopCameraState(this, preferences);
12532                 this.observerCameraState = new HomeController3D.ObserverCameraState(this);
12533                 this.setCameraState(home.getCamera() === home.getTopCamera() ? this.topCameraState : this.observerCameraState);
12534                 this.addModelListeners(home);
12535             }
12536             if (this.home === undefined) {
12537                 this.home = null;
12538             }
12539             if (this.preferences === undefined) {
12540                 this.preferences = null;
12541             }
12542             if (this.viewFactory === undefined) {
12543                 this.viewFactory = null;
12544             }
12545             if (this.contentManager === undefined) {
12546                 this.contentManager = null;
12547             }
12548             if (this.undoSupport === undefined) {
12549                 this.undoSupport = null;
12550             }
12551             if (this.planController === undefined) {
12552                 this.planController = null;
12553             }
12554             if (this.home3DView === undefined) {
12555                 this.home3DView = null;
12556             }
12557             if (this.topCameraState === undefined) {
12558                 this.topCameraState = null;
12559             }
12560             if (this.observerCameraState === undefined) {
12561                 this.observerCameraState = null;
12562             }
12563             if (this.cameraState === undefined) {
12564                 this.cameraState = null;
12565             }
12566             (function () {
12567                 _this.planController = planController;
12568             })();
12569         }
12570         else if (((home != null && home instanceof Home) || home === null) && ((planController != null && planController instanceof UserPreferences) || planController === null) && ((preferences != null && (preferences.constructor != null && preferences.constructor["__interfaces"] != null && preferences.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || viewFactory === null) && ((contentManager != null && contentManager instanceof javax.swing.undo.UndoableEditSupport) || contentManager === null) && undoSupport === undefined) {
12571             var __args = arguments;
12572             var preferences_2 = __args[1];
12573             var viewFactory_1 = __args[2];
12574             var contentManager_1 = __args[3];
12575             var undoSupport_1 = __args[4];
12576             if (this.home === undefined) {
12577                 this.home = null;
12578             }
12579             if (this.preferences === undefined) {
12580                 this.preferences = null;
12581             }
12582             if (this.viewFactory === undefined) {
12583                 this.viewFactory = null;
12584             }
12585             if (this.contentManager === undefined) {
12586                 this.contentManager = null;
12587             }
12588             if (this.undoSupport === undefined) {
12589                 this.undoSupport = null;
12590             }
12591             if (this.planController === undefined) {
12592                 this.planController = null;
12593             }
12594             if (this.home3DView === undefined) {
12595                 this.home3DView = null;
12596             }
12597             if (this.topCameraState === undefined) {
12598                 this.topCameraState = null;
12599             }
12600             if (this.observerCameraState === undefined) {
12601                 this.observerCameraState = null;
12602             }
12603             if (this.cameraState === undefined) {
12604                 this.cameraState = null;
12605             }
12606             this.home = home;
12607             this.preferences = preferences_2;
12608             this.viewFactory = viewFactory_1;
12609             this.contentManager = contentManager_1;
12610             this.undoSupport = undoSupport_1;
12611             this.topCameraState = new HomeController3D.TopCameraState(this, preferences_2);
12612             this.observerCameraState = new HomeController3D.ObserverCameraState(this);
12613             this.setCameraState(home.getCamera() === home.getTopCamera() ? this.topCameraState : this.observerCameraState);
12614             this.addModelListeners(home);
12615         }
12616         else
12617             throw new Error('invalid overload');
12618     }
12619     /**
12620      * Add listeners to model to update camera position accordingly.
12621      * @param {Home} home
12622      * @private
12623      */
12624     HomeController3D.prototype.addModelListeners = function (home) {
12625         home.addPropertyChangeListener("CAMERA", new HomeController3D.HomeController3D$0(this, home));
12626         var levelElevationChangeListener = new HomeController3D.HomeController3D$1(this, home);
12627         var selectedLevel = home.getSelectedLevel();
12628         if (selectedLevel != null) {
12629             selectedLevel.addPropertyChangeListener(levelElevationChangeListener);
12630         }
12631         home.addPropertyChangeListener("SELECTED_LEVEL", new HomeController3D.HomeController3D$2(this, home, levelElevationChangeListener));
12632         var selectedLevelListener = new HomeController3D.HomeController3D$3(this, home);
12633         home.addPropertyChangeListener("SELECTED_LEVEL", selectedLevelListener);
12634         home.getEnvironment().addPropertyChangeListener("ALL_LEVELS_VISIBLE", selectedLevelListener);
12635     };
12636     HomeController3D.prototype.getObserverCameraMinimumElevation = function (home) {
12637         var levels = home.getLevels();
12638         var minimumElevation = levels.length === 0 ? 10 : 10 + /* get */ levels[0].getElevation();
12639         return minimumElevation;
12640     };
12641     /**
12642      * Returns the view associated with this controller.
12643      * @return {Object}
12644      */
12645     HomeController3D.prototype.getView = function () {
12646         if (this.home3DView == null) {
12647             this.home3DView = this.viewFactory.createView3D(this.home, this.preferences, this);
12648         }
12649         return this.home3DView;
12650     };
12651     /**
12652      * Changes home camera for {@link Home#getTopCamera() top camera}.
12653      */
12654     HomeController3D.prototype.viewFromTop = function () {
12655         this.home.setCamera(this.home.getTopCamera());
12656     };
12657     /**
12658      * Changes home camera for {@link Home#getObserverCamera() observer camera}.
12659      */
12660     HomeController3D.prototype.viewFromObserver = function () {
12661         this.home.setCamera(this.home.getObserverCamera());
12662     };
12663     /**
12664      * Stores a clone of the current camera in home under the given <code>name</code>.
12665      * @param {string} name
12666      */
12667     HomeController3D.prototype.storeCamera = function (name) {
12668         var camera = this.home.getCamera().duplicate();
12669         camera.setName(name);
12670         var homeStoredCameras = this.home.getStoredCameras();
12671         var storedCameras = ([]);
12672         /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(storedCameras, homeStoredCameras);
12673         for (var i = storedCameras.length - 1; i >= 0; i--) {
12674             {
12675                 var storedCamera = storedCameras[i];
12676                 if ((name === storedCamera.getName()) || (camera.getX() === storedCamera.getX() && camera.getY() === storedCamera.getY() && camera.getZ() === storedCamera.getZ() && camera.getPitch() === storedCamera.getPitch() && camera.getYaw() === storedCamera.getYaw() && camera.getFieldOfView() === storedCamera.getFieldOfView() && camera.getTime() === storedCamera.getTime() && camera.getLens() === storedCamera.getLens() && (camera.getRenderer() === storedCamera.getRenderer() || camera.getRenderer() != null && (camera.getRenderer() === storedCamera.getRenderer())))) {
12677                     /* remove */ storedCameras.splice(i, 1)[0];
12678                 }
12679             }
12680             ;
12681         }
12682         /* add */ storedCameras.splice(0, 0, camera);
12683         while (( /* size */storedCameras.length > this.preferences.getStoredCamerasMaxCount())) {
12684             {
12685                 /* remove */ storedCameras.splice(/* size */ storedCameras.length - 1, 1)[0];
12686             }
12687         }
12688         ;
12689         this.home.setStoredCameras(storedCameras);
12690     };
12691     /**
12692      * Switches to observer or top camera and move camera to the values as the current camera.
12693      * @param {Camera} camera
12694      */
12695     HomeController3D.prototype.goToCamera = function (camera) {
12696         if (camera != null && camera instanceof ObserverCamera) {
12697             this.viewFromObserver();
12698         }
12699         else {
12700             this.viewFromTop();
12701         }
12702         this.cameraState.goToCamera(camera);
12703         var storedCameras = (this.home.getStoredCameras().slice(0));
12704         /* remove */ (function (a) { var index = a.indexOf(camera); if (index >= 0) {
12705             a.splice(index, 1);
12706             return true;
12707         }
12708         else {
12709             return false;
12710         } })(storedCameras);
12711         /* add */ storedCameras.splice(0, 0, camera);
12712         this.home.setStoredCameras(storedCameras);
12713     };
12714     /**
12715      * Deletes the given list of cameras from the ones stored in home.
12716      * @param {Camera[]} cameras
12717      */
12718     HomeController3D.prototype.deleteCameras = function (cameras) {
12719         var homeStoredCameras = this.home.getStoredCameras();
12720         var storedCameras = ([]);
12721         for (var index = 0; index < homeStoredCameras.length; index++) {
12722             var camera = homeStoredCameras[index];
12723             {
12724                 if (!(cameras.indexOf((camera)) >= 0)) {
12725                     /* add */ (storedCameras.push(camera) > 0);
12726                 }
12727             }
12728         }
12729         this.home.setStoredCameras(storedCameras);
12730     };
12731     /**
12732      * Makes all levels visible.
12733      */
12734     HomeController3D.prototype.displayAllLevels = function () {
12735         this.home.getEnvironment().setAllLevelsVisible(true);
12736     };
12737     /**
12738      * Makes the selected level and below visible.
12739      */
12740     HomeController3D.prototype.displaySelectedLevel = function () {
12741         this.home.getEnvironment().setAllLevelsVisible(false);
12742     };
12743     /**
12744      * Controls the edition of 3D attributes.
12745      */
12746     HomeController3D.prototype.modifyAttributes = function () {
12747         new Home3DAttributesController(this.home, this.preferences, this.viewFactory, this.contentManager, this.undoSupport).displayView(this.getView());
12748     };
12749     /**
12750      * Changes current state of controller.
12751      * @param {HomeController3D.CameraControllerState} state
12752      */
12753     HomeController3D.prototype.setCameraState = function (state) {
12754         if (this.cameraState != null) {
12755             this.cameraState.exit();
12756         }
12757         this.cameraState = state;
12758         this.cameraState.enter();
12759     };
12760     /**
12761      * Moves home camera of <code>delta</code>.
12762      * @param {number} delta  the value in cm that the camera should move forward
12763      * (with a negative delta) or backward (with a positive delta)
12764      */
12765     HomeController3D.prototype.moveCamera = function (delta) {
12766         this.cameraState.moveCamera(delta);
12767     };
12768     /**
12769      * Moves home camera sideways of <code>delta</code>.
12770      * @param {number} delta  the value in cm that the camera should move left
12771      * (with a negative delta) or right (with a positive delta)
12772      */
12773     HomeController3D.prototype.moveCameraSideways = function (delta) {
12774         this.cameraState.moveCameraSideways(delta);
12775     };
12776     /**
12777      * Elevates home camera of <code>delta</code>.
12778      * @param {number} delta the value in cm that the camera should move down
12779      * (with a negative delta) or up (with a positive delta)
12780      */
12781     HomeController3D.prototype.elevateCamera = function (delta) {
12782         this.cameraState.elevateCamera(delta);
12783     };
12784     /**
12785      * Rotates home camera yaw angle of <code>delta</code> radians.
12786      * @param {number} delta  the value in rad that the camera should turn around yaw axis
12787      */
12788     HomeController3D.prototype.rotateCameraYaw = function (delta) {
12789         this.cameraState.rotateCameraYaw(delta);
12790     };
12791     /**
12792      * Rotates home camera pitch angle of <code>delta</code> radians.
12793      * @param {number} delta  the value in rad that the camera should turn around pitch axis
12794      */
12795     HomeController3D.prototype.rotateCameraPitch = function (delta) {
12796         this.cameraState.rotateCameraPitch(delta);
12797     };
12798     /**
12799      * Modifies home camera field of view of <code>delta</code>.
12800      * @param {number} delta  the value in rad that should be added the field of view
12801      * to get a narrower view (with a negative delta) or a wider view (with a positive delta)
12802      */
12803     HomeController3D.prototype.modifyFieldOfView = function (delta) {
12804         this.cameraState.modifyFieldOfView(delta);
12805     };
12806     /**
12807      * Processes a mouse button pressed event.
12808      * @param {number} x
12809      * @param {number} y
12810      * @param {number} clickCount
12811      * @param {boolean} shiftDown
12812      * @param {boolean} alignmentActivated
12813      * @param {boolean} duplicationActivated
12814      * @param {boolean} magnetismToggled
12815      * @param {View.PointerType} pointerType
12816      */
12817     HomeController3D.prototype.pressMouse = function (x, y, clickCount, shiftDown, alignmentActivated, duplicationActivated, magnetismToggled, pointerType) {
12818         this.cameraState.pressMouse(x, y, clickCount, shiftDown, alignmentActivated, duplicationActivated, magnetismToggled, pointerType);
12819     };
12820     /**
12821      * Processes a mouse button released event.
12822      * @param {number} x
12823      * @param {number} y
12824      */
12825     HomeController3D.prototype.releaseMouse = function (x, y) {
12826         this.cameraState.releaseMouse(x, y);
12827     };
12828     /**
12829      * Processes a mouse button moved event.
12830      * @param {number} x
12831      * @param {number} y
12832      */
12833     HomeController3D.prototype.moveMouse = function (x, y) {
12834         this.cameraState.moveMouse(x, y);
12835     };
12836     /**
12837      * Returns <code>true</code> if this controller is moving items.
12838      * @return {boolean}
12839      */
12840     HomeController3D.prototype.isEditingState = function () {
12841         return this.cameraState.isEditingState();
12842     };
12843     /**
12844      * Escapes of current editing action.
12845      */
12846     HomeController3D.prototype.escape = function () {
12847         this.cameraState.escape();
12848     };
12849     /**
12850      * Toggles temporary magnetism feature of user preferences during editing action.
12851      * @param {boolean} magnetismToggled if <code>true</code> then magnetism feature is toggled.
12852      */
12853     HomeController3D.prototype.toggleMagnetism = function (magnetismToggled) {
12854         this.cameraState.toggleMagnetism(magnetismToggled);
12855     };
12856     /**
12857      * Activates or deactivates alignment feature during editing action.
12858      * @param {boolean} alignmentActivated if <code>true</code> then alignment is active.
12859      */
12860     HomeController3D.prototype.setAlignmentActivated = function (alignmentActivated) {
12861         this.cameraState.setAlignmentActivated(alignmentActivated);
12862     };
12863     /**
12864      * Activates or deactivates duplication feature during editing action.
12865      * @param {boolean} duplicationActivated if <code>true</code> then duplication is active.
12866      */
12867     HomeController3D.prototype.setDuplicationActivated = function (duplicationActivated) {
12868         this.cameraState.setDuplicationActivated(duplicationActivated);
12869     };
12870     /**
12871      * Returns the observer camera state.
12872      * @return {HomeController3D.CameraControllerState}
12873      */
12874     HomeController3D.prototype.getObserverCameraState = function () {
12875         return this.observerCameraState;
12876     };
12877     /**
12878      * Returns the top camera state.
12879      * @return {HomeController3D.CameraControllerState}
12880      */
12881     HomeController3D.prototype.getTopCameraState = function () {
12882         return this.topCameraState;
12883     };
12884     return HomeController3D;
12885 }());
12886 HomeController3D["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeController3D";
12887 HomeController3D["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
12888 (function (HomeController3D) {
12889     /**
12890      * Controller state classes super class.
12891      * @class
12892      */
12893     var CameraControllerState = /** @class */ (function () {
12894         function CameraControllerState() {
12895         }
12896         CameraControllerState.prototype.enter = function () {
12897         };
12898         CameraControllerState.prototype.exit = function () {
12899         };
12900         CameraControllerState.prototype.moveCamera = function (delta) {
12901         };
12902         CameraControllerState.prototype.moveCameraSideways = function (delta) {
12903         };
12904         CameraControllerState.prototype.elevateCamera = function (delta) {
12905         };
12906         CameraControllerState.prototype.rotateCameraYaw = function (delta) {
12907         };
12908         CameraControllerState.prototype.rotateCameraPitch = function (delta) {
12909         };
12910         CameraControllerState.prototype.modifyFieldOfView = function (delta) {
12911         };
12912         CameraControllerState.prototype.goToCamera = function (camera) {
12913         };
12914         CameraControllerState.prototype.isEditingState = function () {
12915             return false;
12916         };
12917         CameraControllerState.prototype.pressMouse = function (x, y, clickCount, shiftDown, alignmentActivated, duplicationActivated, magnetismToggled, pointerType) {
12918         };
12919         CameraControllerState.prototype.releaseMouse = function (x, y) {
12920         };
12921         CameraControllerState.prototype.moveMouse = function (x, y) {
12922         };
12923         CameraControllerState.prototype.escape = function () {
12924         };
12925         CameraControllerState.prototype.toggleMagnetism = function (magnetismToggled) {
12926         };
12927         CameraControllerState.prototype.setAlignmentActivated = function (alignmentActivated) {
12928         };
12929         CameraControllerState.prototype.setDuplicationActivated = function (duplicationActivated) {
12930         };
12931         CameraControllerState.prototype.setEditionActivated = function (editionActivated) {
12932         };
12933         return CameraControllerState;
12934     }());
12935     HomeController3D.CameraControllerState = CameraControllerState;
12936     CameraControllerState["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeController3D.CameraControllerState";
12937     /**
12938      * Preferences property listener bound to top camera state with a weak reference to avoid
12939      * strong link between user preferences and top camera state.
12940      * @param {HomeController3D.TopCameraState} topCameraState
12941      * @class
12942      */
12943     var UserPreferencesChangeListener = /** @class */ (function () {
12944         function UserPreferencesChangeListener(topCameraState) {
12945             if (this.topCameraState === undefined) {
12946                 this.topCameraState = null;
12947             }
12948             this.topCameraState = (topCameraState);
12949         }
12950         UserPreferencesChangeListener.prototype.propertyChange = function (ev) {
12951             var topCameraState = this.topCameraState;
12952             var preferences = ev.getSource();
12953             if (topCameraState == null) {
12954                 preferences.removePropertyChangeListener(/* valueOf */ ev.getPropertyName(), this);
12955             }
12956             else {
12957                 topCameraState.setAerialViewCenteredOnSelectionEnabled(preferences.isAerialViewCenteredOnSelectionEnabled());
12958             }
12959         };
12960         return UserPreferencesChangeListener;
12961     }());
12962     HomeController3D.UserPreferencesChangeListener = UserPreferencesChangeListener;
12963     UserPreferencesChangeListener["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeController3D.UserPreferencesChangeListener";
12964     /**
12965      * Controller state handling mouse events to edit home items.
12966      * @extends HomeController3D.CameraControllerState
12967      * @class
12968      */
12969     var EditingCameraState = /** @class */ (function (_super) {
12970         __extends(EditingCameraState, _super);
12971         function EditingCameraState(__parent) {
12972             var _this = _super.call(this) || this;
12973             _this.__parent = __parent;
12974             if (_this.cameraMoved === undefined) {
12975                 _this.cameraMoved = false;
12976             }
12977             if (_this.mouseMoved === undefined) {
12978                 _this.mouseMoved = false;
12979             }
12980             if (_this.elevationActivated === undefined) {
12981                 _this.elevationActivated = false;
12982             }
12983             if (_this.rotationActivated === undefined) {
12984                 _this.rotationActivated = false;
12985             }
12986             if (_this.lastMousePressedPoint3D === undefined) {
12987                 _this.lastMousePressedPoint3D = null;
12988             }
12989             if (_this.distancesRatio === undefined) {
12990                 _this.distancesRatio = 0;
12991             }
12992             if (_this.yLastMousePress === undefined) {
12993                 _this.yLastMousePress = 0;
12994             }
12995             if (_this.angleMousePress === undefined) {
12996                 _this.angleMousePress = null;
12997             }
12998             if (_this.alignmentActivated === undefined) {
12999                 _this.alignmentActivated = false;
13000             }
13001             if (_this.duplicationActivated === undefined) {
13002                 _this.duplicationActivated = false;
13003             }
13004             if (_this.magnetismToggled === undefined) {
13005                 _this.magnetismToggled = false;
13006             }
13007             if (_this.pointerType === undefined) {
13008                 _this.pointerType = null;
13009             }
13010             if (_this.movedItems === undefined) {
13011                 _this.movedItems = null;
13012             }
13013             if (_this.closestMovedPiece === undefined) {
13014                 _this.closestMovedPiece = null;
13015             }
13016             if (_this.movedItemsStartPoint === undefined) {
13017                 _this.movedItemsStartPoint = null;
13018             }
13019             if (_this.movedItemsDeltaX === undefined) {
13020                 _this.movedItemsDeltaX = null;
13021             }
13022             if (_this.movedItemsDeltaY === undefined) {
13023                 _this.movedItemsDeltaY = null;
13024             }
13025             return _this;
13026         }
13027         /**
13028          * Returns <code>true</code> if this controller is moving items.
13029          * @return {boolean}
13030          */
13031         EditingCameraState.prototype.isEditingState = function () {
13032             return this.movedItems != null;
13033         };
13034         EditingCameraState.prototype.moveCamera = function (delta) {
13035             this.cameraMoved = true;
13036         };
13037         EditingCameraState.prototype.moveCameraSideways = function (delta) {
13038             this.cameraMoved = true;
13039         };
13040         EditingCameraState.prototype.elevateCamera = function (delta) {
13041             this.cameraMoved = true;
13042         };
13043         EditingCameraState.prototype.rotateCameraYaw = function (delta) {
13044             this.cameraMoved = true;
13045         };
13046         EditingCameraState.prototype.rotateCameraPitch = function (delta) {
13047             this.cameraMoved = true;
13048         };
13049         EditingCameraState.prototype.modifyFieldOfView = function (delta) {
13050             this.cameraMoved = true;
13051         };
13052         EditingCameraState.prototype.goToCamera = function (camera) {
13053             this.cameraMoved = true;
13054         };
13055         /**
13056          * Processes a mouse button pressed event.
13057          * @param {number} x
13058          * @param {number} y
13059          * @param {number} clickCount
13060          * @param {boolean} shiftDown
13061          * @param {boolean} alignmentActivated
13062          * @param {boolean} duplicationActivated
13063          * @param {boolean} magnetismToggled
13064          * @param {View.PointerType} pointerType
13065          */
13066         EditingCameraState.prototype.pressMouse = function (x, y, clickCount, shiftDown, alignmentActivated, duplicationActivated, magnetismToggled, pointerType) {
13067             if (this.__parent.planController != null && this.__parent.preferences.isEditingIn3DViewEnabled() && (this.__parent.getView() != null && (this.__parent.getView().constructor != null && this.__parent.getView().constructor["__interfaces"] != null && this.__parent.getView().constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.View3D") >= 0)) && !this.__parent.planController.isModificationState()) {
13068                 if (clickCount === 1) {
13069                     var closestItem = this.__parent.getView().getClosestSelectableItemAt(Math.round(x), Math.round(y));
13070                     var allSelectedItems = ([]);
13071                     var selectedItems = this.__parent.home.getSelectedItems();
13072                     for (var index = 0; index < selectedItems.length; index++) {
13073                         var item = selectedItems[index];
13074                         {
13075                             if (item != null && item instanceof HomeFurnitureGroup) {
13076                                 /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(allSelectedItems, item.getAllFurniture());
13077                             }
13078                             else {
13079                                 /* add */ (allSelectedItems.push(item) > 0);
13080                             }
13081                         }
13082                     }
13083                     if ( /* contains */(allSelectedItems.indexOf((closestItem)) >= 0) && this.__parent.planController.isItemMovable(closestItem) && (closestItem != null && closestItem instanceof HomePieceOfFurniture)) {
13084                         this.movedItems = ([]);
13085                         for (var index = 0; index < selectedItems.length; index++) {
13086                             var item = selectedItems[index];
13087                             {
13088                                 if (this.__parent.planController.isItemMovable(item) && (item != null && item instanceof HomePieceOfFurniture)) {
13089                                     /* add */ (this.movedItems.push(item) > 0);
13090                                 }
13091                             }
13092                         }
13093                         this.elevationActivated = !alignmentActivated && duplicationActivated;
13094                         this.rotationActivated = alignmentActivated && duplicationActivated;
13095                         if ((this.elevationActivated || this.rotationActivated) && (closestItem != null && closestItem instanceof HomePieceOfFurniture)) {
13096                             if ( /* size */selectedItems.length > 1) {
13097                                 this.elevationActivated = false;
13098                                 this.rotationActivated = false;
13099                             }
13100                         }
13101                         if (this.movedItems != null) {
13102                             this.closestMovedPiece = closestItem;
13103                             var elevationLastMousePressed = this.closestMovedPiece.getGroundElevation() + this.closestMovedPiece.getHeightInPlan() / 2 * Math.cos(this.__parent.home.getCamera().getPitch());
13104                             this.lastMousePressedPoint3D = this.__parent.getView().convertPixelLocationToVirtualWorld(Math.round(x), Math.round(y));
13105                             var cameraToClosestPieceDistance = Math.sqrt((this.__parent.home.getCamera().getX() - this.closestMovedPiece.getX()) * (this.__parent.home.getCamera().getX() - this.closestMovedPiece.getX()) + (this.__parent.home.getCamera().getY() - this.closestMovedPiece.getY()) * (this.__parent.home.getCamera().getY() - this.closestMovedPiece.getY()) + (this.__parent.home.getCamera().getZ() - elevationLastMousePressed) * (this.__parent.home.getCamera().getZ() - elevationLastMousePressed));
13106                             var cameraToMousePressedPoint3DDistance = Math.sqrt((this.__parent.home.getCamera().getX() - this.lastMousePressedPoint3D[0]) * (this.__parent.home.getCamera().getX() - this.lastMousePressedPoint3D[0]) + (this.__parent.home.getCamera().getY() - this.lastMousePressedPoint3D[1]) * (this.__parent.home.getCamera().getY() - this.lastMousePressedPoint3D[1]) + (this.__parent.home.getCamera().getZ() - this.lastMousePressedPoint3D[2]) * (this.__parent.home.getCamera().getZ() - this.lastMousePressedPoint3D[2]));
13107                             this.distancesRatio = cameraToClosestPieceDistance / cameraToMousePressedPoint3DDistance;
13108                         }
13109                         this.movedItemsDeltaX = null;
13110                         this.movedItemsDeltaY = null;
13111                     }
13112                 }
13113                 else if (clickCount === 2 && !(this.__parent.home.getSelectedItems().length == 0)) {
13114                     this.__parent.planController.modifySelectedItem();
13115                 }
13116                 this.mouseMoved = false;
13117                 this.cameraMoved = false;
13118                 this.yLastMousePress = y;
13119                 this.alignmentActivated = alignmentActivated;
13120                 this.duplicationActivated = duplicationActivated;
13121                 this.magnetismToggled = magnetismToggled;
13122                 this.pointerType = pointerType;
13123             }
13124         };
13125         /**
13126          * Processes a mouse button released event.
13127          * @param {number} x
13128          * @param {number} y
13129          */
13130         EditingCameraState.prototype.releaseMouse = function (x, y) {
13131             if (this.__parent.planController != null && this.__parent.preferences.isEditingIn3DViewEnabled() && (this.__parent.getView() != null && (this.__parent.getView().constructor != null && this.__parent.getView().constructor["__interfaces"] != null && this.__parent.getView().constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.View3D") >= 0))) {
13132                 if (this.movedItems != null && this.movedItemsDeltaY != null) {
13133                     this.__parent.planController.releaseMouse(this.movedItemsStartPoint[0] + this.movedItemsDeltaX, this.movedItemsStartPoint[1] + this.movedItemsDeltaY);
13134                     this.__parent.planController.setFeedbackDisplayed(true);
13135                 }
13136                 else if (!this.__parent.planController.isModificationState() && !this.mouseMoved && !this.cameraMoved) {
13137                     var item = this.__parent.getView().getClosestSelectableItemAt(Math.round(x), Math.round(y));
13138                     if (item != null && this.__parent.home.isBasePlanLocked() && this.__parent.planController.isItemPartOfBasePlan(item)) {
13139                         item = null;
13140                     }
13141                     if (this.alignmentActivated) {
13142                         if (item != null) {
13143                             var selectedItems = (this.__parent.home.getSelectedItems().slice(0));
13144                             if ( /* contains */(selectedItems.indexOf((item)) >= 0)) {
13145                                 this.__parent.home.deselectItem(item);
13146                             }
13147                             else {
13148                                 /* add */ (selectedItems.push(item) > 0);
13149                                 this.__parent.home.setSelectedItems(selectedItems);
13150                             }
13151                         }
13152                     }
13153                     else {
13154                         if (item != null) {
13155                             this.__parent.home.setSelectedItems(/* asList */ [item]);
13156                         }
13157                         else {
13158                             var selectedItems = [];
13159                             this.__parent.home.setSelectedItems(selectedItems);
13160                         }
13161                     }
13162                 }
13163                 this.movedItems = null;
13164                 this.closestMovedPiece = null;
13165                 this.elevationActivated = false;
13166                 this.rotationActivated = false;
13167             }
13168         };
13169         /**
13170          * Processes a mouse button moved event.
13171          * @param {number} x
13172          * @param {number} y
13173          */
13174         EditingCameraState.prototype.moveMouse = function (x, y) {
13175             if (this.__parent.planController != null && this.__parent.preferences.isEditingIn3DViewEnabled() && this.movedItems != null) {
13176                 if (this.movedItemsDeltaY == null) {
13177                     this.movedItemsStartPoint = this.rotationActivated ? /* get */ this.movedItems[0].getPoints()[0] : [this.closestMovedPiece.getX(), this.closestMovedPiece.getY()];
13178                     this.angleMousePress = null;
13179                     this.__parent.planController.setFeedbackDisplayed(false);
13180                     this.__parent.planController.moveMouse(this.movedItemsStartPoint[0], this.movedItemsStartPoint[1]);
13181                     this.__parent.planController.pressMouse$float$float$int$boolean$boolean$boolean$boolean(this.movedItemsStartPoint[0], this.movedItemsStartPoint[1], 1, false, false, this.duplicationActivated, this.magnetismToggled);
13182                     if (this.elevationActivated) {
13183                         this.__parent.planController.setState(this.__parent.planController.getPieceOfFurnitureElevationState());
13184                     }
13185                     else if (this.rotationActivated) {
13186                         this.__parent.planController.setState(this.__parent.planController.getPieceOfFurnitureRotationState());
13187                     }
13188                     else {
13189                         this.__parent.home.setSelectedItems(this.movedItems);
13190                         this.__parent.planController.setState(this.__parent.planController.getSelectionMoveState());
13191                         this.__parent.planController.setAlignmentActivated(this.alignmentActivated);
13192                     }
13193                 }
13194                 if (this.rotationActivated && this.angleMousePress == null) {
13195                     this.angleMousePress = Math.atan2(this.movedItemsStartPoint[1] - /* get */ this.movedItems[0].getY(), this.movedItemsStartPoint[0] - /* get */ this.movedItems[0].getX());
13196                     if (this.pointerType === View.PointerType.TOUCH) {
13197                         this.lastMousePressedPoint3D = this.__parent.getView().convertPixelLocationToVirtualWorld(Math.round(x), Math.round(y));
13198                     }
13199                 }
13200                 var point = this.__parent.getView().convertPixelLocationToVirtualWorld(Math.round(x), Math.round(y));
13201                 if (this.rotationActivated) {
13202                     var newAngle = this.angleMousePress - (point[0] - this.lastMousePressedPoint3D[0]) * this.distancesRatio / 50;
13203                     var indicatorCenterDistance = java.awt.geom.Point2D.distance(/* get */ this.movedItems[0].getX(), /* get */ this.movedItems[0].getY(), this.movedItemsStartPoint[0], this.movedItemsStartPoint[1]);
13204                     this.movedItemsDeltaX = /* get */ this.movedItems[0].getX() + indicatorCenterDistance * Math.cos(newAngle) - this.movedItemsStartPoint[0];
13205                     this.movedItemsDeltaY = /* get */ this.movedItems[0].getY() + indicatorCenterDistance * Math.sin(newAngle) - this.movedItemsStartPoint[1];
13206                 }
13207                 else if (this.elevationActivated) {
13208                     this.movedItemsDeltaX = 0.0;
13209                     this.movedItemsDeltaY = (this.lastMousePressedPoint3D[2] - point[2]) * this.distancesRatio + (y - this.yLastMousePress) * (1 - Math.cos(this.__parent.home.getCamera().getPitch()));
13210                 }
13211                 else {
13212                     this.movedItemsDeltaX = (point[0] - this.lastMousePressedPoint3D[0]) * this.distancesRatio;
13213                     this.movedItemsDeltaY = (point[1] - this.lastMousePressedPoint3D[1]) * this.distancesRatio;
13214                 }
13215                 this.__parent.planController.moveMouse(this.movedItemsStartPoint[0] + this.movedItemsDeltaX, this.movedItemsStartPoint[1] + this.movedItemsDeltaY);
13216             }
13217             this.mouseMoved = true;
13218         };
13219         /**
13220          * Escapes of current editing action.
13221          */
13222         EditingCameraState.prototype.escape = function () {
13223             if (this.__parent.planController != null && this.__parent.preferences.isEditingIn3DViewEnabled()) {
13224                 this.movedItems = null;
13225                 this.__parent.planController.escape();
13226             }
13227         };
13228         /**
13229          * Toggles temporary magnetism feature of user preferences during editing action.
13230          * @param {boolean} magnetismToggled if <code>true</code> then magnetism feature is toggled.
13231          */
13232         EditingCameraState.prototype.toggleMagnetism = function (magnetismToggled) {
13233             if (this.__parent.planController != null && this.__parent.preferences.isEditingIn3DViewEnabled()) {
13234                 this.magnetismToggled = magnetismToggled;
13235                 this.__parent.planController.toggleMagnetism(magnetismToggled);
13236             }
13237         };
13238         /**
13239          * Activates or deactivates alignment feature during editing action.
13240          * @param {boolean} alignmentActivated if <code>true</code> then alignment is active.
13241          */
13242         EditingCameraState.prototype.setAlignmentActivated = function (alignmentActivated) {
13243             if (this.__parent.planController != null && this.__parent.preferences.isEditingIn3DViewEnabled()) {
13244                 if (this.pointerType === View.PointerType.TOUCH && alignmentActivated && /* size */ this.__parent.home.getSelectedItems().length === 1 && !this.mouseMoved) {
13245                     this.elevationActivated = true;
13246                     this.rotationActivated = false;
13247                 }
13248                 this.alignmentActivated = alignmentActivated;
13249                 this.__parent.planController.setAlignmentActivated(alignmentActivated);
13250             }
13251         };
13252         /**
13253          * Activates or deactivates duplication feature during editing action.
13254          * @param {boolean} duplicationActivated if <code>true</code> then duplication is active.
13255          */
13256         EditingCameraState.prototype.setDuplicationActivated = function (duplicationActivated) {
13257             if (this.__parent.planController != null && this.__parent.preferences.isEditingIn3DViewEnabled()) {
13258                 if (this.pointerType === View.PointerType.TOUCH && duplicationActivated && /* size */ this.__parent.home.getSelectedItems().length === 1) {
13259                     if (this.elevationActivated && !this.mouseMoved) {
13260                         this.elevationActivated = false;
13261                         this.rotationActivated = true;
13262                     }
13263                     else {
13264                         this.movedItemsStartPoint[0] += this.movedItemsDeltaX;
13265                         this.movedItemsStartPoint[1] += this.movedItemsDeltaY;
13266                         this.angleMousePress = null;
13267                     }
13268                 }
13269                 this.duplicationActivated = duplicationActivated;
13270                 if (!this.elevationActivated) {
13271                     this.__parent.planController.setDuplicationActivated(duplicationActivated);
13272                 }
13273             }
13274         };
13275         return EditingCameraState;
13276     }(HomeController3D.CameraControllerState));
13277     HomeController3D.EditingCameraState = EditingCameraState;
13278     EditingCameraState["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeController3D.EditingCameraState";
13279     /**
13280      * Top camera controller state.
13281      * @param {UserPreferences} preferences
13282      * @class
13283      * @extends HomeController3D.EditingCameraState
13284      */
13285     var TopCameraState = /** @class */ (function (_super) {
13286         __extends(TopCameraState, _super);
13287         function TopCameraState(__parent, preferences) {
13288             var _this = _super.call(this, __parent) || this;
13289             _this.__parent = __parent;
13290             _this.MIN_WIDTH = 100;
13291             _this.MIN_DEPTH = _this.MIN_WIDTH;
13292             _this.MIN_HEIGHT = 20;
13293             if (_this.topCamera === undefined) {
13294                 _this.topCamera = null;
13295             }
13296             if (_this.aerialViewBoundsLowerPoint === undefined) {
13297                 _this.aerialViewBoundsLowerPoint = null;
13298             }
13299             if (_this.aerialViewBoundsUpperPoint === undefined) {
13300                 _this.aerialViewBoundsUpperPoint = null;
13301             }
13302             if (_this.minDistanceToAerialViewCenter === undefined) {
13303                 _this.minDistanceToAerialViewCenter = 0;
13304             }
13305             if (_this.maxDistanceToAerialViewCenter === undefined) {
13306                 _this.maxDistanceToAerialViewCenter = 0;
13307             }
13308             if (_this.aerialViewCenteredOnSelectionEnabled === undefined) {
13309                 _this.aerialViewCenteredOnSelectionEnabled = false;
13310             }
13311             if (_this.previousSelectionEmpty === undefined) {
13312                 _this.previousSelectionEmpty = false;
13313             }
13314             _this.distanceToCenterWithSelection = -1;
13315             _this.objectChangeListener = new TopCameraState.TopCameraState$0(_this);
13316             _this.levelsListener = function (ev) {
13317                 if (ev.getType() === CollectionEvent.Type.ADD) {
13318                     ev.getItem().addPropertyChangeListener(_this.objectChangeListener);
13319                 }
13320                 else if (ev.getType() === CollectionEvent.Type.DELETE) {
13321                     ev.getItem().removePropertyChangeListener(_this.objectChangeListener);
13322                 }
13323                 _this.updateCameraFromHomeBounds(false, false);
13324             };
13325             _this.wallsListener = function (ev) {
13326                 if (ev.getType() === CollectionEvent.Type.ADD) {
13327                     ev.getItem().addPropertyChangeListener(_this.objectChangeListener);
13328                 }
13329                 else if (ev.getType() === CollectionEvent.Type.DELETE) {
13330                     ev.getItem().removePropertyChangeListener(_this.objectChangeListener);
13331                 }
13332                 _this.updateCameraFromHomeBounds(false, false);
13333             };
13334             _this.furnitureListener = function (ev) {
13335                 if (ev.getType() === CollectionEvent.Type.ADD) {
13336                     _this.addPropertyChangeListener(ev.getItem(), _this.objectChangeListener);
13337                     _this.updateCameraFromHomeBounds(/* size */ __parent.home.getFurniture().length === 1 && /* isEmpty */ (__parent.home.getWalls().length == 0) && /* isEmpty */ (__parent.home.getRooms().length == 0), false);
13338                 }
13339                 else if (ev.getType() === CollectionEvent.Type.DELETE) {
13340                     _this.removePropertyChangeListener(ev.getItem(), _this.objectChangeListener);
13341                     _this.updateCameraFromHomeBounds(false, false);
13342                 }
13343             };
13344             _this.roomsListener = function (ev) {
13345                 if (ev.getType() === CollectionEvent.Type.ADD) {
13346                     ev.getItem().addPropertyChangeListener(_this.objectChangeListener);
13347                 }
13348                 else if (ev.getType() === CollectionEvent.Type.DELETE) {
13349                     ev.getItem().removePropertyChangeListener(_this.objectChangeListener);
13350                 }
13351                 _this.updateCameraFromHomeBounds(false, false);
13352             };
13353             _this.polylinesListener = function (ev) {
13354                 if (ev.getType() === CollectionEvent.Type.ADD) {
13355                     ev.getItem().addPropertyChangeListener(_this.objectChangeListener);
13356                 }
13357                 else if (ev.getType() === CollectionEvent.Type.DELETE) {
13358                     ev.getItem().removePropertyChangeListener(_this.objectChangeListener);
13359                 }
13360                 _this.updateCameraFromHomeBounds(false, false);
13361             };
13362             _this.dimensionLinesListener = function (ev) {
13363                 if (ev.getType() === CollectionEvent.Type.ADD) {
13364                     ev.getItem().addPropertyChangeListener(_this.objectChangeListener);
13365                 }
13366                 else if (ev.getType() === CollectionEvent.Type.DELETE) {
13367                     ev.getItem().removePropertyChangeListener(_this.objectChangeListener);
13368                 }
13369                 _this.updateCameraFromHomeBounds(false, false);
13370             };
13371             _this.labelsListener = function (ev) {
13372                 if (ev.getType() === CollectionEvent.Type.ADD) {
13373                     ev.getItem().addPropertyChangeListener(_this.objectChangeListener);
13374                 }
13375                 else if (ev.getType() === CollectionEvent.Type.DELETE) {
13376                     ev.getItem().removePropertyChangeListener(_this.objectChangeListener);
13377                 }
13378                 _this.updateCameraFromHomeBounds(false, false);
13379             };
13380             _this.selectionListener = new TopCameraState.TopCameraState$1(_this);
13381             if (_this.userPreferencesChangeListener === undefined) {
13382                 _this.userPreferencesChangeListener = null;
13383             }
13384             _this.userPreferencesChangeListener = new HomeController3D.UserPreferencesChangeListener(_this);
13385             return _this;
13386         }
13387         TopCameraState.prototype.addPropertyChangeListener = function (piece, listener) {
13388             if (piece != null && piece instanceof HomeFurnitureGroup) {
13389                 {
13390                     var array = piece.getFurniture();
13391                     for (var index = 0; index < array.length; index++) {
13392                         var child = array[index];
13393                         {
13394                             this.addPropertyChangeListener(child, listener);
13395                         }
13396                     }
13397                 }
13398             }
13399             else {
13400                 piece.addPropertyChangeListener(listener);
13401             }
13402         };
13403         TopCameraState.prototype.removePropertyChangeListener = function (piece, listener) {
13404             if (piece != null && piece instanceof HomeFurnitureGroup) {
13405                 {
13406                     var array = piece.getFurniture();
13407                     for (var index = 0; index < array.length; index++) {
13408                         var child = array[index];
13409                         {
13410                             this.removePropertyChangeListener(child, listener);
13411                         }
13412                     }
13413                 }
13414             }
13415             else {
13416                 piece.removePropertyChangeListener(listener);
13417             }
13418         };
13419         /**
13420          *
13421          */
13422         TopCameraState.prototype.enter = function () {
13423             this.topCamera = this.__parent.home.getCamera();
13424             this.previousSelectionEmpty = /* isEmpty */ (this.__parent.home.getSelectedItems().length == 0);
13425             this.aerialViewCenteredOnSelectionEnabled = this.__parent.preferences.isAerialViewCenteredOnSelectionEnabled();
13426             this.updateCameraFromHomeBounds(false, false);
13427             {
13428                 var array = this.__parent.home.getLevels();
13429                 for (var index = 0; index < array.length; index++) {
13430                     var level = array[index];
13431                     {
13432                         level.addPropertyChangeListener(this.objectChangeListener);
13433                     }
13434                 }
13435             }
13436             this.__parent.home.addLevelsListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
13437                 return funcInst;
13438             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this.levelsListener)));
13439             {
13440                 var array = this.__parent.home.getWalls();
13441                 for (var index = 0; index < array.length; index++) {
13442                     var wall = array[index];
13443                     {
13444                         wall.addPropertyChangeListener(this.objectChangeListener);
13445                     }
13446                 }
13447             }
13448             this.__parent.home.addWallsListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
13449                 return funcInst;
13450             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this.wallsListener)));
13451             {
13452                 var array = this.__parent.home.getFurniture();
13453                 for (var index = 0; index < array.length; index++) {
13454                     var piece = array[index];
13455                     {
13456                         this.addPropertyChangeListener(piece, this.objectChangeListener);
13457                     }
13458                 }
13459             }
13460             this.__parent.home.addFurnitureListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
13461                 return funcInst;
13462             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this.furnitureListener)));
13463             {
13464                 var array = this.__parent.home.getRooms();
13465                 for (var index = 0; index < array.length; index++) {
13466                     var room = array[index];
13467                     {
13468                         room.addPropertyChangeListener(this.objectChangeListener);
13469                     }
13470                 }
13471             }
13472             this.__parent.home.addRoomsListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
13473                 return funcInst;
13474             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this.roomsListener)));
13475             {
13476                 var array = this.__parent.home.getPolylines();
13477                 for (var index = 0; index < array.length; index++) {
13478                     var polyline = array[index];
13479                     {
13480                         polyline.addPropertyChangeListener(this.objectChangeListener);
13481                     }
13482                 }
13483             }
13484             this.__parent.home.addPolylinesListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
13485                 return funcInst;
13486             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this.polylinesListener)));
13487             {
13488                 var array = this.__parent.home.getDimensionLines();
13489                 for (var index = 0; index < array.length; index++) {
13490                     var dimensionLine = array[index];
13491                     {
13492                         dimensionLine.addPropertyChangeListener(this.objectChangeListener);
13493                     }
13494                 }
13495             }
13496             this.__parent.home.addDimensionLinesListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
13497                 return funcInst;
13498             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this.dimensionLinesListener)));
13499             {
13500                 var array = this.__parent.home.getLabels();
13501                 for (var index = 0; index < array.length; index++) {
13502                     var label = array[index];
13503                     {
13504                         label.addPropertyChangeListener(this.objectChangeListener);
13505                     }
13506                 }
13507             }
13508             this.__parent.home.addLabelsListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
13509                 return funcInst;
13510             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this.labelsListener)));
13511             this.__parent.home.addSelectionListener(this.selectionListener);
13512             this.__parent.preferences.addPropertyChangeListener("AERIAL_VIEW_CENTERED_ON_SELECTION_ENABLED", this.userPreferencesChangeListener);
13513         };
13514         /**
13515          * Sets whether aerial view should be centered on selection or not.
13516          * @param {boolean} aerialViewCenteredOnSelectionEnabled
13517          */
13518         TopCameraState.prototype.setAerialViewCenteredOnSelectionEnabled = function (aerialViewCenteredOnSelectionEnabled) {
13519             this.aerialViewCenteredOnSelectionEnabled = aerialViewCenteredOnSelectionEnabled;
13520             this.updateCameraFromHomeBounds(false, false);
13521         };
13522         /**
13523          * Updates camera location from home bounds.
13524          * @param {boolean} firstPieceOfFurnitureAddedToEmptyHome
13525          * @param {boolean} selectionChange
13526          * @private
13527          */
13528         TopCameraState.prototype.updateCameraFromHomeBounds = function (firstPieceOfFurnitureAddedToEmptyHome, selectionChange) {
13529             if (!this.isEditingState()) {
13530                 if (this.aerialViewBoundsLowerPoint == null) {
13531                     this.updateAerialViewBoundsFromHomeBounds(this.aerialViewCenteredOnSelectionEnabled);
13532                 }
13533                 var distanceToCenter = void 0;
13534                 if (selectionChange && this.__parent.preferences.isAerialViewCenteredOnSelectionEnabled() && this.distanceToCenterWithSelection !== -1) {
13535                     distanceToCenter = this.distanceToCenterWithSelection;
13536                 }
13537                 else {
13538                     distanceToCenter = this.getCameraToAerialViewCenterDistance();
13539                 }
13540                 if (!(this.__parent.home.getSelectedItems().length == 0)) {
13541                     this.distanceToCenterWithSelection = distanceToCenter;
13542                 }
13543                 this.updateAerialViewBoundsFromHomeBounds(this.aerialViewCenteredOnSelectionEnabled);
13544                 this.updateCameraIntervalToAerialViewCenter();
13545                 this.placeCameraAt(distanceToCenter, firstPieceOfFurnitureAddedToEmptyHome);
13546             }
13547         };
13548         /**
13549          * Returns the distance between the current camera location and home bounds center.
13550          * @return {number}
13551          * @private
13552          */
13553         TopCameraState.prototype.getCameraToAerialViewCenterDistance = function () {
13554             return Math.sqrt(Math.pow((this.aerialViewBoundsLowerPoint[0] + this.aerialViewBoundsUpperPoint[0]) / 2 - this.topCamera.getX(), 2) + Math.pow((this.aerialViewBoundsLowerPoint[1] + this.aerialViewBoundsUpperPoint[1]) / 2 - this.topCamera.getY(), 2) + Math.pow((this.aerialViewBoundsLowerPoint[2] + this.aerialViewBoundsUpperPoint[2]) / 2 - this.topCamera.getZ(), 2));
13555         };
13556         /**
13557          * Sets the bounds that includes walls, furniture and rooms, or only selected items
13558          * if <code>centerOnSelection</code> is <code>true</code>.
13559          * @param {boolean} centerOnSelection
13560          * @private
13561          */
13562         TopCameraState.prototype.updateAerialViewBoundsFromHomeBounds = function (centerOnSelection) {
13563             this.aerialViewBoundsLowerPoint = this.aerialViewBoundsUpperPoint = null;
13564             var selectedItems = [];
13565             if (centerOnSelection) {
13566                 selectedItems = ([]);
13567                 {
13568                     var array = this.__parent.home.getSelectedItems();
13569                     for (var index = 0; index < array.length; index++) {
13570                         var item = array[index];
13571                         {
13572                             if ((item != null && (item.constructor != null && item.constructor["__interfaces"] != null && item.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Elevatable") >= 0)) && this.isItemAtVisibleLevel(item) && (!(item != null && item instanceof HomePieceOfFurniture) || item.isVisible()) && (!(item != null && item instanceof Polyline) || item.isVisibleIn3D()) && (!(item != null && item instanceof DimensionLine) || item.isVisibleIn3D()) && (!(item != null && item instanceof Label) || item.getPitch() != null)) {
13573                                 /* add */ (selectedItems.push(item) > 0);
13574                             }
13575                         }
13576                     }
13577                 }
13578             }
13579             var selectionEmpty = selectedItems.length === 0 || !centerOnSelection;
13580             var containsVisibleWalls = false;
13581             {
13582                 var array = selectionEmpty ? this.__parent.home.getWalls() : Home.getWallsSubList(selectedItems);
13583                 for (var index = 0; index < array.length; index++) {
13584                     var wall = array[index];
13585                     {
13586                         if (this.isItemAtVisibleLevel(wall)) {
13587                             containsVisibleWalls = true;
13588                             var wallElevation = wall.getLevel() != null ? wall.getLevel().getElevation() : 0;
13589                             var minZ = selectionEmpty ? 0 : wallElevation;
13590                             var height = wall.getHeight();
13591                             var maxZ = void 0;
13592                             if (height != null) {
13593                                 maxZ = wallElevation + height;
13594                             }
13595                             else {
13596                                 maxZ = wallElevation + this.__parent.home.getWallHeight();
13597                             }
13598                             var heightAtEnd = wall.getHeightAtEnd();
13599                             if (heightAtEnd != null) {
13600                                 maxZ = Math.max(maxZ, wallElevation + heightAtEnd);
13601                             }
13602                             {
13603                                 var array1 = wall.getPoints$();
13604                                 for (var index1 = 0; index1 < array1.length; index1++) {
13605                                     var point = array1[index1];
13606                                     {
13607                                         this.updateAerialViewBounds(point[0], point[1], minZ, maxZ);
13608                                     }
13609                                 }
13610                             }
13611                         }
13612                     }
13613                 }
13614             }
13615             {
13616                 var array = selectionEmpty ? this.__parent.home.getFurniture() : Home.getFurnitureSubList(selectedItems);
13617                 for (var index = 0; index < array.length; index++) {
13618                     var piece = array[index];
13619                     {
13620                         if (piece.isVisible() && this.isItemAtVisibleLevel(piece)) {
13621                             var minZ = void 0;
13622                             var maxZ = void 0;
13623                             if (selectionEmpty) {
13624                                 minZ = Math.max(0, piece.getGroundElevation());
13625                                 maxZ = Math.max(0, piece.getGroundElevation() + piece.getHeightInPlan());
13626                             }
13627                             else {
13628                                 minZ = piece.getGroundElevation();
13629                                 maxZ = piece.getGroundElevation() + piece.getHeightInPlan();
13630                             }
13631                             {
13632                                 var array1 = piece.getPoints();
13633                                 for (var index1 = 0; index1 < array1.length; index1++) {
13634                                     var point = array1[index1];
13635                                     {
13636                                         this.updateAerialViewBounds(point[0], point[1], minZ, maxZ);
13637                                     }
13638                                 }
13639                             }
13640                         }
13641                     }
13642                 }
13643             }
13644             {
13645                 var array = selectionEmpty ? this.__parent.home.getRooms() : Home.getRoomsSubList(selectedItems);
13646                 for (var index = 0; index < array.length; index++) {
13647                     var room = array[index];
13648                     {
13649                         if (this.isItemAtVisibleLevel(room)) {
13650                             var minZ = 0;
13651                             var maxZ = this.MIN_HEIGHT;
13652                             var roomLevel = room.getLevel();
13653                             if (roomLevel != null) {
13654                                 minZ = roomLevel.getElevation() - roomLevel.getFloorThickness();
13655                                 maxZ = roomLevel.getElevation();
13656                                 if (selectionEmpty) {
13657                                     minZ = Math.max(0, minZ);
13658                                     maxZ = Math.max(this.MIN_HEIGHT, roomLevel.getElevation());
13659                                 }
13660                             }
13661                             {
13662                                 var array1 = room.getPoints();
13663                                 for (var index1 = 0; index1 < array1.length; index1++) {
13664                                     var point = array1[index1];
13665                                     {
13666                                         this.updateAerialViewBounds(point[0], point[1], minZ, maxZ);
13667                                     }
13668                                 }
13669                             }
13670                         }
13671                     }
13672                 }
13673             }
13674             {
13675                 var array = selectionEmpty ? this.__parent.home.getPolylines() : Home.getPolylinesSubList(selectedItems);
13676                 for (var index = 0; index < array.length; index++) {
13677                     var polyline = array[index];
13678                     {
13679                         if (polyline.isVisibleIn3D() && this.isItemAtVisibleLevel(polyline)) {
13680                             var minZ = void 0;
13681                             var maxZ = void 0;
13682                             if (selectionEmpty) {
13683                                 minZ = Math.max(0, polyline.getGroundElevation());
13684                                 maxZ = Math.max(this.MIN_HEIGHT, polyline.getGroundElevation());
13685                             }
13686                             else {
13687                                 minZ = maxZ = polyline.getGroundElevation();
13688                             }
13689                             {
13690                                 var array1 = polyline.getPoints();
13691                                 for (var index1 = 0; index1 < array1.length; index1++) {
13692                                     var point = array1[index1];
13693                                     {
13694                                         this.updateAerialViewBounds(point[0], point[1], minZ, maxZ);
13695                                     }
13696                                 }
13697                             }
13698                         }
13699                     }
13700                 }
13701             }
13702             {
13703                 var array = selectionEmpty ? this.__parent.home.getDimensionLines() : Home.getDimensionLinesSubList(selectedItems);
13704                 for (var index = 0; index < array.length; index++) {
13705                     var dimensionLine = array[index];
13706                     {
13707                         if (dimensionLine.isVisibleIn3D() && this.isItemAtVisibleLevel(dimensionLine)) {
13708                             var levelElevation = dimensionLine.getLevel() != null ? dimensionLine.getLevel().getElevation() : 0;
13709                             var minZ = void 0;
13710                             var maxZ = void 0;
13711                             if (selectionEmpty) {
13712                                 minZ = Math.max(0, levelElevation + dimensionLine.getElevationStart());
13713                                 maxZ = Math.max(this.MIN_HEIGHT, levelElevation + dimensionLine.getElevationEnd());
13714                             }
13715                             else {
13716                                 minZ = levelElevation + dimensionLine.getElevationStart();
13717                                 maxZ = levelElevation + dimensionLine.getElevationEnd();
13718                             }
13719                             {
13720                                 var array1 = dimensionLine.getPoints();
13721                                 for (var index1 = 0; index1 < array1.length; index1++) {
13722                                     var point = array1[index1];
13723                                     {
13724                                         this.updateAerialViewBounds(point[0], point[1], minZ, maxZ);
13725                                     }
13726                                 }
13727                             }
13728                         }
13729                     }
13730                 }
13731             }
13732             {
13733                 var array = selectionEmpty ? this.__parent.home.getLabels() : Home.getLabelsSubList(selectedItems);
13734                 for (var index = 0; index < array.length; index++) {
13735                     var label = array[index];
13736                     {
13737                         if (label.getPitch() != null && this.isItemAtVisibleLevel(label)) {
13738                             var minZ = void 0;
13739                             var maxZ = void 0;
13740                             if (selectionEmpty) {
13741                                 minZ = Math.max(0, label.getGroundElevation());
13742                                 maxZ = Math.max(this.MIN_HEIGHT, label.getGroundElevation());
13743                             }
13744                             else {
13745                                 minZ = maxZ = label.getGroundElevation();
13746                             }
13747                             {
13748                                 var array1 = label.getPoints();
13749                                 for (var index1 = 0; index1 < array1.length; index1++) {
13750                                     var point = array1[index1];
13751                                     {
13752                                         this.updateAerialViewBounds(point[0], point[1], minZ, maxZ);
13753                                     }
13754                                 }
13755                             }
13756                         }
13757                     }
13758                 }
13759             }
13760             if (this.aerialViewBoundsLowerPoint == null) {
13761                 this.aerialViewBoundsLowerPoint = [0, 0, 0];
13762                 this.aerialViewBoundsUpperPoint = [this.MIN_WIDTH, this.MIN_DEPTH, this.MIN_HEIGHT];
13763             }
13764             else if (containsVisibleWalls && selectionEmpty) {
13765                 if (this.MIN_WIDTH > this.aerialViewBoundsUpperPoint[0] - this.aerialViewBoundsLowerPoint[0]) {
13766                     this.aerialViewBoundsLowerPoint[0] = (this.aerialViewBoundsLowerPoint[0] + this.aerialViewBoundsUpperPoint[0]) / 2 - this.MIN_WIDTH / 2;
13767                     this.aerialViewBoundsUpperPoint[0] = this.aerialViewBoundsLowerPoint[0] + this.MIN_WIDTH;
13768                 }
13769                 if (this.MIN_DEPTH > this.aerialViewBoundsUpperPoint[1] - this.aerialViewBoundsLowerPoint[1]) {
13770                     this.aerialViewBoundsLowerPoint[1] = (this.aerialViewBoundsLowerPoint[1] + this.aerialViewBoundsUpperPoint[1]) / 2 - this.MIN_DEPTH / 2;
13771                     this.aerialViewBoundsUpperPoint[1] = this.aerialViewBoundsLowerPoint[1] + this.MIN_DEPTH;
13772                 }
13773                 if (this.MIN_HEIGHT > this.aerialViewBoundsUpperPoint[2] - this.aerialViewBoundsLowerPoint[2]) {
13774                     this.aerialViewBoundsLowerPoint[2] = (this.aerialViewBoundsLowerPoint[2] + this.aerialViewBoundsUpperPoint[2]) / 2 - this.MIN_HEIGHT / 2;
13775                     this.aerialViewBoundsUpperPoint[2] = this.aerialViewBoundsLowerPoint[2] + this.MIN_HEIGHT;
13776                 }
13777             }
13778         };
13779         /**
13780          * Adds the point at the given coordinates to aerial view bounds.
13781          * @param {number} x
13782          * @param {number} y
13783          * @param {number} minZ
13784          * @param {number} maxZ
13785          * @private
13786          */
13787         TopCameraState.prototype.updateAerialViewBounds = function (x, y, minZ, maxZ) {
13788             if (this.aerialViewBoundsLowerPoint == null) {
13789                 this.aerialViewBoundsLowerPoint = [x, y, minZ];
13790                 this.aerialViewBoundsUpperPoint = [x, y, maxZ];
13791             }
13792             else {
13793                 this.aerialViewBoundsLowerPoint[0] = Math.min(this.aerialViewBoundsLowerPoint[0], x);
13794                 this.aerialViewBoundsUpperPoint[0] = Math.max(this.aerialViewBoundsUpperPoint[0], x);
13795                 this.aerialViewBoundsLowerPoint[1] = Math.min(this.aerialViewBoundsLowerPoint[1], y);
13796                 this.aerialViewBoundsUpperPoint[1] = Math.max(this.aerialViewBoundsUpperPoint[1], y);
13797                 this.aerialViewBoundsLowerPoint[2] = Math.min(this.aerialViewBoundsLowerPoint[2], minZ);
13798                 this.aerialViewBoundsUpperPoint[2] = Math.max(this.aerialViewBoundsUpperPoint[2], maxZ);
13799             }
13800         };
13801         /**
13802          * Returns <code>true</code> if the given <code>item</code> is at a visible level.
13803          * @param {Object} item
13804          * @return {boolean}
13805          * @private
13806          */
13807         TopCameraState.prototype.isItemAtVisibleLevel = function (item) {
13808             return item.getLevel() == null || item.getLevel().isViewableAndVisible();
13809         };
13810         /**
13811          * Updates the minimum and maximum distances of the camera to the center of the aerial view.
13812          * @private
13813          */
13814         TopCameraState.prototype.updateCameraIntervalToAerialViewCenter = function () {
13815             var homeBoundsWidth = this.aerialViewBoundsUpperPoint[0] - this.aerialViewBoundsLowerPoint[0];
13816             var homeBoundsDepth = this.aerialViewBoundsUpperPoint[1] - this.aerialViewBoundsLowerPoint[1];
13817             var homeBoundsHeight = this.aerialViewBoundsUpperPoint[2] - this.aerialViewBoundsLowerPoint[2];
13818             var halfDiagonal = Math.sqrt(homeBoundsWidth * homeBoundsWidth + homeBoundsDepth * homeBoundsDepth + homeBoundsHeight * homeBoundsHeight) / 2;
13819             this.minDistanceToAerialViewCenter = halfDiagonal * 1.05;
13820             this.maxDistanceToAerialViewCenter = Math.max(5 * this.minDistanceToAerialViewCenter, 5000);
13821         };
13822         /**
13823          *
13824          * @param {number} delta
13825          */
13826         TopCameraState.prototype.moveCamera = function (delta) {
13827             _super.prototype.moveCamera.call(this, delta);
13828             delta *= 5;
13829             var newDistanceToCenter = this.getCameraToAerialViewCenterDistance() - delta;
13830             this.placeCameraAt(newDistanceToCenter, false);
13831         };
13832         TopCameraState.prototype.placeCameraAt = function (distanceToCenter, firstPieceOfFurnitureAddedToEmptyHome) {
13833             distanceToCenter = Math.max(distanceToCenter, this.minDistanceToAerialViewCenter);
13834             distanceToCenter = Math.min(distanceToCenter, this.maxDistanceToAerialViewCenter);
13835             if (firstPieceOfFurnitureAddedToEmptyHome) {
13836                 distanceToCenter = Math.min(distanceToCenter, 3 * this.minDistanceToAerialViewCenter);
13837             }
13838             var distanceToCenterAtGroundLevel = distanceToCenter * Math.cos(this.topCamera.getPitch());
13839             this.topCamera.setX((this.aerialViewBoundsLowerPoint[0] + this.aerialViewBoundsUpperPoint[0]) / 2 + (Math.sin(this.topCamera.getYaw()) * distanceToCenterAtGroundLevel));
13840             this.topCamera.setY((this.aerialViewBoundsLowerPoint[1] + this.aerialViewBoundsUpperPoint[1]) / 2 - (Math.cos(this.topCamera.getYaw()) * distanceToCenterAtGroundLevel));
13841             this.topCamera.setZ((this.aerialViewBoundsLowerPoint[2] + this.aerialViewBoundsUpperPoint[2]) / 2 + Math.sin(this.topCamera.getPitch()) * distanceToCenter);
13842         };
13843         /**
13844          *
13845          * @param {number} delta
13846          */
13847         TopCameraState.prototype.rotateCameraYaw = function (delta) {
13848             _super.prototype.rotateCameraYaw.call(this, delta);
13849             var newYaw = this.topCamera.getYaw() + delta;
13850             var distanceToCenterAtGroundLevel = this.getCameraToAerialViewCenterDistance() * Math.cos(this.topCamera.getPitch());
13851             this.topCamera.setYaw(newYaw);
13852             this.topCamera.setX((this.aerialViewBoundsLowerPoint[0] + this.aerialViewBoundsUpperPoint[0]) / 2 + (Math.sin(newYaw) * distanceToCenterAtGroundLevel));
13853             this.topCamera.setY((this.aerialViewBoundsLowerPoint[1] + this.aerialViewBoundsUpperPoint[1]) / 2 - (Math.cos(newYaw) * distanceToCenterAtGroundLevel));
13854         };
13855         /**
13856          *
13857          * @param {number} delta
13858          */
13859         TopCameraState.prototype.rotateCameraPitch = function (delta) {
13860             _super.prototype.rotateCameraPitch.call(this, delta);
13861             var newPitch = this.topCamera.getPitch() + delta;
13862             newPitch = Math.max(newPitch, 0);
13863             newPitch = Math.min(newPitch, Math.PI / 2);
13864             var distanceToCenter = this.getCameraToAerialViewCenterDistance();
13865             var distanceToCenterAtGroundLevel = distanceToCenter * Math.cos(newPitch);
13866             this.topCamera.setPitch(newPitch);
13867             this.topCamera.setX((this.aerialViewBoundsLowerPoint[0] + this.aerialViewBoundsUpperPoint[0]) / 2 + (Math.sin(this.topCamera.getYaw()) * distanceToCenterAtGroundLevel));
13868             this.topCamera.setY((this.aerialViewBoundsLowerPoint[1] + this.aerialViewBoundsUpperPoint[1]) / 2 - (Math.cos(this.topCamera.getYaw()) * distanceToCenterAtGroundLevel));
13869             this.topCamera.setZ((this.aerialViewBoundsLowerPoint[2] + this.aerialViewBoundsUpperPoint[2]) / 2 + (distanceToCenter * Math.sin(newPitch)));
13870         };
13871         /**
13872          *
13873          * @param {Camera} camera
13874          */
13875         TopCameraState.prototype.goToCamera = function (camera) {
13876             _super.prototype.goToCamera.call(this, camera);
13877             this.topCamera.setCamera(camera);
13878             this.topCamera.setTime(camera.getTime());
13879             this.topCamera.setLens(camera.getLens());
13880             this.topCamera.setRenderer(camera.getRenderer());
13881             this.updateCameraFromHomeBounds(false, false);
13882         };
13883         /**
13884          *
13885          * @param {number} x
13886          * @param {number} y
13887          */
13888         TopCameraState.prototype.releaseMouse = function (x, y) {
13889             _super.prototype.releaseMouse.call(this, x, y);
13890             this.updateCameraFromHomeBounds(false, false);
13891         };
13892         /**
13893          *
13894          */
13895         TopCameraState.prototype.exit = function () {
13896             this.topCamera = null;
13897             {
13898                 var array = this.__parent.home.getWalls();
13899                 for (var index = 0; index < array.length; index++) {
13900                     var wall = array[index];
13901                     {
13902                         wall.removePropertyChangeListener(this.objectChangeListener);
13903                     }
13904                 }
13905             }
13906             this.__parent.home.removeWallsListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
13907                 return funcInst;
13908             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this.wallsListener)));
13909             {
13910                 var array = this.__parent.home.getFurniture();
13911                 for (var index = 0; index < array.length; index++) {
13912                     var piece = array[index];
13913                     {
13914                         this.removePropertyChangeListener(piece, this.objectChangeListener);
13915                     }
13916                 }
13917             }
13918             this.__parent.home.removeFurnitureListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
13919                 return funcInst;
13920             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this.furnitureListener)));
13921             {
13922                 var array = this.__parent.home.getRooms();
13923                 for (var index = 0; index < array.length; index++) {
13924                     var room = array[index];
13925                     {
13926                         room.removePropertyChangeListener(this.objectChangeListener);
13927                     }
13928                 }
13929             }
13930             this.__parent.home.removeRoomsListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
13931                 return funcInst;
13932             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this.roomsListener)));
13933             {
13934                 var array = this.__parent.home.getPolylines();
13935                 for (var index = 0; index < array.length; index++) {
13936                     var polyline = array[index];
13937                     {
13938                         polyline.removePropertyChangeListener(this.objectChangeListener);
13939                     }
13940                 }
13941             }
13942             this.__parent.home.removePolylinesListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
13943                 return funcInst;
13944             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this.polylinesListener)));
13945             {
13946                 var array = this.__parent.home.getDimensionLines();
13947                 for (var index = 0; index < array.length; index++) {
13948                     var dimensionLine = array[index];
13949                     {
13950                         dimensionLine.removePropertyChangeListener(this.objectChangeListener);
13951                     }
13952                 }
13953             }
13954             this.__parent.home.removeDimensionLinesListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
13955                 return funcInst;
13956             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this.dimensionLinesListener)));
13957             {
13958                 var array = this.__parent.home.getLabels();
13959                 for (var index = 0; index < array.length; index++) {
13960                     var label = array[index];
13961                     {
13962                         label.removePropertyChangeListener(this.objectChangeListener);
13963                     }
13964                 }
13965             }
13966             this.__parent.home.removeLabelsListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
13967                 return funcInst;
13968             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this.labelsListener)));
13969             {
13970                 var array = this.__parent.home.getLevels();
13971                 for (var index = 0; index < array.length; index++) {
13972                     var level = array[index];
13973                     {
13974                         level.removePropertyChangeListener(this.objectChangeListener);
13975                     }
13976                 }
13977             }
13978             this.__parent.home.removeLevelsListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
13979                 return funcInst;
13980             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this.levelsListener)));
13981             this.__parent.home.removeSelectionListener(this.selectionListener);
13982             this.__parent.preferences.removePropertyChangeListener("AERIAL_VIEW_CENTERED_ON_SELECTION_ENABLED", this.userPreferencesChangeListener);
13983         };
13984         return TopCameraState;
13985     }(HomeController3D.EditingCameraState));
13986     HomeController3D.TopCameraState = TopCameraState;
13987     TopCameraState["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeController3D.TopCameraState";
13988     (function (TopCameraState) {
13989         var TopCameraState$0 = /** @class */ (function () {
13990             function TopCameraState$0(__parent) {
13991                 this.__parent = __parent;
13992             }
13993             TopCameraState$0.prototype.propertyChange = function (ev) {
13994                 this.__parent.updateCameraFromHomeBounds(false, false);
13995             };
13996             return TopCameraState$0;
13997         }());
13998         TopCameraState.TopCameraState$0 = TopCameraState$0;
13999         var TopCameraState$1 = /** @class */ (function () {
14000             function TopCameraState$1(__parent) {
14001                 this.__parent = __parent;
14002             }
14003             TopCameraState$1.prototype.selectionChanged = function (ev) {
14004                 var selectionEmpty = (ev.getSelectedItems().length == 0);
14005                 this.__parent.updateCameraFromHomeBounds(false, this.__parent.previousSelectionEmpty && !selectionEmpty);
14006                 this.__parent.previousSelectionEmpty = selectionEmpty;
14007             };
14008             return TopCameraState$1;
14009         }());
14010         TopCameraState.TopCameraState$1 = TopCameraState$1;
14011         TopCameraState$1["__interfaces"] = ["com.eteks.sweethome3d.model.SelectionListener"];
14012     })(TopCameraState = HomeController3D.TopCameraState || (HomeController3D.TopCameraState = {}));
14013     /**
14014      * Observer camera controller state.
14015      * @extends HomeController3D.EditingCameraState
14016      * @class
14017      */
14018     var ObserverCameraState = /** @class */ (function (_super) {
14019         __extends(ObserverCameraState, _super);
14020         function ObserverCameraState(__parent) {
14021             var _this = _super.call(this, __parent) || this;
14022             _this.__parent = __parent;
14023             if (_this.observerCamera === undefined) {
14024                 _this.observerCamera = null;
14025             }
14026             _this.levelElevationChangeListener = new ObserverCameraState.ObserverCameraState$0(_this);
14027             _this.levelsListener = function (ev) {
14028                 if (ev.getType() === CollectionEvent.Type.ADD) {
14029                     ev.getItem().addPropertyChangeListener(_this.levelElevationChangeListener);
14030                 }
14031                 else if (ev.getType() === CollectionEvent.Type.DELETE) {
14032                     ev.getItem().removePropertyChangeListener(_this.levelElevationChangeListener);
14033                 }
14034                 _this.updateCameraMinimumElevation();
14035             };
14036             return _this;
14037         }
14038         /**
14039          *
14040          */
14041         ObserverCameraState.prototype.enter = function () {
14042             this.observerCamera = this.__parent.home.getCamera();
14043             {
14044                 var array = this.__parent.home.getLevels();
14045                 for (var index = 0; index < array.length; index++) {
14046                     var level = array[index];
14047                     {
14048                         level.addPropertyChangeListener(this.levelElevationChangeListener);
14049                     }
14050                 }
14051             }
14052             this.__parent.home.addLevelsListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
14053                 return funcInst;
14054             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this.levelsListener)));
14055             this.selectCamera();
14056         };
14057         /**
14058          * Selects the camera in home if required conditions are met.
14059          * @private
14060          */
14061         ObserverCameraState.prototype.selectCamera = function () {
14062             if (this.__parent.preferences.isObserverCameraSelectedAtChange()) {
14063                 var selectedItems = this.__parent.home.getSelectedItems();
14064                 if (!this.__parent.preferences.isEditingIn3DViewEnabled() || /* isEmpty */ (selectedItems.length == 0) || /* size */ selectedItems.length === 1 && /* get */ selectedItems[0] === this.observerCamera) {
14065                     this.__parent.home.setSelectedItems(/* asList */ [this.observerCamera].slice(0));
14066                 }
14067             }
14068         };
14069         /**
14070          *
14071          * @param {number} delta
14072          */
14073         ObserverCameraState.prototype.moveCamera = function (delta) {
14074             _super.prototype.moveCamera.call(this, delta);
14075             this.observerCamera.setX(this.observerCamera.getX() - Math.sin(this.observerCamera.getYaw()) * delta);
14076             this.observerCamera.setY(this.observerCamera.getY() + Math.cos(this.observerCamera.getYaw()) * delta);
14077             this.selectCamera();
14078         };
14079         /**
14080          *
14081          * @param {number} delta
14082          */
14083         ObserverCameraState.prototype.moveCameraSideways = function (delta) {
14084             _super.prototype.moveCameraSideways.call(this, delta);
14085             this.observerCamera.setX(this.observerCamera.getX() - Math.cos(this.observerCamera.getYaw()) * delta);
14086             this.observerCamera.setY(this.observerCamera.getY() - Math.sin(this.observerCamera.getYaw()) * delta);
14087             this.selectCamera();
14088         };
14089         /**
14090          *
14091          * @param {number} delta
14092          */
14093         ObserverCameraState.prototype.elevateCamera = function (delta) {
14094             _super.prototype.elevateCamera.call(this, delta);
14095             var newElevation = this.observerCamera.getZ() + delta;
14096             newElevation = Math.min(Math.max(newElevation, this.getMinimumElevation()), this.__parent.preferences.getLengthUnit().getMaximumElevation());
14097             this.observerCamera.setZ(newElevation);
14098             this.selectCamera();
14099         };
14100         ObserverCameraState.prototype.updateCameraMinimumElevation = function () {
14101             this.observerCamera.setZ(Math.max(this.observerCamera.getZ(), this.getMinimumElevation()));
14102         };
14103         ObserverCameraState.prototype.getMinimumElevation = function () {
14104             var levels = this.__parent.home.getLevels();
14105             if ( /* size */levels.length > 0) {
14106                 return 10 + /* get */ levels[0].getElevation();
14107             }
14108             else {
14109                 return 10;
14110             }
14111         };
14112         /**
14113          *
14114          * @param {number} delta
14115          */
14116         ObserverCameraState.prototype.rotateCameraYaw = function (delta) {
14117             _super.prototype.rotateCameraYaw.call(this, delta);
14118             this.observerCamera.setYaw(this.observerCamera.getYaw() + delta);
14119             this.selectCamera();
14120         };
14121         /**
14122          *
14123          * @param {number} delta
14124          */
14125         ObserverCameraState.prototype.rotateCameraPitch = function (delta) {
14126             _super.prototype.rotateCameraPitch.call(this, delta);
14127             var newPitch = this.observerCamera.getPitch() + delta;
14128             newPitch = Math.min(Math.max(-Math.PI / 2, newPitch), Math.PI / 2);
14129             this.observerCamera.setPitch(newPitch);
14130             this.selectCamera();
14131         };
14132         /**
14133          *
14134          * @param {number} delta
14135          */
14136         ObserverCameraState.prototype.modifyFieldOfView = function (delta) {
14137             _super.prototype.modifyFieldOfView.call(this, delta);
14138             var newFieldOfView = this.observerCamera.getFieldOfView() + delta;
14139             newFieldOfView = Math.min(Math.max(/* toRadians */ (function (x) { return x * Math.PI / 180; })(2), newFieldOfView), /* toRadians */ (function (x) { return x * Math.PI / 180; })(120));
14140             this.observerCamera.setFieldOfView(newFieldOfView);
14141             this.selectCamera();
14142         };
14143         /**
14144          *
14145          * @param {Camera} camera
14146          */
14147         ObserverCameraState.prototype.goToCamera = function (camera) {
14148             _super.prototype.goToCamera.call(this, camera);
14149             this.observerCamera.setCamera(camera);
14150             this.observerCamera.setTime(camera.getTime());
14151             this.observerCamera.setLens(camera.getLens());
14152             this.observerCamera.setRenderer(camera.getRenderer());
14153         };
14154         /**
14155          *
14156          */
14157         ObserverCameraState.prototype.exit = function () {
14158             var _this = this;
14159             var selectedItems = this.__parent.home.getSelectedItems();
14160             if ( /* contains */(selectedItems.indexOf((this.observerCamera)) >= 0)) {
14161                 selectedItems = (selectedItems.slice(0));
14162                 /* remove */ (function (a) { var index = a.indexOf(_this.observerCamera); if (index >= 0) {
14163                     a.splice(index, 1);
14164                     return true;
14165                 }
14166                 else {
14167                     return false;
14168                 } })(selectedItems);
14169                 this.__parent.home.setSelectedItems(selectedItems);
14170             }
14171             {
14172                 var array = this.__parent.home.getLevels();
14173                 for (var index = 0; index < array.length; index++) {
14174                     var level = array[index];
14175                     {
14176                         level.removePropertyChangeListener(this.levelElevationChangeListener);
14177                     }
14178                 }
14179             }
14180             this.__parent.home.removeLevelsListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
14181                 return funcInst;
14182             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this.levelsListener)));
14183             this.observerCamera = null;
14184         };
14185         return ObserverCameraState;
14186     }(HomeController3D.EditingCameraState));
14187     HomeController3D.ObserverCameraState = ObserverCameraState;
14188     ObserverCameraState["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeController3D.ObserverCameraState";
14189     (function (ObserverCameraState) {
14190         var ObserverCameraState$0 = /** @class */ (function () {
14191             function ObserverCameraState$0(__parent) {
14192                 this.__parent = __parent;
14193             }
14194             ObserverCameraState$0.prototype.propertyChange = function (ev) {
14195                 if ( /* name */"ELEVATION" === ev.getPropertyName()) {
14196                     this.__parent.updateCameraMinimumElevation();
14197                 }
14198             };
14199             return ObserverCameraState$0;
14200         }());
14201         ObserverCameraState.ObserverCameraState$0 = ObserverCameraState$0;
14202     })(ObserverCameraState = HomeController3D.ObserverCameraState || (HomeController3D.ObserverCameraState = {}));
14203     var HomeController3D$0 = /** @class */ (function () {
14204         function HomeController3D$0(__parent, home) {
14205             this.home = home;
14206             this.__parent = __parent;
14207         }
14208         HomeController3D$0.prototype.propertyChange = function (ev) {
14209             this.__parent.setCameraState(this.home.getCamera() === this.home.getTopCamera() ? this.__parent.topCameraState : this.__parent.observerCameraState);
14210         };
14211         return HomeController3D$0;
14212     }());
14213     HomeController3D.HomeController3D$0 = HomeController3D$0;
14214     var HomeController3D$1 = /** @class */ (function () {
14215         function HomeController3D$1(__parent, home) {
14216             this.home = home;
14217             this.__parent = __parent;
14218         }
14219         HomeController3D$1.prototype.propertyChange = function (ev) {
14220             if (( /* name */"ELEVATION" === ev.getPropertyName()) && this.home.getEnvironment().isObserverCameraElevationAdjusted()) {
14221                 this.home.getObserverCamera().setZ(Math.max(this.__parent.getObserverCameraMinimumElevation(this.home), this.home.getObserverCamera().getZ() + ev.getNewValue() - ev.getOldValue()));
14222             }
14223         };
14224         return HomeController3D$1;
14225     }());
14226     HomeController3D.HomeController3D$1 = HomeController3D$1;
14227     var HomeController3D$2 = /** @class */ (function () {
14228         function HomeController3D$2(__parent, home, levelElevationChangeListener) {
14229             this.home = home;
14230             this.levelElevationChangeListener = levelElevationChangeListener;
14231             this.__parent = __parent;
14232         }
14233         HomeController3D$2.prototype.propertyChange = function (ev) {
14234             var oldSelectedLevel = ev.getOldValue();
14235             var selectedLevel = this.home.getSelectedLevel();
14236             if (this.home.getEnvironment().isObserverCameraElevationAdjusted()) {
14237                 this.home.getObserverCamera().setZ(Math.max(this.__parent.getObserverCameraMinimumElevation(this.home), this.home.getObserverCamera().getZ() + (selectedLevel == null ? 0 : selectedLevel.getElevation()) - (oldSelectedLevel == null ? 0 : oldSelectedLevel.getElevation())));
14238             }
14239             if (oldSelectedLevel != null) {
14240                 oldSelectedLevel.removePropertyChangeListener(this.levelElevationChangeListener);
14241             }
14242             if (selectedLevel != null) {
14243                 selectedLevel.addPropertyChangeListener(this.levelElevationChangeListener);
14244             }
14245         };
14246         return HomeController3D$2;
14247     }());
14248     HomeController3D.HomeController3D$2 = HomeController3D$2;
14249     var HomeController3D$3 = /** @class */ (function () {
14250         function HomeController3D$3(__parent, home) {
14251             this.home = home;
14252             this.__parent = __parent;
14253         }
14254         HomeController3D$3.prototype.propertyChange = function (ev) {
14255             var levels = this.home.getLevels();
14256             var selectedLevel = this.home.getSelectedLevel();
14257             var visible = true;
14258             for (var i = 0; i < /* size */ levels.length; i++) {
14259                 {
14260                     /* get */ levels[i].setVisible(visible);
14261                     if ( /* get */levels[i] === selectedLevel && !this.home.getEnvironment().isAllLevelsVisible()) {
14262                         visible = false;
14263                     }
14264                 }
14265                 ;
14266             }
14267         };
14268         return HomeController3D$3;
14269     }());
14270     HomeController3D.HomeController3D$3 = HomeController3D$3;
14271 })(HomeController3D || (HomeController3D = {}));
14272 var TransferableView;
14273 (function (TransferableView) {
14274     /**
14275      * Data types.
14276      * @class
14277      */
14278     var DataType = /** @class */ (function () {
14279         function DataType(name) {
14280             if (this.__name === undefined) {
14281                 this.__name = null;
14282             }
14283             this.__name = name;
14284         }
14285         DataType.PLAN_IMAGE_$LI$ = function () { if (DataType.PLAN_IMAGE == null) {
14286             DataType.PLAN_IMAGE = new TransferableView.DataType("PLAN_IMAGE");
14287         } return DataType.PLAN_IMAGE; };
14288         DataType.FURNITURE_LIST_$LI$ = function () { if (DataType.FURNITURE_LIST == null) {
14289             DataType.FURNITURE_LIST = new TransferableView.DataType("FURNITURE_LIST");
14290         } return DataType.FURNITURE_LIST; };
14291         DataType.prototype.name = function () {
14292             return this.__name;
14293         };
14294         /**
14295          *
14296          * @return {string}
14297          */
14298         DataType.prototype.toString = function () {
14299             return this.__name;
14300         };
14301         return DataType;
14302     }());
14303     TransferableView.DataType = DataType;
14304     DataType["__class"] = "com.eteks.sweethome3d.viewcontroller.TransferableView.DataType";
14305 })(TransferableView || (TransferableView = {}));
14306 /**
14307  * A MVC controller for model materials choice.
14308  * @author Emmanuel Puybaret
14309  * @param {string} title
14310  * @param {UserPreferences} preferences
14311  * @param {Object} viewFactory
14312  * @param {Object} contentManager
14313  * @class
14314  */
14315 var ModelMaterialsController = /** @class */ (function () {
14316     function ModelMaterialsController(title, preferences, viewFactory, contentManager) {
14317         if (this.title === undefined) {
14318             this.title = null;
14319         }
14320         if (this.preferences === undefined) {
14321             this.preferences = null;
14322         }
14323         if (this.viewFactory === undefined) {
14324             this.viewFactory = null;
14325         }
14326         if (this.contentManager === undefined) {
14327             this.contentManager = null;
14328         }
14329         if (this.propertyChangeSupport === undefined) {
14330             this.propertyChangeSupport = null;
14331         }
14332         if (this.materialsChoiceView === undefined) {
14333             this.materialsChoiceView = null;
14334         }
14335         if (this.textureController === undefined) {
14336             this.textureController = null;
14337         }
14338         if (this.model === undefined) {
14339             this.model = null;
14340         }
14341         if (this.modelCreator === undefined) {
14342             this.modelCreator = null;
14343         }
14344         if (this.modelWidth === undefined) {
14345             this.modelWidth = 0;
14346         }
14347         if (this.modelDepth === undefined) {
14348             this.modelDepth = 0;
14349         }
14350         if (this.modelHeight === undefined) {
14351             this.modelHeight = 0;
14352         }
14353         if (this.modelRotation === undefined) {
14354             this.modelRotation = null;
14355         }
14356         if (this.modelTransformations === undefined) {
14357             this.modelTransformations = null;
14358         }
14359         if (this.modelFlags === undefined) {
14360             this.modelFlags = 0;
14361         }
14362         if (this.materials === undefined) {
14363             this.materials = null;
14364         }
14365         this.title = title;
14366         this.preferences = preferences;
14367         this.viewFactory = viewFactory;
14368         this.contentManager = contentManager;
14369         this.propertyChangeSupport = new PropertyChangeSupport(this);
14370     }
14371     /**
14372      * Returns the view associated with this controller.
14373      * @return {Object}
14374      */
14375     ModelMaterialsController.prototype.getView = function () {
14376         if (this.materialsChoiceView == null) {
14377             this.materialsChoiceView = this.viewFactory.createModelMaterialsView(this.preferences, this);
14378         }
14379         return this.materialsChoiceView;
14380     };
14381     /**
14382      * Adds the property change <code>listener</code> in parameter to this controller.
14383      * @param {string} property
14384      * @param {PropertyChangeListener} listener
14385      */
14386     ModelMaterialsController.prototype.addPropertyChangeListener = function (property, listener) {
14387         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
14388     };
14389     /**
14390      * Removes the property change <code>listener</code> in parameter from this controller.
14391      * @param {string} property
14392      * @param {PropertyChangeListener} listener
14393      */
14394     ModelMaterialsController.prototype.removePropertyChangeListener = function (property, listener) {
14395         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
14396     };
14397     /**
14398      * Sets the 3D model which materials are displayed by the view
14399      * and fires a <code>PropertyChangeEvent</code>.
14400      * @param {Object} model
14401      */
14402     ModelMaterialsController.prototype.setModel = function (model) {
14403         if (this.model !== model) {
14404             var oldModel = this.model;
14405             this.model = model;
14406             this.propertyChangeSupport.firePropertyChange(/* name */ "MODEL", oldModel, model);
14407         }
14408     };
14409     /**
14410      * Returns the 3D model which materials are displayed by the view.
14411      * @return {Object}
14412      */
14413     ModelMaterialsController.prototype.getModel = function () {
14414         return this.model;
14415     };
14416     /**
14417      * Sets the creator of the 3D model displayed by the view.
14418      * @param {string} modelCreator
14419      */
14420     ModelMaterialsController.prototype.setModelCreator = function (modelCreator) {
14421         this.modelCreator = modelCreator;
14422     };
14423     /**
14424      * Returns the creator of the 3D model displayed by the view.
14425      * @return {string}
14426      */
14427     ModelMaterialsController.prototype.getModelCreator = function () {
14428         return this.modelCreator;
14429     };
14430     /**
14431      * Sets the rotation of the 3D model used to preview materials change.
14432      * @param {float[][]} modelRotation
14433      * @private
14434      */
14435     ModelMaterialsController.prototype.setModelRotation = function (modelRotation) {
14436         this.modelRotation = modelRotation;
14437     };
14438     /**
14439      * Returns the rotation of the 3D model used to preview materials change.
14440      * @return {float[][]}
14441      */
14442     ModelMaterialsController.prototype.getModelRotation = function () {
14443         return this.modelRotation;
14444     };
14445     /**
14446      * Sets the transformations of the 3D model used to preview materials change.
14447      * @param {com.eteks.sweethome3d.model.Transformation[]} modelTransformations
14448      * @private
14449      */
14450     ModelMaterialsController.prototype.setModelTransformations = function (modelTransformations) {
14451         this.modelTransformations = modelTransformations;
14452     };
14453     /**
14454      * Returns the transformations of the 3D model used to preview materials change.
14455      * @return {com.eteks.sweethome3d.model.Transformation[]}
14456      */
14457     ModelMaterialsController.prototype.getModelTransformations = function () {
14458         return this.modelTransformations;
14459     };
14460     /**
14461      * Sets the size of the 3D model used to preview materials change.
14462      * @param {number} width
14463      * @param {number} depth
14464      * @param {number} height
14465      * @private
14466      */
14467     ModelMaterialsController.prototype.setModelSize = function (width, depth, height) {
14468         this.modelWidth = width;
14469         this.modelDepth = depth;
14470         this.modelHeight = height;
14471     };
14472     /**
14473      * Returns the width of the 3D model used to preview materials change.
14474      * @return {number}
14475      */
14476     ModelMaterialsController.prototype.getModelWidth = function () {
14477         return this.modelWidth;
14478     };
14479     /**
14480      * Returns the depth of the 3D model used to preview materials change.
14481      * @return {number}
14482      */
14483     ModelMaterialsController.prototype.getModelDepth = function () {
14484         return this.modelDepth;
14485     };
14486     /**
14487      * Returns the height of the 3D model used to preview materials change.
14488      * @return {number}
14489      */
14490     ModelMaterialsController.prototype.getModelHeight = function () {
14491         return this.modelHeight;
14492     };
14493     /**
14494      * Sets whether the 3D model used to preview materials change should show back face.
14495      * @deprecated Prefer use {@link #setModelFlags} with {@link PieceOfFurniture#SHOW_BACK_FACE} flag.
14496      * @param {boolean} backFaceShown
14497      * @private
14498      */
14499     ModelMaterialsController.prototype.setBackFaceShown = function (backFaceShown) {
14500         this.setModelFlags((this.getModelFlags() & ~PieceOfFurniture.SHOW_BACK_FACE) | (backFaceShown ? PieceOfFurniture.SHOW_BACK_FACE : 0));
14501     };
14502     /**
14503      * Returns <code>true</code> if the 3D model used to preview materials change should show back face.
14504      * @return {boolean}
14505      */
14506     ModelMaterialsController.prototype.isBackFaceShown = function () {
14507         return (this.modelFlags & PieceOfFurniture.SHOW_BACK_FACE) === PieceOfFurniture.SHOW_BACK_FACE;
14508     };
14509     /**
14510      * Sets the flags applied to the 3D model used to preview materials change.
14511      * @param {number} modelFlags
14512      */
14513     ModelMaterialsController.prototype.setModelFlags = function (modelFlags) {
14514         this.modelFlags = modelFlags;
14515     };
14516     /**
14517      * Returns the flags applied to the 3D model used to preview materials change.
14518      * @return {number}
14519      */
14520     ModelMaterialsController.prototype.getModelFlags = function () {
14521         return this.modelFlags;
14522     };
14523     /**
14524      * Sets the materials displayed by view and fires a <code>PropertyChangeEvent</code>.
14525      * @param {com.eteks.sweethome3d.model.HomeMaterial[]} materials
14526      */
14527     ModelMaterialsController.prototype.setMaterials = function (materials) {
14528         if (!(function (a1, a2) { if (a1 == null && a2 == null)
14529             return true; if (a1 == null || a2 == null)
14530             return false; if (a1.length != a2.length)
14531             return false; for (var i = 0; i < a1.length; i++) {
14532             if (a1[i] != a2[i])
14533                 return false;
14534         } return true; })(this.materials, materials)) {
14535             var oldMaterials = this.materials;
14536             this.materials = materials;
14537             this.propertyChangeSupport.firePropertyChange(/* name */ "MATERIALS", oldMaterials, materials);
14538         }
14539     };
14540     /**
14541      * Returns the materials displayed by view.
14542      * @return {com.eteks.sweethome3d.model.HomeMaterial[]}
14543      */
14544     ModelMaterialsController.prototype.getMaterials = function () {
14545         return this.materials;
14546     };
14547     /**
14548      * Returns the text that should be displayed as materials choice dialog title.
14549      * @return {string}
14550      */
14551     ModelMaterialsController.prototype.getDialogTitle = function () {
14552         return this.title;
14553     };
14554     /**
14555      * Returns the texture controller of the model materials.
14556      * @return {TextureChoiceController}
14557      */
14558     ModelMaterialsController.prototype.getTextureController = function () {
14559         if (this.textureController == null) {
14560             this.textureController = new TextureChoiceController(this.preferences.getLocalizedString(ModelMaterialsController, "textureTitle"), this.preferences, this.viewFactory, this.contentManager);
14561         }
14562         return this.textureController;
14563     };
14564     return ModelMaterialsController;
14565 }());
14566 ModelMaterialsController["__class"] = "com.eteks.sweethome3d.viewcontroller.ModelMaterialsController";
14567 ModelMaterialsController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
14568 /**
14569  * An abstract MVC for a wizard view. Subclasses should create a set of wizard steps
14570  * with subclasses of <code>WizardControllerStepState</code> and
14571  * and choose the first step with a call to <code>setStepState</code>.
14572  * The {@link #finish() finish} method will be called if user completes the wizard
14573  * steps correctly.
14574  * @author Emmanuel Puybaret
14575  * @param {UserPreferences} preferences
14576  * @param {Object} viewFactory
14577  * @class
14578  */
14579 var WizardController = /** @class */ (function () {
14580     function WizardController(preferences, viewFactory) {
14581         if (this.preferences === undefined) {
14582             this.preferences = null;
14583         }
14584         if (this.viewFactory === undefined) {
14585             this.viewFactory = null;
14586         }
14587         if (this.propertyChangeSupport === undefined) {
14588             this.propertyChangeSupport = null;
14589         }
14590         if (this.stepStatePropertyChangeListener === undefined) {
14591             this.stepStatePropertyChangeListener = null;
14592         }
14593         if (this.wizardView === undefined) {
14594             this.wizardView = null;
14595         }
14596         if (this.stepState === undefined) {
14597             this.stepState = null;
14598         }
14599         if (this.backStepEnabled === undefined) {
14600             this.backStepEnabled = false;
14601         }
14602         if (this.nextStepEnabled === undefined) {
14603             this.nextStepEnabled = false;
14604         }
14605         if (this.lastStep === undefined) {
14606             this.lastStep = false;
14607         }
14608         if (this.stepView === undefined) {
14609             this.stepView = null;
14610         }
14611         if (this.stepIcon === undefined) {
14612             this.stepIcon = null;
14613         }
14614         if (this.title === undefined) {
14615             this.title = null;
14616         }
14617         if (this.resizable === undefined) {
14618             this.resizable = false;
14619         }
14620         this.preferences = preferences;
14621         this.viewFactory = viewFactory;
14622         this.stepStatePropertyChangeListener = new WizardController.WizardController$0(this);
14623         this.propertyChangeSupport = new PropertyChangeSupport(this);
14624     }
14625     /**
14626      * Returns the view associated with this controller.
14627      * @return {Object}
14628      */
14629     WizardController.prototype.getView = function () {
14630         if (this.wizardView == null) {
14631             this.wizardView = this.viewFactory.createWizardView(this.preferences, this);
14632         }
14633         return this.wizardView;
14634     };
14635     /**
14636      * Displays the view controlled by this controller.
14637      * @param {Object} parentView
14638      */
14639     WizardController.prototype.displayView = function (parentView) {
14640         this.getView().displayView(parentView);
14641     };
14642     /**
14643      * Adds the property change <code>listener</code> in parameter to this controller.
14644      * @param {string} property
14645      * @param {PropertyChangeListener} listener
14646      */
14647     WizardController.prototype.addPropertyChangeListener = function (property, listener) {
14648         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
14649     };
14650     /**
14651      * Removes the property change <code>listener</code> in parameter from this controller.
14652      * @param {string} property
14653      * @param {PropertyChangeListener} listener
14654      */
14655     WizardController.prototype.removePropertyChangeListener = function (property, listener) {
14656         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
14657     };
14658     /**
14659      * Sets whether back step is enabled or not.
14660      * @param {boolean} backStepEnabled
14661      * @private
14662      */
14663     WizardController.prototype.setBackStepEnabled = function (backStepEnabled) {
14664         if (backStepEnabled !== this.backStepEnabled) {
14665             this.backStepEnabled = backStepEnabled;
14666             this.propertyChangeSupport.firePropertyChange(/* name */ "BACK_STEP_ENABLED", !backStepEnabled, backStepEnabled);
14667         }
14668     };
14669     /**
14670      * Returns whether back step is enabled or not.
14671      * @return {boolean}
14672      */
14673     WizardController.prototype.isBackStepEnabled = function () {
14674         return this.backStepEnabled;
14675     };
14676     /**
14677      * Sets whether next step is enabled or not.
14678      * @param {boolean} nextStepEnabled
14679      * @private
14680      */
14681     WizardController.prototype.setNextStepEnabled = function (nextStepEnabled) {
14682         if (nextStepEnabled !== this.nextStepEnabled) {
14683             this.nextStepEnabled = nextStepEnabled;
14684             this.propertyChangeSupport.firePropertyChange(/* name */ "NEXT_STEP_ENABLED", !nextStepEnabled, nextStepEnabled);
14685         }
14686     };
14687     /**
14688      * Returns whether next step is enabled or not.
14689      * @return {boolean}
14690      */
14691     WizardController.prototype.isNextStepEnabled = function () {
14692         return this.nextStepEnabled;
14693     };
14694     /**
14695      * Sets whether this is the last step or not.
14696      * @param {boolean} lastStep
14697      * @private
14698      */
14699     WizardController.prototype.setLastStep = function (lastStep) {
14700         if (lastStep !== this.lastStep) {
14701             this.lastStep = lastStep;
14702             this.propertyChangeSupport.firePropertyChange(/* name */ "LAST_STEP", !lastStep, lastStep);
14703         }
14704     };
14705     /**
14706      * Returns whether this is the last step or not.
14707      * @return {boolean}
14708      */
14709     WizardController.prototype.isLastStep = function () {
14710         return this.lastStep;
14711     };
14712     /**
14713      * Sets the step view.
14714      * @param {Object} stepView
14715      * @private
14716      */
14717     WizardController.prototype.setStepView = function (stepView) {
14718         if (stepView !== this.stepView) {
14719             var oldStepView = this.stepView;
14720             this.stepView = stepView;
14721             this.propertyChangeSupport.firePropertyChange(/* name */ "STEP_VIEW", oldStepView, stepView);
14722         }
14723     };
14724     /**
14725      * Returns the current step view.
14726      * @return {Object}
14727      */
14728     WizardController.prototype.getStepView = function () {
14729         return this.stepView;
14730     };
14731     /**
14732      * Sets the step icon.
14733      * @param {string} stepIcon
14734      * @private
14735      */
14736     WizardController.prototype.setStepIcon = function (stepIcon) {
14737         if (stepIcon !== this.stepIcon) {
14738             var oldStepIcon = this.stepIcon;
14739             this.stepIcon = stepIcon;
14740             this.propertyChangeSupport.firePropertyChange(/* name */ "STEP_ICON", oldStepIcon, stepIcon);
14741         }
14742     };
14743     /**
14744      * Returns the current step icon.
14745      * @return {string}
14746      */
14747     WizardController.prototype.getStepIcon = function () {
14748         return this.stepIcon;
14749     };
14750     /**
14751      * Sets the wizard title.
14752      * @param {string} title
14753      */
14754     WizardController.prototype.setTitle = function (title) {
14755         if (title !== this.title) {
14756             var oldTitle = this.title;
14757             this.title = title;
14758             this.propertyChangeSupport.firePropertyChange(/* name */ "TITLE", oldTitle, title);
14759         }
14760     };
14761     /**
14762      * Returns the wizard title.
14763      * @return {string}
14764      */
14765     WizardController.prototype.getTitle = function () {
14766         return this.title;
14767     };
14768     /**
14769      * Sets whether the wizard is resizable or not.
14770      * @param {boolean} resizable
14771      */
14772     WizardController.prototype.setResizable = function (resizable) {
14773         if (resizable !== this.resizable) {
14774             this.resizable = resizable;
14775             this.propertyChangeSupport.firePropertyChange(/* name */ "RESIZABLE", !resizable, resizable);
14776         }
14777     };
14778     /**
14779      * Returns whether the wizard is resizable or not.
14780      * @return {boolean}
14781      */
14782     WizardController.prototype.isResizable = function () {
14783         return this.resizable;
14784     };
14785     /**
14786      * Changes current state of controller.
14787      * @param {WizardController.WizardControllerStepState} stepState
14788      */
14789     WizardController.prototype.setStepState = function (stepState) {
14790         if (this.stepState != null) {
14791             this.stepState.exit();
14792             this.stepState.removePropertyChangeListener(this.stepStatePropertyChangeListener);
14793         }
14794         this.stepState = stepState;
14795         this.setBackStepEnabled(!stepState.isFirstStep());
14796         this.setNextStepEnabled(stepState.isNextStepEnabled());
14797         this.setStepView(stepState.getView());
14798         this.setStepIcon(stepState.getIcon());
14799         this.setLastStep(stepState.isLastStep());
14800         this.stepState.addPropertyChangeListener(this.stepStatePropertyChangeListener);
14801         this.stepState.enter();
14802     };
14803     WizardController.prototype.getStepState = function () {
14804         return this.stepState;
14805     };
14806     /**
14807      * Requires to the current step to jump to next step.
14808      */
14809     WizardController.prototype.goToNextStep = function () {
14810         this.stepState.goToNextStep();
14811     };
14812     /**
14813      * Requires to the current step to go back to previous step.
14814      */
14815     WizardController.prototype.goBackToPreviousStep = function () {
14816         this.stepState.goBackToPreviousStep();
14817     };
14818     return WizardController;
14819 }());
14820 WizardController["__class"] = "com.eteks.sweethome3d.viewcontroller.WizardController";
14821 WizardController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
14822 (function (WizardController) {
14823     /**
14824      * State of a step in wizard.
14825      * @class
14826      */
14827     var WizardControllerStepState = /** @class */ (function () {
14828         function WizardControllerStepState() {
14829             if (this.propertyChangeSupport === undefined) {
14830                 this.propertyChangeSupport = null;
14831             }
14832             if (this.firstStep === undefined) {
14833                 this.firstStep = false;
14834             }
14835             if (this.lastStep === undefined) {
14836                 this.lastStep = false;
14837             }
14838             if (this.nextStepEnabled === undefined) {
14839                 this.nextStepEnabled = false;
14840             }
14841             this.propertyChangeSupport = new PropertyChangeSupport(this);
14842         }
14843         /**
14844          * Adds the property change <code>listener</code> in parameter to this home.
14845          * @param {PropertyChangeListener} listener
14846          * @private
14847          */
14848         WizardControllerStepState.prototype.addPropertyChangeListener = function (listener) {
14849             this.propertyChangeSupport.addPropertyChangeListener(listener);
14850         };
14851         /**
14852          * Removes the property change <code>listener</code> in parameter from this home.
14853          * @param {PropertyChangeListener} listener
14854          * @private
14855          */
14856         WizardControllerStepState.prototype.removePropertyChangeListener = function (listener) {
14857             this.propertyChangeSupport.removePropertyChangeListener(listener);
14858         };
14859         WizardControllerStepState.prototype.enter = function () {
14860         };
14861         WizardControllerStepState.prototype.exit = function () {
14862         };
14863         WizardControllerStepState.prototype.getIcon = function () {
14864             return null;
14865         };
14866         WizardControllerStepState.prototype.goBackToPreviousStep = function () {
14867         };
14868         WizardControllerStepState.prototype.goToNextStep = function () {
14869         };
14870         WizardControllerStepState.prototype.isFirstStep = function () {
14871             return this.firstStep;
14872         };
14873         WizardControllerStepState.prototype.setFirstStep = function (firstStep) {
14874             if (firstStep !== this.firstStep) {
14875                 this.firstStep = firstStep;
14876                 this.propertyChangeSupport.firePropertyChange(/* name */ "FIRST_STEP", !firstStep, firstStep);
14877             }
14878         };
14879         WizardControllerStepState.prototype.isLastStep = function () {
14880             return this.lastStep;
14881         };
14882         WizardControllerStepState.prototype.setLastStep = function (lastStep) {
14883             if (lastStep !== this.lastStep) {
14884                 this.lastStep = lastStep;
14885                 this.propertyChangeSupport.firePropertyChange(/* name */ "LAST_STEP", !lastStep, lastStep);
14886             }
14887         };
14888         WizardControllerStepState.prototype.isNextStepEnabled = function () {
14889             return this.nextStepEnabled;
14890         };
14891         WizardControllerStepState.prototype.setNextStepEnabled = function (nextStepEnabled) {
14892             if (nextStepEnabled !== this.nextStepEnabled) {
14893                 this.nextStepEnabled = nextStepEnabled;
14894                 this.propertyChangeSupport.firePropertyChange(/* name */ "NEXT_STEP_ENABLED", !nextStepEnabled, nextStepEnabled);
14895             }
14896         };
14897         return WizardControllerStepState;
14898     }());
14899     WizardController.WizardControllerStepState = WizardControllerStepState;
14900     WizardControllerStepState["__class"] = "com.eteks.sweethome3d.viewcontroller.WizardController.WizardControllerStepState";
14901     var WizardController$0 = /** @class */ (function () {
14902         function WizardController$0(__parent) {
14903             this.__parent = __parent;
14904         }
14905         WizardController$0.prototype.propertyChange = function (ev) {
14906             switch (( /* valueOf */ev.getPropertyName())) {
14907                 case "FIRST_STEP":
14908                     this.__parent.setBackStepEnabled(!this.__parent.stepState.isFirstStep());
14909                     break;
14910                 case "LAST_STEP":
14911                     this.__parent.setLastStep(this.__parent.stepState.isLastStep());
14912                     break;
14913                 case "NEXT_STEP_ENABLED":
14914                     this.__parent.setNextStepEnabled(this.__parent.stepState.isNextStepEnabled());
14915                     break;
14916             }
14917         };
14918         return WizardController$0;
14919     }());
14920     WizardController.WizardController$0 = WizardController$0;
14921 })(WizardController || (WizardController = {}));
14922 /**
14923  * Creates the controller of room view with undo support.
14924  * @param {UserPreferences} preferences
14925  * @param {Object} viewFactory
14926  * @param {Object} contentManager
14927  * @class
14928  * @author Emmanuel Puybaret
14929  */
14930 var BaseboardChoiceController = /** @class */ (function () {
14931     function BaseboardChoiceController(preferences, viewFactory, contentManager) {
14932         if (this.preferences === undefined) {
14933             this.preferences = null;
14934         }
14935         if (this.viewFactory === undefined) {
14936             this.viewFactory = null;
14937         }
14938         if (this.contentManager === undefined) {
14939             this.contentManager = null;
14940         }
14941         if (this.textureController === undefined) {
14942             this.textureController = null;
14943         }
14944         if (this.propertyChangeSupport === undefined) {
14945             this.propertyChangeSupport = null;
14946         }
14947         if (this.view === undefined) {
14948             this.view = null;
14949         }
14950         if (this.visible === undefined) {
14951             this.visible = null;
14952         }
14953         if (this.thickness === undefined) {
14954             this.thickness = null;
14955         }
14956         if (this.height === undefined) {
14957             this.height = null;
14958         }
14959         if (this.maxHeight === undefined) {
14960             this.maxHeight = null;
14961         }
14962         if (this.color === undefined) {
14963             this.color = null;
14964         }
14965         if (this.paint === undefined) {
14966             this.paint = null;
14967         }
14968         this.preferences = preferences;
14969         this.viewFactory = viewFactory;
14970         this.contentManager = contentManager;
14971         this.propertyChangeSupport = new PropertyChangeSupport(this);
14972     }
14973     /**
14974      * Returns the texture controller of the baseboard.
14975      * @return {TextureChoiceController}
14976      */
14977     BaseboardChoiceController.prototype.getTextureController = function () {
14978         if (this.textureController == null) {
14979             this.textureController = new TextureChoiceController(this.preferences.getLocalizedString(BaseboardChoiceController, "baseboardTextureTitle"), this.preferences, this.viewFactory, this.contentManager);
14980             this.textureController.addPropertyChangeListener("TEXTURE", new BaseboardChoiceController.BaseboardChoiceController$0(this));
14981         }
14982         return this.textureController;
14983     };
14984     /**
14985      * Returns the view associated with this controller.
14986      * @return {Object}
14987      */
14988     BaseboardChoiceController.prototype.getView = function () {
14989         if (this.view == null) {
14990             this.view = this.viewFactory.createBaseboardChoiceView(this.preferences, this);
14991         }
14992         return this.view;
14993     };
14994     /**
14995      * Adds the property change <code>listener</code> in parameter to this controller.
14996      * @param {string} property
14997      * @param {PropertyChangeListener} listener
14998      */
14999     BaseboardChoiceController.prototype.addPropertyChangeListener = function (property, listener) {
15000         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
15001     };
15002     /**
15003      * Removes the property change <code>listener</code> in parameter from this controller.
15004      * @param {string} property
15005      * @param {PropertyChangeListener} listener
15006      */
15007     BaseboardChoiceController.prototype.removePropertyChangeListener = function (property, listener) {
15008         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
15009     };
15010     /**
15011      * Returns <code>true</code> if the baseboard should be visible.
15012      * @return {boolean}
15013      */
15014     BaseboardChoiceController.prototype.getVisible = function () {
15015         return this.visible;
15016     };
15017     /**
15018      * Sets whether the baseboard should be visible.
15019      * @param {boolean} baseboardVisible
15020      */
15021     BaseboardChoiceController.prototype.setVisible = function (baseboardVisible) {
15022         if (baseboardVisible !== this.visible) {
15023             var oldVisible = this.visible;
15024             this.visible = baseboardVisible;
15025             this.propertyChangeSupport.firePropertyChange(/* name */ "VISIBLE", oldVisible, baseboardVisible);
15026         }
15027     };
15028     /**
15029      * Sets the edited thickness of the baseboard.
15030      * @param {number} baseboardThickness
15031      */
15032     BaseboardChoiceController.prototype.setThickness = function (baseboardThickness) {
15033         if (baseboardThickness !== this.thickness) {
15034             var oldThickness = this.thickness;
15035             this.thickness = baseboardThickness;
15036             this.propertyChangeSupport.firePropertyChange(/* name */ "THICKNESS", oldThickness, baseboardThickness);
15037         }
15038     };
15039     /**
15040      * Returns the edited thickness of the baseboard.
15041      * @return {number}
15042      */
15043     BaseboardChoiceController.prototype.getThickness = function () {
15044         return this.thickness;
15045     };
15046     /**
15047      * Sets the edited height of the baseboard.
15048      * @param {number} baseboardHeight
15049      */
15050     BaseboardChoiceController.prototype.setHeight = function (baseboardHeight) {
15051         if (baseboardHeight !== this.height) {
15052             var oldHeight = this.height;
15053             this.height = baseboardHeight;
15054             this.propertyChangeSupport.firePropertyChange(/* name */ "HEIGHT", oldHeight, baseboardHeight);
15055         }
15056     };
15057     /**
15058      * Returns the edited height of the baseboard.
15059      * @return {number}
15060      */
15061     BaseboardChoiceController.prototype.getHeight = function () {
15062         return this.height;
15063     };
15064     /**
15065      * Sets the maximum height allowed for the edited baseboard.
15066      * @param {number} maxHeight
15067      */
15068     BaseboardChoiceController.prototype.setMaxHeight = function (maxHeight) {
15069         if (this.maxHeight == null || maxHeight !== this.maxHeight) {
15070             var oldMaxHeight = this.maxHeight;
15071             this.maxHeight = maxHeight;
15072             this.propertyChangeSupport.firePropertyChange(/* name */ "MAX_HEIGHT", oldMaxHeight, maxHeight);
15073         }
15074     };
15075     /**
15076      * Returns the maximum height allowed for the edited baseboard.
15077      * @return {number}
15078      */
15079     BaseboardChoiceController.prototype.getMaxHeight = function () {
15080         return this.maxHeight;
15081     };
15082     /**
15083      * Sets the edited color of the baseboard.
15084      * @param {number} baseboardColor
15085      */
15086     BaseboardChoiceController.prototype.setColor = function (baseboardColor) {
15087         if (baseboardColor !== this.color) {
15088             var oldColor = this.color;
15089             this.color = baseboardColor;
15090             this.propertyChangeSupport.firePropertyChange(/* name */ "COLOR", oldColor, baseboardColor);
15091             this.setPaint(BaseboardChoiceController.BaseboardPaint.COLORED);
15092         }
15093     };
15094     /**
15095      * Returns the edited color of the baseboard.
15096      * @return {number}
15097      */
15098     BaseboardChoiceController.prototype.getColor = function () {
15099         return this.color;
15100     };
15101     /**
15102      * Sets whether the baseboard is as its wall, colored, textured or unknown painted.
15103      * @param {BaseboardChoiceController.BaseboardPaint} baseboardPaint
15104      */
15105     BaseboardChoiceController.prototype.setPaint = function (baseboardPaint) {
15106         if (baseboardPaint !== this.paint) {
15107             var oldPaint = this.paint;
15108             this.paint = baseboardPaint;
15109             this.propertyChangeSupport.firePropertyChange(/* name */ "PAINT", oldPaint, baseboardPaint);
15110         }
15111     };
15112     /**
15113      * Returns whether the baseboard side is colored, textured or unknown painted.
15114      * @return {BaseboardChoiceController.BaseboardPaint} {@link BaseboardPaint#DEFAULT}, {@link BaseboardPaint#COLORED}, {@link BaseboardPaint#TEXTURED} or <code>null</code>
15115      */
15116     BaseboardChoiceController.prototype.getPaint = function () {
15117         return this.paint;
15118     };
15119     /**
15120      * Set controller properties from the given <code>baseboard</code>.
15121      * @param {Baseboard} baseboard
15122      */
15123     BaseboardChoiceController.prototype.setBaseboard = function (baseboard) {
15124         if (baseboard == null) {
15125             this.setVisible(false);
15126             this.setThickness(null);
15127             this.setHeight(null);
15128             this.setColor(null);
15129             this.getTextureController().setTexture(null);
15130             this.setPaint(null);
15131         }
15132         else {
15133             this.setVisible(true);
15134             this.setThickness(baseboard.getThickness());
15135             this.setHeight(baseboard.getHeight());
15136             if (baseboard.getTexture() != null) {
15137                 this.setColor(null);
15138                 this.getTextureController().setTexture(baseboard.getTexture());
15139                 this.setPaint(BaseboardChoiceController.BaseboardPaint.TEXTURED);
15140             }
15141             else if (baseboard.getColor() != null) {
15142                 this.getTextureController().setTexture(null);
15143                 this.setColor(baseboard.getColor());
15144             }
15145             else {
15146                 this.setColor(null);
15147                 this.getTextureController().setTexture(null);
15148                 this.setPaint(BaseboardChoiceController.BaseboardPaint.DEFAULT);
15149             }
15150         }
15151     };
15152     return BaseboardChoiceController;
15153 }());
15154 BaseboardChoiceController["__class"] = "com.eteks.sweethome3d.viewcontroller.BaseboardChoiceController";
15155 BaseboardChoiceController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
15156 (function (BaseboardChoiceController) {
15157     /**
15158      * The possible values for {@linkplain #getPaint() paint type}.
15159      * @enum
15160      * @property {BaseboardChoiceController.BaseboardPaint} DEFAULT
15161      * @property {BaseboardChoiceController.BaseboardPaint} COLORED
15162      * @property {BaseboardChoiceController.BaseboardPaint} TEXTURED
15163      * @class
15164      */
15165     var BaseboardPaint;
15166     (function (BaseboardPaint) {
15167         BaseboardPaint[BaseboardPaint["DEFAULT"] = 0] = "DEFAULT";
15168         BaseboardPaint[BaseboardPaint["COLORED"] = 1] = "COLORED";
15169         BaseboardPaint[BaseboardPaint["TEXTURED"] = 2] = "TEXTURED";
15170     })(BaseboardPaint = BaseboardChoiceController.BaseboardPaint || (BaseboardChoiceController.BaseboardPaint = {}));
15171     var BaseboardChoiceController$0 = /** @class */ (function () {
15172         function BaseboardChoiceController$0(__parent) {
15173             this.__parent = __parent;
15174         }
15175         BaseboardChoiceController$0.prototype.propertyChange = function (ev) {
15176             this.__parent.setPaint(BaseboardChoiceController.BaseboardPaint.TEXTURED);
15177         };
15178         return BaseboardChoiceController$0;
15179     }());
15180     BaseboardChoiceController.BaseboardChoiceController$0 = BaseboardChoiceController$0;
15181 })(BaseboardChoiceController || (BaseboardChoiceController = {}));
15182 var HomeView;
15183 (function (HomeView) {
15184     HomeView.SORT_HOME_FURNITURE_ADDITIONAL_PROPERTY_ACTION_PREFIX = "SORT_HOME_FURNITURE_ADDITIONAL_PROPERTY_BY_";
15185     HomeView.DISPLAY_HOME_FURNITURE_ADDITIONAL_PROPERTY_ACTION_PREFIX = "DISPLAY_HOME_FURNITURE_ADDITIONAL_PROPERTY_";
15186 })(HomeView || (HomeView = {}));
15187 (function (HomeView) {
15188     /**
15189      * The actions proposed by the view to user.
15190      * @enum
15191      * @property {HomeView.ActionType} NEW_HOME
15192      * @property {HomeView.ActionType} NEW_HOME_FROM_EXAMPLE
15193      * @property {HomeView.ActionType} CLOSE
15194      * @property {HomeView.ActionType} OPEN
15195      * @property {HomeView.ActionType} DELETE_RECENT_HOMES
15196      * @property {HomeView.ActionType} SAVE
15197      * @property {HomeView.ActionType} SAVE_AS
15198      * @property {HomeView.ActionType} SAVE_AND_COMPRESS
15199      * @property {HomeView.ActionType} PAGE_SETUP
15200      * @property {HomeView.ActionType} PRINT_PREVIEW
15201      * @property {HomeView.ActionType} PRINT
15202      * @property {HomeView.ActionType} PRINT_TO_PDF
15203      * @property {HomeView.ActionType} PREFERENCES
15204      * @property {HomeView.ActionType} EXIT
15205      * @property {HomeView.ActionType} UNDO
15206      * @property {HomeView.ActionType} REDO
15207      * @property {HomeView.ActionType} CUT
15208      * @property {HomeView.ActionType} COPY
15209      * @property {HomeView.ActionType} PASTE
15210      * @property {HomeView.ActionType} PASTE_TO_GROUP
15211      * @property {HomeView.ActionType} PASTE_STYLE
15212      * @property {HomeView.ActionType} DELETE
15213      * @property {HomeView.ActionType} SELECT_ALL
15214      * @property {HomeView.ActionType} SELECT_ALL_AT_ALL_LEVELS
15215      * @property {HomeView.ActionType} ADD_HOME_FURNITURE
15216      * @property {HomeView.ActionType} ADD_FURNITURE_TO_GROUP
15217      * @property {HomeView.ActionType} DELETE_HOME_FURNITURE
15218      * @property {HomeView.ActionType} MODIFY_FURNITURE
15219      * @property {HomeView.ActionType} IMPORT_FURNITURE
15220      * @property {HomeView.ActionType} IMPORT_FURNITURE_LIBRARY
15221      * @property {HomeView.ActionType} IMPORT_TEXTURE
15222      * @property {HomeView.ActionType} IMPORT_TEXTURES_LIBRARY
15223      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_CATALOG_ID
15224      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_NAME
15225      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_DESCRIPTION
15226      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_CREATOR
15227      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_LICENSE
15228      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_WIDTH
15229      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_DEPTH
15230      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_HEIGHT
15231      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_X
15232      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_Y
15233      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_ELEVATION
15234      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_ANGLE
15235      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_LEVEL
15236      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_MODEL_SIZE
15237      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_COLOR
15238      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_TEXTURE
15239      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_MOVABILITY
15240      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_TYPE
15241      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_VISIBILITY
15242      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_PRICE
15243      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_VALUE_ADDED_TAX_PERCENTAGE
15244      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_VALUE_ADDED_TAX
15245      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_PRICE_VALUE_ADDED_TAX_INCLUDED
15246      * @property {HomeView.ActionType} SORT_HOME_FURNITURE_BY_DESCENDING_ORDER
15247      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_CATALOG_ID
15248      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_NAME
15249      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_DESCRIPTION
15250      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_CREATOR
15251      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_LICENSE
15252      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_WIDTH
15253      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_DEPTH
15254      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_HEIGHT
15255      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_X
15256      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_Y
15257      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_ELEVATION
15258      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_ANGLE
15259      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_LEVEL
15260      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_MODEL_SIZE
15261      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_COLOR
15262      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_TEXTURE
15263      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_MOVABLE
15264      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_DOOR_OR_WINDOW
15265      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_VISIBLE
15266      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_PRICE
15267      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_VALUE_ADDED_TAX_PERCENTAGE
15268      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_VALUE_ADDED_TAX
15269      * @property {HomeView.ActionType} DISPLAY_HOME_FURNITURE_PRICE_VALUE_ADDED_TAX_INCLUDED
15270      * @property {HomeView.ActionType} ALIGN_FURNITURE_ON_TOP
15271      * @property {HomeView.ActionType} ALIGN_FURNITURE_ON_BOTTOM
15272      * @property {HomeView.ActionType} ALIGN_FURNITURE_ON_LEFT
15273      * @property {HomeView.ActionType} ALIGN_FURNITURE_ON_RIGHT
15274      * @property {HomeView.ActionType} ALIGN_FURNITURE_ON_FRONT_SIDE
15275      * @property {HomeView.ActionType} ALIGN_FURNITURE_ON_BACK_SIDE
15276      * @property {HomeView.ActionType} ALIGN_FURNITURE_ON_LEFT_SIDE
15277      * @property {HomeView.ActionType} ALIGN_FURNITURE_ON_RIGHT_SIDE
15278      * @property {HomeView.ActionType} ALIGN_FURNITURE_SIDE_BY_SIDE
15279      * @property {HomeView.ActionType} DISTRIBUTE_FURNITURE_HORIZONTALLY
15280      * @property {HomeView.ActionType} DISTRIBUTE_FURNITURE_VERTICALLY
15281      * @property {HomeView.ActionType} RESET_FURNITURE_ELEVATION
15282      * @property {HomeView.ActionType} GROUP_FURNITURE
15283      * @property {HomeView.ActionType} UNGROUP_FURNITURE
15284      * @property {HomeView.ActionType} EXPORT_TO_CSV
15285      * @property {HomeView.ActionType} SELECT
15286      * @property {HomeView.ActionType} PAN
15287      * @property {HomeView.ActionType} CREATE_WALLS
15288      * @property {HomeView.ActionType} CREATE_ROOMS
15289      * @property {HomeView.ActionType} CREATE_DIMENSION_LINES
15290      * @property {HomeView.ActionType} CREATE_POLYLINES
15291      * @property {HomeView.ActionType} CREATE_LABELS
15292      * @property {HomeView.ActionType} DELETE_SELECTION
15293      * @property {HomeView.ActionType} LOCK_BASE_PLAN
15294      * @property {HomeView.ActionType} UNLOCK_BASE_PLAN
15295      * @property {HomeView.ActionType} ENABLE_MAGNETISM
15296      * @property {HomeView.ActionType} DISABLE_MAGNETISM
15297      * @property {HomeView.ActionType} FLIP_HORIZONTALLY
15298      * @property {HomeView.ActionType} FLIP_VERTICALLY
15299      * @property {HomeView.ActionType} MODIFY_COMPASS
15300      * @property {HomeView.ActionType} MODIFY_WALL
15301      * @property {HomeView.ActionType} JOIN_WALLS
15302      * @property {HomeView.ActionType} REVERSE_WALL_DIRECTION
15303      * @property {HomeView.ActionType} SPLIT_WALL
15304      * @property {HomeView.ActionType} MODIFY_ROOM
15305      * @property {HomeView.ActionType} RECOMPUTE_ROOM_POINTS
15306      * @property {HomeView.ActionType} ADD_ROOM_POINT
15307      * @property {HomeView.ActionType} DELETE_ROOM_POINT
15308      * @property {HomeView.ActionType} MODIFY_POLYLINE
15309      * @property {HomeView.ActionType} MODIFY_DIMENSION_LINE
15310      * @property {HomeView.ActionType} MODIFY_LABEL
15311      * @property {HomeView.ActionType} INCREASE_TEXT_SIZE
15312      * @property {HomeView.ActionType} DECREASE_TEXT_SIZE
15313      * @property {HomeView.ActionType} TOGGLE_BOLD_STYLE
15314      * @property {HomeView.ActionType} TOGGLE_ITALIC_STYLE
15315      * @property {HomeView.ActionType} IMPORT_BACKGROUND_IMAGE
15316      * @property {HomeView.ActionType} MODIFY_BACKGROUND_IMAGE
15317      * @property {HomeView.ActionType} HIDE_BACKGROUND_IMAGE
15318      * @property {HomeView.ActionType} SHOW_BACKGROUND_IMAGE
15319      * @property {HomeView.ActionType} DELETE_BACKGROUND_IMAGE
15320      * @property {HomeView.ActionType} ADD_LEVEL
15321      * @property {HomeView.ActionType} ADD_LEVEL_AT_SAME_ELEVATION
15322      * @property {HomeView.ActionType} MAKE_LEVEL_VIEWABLE
15323      * @property {HomeView.ActionType} MAKE_LEVEL_UNVIEWABLE
15324      * @property {HomeView.ActionType} MAKE_LEVEL_ONLY_VIEWABLE_ONE
15325      * @property {HomeView.ActionType} MAKE_ALL_LEVELS_VIEWABLE
15326      * @property {HomeView.ActionType} MODIFY_LEVEL
15327      * @property {HomeView.ActionType} DELETE_LEVEL
15328      * @property {HomeView.ActionType} ZOOM_OUT
15329      * @property {HomeView.ActionType} ZOOM_IN
15330      * @property {HomeView.ActionType} EXPORT_TO_SVG
15331      * @property {HomeView.ActionType} SELECT_OBJECT
15332      * @property {HomeView.ActionType} TOGGLE_SELECTION
15333      * @property {HomeView.ActionType} VIEW_FROM_TOP
15334      * @property {HomeView.ActionType} VIEW_FROM_OBSERVER
15335      * @property {HomeView.ActionType} MODIFY_OBSERVER
15336      * @property {HomeView.ActionType} STORE_POINT_OF_VIEW
15337      * @property {HomeView.ActionType} DELETE_POINTS_OF_VIEW
15338      * @property {HomeView.ActionType} CREATE_PHOTOS_AT_POINTS_OF_VIEW
15339      * @property {HomeView.ActionType} DETACH_3D_VIEW
15340      * @property {HomeView.ActionType} ATTACH_3D_VIEW
15341      * @property {HomeView.ActionType} DISPLAY_ALL_LEVELS
15342      * @property {HomeView.ActionType} DISPLAY_SELECTED_LEVEL
15343      * @property {HomeView.ActionType} MODIFY_3D_ATTRIBUTES
15344      * @property {HomeView.ActionType} CREATE_PHOTO
15345      * @property {HomeView.ActionType} CREATE_VIDEO
15346      * @property {HomeView.ActionType} EXPORT_TO_OBJ
15347      * @property {HomeView.ActionType} HELP
15348      * @property {HomeView.ActionType} ABOUT
15349      * @class
15350      */
15351     var ActionType;
15352     (function (ActionType) {
15353         ActionType[ActionType["NEW_HOME"] = 0] = "NEW_HOME";
15354         ActionType[ActionType["NEW_HOME_FROM_EXAMPLE"] = 1] = "NEW_HOME_FROM_EXAMPLE";
15355         ActionType[ActionType["CLOSE"] = 2] = "CLOSE";
15356         ActionType[ActionType["OPEN"] = 3] = "OPEN";
15357         ActionType[ActionType["DELETE_RECENT_HOMES"] = 4] = "DELETE_RECENT_HOMES";
15358         ActionType[ActionType["SAVE"] = 5] = "SAVE";
15359         ActionType[ActionType["SAVE_AS"] = 6] = "SAVE_AS";
15360         ActionType[ActionType["SAVE_AND_COMPRESS"] = 7] = "SAVE_AND_COMPRESS";
15361         ActionType[ActionType["PAGE_SETUP"] = 8] = "PAGE_SETUP";
15362         ActionType[ActionType["PRINT_PREVIEW"] = 9] = "PRINT_PREVIEW";
15363         ActionType[ActionType["PRINT"] = 10] = "PRINT";
15364         ActionType[ActionType["PRINT_TO_PDF"] = 11] = "PRINT_TO_PDF";
15365         ActionType[ActionType["PREFERENCES"] = 12] = "PREFERENCES";
15366         ActionType[ActionType["EXIT"] = 13] = "EXIT";
15367         ActionType[ActionType["UNDO"] = 14] = "UNDO";
15368         ActionType[ActionType["REDO"] = 15] = "REDO";
15369         ActionType[ActionType["CUT"] = 16] = "CUT";
15370         ActionType[ActionType["COPY"] = 17] = "COPY";
15371         ActionType[ActionType["PASTE"] = 18] = "PASTE";
15372         ActionType[ActionType["PASTE_TO_GROUP"] = 19] = "PASTE_TO_GROUP";
15373         ActionType[ActionType["PASTE_STYLE"] = 20] = "PASTE_STYLE";
15374         ActionType[ActionType["DELETE"] = 21] = "DELETE";
15375         ActionType[ActionType["SELECT_ALL"] = 22] = "SELECT_ALL";
15376         ActionType[ActionType["SELECT_ALL_AT_ALL_LEVELS"] = 23] = "SELECT_ALL_AT_ALL_LEVELS";
15377         ActionType[ActionType["ADD_HOME_FURNITURE"] = 24] = "ADD_HOME_FURNITURE";
15378         ActionType[ActionType["ADD_FURNITURE_TO_GROUP"] = 25] = "ADD_FURNITURE_TO_GROUP";
15379         ActionType[ActionType["DELETE_HOME_FURNITURE"] = 26] = "DELETE_HOME_FURNITURE";
15380         ActionType[ActionType["MODIFY_FURNITURE"] = 27] = "MODIFY_FURNITURE";
15381         ActionType[ActionType["IMPORT_FURNITURE"] = 28] = "IMPORT_FURNITURE";
15382         ActionType[ActionType["IMPORT_FURNITURE_LIBRARY"] = 29] = "IMPORT_FURNITURE_LIBRARY";
15383         ActionType[ActionType["IMPORT_TEXTURE"] = 30] = "IMPORT_TEXTURE";
15384         ActionType[ActionType["IMPORT_TEXTURES_LIBRARY"] = 31] = "IMPORT_TEXTURES_LIBRARY";
15385         ActionType[ActionType["SORT_HOME_FURNITURE_BY_CATALOG_ID"] = 32] = "SORT_HOME_FURNITURE_BY_CATALOG_ID";
15386         ActionType[ActionType["SORT_HOME_FURNITURE_BY_NAME"] = 33] = "SORT_HOME_FURNITURE_BY_NAME";
15387         ActionType[ActionType["SORT_HOME_FURNITURE_BY_DESCRIPTION"] = 34] = "SORT_HOME_FURNITURE_BY_DESCRIPTION";
15388         ActionType[ActionType["SORT_HOME_FURNITURE_BY_CREATOR"] = 35] = "SORT_HOME_FURNITURE_BY_CREATOR";
15389         ActionType[ActionType["SORT_HOME_FURNITURE_BY_LICENSE"] = 36] = "SORT_HOME_FURNITURE_BY_LICENSE";
15390         ActionType[ActionType["SORT_HOME_FURNITURE_BY_WIDTH"] = 37] = "SORT_HOME_FURNITURE_BY_WIDTH";
15391         ActionType[ActionType["SORT_HOME_FURNITURE_BY_DEPTH"] = 38] = "SORT_HOME_FURNITURE_BY_DEPTH";
15392         ActionType[ActionType["SORT_HOME_FURNITURE_BY_HEIGHT"] = 39] = "SORT_HOME_FURNITURE_BY_HEIGHT";
15393         ActionType[ActionType["SORT_HOME_FURNITURE_BY_X"] = 40] = "SORT_HOME_FURNITURE_BY_X";
15394         ActionType[ActionType["SORT_HOME_FURNITURE_BY_Y"] = 41] = "SORT_HOME_FURNITURE_BY_Y";
15395         ActionType[ActionType["SORT_HOME_FURNITURE_BY_ELEVATION"] = 42] = "SORT_HOME_FURNITURE_BY_ELEVATION";
15396         ActionType[ActionType["SORT_HOME_FURNITURE_BY_ANGLE"] = 43] = "SORT_HOME_FURNITURE_BY_ANGLE";
15397         ActionType[ActionType["SORT_HOME_FURNITURE_BY_LEVEL"] = 44] = "SORT_HOME_FURNITURE_BY_LEVEL";
15398         ActionType[ActionType["SORT_HOME_FURNITURE_BY_MODEL_SIZE"] = 45] = "SORT_HOME_FURNITURE_BY_MODEL_SIZE";
15399         ActionType[ActionType["SORT_HOME_FURNITURE_BY_COLOR"] = 46] = "SORT_HOME_FURNITURE_BY_COLOR";
15400         ActionType[ActionType["SORT_HOME_FURNITURE_BY_TEXTURE"] = 47] = "SORT_HOME_FURNITURE_BY_TEXTURE";
15401         ActionType[ActionType["SORT_HOME_FURNITURE_BY_MOVABILITY"] = 48] = "SORT_HOME_FURNITURE_BY_MOVABILITY";
15402         ActionType[ActionType["SORT_HOME_FURNITURE_BY_TYPE"] = 49] = "SORT_HOME_FURNITURE_BY_TYPE";
15403         ActionType[ActionType["SORT_HOME_FURNITURE_BY_VISIBILITY"] = 50] = "SORT_HOME_FURNITURE_BY_VISIBILITY";
15404         ActionType[ActionType["SORT_HOME_FURNITURE_BY_PRICE"] = 51] = "SORT_HOME_FURNITURE_BY_PRICE";
15405         ActionType[ActionType["SORT_HOME_FURNITURE_BY_VALUE_ADDED_TAX_PERCENTAGE"] = 52] = "SORT_HOME_FURNITURE_BY_VALUE_ADDED_TAX_PERCENTAGE";
15406         ActionType[ActionType["SORT_HOME_FURNITURE_BY_VALUE_ADDED_TAX"] = 53] = "SORT_HOME_FURNITURE_BY_VALUE_ADDED_TAX";
15407         ActionType[ActionType["SORT_HOME_FURNITURE_BY_PRICE_VALUE_ADDED_TAX_INCLUDED"] = 54] = "SORT_HOME_FURNITURE_BY_PRICE_VALUE_ADDED_TAX_INCLUDED";
15408         ActionType[ActionType["SORT_HOME_FURNITURE_BY_DESCENDING_ORDER"] = 55] = "SORT_HOME_FURNITURE_BY_DESCENDING_ORDER";
15409         ActionType[ActionType["DISPLAY_HOME_FURNITURE_CATALOG_ID"] = 56] = "DISPLAY_HOME_FURNITURE_CATALOG_ID";
15410         ActionType[ActionType["DISPLAY_HOME_FURNITURE_NAME"] = 57] = "DISPLAY_HOME_FURNITURE_NAME";
15411         ActionType[ActionType["DISPLAY_HOME_FURNITURE_DESCRIPTION"] = 58] = "DISPLAY_HOME_FURNITURE_DESCRIPTION";
15412         ActionType[ActionType["DISPLAY_HOME_FURNITURE_CREATOR"] = 59] = "DISPLAY_HOME_FURNITURE_CREATOR";
15413         ActionType[ActionType["DISPLAY_HOME_FURNITURE_LICENSE"] = 60] = "DISPLAY_HOME_FURNITURE_LICENSE";
15414         ActionType[ActionType["DISPLAY_HOME_FURNITURE_WIDTH"] = 61] = "DISPLAY_HOME_FURNITURE_WIDTH";
15415         ActionType[ActionType["DISPLAY_HOME_FURNITURE_DEPTH"] = 62] = "DISPLAY_HOME_FURNITURE_DEPTH";
15416         ActionType[ActionType["DISPLAY_HOME_FURNITURE_HEIGHT"] = 63] = "DISPLAY_HOME_FURNITURE_HEIGHT";
15417         ActionType[ActionType["DISPLAY_HOME_FURNITURE_X"] = 64] = "DISPLAY_HOME_FURNITURE_X";
15418         ActionType[ActionType["DISPLAY_HOME_FURNITURE_Y"] = 65] = "DISPLAY_HOME_FURNITURE_Y";
15419         ActionType[ActionType["DISPLAY_HOME_FURNITURE_ELEVATION"] = 66] = "DISPLAY_HOME_FURNITURE_ELEVATION";
15420         ActionType[ActionType["DISPLAY_HOME_FURNITURE_ANGLE"] = 67] = "DISPLAY_HOME_FURNITURE_ANGLE";
15421         ActionType[ActionType["DISPLAY_HOME_FURNITURE_LEVEL"] = 68] = "DISPLAY_HOME_FURNITURE_LEVEL";
15422         ActionType[ActionType["DISPLAY_HOME_FURNITURE_MODEL_SIZE"] = 69] = "DISPLAY_HOME_FURNITURE_MODEL_SIZE";
15423         ActionType[ActionType["DISPLAY_HOME_FURNITURE_COLOR"] = 70] = "DISPLAY_HOME_FURNITURE_COLOR";
15424         ActionType[ActionType["DISPLAY_HOME_FURNITURE_TEXTURE"] = 71] = "DISPLAY_HOME_FURNITURE_TEXTURE";
15425         ActionType[ActionType["DISPLAY_HOME_FURNITURE_MOVABLE"] = 72] = "DISPLAY_HOME_FURNITURE_MOVABLE";
15426         ActionType[ActionType["DISPLAY_HOME_FURNITURE_DOOR_OR_WINDOW"] = 73] = "DISPLAY_HOME_FURNITURE_DOOR_OR_WINDOW";
15427         ActionType[ActionType["DISPLAY_HOME_FURNITURE_VISIBLE"] = 74] = "DISPLAY_HOME_FURNITURE_VISIBLE";
15428         ActionType[ActionType["DISPLAY_HOME_FURNITURE_PRICE"] = 75] = "DISPLAY_HOME_FURNITURE_PRICE";
15429         ActionType[ActionType["DISPLAY_HOME_FURNITURE_VALUE_ADDED_TAX_PERCENTAGE"] = 76] = "DISPLAY_HOME_FURNITURE_VALUE_ADDED_TAX_PERCENTAGE";
15430         ActionType[ActionType["DISPLAY_HOME_FURNITURE_VALUE_ADDED_TAX"] = 77] = "DISPLAY_HOME_FURNITURE_VALUE_ADDED_TAX";
15431         ActionType[ActionType["DISPLAY_HOME_FURNITURE_PRICE_VALUE_ADDED_TAX_INCLUDED"] = 78] = "DISPLAY_HOME_FURNITURE_PRICE_VALUE_ADDED_TAX_INCLUDED";
15432         ActionType[ActionType["ALIGN_FURNITURE_ON_TOP"] = 79] = "ALIGN_FURNITURE_ON_TOP";
15433         ActionType[ActionType["ALIGN_FURNITURE_ON_BOTTOM"] = 80] = "ALIGN_FURNITURE_ON_BOTTOM";
15434         ActionType[ActionType["ALIGN_FURNITURE_ON_LEFT"] = 81] = "ALIGN_FURNITURE_ON_LEFT";
15435         ActionType[ActionType["ALIGN_FURNITURE_ON_RIGHT"] = 82] = "ALIGN_FURNITURE_ON_RIGHT";
15436         ActionType[ActionType["ALIGN_FURNITURE_ON_FRONT_SIDE"] = 83] = "ALIGN_FURNITURE_ON_FRONT_SIDE";
15437         ActionType[ActionType["ALIGN_FURNITURE_ON_BACK_SIDE"] = 84] = "ALIGN_FURNITURE_ON_BACK_SIDE";
15438         ActionType[ActionType["ALIGN_FURNITURE_ON_LEFT_SIDE"] = 85] = "ALIGN_FURNITURE_ON_LEFT_SIDE";
15439         ActionType[ActionType["ALIGN_FURNITURE_ON_RIGHT_SIDE"] = 86] = "ALIGN_FURNITURE_ON_RIGHT_SIDE";
15440         ActionType[ActionType["ALIGN_FURNITURE_SIDE_BY_SIDE"] = 87] = "ALIGN_FURNITURE_SIDE_BY_SIDE";
15441         ActionType[ActionType["DISTRIBUTE_FURNITURE_HORIZONTALLY"] = 88] = "DISTRIBUTE_FURNITURE_HORIZONTALLY";
15442         ActionType[ActionType["DISTRIBUTE_FURNITURE_VERTICALLY"] = 89] = "DISTRIBUTE_FURNITURE_VERTICALLY";
15443         ActionType[ActionType["RESET_FURNITURE_ELEVATION"] = 90] = "RESET_FURNITURE_ELEVATION";
15444         ActionType[ActionType["GROUP_FURNITURE"] = 91] = "GROUP_FURNITURE";
15445         ActionType[ActionType["UNGROUP_FURNITURE"] = 92] = "UNGROUP_FURNITURE";
15446         ActionType[ActionType["EXPORT_TO_CSV"] = 93] = "EXPORT_TO_CSV";
15447         ActionType[ActionType["SELECT"] = 94] = "SELECT";
15448         ActionType[ActionType["PAN"] = 95] = "PAN";
15449         ActionType[ActionType["CREATE_WALLS"] = 96] = "CREATE_WALLS";
15450         ActionType[ActionType["CREATE_ROOMS"] = 97] = "CREATE_ROOMS";
15451         ActionType[ActionType["CREATE_DIMENSION_LINES"] = 98] = "CREATE_DIMENSION_LINES";
15452         ActionType[ActionType["CREATE_POLYLINES"] = 99] = "CREATE_POLYLINES";
15453         ActionType[ActionType["CREATE_LABELS"] = 100] = "CREATE_LABELS";
15454         ActionType[ActionType["DELETE_SELECTION"] = 101] = "DELETE_SELECTION";
15455         ActionType[ActionType["LOCK_BASE_PLAN"] = 102] = "LOCK_BASE_PLAN";
15456         ActionType[ActionType["UNLOCK_BASE_PLAN"] = 103] = "UNLOCK_BASE_PLAN";
15457         ActionType[ActionType["ENABLE_MAGNETISM"] = 104] = "ENABLE_MAGNETISM";
15458         ActionType[ActionType["DISABLE_MAGNETISM"] = 105] = "DISABLE_MAGNETISM";
15459         ActionType[ActionType["FLIP_HORIZONTALLY"] = 106] = "FLIP_HORIZONTALLY";
15460         ActionType[ActionType["FLIP_VERTICALLY"] = 107] = "FLIP_VERTICALLY";
15461         ActionType[ActionType["MODIFY_COMPASS"] = 108] = "MODIFY_COMPASS";
15462         ActionType[ActionType["MODIFY_WALL"] = 109] = "MODIFY_WALL";
15463         ActionType[ActionType["JOIN_WALLS"] = 110] = "JOIN_WALLS";
15464         ActionType[ActionType["REVERSE_WALL_DIRECTION"] = 111] = "REVERSE_WALL_DIRECTION";
15465         ActionType[ActionType["SPLIT_WALL"] = 112] = "SPLIT_WALL";
15466         ActionType[ActionType["MODIFY_ROOM"] = 113] = "MODIFY_ROOM";
15467         ActionType[ActionType["RECOMPUTE_ROOM_POINTS"] = 114] = "RECOMPUTE_ROOM_POINTS";
15468         ActionType[ActionType["ADD_ROOM_POINT"] = 115] = "ADD_ROOM_POINT";
15469         ActionType[ActionType["DELETE_ROOM_POINT"] = 116] = "DELETE_ROOM_POINT";
15470         ActionType[ActionType["MODIFY_POLYLINE"] = 117] = "MODIFY_POLYLINE";
15471         ActionType[ActionType["MODIFY_DIMENSION_LINE"] = 118] = "MODIFY_DIMENSION_LINE";
15472         ActionType[ActionType["MODIFY_LABEL"] = 119] = "MODIFY_LABEL";
15473         ActionType[ActionType["INCREASE_TEXT_SIZE"] = 120] = "INCREASE_TEXT_SIZE";
15474         ActionType[ActionType["DECREASE_TEXT_SIZE"] = 121] = "DECREASE_TEXT_SIZE";
15475         ActionType[ActionType["TOGGLE_BOLD_STYLE"] = 122] = "TOGGLE_BOLD_STYLE";
15476         ActionType[ActionType["TOGGLE_ITALIC_STYLE"] = 123] = "TOGGLE_ITALIC_STYLE";
15477         ActionType[ActionType["IMPORT_BACKGROUND_IMAGE"] = 124] = "IMPORT_BACKGROUND_IMAGE";
15478         ActionType[ActionType["MODIFY_BACKGROUND_IMAGE"] = 125] = "MODIFY_BACKGROUND_IMAGE";
15479         ActionType[ActionType["HIDE_BACKGROUND_IMAGE"] = 126] = "HIDE_BACKGROUND_IMAGE";
15480         ActionType[ActionType["SHOW_BACKGROUND_IMAGE"] = 127] = "SHOW_BACKGROUND_IMAGE";
15481         ActionType[ActionType["DELETE_BACKGROUND_IMAGE"] = 128] = "DELETE_BACKGROUND_IMAGE";
15482         ActionType[ActionType["ADD_LEVEL"] = 129] = "ADD_LEVEL";
15483         ActionType[ActionType["ADD_LEVEL_AT_SAME_ELEVATION"] = 130] = "ADD_LEVEL_AT_SAME_ELEVATION";
15484         ActionType[ActionType["MAKE_LEVEL_VIEWABLE"] = 131] = "MAKE_LEVEL_VIEWABLE";
15485         ActionType[ActionType["MAKE_LEVEL_UNVIEWABLE"] = 132] = "MAKE_LEVEL_UNVIEWABLE";
15486         ActionType[ActionType["MAKE_LEVEL_ONLY_VIEWABLE_ONE"] = 133] = "MAKE_LEVEL_ONLY_VIEWABLE_ONE";
15487         ActionType[ActionType["MAKE_ALL_LEVELS_VIEWABLE"] = 134] = "MAKE_ALL_LEVELS_VIEWABLE";
15488         ActionType[ActionType["MODIFY_LEVEL"] = 135] = "MODIFY_LEVEL";
15489         ActionType[ActionType["DELETE_LEVEL"] = 136] = "DELETE_LEVEL";
15490         ActionType[ActionType["ZOOM_OUT"] = 137] = "ZOOM_OUT";
15491         ActionType[ActionType["ZOOM_IN"] = 138] = "ZOOM_IN";
15492         ActionType[ActionType["EXPORT_TO_SVG"] = 139] = "EXPORT_TO_SVG";
15493         ActionType[ActionType["SELECT_OBJECT"] = 140] = "SELECT_OBJECT";
15494         ActionType[ActionType["TOGGLE_SELECTION"] = 141] = "TOGGLE_SELECTION";
15495         ActionType[ActionType["VIEW_FROM_TOP"] = 142] = "VIEW_FROM_TOP";
15496         ActionType[ActionType["VIEW_FROM_OBSERVER"] = 143] = "VIEW_FROM_OBSERVER";
15497         ActionType[ActionType["MODIFY_OBSERVER"] = 144] = "MODIFY_OBSERVER";
15498         ActionType[ActionType["STORE_POINT_OF_VIEW"] = 145] = "STORE_POINT_OF_VIEW";
15499         ActionType[ActionType["DELETE_POINTS_OF_VIEW"] = 146] = "DELETE_POINTS_OF_VIEW";
15500         ActionType[ActionType["CREATE_PHOTOS_AT_POINTS_OF_VIEW"] = 147] = "CREATE_PHOTOS_AT_POINTS_OF_VIEW";
15501         ActionType[ActionType["DETACH_3D_VIEW"] = 148] = "DETACH_3D_VIEW";
15502         ActionType[ActionType["ATTACH_3D_VIEW"] = 149] = "ATTACH_3D_VIEW";
15503         ActionType[ActionType["DISPLAY_ALL_LEVELS"] = 150] = "DISPLAY_ALL_LEVELS";
15504         ActionType[ActionType["DISPLAY_SELECTED_LEVEL"] = 151] = "DISPLAY_SELECTED_LEVEL";
15505         ActionType[ActionType["MODIFY_3D_ATTRIBUTES"] = 152] = "MODIFY_3D_ATTRIBUTES";
15506         ActionType[ActionType["CREATE_PHOTO"] = 153] = "CREATE_PHOTO";
15507         ActionType[ActionType["CREATE_VIDEO"] = 154] = "CREATE_VIDEO";
15508         ActionType[ActionType["EXPORT_TO_OBJ"] = 155] = "EXPORT_TO_OBJ";
15509         ActionType[ActionType["HELP"] = 156] = "HELP";
15510         ActionType[ActionType["ABOUT"] = 157] = "ABOUT";
15511     })(ActionType = HomeView.ActionType || (HomeView.ActionType = {}));
15512     var SaveAnswer;
15513     (function (SaveAnswer) {
15514         SaveAnswer[SaveAnswer["SAVE"] = 0] = "SAVE";
15515         SaveAnswer[SaveAnswer["CANCEL"] = 1] = "CANCEL";
15516         SaveAnswer[SaveAnswer["DO_NOT_SAVE"] = 2] = "DO_NOT_SAVE";
15517     })(SaveAnswer = HomeView.SaveAnswer || (HomeView.SaveAnswer = {}));
15518     var OpenDamagedHomeAnswer;
15519     (function (OpenDamagedHomeAnswer) {
15520         OpenDamagedHomeAnswer[OpenDamagedHomeAnswer["REMOVE_DAMAGED_ITEMS"] = 0] = "REMOVE_DAMAGED_ITEMS";
15521         OpenDamagedHomeAnswer[OpenDamagedHomeAnswer["REPLACE_DAMAGED_ITEMS"] = 1] = "REPLACE_DAMAGED_ITEMS";
15522         OpenDamagedHomeAnswer[OpenDamagedHomeAnswer["DO_NOT_OPEN_HOME"] = 2] = "DO_NOT_OPEN_HOME";
15523     })(OpenDamagedHomeAnswer = HomeView.OpenDamagedHomeAnswer || (HomeView.OpenDamagedHomeAnswer = {}));
15524 })(HomeView || (HomeView = {}));
15525 /**
15526  * Creates a controller of the furniture catalog view.
15527  * @param {FurnitureCatalog} catalog the furniture catalog of the application
15528  * @param {UserPreferences} preferences application user preferences
15529  * @param {Object} viewFactory a factory able to create the furniture view managed by this controller
15530  * @param {Object} contentManager content manager for furniture import
15531  * @class
15532  * @author Emmanuel Puybaret
15533  */
15534 var FurnitureCatalogController = /** @class */ (function () {
15535     function FurnitureCatalogController(catalog, preferences, viewFactory, contentManager) {
15536         if (((catalog != null && catalog instanceof FurnitureCatalog) || catalog === null) && ((preferences != null && preferences instanceof UserPreferences) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || viewFactory === null) && ((contentManager != null && (contentManager.constructor != null && contentManager.constructor["__interfaces"] != null && contentManager.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || contentManager === null)) {
15537             var __args = arguments;
15538             if (this.catalog === undefined) {
15539                 this.catalog = null;
15540             }
15541             if (this.preferences === undefined) {
15542                 this.preferences = null;
15543             }
15544             if (this.viewFactory === undefined) {
15545                 this.viewFactory = null;
15546             }
15547             if (this.contentManager === undefined) {
15548                 this.contentManager = null;
15549             }
15550             if (this.selectionListeners === undefined) {
15551                 this.selectionListeners = null;
15552             }
15553             if (this.selectedFurniture === undefined) {
15554                 this.selectedFurniture = null;
15555             }
15556             if (this.catalogView === undefined) {
15557                 this.catalogView = null;
15558             }
15559             this.catalog = catalog;
15560             this.preferences = preferences;
15561             this.viewFactory = viewFactory;
15562             this.contentManager = contentManager;
15563             this.selectionListeners = ([]);
15564             this.selectedFurniture = /* emptyList */ [];
15565             this.catalog.addFurnitureListener((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
15566                 return funcInst;
15567             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(new FurnitureCatalogController.FurnitureCatalogChangeListener(this)));
15568             if (preferences != null) {
15569                 preferences.addPropertyChangeListener("FURNITURE_CATALOG_VIEWED_IN_TREE", new FurnitureCatalogController.FurnitureCatalogViewChangeListener(this));
15570             }
15571         }
15572         else if (((catalog != null && catalog instanceof FurnitureCatalog) || catalog === null) && ((preferences != null && (preferences.constructor != null && preferences.constructor["__interfaces"] != null && preferences.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || preferences === null) && viewFactory === undefined && contentManager === undefined) {
15573             var __args = arguments;
15574             var viewFactory_2 = __args[1];
15575             {
15576                 var __args_62 = arguments;
15577                 var preferences_3 = null;
15578                 var contentManager_2 = null;
15579                 if (this.catalog === undefined) {
15580                     this.catalog = null;
15581                 }
15582                 if (this.preferences === undefined) {
15583                     this.preferences = null;
15584                 }
15585                 if (this.viewFactory === undefined) {
15586                     this.viewFactory = null;
15587                 }
15588                 if (this.contentManager === undefined) {
15589                     this.contentManager = null;
15590                 }
15591                 if (this.selectionListeners === undefined) {
15592                     this.selectionListeners = null;
15593                 }
15594                 if (this.selectedFurniture === undefined) {
15595                     this.selectedFurniture = null;
15596                 }
15597                 if (this.catalogView === undefined) {
15598                     this.catalogView = null;
15599                 }
15600                 this.catalog = catalog;
15601                 this.preferences = preferences_3;
15602                 this.viewFactory = viewFactory_2;
15603                 this.contentManager = contentManager_2;
15604                 this.selectionListeners = ([]);
15605                 this.selectedFurniture = /* emptyList */ [];
15606                 this.catalog.addFurnitureListener((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
15607                     return funcInst;
15608                 } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(new FurnitureCatalogController.FurnitureCatalogChangeListener(this)));
15609                 if (preferences_3 != null) {
15610                     preferences_3.addPropertyChangeListener("FURNITURE_CATALOG_VIEWED_IN_TREE", new FurnitureCatalogController.FurnitureCatalogViewChangeListener(this));
15611                 }
15612             }
15613             if (this.catalog === undefined) {
15614                 this.catalog = null;
15615             }
15616             if (this.preferences === undefined) {
15617                 this.preferences = null;
15618             }
15619             if (this.viewFactory === undefined) {
15620                 this.viewFactory = null;
15621             }
15622             if (this.contentManager === undefined) {
15623                 this.contentManager = null;
15624             }
15625             if (this.selectionListeners === undefined) {
15626                 this.selectionListeners = null;
15627             }
15628             if (this.selectedFurniture === undefined) {
15629                 this.selectedFurniture = null;
15630             }
15631             if (this.catalogView === undefined) {
15632                 this.catalogView = null;
15633             }
15634         }
15635         else
15636             throw new Error('invalid overload');
15637     }
15638     /**
15639      * Returns the view associated with this controller.
15640      * @return {Object}
15641      */
15642     FurnitureCatalogController.prototype.getView = function () {
15643         if (this.catalogView == null) {
15644             this.catalogView = this.viewFactory.createFurnitureCatalogView(this.catalog, this.preferences, this);
15645         }
15646         return this.catalogView;
15647     };
15648     /**
15649      * Adds the selection <code>listener</code> in parameter to this controller.
15650      * @param {Object} listener
15651      */
15652     FurnitureCatalogController.prototype.addSelectionListener = function (listener) {
15653         /* add */ (this.selectionListeners.push(listener) > 0);
15654     };
15655     /**
15656      * Removes the selection <code>listener</code> in parameter from this controller.
15657      * @param {Object} listener
15658      */
15659     FurnitureCatalogController.prototype.removeSelectionListener = function (listener) {
15660         /* remove */ (function (a) { var index = a.indexOf(listener); if (index >= 0) {
15661             a.splice(index, 1);
15662             return true;
15663         }
15664         else {
15665             return false;
15666         } })(this.selectionListeners);
15667     };
15668     /**
15669      * Returns a list of the selected furniture in catalog.
15670      * @return {CatalogPieceOfFurniture[]}
15671      */
15672     FurnitureCatalogController.prototype.getSelectedFurniture = function () {
15673         return /* unmodifiableList */ this.selectedFurniture.slice(0);
15674     };
15675     /**
15676      * Updates the selected furniture in catalog and notifies listeners selection change.
15677      * @param {CatalogPieceOfFurniture[]} selectedFurniture
15678      */
15679     FurnitureCatalogController.prototype.setSelectedFurniture = function (selectedFurniture) {
15680         this.selectedFurniture = (selectedFurniture.slice(0));
15681         if (!(this.selectionListeners.length == 0)) {
15682             var selectionEvent = new SelectionEvent(this, this.getSelectedFurniture());
15683             var listeners = this.selectionListeners.slice(0);
15684             for (var index = 0; index < listeners.length; index++) {
15685                 var listener = listeners[index];
15686                 {
15687                     listener.selectionChanged(selectionEvent);
15688                 }
15689             }
15690         }
15691     };
15692     /**
15693      * Removes <code>piece</code> from selected furniture.
15694      * @param {CatalogPieceOfFurniture} piece
15695      * @private
15696      */
15697     FurnitureCatalogController.prototype.deselectPieceOfFurniture = function (piece) {
15698         var pieceSelectionIndex = this.selectedFurniture.indexOf(piece);
15699         if (pieceSelectionIndex !== -1) {
15700             var selectedItems = (this.getSelectedFurniture().slice(0));
15701             /* remove */ selectedItems.splice(pieceSelectionIndex, 1)[0];
15702             this.setSelectedFurniture(selectedItems);
15703         }
15704     };
15705     /**
15706      * Displays the wizard that helps to change the selected piece of furniture.
15707      */
15708     FurnitureCatalogController.prototype.modifySelectedFurniture = function () {
15709         if (this.preferences != null) {
15710             if ( /* size */this.selectedFurniture.length > 0) {
15711                 var piece = this.selectedFurniture[0];
15712                 if (piece.isModifiable()) {
15713                     var addedFurnitureListener = new FurnitureCatalogController.AddedFurnitureSelector(this);
15714                     this.preferences.getFurnitureCatalog().addFurnitureListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
15715                         return funcInst;
15716                     } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(addedFurnitureListener)));
15717                     new ImportedFurnitureWizardController(piece, this.preferences, this.viewFactory, this.contentManager).displayView(this.getView());
15718                     addedFurnitureListener.selectAddedFurniture();
15719                     this.preferences.getFurnitureCatalog().removeFurnitureListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
15720                         return funcInst;
15721                     } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(addedFurnitureListener)));
15722                 }
15723             }
15724         }
15725     };
15726     FurnitureCatalogController.prototype.importFurniture$ = function () {
15727         if (this.preferences != null) {
15728             var addedFurnitureListener = new FurnitureCatalogController.AddedFurnitureSelector(this);
15729             this.preferences.getFurnitureCatalog().addFurnitureListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
15730                 return funcInst;
15731             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(addedFurnitureListener)));
15732             new ImportedFurnitureWizardController(this.preferences, this.viewFactory, this.contentManager).displayView(this.getView());
15733             addedFurnitureListener.selectAddedFurniture();
15734             this.preferences.getFurnitureCatalog().removeFurnitureListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
15735                 return funcInst;
15736             } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(addedFurnitureListener)));
15737         }
15738     };
15739     FurnitureCatalogController.prototype.importFurniture$java_lang_String = function (modelName) {
15740         if (this.preferences != null) {
15741             new ImportedFurnitureWizardController(modelName, this.preferences, this.viewFactory, this.contentManager).displayView(this.getView());
15742         }
15743     };
15744     /**
15745      * Displays the wizard that helps to import furniture to catalog.
15746      * @param {string} modelName
15747      * @private
15748      */
15749     FurnitureCatalogController.prototype.importFurniture = function (modelName) {
15750         if (((typeof modelName === 'string') || modelName === null)) {
15751             return this.importFurniture$java_lang_String(modelName);
15752         }
15753         else if (modelName === undefined) {
15754             return this.importFurniture$();
15755         }
15756         else
15757             throw new Error('invalid overload');
15758     };
15759     /**
15760      * Deletes selected catalog furniture.
15761      */
15762     FurnitureCatalogController.prototype.deleteSelection = function () {
15763         for (var index = 0; index < this.selectedFurniture.length; index++) {
15764             var piece = this.selectedFurniture[index];
15765             {
15766                 if (piece.isModifiable()) {
15767                     this.catalog["delete"](piece);
15768                 }
15769             }
15770         }
15771     };
15772     /**
15773      * Adds dropped files to catalog.
15774      * @param {string[]} importableModels
15775      */
15776     FurnitureCatalogController.prototype.dropFiles = function (importableModels) {
15777         var addedFurnitureListener = new FurnitureCatalogController.AddedFurnitureSelector(this);
15778         this.preferences.getFurnitureCatalog().addFurnitureListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
15779             return funcInst;
15780         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(addedFurnitureListener)));
15781         for (var index = 0; index < importableModels.length; index++) {
15782             var model = importableModels[index];
15783             {
15784                 this.importFurniture$java_lang_String(model);
15785             }
15786         }
15787         addedFurnitureListener.selectAddedFurniture();
15788         this.preferences.getFurnitureCatalog().removeFurnitureListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
15789             return funcInst;
15790         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(addedFurnitureListener)));
15791     };
15792     return FurnitureCatalogController;
15793 }());
15794 FurnitureCatalogController["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureCatalogController";
15795 FurnitureCatalogController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
15796 (function (FurnitureCatalogController) {
15797     /**
15798      * Furniture catalog listener that deselects a piece removed from catalog.
15799      * @param {FurnitureCatalogController} furnitureCatalogController
15800      * @class
15801      */
15802     var FurnitureCatalogChangeListener = /** @class */ (function () {
15803         function FurnitureCatalogChangeListener(furnitureCatalogController) {
15804             if (this.furnitureCatalogController === undefined) {
15805                 this.furnitureCatalogController = null;
15806             }
15807             this.furnitureCatalogController = (furnitureCatalogController);
15808         }
15809         FurnitureCatalogChangeListener.prototype.collectionChanged = function (ev) {
15810             var controller = this.furnitureCatalogController;
15811             if (controller == null) {
15812                 ev.getSource().removeFurnitureListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
15813                     return funcInst;
15814                 } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this)));
15815             }
15816             else if (ev.getType() === CollectionEvent.Type.DELETE) {
15817                 controller.deselectPieceOfFurniture(ev.getItem());
15818             }
15819         };
15820         return FurnitureCatalogChangeListener;
15821     }());
15822     FurnitureCatalogController.FurnitureCatalogChangeListener = FurnitureCatalogChangeListener;
15823     FurnitureCatalogChangeListener["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureCatalogController.FurnitureCatalogChangeListener";
15824     FurnitureCatalogChangeListener["__interfaces"] = ["com.eteks.sweethome3d.model.CollectionListener"];
15825     /**
15826      * Preferences listener that reset view when furniture catalog view should change.
15827      * @param {FurnitureCatalogController} controller
15828      * @class
15829      */
15830     var FurnitureCatalogViewChangeListener = /** @class */ (function () {
15831         function FurnitureCatalogViewChangeListener(controller) {
15832             if (this.controller === undefined) {
15833                 this.controller = null;
15834             }
15835             this.controller = (controller);
15836         }
15837         FurnitureCatalogViewChangeListener.prototype.propertyChange = function (ev) {
15838             var controller = this.controller;
15839             if (controller == null) {
15840                 (ev.getSource()).removePropertyChangeListener("FURNITURE_CATALOG_VIEWED_IN_TREE", this);
15841             }
15842             else {
15843                 controller.catalogView = null;
15844             }
15845         };
15846         return FurnitureCatalogViewChangeListener;
15847     }());
15848     FurnitureCatalogController.FurnitureCatalogViewChangeListener = FurnitureCatalogViewChangeListener;
15849     FurnitureCatalogViewChangeListener["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureCatalogController.FurnitureCatalogViewChangeListener";
15850     /**
15851      * Listener that keeps track of the furniture added to catalog.
15852      * @class
15853      */
15854     var AddedFurnitureSelector = /** @class */ (function () {
15855         function AddedFurnitureSelector(__parent) {
15856             this.__parent = __parent;
15857             this.addedFurniture = ([]);
15858         }
15859         AddedFurnitureSelector.prototype.collectionChanged = function (ev) {
15860             if (ev.getType() === CollectionEvent.Type.ADD) {
15861                 /* add */ (this.addedFurniture.push(ev.getItem()) > 0);
15862             }
15863         };
15864         AddedFurnitureSelector.prototype.selectAddedFurniture = function () {
15865             if ( /* size */this.addedFurniture.length > 0) {
15866                 this.__parent.setSelectedFurniture(this.addedFurniture);
15867             }
15868         };
15869         return AddedFurnitureSelector;
15870     }());
15871     FurnitureCatalogController.AddedFurnitureSelector = AddedFurnitureSelector;
15872     AddedFurnitureSelector["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureCatalogController.AddedFurnitureSelector";
15873     AddedFurnitureSelector["__interfaces"] = ["com.eteks.sweethome3d.model.CollectionListener"];
15874 })(FurnitureCatalogController || (FurnitureCatalogController = {}));
15875 /**
15876  * Creates the controller of 3D view with undo support.
15877  * @param {Home} home
15878  * @param {UserPreferences} preferences
15879  * @param {Object} viewFactory
15880  * @class
15881  * @author Emmanuel Puybaret
15882  */
15883 var ObserverCameraController = /** @class */ (function () {
15884     function ObserverCameraController(home, preferences, viewFactory) {
15885         if (this.home === undefined) {
15886             this.home = null;
15887         }
15888         if (this.preferences === undefined) {
15889             this.preferences = null;
15890         }
15891         if (this.viewFactory === undefined) {
15892             this.viewFactory = null;
15893         }
15894         if (this.propertyChangeSupport === undefined) {
15895             this.propertyChangeSupport = null;
15896         }
15897         if (this.observerCameraView === undefined) {
15898             this.observerCameraView = null;
15899         }
15900         if (this.x === undefined) {
15901             this.x = 0;
15902         }
15903         if (this.y === undefined) {
15904             this.y = 0;
15905         }
15906         if (this.elevation === undefined) {
15907             this.elevation = 0;
15908         }
15909         if (this.minimumElevation === undefined) {
15910             this.minimumElevation = 0;
15911         }
15912         if (this.yawInDegrees === undefined) {
15913             this.yawInDegrees = 0;
15914         }
15915         if (this.yaw === undefined) {
15916             this.yaw = 0;
15917         }
15918         if (this.pitchInDegrees === undefined) {
15919             this.pitchInDegrees = 0;
15920         }
15921         if (this.pitch === undefined) {
15922             this.pitch = 0;
15923         }
15924         if (this.fieldOfViewInDegrees === undefined) {
15925             this.fieldOfViewInDegrees = 0;
15926         }
15927         if (this.fieldOfView === undefined) {
15928             this.fieldOfView = 0;
15929         }
15930         if (this.elevationAdjusted === undefined) {
15931             this.elevationAdjusted = false;
15932         }
15933         this.home = home;
15934         this.preferences = preferences;
15935         this.viewFactory = viewFactory;
15936         this.propertyChangeSupport = new PropertyChangeSupport(this);
15937         this.updateProperties();
15938     }
15939     /**
15940      * Returns the view associated with this controller.
15941      * @return {Object}
15942      */
15943     ObserverCameraController.prototype.getView = function () {
15944         if (this.observerCameraView == null) {
15945             this.observerCameraView = this.viewFactory.createObserverCameraView(this.preferences, this);
15946         }
15947         return this.observerCameraView;
15948     };
15949     /**
15950      * Displays the view controlled by this controller.
15951      * @param {Object} parentView
15952      */
15953     ObserverCameraController.prototype.displayView = function (parentView) {
15954         this.getView().displayView(parentView);
15955     };
15956     /**
15957      * Adds the property change <code>listener</code> in parameter to this controller.
15958      * @param {string} property
15959      * @param {PropertyChangeListener} listener
15960      */
15961     ObserverCameraController.prototype.addPropertyChangeListener = function (property, listener) {
15962         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
15963     };
15964     /**
15965      * Removes the property change <code>listener</code> in parameter from this controller.
15966      * @param {string} property
15967      * @param {PropertyChangeListener} listener
15968      */
15969     ObserverCameraController.prototype.removePropertyChangeListener = function (property, listener) {
15970         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
15971     };
15972     /**
15973      * Updates edited properties from the 3D attributes of the home edited by this controller.
15974      */
15975     ObserverCameraController.prototype.updateProperties = function () {
15976         var observerCamera = this.home.getObserverCamera();
15977         this.setX(observerCamera.getX());
15978         this.setY(observerCamera.getY());
15979         var levels = this.home.getLevels();
15980         this.setMinimumElevation(/* size */ levels.length === 0 ? 10 : 10 + /* get */ levels[0].getElevation());
15981         this.setElevation(observerCamera.getZ());
15982         this.setYaw(observerCamera.getYaw());
15983         this.setPitch(observerCamera.getPitch());
15984         this.setFieldOfView(observerCamera.getFieldOfView());
15985         var homeEnvironment = this.home.getEnvironment();
15986         this.setElevationAdjusted(homeEnvironment.isObserverCameraElevationAdjusted());
15987     };
15988     /**
15989      * Sets the edited abscissa.
15990      * @param {number} x
15991      */
15992     ObserverCameraController.prototype.setX = function (x) {
15993         if (x !== this.x) {
15994             var oldX = this.x;
15995             this.x = x;
15996             this.propertyChangeSupport.firePropertyChange(/* name */ "X", oldX, x);
15997         }
15998     };
15999     /**
16000      * Returns the edited abscissa.
16001      * @return {number}
16002      */
16003     ObserverCameraController.prototype.getX = function () {
16004         return this.x;
16005     };
16006     /**
16007      * Sets the edited ordinate.
16008      * @param {number} y
16009      */
16010     ObserverCameraController.prototype.setY = function (y) {
16011         if (y !== this.y) {
16012             var oldY = this.y;
16013             this.y = y;
16014             this.propertyChangeSupport.firePropertyChange(/* name */ "Y", oldY, y);
16015         }
16016     };
16017     /**
16018      * Returns the edited ordinate.
16019      * @return {number}
16020      */
16021     ObserverCameraController.prototype.getY = function () {
16022         return this.y;
16023     };
16024     /**
16025      * Sets the edited camera elevation.
16026      * @param {number} elevation
16027      */
16028     ObserverCameraController.prototype.setElevation = function (elevation) {
16029         if (elevation !== this.elevation) {
16030             var oldObserverCameraElevation = this.elevation;
16031             this.elevation = elevation;
16032             this.propertyChangeSupport.firePropertyChange(/* name */ "ELEVATION", oldObserverCameraElevation, elevation);
16033         }
16034     };
16035     /**
16036      * Returns the edited camera elevation.
16037      * @return {number}
16038      */
16039     ObserverCameraController.prototype.getElevation = function () {
16040         return this.elevation;
16041     };
16042     /**
16043      * Sets the minimum elevation.
16044      * @param {number} minimumElevation
16045      * @private
16046      */
16047     ObserverCameraController.prototype.setMinimumElevation = function (minimumElevation) {
16048         if (minimumElevation !== this.minimumElevation) {
16049             var oldMinimumElevation = this.minimumElevation;
16050             this.minimumElevation = minimumElevation;
16051             this.propertyChangeSupport.firePropertyChange(/* name */ "MINIMUM_ELEVATION", oldMinimumElevation, minimumElevation);
16052         }
16053     };
16054     /**
16055      * Returns the minimum elevation.
16056      * @return {number}
16057      */
16058     ObserverCameraController.prototype.getMinimumElevation = function () {
16059         return this.minimumElevation;
16060     };
16061     /**
16062      * Returns <code>true</code> if the observer elevation should be adjusted according
16063      * to the elevation of the selected level.
16064      * @return {boolean}
16065      */
16066     ObserverCameraController.prototype.isElevationAdjusted = function () {
16067         return this.elevationAdjusted;
16068     };
16069     /**
16070      * Sets whether the observer elevation should be adjusted according
16071      * to the elevation of the selected level.
16072      * @param {boolean} observerCameraElevationAdjusted
16073      */
16074     ObserverCameraController.prototype.setElevationAdjusted = function (observerCameraElevationAdjusted) {
16075         if (this.elevationAdjusted !== observerCameraElevationAdjusted) {
16076             this.elevationAdjusted = observerCameraElevationAdjusted;
16077             this.propertyChangeSupport.firePropertyChange(/* name */ "OBSERVER_CAMERA_ELEVATION_ADJUSTED", !observerCameraElevationAdjusted, observerCameraElevationAdjusted);
16078             var selectedLevel = this.home.getSelectedLevel();
16079             if (selectedLevel != null) {
16080                 if (observerCameraElevationAdjusted) {
16081                     this.setElevation(this.getElevation() - selectedLevel.getElevation());
16082                 }
16083                 else {
16084                     this.setElevation(this.getElevation() + selectedLevel.getElevation());
16085                 }
16086             }
16087         }
16088     };
16089     /**
16090      * Returns <code>true</code> if the adjustment of the observer camera according to the current level is modifiable.
16091      * @return {boolean}
16092      */
16093     ObserverCameraController.prototype.isObserverCameraElevationAdjustedEditable = function () {
16094         return /* size */ this.home.getLevels().length > 1;
16095     };
16096     ObserverCameraController.prototype.setYawInDegrees = function (yawInDegrees, updateYaw) {
16097         if (updateYaw === void 0) { updateYaw = true; }
16098         if (yawInDegrees !== this.yawInDegrees) {
16099             var oldYawInDegrees = this.yawInDegrees;
16100             this.yawInDegrees = yawInDegrees;
16101             this.propertyChangeSupport.firePropertyChange(/* name */ "YAW_IN_DEGREES", oldYawInDegrees, yawInDegrees);
16102             if (updateYaw) {
16103                 this.setYaw((function (x) { return x * Math.PI / 180; })(yawInDegrees), false);
16104             }
16105         }
16106     };
16107     /**
16108      * Returns the edited yaw in degrees.
16109      * @return {number}
16110      */
16111     ObserverCameraController.prototype.getYawInDegrees = function () {
16112         return this.yawInDegrees;
16113     };
16114     ObserverCameraController.prototype.setYaw = function (yaw, updateYawInDegrees) {
16115         if (updateYawInDegrees === void 0) { updateYawInDegrees = true; }
16116         if (yaw !== this.yaw) {
16117             var oldYaw = this.yaw;
16118             this.yaw = yaw;
16119             this.propertyChangeSupport.firePropertyChange(/* name */ "YAW", oldYaw, yaw);
16120             if (updateYawInDegrees) {
16121                 this.setYawInDegrees((Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(yaw)) | 0), false);
16122             }
16123         }
16124     };
16125     /**
16126      * Returns the edited yaw in radians.
16127      * @return {number}
16128      */
16129     ObserverCameraController.prototype.getYaw = function () {
16130         return this.yaw;
16131     };
16132     ObserverCameraController.prototype.setPitchInDegrees = function (pitchInDegrees, updatePitch) {
16133         if (updatePitch === void 0) { updatePitch = true; }
16134         if (pitchInDegrees !== this.pitchInDegrees) {
16135             var oldPitchInDegrees = this.pitchInDegrees;
16136             this.pitchInDegrees = pitchInDegrees;
16137             this.propertyChangeSupport.firePropertyChange(/* name */ "PITCH_IN_DEGREES", oldPitchInDegrees, pitchInDegrees);
16138             if (updatePitch) {
16139                 this.setPitch((function (x) { return x * Math.PI / 180; })(pitchInDegrees), false);
16140             }
16141         }
16142     };
16143     /**
16144      * Returns the edited pitch in degrees.
16145      * @return {number}
16146      */
16147     ObserverCameraController.prototype.getPitchInDegrees = function () {
16148         return this.pitchInDegrees;
16149     };
16150     ObserverCameraController.prototype.setPitch = function (pitch, updatePitchInDegrees) {
16151         if (updatePitchInDegrees === void 0) { updatePitchInDegrees = true; }
16152         if (pitch !== this.pitch) {
16153             var oldPitch = this.pitch;
16154             this.pitch = pitch;
16155             this.propertyChangeSupport.firePropertyChange(/* name */ "PITCH", oldPitch, pitch);
16156             if (updatePitchInDegrees) {
16157                 this.setPitchInDegrees(((Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(pitch))) | 0), false);
16158             }
16159         }
16160     };
16161     /**
16162      * Returns the edited pitch in radians.
16163      * @return {number}
16164      */
16165     ObserverCameraController.prototype.getPitch = function () {
16166         return this.pitch;
16167     };
16168     ObserverCameraController.prototype.setFieldOfViewInDegrees = function (fieldOfViewInDegrees, updateFieldOfView) {
16169         if (updateFieldOfView === void 0) { updateFieldOfView = true; }
16170         if (fieldOfViewInDegrees !== this.fieldOfViewInDegrees) {
16171             var oldFieldOfViewInDegrees = this.fieldOfViewInDegrees;
16172             this.fieldOfViewInDegrees = fieldOfViewInDegrees;
16173             this.propertyChangeSupport.firePropertyChange(/* name */ "FIELD_OF_VIEW_IN_DEGREES", oldFieldOfViewInDegrees, fieldOfViewInDegrees);
16174             if (updateFieldOfView) {
16175                 this.setFieldOfView((function (x) { return x * Math.PI / 180; })(fieldOfViewInDegrees), false);
16176             }
16177         }
16178     };
16179     /**
16180      * Returns the edited observer field of view in degrees.
16181      * @return {number}
16182      */
16183     ObserverCameraController.prototype.getFieldOfViewInDegrees = function () {
16184         return this.fieldOfViewInDegrees;
16185     };
16186     ObserverCameraController.prototype.setFieldOfView = function (fieldOfView, updateFieldOfViewInDegrees) {
16187         if (updateFieldOfViewInDegrees === void 0) { updateFieldOfViewInDegrees = true; }
16188         if (fieldOfView !== this.fieldOfView) {
16189             var oldFieldOfView = this.fieldOfView;
16190             this.fieldOfView = fieldOfView;
16191             this.propertyChangeSupport.firePropertyChange(/* name */ "FIELD_OF_VIEW", oldFieldOfView, fieldOfView);
16192             if (updateFieldOfViewInDegrees) {
16193                 this.setFieldOfViewInDegrees(((Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(fieldOfView))) | 0), false);
16194             }
16195         }
16196     };
16197     /**
16198      * Returns the edited observer field of view in radians.
16199      * @return {number}
16200      */
16201     ObserverCameraController.prototype.getFieldOfView = function () {
16202         return this.fieldOfView;
16203     };
16204     /**
16205      * Controls the modification of the observer camera of the edited home.
16206      */
16207     ObserverCameraController.prototype.modifyObserverCamera = function () {
16208         var x = this.getX();
16209         var y = this.getY();
16210         var z = this.getElevation();
16211         var observerCameraElevationAdjusted = this.isElevationAdjusted();
16212         var selectedLevel = this.home.getSelectedLevel();
16213         if (observerCameraElevationAdjusted && selectedLevel != null) {
16214             z += selectedLevel.getElevation();
16215             var levels = this.home.getLevels();
16216             z = Math.max(z, /* size */ levels.length === 0 ? 10 : 10 + /* get */ levels[0].getElevation());
16217         }
16218         var yaw = this.getYaw();
16219         var pitch = this.getPitch();
16220         var fieldOfView = this.getFieldOfView();
16221         var observerCamera = this.home.getObserverCamera();
16222         observerCamera.setX(x);
16223         observerCamera.setY(y);
16224         observerCamera.setZ(z);
16225         observerCamera.setYaw(yaw);
16226         observerCamera.setPitch(pitch);
16227         observerCamera.setFieldOfView(fieldOfView);
16228         var homeEnvironment = this.home.getEnvironment();
16229         homeEnvironment.setObserverCameraElevationAdjusted(observerCameraElevationAdjusted);
16230     };
16231     return ObserverCameraController;
16232 }());
16233 ObserverCameraController["__class"] = "com.eteks.sweethome3d.viewcontroller.ObserverCameraController";
16234 ObserverCameraController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
16235 var View;
16236 (function (View) {
16237     /**
16238      * The pointer types that the user may use to interact with the plan
16239      * @enum
16240      * @property {View.PointerType} MOUSE
16241      * @property {View.PointerType} TOUCH
16242      * @class
16243      */
16244     var PointerType;
16245     (function (PointerType) {
16246         PointerType[PointerType["MOUSE"] = 0] = "MOUSE";
16247         PointerType[PointerType["TOUCH"] = 1] = "TOUCH";
16248     })(PointerType = View.PointerType || (View.PointerType = {}));
16249 })(View || (View = {}));
16250 /**
16251  * Creates the controller of user preferences view.
16252  * @param {UserPreferences} preferences
16253  * @param {Object} viewFactory
16254  * @param {Object} contentManager
16255  * @param {HomeController} homeController
16256  * @class
16257  * @author Emmanuel Puybaret
16258  */
16259 var UserPreferencesController = /** @class */ (function () {
16260     function UserPreferencesController(preferences, viewFactory, contentManager, homeController) {
16261         if (((preferences != null && preferences instanceof UserPreferences) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || viewFactory === null) && ((contentManager != null && (contentManager.constructor != null && contentManager.constructor["__interfaces"] != null && contentManager.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || contentManager === null) && ((homeController != null && homeController instanceof HomeController) || homeController === null)) {
16262             var __args = arguments;
16263             if (this.preferences === undefined) {
16264                 this.preferences = null;
16265             }
16266             if (this.viewFactory === undefined) {
16267                 this.viewFactory = null;
16268             }
16269             if (this.homeController === undefined) {
16270                 this.homeController = null;
16271             }
16272             if (this.propertyChangeSupport === undefined) {
16273                 this.propertyChangeSupport = null;
16274             }
16275             if (this.userPreferencesView === undefined) {
16276                 this.userPreferencesView = null;
16277             }
16278             if (this.language === undefined) {
16279                 this.language = null;
16280             }
16281             if (this.unit === undefined) {
16282                 this.unit = null;
16283             }
16284             if (this.currency === undefined) {
16285                 this.currency = null;
16286             }
16287             if (this.valueAddedTaxEnabled === undefined) {
16288                 this.valueAddedTaxEnabled = false;
16289             }
16290             if (this.furnitureCatalogViewedInTree === undefined) {
16291                 this.furnitureCatalogViewedInTree = false;
16292             }
16293             if (this.navigationPanelVisible === undefined) {
16294                 this.navigationPanelVisible = false;
16295             }
16296             if (this.editingIn3DViewEnabled === undefined) {
16297                 this.editingIn3DViewEnabled = false;
16298             }
16299             if (this.aerialViewCenteredOnSelectionEnabled === undefined) {
16300                 this.aerialViewCenteredOnSelectionEnabled = false;
16301             }
16302             if (this.observerCameraSelectedAtChange === undefined) {
16303                 this.observerCameraSelectedAtChange = false;
16304             }
16305             if (this.magnetismEnabled === undefined) {
16306                 this.magnetismEnabled = false;
16307             }
16308             if (this.rulersVisible === undefined) {
16309                 this.rulersVisible = false;
16310             }
16311             if (this.gridVisible === undefined) {
16312                 this.gridVisible = false;
16313             }
16314             if (this.defaultFontName === undefined) {
16315                 this.defaultFontName = null;
16316             }
16317             if (this.furnitureViewedFromTop === undefined) {
16318                 this.furnitureViewedFromTop = false;
16319             }
16320             if (this.furnitureModelIconSize === undefined) {
16321                 this.furnitureModelIconSize = 0;
16322             }
16323             if (this.roomFloorColoredOrTextured === undefined) {
16324                 this.roomFloorColoredOrTextured = false;
16325             }
16326             if (this.wallPattern === undefined) {
16327                 this.wallPattern = null;
16328             }
16329             if (this.newWallPattern === undefined) {
16330                 this.newWallPattern = null;
16331             }
16332             if (this.newWallThickness === undefined) {
16333                 this.newWallThickness = 0;
16334             }
16335             if (this.newWallHeight === undefined) {
16336                 this.newWallHeight = 0;
16337             }
16338             if (this.newFloorThickness === undefined) {
16339                 this.newFloorThickness = 0;
16340             }
16341             if (this.checkUpdatesEnabled === undefined) {
16342                 this.checkUpdatesEnabled = false;
16343             }
16344             if (this.autoSaveDelayForRecovery === undefined) {
16345                 this.autoSaveDelayForRecovery = 0;
16346             }
16347             if (this.autoSaveForRecoveryEnabled === undefined) {
16348                 this.autoSaveForRecoveryEnabled = false;
16349             }
16350             this.preferences = preferences;
16351             this.viewFactory = viewFactory;
16352             this.homeController = homeController;
16353             this.propertyChangeSupport = new PropertyChangeSupport(this);
16354             this.updateProperties();
16355         }
16356         else if (((preferences != null && preferences instanceof UserPreferences) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || viewFactory === null) && ((contentManager != null && (contentManager.constructor != null && contentManager.constructor["__interfaces"] != null && contentManager.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || contentManager === null) && homeController === undefined) {
16357             var __args = arguments;
16358             {
16359                 var __args_63 = arguments;
16360                 var homeController_1 = null;
16361                 if (this.preferences === undefined) {
16362                     this.preferences = null;
16363                 }
16364                 if (this.viewFactory === undefined) {
16365                     this.viewFactory = null;
16366                 }
16367                 if (this.homeController === undefined) {
16368                     this.homeController = null;
16369                 }
16370                 if (this.propertyChangeSupport === undefined) {
16371                     this.propertyChangeSupport = null;
16372                 }
16373                 if (this.userPreferencesView === undefined) {
16374                     this.userPreferencesView = null;
16375                 }
16376                 if (this.language === undefined) {
16377                     this.language = null;
16378                 }
16379                 if (this.unit === undefined) {
16380                     this.unit = null;
16381                 }
16382                 if (this.currency === undefined) {
16383                     this.currency = null;
16384                 }
16385                 if (this.valueAddedTaxEnabled === undefined) {
16386                     this.valueAddedTaxEnabled = false;
16387                 }
16388                 if (this.furnitureCatalogViewedInTree === undefined) {
16389                     this.furnitureCatalogViewedInTree = false;
16390                 }
16391                 if (this.navigationPanelVisible === undefined) {
16392                     this.navigationPanelVisible = false;
16393                 }
16394                 if (this.editingIn3DViewEnabled === undefined) {
16395                     this.editingIn3DViewEnabled = false;
16396                 }
16397                 if (this.aerialViewCenteredOnSelectionEnabled === undefined) {
16398                     this.aerialViewCenteredOnSelectionEnabled = false;
16399                 }
16400                 if (this.observerCameraSelectedAtChange === undefined) {
16401                     this.observerCameraSelectedAtChange = false;
16402                 }
16403                 if (this.magnetismEnabled === undefined) {
16404                     this.magnetismEnabled = false;
16405                 }
16406                 if (this.rulersVisible === undefined) {
16407                     this.rulersVisible = false;
16408                 }
16409                 if (this.gridVisible === undefined) {
16410                     this.gridVisible = false;
16411                 }
16412                 if (this.defaultFontName === undefined) {
16413                     this.defaultFontName = null;
16414                 }
16415                 if (this.furnitureViewedFromTop === undefined) {
16416                     this.furnitureViewedFromTop = false;
16417                 }
16418                 if (this.furnitureModelIconSize === undefined) {
16419                     this.furnitureModelIconSize = 0;
16420                 }
16421                 if (this.roomFloorColoredOrTextured === undefined) {
16422                     this.roomFloorColoredOrTextured = false;
16423                 }
16424                 if (this.wallPattern === undefined) {
16425                     this.wallPattern = null;
16426                 }
16427                 if (this.newWallPattern === undefined) {
16428                     this.newWallPattern = null;
16429                 }
16430                 if (this.newWallThickness === undefined) {
16431                     this.newWallThickness = 0;
16432                 }
16433                 if (this.newWallHeight === undefined) {
16434                     this.newWallHeight = 0;
16435                 }
16436                 if (this.newFloorThickness === undefined) {
16437                     this.newFloorThickness = 0;
16438                 }
16439                 if (this.checkUpdatesEnabled === undefined) {
16440                     this.checkUpdatesEnabled = false;
16441                 }
16442                 if (this.autoSaveDelayForRecovery === undefined) {
16443                     this.autoSaveDelayForRecovery = 0;
16444                 }
16445                 if (this.autoSaveForRecoveryEnabled === undefined) {
16446                     this.autoSaveForRecoveryEnabled = false;
16447                 }
16448                 this.preferences = preferences;
16449                 this.viewFactory = viewFactory;
16450                 this.homeController = homeController_1;
16451                 this.propertyChangeSupport = new PropertyChangeSupport(this);
16452                 this.updateProperties();
16453             }
16454             this.preferences = preferences;
16455             this.viewFactory = viewFactory;
16456             this.propertyChangeSupport = new PropertyChangeSupport(this);
16457             this.updateProperties();
16458         }
16459         else
16460             throw new Error('invalid overload');
16461     }
16462     /**
16463      * Returns the view associated with this controller.
16464      * @return {Object}
16465      */
16466     UserPreferencesController.prototype.getView = function () {
16467         if (this.userPreferencesView == null) {
16468             this.userPreferencesView = this.viewFactory.createUserPreferencesView(this.preferences, this);
16469         }
16470         return this.userPreferencesView;
16471     };
16472     /**
16473      * Displays the view controlled by this controller.
16474      * @param {Object} parentView
16475      */
16476     UserPreferencesController.prototype.displayView = function (parentView) {
16477         this.getView().displayView(parentView);
16478     };
16479     /**
16480      * Adds the property change <code>listener</code> in parameter to this controller.
16481      * @param {string} property
16482      * @param {PropertyChangeListener} listener
16483      */
16484     UserPreferencesController.prototype.addPropertyChangeListener = function (property, listener) {
16485         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
16486     };
16487     /**
16488      * Removes the property change <code>listener</code> in parameter from this controller.
16489      * @param {string} property
16490      * @param {PropertyChangeListener} listener
16491      */
16492     UserPreferencesController.prototype.removePropertyChangeListener = function (property, listener) {
16493         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
16494     };
16495     /**
16496      * Updates preferences properties edited by this controller.
16497      */
16498     UserPreferencesController.prototype.updateProperties = function () {
16499         this.setLanguage(this.preferences.getLanguage());
16500         this.setUnit(this.preferences.getLengthUnit());
16501         this.setCurrency(this.preferences.getCurrency());
16502         this.setValueAddedTaxEnabled(this.preferences.isValueAddedTaxEnabled());
16503         this.setFurnitureCatalogViewedInTree(this.preferences.isFurnitureCatalogViewedInTree());
16504         this.setNavigationPanelVisible(this.preferences.isNavigationPanelVisible());
16505         this.setEditingIn3DViewEnabled(this.preferences.isEditingIn3DViewEnabled());
16506         this.setAerialViewCenteredOnSelectionEnabled(this.preferences.isAerialViewCenteredOnSelectionEnabled());
16507         this.setObserverCameraSelectedAtChange(this.preferences.isObserverCameraSelectedAtChange());
16508         this.setMagnetismEnabled(this.preferences.isMagnetismEnabled());
16509         this.setRulersVisible(this.preferences.isRulersVisible());
16510         this.setGridVisible(this.preferences.isGridVisible());
16511         this.setDefaultFontName(this.preferences.getDefaultFontName());
16512         this.setFurnitureViewedFromTop(this.preferences.isFurnitureViewedFromTop());
16513         this.setFurnitureModelIconSize(this.preferences.getFurnitureModelIconSize());
16514         this.setRoomFloorColoredOrTextured(this.preferences.isRoomFloorColoredOrTextured());
16515         this.setWallPattern(this.preferences.getWallPattern());
16516         this.setNewWallPattern(this.preferences.getNewWallPattern());
16517         var minimumLength = this.getUnit().getMinimumLength();
16518         var maximumLength = this.getUnit().getMaximumLength();
16519         this.setNewWallThickness(Math.min(Math.max(minimumLength, this.preferences.getNewWallThickness()), maximumLength / 10));
16520         this.setNewWallHeight(Math.min(Math.max(minimumLength, this.preferences.getNewWallHeight()), maximumLength));
16521         this.setNewFloorThickness(Math.min(Math.max(minimumLength, this.preferences.getNewFloorThickness()), maximumLength / 10));
16522         this.setCheckUpdatesEnabled(this.preferences.isCheckUpdatesEnabled());
16523         this.setAutoSaveDelayForRecovery(this.preferences.getAutoSaveDelayForRecovery());
16524         this.setAutoSaveForRecoveryEnabled(this.preferences.getAutoSaveDelayForRecovery() > 0);
16525     };
16526     /**
16527      * Returns <code>true</code> if the given <code>property</code> is editable.
16528      * Depending on whether a property is editable or not, the view associated to this controller
16529      * may render it differently.
16530      * The implementation of this method always returns <code>true</code> except for <code>LANGUAGE</code> if it's not editable.
16531      * @param {string} property
16532      * @return {boolean}
16533      */
16534     UserPreferencesController.prototype.isPropertyEditable = function (property) {
16535         switch ((property)) {
16536             case "LANGUAGE":
16537                 return this.preferences.isLanguageEditable();
16538             default:
16539                 return true;
16540         }
16541     };
16542     /**
16543      * Sets the edited language.
16544      * @param {string} language
16545      */
16546     UserPreferencesController.prototype.setLanguage = function (language) {
16547         if (language !== this.language) {
16548             var oldLanguage = this.language;
16549             this.language = language;
16550             this.propertyChangeSupport.firePropertyChange(/* name */ "LANGUAGE", oldLanguage, language);
16551         }
16552     };
16553     /**
16554      * Returns the edited language.
16555      * @return {string}
16556      */
16557     UserPreferencesController.prototype.getLanguage = function () {
16558         return this.language;
16559     };
16560     /**
16561      * Sets the edited unit.
16562      * @param {LengthUnit} unit
16563      */
16564     UserPreferencesController.prototype.setUnit = function (unit) {
16565         if (unit !== this.unit) {
16566             var oldUnit = this.unit;
16567             this.unit = unit;
16568             this.propertyChangeSupport.firePropertyChange(/* name */ "UNIT", oldUnit, unit);
16569         }
16570     };
16571     /**
16572      * Returns the edited unit.
16573      * @return {LengthUnit}
16574      */
16575     UserPreferencesController.prototype.getUnit = function () {
16576         return this.unit;
16577     };
16578     /**
16579      * Sets the edited currency.
16580      * @param {string} currency
16581      */
16582     UserPreferencesController.prototype.setCurrency = function (currency) {
16583         if (currency !== this.currency) {
16584             var oldCurrency = this.currency;
16585             this.currency = currency;
16586             this.propertyChangeSupport.firePropertyChange(/* name */ "CURRENCY", oldCurrency, currency);
16587             if (currency == null) {
16588                 this.setValueAddedTaxEnabled(false);
16589             }
16590         }
16591     };
16592     /**
16593      * Returns the edited currency.
16594      * @return {string}
16595      */
16596     UserPreferencesController.prototype.getCurrency = function () {
16597         return this.currency;
16598     };
16599     /**
16600      * Sets whether Value Added Tax should be taken in account in prices.
16601      * @param {boolean} valueAddedTaxEnabled
16602      */
16603     UserPreferencesController.prototype.setValueAddedTaxEnabled = function (valueAddedTaxEnabled) {
16604         if (this.valueAddedTaxEnabled !== valueAddedTaxEnabled) {
16605             this.valueAddedTaxEnabled = valueAddedTaxEnabled;
16606             this.propertyChangeSupport.firePropertyChange(/* name */ "VALUE_ADDED_TAX_ENABLED", !valueAddedTaxEnabled, valueAddedTaxEnabled);
16607         }
16608     };
16609     /**
16610      * Returns <code>true</code> if Value Added Tax should be taken in account in prices.
16611      * @return {boolean}
16612      */
16613     UserPreferencesController.prototype.isValueAddedTaxEnabled = function () {
16614         return this.valueAddedTaxEnabled;
16615     };
16616     /**
16617      * Sets whether the furniture catalog should be viewed in a tree or a different way.
16618      * @param {boolean} furnitureCatalogViewedInTree
16619      */
16620     UserPreferencesController.prototype.setFurnitureCatalogViewedInTree = function (furnitureCatalogViewedInTree) {
16621         if (this.furnitureCatalogViewedInTree !== furnitureCatalogViewedInTree) {
16622             this.furnitureCatalogViewedInTree = furnitureCatalogViewedInTree;
16623             this.propertyChangeSupport.firePropertyChange(/* name */ "FURNITURE_CATALOG_VIEWED_IN_TREE", !furnitureCatalogViewedInTree, furnitureCatalogViewedInTree);
16624         }
16625     };
16626     /**
16627      * Returns <code>true</code> if furniture catalog should be viewed in a tree.
16628      * @return {boolean}
16629      */
16630     UserPreferencesController.prototype.isFurnitureCatalogViewedInTree = function () {
16631         return this.furnitureCatalogViewedInTree;
16632     };
16633     /**
16634      * Sets whether the navigation panel should be displayed or not.
16635      * @param {boolean} navigationPanelVisible
16636      */
16637     UserPreferencesController.prototype.setNavigationPanelVisible = function (navigationPanelVisible) {
16638         if (this.navigationPanelVisible !== navigationPanelVisible) {
16639             this.navigationPanelVisible = navigationPanelVisible;
16640             this.propertyChangeSupport.firePropertyChange(/* name */ "NAVIGATION_PANEL_VISIBLE", !navigationPanelVisible, navigationPanelVisible);
16641         }
16642     };
16643     /**
16644      * Returns <code>true</code> if the navigation panel should be displayed.
16645      * @return {boolean}
16646      */
16647     UserPreferencesController.prototype.isNavigationPanelVisible = function () {
16648         return this.navigationPanelVisible;
16649     };
16650     /**
16651      * Sets whether interactive editing in 3D view is enabled or not.
16652      * @param {boolean} editingIn3DViewEnabled
16653      */
16654     UserPreferencesController.prototype.setEditingIn3DViewEnabled = function (editingIn3DViewEnabled) {
16655         if (editingIn3DViewEnabled !== this.editingIn3DViewEnabled) {
16656             this.editingIn3DViewEnabled = editingIn3DViewEnabled;
16657             this.propertyChangeSupport.firePropertyChange(/* name */ "EDITING_IN_3D_VIEW_ENABLED", !editingIn3DViewEnabled, editingIn3DViewEnabled);
16658         }
16659     };
16660     /**
16661      * Returns whether interactive editing in 3D view is enabled or not.
16662      * @return {boolean}
16663      */
16664     UserPreferencesController.prototype.isEditingIn3DViewEnabled = function () {
16665         return this.editingIn3DViewEnabled;
16666     };
16667     /**
16668      * Sets whether aerial view should be centered on selection or not.
16669      * @param {boolean} aerialViewCenteredOnSelectionEnabled
16670      */
16671     UserPreferencesController.prototype.setAerialViewCenteredOnSelectionEnabled = function (aerialViewCenteredOnSelectionEnabled) {
16672         if (aerialViewCenteredOnSelectionEnabled !== this.aerialViewCenteredOnSelectionEnabled) {
16673             this.aerialViewCenteredOnSelectionEnabled = aerialViewCenteredOnSelectionEnabled;
16674             this.propertyChangeSupport.firePropertyChange(/* name */ "AERIAL_VIEW_CENTERED_ON_SELECTION_ENABLED", !aerialViewCenteredOnSelectionEnabled, aerialViewCenteredOnSelectionEnabled);
16675         }
16676     };
16677     /**
16678      * Returns whether aerial view should be centered on selection or not.
16679      * @return {boolean}
16680      */
16681     UserPreferencesController.prototype.isAerialViewCenteredOnSelectionEnabled = function () {
16682         return this.aerialViewCenteredOnSelectionEnabled;
16683     };
16684     /**
16685      * Sets whether the observer camera should be selected at each change.
16686      * @param {boolean} observerCameraSelectedAtChange
16687      */
16688     UserPreferencesController.prototype.setObserverCameraSelectedAtChange = function (observerCameraSelectedAtChange) {
16689         if (observerCameraSelectedAtChange !== this.observerCameraSelectedAtChange) {
16690             this.observerCameraSelectedAtChange = observerCameraSelectedAtChange;
16691             this.propertyChangeSupport.firePropertyChange(/* name */ "OBSERVER_CAMERA_SELECTED_AT_CHANGE", !observerCameraSelectedAtChange, observerCameraSelectedAtChange);
16692         }
16693     };
16694     /**
16695      * Returns whether the observer camera should be selected at each change.
16696      * @return {boolean}
16697      */
16698     UserPreferencesController.prototype.isObserverCameraSelectedAtChange = function () {
16699         return this.observerCameraSelectedAtChange;
16700     };
16701     /**
16702      * Sets whether magnetism is enabled or not.
16703      * @param {boolean} magnetismEnabled
16704      */
16705     UserPreferencesController.prototype.setMagnetismEnabled = function (magnetismEnabled) {
16706         if (magnetismEnabled !== this.magnetismEnabled) {
16707             this.magnetismEnabled = magnetismEnabled;
16708             this.propertyChangeSupport.firePropertyChange(/* name */ "MAGNETISM_ENABLED", !magnetismEnabled, magnetismEnabled);
16709         }
16710     };
16711     /**
16712      * Returns whether magnetism is enabled or not.
16713      * @return {boolean}
16714      */
16715     UserPreferencesController.prototype.isMagnetismEnabled = function () {
16716         return this.magnetismEnabled;
16717     };
16718     /**
16719      * Sets whether rulers are visible or not.
16720      * @param {boolean} rulersVisible
16721      */
16722     UserPreferencesController.prototype.setRulersVisible = function (rulersVisible) {
16723         if (rulersVisible !== this.rulersVisible) {
16724             this.rulersVisible = rulersVisible;
16725             this.propertyChangeSupport.firePropertyChange(/* name */ "RULERS_VISIBLE", !rulersVisible, rulersVisible);
16726         }
16727     };
16728     /**
16729      * Returns whether rulers are visible or not.
16730      * @return {boolean}
16731      */
16732     UserPreferencesController.prototype.isRulersVisible = function () {
16733         return this.rulersVisible;
16734     };
16735     /**
16736      * Sets whether grid is visible or not.
16737      * @param {boolean} gridVisible
16738      */
16739     UserPreferencesController.prototype.setGridVisible = function (gridVisible) {
16740         if (gridVisible !== this.gridVisible) {
16741             this.gridVisible = gridVisible;
16742             this.propertyChangeSupport.firePropertyChange(/* name */ "GRID_VISIBLE", !gridVisible, gridVisible);
16743         }
16744     };
16745     /**
16746      * Returns whether grid is visible or not.
16747      * @return {boolean}
16748      */
16749     UserPreferencesController.prototype.isGridVisible = function () {
16750         return this.gridVisible;
16751     };
16752     /**
16753      * Sets the name of the font that should be used by default.
16754      * @param {string} defaultFontName
16755      */
16756     UserPreferencesController.prototype.setDefaultFontName = function (defaultFontName) {
16757         if (defaultFontName !== this.defaultFontName && (defaultFontName == null || !(defaultFontName === this.defaultFontName))) {
16758             var oldName = this.defaultFontName;
16759             this.defaultFontName = defaultFontName;
16760             this.propertyChangeSupport.firePropertyChange(/* name */ "DEFAULT_FONT_NAME", oldName, defaultFontName);
16761         }
16762     };
16763     /**
16764      * Returns the name of the font that should be used by default or <code>null</code>
16765      * if the default font should be the default one in the application.
16766      * @return {string}
16767      */
16768     UserPreferencesController.prototype.getDefaultFontName = function () {
16769         return this.defaultFontName;
16770     };
16771     /**
16772      * Sets how furniture should be displayed in plan.
16773      * @param {boolean} furnitureViewedFromTop
16774      */
16775     UserPreferencesController.prototype.setFurnitureViewedFromTop = function (furnitureViewedFromTop) {
16776         if (this.furnitureViewedFromTop !== furnitureViewedFromTop) {
16777             this.furnitureViewedFromTop = furnitureViewedFromTop;
16778             this.propertyChangeSupport.firePropertyChange(/* name */ "FURNITURE_VIEWED_FROM_TOP", !furnitureViewedFromTop, furnitureViewedFromTop);
16779         }
16780     };
16781     /**
16782      * Returns how furniture should be displayed in plan.
16783      * @return {boolean}
16784      */
16785     UserPreferencesController.prototype.isFurnitureViewedFromTop = function () {
16786         return this.furnitureViewedFromTop;
16787     };
16788     /**
16789      * Sets the size used to generate icons of furniture viewed from top.
16790      * @param {number} furnitureModelIconSize
16791      */
16792     UserPreferencesController.prototype.setFurnitureModelIconSize = function (furnitureModelIconSize) {
16793         if (furnitureModelIconSize !== this.furnitureModelIconSize) {
16794             var oldSize = this.furnitureModelIconSize;
16795             this.furnitureModelIconSize = furnitureModelIconSize;
16796             this.propertyChangeSupport.firePropertyChange(/* name */ "FURNITURE_MODEL_ICON_SIZE", oldSize, furnitureModelIconSize);
16797         }
16798     };
16799     /**
16800      * Returns the size used to generate icons of furniture viewed from top.
16801      * @return {number}
16802      */
16803     UserPreferencesController.prototype.getFurnitureModelIconSize = function () {
16804         return this.furnitureModelIconSize;
16805     };
16806     /**
16807      * Sets whether floor texture is visible in plan or not.
16808      * @param {boolean} floorTextureVisible
16809      */
16810     UserPreferencesController.prototype.setRoomFloorColoredOrTextured = function (floorTextureVisible) {
16811         if (this.roomFloorColoredOrTextured !== floorTextureVisible) {
16812             this.roomFloorColoredOrTextured = floorTextureVisible;
16813             this.propertyChangeSupport.firePropertyChange(/* name */ "ROOM_FLOOR_COLORED_OR_TEXTURED", !floorTextureVisible, floorTextureVisible);
16814         }
16815     };
16816     /**
16817      * Returns <code>true</code> if floor texture is visible in plan.
16818      * @return {boolean}
16819      */
16820     UserPreferencesController.prototype.isRoomFloorColoredOrTextured = function () {
16821         return this.roomFloorColoredOrTextured;
16822     };
16823     /**
16824      * Sets default walls top pattern in plan, and notifies
16825      * listeners of this change.
16826      * @param {Object} wallPattern
16827      */
16828     UserPreferencesController.prototype.setWallPattern = function (wallPattern) {
16829         if (this.wallPattern !== wallPattern) {
16830             var oldWallPattern = this.wallPattern;
16831             this.wallPattern = wallPattern;
16832             this.propertyChangeSupport.firePropertyChange(/* name */ "WALL_PATTERN", oldWallPattern, wallPattern);
16833         }
16834     };
16835     /**
16836      * Returns the default walls top pattern in plan.
16837      * @return {Object}
16838      */
16839     UserPreferencesController.prototype.getWallPattern = function () {
16840         return this.wallPattern;
16841     };
16842     /**
16843      * Sets the edited new wall top pattern in plan, and notifies
16844      * listeners of this change.
16845      * @param {Object} newWallPattern
16846      */
16847     UserPreferencesController.prototype.setNewWallPattern = function (newWallPattern) {
16848         if (this.newWallPattern !== newWallPattern) {
16849             var oldNewWallPattern = this.newWallPattern;
16850             this.newWallPattern = newWallPattern;
16851             this.propertyChangeSupport.firePropertyChange(/* name */ "NEW_WALL_PATTERN", oldNewWallPattern, newWallPattern);
16852         }
16853     };
16854     /**
16855      * Returns the edited new wall top pattern in plan.
16856      * @return {Object}
16857      */
16858     UserPreferencesController.prototype.getNewWallPattern = function () {
16859         return this.newWallPattern;
16860     };
16861     /**
16862      * Sets the edited new wall thickness.
16863      * @param {number} newWallThickness
16864      */
16865     UserPreferencesController.prototype.setNewWallThickness = function (newWallThickness) {
16866         if (newWallThickness !== this.newWallThickness) {
16867             var oldNewWallThickness = this.newWallThickness;
16868             this.newWallThickness = newWallThickness;
16869             this.propertyChangeSupport.firePropertyChange(/* name */ "NEW_WALL_THICKNESS", oldNewWallThickness, newWallThickness);
16870         }
16871     };
16872     /**
16873      * Returns the edited new wall thickness.
16874      * @return {number}
16875      */
16876     UserPreferencesController.prototype.getNewWallThickness = function () {
16877         return this.newWallThickness;
16878     };
16879     /**
16880      * Sets the edited new wall height.
16881      * @param {number} newWallHeight
16882      */
16883     UserPreferencesController.prototype.setNewWallHeight = function (newWallHeight) {
16884         if (newWallHeight !== this.newWallHeight) {
16885             var oldNewWallHeight = this.newWallHeight;
16886             this.newWallHeight = newWallHeight;
16887             this.propertyChangeSupport.firePropertyChange(/* name */ "NEW_WALL_HEIGHT", oldNewWallHeight, newWallHeight);
16888         }
16889     };
16890     /**
16891      * Returns the edited new wall height.
16892      * @return {number}
16893      */
16894     UserPreferencesController.prototype.getNewWallHeight = function () {
16895         return this.newWallHeight;
16896     };
16897     /**
16898      * Sets the edited new floor thickness.
16899      * @param {number} newFloorThickness
16900      */
16901     UserPreferencesController.prototype.setNewFloorThickness = function (newFloorThickness) {
16902         if (newFloorThickness !== this.newFloorThickness) {
16903             var oldNewFloorThickness = this.newFloorThickness;
16904             this.newFloorThickness = newFloorThickness;
16905             this.propertyChangeSupport.firePropertyChange(/* name */ "NEW_FLOOR_THICKNESS", oldNewFloorThickness, newFloorThickness);
16906         }
16907     };
16908     /**
16909      * Returns the edited new floor thickness.
16910      * @return {number}
16911      */
16912     UserPreferencesController.prototype.getNewFloorThickness = function () {
16913         return this.newFloorThickness;
16914     };
16915     /**
16916      * Sets whether updates should be checked or not.
16917      * @param {boolean} updatesChecked
16918      */
16919     UserPreferencesController.prototype.setCheckUpdatesEnabled = function (updatesChecked) {
16920         if (updatesChecked !== this.checkUpdatesEnabled) {
16921             this.checkUpdatesEnabled = updatesChecked;
16922             this.propertyChangeSupport.firePropertyChange(/* name */ "CHECK_UPDATES_ENABLED", !updatesChecked, updatesChecked);
16923         }
16924     };
16925     /**
16926      * Returns <code>true</code> if updates should be checked.
16927      * @return {boolean}
16928      */
16929     UserPreferencesController.prototype.isCheckUpdatesEnabled = function () {
16930         return this.checkUpdatesEnabled;
16931     };
16932     /**
16933      * Sets the edited auto recovery save delay.
16934      * @param {number} autoSaveDelayForRecovery
16935      */
16936     UserPreferencesController.prototype.setAutoSaveDelayForRecovery = function (autoSaveDelayForRecovery) {
16937         if (autoSaveDelayForRecovery !== this.autoSaveDelayForRecovery) {
16938             var oldAutoSaveDelayForRecovery = this.autoSaveDelayForRecovery;
16939             this.autoSaveDelayForRecovery = autoSaveDelayForRecovery;
16940             this.propertyChangeSupport.firePropertyChange(/* name */ "AUTO_SAVE_DELAY_FOR_RECOVERY", oldAutoSaveDelayForRecovery, autoSaveDelayForRecovery);
16941         }
16942     };
16943     /**
16944      * Returns the edited auto recovery save delay.
16945      * @return {number}
16946      */
16947     UserPreferencesController.prototype.getAutoSaveDelayForRecovery = function () {
16948         return this.autoSaveDelayForRecovery;
16949     };
16950     /**
16951      * Sets whether auto recovery save is enabled or not.
16952      * @param {boolean} autoSaveForRecoveryEnabled
16953      */
16954     UserPreferencesController.prototype.setAutoSaveForRecoveryEnabled = function (autoSaveForRecoveryEnabled) {
16955         if (autoSaveForRecoveryEnabled !== this.autoSaveForRecoveryEnabled) {
16956             this.autoSaveForRecoveryEnabled = autoSaveForRecoveryEnabled;
16957             this.propertyChangeSupport.firePropertyChange(/* name */ "AUTO_SAVE_FOR_RECOVERY_ENABLED", !autoSaveForRecoveryEnabled, autoSaveForRecoveryEnabled);
16958         }
16959     };
16960     /**
16961      * Returns <code>true</code> if auto recovery save is enabled.
16962      * @return {boolean}
16963      */
16964     UserPreferencesController.prototype.isAutoSaveForRecoveryEnabled = function () {
16965         return this.autoSaveForRecoveryEnabled;
16966     };
16967     /**
16968      * Resets the displayed flags of action tips.
16969      */
16970     UserPreferencesController.prototype.resetDisplayedActionTips = function () {
16971         this.preferences.resetIgnoredActionTips();
16972     };
16973     /**
16974      * Controls the modification of user preferences.
16975      */
16976     UserPreferencesController.prototype.modifyUserPreferences = function () {
16977         this.preferences.setLanguage(this.getLanguage());
16978         this.preferences.setUnit(this.getUnit());
16979         this.preferences.setCurrency(this.getCurrency());
16980         this.preferences.setValueAddedTaxEnabled(this.isValueAddedTaxEnabled());
16981         this.preferences.setFurnitureCatalogViewedInTree(this.isFurnitureCatalogViewedInTree());
16982         this.preferences.setNavigationPanelVisible(this.isNavigationPanelVisible());
16983         this.preferences.setEditingIn3DViewEnabled(this.isEditingIn3DViewEnabled());
16984         this.preferences.setAerialViewCenteredOnSelectionEnabled(this.isAerialViewCenteredOnSelectionEnabled());
16985         this.preferences.setObserverCameraSelectedAtChange(this.isObserverCameraSelectedAtChange());
16986         this.preferences.setMagnetismEnabled(this.isMagnetismEnabled());
16987         this.preferences.setRulersVisible(this.isRulersVisible());
16988         this.preferences.setGridVisible(this.isGridVisible());
16989         this.preferences.setDefaultFontName(this.getDefaultFontName());
16990         this.preferences.setFurnitureViewedFromTop(this.isFurnitureViewedFromTop());
16991         this.preferences.setFurnitureModelIconSize(this.getFurnitureModelIconSize());
16992         this.preferences.setFloorColoredOrTextured(this.isRoomFloorColoredOrTextured());
16993         this.preferences.setWallPattern(this.getWallPattern());
16994         this.preferences.setNewWallPattern(this.getNewWallPattern());
16995         this.preferences.setNewWallThickness(this.getNewWallThickness());
16996         this.preferences.setNewWallHeight(this.getNewWallHeight());
16997         this.preferences.setNewFloorThickness(this.getNewFloorThickness());
16998         this.preferences.setCheckUpdatesEnabled(this.isCheckUpdatesEnabled());
16999         this.preferences.setAutoSaveDelayForRecovery(this.isAutoSaveForRecoveryEnabled() ? this.getAutoSaveDelayForRecovery() : 0);
17000     };
17001     return UserPreferencesController;
17002 }());
17003 UserPreferencesController["__class"] = "com.eteks.sweethome3d.viewcontroller.UserPreferencesController";
17004 UserPreferencesController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
17005 /**
17006  * The controller of the video creation view.
17007  * @author Emmanuel Puybaret
17008  * @param {Home} home
17009  * @param {UserPreferences} preferences
17010  * @param {Object} viewFactory
17011  * @param {Object} contentManager
17012  * @class
17013  * @ignore
17014  */
17015 var VideoController = /** @class */ (function () {
17016     function VideoController(home, preferences, viewFactory, contentManager) {
17017         if (this.home === undefined) {
17018             this.home = null;
17019         }
17020         if (this.preferences === undefined) {
17021             this.preferences = null;
17022         }
17023         if (this.viewFactory === undefined) {
17024             this.viewFactory = null;
17025         }
17026         if (this.contentManager === undefined) {
17027             this.contentManager = null;
17028         }
17029         if (this.propertyChangeSupport === undefined) {
17030             this.propertyChangeSupport = null;
17031         }
17032         if (this.videoView === undefined) {
17033             this.videoView = null;
17034         }
17035         if (this.aspectRatio === undefined) {
17036             this.aspectRatio = null;
17037         }
17038         if (this.frameRate === undefined) {
17039             this.frameRate = 0;
17040         }
17041         if (this.width === undefined) {
17042             this.width = 0;
17043         }
17044         if (this.height === undefined) {
17045             this.height = 0;
17046         }
17047         if (this.quality === undefined) {
17048             this.quality = 0;
17049         }
17050         if (this.speed === undefined) {
17051             this.speed = 0;
17052         }
17053         if (this.cameraPath === undefined) {
17054             this.cameraPath = null;
17055         }
17056         if (this.time === undefined) {
17057             this.time = 0;
17058         }
17059         if (this.renderer === undefined) {
17060             this.renderer = null;
17061         }
17062         if (this.ceilingLightColor === undefined) {
17063             this.ceilingLightColor = 0;
17064         }
17065         this.home = home;
17066         this.preferences = preferences;
17067         this.viewFactory = viewFactory;
17068         this.contentManager = contentManager;
17069         this.propertyChangeSupport = new PropertyChangeSupport(this);
17070         this.updateProperties();
17071         home.getEnvironment().addPropertyChangeListener("CEILING_LIGHT_COLOR", new VideoController.HomeEnvironmentChangeListener(this));
17072     }
17073     /**
17074      * Returns the view associated with this controller.
17075      * @return {Object}
17076      */
17077     VideoController.prototype.getView = function () {
17078         if (this.videoView == null) {
17079             this.videoView = this.viewFactory.createVideoView(this.home, this.preferences, this);
17080         }
17081         return this.videoView;
17082     };
17083     /**
17084      * Displays the view controlled by this controller.
17085      * @param {Object} parentView
17086      */
17087     VideoController.prototype.displayView = function (parentView) {
17088         this.getView().displayView(parentView);
17089     };
17090     /**
17091      * Returns the content manager of this controller.
17092      * @return {Object}
17093      */
17094     VideoController.prototype.getContentManager = function () {
17095         return this.contentManager;
17096     };
17097     /**
17098      * Adds the property change <code>listener</code> in parameter to this controller.
17099      * @param {string} property
17100      * @param {PropertyChangeListener} listener
17101      */
17102     VideoController.prototype.addPropertyChangeListener = function (property, listener) {
17103         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
17104     };
17105     /**
17106      * Removes the property change <code>listener</code> in parameter from this controller.
17107      * @param {string} property
17108      * @param {PropertyChangeListener} listener
17109      */
17110     VideoController.prototype.removePropertyChangeListener = function (property, listener) {
17111         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
17112     };
17113     /**
17114      * Updates edited properties from the video creation preferences.
17115      */
17116     VideoController.prototype.updateProperties = function () {
17117         var homeEnvironment = this.home.getEnvironment();
17118         this.setFrameRate(homeEnvironment.getVideoFrameRate());
17119         this.setWidth(homeEnvironment.getVideoWidth(), false);
17120         this.setHeight(homeEnvironment.getVideoHeight(), false);
17121         this.setAspectRatio(homeEnvironment.getVideoAspectRatio());
17122         this.setQuality(homeEnvironment.getVideoQuality());
17123         this.setSpeed(homeEnvironment.getVideoSpeed());
17124         var videoCameraPath = homeEnvironment.getVideoCameraPath();
17125         this.setCameraPath(videoCameraPath);
17126         this.setTime(/* isEmpty */ (videoCameraPath.length == 0) ? this.home.getCamera().getTime() : /* get */ videoCameraPath[0].getTime());
17127         var renderer = this.home.getCamera().getRenderer();
17128         if (renderer == null) {
17129             renderer = this.preferences.getPhotoRenderer();
17130         }
17131         this.setRenderer(renderer, false);
17132         this.setCeilingLightColor(homeEnvironment.getCeillingLightColor());
17133     };
17134     /**
17135      * Sets the aspect ratio of the video.
17136      * @param {AspectRatio} aspectRatio
17137      */
17138     VideoController.prototype.setAspectRatio = function (aspectRatio) {
17139         if (this.aspectRatio !== aspectRatio) {
17140             var oldAspectRatio = this.aspectRatio;
17141             this.aspectRatio = aspectRatio;
17142             this.propertyChangeSupport.firePropertyChange(/* name */ "ASPECT_RATIO", oldAspectRatio, aspectRatio);
17143             this.home.getEnvironment().setVideoAspectRatio(this.aspectRatio);
17144             this.setHeight(Math.round(this.width / { FREE_RATIO: null, VIEW_3D_RATIO: null, RATIO_4_3: 4 / 3, RATIO_3_2: 1.5, RATIO_16_9: 16 / 9, RATIO_2_1: 2 / 1, SQUARE_RATIO: 1 }[this.aspectRatio]), false);
17145         }
17146     };
17147     /**
17148      * Returns the aspect ratio of the video.
17149      * @return {AspectRatio}
17150      */
17151     VideoController.prototype.getAspectRatio = function () {
17152         return this.aspectRatio;
17153     };
17154     /**
17155      * Sets the frame rate of the video.
17156      * @param {number} frameRate
17157      */
17158     VideoController.prototype.setFrameRate = function (frameRate) {
17159         if (this.frameRate !== frameRate) {
17160             var oldFrameRate = this.frameRate;
17161             this.frameRate = frameRate;
17162             this.propertyChangeSupport.firePropertyChange(/* name */ "QUALITY", oldFrameRate, frameRate);
17163             this.home.getEnvironment().setVideoFrameRate(this.frameRate);
17164         }
17165     };
17166     /**
17167      * Returns the frame rate of the video.
17168      * @return {number}
17169      */
17170     VideoController.prototype.getFrameRate = function () {
17171         return this.frameRate;
17172     };
17173     VideoController.prototype.setWidth = function (width, updateHeight) {
17174         if (updateHeight === void 0) { updateHeight = true; }
17175         if (this.width !== width) {
17176             var oldWidth = this.width;
17177             this.width = width;
17178             this.propertyChangeSupport.firePropertyChange(/* name */ "WIDTH", oldWidth, width);
17179             if (updateHeight) {
17180                 this.setHeight(Math.round(width / { FREE_RATIO: null, VIEW_3D_RATIO: null, RATIO_4_3: 4 / 3, RATIO_3_2: 1.5, RATIO_16_9: 16 / 9, RATIO_2_1: 2 / 1, SQUARE_RATIO: 1 }[this.aspectRatio]), false);
17181             }
17182             this.home.getEnvironment().setVideoWidth(this.width);
17183         }
17184     };
17185     /**
17186      * Returns the width of the video.
17187      * @return {number}
17188      */
17189     VideoController.prototype.getWidth = function () {
17190         return this.width;
17191     };
17192     VideoController.prototype.setHeight = function (height, updateWidth) {
17193         if (updateWidth === void 0) { updateWidth = true; }
17194         if (this.height !== height) {
17195             var oldHeight = this.height;
17196             this.height = height;
17197             this.propertyChangeSupport.firePropertyChange(/* name */ "HEIGHT", oldHeight, height);
17198             if (updateWidth) {
17199                 this.setWidth(Math.round(height * { FREE_RATIO: null, VIEW_3D_RATIO: null, RATIO_4_3: 4 / 3, RATIO_3_2: 1.5, RATIO_16_9: 16 / 9, RATIO_2_1: 2 / 1, SQUARE_RATIO: 1 }[this.aspectRatio]), false);
17200             }
17201         }
17202     };
17203     /**
17204      * Returns the height of the video.
17205      * @return {number}
17206      */
17207     VideoController.prototype.getHeight = function () {
17208         return this.height;
17209     };
17210     /**
17211      * Sets the rendering quality of the video.
17212      * @param {number} quality
17213      */
17214     VideoController.prototype.setQuality = function (quality) {
17215         if (this.quality !== quality) {
17216             var oldQuality = this.quality;
17217             this.quality = Math.min(quality, this.getQualityLevelCount() - 1);
17218             this.propertyChangeSupport.firePropertyChange(/* name */ "QUALITY", oldQuality, quality);
17219             this.home.getEnvironment().setVideoQuality(this.quality);
17220         }
17221     };
17222     /**
17223      * Returns the rendering quality of the video.
17224      * @return {number}
17225      */
17226     VideoController.prototype.getQuality = function () {
17227         return this.quality;
17228     };
17229     /**
17230      * Sets the preferred speed of movements in the video in m/s.
17231      * @param {number} speed
17232      */
17233     VideoController.prototype.setSpeed = function (speed) {
17234         if (this.speed !== speed) {
17235             var oldSpeed = this.speed;
17236             this.speed = speed;
17237             this.propertyChangeSupport.firePropertyChange(/* name */ "SPEED", oldSpeed, speed);
17238             this.home.getEnvironment().setVideoSpeed(this.speed);
17239         }
17240     };
17241     /**
17242      * Returns the preferred speed of movements in the video in m/s.
17243      * @return {number}
17244      */
17245     VideoController.prototype.getSpeed = function () {
17246         return this.speed;
17247     };
17248     /**
17249      * Returns the maximum value for quality.
17250      * @return {number}
17251      */
17252     VideoController.prototype.getQualityLevelCount = function () {
17253         return 4;
17254     };
17255     /**
17256      * Returns the camera path of the video.
17257      * @return {Camera[]}
17258      */
17259     VideoController.prototype.getCameraPath = function () {
17260         return this.cameraPath;
17261     };
17262     /**
17263      * Sets the camera locations of the video.
17264      * @param {Camera[]} cameraPath
17265      */
17266     VideoController.prototype.setCameraPath = function (cameraPath) {
17267         if (this.cameraPath !== cameraPath) {
17268             var oldCameraPath = this.cameraPath;
17269             this.cameraPath = cameraPath;
17270             this.propertyChangeSupport.firePropertyChange(/* name */ "CAMERA_PATH", oldCameraPath, cameraPath);
17271             this.home.getEnvironment().setVideoCameraPath(this.cameraPath);
17272         }
17273     };
17274     /**
17275      * Sets the edited time in UTC time zone.
17276      * @param {number} time
17277      */
17278     VideoController.prototype.setTime = function (time) {
17279         if (this.time !== time) {
17280             var oldTime = this.time;
17281             this.time = time;
17282             this.propertyChangeSupport.firePropertyChange(/* name */ "TIME", oldTime, time);
17283             this.home.getCamera().setTime(time);
17284         }
17285     };
17286     /**
17287      * Returns the edited time in UTC time zone.
17288      * @return {number}
17289      */
17290     VideoController.prototype.getTime = function () {
17291         return this.time;
17292     };
17293     VideoController.prototype.setRenderer = function (renderer, updatePreferences) {
17294         if (updatePreferences === void 0) { updatePreferences = true; }
17295         if (this.renderer !== renderer) {
17296             var oldRenderer = this.renderer;
17297             this.renderer = renderer;
17298             this.propertyChangeSupport.firePropertyChange(/* name */ "RENDERER", oldRenderer, renderer);
17299             var cameraPath = this.home.getEnvironment().getVideoCameraPath();
17300             if (!(cameraPath.length == 0)) {
17301                 cameraPath = (cameraPath.slice(0));
17302                 /* get */ cameraPath[0].setRenderer(renderer);
17303                 this.setCameraPath(cameraPath);
17304             }
17305             if (updatePreferences) {
17306                 this.preferences.setPhotoRenderer(renderer);
17307             }
17308         }
17309     };
17310     /**
17311      * Returns the edited camera rendering engine.
17312      * @return {string}
17313      */
17314     VideoController.prototype.getRenderer = function () {
17315         return this.renderer;
17316     };
17317     /**
17318      * Sets the edited ceiling light color.
17319      * @param {number} ceilingLightColor
17320      */
17321     VideoController.prototype.setCeilingLightColor = function (ceilingLightColor) {
17322         if (this.ceilingLightColor !== ceilingLightColor) {
17323             var oldCeilingLightColor = this.ceilingLightColor;
17324             this.ceilingLightColor = ceilingLightColor;
17325             this.propertyChangeSupport.firePropertyChange(/* name */ "CEILING_LIGHT_COLOR", oldCeilingLightColor, ceilingLightColor);
17326             this.home.getEnvironment().setCeillingLightColor(ceilingLightColor);
17327         }
17328     };
17329     /**
17330      * Returns the edited ceiling light color.
17331      * @return {number}
17332      */
17333     VideoController.prototype.getCeilingLightColor = function () {
17334         return this.ceilingLightColor;
17335     };
17336     /**
17337      * Controls the change of value of a visual property in home.
17338      * @deprecated {@link #setVisualProperty(String, Object) setVisualProperty} should be replaced by a call to
17339      * {@link #setHomeProperty(String, String) setHomeProperty} to ensure the property can be easily saved and read.
17340      * @param {string} propertyName
17341      * @param {Object} propertyValue
17342      */
17343     VideoController.prototype.setVisualProperty = function (propertyName, propertyValue) {
17344         this.home.setVisualProperty(propertyName, propertyValue);
17345     };
17346     /**
17347      * Controls the change of value of a property in home.
17348      * @param {string} propertyName
17349      * @param {string} propertyValue
17350      */
17351     VideoController.prototype.setHomeProperty = function (propertyName, propertyValue) {
17352         this.home.setProperty(propertyName, propertyValue);
17353     };
17354     return VideoController;
17355 }());
17356 VideoController["__class"] = "com.eteks.sweethome3d.viewcontroller.VideoController";
17357 VideoController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
17358 (function (VideoController) {
17359     /**
17360      * Home environment listener that updates properties. This listener is bound to this controller
17361      * with a weak reference to avoid strong link between home and this controller.
17362      * @param {VideoController} videoController
17363      * @class
17364      */
17365     var HomeEnvironmentChangeListener = /** @class */ (function () {
17366         function HomeEnvironmentChangeListener(videoController) {
17367             if (this.videoController === undefined) {
17368                 this.videoController = null;
17369             }
17370             this.videoController = (videoController);
17371         }
17372         HomeEnvironmentChangeListener.prototype.propertyChange = function (ev) {
17373             var controller = this.videoController;
17374             if (controller == null) {
17375                 ev.getSource().removePropertyChangeListener("CEILING_LIGHT_COLOR", this);
17376             }
17377             else {
17378                 controller.updateProperties();
17379             }
17380         };
17381         return HomeEnvironmentChangeListener;
17382     }());
17383     VideoController.HomeEnvironmentChangeListener = HomeEnvironmentChangeListener;
17384     HomeEnvironmentChangeListener["__class"] = "com.eteks.sweethome3d.viewcontroller.VideoController.HomeEnvironmentChangeListener";
17385 })(VideoController || (VideoController = {}));
17386 /**
17387  * An undoable edit able with a localized presentation name.
17388  * @author Emmanuel Puybaret
17389  * @param {UserPreferences} preferences
17390  * @param {Object} controllerClass
17391  * @param {string} presentationNameKey
17392  * @class
17393  * @extends javax.swing.undo.AbstractUndoableEdit
17394  * @private
17395  */
17396 var LocalizedUndoableEdit = /** @class */ (function (_super) {
17397     __extends(LocalizedUndoableEdit, _super);
17398     function LocalizedUndoableEdit(preferences, controllerClass, presentationNameKey) {
17399         var _this = _super.call(this) || this;
17400         if (_this.preferences === undefined) {
17401             _this.preferences = null;
17402         }
17403         if (_this.controllerClass === undefined) {
17404             _this.controllerClass = null;
17405         }
17406         if (_this.presentationNameKey === undefined) {
17407             _this.presentationNameKey = null;
17408         }
17409         _this.preferences = preferences;
17410         _this.controllerClass = controllerClass;
17411         _this.presentationNameKey = presentationNameKey;
17412         return _this;
17413     }
17414     /**
17415      *
17416      * @return {string}
17417      */
17418     LocalizedUndoableEdit.prototype.getPresentationName = function () {
17419         return this.preferences.getLocalizedString(this.controllerClass, this.presentationNameKey);
17420     };
17421     return LocalizedUndoableEdit;
17422 }(javax.swing.undo.AbstractUndoableEdit));
17423 LocalizedUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.LocalizedUndoableEdit";
17424 LocalizedUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
17425 var ContentManager;
17426 (function (ContentManager) {
17427     var ContentType;
17428     (function (ContentType) {
17429         ContentType[ContentType["SWEET_HOME_3D"] = 0] = "SWEET_HOME_3D";
17430         ContentType[ContentType["MODEL"] = 1] = "MODEL";
17431         ContentType[ContentType["IMAGE"] = 2] = "IMAGE";
17432         ContentType[ContentType["CSV"] = 3] = "CSV";
17433         ContentType[ContentType["SVG"] = 4] = "SVG";
17434         ContentType[ContentType["OBJ"] = 5] = "OBJ";
17435         ContentType[ContentType["PNG"] = 6] = "PNG";
17436         ContentType[ContentType["JPEG"] = 7] = "JPEG";
17437         ContentType[ContentType["MOV"] = 8] = "MOV";
17438         ContentType[ContentType["PDF"] = 9] = "PDF";
17439         ContentType[ContentType["LANGUAGE_LIBRARY"] = 10] = "LANGUAGE_LIBRARY";
17440         ContentType[ContentType["TEXTURES_LIBRARY"] = 11] = "TEXTURES_LIBRARY";
17441         ContentType[ContentType["FURNITURE_LIBRARY"] = 12] = "FURNITURE_LIBRARY";
17442         ContentType[ContentType["PLUGIN"] = 13] = "PLUGIN";
17443         ContentType[ContentType["PHOTOS_DIRECTORY"] = 14] = "PHOTOS_DIRECTORY";
17444         ContentType[ContentType["USER_DEFINED"] = 15] = "USER_DEFINED";
17445     })(ContentType = ContentManager.ContentType || (ContentManager.ContentType = {}));
17446 })(ContentManager || (ContentManager = {}));
17447 var PlanView;
17448 (function (PlanView) {
17449     /**
17450      * The cursor types available in plan view.
17451      * @enum
17452      * @property {PlanView.CursorType} SELECTION
17453      * @property {PlanView.CursorType} PANNING
17454      * @property {PlanView.CursorType} DRAW
17455      * @property {PlanView.CursorType} ROTATION
17456      * @property {PlanView.CursorType} ELEVATION
17457      * @property {PlanView.CursorType} HEIGHT
17458      * @property {PlanView.CursorType} POWER
17459      * @property {PlanView.CursorType} RESIZE
17460      * @property {PlanView.CursorType} DUPLICATION
17461      * @property {PlanView.CursorType} MOVE
17462      * @class
17463      */
17464     var CursorType;
17465     (function (CursorType) {
17466         CursorType[CursorType["SELECTION"] = 0] = "SELECTION";
17467         CursorType[CursorType["PANNING"] = 1] = "PANNING";
17468         CursorType[CursorType["DRAW"] = 2] = "DRAW";
17469         CursorType[CursorType["ROTATION"] = 3] = "ROTATION";
17470         CursorType[CursorType["ELEVATION"] = 4] = "ELEVATION";
17471         CursorType[CursorType["HEIGHT"] = 5] = "HEIGHT";
17472         CursorType[CursorType["POWER"] = 6] = "POWER";
17473         CursorType[CursorType["RESIZE"] = 7] = "RESIZE";
17474         CursorType[CursorType["DUPLICATION"] = 8] = "DUPLICATION";
17475         CursorType[CursorType["MOVE"] = 9] = "MOVE";
17476     })(CursorType = PlanView.CursorType || (PlanView.CursorType = {}));
17477 })(PlanView || (PlanView = {}));
17478 /**
17479  * A MVC controller for texture choice.
17480  * @author Emmanuel Puybaret
17481  * @param {string} title
17482  * @param {string} fitAreaText
17483  * @param {boolean} rotationSupported
17484  * @param {UserPreferences} preferences
17485  * @param {Object} viewFactory
17486  * @param {Object} contentManager
17487  * @class
17488  */
17489 var TextureChoiceController = /** @class */ (function () {
17490     function TextureChoiceController(title, fitAreaText, rotationSupported, preferences, viewFactory, contentManager) {
17491         if (((typeof title === 'string') || title === null) && ((typeof fitAreaText === 'string') || fitAreaText === null) && ((typeof rotationSupported === 'boolean') || rotationSupported === null) && ((preferences != null && preferences instanceof UserPreferences) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || viewFactory === null) && ((contentManager != null && (contentManager.constructor != null && contentManager.constructor["__interfaces"] != null && contentManager.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || contentManager === null)) {
17492             var __args = arguments;
17493             if (this.title === undefined) {
17494                 this.title = null;
17495             }
17496             if (this.fitAreaText === undefined) {
17497                 this.fitAreaText = null;
17498             }
17499             if (this.rotationSupported === undefined) {
17500                 this.rotationSupported = false;
17501             }
17502             if (this.preferences === undefined) {
17503                 this.preferences = null;
17504             }
17505             if (this.viewFactory === undefined) {
17506                 this.viewFactory = null;
17507             }
17508             if (this.contentManager === undefined) {
17509                 this.contentManager = null;
17510             }
17511             if (this.propertyChangeSupport === undefined) {
17512                 this.propertyChangeSupport = null;
17513             }
17514             if (this.textureChoiceView === undefined) {
17515                 this.textureChoiceView = null;
17516             }
17517             if (this.texture === undefined) {
17518                 this.texture = null;
17519             }
17520             this.title = title;
17521             this.fitAreaText = fitAreaText;
17522             this.rotationSupported = rotationSupported;
17523             this.preferences = preferences;
17524             this.viewFactory = viewFactory;
17525             this.contentManager = contentManager;
17526             this.propertyChangeSupport = new PropertyChangeSupport(this);
17527         }
17528         else if (((typeof title === 'string') || title === null) && ((typeof fitAreaText === 'boolean') || fitAreaText === null) && ((rotationSupported != null && rotationSupported instanceof UserPreferences) || rotationSupported === null) && ((preferences != null && (preferences.constructor != null && preferences.constructor["__interfaces"] != null && preferences.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || viewFactory === null) && contentManager === undefined) {
17529             var __args = arguments;
17530             var rotationSupported_1 = __args[1];
17531             var preferences_4 = __args[2];
17532             var viewFactory_3 = __args[3];
17533             var contentManager_3 = __args[4];
17534             {
17535                 var __args_64 = arguments;
17536                 var fitAreaText_1 = null;
17537                 if (this.title === undefined) {
17538                     this.title = null;
17539                 }
17540                 if (this.fitAreaText === undefined) {
17541                     this.fitAreaText = null;
17542                 }
17543                 if (this.rotationSupported === undefined) {
17544                     this.rotationSupported = false;
17545                 }
17546                 if (this.preferences === undefined) {
17547                     this.preferences = null;
17548                 }
17549                 if (this.viewFactory === undefined) {
17550                     this.viewFactory = null;
17551                 }
17552                 if (this.contentManager === undefined) {
17553                     this.contentManager = null;
17554                 }
17555                 if (this.propertyChangeSupport === undefined) {
17556                     this.propertyChangeSupport = null;
17557                 }
17558                 if (this.textureChoiceView === undefined) {
17559                     this.textureChoiceView = null;
17560                 }
17561                 if (this.texture === undefined) {
17562                     this.texture = null;
17563                 }
17564                 this.title = title;
17565                 this.fitAreaText = fitAreaText_1;
17566                 this.rotationSupported = rotationSupported_1;
17567                 this.preferences = preferences_4;
17568                 this.viewFactory = viewFactory_3;
17569                 this.contentManager = contentManager_3;
17570                 this.propertyChangeSupport = new PropertyChangeSupport(this);
17571             }
17572             if (this.title === undefined) {
17573                 this.title = null;
17574             }
17575             if (this.fitAreaText === undefined) {
17576                 this.fitAreaText = null;
17577             }
17578             if (this.rotationSupported === undefined) {
17579                 this.rotationSupported = false;
17580             }
17581             if (this.preferences === undefined) {
17582                 this.preferences = null;
17583             }
17584             if (this.viewFactory === undefined) {
17585                 this.viewFactory = null;
17586             }
17587             if (this.contentManager === undefined) {
17588                 this.contentManager = null;
17589             }
17590             if (this.propertyChangeSupport === undefined) {
17591                 this.propertyChangeSupport = null;
17592             }
17593             if (this.textureChoiceView === undefined) {
17594                 this.textureChoiceView = null;
17595             }
17596             if (this.texture === undefined) {
17597                 this.texture = null;
17598             }
17599         }
17600         else if (((typeof title === 'string') || title === null) && ((fitAreaText != null && fitAreaText instanceof UserPreferences) || fitAreaText === null) && ((rotationSupported != null && (rotationSupported.constructor != null && rotationSupported.constructor["__interfaces"] != null && rotationSupported.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || rotationSupported === null) && ((preferences != null && (preferences.constructor != null && preferences.constructor["__interfaces"] != null && preferences.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || preferences === null) && viewFactory === undefined && contentManager === undefined) {
17601             var __args = arguments;
17602             var preferences_5 = __args[1];
17603             var viewFactory_4 = __args[2];
17604             var contentManager_4 = __args[3];
17605             {
17606                 var __args_65 = arguments;
17607                 var rotationSupported_2 = true;
17608                 {
17609                     var __args_66 = arguments;
17610                     var fitAreaText_2 = null;
17611                     if (this.title === undefined) {
17612                         this.title = null;
17613                     }
17614                     if (this.fitAreaText === undefined) {
17615                         this.fitAreaText = null;
17616                     }
17617                     if (this.rotationSupported === undefined) {
17618                         this.rotationSupported = false;
17619                     }
17620                     if (this.preferences === undefined) {
17621                         this.preferences = null;
17622                     }
17623                     if (this.viewFactory === undefined) {
17624                         this.viewFactory = null;
17625                     }
17626                     if (this.contentManager === undefined) {
17627                         this.contentManager = null;
17628                     }
17629                     if (this.propertyChangeSupport === undefined) {
17630                         this.propertyChangeSupport = null;
17631                     }
17632                     if (this.textureChoiceView === undefined) {
17633                         this.textureChoiceView = null;
17634                     }
17635                     if (this.texture === undefined) {
17636                         this.texture = null;
17637                     }
17638                     this.title = title;
17639                     this.fitAreaText = fitAreaText_2;
17640                     this.rotationSupported = rotationSupported_2;
17641                     this.preferences = preferences_5;
17642                     this.viewFactory = viewFactory_4;
17643                     this.contentManager = contentManager_4;
17644                     this.propertyChangeSupport = new PropertyChangeSupport(this);
17645                 }
17646                 if (this.title === undefined) {
17647                     this.title = null;
17648                 }
17649                 if (this.fitAreaText === undefined) {
17650                     this.fitAreaText = null;
17651                 }
17652                 if (this.rotationSupported === undefined) {
17653                     this.rotationSupported = false;
17654                 }
17655                 if (this.preferences === undefined) {
17656                     this.preferences = null;
17657                 }
17658                 if (this.viewFactory === undefined) {
17659                     this.viewFactory = null;
17660                 }
17661                 if (this.contentManager === undefined) {
17662                     this.contentManager = null;
17663                 }
17664                 if (this.propertyChangeSupport === undefined) {
17665                     this.propertyChangeSupport = null;
17666                 }
17667                 if (this.textureChoiceView === undefined) {
17668                     this.textureChoiceView = null;
17669                 }
17670                 if (this.texture === undefined) {
17671                     this.texture = null;
17672                 }
17673             }
17674             if (this.title === undefined) {
17675                 this.title = null;
17676             }
17677             if (this.fitAreaText === undefined) {
17678                 this.fitAreaText = null;
17679             }
17680             if (this.rotationSupported === undefined) {
17681                 this.rotationSupported = false;
17682             }
17683             if (this.preferences === undefined) {
17684                 this.preferences = null;
17685             }
17686             if (this.viewFactory === undefined) {
17687                 this.viewFactory = null;
17688             }
17689             if (this.contentManager === undefined) {
17690                 this.contentManager = null;
17691             }
17692             if (this.propertyChangeSupport === undefined) {
17693                 this.propertyChangeSupport = null;
17694             }
17695             if (this.textureChoiceView === undefined) {
17696                 this.textureChoiceView = null;
17697             }
17698             if (this.texture === undefined) {
17699                 this.texture = null;
17700             }
17701         }
17702         else
17703             throw new Error('invalid overload');
17704     }
17705     /**
17706      * Returns the view associated with this controller.
17707      * @return {Object}
17708      */
17709     TextureChoiceController.prototype.getView = function () {
17710         if (this.textureChoiceView == null) {
17711             this.textureChoiceView = this.viewFactory.createTextureChoiceView(this.preferences, this);
17712         }
17713         return this.textureChoiceView;
17714     };
17715     /**
17716      * Adds the property change <code>listener</code> in parameter to this controller.
17717      * @param {string} property
17718      * @param {PropertyChangeListener} listener
17719      */
17720     TextureChoiceController.prototype.addPropertyChangeListener = function (property, listener) {
17721         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
17722     };
17723     /**
17724      * Removes the property change <code>listener</code> in parameter from this controller.
17725      * @param {string} property
17726      * @param {PropertyChangeListener} listener
17727      */
17728     TextureChoiceController.prototype.removePropertyChangeListener = function (property, listener) {
17729         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
17730     };
17731     /**
17732      * Sets the texture displayed by view and fires a <code>PropertyChangeEvent</code>.
17733      * @param {HomeTexture} texture
17734      */
17735     TextureChoiceController.prototype.setTexture = function (texture) {
17736         if (this.texture !== texture && (texture == null || !texture.equals(this.texture))) {
17737             var oldTexture = this.texture;
17738             this.texture = texture;
17739             this.propertyChangeSupport.firePropertyChange(/* name */ "TEXTURE", oldTexture, texture);
17740         }
17741     };
17742     /**
17743      * Returns the texture displayed by view.
17744      * @return {HomeTexture}
17745      */
17746     TextureChoiceController.prototype.getTexture = function () {
17747         return this.texture;
17748     };
17749     /**
17750      * Returns the text that should be displayed as texture choice dialog title.
17751      * @return {string}
17752      */
17753     TextureChoiceController.prototype.getDialogTitle = function () {
17754         return this.title;
17755     };
17756     /**
17757      * Returns the text that should be displayed if fit area option is supported.
17758      * @return {string}
17759      */
17760     TextureChoiceController.prototype.getFitAreaText = function () {
17761         return this.fitAreaText;
17762     };
17763     /**
17764      * Returns <code>true</code> if the rotation of the edited texture is supported.
17765      * @return {boolean}
17766      */
17767     TextureChoiceController.prototype.isRotationSupported = function () {
17768         return this.rotationSupported;
17769     };
17770     TextureChoiceController.prototype.importTexture$ = function () {
17771         new ImportedTextureWizardController(this.preferences, this.viewFactory, this.contentManager).displayView(this.getView());
17772     };
17773     TextureChoiceController.prototype.importTexture$java_lang_String = function (textureName) {
17774         new ImportedTextureWizardController(textureName, this.preferences, this.viewFactory, this.contentManager).displayView(this.getView());
17775     };
17776     /**
17777      * Controls the import of a texture with a given name.
17778      * @param {string} textureName
17779      */
17780     TextureChoiceController.prototype.importTexture = function (textureName) {
17781         if (((typeof textureName === 'string') || textureName === null)) {
17782             return this.importTexture$java_lang_String(textureName);
17783         }
17784         else if (textureName === undefined) {
17785             return this.importTexture$();
17786         }
17787         else
17788             throw new Error('invalid overload');
17789     };
17790     /**
17791      * Controls the modification of a texture.
17792      * @param {CatalogTexture} texture
17793      */
17794     TextureChoiceController.prototype.modifyTexture = function (texture) {
17795         new ImportedTextureWizardController(texture, this.preferences, this.viewFactory, this.contentManager).displayView(this.getView());
17796     };
17797     /**
17798      * Controls the deletion of a texture.
17799      * @param {CatalogTexture} texture
17800      */
17801     TextureChoiceController.prototype.deleteTexture = function (texture) {
17802         if (this.getView().confirmDeleteSelectedCatalogTexture()) {
17803             this.preferences.getTexturesCatalog()["delete"](texture);
17804         }
17805     };
17806     /**
17807      * Adds the given <code>texture</code> to the recent textures set.
17808      * @param {Object} texture
17809      */
17810     TextureChoiceController.prototype.addRecentTexture = function (texture) {
17811         var recentTextures = (this.preferences.getRecentTextures().slice(0));
17812         for (var i = 0; i < /* size */ recentTextures.length; i++) {
17813             {
17814                 var recentTexture = recentTextures[i];
17815                 if ( /* equals */(function (o1, o2) { if (o1 && o1.equals) {
17816                     return o1.equals(o2);
17817                 }
17818                 else {
17819                     return o1 === o2;
17820                 } })(recentTexture.getImage(), texture.getImage())) {
17821                     if (i === 0) {
17822                         return;
17823                     }
17824                     else {
17825                         /* remove */ recentTextures.splice(i, 1)[0];
17826                         break;
17827                     }
17828                 }
17829             }
17830             ;
17831         }
17832         /* add */ recentTextures.splice(0, 0, texture);
17833         while (( /* size */recentTextures.length > TextureChoiceController.MAX_RECENT_TEXTURES)) {
17834             {
17835                 /* remove */ recentTextures.splice(/* size */ recentTextures.length - 1, 1)[0];
17836             }
17837         }
17838         ;
17839         this.preferences.setRecentTextures(recentTextures);
17840     };
17841     TextureChoiceController.MAX_RECENT_TEXTURES = 15;
17842     return TextureChoiceController;
17843 }());
17844 TextureChoiceController["__class"] = "com.eteks.sweethome3d.viewcontroller.TextureChoiceController";
17845 TextureChoiceController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
17846 var ExportableView;
17847 (function (ExportableView) {
17848     /**
17849      * Data types.
17850      * @class
17851      */
17852     var FormatType = /** @class */ (function () {
17853         function FormatType(name) {
17854             if (this.__name === undefined) {
17855                 this.__name = null;
17856             }
17857             this.__name = name;
17858         }
17859         FormatType.SVG_$LI$ = function () { if (FormatType.SVG == null) {
17860             FormatType.SVG = new ExportableView.FormatType("SVG");
17861         } return FormatType.SVG; };
17862         FormatType.CSV_$LI$ = function () { if (FormatType.CSV == null) {
17863             FormatType.CSV = new ExportableView.FormatType("CSV");
17864         } return FormatType.CSV; };
17865         FormatType.prototype.name = function () {
17866             return this.__name;
17867         };
17868         /**
17869          *
17870          * @return {string}
17871          */
17872         FormatType.prototype.toString = function () {
17873             return this.__name;
17874         };
17875         return FormatType;
17876     }());
17877     ExportableView.FormatType = FormatType;
17878     FormatType["__class"] = "com.eteks.sweethome3d.viewcontroller.ExportableView.FormatType";
17879 })(ExportableView || (ExportableView = {}));
17880 /**
17881  * The base class for controllers of photo creation views.
17882  * @author Emmanuel Puybaret
17883  * @param {Home} home
17884  * @param {UserPreferences} preferences
17885  * @param {Object} view3D
17886  * @param {Object} contentManager
17887  * @class
17888  * @ignore
17889  */
17890 var AbstractPhotoController = /** @class */ (function () {
17891     function AbstractPhotoController(home, preferences, view3D, contentManager) {
17892         if (this.home === undefined) {
17893             this.home = null;
17894         }
17895         if (this.view3D === undefined) {
17896             this.view3D = null;
17897         }
17898         if (this.contentManager === undefined) {
17899             this.contentManager = null;
17900         }
17901         if (this.propertyChangeSupport === undefined) {
17902             this.propertyChangeSupport = null;
17903         }
17904         if (this.aspectRatio === undefined) {
17905             this.aspectRatio = null;
17906         }
17907         if (this.width === undefined) {
17908             this.width = 0;
17909         }
17910         if (this.height === undefined) {
17911             this.height = 0;
17912         }
17913         if (this.quality === undefined) {
17914             this.quality = 0;
17915         }
17916         if (this.view3DAspectRatio === undefined) {
17917             this.view3DAspectRatio = 0;
17918         }
17919         if (this.ceilingLightColor === undefined) {
17920             this.ceilingLightColor = 0;
17921         }
17922         this.home = home;
17923         this.view3D = view3D;
17924         this.contentManager = contentManager;
17925         this.propertyChangeSupport = new PropertyChangeSupport(this);
17926         this.view3DAspectRatio = 1;
17927         var listener = new AbstractPhotoController.EnvironmentChangeListener(this);
17928         home.getEnvironment().addPropertyChangeListener("PHOTO_WIDTH", listener);
17929         home.getEnvironment().addPropertyChangeListener("PHOTO_HEIGHT", listener);
17930         home.getEnvironment().addPropertyChangeListener("PHOTO_ASPECT_RATIO", listener);
17931         home.getEnvironment().addPropertyChangeListener("PHOTO_QUALITY", listener);
17932         home.getEnvironment().addPropertyChangeListener("CEILING_LIGHT_COLOR", listener);
17933         this.updateProperties();
17934     }
17935     /**
17936      * Returns the content manager of this controller.
17937      * @return {Object}
17938      */
17939     AbstractPhotoController.prototype.getContentManager = function () {
17940         return this.contentManager;
17941     };
17942     /**
17943      * Adds the property change <code>listener</code> in parameter to this controller.
17944      * @param {string} property
17945      * @param {PropertyChangeListener} listener
17946      */
17947     AbstractPhotoController.prototype.addPropertyChangeListener = function (property, listener) {
17948         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
17949     };
17950     /**
17951      * Removes the property change <code>listener</code> in parameter from this controller.
17952      * @param {string} property
17953      * @param {PropertyChangeListener} listener
17954      */
17955     AbstractPhotoController.prototype.removePropertyChangeListener = function (property, listener) {
17956         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
17957     };
17958     /**
17959      * Updates edited properties from the photo creation preferences.
17960      */
17961     AbstractPhotoController.prototype.updateProperties = function () {
17962         var homeEnvironment = this.home.getEnvironment();
17963         this.setAspectRatio(homeEnvironment.getPhotoAspectRatio());
17964         this.setWidth(homeEnvironment.getPhotoWidth(), false);
17965         this.setHeight(homeEnvironment.getPhotoHeight(), false);
17966         this.setQuality(homeEnvironment.getPhotoQuality());
17967         this.setCeilingLightColor(homeEnvironment.getCeillingLightColor());
17968     };
17969     /**
17970      * Sets the aspect ratio of the photo.
17971      * @param {AspectRatio} aspectRatio
17972      */
17973     AbstractPhotoController.prototype.setAspectRatio = function (aspectRatio) {
17974         if (this.aspectRatio !== aspectRatio) {
17975             var oldAspectRatio = this.aspectRatio;
17976             this.aspectRatio = aspectRatio;
17977             this.propertyChangeSupport.firePropertyChange(/* name */ "ASPECT_RATIO", oldAspectRatio, aspectRatio);
17978             this.home.getEnvironment().setPhotoAspectRatio(this.aspectRatio);
17979             if (this.aspectRatio === AspectRatio.VIEW_3D_RATIO) {
17980                 if (this.view3DAspectRatio !== Infinity) {
17981                     this.setHeight(Math.round(this.width / this.view3DAspectRatio), false);
17982                 }
17983             }
17984             else if ({ FREE_RATIO: null, VIEW_3D_RATIO: null, RATIO_4_3: 4 / 3, RATIO_3_2: 1.5, RATIO_16_9: 16 / 9, RATIO_2_1: 2 / 1, SQUARE_RATIO: 1 }[this.aspectRatio] != null) {
17985                 this.setHeight(Math.round(this.width / { FREE_RATIO: null, VIEW_3D_RATIO: null, RATIO_4_3: 4 / 3, RATIO_3_2: 1.5, RATIO_16_9: 16 / 9, RATIO_2_1: 2 / 1, SQUARE_RATIO: 1 }[this.aspectRatio]), false);
17986             }
17987         }
17988     };
17989     /**
17990      * Returns the aspect ratio of the photo.
17991      * @return {AspectRatio}
17992      */
17993     AbstractPhotoController.prototype.getAspectRatio = function () {
17994         return this.aspectRatio;
17995     };
17996     AbstractPhotoController.prototype.setWidth = function (width, updateHeight) {
17997         if (updateHeight === void 0) { updateHeight = true; }
17998         if (this.width !== width) {
17999             var oldWidth = this.width;
18000             this.width = width;
18001             this.propertyChangeSupport.firePropertyChange(/* name */ "WIDTH", oldWidth, width);
18002             if (updateHeight) {
18003                 if (this.aspectRatio === AspectRatio.VIEW_3D_RATIO) {
18004                     if (this.view3DAspectRatio !== Infinity) {
18005                         this.setHeight(Math.round(width / this.view3DAspectRatio), false);
18006                     }
18007                 }
18008                 else if ({ FREE_RATIO: null, VIEW_3D_RATIO: null, RATIO_4_3: 4 / 3, RATIO_3_2: 1.5, RATIO_16_9: 16 / 9, RATIO_2_1: 2 / 1, SQUARE_RATIO: 1 }[this.aspectRatio] != null) {
18009                     this.setHeight(Math.round(width / { FREE_RATIO: null, VIEW_3D_RATIO: null, RATIO_4_3: 4 / 3, RATIO_3_2: 1.5, RATIO_16_9: 16 / 9, RATIO_2_1: 2 / 1, SQUARE_RATIO: 1 }[this.aspectRatio]), false);
18010                 }
18011             }
18012             this.home.getEnvironment().setPhotoWidth(this.width);
18013         }
18014     };
18015     /**
18016      * Returns the width of the photo.
18017      * @return {number}
18018      */
18019     AbstractPhotoController.prototype.getWidth = function () {
18020         return this.width;
18021     };
18022     AbstractPhotoController.prototype.setHeight = function (height, updateWidth) {
18023         if (updateWidth === void 0) { updateWidth = true; }
18024         if (this.height !== height) {
18025             var oldHeight = this.height;
18026             this.height = height;
18027             this.propertyChangeSupport.firePropertyChange(/* name */ "HEIGHT", oldHeight, height);
18028             if (updateWidth) {
18029                 if (this.aspectRatio === AspectRatio.VIEW_3D_RATIO) {
18030                     if (this.view3DAspectRatio !== Infinity) {
18031                         this.setWidth(Math.round(height * this.view3DAspectRatio), false);
18032                     }
18033                 }
18034                 else if ({ FREE_RATIO: null, VIEW_3D_RATIO: null, RATIO_4_3: 4 / 3, RATIO_3_2: 1.5, RATIO_16_9: 16 / 9, RATIO_2_1: 2 / 1, SQUARE_RATIO: 1 }[this.aspectRatio] != null) {
18035                     this.setWidth(Math.round(height * { FREE_RATIO: null, VIEW_3D_RATIO: null, RATIO_4_3: 4 / 3, RATIO_3_2: 1.5, RATIO_16_9: 16 / 9, RATIO_2_1: 2 / 1, SQUARE_RATIO: 1 }[this.aspectRatio]), false);
18036                 }
18037             }
18038             this.home.getEnvironment().setPhotoHeight(this.height);
18039         }
18040     };
18041     /**
18042      * Returns the height of the photo.
18043      * @return {number}
18044      */
18045     AbstractPhotoController.prototype.getHeight = function () {
18046         return this.height;
18047     };
18048     /**
18049      * Sets the rendering quality of the photo.
18050      * @param {number} quality
18051      */
18052     AbstractPhotoController.prototype.setQuality = function (quality) {
18053         if (this.quality !== quality) {
18054             var oldQuality = this.quality;
18055             this.quality = Math.min(quality, this.getQualityLevelCount() - 1);
18056             this.propertyChangeSupport.firePropertyChange(/* name */ "QUALITY", oldQuality, quality);
18057             this.home.getEnvironment().setPhotoQuality(this.quality);
18058         }
18059     };
18060     /**
18061      * Returns the rendering quality of the photo.
18062      * @return {number}
18063      */
18064     AbstractPhotoController.prototype.getQuality = function () {
18065         return this.quality;
18066     };
18067     /**
18068      * Returns the maximum value for quality.
18069      * @return {number}
18070      */
18071     AbstractPhotoController.prototype.getQualityLevelCount = function () {
18072         return 4;
18073     };
18074     /**
18075      * Sets the edited ceiling light color.
18076      * @param {number} ceilingLightColor
18077      */
18078     AbstractPhotoController.prototype.setCeilingLightColor = function (ceilingLightColor) {
18079         if (this.ceilingLightColor !== ceilingLightColor) {
18080             var oldCeilingLightColor = this.ceilingLightColor;
18081             this.ceilingLightColor = ceilingLightColor;
18082             this.propertyChangeSupport.firePropertyChange(/* name */ "CEILING_LIGHT_COLOR", oldCeilingLightColor, ceilingLightColor);
18083             this.home.getEnvironment().setCeillingLightColor(ceilingLightColor);
18084         }
18085     };
18086     /**
18087      * Returns the edited ceiling light color.
18088      * @return {number}
18089      */
18090     AbstractPhotoController.prototype.getCeilingLightColor = function () {
18091         return this.ceilingLightColor;
18092     };
18093     /**
18094      * Sets the aspect ratio of the 3D view.
18095      * @param {number} view3DAspectRatio
18096      */
18097     AbstractPhotoController.prototype.set3DViewAspectRatio = function (view3DAspectRatio) {
18098         if (this.view3DAspectRatio !== view3DAspectRatio) {
18099             var oldAspectRatio = this.view3DAspectRatio;
18100             this.view3DAspectRatio = view3DAspectRatio;
18101             this.propertyChangeSupport.firePropertyChange(/* name */ "ASPECT_RATIO", oldAspectRatio, view3DAspectRatio);
18102             if (this.aspectRatio === AspectRatio.VIEW_3D_RATIO && this.view3DAspectRatio !== Infinity) {
18103                 this.setHeight(Math.round(this.width / this.view3DAspectRatio), false);
18104             }
18105         }
18106     };
18107     /**
18108      * Returns the aspect ratio of the 3D view.
18109      * @return {number}
18110      */
18111     AbstractPhotoController.prototype.get3DViewAspectRatio = function () {
18112         return this.view3DAspectRatio;
18113     };
18114     /**
18115      * Returns the 3D view used to compute aspect ratio bound to it.
18116      * @return {Object}
18117      */
18118     AbstractPhotoController.prototype.get3DView = function () {
18119         return this.view3D;
18120     };
18121     /**
18122      * Controls the change of value of a visual property in home.
18123      * @deprecated {@link #setVisualProperty(String, Object) setVisualProperty} should be replaced by a call to
18124      * {@link #setHomeProperty(String, String)} to ensure the property can be easily saved and read.
18125      * @param {string} propertyName
18126      * @param {Object} propertyValue
18127      */
18128     AbstractPhotoController.prototype.setVisualProperty = function (propertyName, propertyValue) {
18129         this.home.setVisualProperty(propertyName, propertyValue);
18130     };
18131     /**
18132      * Controls the change of value of a property in home.
18133      * @param {string} propertyName
18134      * @param {string} propertyValue
18135      */
18136     AbstractPhotoController.prototype.setHomeProperty = function (propertyName, propertyValue) {
18137         this.home.setProperty(propertyName, propertyValue);
18138     };
18139     return AbstractPhotoController;
18140 }());
18141 AbstractPhotoController["__class"] = "com.eteks.sweethome3d.viewcontroller.AbstractPhotoController";
18142 AbstractPhotoController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
18143 (function (AbstractPhotoController) {
18144     /**
18145      * Home environment listener that updates ceiling light color. This listener is bound to this controller
18146      * with a weak reference to avoid strong link between home and this controller.
18147      * @param {AbstractPhotoController} photoController
18148      * @class
18149      */
18150     var EnvironmentChangeListener = /** @class */ (function () {
18151         function EnvironmentChangeListener(photoController) {
18152             if (this.photoController === undefined) {
18153                 this.photoController = null;
18154             }
18155             this.photoController = (photoController);
18156         }
18157         EnvironmentChangeListener.prototype.propertyChange = function (ev) {
18158             var controller = this.photoController;
18159             if (controller == null) {
18160                 ev.getSource().removePropertyChangeListener("PHOTO_WIDTH", this);
18161                 ev.getSource().removePropertyChangeListener("PHOTO_HEIGHT", this);
18162                 ev.getSource().removePropertyChangeListener("PHOTO_ASPECT_RATIO", this);
18163                 ev.getSource().removePropertyChangeListener("PHOTO_QUALITY", this);
18164                 ev.getSource().removePropertyChangeListener("CEILING_LIGHT_COLOR", this);
18165             }
18166             else if ( /* name */"PHOTO_WIDTH" === ev.getPropertyName()) {
18167                 controller.setWidth(ev.getNewValue(), false);
18168             }
18169             else if ( /* name */"PHOTO_HEIGHT" === ev.getPropertyName()) {
18170                 controller.setHeight(ev.getNewValue(), false);
18171             }
18172             else if ( /* name */"PHOTO_ASPECT_RATIO" === ev.getPropertyName()) {
18173                 controller.setAspectRatio(ev.getNewValue());
18174             }
18175             else if ( /* name */"PHOTO_QUALITY" === ev.getPropertyName()) {
18176                 controller.setQuality(ev.getNewValue());
18177             }
18178             else if ( /* name */"CEILING_LIGHT_COLOR" === ev.getPropertyName()) {
18179                 controller.setCeilingLightColor(ev.getNewValue());
18180             }
18181         };
18182         return EnvironmentChangeListener;
18183     }());
18184     AbstractPhotoController.EnvironmentChangeListener = EnvironmentChangeListener;
18185     EnvironmentChangeListener["__class"] = "com.eteks.sweethome3d.viewcontroller.AbstractPhotoController.EnvironmentChangeListener";
18186 })(AbstractPhotoController || (AbstractPhotoController = {}));
18187 /**
18188  * Exporter for home instances. Homes will be written using the DTD given in {@link HomeXMLHandler} class.
18189  * @author Emmanuel Puybaret
18190  * @class
18191  * @extends ObjectXMLExporter
18192  */
18193 var HomeXMLExporter = /** @class */ (function (_super) {
18194     __extends(HomeXMLExporter, _super);
18195     function HomeXMLExporter() {
18196         var _this = _super.call(this) || this;
18197         if (_this.savedContentNames === undefined) {
18198             _this.savedContentNames = null;
18199         }
18200         _this.levelIds = ({});
18201         _this.wallIds = ({});
18202         return _this;
18203     }
18204     /**
18205      * Sets the names that will be saved as XML attribute values for each content.
18206      * @param {Object} savedContentNames
18207      * @private
18208      */
18209     HomeXMLExporter.prototype.setSavedContentNames = function (savedContentNames) {
18210         this.savedContentNames = savedContentNames;
18211     };
18212     /**
18213      * Returns the XML id of the given <code>object</code> that can be referenced by other elements.
18214      * @throws IllegalArgumentException if the <code>object</code> has no associated id.
18215      * @param {Object} object
18216      * @return {string}
18217      */
18218     HomeXMLExporter.prototype.getId = function (object) {
18219         if (object == null) {
18220             return null;
18221         }
18222         else if (object != null && object instanceof Level) {
18223             return /* get */ (function (m, k) { if (m.entries == null)
18224                 m.entries = []; for (var i = 0; i < m.entries.length; i++)
18225                 if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
18226                     return m.entries[i].value;
18227                 } return null; })(this.levelIds, object);
18228         }
18229         else if (object != null && object instanceof Wall) {
18230             return /* get */ (function (m, k) { if (m.entries == null)
18231                 m.entries = []; for (var i = 0; i < m.entries.length; i++)
18232                 if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
18233                     return m.entries[i].value;
18234                 } return null; })(this.wallIds, object);
18235         }
18236         else {
18237             throw new IllegalArgumentException("No Id provided for object of class " + /* getName */ (function (c) { return typeof c === 'string' ? c : c["__class"] ? c["__class"] : c["name"]; })(object.constructor));
18238         }
18239     };
18240     HomeXMLExporter.prototype.writeElement$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Home = function (writer, home) {
18241         {
18242             var array = home.getLevels();
18243             for (var index = 0; index < array.length; index++) {
18244                 var level = array[index];
18245                 {
18246                     /* put */ (function (m, k, v) { if (m.entries == null)
18247                         m.entries = []; for (var i = 0; i < m.entries.length; i++)
18248                         if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
18249                             m.entries[i].value = v;
18250                             return;
18251                         } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(this.levelIds, level, level.getId());
18252                 }
18253             }
18254         }
18255         {
18256             var array = home.getWalls();
18257             for (var index = 0; index < array.length; index++) {
18258                 var wall = array[index];
18259                 {
18260                     /* put */ (function (m, k, v) { if (m.entries == null)
18261                         m.entries = []; for (var i = 0; i < m.entries.length; i++)
18262                         if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
18263                             m.entries[i].value = v;
18264                             return;
18265                         } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(this.wallIds, wall, wall.getId());
18266                 }
18267             }
18268         }
18269         _super.prototype.writeElement.call(this, writer, home);
18270     };
18271     /**
18272      * Writes in XML the <code>home</code> object and the objects that depends on it with the given <code>writer</code>.
18273      * @param {XMLWriter} writer
18274      * @param {Home} home
18275      */
18276     HomeXMLExporter.prototype.writeElement = function (writer, home) {
18277         if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((home != null && home instanceof Home) || home === null)) {
18278             return this.writeElement$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Home(writer, home);
18279         }
18280         else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((home != null) || home === null)) {
18281             _super.prototype.writeElement.call(this, writer, home);
18282         }
18283         else
18284             throw new Error('invalid overload');
18285     };
18286     HomeXMLExporter.prototype.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Home = function (writer, home) {
18287         home.setVersion(Home.CURRENT_VERSION);
18288         writer.writeAttribute$java_lang_String$java_lang_String("version", /* valueOf */ String(home.getVersion()).toString());
18289         writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("name", home.getName(), null);
18290         writer.writeAttribute$java_lang_String$java_lang_String("camera", home.getCamera() === home.getObserverCamera() ? "observerCamera" : "topCamera");
18291         writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("selectedLevel", this.getId(home.getSelectedLevel()), null);
18292         writer.writeFloatAttribute$java_lang_String$float("wallHeight", home.getWallHeight());
18293         writer.writeBooleanAttribute("basePlanLocked", home.isBasePlanLocked(), false);
18294         if (home.getFurnitureSortedPropertyName() != null) {
18295             writer.writeAttribute$java_lang_String$java_lang_String("furnitureSortedProperty", home.getFurnitureSortedPropertyName());
18296         }
18297         writer.writeBooleanAttribute("furnitureDescendingSorted", home.isFurnitureDescendingSorted(), false);
18298     };
18299     /**
18300      * Writes as XML attributes some data of <code>home</code> object with the given <code>writer</code>.
18301      * @param {XMLWriter} writer
18302      * @param {Home} home
18303      */
18304     HomeXMLExporter.prototype.writeAttributes = function (writer, home) {
18305         if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((home != null && home instanceof Home) || home === null)) {
18306             return this.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Home(writer, home);
18307         }
18308         else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((home != null) || home === null)) {
18309             _super.prototype.writeAttributes.call(this, writer, home);
18310         }
18311         else
18312             throw new Error('invalid overload');
18313     };
18314     HomeXMLExporter.prototype.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Home = function (writer, home) {
18315         var propertiesNames = (home.getPropertyNames().slice(0));
18316         /* sort */ propertiesNames.sort();
18317         for (var index = 0; index < propertiesNames.length; index++) {
18318             var propertyName = propertiesNames[index];
18319             {
18320                 this.writeProperty(writer, home, propertyName, home.getProperty(propertyName), false);
18321             }
18322         }
18323         {
18324             var array = home.getFurnitureVisiblePropertyNames();
18325             for (var index = 0; index < array.length; index++) {
18326                 var property = array[index];
18327                 {
18328                     writer.writeStartElement("furnitureVisibleProperty");
18329                     writer.writeAttribute$java_lang_String$java_lang_String("name", property);
18330                     writer.writeEndElement();
18331                 }
18332             }
18333         }
18334         this.writeEnvironment(writer, home.getEnvironment());
18335         this.writeBackgroundImage(writer, home.getBackgroundImage());
18336         this.writePrint(writer, home.getPrint());
18337         this.writeCompass(writer, home.getCompass());
18338         this.writeCamera(writer, home.getObserverCamera(), "observerCamera");
18339         this.writeCamera(writer, home.getTopCamera(), "topCamera");
18340         {
18341             var array = home.getStoredCameras();
18342             for (var index = 0; index < array.length; index++) {
18343                 var camera = array[index];
18344                 {
18345                     this.writeCamera(writer, camera, "storedCamera");
18346                 }
18347             }
18348         }
18349         {
18350             var array = home.getLevels();
18351             for (var index = 0; index < array.length; index++) {
18352                 var level = array[index];
18353                 {
18354                     this.writeLevel(writer, level);
18355                 }
18356             }
18357         }
18358         {
18359             var array = home.getFurniture();
18360             for (var index = 0; index < array.length; index++) {
18361                 var piece = array[index];
18362                 {
18363                     this.writePieceOfFurniture(writer, piece);
18364                 }
18365             }
18366         }
18367         {
18368             var array = home.getWalls();
18369             for (var index = 0; index < array.length; index++) {
18370                 var wall = array[index];
18371                 {
18372                     this.writeWall(writer, wall);
18373                 }
18374             }
18375         }
18376         {
18377             var array = home.getRooms();
18378             for (var index = 0; index < array.length; index++) {
18379                 var room = array[index];
18380                 {
18381                     this.writeRoom(writer, room);
18382                 }
18383             }
18384         }
18385         {
18386             var array = home.getPolylines();
18387             for (var index = 0; index < array.length; index++) {
18388                 var polyline = array[index];
18389                 {
18390                     this.writePolyline(writer, polyline);
18391                 }
18392             }
18393         }
18394         {
18395             var array = home.getDimensionLines();
18396             for (var index = 0; index < array.length; index++) {
18397                 var dimensionLine = array[index];
18398                 {
18399                     this.writeDimensionLine(writer, dimensionLine);
18400                 }
18401             }
18402         }
18403         {
18404             var array = home.getLabels();
18405             for (var index = 0; index < array.length; index++) {
18406                 var label = array[index];
18407                 {
18408                     this.writeLabel(writer, label);
18409                 }
18410             }
18411         }
18412     };
18413     /**
18414      * Writes as XML elements some objects that depends on of <code>home</code> with the given <code>writer</code>.
18415      * @param {XMLWriter} writer
18416      * @param {Home} home
18417      */
18418     HomeXMLExporter.prototype.writeChildren = function (writer, home) {
18419         if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((home != null && home instanceof Home) || home === null)) {
18420             return this.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Home(writer, home);
18421         }
18422         else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((home != null) || home === null)) {
18423             _super.prototype.writeChildren.call(this, writer, home);
18424         }
18425         else
18426             throw new Error('invalid overload');
18427     };
18428     /**
18429      * Writes in XML the <code>environment</code> object with the given <code>writer</code>.
18430      * @param {XMLWriter} writer
18431      * @param {HomeEnvironment} environment
18432      */
18433     HomeXMLExporter.prototype.writeEnvironment = function (writer, environment) {
18434         new HomeXMLExporter.HomeXMLExporter$0(this).writeElement(writer, environment);
18435     };
18436     /**
18437      * Writes in XML the <code>background</code> object with the given <code>writer</code>.
18438      * @param {XMLWriter} writer
18439      * @param {BackgroundImage} backgroundImage
18440      */
18441     HomeXMLExporter.prototype.writeBackgroundImage = function (writer, backgroundImage) {
18442         if (backgroundImage != null) {
18443             new HomeXMLExporter.HomeXMLExporter$1(this).writeElement(writer, backgroundImage);
18444         }
18445     };
18446     /**
18447      * Writes in XML the <code>print</code> object with the given <code>writer</code>.
18448      * @param {XMLWriter} writer
18449      * @param {HomePrint} print
18450      */
18451     HomeXMLExporter.prototype.writePrint = function (writer, print) {
18452         if (print != null) {
18453             new HomeXMLExporter.HomeXMLExporter$2(this).writeElement(writer, print);
18454         }
18455     };
18456     /**
18457      * Writes in XML the <code>compass</code> object with the given <code>writer</code>.
18458      * @param {XMLWriter} writer
18459      * @param {Compass} compass
18460      */
18461     HomeXMLExporter.prototype.writeCompass = function (writer, compass) {
18462         new HomeXMLExporter.HomeXMLExporter$3(this).writeElement(writer, compass);
18463     };
18464     /**
18465      * Writes in XML the <code>camera</code> object with the given <code>writer</code>.
18466      * @param {XMLWriter} writer
18467      * @param {Camera} camera
18468      * @param {string} attributeName
18469      */
18470     HomeXMLExporter.prototype.writeCamera = function (writer, camera, attributeName) {
18471         if (camera != null) {
18472             new HomeXMLExporter.HomeXMLExporter$4(this, attributeName).writeElement(writer, camera);
18473         }
18474     };
18475     /**
18476      * Writes in XML the <code>level</code> object with the given <code>writer</code>.
18477      * @param {XMLWriter} writer
18478      * @param {Level} level
18479      */
18480     HomeXMLExporter.prototype.writeLevel = function (writer, level) {
18481         new HomeXMLExporter.HomeXMLExporter$5(this).writeElement(writer, level);
18482     };
18483     /**
18484      * Writes in XML the <code>piece</code> object with the given <code>writer</code>.
18485      * @param {XMLWriter} writer
18486      * @param {HomePieceOfFurniture} piece
18487      */
18488     HomeXMLExporter.prototype.writePieceOfFurniture = function (writer, piece) {
18489         new HomeXMLExporter.PieceOfFurnitureExporter(this).writeElement(writer, piece);
18490     };
18491     /**
18492      * Writes in XML the <code>material</code> object with the given <code>writer</code>.
18493      * @param {XMLWriter} writer
18494      * @param {HomeMaterial} material
18495      * @param {Object} model
18496      */
18497     HomeXMLExporter.prototype.writeMaterial = function (writer, material, model) {
18498         if (material != null) {
18499             new HomeXMLExporter.HomeXMLExporter$6(this).writeElement(writer, material);
18500         }
18501     };
18502     /**
18503      * Writes in XML the <code>wall</code> object with the given <code>writer</code>.
18504      * @param {XMLWriter} writer
18505      * @param {Wall} wall
18506      */
18507     HomeXMLExporter.prototype.writeWall = function (writer, wall) {
18508         new HomeXMLExporter.HomeXMLExporter$7(this).writeElement(writer, wall);
18509     };
18510     /**
18511      * Writes in XML the <code>room</code> object with the given <code>writer</code>.
18512      * @param {XMLWriter} writer
18513      * @param {Room} room
18514      */
18515     HomeXMLExporter.prototype.writeRoom = function (writer, room) {
18516         new HomeXMLExporter.HomeXMLExporter$8(this).writeElement(writer, room);
18517     };
18518     /**
18519      * Writes in XML the <code>polyline</code> object with the given <code>writer</code>.
18520      * @param {XMLWriter} writer
18521      * @param {Polyline} polyline
18522      */
18523     HomeXMLExporter.prototype.writePolyline = function (writer, polyline) {
18524         new HomeXMLExporter.HomeXMLExporter$9(this).writeElement(writer, polyline);
18525     };
18526     /**
18527      * Writes in XML the <code>dimensionLine</code> object with the given <code>writer</code>.
18528      * @param {XMLWriter} writer
18529      * @param {DimensionLine} dimensionLine
18530      */
18531     HomeXMLExporter.prototype.writeDimensionLine = function (writer, dimensionLine) {
18532         new HomeXMLExporter.HomeXMLExporter$10(this).writeElement(writer, dimensionLine);
18533     };
18534     /**
18535      * Writes in XML the <code>label</code> object with the given <code>writer</code>.
18536      * @param {XMLWriter} writer
18537      * @param {Label} label
18538      */
18539     HomeXMLExporter.prototype.writeLabel = function (writer, label) {
18540         new HomeXMLExporter.HomeXMLExporter$11(this).writeElement(writer, label);
18541     };
18542     /**
18543      * Writes in XML the <code>textStyle</code> object with the given <code>writer</code>.
18544      * @param {XMLWriter} writer
18545      * @param {TextStyle} textStyle
18546      * @param {string} attributeName
18547      */
18548     HomeXMLExporter.prototype.writeTextStyle = function (writer, textStyle, attributeName) {
18549         if (textStyle != null) {
18550             new HomeXMLExporter.HomeXMLExporter$12(this, attributeName).writeElement(writer, textStyle);
18551         }
18552     };
18553     /**
18554      * Writes in XML the <code>baseboard</code> object with the given <code>writer</code>.
18555      * @param {XMLWriter} writer
18556      * @param {Baseboard} baseboard
18557      * @param {string} attributeName
18558      */
18559     HomeXMLExporter.prototype.writeBaseboard = function (writer, baseboard, attributeName) {
18560         if (baseboard != null) {
18561             new HomeXMLExporter.HomeXMLExporter$13(this, attributeName).writeElement(writer, baseboard);
18562         }
18563     };
18564     /**
18565      * Writes in XML the <code>texture</code> object with the given <code>writer</code>.
18566      * @param {XMLWriter} writer
18567      * @param {HomeTexture} texture
18568      * @param {string} attributeName
18569      */
18570     HomeXMLExporter.prototype.writeTexture = function (writer, texture, attributeName) {
18571         if (texture != null) {
18572             new HomeXMLExporter.HomeXMLExporter$14(this, attributeName).writeElement(writer, texture);
18573         }
18574     };
18575     /**
18576      * Writes in XML the properties of the <code>HomeObject</code> instance with the given <code>writer</code>.
18577      * @param {XMLWriter} writer
18578      * @param {HomeObject} object
18579      * @private
18580      */
18581     HomeXMLExporter.prototype.writeProperties = function (writer, object) {
18582         var propertiesNames = (object.getPropertyNames().slice(0));
18583         /* sort */ propertiesNames.sort();
18584         for (var index = 0; index < propertiesNames.length; index++) {
18585             var propertyName = propertiesNames[index];
18586             {
18587                 var propertyContent = object.isContentProperty(propertyName);
18588                 this.writeProperty(writer, object, propertyName, propertyContent ? object.getContentProperty(propertyName) : object.getProperty(propertyName), propertyContent);
18589             }
18590         }
18591     };
18592     /**
18593      * Writes in XML the given property.
18594      * @param {XMLWriter} writer
18595      * @param {Object} object
18596      * @param {string} propertyName
18597      * @param {Object} propertyValue
18598      * @param {boolean} content
18599      * @private
18600      */
18601     HomeXMLExporter.prototype.writeProperty = function (writer, object, propertyName, propertyValue, content) {
18602         if (propertyValue != null) {
18603             writer.writeStartElement("property");
18604             writer.writeAttribute$java_lang_String$java_lang_String("name", propertyName);
18605             writer.writeAttribute$java_lang_String$java_lang_String("value", content ? this.getExportedContentName(object, propertyValue) : propertyValue.toString());
18606             if (content) {
18607                 writer.writeAttribute$java_lang_String$java_lang_String("type", /* Enum.name */ ObjectProperty.Type[ObjectProperty.Type.CONTENT]);
18608             }
18609             writer.writeEndElement();
18610         }
18611     };
18612     /**
18613      * Returns the string value of the given float, except for -1.0, 1.0 or 0.0
18614      * where -1, 1 and 0 is returned.
18615      * @param {number} f
18616      * @return {string}
18617      * @private
18618      */
18619     HomeXMLExporter.floatToString = function (f) {
18620         if (Math.abs(f) < 1.0E-6) {
18621             return "0";
18622         }
18623         else if (Math.abs(f - 1.0) < 1.0E-6) {
18624             return "1";
18625         }
18626         else if (Math.abs(f + 1.0) < 1.0E-6) {
18627             return "-1";
18628         }
18629         else {
18630             return /* valueOf */ String(f).toString();
18631         }
18632     };
18633     /**
18634      * Returns the saved name of the given <code>content</code> owned by an object.
18635      * @param {Object} owner
18636      * @param {Object} content
18637      * @return {string}
18638      */
18639     HomeXMLExporter.prototype.getExportedContentName = function (owner, content) {
18640         if (content == null) {
18641             return null;
18642         }
18643         else if (this.savedContentNames != null) {
18644             var contentName = this.savedContentNames[content.getURL()];
18645             if (contentName != null) {
18646                 return contentName;
18647             }
18648         }
18649         return content.getURL();
18650     };
18651     return HomeXMLExporter;
18652 }(ObjectXMLExporter));
18653 HomeXMLExporter["__class"] = "com.eteks.sweethome3d.io.HomeXMLExporter";
18654 (function (HomeXMLExporter) {
18655     /**
18656      * Default exporter class used to write a piece of furniture in XML.
18657      * @class
18658      * @extends ObjectXMLExporter
18659      */
18660     var PieceOfFurnitureExporter = /** @class */ (function (_super) {
18661         __extends(PieceOfFurnitureExporter, _super);
18662         function PieceOfFurnitureExporter(__parent) {
18663             var _this = _super.call(this) || this;
18664             _this.__parent = __parent;
18665             return _this;
18666         }
18667         PieceOfFurnitureExporter.prototype.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (writer, piece) {
18668             writer.writeAttribute$java_lang_String$java_lang_String("id", piece.getId());
18669             if (piece.getLevel() != null) {
18670                 writer.writeAttribute$java_lang_String$java_lang_String("level", this.__parent.getId(piece.getLevel()));
18671             }
18672             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("catalogId", piece.getCatalogId(), null);
18673             writer.writeAttribute$java_lang_String$java_lang_String("name", piece.getName());
18674             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("creator", piece.getCreator(), null);
18675             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("model", this.__parent.getExportedContentName(piece, piece.getModel()), null);
18676             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("icon", this.__parent.getExportedContentName(piece, piece.getIcon()), null);
18677             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("planIcon", this.__parent.getExportedContentName(piece, piece.getPlanIcon()), null);
18678             writer.writeFloatAttribute$java_lang_String$float("x", piece.getX());
18679             writer.writeFloatAttribute$java_lang_String$float("y", piece.getY());
18680             writer.writeFloatAttribute$java_lang_String$float$float("elevation", piece.getElevation(), 0.0);
18681             writer.writeFloatAttribute$java_lang_String$float$float("angle", piece.getAngle(), 0.0);
18682             writer.writeFloatAttribute$java_lang_String$float$float("pitch", piece.getPitch(), 0.0);
18683             writer.writeFloatAttribute$java_lang_String$float$float("roll", piece.getRoll(), 0.0);
18684             writer.writeFloatAttribute$java_lang_String$float("width", piece.getWidth());
18685             writer.writeFloatAttribute$java_lang_String$float$float("widthInPlan", piece.getWidthInPlan(), piece.getWidth());
18686             writer.writeFloatAttribute$java_lang_String$float("depth", piece.getDepth());
18687             writer.writeFloatAttribute$java_lang_String$float$float("depthInPlan", piece.getDepthInPlan(), piece.getDepth());
18688             writer.writeFloatAttribute$java_lang_String$float("height", piece.getHeight());
18689             writer.writeFloatAttribute$java_lang_String$float$float("heightInPlan", piece.getHeightInPlan(), piece.getHeight());
18690             writer.writeIntegerAttribute$java_lang_String$int$int("modelFlags", piece.getModelFlags(), 0);
18691             writer.writeBooleanAttribute("modelMirrored", piece.isModelMirrored(), false);
18692             writer.writeBooleanAttribute("visible", piece.isVisible(), true);
18693             writer.writeColorAttribute("color", piece.getColor());
18694             if (piece.getShininess() != null) {
18695                 writer.writeFloatAttribute$java_lang_String$java_lang_Float("shininess", piece.getShininess());
18696             }
18697             var modelRotation = piece.getModelRotation();
18698             var modelRotationString = HomeXMLExporter.floatToString(modelRotation[0][0]) + " " + HomeXMLExporter.floatToString(modelRotation[0][1]) + " " + HomeXMLExporter.floatToString(modelRotation[0][2]) + " " + HomeXMLExporter.floatToString(modelRotation[1][0]) + " " + HomeXMLExporter.floatToString(modelRotation[1][1]) + " " + HomeXMLExporter.floatToString(modelRotation[1][2]) + " " + HomeXMLExporter.floatToString(modelRotation[2][0]) + " " + HomeXMLExporter.floatToString(modelRotation[2][1]) + " " + HomeXMLExporter.floatToString(modelRotation[2][2]);
18699             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("modelRotation", modelRotationString, "1 0 0 0 1 0 0 0 1");
18700             writer.writeBooleanAttribute("modelCenteredAtOrigin", piece.isModelCenteredAtOrigin(), true);
18701             writer.writeLongAttribute$java_lang_String$java_lang_Long("modelSize", piece.getModelSize());
18702             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("description", piece.getDescription(), null);
18703             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("information", piece.getInformation(), null);
18704             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("license", piece.getLicense(), null);
18705             writer.writeBooleanAttribute("movable", piece.isMovable(), true);
18706             if (!(piece != null && piece instanceof HomeFurnitureGroup)) {
18707                 if (!(piece != null && piece instanceof HomeDoorOrWindow)) {
18708                     writer.writeBooleanAttribute("doorOrWindow", piece.isDoorOrWindow(), false);
18709                     writer.writeBooleanAttribute("horizontallyRotatable", piece.isHorizontallyRotatable(), true);
18710                 }
18711                 writer.writeBooleanAttribute("resizable", piece.isResizable(), true);
18712                 writer.writeBooleanAttribute("deformable", piece.isDeformable(), true);
18713                 writer.writeBooleanAttribute("texturable", piece.isTexturable(), true);
18714             }
18715             if (piece != null && piece instanceof HomeFurnitureGroup) {
18716                 var price = piece.getPrice();
18717                 {
18718                     var array = piece.getFurniture();
18719                     for (var index = 0; index < array.length; index++) {
18720                         var groupPiece = array[index];
18721                         {
18722                             if (groupPiece.getPrice() != null) {
18723                                 price = null;
18724                                 break;
18725                             }
18726                         }
18727                     }
18728                 }
18729                 writer.writeBigDecimalAttribute("price", price);
18730             }
18731             else {
18732                 writer.writeBigDecimalAttribute("price", piece.getPrice());
18733                 writer.writeBigDecimalAttribute("valueAddedTaxPercentage", piece.getValueAddedTaxPercentage());
18734                 writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("currency", piece.getCurrency(), null);
18735             }
18736             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("staircaseCutOutShape", piece.getStaircaseCutOutShape(), null);
18737             writer.writeFloatAttribute$java_lang_String$float$float("dropOnTopElevation", piece.getDropOnTopElevation(), 1.0);
18738             writer.writeBooleanAttribute("nameVisible", piece.isNameVisible(), false);
18739             writer.writeFloatAttribute$java_lang_String$float$float("nameAngle", piece.getNameAngle(), 0.0);
18740             writer.writeFloatAttribute$java_lang_String$float$float("nameXOffset", piece.getNameXOffset(), 0.0);
18741             writer.writeFloatAttribute$java_lang_String$float$float("nameYOffset", piece.getNameYOffset(), 0.0);
18742             if (piece != null && piece instanceof HomeDoorOrWindow) {
18743                 var doorOrWindow = piece;
18744                 writer.writeFloatAttribute$java_lang_String$float$float("wallThickness", doorOrWindow.getWallThickness(), 1.0);
18745                 writer.writeFloatAttribute$java_lang_String$float$float("wallDistance", doorOrWindow.getWallDistance(), 0.0);
18746                 writer.writeFloatAttribute$java_lang_String$float$float("wallWidth", doorOrWindow.getWallWidth(), 1.0);
18747                 writer.writeFloatAttribute$java_lang_String$float$float("wallLeft", doorOrWindow.getWallLeft(), 0.0);
18748                 writer.writeFloatAttribute$java_lang_String$float$float("wallHeight", doorOrWindow.getWallHeight(), 1.0);
18749                 writer.writeFloatAttribute$java_lang_String$float$float("wallTop", doorOrWindow.getWallTop(), 0.0);
18750                 writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("cutOutShape", doorOrWindow.getCutOutShape(), null);
18751                 writer.writeBooleanAttribute("wallCutOutOnBothSides", doorOrWindow.isWallCutOutOnBothSides(), false);
18752                 writer.writeBooleanAttribute("widthDepthDeformable", doorOrWindow.isWidthDepthDeformable(), true);
18753                 writer.writeBooleanAttribute("boundToWall", doorOrWindow.isBoundToWall(), true);
18754             }
18755             else if (piece != null && piece instanceof HomeLight) {
18756                 writer.writeFloatAttribute$java_lang_String$float("power", piece.getPower());
18757             }
18758         };
18759         /**
18760          *
18761          * @param {XMLWriter} writer
18762          * @param {HomePieceOfFurniture} piece
18763          */
18764         PieceOfFurnitureExporter.prototype.writeAttributes = function (writer, piece) {
18765             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((piece != null && piece instanceof HomePieceOfFurniture) || piece === null)) {
18766                 return this.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomePieceOfFurniture(writer, piece);
18767             }
18768             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((piece != null) || piece === null)) {
18769                 _super.prototype.writeAttributes.call(this, writer, piece);
18770             }
18771             else
18772                 throw new Error('invalid overload');
18773         };
18774         PieceOfFurnitureExporter.prototype.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (writer, piece) {
18775             if (piece != null && piece instanceof HomeFurnitureGroup) {
18776                 {
18777                     var array = piece.getFurniture();
18778                     for (var index = 0; index < array.length; index++) {
18779                         var groupPiece = array[index];
18780                         {
18781                             this.__parent.writePieceOfFurniture(writer, groupPiece);
18782                         }
18783                     }
18784                 }
18785             }
18786             else if (piece != null && piece instanceof HomeLight) {
18787                 {
18788                     var array = piece.getLightSources();
18789                     for (var index = 0; index < array.length; index++) {
18790                         var lightSource = array[index];
18791                         {
18792                             writer.writeStartElement("lightSource");
18793                             writer.writeFloatAttribute$java_lang_String$float("x", lightSource.getX());
18794                             writer.writeFloatAttribute$java_lang_String$float("y", lightSource.getY());
18795                             writer.writeFloatAttribute$java_lang_String$float("z", lightSource.getZ());
18796                             writer.writeColorAttribute("color", lightSource.getColor());
18797                             writer.writeFloatAttribute$java_lang_String$java_lang_Float("diameter", lightSource.getDiameter());
18798                             writer.writeEndElement();
18799                         }
18800                     }
18801                 }
18802                 {
18803                     var array = piece.getLightSourceMaterialNames();
18804                     for (var index = 0; index < array.length; index++) {
18805                         var lightSourceMaterialName = array[index];
18806                         {
18807                             writer.writeStartElement("lightSourceMaterial");
18808                             writer.writeAttribute$java_lang_String$java_lang_String("name", lightSourceMaterialName);
18809                             writer.writeEndElement();
18810                         }
18811                     }
18812                 }
18813             }
18814             else if (piece != null && piece instanceof HomeDoorOrWindow) {
18815                 {
18816                     var array = piece.getSashes();
18817                     for (var index = 0; index < array.length; index++) {
18818                         var sash = array[index];
18819                         {
18820                             writer.writeStartElement("sash");
18821                             writer.writeFloatAttribute$java_lang_String$float("xAxis", sash.getXAxis());
18822                             writer.writeFloatAttribute$java_lang_String$float("yAxis", sash.getYAxis());
18823                             writer.writeFloatAttribute$java_lang_String$float("width", sash.getWidth());
18824                             writer.writeFloatAttribute$java_lang_String$float("startAngle", sash.getStartAngle());
18825                             writer.writeFloatAttribute$java_lang_String$float("endAngle", sash.getEndAngle());
18826                             writer.writeEndElement();
18827                         }
18828                     }
18829                 }
18830             }
18831             else if (piece != null && piece instanceof HomeShelfUnit) {
18832                 var shelf = piece;
18833                 var shelfElevations = shelf.getShelfElevations();
18834                 if (shelfElevations != null) {
18835                     for (var i = 0; i < shelfElevations.length; i++) {
18836                         {
18837                             writer.writeStartElement("shelf");
18838                             writer.writeFloatAttribute$java_lang_String$float("elevation", shelfElevations[i]);
18839                             writer.writeEndElement();
18840                         }
18841                         ;
18842                     }
18843                 }
18844                 var shelfBoxes = shelf.getShelfBoxes();
18845                 if (shelfBoxes != null) {
18846                     for (var i = 0; i < shelfBoxes.length; i++) {
18847                         {
18848                             writer.writeStartElement("shelf");
18849                             writer.writeFloatAttribute$java_lang_String$float("xLower", shelfBoxes[i].getXLower());
18850                             writer.writeFloatAttribute$java_lang_String$float("yLower", shelfBoxes[i].getYLower());
18851                             writer.writeFloatAttribute$java_lang_String$float("zLower", shelfBoxes[i].getZLower());
18852                             writer.writeFloatAttribute$java_lang_String$float("xUpper", shelfBoxes[i].getXUpper());
18853                             writer.writeFloatAttribute$java_lang_String$float("yUpper", shelfBoxes[i].getYUpper());
18854                             writer.writeFloatAttribute$java_lang_String$float("zUpper", shelfBoxes[i].getZUpper());
18855                             writer.writeEndElement();
18856                         }
18857                         ;
18858                     }
18859                 }
18860             }
18861             this.__parent.writeProperties(writer, piece);
18862             this.__parent.writeTextStyle(writer, piece.getNameStyle(), "nameStyle");
18863             this.__parent.writeTexture(writer, piece.getTexture(), null);
18864             if (piece.getModelMaterials() != null) {
18865                 {
18866                     var array = piece.getModelMaterials();
18867                     for (var index = 0; index < array.length; index++) {
18868                         var material = array[index];
18869                         {
18870                             this.__parent.writeMaterial(writer, material, piece.getModel());
18871                         }
18872                     }
18873                 }
18874             }
18875             if (piece.getModelTransformations() != null) {
18876                 {
18877                     var array = piece.getModelTransformations();
18878                     for (var index = 0; index < array.length; index++) {
18879                         var transformation = array[index];
18880                         {
18881                             writer.writeStartElement("transformation");
18882                             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("name", transformation.getName(), null);
18883                             var matrix = transformation.getMatrix();
18884                             var matrixString = HomeXMLExporter.floatToString(matrix[0][0]) + " " + HomeXMLExporter.floatToString(matrix[0][1]) + " " + HomeXMLExporter.floatToString(matrix[0][2]) + " " + HomeXMLExporter.floatToString(matrix[0][3]) + " " + HomeXMLExporter.floatToString(matrix[1][0]) + " " + HomeXMLExporter.floatToString(matrix[1][1]) + " " + HomeXMLExporter.floatToString(matrix[1][2]) + " " + HomeXMLExporter.floatToString(matrix[1][3]) + " " + HomeXMLExporter.floatToString(matrix[2][0]) + " " + HomeXMLExporter.floatToString(matrix[2][1]) + " " + HomeXMLExporter.floatToString(matrix[2][2]) + " " + HomeXMLExporter.floatToString(matrix[2][3]);
18885                             writer.writeAttribute$java_lang_String$java_lang_String("matrix", matrixString);
18886                             writer.writeEndElement();
18887                         }
18888                     }
18889                 }
18890             }
18891         };
18892         /**
18893          *
18894          * @param {XMLWriter} writer
18895          * @param {HomePieceOfFurniture} piece
18896          */
18897         PieceOfFurnitureExporter.prototype.writeChildren = function (writer, piece) {
18898             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((piece != null && piece instanceof HomePieceOfFurniture) || piece === null)) {
18899                 return this.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomePieceOfFurniture(writer, piece);
18900             }
18901             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((piece != null) || piece === null)) {
18902                 _super.prototype.writeChildren.call(this, writer, piece);
18903             }
18904             else
18905                 throw new Error('invalid overload');
18906         };
18907         return PieceOfFurnitureExporter;
18908     }(ObjectXMLExporter));
18909     HomeXMLExporter.PieceOfFurnitureExporter = PieceOfFurnitureExporter;
18910     PieceOfFurnitureExporter["__class"] = "com.eteks.sweethome3d.io.HomeXMLExporter.PieceOfFurnitureExporter";
18911     var HomeXMLExporter$0 = /** @class */ (function (_super) {
18912         __extends(HomeXMLExporter$0, _super);
18913         function HomeXMLExporter$0(__parent) {
18914             var _this = _super.call(this) || this;
18915             _this.__parent = __parent;
18916             return _this;
18917         }
18918         HomeXMLExporter$0.prototype.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomeEnvironment = function (writer, environment) {
18919             writer.writeColorAttribute("groundColor", environment.getGroundColor());
18920             writer.writeBooleanAttribute("backgroundImageVisibleOnGround3D", environment.isBackgroundImageVisibleOnGround3D(), false);
18921             writer.writeColorAttribute("skyColor", environment.getSkyColor());
18922             writer.writeColorAttribute("lightColor", environment.getLightColor());
18923             writer.writeFloatAttribute$java_lang_String$float$float("wallsAlpha", environment.getWallsAlpha(), 0);
18924             writer.writeBooleanAttribute("allLevelsVisible", environment.isAllLevelsVisible(), false);
18925             writer.writeBooleanAttribute("observerCameraElevationAdjusted", environment.isObserverCameraElevationAdjusted(), true);
18926             writer.writeColorAttribute("ceillingLightColor", environment.getCeillingLightColor());
18927             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("drawingMode", /* Enum.name */ HomeEnvironment.DrawingMode[environment.getDrawingMode()], /* Enum.name */ HomeEnvironment.DrawingMode[HomeEnvironment.DrawingMode.FILL]);
18928             writer.writeFloatAttribute$java_lang_String$float$float("subpartSizeUnderLight", environment.getSubpartSizeUnderLight(), 0);
18929             writer.writeIntegerAttribute$java_lang_String$int("photoWidth", environment.getPhotoWidth());
18930             writer.writeIntegerAttribute$java_lang_String$int("photoHeight", environment.getPhotoHeight());
18931             writer.writeAttribute$java_lang_String$java_lang_String("photoAspectRatio", /* Enum.name */ AspectRatio[environment.getPhotoAspectRatio()]);
18932             writer.writeIntegerAttribute$java_lang_String$int("photoQuality", environment.getPhotoQuality());
18933             writer.writeIntegerAttribute$java_lang_String$int("videoWidth", environment.getVideoWidth());
18934             writer.writeAttribute$java_lang_String$java_lang_String("videoAspectRatio", /* Enum.name */ AspectRatio[environment.getVideoAspectRatio()]);
18935             writer.writeIntegerAttribute$java_lang_String$int("videoQuality", environment.getVideoQuality());
18936             writer.writeFloatAttribute$java_lang_String$float$float("videoSpeed", environment.getVideoSpeed(), 2400.0 / 3600);
18937             writer.writeIntegerAttribute$java_lang_String$int("videoFrameRate", environment.getVideoFrameRate());
18938         };
18939         /**
18940          *
18941          * @param {XMLWriter} writer
18942          * @param {HomeEnvironment} environment
18943          */
18944         HomeXMLExporter$0.prototype.writeAttributes = function (writer, environment) {
18945             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((environment != null && environment instanceof HomeEnvironment) || environment === null)) {
18946                 return this.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomeEnvironment(writer, environment);
18947             }
18948             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((environment != null) || environment === null)) {
18949                 _super.prototype.writeAttributes.call(this, writer, environment);
18950             }
18951             else
18952                 throw new Error('invalid overload');
18953         };
18954         HomeXMLExporter$0.prototype.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomeEnvironment = function (writer, environment) {
18955             this.__parent.writeProperties(writer, environment);
18956             if (!(environment.getVideoCameraPath().length == 0)) {
18957                 {
18958                     var array = environment.getVideoCameraPath();
18959                     for (var index = 0; index < array.length; index++) {
18960                         var camera = array[index];
18961                         {
18962                             this.__parent.writeCamera(writer, camera, "cameraPath");
18963                         }
18964                     }
18965                 }
18966             }
18967             this.__parent.writeTexture(writer, environment.getGroundTexture(), "groundTexture");
18968             this.__parent.writeTexture(writer, environment.getSkyTexture(), "skyTexture");
18969         };
18970         /**
18971          *
18972          * @param {XMLWriter} writer
18973          * @param {HomeEnvironment} environment
18974          */
18975         HomeXMLExporter$0.prototype.writeChildren = function (writer, environment) {
18976             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((environment != null && environment instanceof HomeEnvironment) || environment === null)) {
18977                 return this.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomeEnvironment(writer, environment);
18978             }
18979             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((environment != null) || environment === null)) {
18980                 _super.prototype.writeChildren.call(this, writer, environment);
18981             }
18982             else
18983                 throw new Error('invalid overload');
18984         };
18985         return HomeXMLExporter$0;
18986     }(ObjectXMLExporter));
18987     HomeXMLExporter.HomeXMLExporter$0 = HomeXMLExporter$0;
18988     var HomeXMLExporter$1 = /** @class */ (function (_super) {
18989         __extends(HomeXMLExporter$1, _super);
18990         function HomeXMLExporter$1(__parent) {
18991             var _this = _super.call(this) || this;
18992             _this.__parent = __parent;
18993             return _this;
18994         }
18995         HomeXMLExporter$1.prototype.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_BackgroundImage = function (writer, backgroundImage) {
18996             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("image", this.__parent.getExportedContentName(backgroundImage, backgroundImage.getImage()), null);
18997             writer.writeFloatAttribute$java_lang_String$float("scaleDistance", backgroundImage.getScaleDistance());
18998             writer.writeFloatAttribute$java_lang_String$float("scaleDistanceXStart", backgroundImage.getScaleDistanceXStart());
18999             writer.writeFloatAttribute$java_lang_String$float("scaleDistanceYStart", backgroundImage.getScaleDistanceYStart());
19000             writer.writeFloatAttribute$java_lang_String$float("scaleDistanceXEnd", backgroundImage.getScaleDistanceXEnd());
19001             writer.writeFloatAttribute$java_lang_String$float("scaleDistanceYEnd", backgroundImage.getScaleDistanceYEnd());
19002             writer.writeFloatAttribute$java_lang_String$float$float("xOrigin", backgroundImage.getXOrigin(), 0);
19003             writer.writeFloatAttribute$java_lang_String$float$float("yOrigin", backgroundImage.getYOrigin(), 0);
19004             writer.writeBooleanAttribute("visible", backgroundImage.isVisible(), true);
19005         };
19006         /**
19007          *
19008          * @param {XMLWriter} writer
19009          * @param {BackgroundImage} backgroundImage
19010          */
19011         HomeXMLExporter$1.prototype.writeAttributes = function (writer, backgroundImage) {
19012             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((backgroundImage != null && backgroundImage instanceof BackgroundImage) || backgroundImage === null)) {
19013                 return this.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_BackgroundImage(writer, backgroundImage);
19014             }
19015             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((backgroundImage != null) || backgroundImage === null)) {
19016                 _super.prototype.writeAttributes.call(this, writer, backgroundImage);
19017             }
19018             else
19019                 throw new Error('invalid overload');
19020         };
19021         return HomeXMLExporter$1;
19022     }(ObjectXMLExporter));
19023     HomeXMLExporter.HomeXMLExporter$1 = HomeXMLExporter$1;
19024     var HomeXMLExporter$2 = /** @class */ (function (_super) {
19025         __extends(HomeXMLExporter$2, _super);
19026         function HomeXMLExporter$2(__parent) {
19027             var _this = _super.call(this) || this;
19028             _this.__parent = __parent;
19029             return _this;
19030         }
19031         HomeXMLExporter$2.prototype.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomePrint = function (writer, print) {
19032             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("headerFormat", print.getHeaderFormat(), null);
19033             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("footerFormat", print.getFooterFormat(), null);
19034             writer.writeBooleanAttribute("furniturePrinted", print.isFurniturePrinted(), true);
19035             writer.writeBooleanAttribute("planPrinted", print.isPlanPrinted(), true);
19036             writer.writeBooleanAttribute("view3DPrinted", print.isView3DPrinted(), true);
19037             writer.writeFloatAttribute$java_lang_String$java_lang_Float("planScale", print.getPlanScale());
19038             writer.writeFloatAttribute$java_lang_String$float("paperWidth", print.getPaperWidth());
19039             writer.writeFloatAttribute$java_lang_String$float("paperHeight", print.getPaperHeight());
19040             writer.writeFloatAttribute$java_lang_String$float("paperTopMargin", print.getPaperTopMargin());
19041             writer.writeFloatAttribute$java_lang_String$float("paperLeftMargin", print.getPaperLeftMargin());
19042             writer.writeFloatAttribute$java_lang_String$float("paperBottomMargin", print.getPaperBottomMargin());
19043             writer.writeFloatAttribute$java_lang_String$float("paperRightMargin", print.getPaperRightMargin());
19044             writer.writeAttribute$java_lang_String$java_lang_String("paperOrientation", /* Enum.name */ HomePrint.PaperOrientation[print.getPaperOrientation()]);
19045         };
19046         /**
19047          *
19048          * @param {XMLWriter} writer
19049          * @param {HomePrint} print
19050          */
19051         HomeXMLExporter$2.prototype.writeAttributes = function (writer, print) {
19052             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((print != null && print instanceof HomePrint) || print === null)) {
19053                 return this.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomePrint(writer, print);
19054             }
19055             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((print != null) || print === null)) {
19056                 _super.prototype.writeAttributes.call(this, writer, print);
19057             }
19058             else
19059                 throw new Error('invalid overload');
19060         };
19061         HomeXMLExporter$2.prototype.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomePrint = function (writer, print) {
19062             var printedLevels = print.getPrintedLevels();
19063             if (printedLevels != null) {
19064                 for (var index = 0; index < printedLevels.length; index++) {
19065                     var level = printedLevels[index];
19066                     {
19067                         writer.writeStartElement("printedLevel");
19068                         writer.writeAttribute$java_lang_String$java_lang_String("level", this.__parent.getId(level));
19069                         writer.writeEndElement();
19070                     }
19071                 }
19072             }
19073         };
19074         /**
19075          *
19076          * @param {XMLWriter} writer
19077          * @param {HomePrint} print
19078          */
19079         HomeXMLExporter$2.prototype.writeChildren = function (writer, print) {
19080             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((print != null && print instanceof HomePrint) || print === null)) {
19081                 return this.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomePrint(writer, print);
19082             }
19083             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((print != null) || print === null)) {
19084                 _super.prototype.writeChildren.call(this, writer, print);
19085             }
19086             else
19087                 throw new Error('invalid overload');
19088         };
19089         return HomeXMLExporter$2;
19090     }(ObjectXMLExporter));
19091     HomeXMLExporter.HomeXMLExporter$2 = HomeXMLExporter$2;
19092     var HomeXMLExporter$3 = /** @class */ (function (_super) {
19093         __extends(HomeXMLExporter$3, _super);
19094         function HomeXMLExporter$3(__parent) {
19095             var _this = _super.call(this) || this;
19096             _this.__parent = __parent;
19097             return _this;
19098         }
19099         HomeXMLExporter$3.prototype.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Compass = function (writer, compass) {
19100             writer.writeFloatAttribute$java_lang_String$float("x", compass.getX());
19101             writer.writeFloatAttribute$java_lang_String$float("y", compass.getY());
19102             writer.writeFloatAttribute$java_lang_String$float("diameter", compass.getDiameter());
19103             writer.writeFloatAttribute$java_lang_String$float("northDirection", compass.getNorthDirection());
19104             writer.writeFloatAttribute$java_lang_String$float("longitude", compass.getLongitude());
19105             writer.writeFloatAttribute$java_lang_String$float("latitude", compass.getLatitude());
19106             writer.writeAttribute$java_lang_String$java_lang_String("timeZone", compass.getTimeZone());
19107             writer.writeBooleanAttribute("visible", compass.isVisible(), true);
19108         };
19109         /**
19110          *
19111          * @param {XMLWriter} writer
19112          * @param {Compass} compass
19113          */
19114         HomeXMLExporter$3.prototype.writeAttributes = function (writer, compass) {
19115             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((compass != null && compass instanceof Compass) || compass === null)) {
19116                 return this.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Compass(writer, compass);
19117             }
19118             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((compass != null) || compass === null)) {
19119                 _super.prototype.writeAttributes.call(this, writer, compass);
19120             }
19121             else
19122                 throw new Error('invalid overload');
19123         };
19124         HomeXMLExporter$3.prototype.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Compass = function (writer, compass) {
19125             this.__parent.writeProperties(writer, compass);
19126         };
19127         /**
19128          *
19129          * @param {XMLWriter} writer
19130          * @param {Compass} compass
19131          */
19132         HomeXMLExporter$3.prototype.writeChildren = function (writer, compass) {
19133             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((compass != null && compass instanceof Compass) || compass === null)) {
19134                 return this.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Compass(writer, compass);
19135             }
19136             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((compass != null) || compass === null)) {
19137                 _super.prototype.writeChildren.call(this, writer, compass);
19138             }
19139             else
19140                 throw new Error('invalid overload');
19141         };
19142         return HomeXMLExporter$3;
19143     }(ObjectXMLExporter));
19144     HomeXMLExporter.HomeXMLExporter$3 = HomeXMLExporter$3;
19145     var HomeXMLExporter$4 = /** @class */ (function (_super) {
19146         __extends(HomeXMLExporter$4, _super);
19147         function HomeXMLExporter$4(__parent, attributeName) {
19148             var _this = _super.call(this) || this;
19149             _this.attributeName = attributeName;
19150             _this.__parent = __parent;
19151             return _this;
19152         }
19153         HomeXMLExporter$4.prototype.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Camera = function (writer, camera) {
19154             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("attribute", this.attributeName, null);
19155             if (!("observerCamera" === this.attributeName) && !("topCamera" === this.attributeName)) {
19156                 writer.writeAttribute$java_lang_String$java_lang_String("id", camera.getId());
19157             }
19158             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("name", camera.getName(), null);
19159             writer.writeAttribute$java_lang_String$java_lang_String("lens", /* Enum.name */ Camera.Lens[camera.getLens()]);
19160             writer.writeFloatAttribute$java_lang_String$float("x", camera.getX());
19161             writer.writeFloatAttribute$java_lang_String$float("y", camera.getY());
19162             writer.writeFloatAttribute$java_lang_String$float("z", camera.getZ());
19163             writer.writeFloatAttribute$java_lang_String$float("yaw", camera.getYaw());
19164             writer.writeFloatAttribute$java_lang_String$float("pitch", camera.getPitch());
19165             writer.writeFloatAttribute$java_lang_String$float("fieldOfView", camera.getFieldOfView());
19166             writer.writeLongAttribute$java_lang_String$long("time", camera.getTime());
19167             if (camera != null && camera instanceof ObserverCamera) {
19168                 writer.writeBooleanAttribute("fixedSize", camera.isFixedSize(), false);
19169             }
19170             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("renderer", camera.getRenderer(), null);
19171         };
19172         /**
19173          *
19174          * @param {XMLWriter} writer
19175          * @param {Camera} camera
19176          */
19177         HomeXMLExporter$4.prototype.writeAttributes = function (writer, camera) {
19178             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((camera != null && camera instanceof Camera) || camera === null)) {
19179                 return this.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Camera(writer, camera);
19180             }
19181             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((camera != null) || camera === null)) {
19182                 _super.prototype.writeAttributes.call(this, writer, camera);
19183             }
19184             else
19185                 throw new Error('invalid overload');
19186         };
19187         HomeXMLExporter$4.prototype.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Camera = function (writer, camera) {
19188             this.__parent.writeProperties(writer, camera);
19189         };
19190         /**
19191          *
19192          * @param {XMLWriter} writer
19193          * @param {Camera} camera
19194          */
19195         HomeXMLExporter$4.prototype.writeChildren = function (writer, camera) {
19196             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((camera != null && camera instanceof Camera) || camera === null)) {
19197                 return this.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Camera(writer, camera);
19198             }
19199             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((camera != null) || camera === null)) {
19200                 _super.prototype.writeChildren.call(this, writer, camera);
19201             }
19202             else
19203                 throw new Error('invalid overload');
19204         };
19205         return HomeXMLExporter$4;
19206     }(ObjectXMLExporter));
19207     HomeXMLExporter.HomeXMLExporter$4 = HomeXMLExporter$4;
19208     var HomeXMLExporter$5 = /** @class */ (function (_super) {
19209         __extends(HomeXMLExporter$5, _super);
19210         function HomeXMLExporter$5(__parent) {
19211             var _this = _super.call(this) || this;
19212             _this.__parent = __parent;
19213             return _this;
19214         }
19215         HomeXMLExporter$5.prototype.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Level = function (writer, level) {
19216             writer.writeAttribute$java_lang_String$java_lang_String("id", level.getId());
19217             writer.writeAttribute$java_lang_String$java_lang_String("name", level.getName());
19218             writer.writeFloatAttribute$java_lang_String$float("elevation", level.getElevation());
19219             writer.writeFloatAttribute$java_lang_String$float("floorThickness", level.getFloorThickness());
19220             writer.writeFloatAttribute$java_lang_String$float("height", level.getHeight());
19221             writer.writeIntegerAttribute$java_lang_String$int("elevationIndex", level.getElevationIndex());
19222             writer.writeBooleanAttribute("visible", level.isVisible(), true);
19223             writer.writeBooleanAttribute("viewable", level.isViewable(), true);
19224         };
19225         /**
19226          *
19227          * @param {XMLWriter} writer
19228          * @param {Level} level
19229          */
19230         HomeXMLExporter$5.prototype.writeAttributes = function (writer, level) {
19231             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((level != null && level instanceof Level) || level === null)) {
19232                 return this.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Level(writer, level);
19233             }
19234             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((level != null) || level === null)) {
19235                 _super.prototype.writeAttributes.call(this, writer, level);
19236             }
19237             else
19238                 throw new Error('invalid overload');
19239         };
19240         HomeXMLExporter$5.prototype.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Level = function (writer, level) {
19241             this.__parent.writeProperties(writer, level);
19242             this.__parent.writeBackgroundImage(writer, level.getBackgroundImage());
19243         };
19244         /**
19245          *
19246          * @param {XMLWriter} writer
19247          * @param {Level} level
19248          */
19249         HomeXMLExporter$5.prototype.writeChildren = function (writer, level) {
19250             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((level != null && level instanceof Level) || level === null)) {
19251                 return this.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Level(writer, level);
19252             }
19253             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((level != null) || level === null)) {
19254                 _super.prototype.writeChildren.call(this, writer, level);
19255             }
19256             else
19257                 throw new Error('invalid overload');
19258         };
19259         return HomeXMLExporter$5;
19260     }(ObjectXMLExporter));
19261     HomeXMLExporter.HomeXMLExporter$5 = HomeXMLExporter$5;
19262     var HomeXMLExporter$6 = /** @class */ (function (_super) {
19263         __extends(HomeXMLExporter$6, _super);
19264         function HomeXMLExporter$6(__parent) {
19265             var _this = _super.call(this) || this;
19266             _this.__parent = __parent;
19267             return _this;
19268         }
19269         HomeXMLExporter$6.prototype.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomeMaterial = function (writer, material) {
19270             writer.writeAttribute$java_lang_String$java_lang_String("name", material.getName());
19271             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("key", material.getKey(), null);
19272             writer.writeColorAttribute("color", material.getColor());
19273             if (material.getShininess() != null) {
19274                 writer.writeFloatAttribute$java_lang_String$java_lang_Float("shininess", material.getShininess());
19275             }
19276         };
19277         /**
19278          *
19279          * @param {XMLWriter} writer
19280          * @param {HomeMaterial} material
19281          */
19282         HomeXMLExporter$6.prototype.writeAttributes = function (writer, material) {
19283             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((material != null && material instanceof HomeMaterial) || material === null)) {
19284                 return this.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomeMaterial(writer, material);
19285             }
19286             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((material != null) || material === null)) {
19287                 _super.prototype.writeAttributes.call(this, writer, material);
19288             }
19289             else
19290                 throw new Error('invalid overload');
19291         };
19292         HomeXMLExporter$6.prototype.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomeMaterial = function (writer, material) {
19293             this.__parent.writeTexture(writer, material.getTexture(), null);
19294         };
19295         /**
19296          *
19297          * @param {XMLWriter} writer
19298          * @param {HomeMaterial} material
19299          */
19300         HomeXMLExporter$6.prototype.writeChildren = function (writer, material) {
19301             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((material != null && material instanceof HomeMaterial) || material === null)) {
19302                 return this.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomeMaterial(writer, material);
19303             }
19304             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((material != null) || material === null)) {
19305                 _super.prototype.writeChildren.call(this, writer, material);
19306             }
19307             else
19308                 throw new Error('invalid overload');
19309         };
19310         return HomeXMLExporter$6;
19311     }(ObjectXMLExporter));
19312     HomeXMLExporter.HomeXMLExporter$6 = HomeXMLExporter$6;
19313     var HomeXMLExporter$7 = /** @class */ (function (_super) {
19314         __extends(HomeXMLExporter$7, _super);
19315         function HomeXMLExporter$7(__parent) {
19316             var _this = _super.call(this) || this;
19317             _this.__parent = __parent;
19318             return _this;
19319         }
19320         HomeXMLExporter$7.prototype.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Wall = function (writer, wall) {
19321             writer.writeAttribute$java_lang_String$java_lang_String("id", wall.getId());
19322             if (wall.getLevel() != null) {
19323                 writer.writeAttribute$java_lang_String$java_lang_String("level", this.__parent.getId(wall.getLevel()));
19324             }
19325             if (wall.getWallAtStart() != null) {
19326                 var id = this.__parent.getId(wall.getWallAtStart());
19327                 if (id != null) {
19328                     writer.writeAttribute$java_lang_String$java_lang_String("wallAtStart", id);
19329                 }
19330             }
19331             if (wall.getWallAtEnd() != null) {
19332                 var id = this.__parent.getId(wall.getWallAtEnd());
19333                 if (id != null) {
19334                     writer.writeAttribute$java_lang_String$java_lang_String("wallAtEnd", id);
19335                 }
19336             }
19337             writer.writeFloatAttribute$java_lang_String$float("xStart", wall.getXStart());
19338             writer.writeFloatAttribute$java_lang_String$float("yStart", wall.getYStart());
19339             writer.writeFloatAttribute$java_lang_String$float("xEnd", wall.getXEnd());
19340             writer.writeFloatAttribute$java_lang_String$float("yEnd", wall.getYEnd());
19341             writer.writeFloatAttribute$java_lang_String$java_lang_Float("height", wall.getHeight());
19342             writer.writeFloatAttribute$java_lang_String$java_lang_Float("heightAtEnd", wall.getHeightAtEnd());
19343             writer.writeFloatAttribute$java_lang_String$float("thickness", wall.getThickness());
19344             writer.writeFloatAttribute$java_lang_String$java_lang_Float("arcExtent", wall.getArcExtent());
19345             if (wall.getPattern() != null) {
19346                 writer.writeAttribute$java_lang_String$java_lang_String("pattern", wall.getPattern().getName());
19347             }
19348             writer.writeColorAttribute("topColor", wall.getTopColor());
19349             writer.writeColorAttribute("leftSideColor", wall.getLeftSideColor());
19350             writer.writeFloatAttribute$java_lang_String$float$float("leftSideShininess", wall.getLeftSideShininess(), 0);
19351             writer.writeColorAttribute("rightSideColor", wall.getRightSideColor());
19352             writer.writeFloatAttribute$java_lang_String$float$float("rightSideShininess", wall.getRightSideShininess(), 0);
19353         };
19354         /**
19355          *
19356          * @param {XMLWriter} writer
19357          * @param {Wall} wall
19358          */
19359         HomeXMLExporter$7.prototype.writeAttributes = function (writer, wall) {
19360             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((wall != null && wall instanceof Wall) || wall === null)) {
19361                 return this.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Wall(writer, wall);
19362             }
19363             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((wall != null) || wall === null)) {
19364                 _super.prototype.writeAttributes.call(this, writer, wall);
19365             }
19366             else
19367                 throw new Error('invalid overload');
19368         };
19369         HomeXMLExporter$7.prototype.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Wall = function (writer, wall) {
19370             this.__parent.writeProperties(writer, wall);
19371             this.__parent.writeTexture(writer, wall.getLeftSideTexture(), "leftSideTexture");
19372             this.__parent.writeTexture(writer, wall.getRightSideTexture(), "rightSideTexture");
19373             this.__parent.writeBaseboard(writer, wall.getLeftSideBaseboard(), "leftSideBaseboard");
19374             this.__parent.writeBaseboard(writer, wall.getRightSideBaseboard(), "rightSideBaseboard");
19375         };
19376         /**
19377          *
19378          * @param {XMLWriter} writer
19379          * @param {Wall} wall
19380          */
19381         HomeXMLExporter$7.prototype.writeChildren = function (writer, wall) {
19382             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((wall != null && wall instanceof Wall) || wall === null)) {
19383                 return this.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Wall(writer, wall);
19384             }
19385             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((wall != null) || wall === null)) {
19386                 _super.prototype.writeChildren.call(this, writer, wall);
19387             }
19388             else
19389                 throw new Error('invalid overload');
19390         };
19391         return HomeXMLExporter$7;
19392     }(ObjectXMLExporter));
19393     HomeXMLExporter.HomeXMLExporter$7 = HomeXMLExporter$7;
19394     var HomeXMLExporter$8 = /** @class */ (function (_super) {
19395         __extends(HomeXMLExporter$8, _super);
19396         function HomeXMLExporter$8(__parent) {
19397             var _this = _super.call(this) || this;
19398             _this.__parent = __parent;
19399             return _this;
19400         }
19401         HomeXMLExporter$8.prototype.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Room = function (writer, room) {
19402             writer.writeAttribute$java_lang_String$java_lang_String("id", room.getId());
19403             if (room.getLevel() != null) {
19404                 writer.writeAttribute$java_lang_String$java_lang_String("level", this.__parent.getId(room.getLevel()));
19405             }
19406             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("name", room.getName(), null);
19407             writer.writeFloatAttribute$java_lang_String$float$float("nameAngle", room.getNameAngle(), 0.0);
19408             writer.writeFloatAttribute$java_lang_String$float$float("nameXOffset", room.getNameXOffset(), 0.0);
19409             writer.writeFloatAttribute$java_lang_String$float$float("nameYOffset", room.getNameYOffset(), -40.0);
19410             writer.writeBooleanAttribute("areaVisible", room.isAreaVisible(), false);
19411             writer.writeFloatAttribute$java_lang_String$float$float("areaAngle", room.getAreaAngle(), 0.0);
19412             writer.writeFloatAttribute$java_lang_String$float$float("areaXOffset", room.getAreaXOffset(), 0.0);
19413             writer.writeFloatAttribute$java_lang_String$float$float("areaYOffset", room.getAreaYOffset(), 0.0);
19414             writer.writeBooleanAttribute("floorVisible", room.isFloorVisible(), true);
19415             writer.writeColorAttribute("floorColor", room.getFloorColor());
19416             writer.writeFloatAttribute$java_lang_String$float$float("floorShininess", room.getFloorShininess(), 0);
19417             writer.writeBooleanAttribute("ceilingVisible", room.isCeilingVisible(), true);
19418             writer.writeColorAttribute("ceilingColor", room.getCeilingColor());
19419             writer.writeFloatAttribute$java_lang_String$float$float("ceilingShininess", room.getCeilingShininess(), 0);
19420             writer.writeBooleanAttribute("ceilingFlat", room.isCeilingFlat(), false);
19421         };
19422         /**
19423          *
19424          * @param {XMLWriter} writer
19425          * @param {Room} room
19426          */
19427         HomeXMLExporter$8.prototype.writeAttributes = function (writer, room) {
19428             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((room != null && room instanceof Room) || room === null)) {
19429                 return this.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Room(writer, room);
19430             }
19431             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((room != null) || room === null)) {
19432                 _super.prototype.writeAttributes.call(this, writer, room);
19433             }
19434             else
19435                 throw new Error('invalid overload');
19436         };
19437         HomeXMLExporter$8.prototype.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Room = function (writer, room) {
19438             this.__parent.writeProperties(writer, room);
19439             this.__parent.writeTextStyle(writer, room.getNameStyle(), "nameStyle");
19440             this.__parent.writeTextStyle(writer, room.getAreaStyle(), "areaStyle");
19441             this.__parent.writeTexture(writer, room.getFloorTexture(), "floorTexture");
19442             this.__parent.writeTexture(writer, room.getCeilingTexture(), "ceilingTexture");
19443             {
19444                 var array = room.getPoints();
19445                 for (var index = 0; index < array.length; index++) {
19446                     var point = array[index];
19447                     {
19448                         writer.writeStartElement("point");
19449                         writer.writeFloatAttribute$java_lang_String$float("x", point[0]);
19450                         writer.writeFloatAttribute$java_lang_String$float("y", point[1]);
19451                         writer.writeEndElement();
19452                     }
19453                 }
19454             }
19455         };
19456         /**
19457          *
19458          * @param {XMLWriter} writer
19459          * @param {Room} room
19460          */
19461         HomeXMLExporter$8.prototype.writeChildren = function (writer, room) {
19462             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((room != null && room instanceof Room) || room === null)) {
19463                 return this.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Room(writer, room);
19464             }
19465             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((room != null) || room === null)) {
19466                 _super.prototype.writeChildren.call(this, writer, room);
19467             }
19468             else
19469                 throw new Error('invalid overload');
19470         };
19471         return HomeXMLExporter$8;
19472     }(ObjectXMLExporter));
19473     HomeXMLExporter.HomeXMLExporter$8 = HomeXMLExporter$8;
19474     var HomeXMLExporter$9 = /** @class */ (function (_super) {
19475         __extends(HomeXMLExporter$9, _super);
19476         function HomeXMLExporter$9(__parent) {
19477             var _this = _super.call(this) || this;
19478             _this.__parent = __parent;
19479             return _this;
19480         }
19481         HomeXMLExporter$9.prototype.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Polyline = function (writer, polyline) {
19482             writer.writeAttribute$java_lang_String$java_lang_String("id", polyline.getId());
19483             if (polyline.getLevel() != null) {
19484                 writer.writeAttribute$java_lang_String$java_lang_String("level", this.__parent.getId(polyline.getLevel()));
19485             }
19486             writer.writeFloatAttribute$java_lang_String$float$float("thickness", polyline.getThickness(), 1.0);
19487             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("capStyle", /* Enum.name */ Polyline.CapStyle[polyline.getCapStyle()], /* Enum.name */ Polyline.CapStyle[Polyline.CapStyle.BUTT]);
19488             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("joinStyle", /* Enum.name */ Polyline.JoinStyle[polyline.getJoinStyle()], /* Enum.name */ Polyline.JoinStyle[Polyline.JoinStyle.MITER]);
19489             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("dashStyle", /* Enum.name */ Polyline.DashStyle[polyline.getDashStyle()], /* Enum.name */ Polyline.DashStyle[Polyline.DashStyle.SOLID]);
19490             if (polyline.getDashStyle() === Polyline.DashStyle.CUSTOMIZED) {
19491                 var dashPattern = { str: "", toString: function () { return this.str; } };
19492                 {
19493                     var array = polyline.getDashPattern();
19494                     var _loop_2 = function (index) {
19495                         var dashPart = array[index];
19496                         {
19497                             /* append */ (function (sb) { sb.str += HomeXMLExporter.floatToString(dashPart); return sb; })(dashPattern);
19498                             /* append */ (function (sb) { sb.str += " "; return sb; })(dashPattern);
19499                         }
19500                     };
19501                     for (var index = 0; index < array.length; index++) {
19502                         _loop_2(index);
19503                     }
19504                 }
19505                 /* setLength */ (function (sb, length) { return sb.str = sb.str.substring(0, length); })(dashPattern, /* length */ dashPattern.str.length - 1);
19506                 writer.writeAttribute$java_lang_String$java_lang_String("dashPattern", /* toString */ dashPattern.str);
19507             }
19508             writer.writeFloatAttribute$java_lang_String$float$float("dashOffset", polyline.getDashOffset(), 0.0);
19509             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("startArrowStyle", /* Enum.name */ Polyline.ArrowStyle[polyline.getStartArrowStyle()], /* Enum.name */ Polyline.ArrowStyle[Polyline.ArrowStyle.NONE]);
19510             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("endArrowStyle", /* Enum.name */ Polyline.ArrowStyle[polyline.getEndArrowStyle()], /* Enum.name */ Polyline.ArrowStyle[Polyline.ArrowStyle.NONE]);
19511             if (polyline.isVisibleIn3D()) {
19512                 writer.writeFloatAttribute$java_lang_String$float("elevation", polyline.getElevation());
19513             }
19514             writer.writeColorAttribute("color", polyline.getColor());
19515             writer.writeBooleanAttribute("closedPath", polyline.isClosedPath(), false);
19516         };
19517         /**
19518          *
19519          * @param {XMLWriter} writer
19520          * @param {Polyline} polyline
19521          */
19522         HomeXMLExporter$9.prototype.writeAttributes = function (writer, polyline) {
19523             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((polyline != null && polyline instanceof Polyline) || polyline === null)) {
19524                 return this.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Polyline(writer, polyline);
19525             }
19526             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((polyline != null) || polyline === null)) {
19527                 _super.prototype.writeAttributes.call(this, writer, polyline);
19528             }
19529             else
19530                 throw new Error('invalid overload');
19531         };
19532         HomeXMLExporter$9.prototype.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Polyline = function (writer, polyline) {
19533             this.__parent.writeProperties(writer, polyline);
19534             {
19535                 var array = polyline.getPoints();
19536                 for (var index = 0; index < array.length; index++) {
19537                     var point = array[index];
19538                     {
19539                         writer.writeStartElement("point");
19540                         writer.writeFloatAttribute$java_lang_String$float("x", point[0]);
19541                         writer.writeFloatAttribute$java_lang_String$float("y", point[1]);
19542                         writer.writeEndElement();
19543                     }
19544                 }
19545             }
19546         };
19547         /**
19548          *
19549          * @param {XMLWriter} writer
19550          * @param {Polyline} polyline
19551          */
19552         HomeXMLExporter$9.prototype.writeChildren = function (writer, polyline) {
19553             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((polyline != null && polyline instanceof Polyline) || polyline === null)) {
19554                 return this.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Polyline(writer, polyline);
19555             }
19556             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((polyline != null) || polyline === null)) {
19557                 _super.prototype.writeChildren.call(this, writer, polyline);
19558             }
19559             else
19560                 throw new Error('invalid overload');
19561         };
19562         return HomeXMLExporter$9;
19563     }(ObjectXMLExporter));
19564     HomeXMLExporter.HomeXMLExporter$9 = HomeXMLExporter$9;
19565     var HomeXMLExporter$10 = /** @class */ (function (_super) {
19566         __extends(HomeXMLExporter$10, _super);
19567         function HomeXMLExporter$10(__parent) {
19568             var _this = _super.call(this) || this;
19569             _this.__parent = __parent;
19570             return _this;
19571         }
19572         HomeXMLExporter$10.prototype.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_DimensionLine = function (writer, dimensionLine) {
19573             writer.writeAttribute$java_lang_String$java_lang_String("id", dimensionLine.getId());
19574             if (dimensionLine.getLevel() != null) {
19575                 writer.writeAttribute$java_lang_String$java_lang_String("level", this.__parent.getId(dimensionLine.getLevel()));
19576             }
19577             writer.writeFloatAttribute$java_lang_String$float("xStart", dimensionLine.getXStart());
19578             writer.writeFloatAttribute$java_lang_String$float("yStart", dimensionLine.getYStart());
19579             writer.writeFloatAttribute$java_lang_String$float$float("elevationStart", dimensionLine.getElevationStart(), 0);
19580             writer.writeFloatAttribute$java_lang_String$float("xEnd", dimensionLine.getXEnd());
19581             writer.writeFloatAttribute$java_lang_String$float("yEnd", dimensionLine.getYEnd());
19582             writer.writeFloatAttribute$java_lang_String$float$float("elevationEnd", dimensionLine.getElevationEnd(), 0);
19583             writer.writeFloatAttribute$java_lang_String$float("offset", dimensionLine.getOffset());
19584             writer.writeFloatAttribute$java_lang_String$float$float("endMarkSize", dimensionLine.getEndMarkSize(), 10);
19585             writer.writeFloatAttribute$java_lang_String$float$float("pitch", dimensionLine.getPitch(), 0);
19586             writer.writeColorAttribute("color", dimensionLine.getColor());
19587             writer.writeBooleanAttribute("visibleIn3D", dimensionLine.isVisibleIn3D(), false);
19588         };
19589         /**
19590          *
19591          * @param {XMLWriter} writer
19592          * @param {DimensionLine} dimensionLine
19593          */
19594         HomeXMLExporter$10.prototype.writeAttributes = function (writer, dimensionLine) {
19595             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((dimensionLine != null && dimensionLine instanceof DimensionLine) || dimensionLine === null)) {
19596                 return this.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_DimensionLine(writer, dimensionLine);
19597             }
19598             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((dimensionLine != null) || dimensionLine === null)) {
19599                 _super.prototype.writeAttributes.call(this, writer, dimensionLine);
19600             }
19601             else
19602                 throw new Error('invalid overload');
19603         };
19604         HomeXMLExporter$10.prototype.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_DimensionLine = function (writer, dimensionLine) {
19605             this.__parent.writeProperties(writer, dimensionLine);
19606             this.__parent.writeTextStyle(writer, dimensionLine.getLengthStyle(), "lengthStyle");
19607         };
19608         /**
19609          *
19610          * @param {XMLWriter} writer
19611          * @param {DimensionLine} dimensionLine
19612          */
19613         HomeXMLExporter$10.prototype.writeChildren = function (writer, dimensionLine) {
19614             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((dimensionLine != null && dimensionLine instanceof DimensionLine) || dimensionLine === null)) {
19615                 return this.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_DimensionLine(writer, dimensionLine);
19616             }
19617             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((dimensionLine != null) || dimensionLine === null)) {
19618                 _super.prototype.writeChildren.call(this, writer, dimensionLine);
19619             }
19620             else
19621                 throw new Error('invalid overload');
19622         };
19623         return HomeXMLExporter$10;
19624     }(ObjectXMLExporter));
19625     HomeXMLExporter.HomeXMLExporter$10 = HomeXMLExporter$10;
19626     var HomeXMLExporter$11 = /** @class */ (function (_super) {
19627         __extends(HomeXMLExporter$11, _super);
19628         function HomeXMLExporter$11(__parent) {
19629             var _this = _super.call(this) || this;
19630             _this.__parent = __parent;
19631             return _this;
19632         }
19633         HomeXMLExporter$11.prototype.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Label = function (writer, label) {
19634             writer.writeAttribute$java_lang_String$java_lang_String("id", label.getId());
19635             if (label.getLevel() != null) {
19636                 writer.writeAttribute$java_lang_String$java_lang_String("level", this.__parent.getId(label.getLevel()));
19637             }
19638             writer.writeFloatAttribute$java_lang_String$float("x", label.getX());
19639             writer.writeFloatAttribute$java_lang_String$float("y", label.getY());
19640             writer.writeFloatAttribute$java_lang_String$float$float("angle", label.getAngle(), 0);
19641             writer.writeFloatAttribute$java_lang_String$float$float("elevation", label.getElevation(), 0);
19642             writer.writeFloatAttribute$java_lang_String$java_lang_Float("pitch", label.getPitch());
19643             writer.writeColorAttribute("color", label.getColor());
19644             writer.writeColorAttribute("outlineColor", label.getOutlineColor());
19645         };
19646         /**
19647          *
19648          * @param {XMLWriter} writer
19649          * @param {Label} label
19650          */
19651         HomeXMLExporter$11.prototype.writeAttributes = function (writer, label) {
19652             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((label != null && label instanceof Label) || label === null)) {
19653                 return this.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Label(writer, label);
19654             }
19655             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((label != null) || label === null)) {
19656                 _super.prototype.writeAttributes.call(this, writer, label);
19657             }
19658             else
19659                 throw new Error('invalid overload');
19660         };
19661         HomeXMLExporter$11.prototype.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Label = function (writer, label) {
19662             this.__parent.writeProperties(writer, label);
19663             this.__parent.writeTextStyle(writer, label.getStyle(), null);
19664             writer.writeStartElement("text");
19665             writer.writeText(label.getText());
19666             writer.writeEndElement();
19667         };
19668         /**
19669          *
19670          * @param {XMLWriter} writer
19671          * @param {Label} label
19672          */
19673         HomeXMLExporter$11.prototype.writeChildren = function (writer, label) {
19674             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((label != null && label instanceof Label) || label === null)) {
19675                 return this.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Label(writer, label);
19676             }
19677             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((label != null) || label === null)) {
19678                 _super.prototype.writeChildren.call(this, writer, label);
19679             }
19680             else
19681                 throw new Error('invalid overload');
19682         };
19683         return HomeXMLExporter$11;
19684     }(ObjectXMLExporter));
19685     HomeXMLExporter.HomeXMLExporter$11 = HomeXMLExporter$11;
19686     var HomeXMLExporter$12 = /** @class */ (function (_super) {
19687         __extends(HomeXMLExporter$12, _super);
19688         function HomeXMLExporter$12(__parent, attributeName) {
19689             var _this = _super.call(this) || this;
19690             _this.attributeName = attributeName;
19691             _this.__parent = __parent;
19692             return _this;
19693         }
19694         HomeXMLExporter$12.prototype.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_TextStyle = function (writer, textStyle) {
19695             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("attribute", this.attributeName, null);
19696             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("fontName", textStyle.getFontName(), null);
19697             writer.writeFloatAttribute$java_lang_String$float("fontSize", textStyle.getFontSize());
19698             writer.writeBooleanAttribute("bold", textStyle.isBold(), false);
19699             writer.writeBooleanAttribute("italic", textStyle.isItalic(), false);
19700             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("alignment", /* Enum.name */ TextStyle.Alignment[textStyle.getAlignment()], /* Enum.name */ TextStyle.Alignment[TextStyle.Alignment.CENTER]);
19701         };
19702         /**
19703          *
19704          * @param {XMLWriter} writer
19705          * @param {TextStyle} textStyle
19706          */
19707         HomeXMLExporter$12.prototype.writeAttributes = function (writer, textStyle) {
19708             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((textStyle != null && textStyle instanceof TextStyle) || textStyle === null)) {
19709                 return this.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_TextStyle(writer, textStyle);
19710             }
19711             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((textStyle != null) || textStyle === null)) {
19712                 _super.prototype.writeAttributes.call(this, writer, textStyle);
19713             }
19714             else
19715                 throw new Error('invalid overload');
19716         };
19717         return HomeXMLExporter$12;
19718     }(ObjectXMLExporter));
19719     HomeXMLExporter.HomeXMLExporter$12 = HomeXMLExporter$12;
19720     var HomeXMLExporter$13 = /** @class */ (function (_super) {
19721         __extends(HomeXMLExporter$13, _super);
19722         function HomeXMLExporter$13(__parent, attributeName) {
19723             var _this = _super.call(this) || this;
19724             _this.attributeName = attributeName;
19725             _this.__parent = __parent;
19726             return _this;
19727         }
19728         HomeXMLExporter$13.prototype.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Baseboard = function (writer, baseboard) {
19729             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("attribute", this.attributeName, null);
19730             writer.writeFloatAttribute$java_lang_String$float("thickness", baseboard.getThickness());
19731             writer.writeFloatAttribute$java_lang_String$float("height", baseboard.getHeight());
19732             writer.writeColorAttribute("color", baseboard.getColor());
19733         };
19734         /**
19735          *
19736          * @param {XMLWriter} writer
19737          * @param {Baseboard} baseboard
19738          */
19739         HomeXMLExporter$13.prototype.writeAttributes = function (writer, baseboard) {
19740             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((baseboard != null && baseboard instanceof Baseboard) || baseboard === null)) {
19741                 return this.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Baseboard(writer, baseboard);
19742             }
19743             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((baseboard != null) || baseboard === null)) {
19744                 _super.prototype.writeAttributes.call(this, writer, baseboard);
19745             }
19746             else
19747                 throw new Error('invalid overload');
19748         };
19749         HomeXMLExporter$13.prototype.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Baseboard = function (writer, baseboard) {
19750             this.__parent.writeTexture(writer, baseboard.getTexture(), null);
19751         };
19752         /**
19753          *
19754          * @param {XMLWriter} writer
19755          * @param {Baseboard} baseboard
19756          */
19757         HomeXMLExporter$13.prototype.writeChildren = function (writer, baseboard) {
19758             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((baseboard != null && baseboard instanceof Baseboard) || baseboard === null)) {
19759                 return this.writeChildren$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_Baseboard(writer, baseboard);
19760             }
19761             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((baseboard != null) || baseboard === null)) {
19762                 _super.prototype.writeChildren.call(this, writer, baseboard);
19763             }
19764             else
19765                 throw new Error('invalid overload');
19766         };
19767         return HomeXMLExporter$13;
19768     }(ObjectXMLExporter));
19769     HomeXMLExporter.HomeXMLExporter$13 = HomeXMLExporter$13;
19770     var HomeXMLExporter$14 = /** @class */ (function (_super) {
19771         __extends(HomeXMLExporter$14, _super);
19772         function HomeXMLExporter$14(__parent, attributeName) {
19773             var _this = _super.call(this) || this;
19774             _this.attributeName = attributeName;
19775             _this.__parent = __parent;
19776             return _this;
19777         }
19778         HomeXMLExporter$14.prototype.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomeTexture = function (writer, texture) {
19779             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("attribute", this.attributeName, null);
19780             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("name", texture.getName(), null);
19781             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("creator", texture.getCreator(), null);
19782             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("catalogId", texture.getCatalogId(), null);
19783             writer.writeFloatAttribute$java_lang_String$float("width", texture.getWidth());
19784             writer.writeFloatAttribute$java_lang_String$float("height", texture.getHeight());
19785             writer.writeFloatAttribute$java_lang_String$float$float("xOffset", texture.getXOffset(), 0.0);
19786             writer.writeFloatAttribute$java_lang_String$float$float("yOffset", texture.getYOffset(), 0.0);
19787             writer.writeFloatAttribute$java_lang_String$float$float("angle", texture.getAngle(), 0.0);
19788             writer.writeFloatAttribute$java_lang_String$float$float("scale", texture.getScale(), 1.0);
19789             writer.writeBooleanAttribute("fittingArea", texture.isFittingArea(), false);
19790             writer.writeBooleanAttribute("leftToRightOriented", texture.isLeftToRightOriented(), true);
19791             writer.writeAttribute$java_lang_String$java_lang_String$java_lang_String("image", this.__parent.getExportedContentName(texture, texture.getImage()), null);
19792         };
19793         /**
19794          *
19795          * @param {XMLWriter} writer
19796          * @param {HomeTexture} texture
19797          */
19798         HomeXMLExporter$14.prototype.writeAttributes = function (writer, texture) {
19799             if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((texture != null && texture instanceof HomeTexture) || texture === null)) {
19800                 return this.writeAttributes$com_eteks_sweethome3d_io_XMLWriter$com_eteks_sweethome3d_model_HomeTexture(writer, texture);
19801             }
19802             else if (((writer != null && writer instanceof XMLWriter) || writer === null) && ((texture != null) || texture === null)) {
19803                 _super.prototype.writeAttributes.call(this, writer, texture);
19804             }
19805             else
19806                 throw new Error('invalid overload');
19807         };
19808         return HomeXMLExporter$14;
19809     }(ObjectXMLExporter));
19810     HomeXMLExporter.HomeXMLExporter$14 = HomeXMLExporter$14;
19811 })(HomeXMLExporter || (HomeXMLExporter = {}));
19812 /**
19813  * Creates a <code>InterruptedRecorderException</code> from its message.
19814  * @param {string} message
19815  * @class
19816  * @extends RecorderException
19817  * @author Emmanuel Puybaret
19818  * @ignore
19819  */
19820 var InterruptedRecorderException = /** @class */ (function (_super) {
19821     __extends(InterruptedRecorderException, _super);
19822     function InterruptedRecorderException(message) {
19823         var _this = this;
19824         if (((typeof message === 'string') || message === null)) {
19825             var __args = arguments;
19826             _this = _super.call(this, message) || this;
19827         }
19828         else if (message === undefined) {
19829             var __args = arguments;
19830             _this = _super.call(this) || this;
19831         }
19832         else
19833             throw new Error('invalid overload');
19834         return _this;
19835     }
19836     return InterruptedRecorderException;
19837 }(RecorderException));
19838 InterruptedRecorderException["__class"] = "com.eteks.sweethome3d.model.InterruptedRecorderException";
19839 /**
19840  * Exception thrown when there's not enough space to save a home.
19841  * @author Emmanuel Puybaret
19842  * @param {string} message
19843  * @param {number} missingSpace
19844  * @class
19845  * @extends RecorderException
19846  * @ignore
19847  */
19848 var NotEnoughSpaceRecorderException = /** @class */ (function (_super) {
19849     __extends(NotEnoughSpaceRecorderException, _super);
19850     function NotEnoughSpaceRecorderException(message, missingSpace) {
19851         var _this = _super.call(this, message) || this;
19852         Object.setPrototypeOf(_this, NotEnoughSpaceRecorderException.prototype);
19853         if (_this.missingSpace === undefined) {
19854             _this.missingSpace = 0;
19855         }
19856         _this.missingSpace = missingSpace;
19857         return _this;
19858     }
19859     /**
19860      * Returns the length of the missing space to save a home.
19861      * @return {number}
19862      */
19863     NotEnoughSpaceRecorderException.prototype.getMissingSpace = function () {
19864         return this.missingSpace;
19865     };
19866     return NotEnoughSpaceRecorderException;
19867 }(RecorderException));
19868 NotEnoughSpaceRecorderException["__class"] = "com.eteks.sweethome3d.model.NotEnoughSpaceRecorderException";
19869 /**
19870  * Creates an exception for the given damaged home with the invalid content it may contains.
19871  * @param {Home} damagedHome
19872  * @param {*[]} invalidContent
19873  * @param {string} message
19874  * @class
19875  * @extends RecorderException
19876  * @author Emmanuel Puybaret
19877  * @ignore
19878  */
19879 var DamagedHomeRecorderException = /** @class */ (function (_super) {
19880     __extends(DamagedHomeRecorderException, _super);
19881     function DamagedHomeRecorderException(damagedHome, invalidContent, message) {
19882         var _this = this;
19883         if (((damagedHome != null && damagedHome instanceof Home) || damagedHome === null) && ((invalidContent != null && (invalidContent instanceof Array)) || invalidContent === null) && ((typeof message === 'string') || message === null)) {
19884             var __args = arguments;
19885             _this = _super.call(this, message) || this;
19886             if (_this.damagedHome === undefined) {
19887                 _this.damagedHome = null;
19888             }
19889             if (_this.invalidContent === undefined) {
19890                 _this.invalidContent = null;
19891             }
19892             _this.damagedHome = damagedHome;
19893             _this.invalidContent = invalidContent;
19894         }
19895         else if (((damagedHome != null && damagedHome instanceof Home) || damagedHome === null) && ((invalidContent != null && (invalidContent instanceof Array)) || invalidContent === null) && message === undefined) {
19896             var __args = arguments;
19897             _this = _super.call(this) || this;
19898             if (_this.damagedHome === undefined) {
19899                 _this.damagedHome = null;
19900             }
19901             if (_this.invalidContent === undefined) {
19902                 _this.invalidContent = null;
19903             }
19904             _this.damagedHome = damagedHome;
19905             _this.invalidContent = invalidContent;
19906         }
19907         else
19908             throw new Error('invalid overload');
19909         return _this;
19910     }
19911     /**
19912      * Returns the damaged home containing some possible invalid content.
19913      * This home can be handled and saved correctly only once the invalid content will be removed.
19914      * @return {Home}
19915      */
19916     DamagedHomeRecorderException.prototype.getDamagedHome = function () {
19917         return this.damagedHome;
19918     };
19919     /**
19920      * Returns the invalid content in the damaged home.
19921      * @return {*[]}
19922      */
19923     DamagedHomeRecorderException.prototype.getInvalidContent = function () {
19924         return this.invalidContent;
19925     };
19926     return DamagedHomeRecorderException;
19927 }(RecorderException));
19928 DamagedHomeRecorderException["__class"] = "com.eteks.sweethome3d.model.DamagedHomeRecorderException";
19929 /**
19930  * Creates a room from its name and the given coordinates.
19931  * @param {string} id
19932  * @param {float[][]} points
19933  * @class
19934  * @extends HomeObject
19935  * @author Emmanuel Puybaret
19936  */
19937 var Room = /** @class */ (function (_super) {
19938     __extends(Room, _super);
19939     function Room(id, points) {
19940         var _this = this;
19941         if (((typeof id === 'string') || id === null) && ((points != null && points instanceof Array && (points.length == 0 || points[0] == null || points[0] instanceof Array)) || points === null)) {
19942             var __args = arguments;
19943             _this = _super.call(this, id) || this;
19944             if (_this.name === undefined) {
19945                 _this.name = null;
19946             }
19947             if (_this.nameXOffset === undefined) {
19948                 _this.nameXOffset = 0;
19949             }
19950             if (_this.nameYOffset === undefined) {
19951                 _this.nameYOffset = 0;
19952             }
19953             if (_this.nameStyle === undefined) {
19954                 _this.nameStyle = null;
19955             }
19956             if (_this.nameAngle === undefined) {
19957                 _this.nameAngle = 0;
19958             }
19959             if (_this.points === undefined) {
19960                 _this.points = null;
19961             }
19962             if (_this.areaVisible === undefined) {
19963                 _this.areaVisible = false;
19964             }
19965             if (_this.areaXOffset === undefined) {
19966                 _this.areaXOffset = 0;
19967             }
19968             if (_this.areaYOffset === undefined) {
19969                 _this.areaYOffset = 0;
19970             }
19971             if (_this.areaStyle === undefined) {
19972                 _this.areaStyle = null;
19973             }
19974             if (_this.areaAngle === undefined) {
19975                 _this.areaAngle = 0;
19976             }
19977             if (_this.floorVisible === undefined) {
19978                 _this.floorVisible = false;
19979             }
19980             if (_this.floorColor === undefined) {
19981                 _this.floorColor = null;
19982             }
19983             if (_this.floorTexture === undefined) {
19984                 _this.floorTexture = null;
19985             }
19986             if (_this.floorShininess === undefined) {
19987                 _this.floorShininess = 0;
19988             }
19989             if (_this.ceilingVisible === undefined) {
19990                 _this.ceilingVisible = false;
19991             }
19992             if (_this.ceilingColor === undefined) {
19993                 _this.ceilingColor = null;
19994             }
19995             if (_this.ceilingTexture === undefined) {
19996                 _this.ceilingTexture = null;
19997             }
19998             if (_this.ceilingShininess === undefined) {
19999                 _this.ceilingShininess = 0;
20000             }
20001             if (_this.ceilingFlat === undefined) {
20002                 _this.ceilingFlat = false;
20003             }
20004             if (_this.level === undefined) {
20005                 _this.level = null;
20006             }
20007             if (_this.shapeCache === undefined) {
20008                 _this.shapeCache = null;
20009             }
20010             if (_this.boundsCache === undefined) {
20011                 _this.boundsCache = null;
20012             }
20013             if (_this.areaCache === undefined) {
20014                 _this.areaCache = null;
20015             }
20016             if (points.length <= 1) {
20017                 throw new IllegalStateException("Room points must containt at least two points");
20018             }
20019             _this.points = _this.deepCopy(points);
20020             _this.areaVisible = true;
20021             _this.nameYOffset = -40.0;
20022             _this.floorVisible = true;
20023             _this.ceilingVisible = true;
20024             _this.ceilingFlat = true;
20025         }
20026         else if (((id != null && id instanceof Array && (id.length == 0 || id[0] == null || id[0] instanceof Array)) || id === null) && points === undefined) {
20027             var __args = arguments;
20028             var points_1 = __args[0];
20029             {
20030                 var __args_67 = arguments;
20031                 var id_6 = HomeObject.createId("room");
20032                 _this = _super.call(this, id_6) || this;
20033                 if (_this.name === undefined) {
20034                     _this.name = null;
20035                 }
20036                 if (_this.nameXOffset === undefined) {
20037                     _this.nameXOffset = 0;
20038                 }
20039                 if (_this.nameYOffset === undefined) {
20040                     _this.nameYOffset = 0;
20041                 }
20042                 if (_this.nameStyle === undefined) {
20043                     _this.nameStyle = null;
20044                 }
20045                 if (_this.nameAngle === undefined) {
20046                     _this.nameAngle = 0;
20047                 }
20048                 if (_this.points === undefined) {
20049                     _this.points = null;
20050                 }
20051                 if (_this.areaVisible === undefined) {
20052                     _this.areaVisible = false;
20053                 }
20054                 if (_this.areaXOffset === undefined) {
20055                     _this.areaXOffset = 0;
20056                 }
20057                 if (_this.areaYOffset === undefined) {
20058                     _this.areaYOffset = 0;
20059                 }
20060                 if (_this.areaStyle === undefined) {
20061                     _this.areaStyle = null;
20062                 }
20063                 if (_this.areaAngle === undefined) {
20064                     _this.areaAngle = 0;
20065                 }
20066                 if (_this.floorVisible === undefined) {
20067                     _this.floorVisible = false;
20068                 }
20069                 if (_this.floorColor === undefined) {
20070                     _this.floorColor = null;
20071                 }
20072                 if (_this.floorTexture === undefined) {
20073                     _this.floorTexture = null;
20074                 }
20075                 if (_this.floorShininess === undefined) {
20076                     _this.floorShininess = 0;
20077                 }
20078                 if (_this.ceilingVisible === undefined) {
20079                     _this.ceilingVisible = false;
20080                 }
20081                 if (_this.ceilingColor === undefined) {
20082                     _this.ceilingColor = null;
20083                 }
20084                 if (_this.ceilingTexture === undefined) {
20085                     _this.ceilingTexture = null;
20086                 }
20087                 if (_this.ceilingShininess === undefined) {
20088                     _this.ceilingShininess = 0;
20089                 }
20090                 if (_this.ceilingFlat === undefined) {
20091                     _this.ceilingFlat = false;
20092                 }
20093                 if (_this.level === undefined) {
20094                     _this.level = null;
20095                 }
20096                 if (_this.shapeCache === undefined) {
20097                     _this.shapeCache = null;
20098                 }
20099                 if (_this.boundsCache === undefined) {
20100                     _this.boundsCache = null;
20101                 }
20102                 if (_this.areaCache === undefined) {
20103                     _this.areaCache = null;
20104                 }
20105                 if (points_1.length <= 1) {
20106                     throw new IllegalStateException("Room points must containt at least two points");
20107                 }
20108                 _this.points = _this.deepCopy(points_1);
20109                 _this.areaVisible = true;
20110                 _this.nameYOffset = -40.0;
20111                 _this.floorVisible = true;
20112                 _this.ceilingVisible = true;
20113                 _this.ceilingFlat = true;
20114             }
20115             if (_this.name === undefined) {
20116                 _this.name = null;
20117             }
20118             if (_this.nameXOffset === undefined) {
20119                 _this.nameXOffset = 0;
20120             }
20121             if (_this.nameYOffset === undefined) {
20122                 _this.nameYOffset = 0;
20123             }
20124             if (_this.nameStyle === undefined) {
20125                 _this.nameStyle = null;
20126             }
20127             if (_this.nameAngle === undefined) {
20128                 _this.nameAngle = 0;
20129             }
20130             if (_this.points === undefined) {
20131                 _this.points = null;
20132             }
20133             if (_this.areaVisible === undefined) {
20134                 _this.areaVisible = false;
20135             }
20136             if (_this.areaXOffset === undefined) {
20137                 _this.areaXOffset = 0;
20138             }
20139             if (_this.areaYOffset === undefined) {
20140                 _this.areaYOffset = 0;
20141             }
20142             if (_this.areaStyle === undefined) {
20143                 _this.areaStyle = null;
20144             }
20145             if (_this.areaAngle === undefined) {
20146                 _this.areaAngle = 0;
20147             }
20148             if (_this.floorVisible === undefined) {
20149                 _this.floorVisible = false;
20150             }
20151             if (_this.floorColor === undefined) {
20152                 _this.floorColor = null;
20153             }
20154             if (_this.floorTexture === undefined) {
20155                 _this.floorTexture = null;
20156             }
20157             if (_this.floorShininess === undefined) {
20158                 _this.floorShininess = 0;
20159             }
20160             if (_this.ceilingVisible === undefined) {
20161                 _this.ceilingVisible = false;
20162             }
20163             if (_this.ceilingColor === undefined) {
20164                 _this.ceilingColor = null;
20165             }
20166             if (_this.ceilingTexture === undefined) {
20167                 _this.ceilingTexture = null;
20168             }
20169             if (_this.ceilingShininess === undefined) {
20170                 _this.ceilingShininess = 0;
20171             }
20172             if (_this.ceilingFlat === undefined) {
20173                 _this.ceilingFlat = false;
20174             }
20175             if (_this.level === undefined) {
20176                 _this.level = null;
20177             }
20178             if (_this.shapeCache === undefined) {
20179                 _this.shapeCache = null;
20180             }
20181             if (_this.boundsCache === undefined) {
20182                 _this.boundsCache = null;
20183             }
20184             if (_this.areaCache === undefined) {
20185                 _this.areaCache = null;
20186             }
20187         }
20188         else
20189             throw new Error('invalid overload');
20190         return _this;
20191     }
20192     Room.TWICE_PI_$LI$ = function () { if (Room.TWICE_PI == null) {
20193         Room.TWICE_PI = 2 * Math.PI;
20194     } return Room.TWICE_PI; };
20195     /**
20196      * Returns the name of this room.
20197      * @return {string}
20198      */
20199     Room.prototype.getName = function () {
20200         return this.name;
20201     };
20202     /**
20203      * Sets the name of this room. Once this room is updated,
20204      * listeners added to this room will receive a change notification.
20205      * @param {string} name
20206      */
20207     Room.prototype.setName = function (name) {
20208         if (name !== this.name && (name == null || !(name === this.name))) {
20209             var oldName = this.name;
20210             this.name = name;
20211             this.firePropertyChange(/* name */ "NAME", oldName, name);
20212         }
20213     };
20214     /**
20215      * Returns the distance along x axis applied to room center abscissa
20216      * to display room name.
20217      * @return {number}
20218      */
20219     Room.prototype.getNameXOffset = function () {
20220         return this.nameXOffset;
20221     };
20222     /**
20223      * Sets the distance along x axis applied to room center abscissa to display room name.
20224      * Once this room  is updated, listeners added to this room will receive a change notification.
20225      * @param {number} nameXOffset
20226      */
20227     Room.prototype.setNameXOffset = function (nameXOffset) {
20228         if (nameXOffset !== this.nameXOffset) {
20229             var oldNameXOffset = this.nameXOffset;
20230             this.nameXOffset = nameXOffset;
20231             this.firePropertyChange(/* name */ "NAME_X_OFFSET", oldNameXOffset, nameXOffset);
20232         }
20233     };
20234     /**
20235      * Returns the distance along y axis applied to room center ordinate
20236      * to display room name.
20237      * @return {number}
20238      */
20239     Room.prototype.getNameYOffset = function () {
20240         return this.nameYOffset;
20241     };
20242     /**
20243      * Sets the distance along y axis applied to room center ordinate to display room name.
20244      * Once this room is updated, listeners added to this room will receive a change notification.
20245      * @param {number} nameYOffset
20246      */
20247     Room.prototype.setNameYOffset = function (nameYOffset) {
20248         if (nameYOffset !== this.nameYOffset) {
20249             var oldNameYOffset = this.nameYOffset;
20250             this.nameYOffset = nameYOffset;
20251             this.firePropertyChange(/* name */ "NAME_Y_OFFSET", oldNameYOffset, nameYOffset);
20252         }
20253     };
20254     /**
20255      * Returns the text style used to display room name.
20256      * @return {TextStyle}
20257      */
20258     Room.prototype.getNameStyle = function () {
20259         return this.nameStyle;
20260     };
20261     /**
20262      * Sets the text style used to display room name.
20263      * Once this room is updated, listeners added to this room will receive a change notification.
20264      * @param {TextStyle} nameStyle
20265      */
20266     Room.prototype.setNameStyle = function (nameStyle) {
20267         if (nameStyle !== this.nameStyle) {
20268             var oldNameStyle = this.nameStyle;
20269             this.nameStyle = nameStyle;
20270             this.firePropertyChange(/* name */ "NAME_STYLE", oldNameStyle, nameStyle);
20271         }
20272     };
20273     /**
20274      * Returns the angle in radians used to display the room name.
20275      * @return {number}
20276      */
20277     Room.prototype.getNameAngle = function () {
20278         return this.nameAngle;
20279     };
20280     /**
20281      * Sets the angle in radians used to display the room name. Once this piece is updated,
20282      * listeners added to this piece will receive a change notification.
20283      * @param {number} nameAngle
20284      */
20285     Room.prototype.setNameAngle = function (nameAngle) {
20286         nameAngle = ((nameAngle % Room.TWICE_PI_$LI$() + Room.TWICE_PI_$LI$()) % Room.TWICE_PI_$LI$());
20287         if (nameAngle !== this.nameAngle) {
20288             var oldNameAngle = this.nameAngle;
20289             this.nameAngle = nameAngle;
20290             this.firePropertyChange(/* name */ "NAME_ANGLE", oldNameAngle, nameAngle);
20291         }
20292     };
20293     /**
20294      * Returns the points of the polygon matching this room.
20295      * @return {float[][]} an array of the (x,y) coordinates of the room points.
20296      */
20297     Room.prototype.getPoints = function () {
20298         return this.deepCopy(this.points);
20299     };
20300     /**
20301      * Returns the number of points of the polygon matching this room.
20302      * @return {number}
20303      */
20304     Room.prototype.getPointCount = function () {
20305         return this.points.length;
20306     };
20307     Room.prototype.deepCopy = function (points) {
20308         var pointsCopy = (function (s) { var a = []; while (s-- > 0)
20309             a.push(null); return a; })(points.length);
20310         for (var i = 0; i < points.length; i++) {
20311             {
20312                 pointsCopy[i] = /* clone */ points[i].slice(0);
20313             }
20314             ;
20315         }
20316         return pointsCopy;
20317     };
20318     /**
20319      * Sets the points of the polygon matching this room. Once this room
20320      * is updated, listeners added to this room will receive a change notification.
20321      * @param {float[][]} points
20322      */
20323     Room.prototype.setPoints = function (points) {
20324         if (!(JSON.stringify(this.points) === JSON.stringify(points))) {
20325             this.updatePoints(points);
20326         }
20327     };
20328     /**
20329      * Update the points of the polygon matching this room.
20330      * @param {float[][]} points
20331      * @private
20332      */
20333     Room.prototype.updatePoints = function (points) {
20334         var oldPoints = this.points;
20335         this.points = this.deepCopy(points);
20336         this.shapeCache = null;
20337         this.boundsCache = null;
20338         this.areaCache = null;
20339         this.firePropertyChange(/* name */ "POINTS", oldPoints, points);
20340     };
20341     Room.prototype.addPoint$float$float = function (x, y) {
20342         this.addPoint$float$float$int(x, y, this.points.length);
20343     };
20344     Room.prototype.addPoint$float$float$int = function (x, y, index) {
20345         if (index < 0 || index > this.points.length) {
20346             throw Object.defineProperty(new Error("Invalid index " + index), '__classes', { configurable: true, value: ['java.lang.Throwable', 'java.lang.IndexOutOfBoundsException', 'java.lang.Object', 'java.lang.RuntimeException', 'java.lang.Exception'] });
20347         }
20348         var newPoints = (function (s) { var a = []; while (s-- > 0)
20349             a.push(null); return a; })(this.points.length + 1);
20350         /* arraycopy */ (function (srcPts, srcOff, dstPts, dstOff, size) { if (srcPts !== dstPts || dstOff >= srcOff + size) {
20351             while (--size >= 0)
20352                 dstPts[dstOff++] = srcPts[srcOff++];
20353         }
20354         else {
20355             var tmp = srcPts.slice(srcOff, srcOff + size);
20356             for (var i = 0; i < size; i++)
20357                 dstPts[dstOff++] = tmp[i];
20358         } })(this.points, 0, newPoints, 0, index);
20359         newPoints[index] = [x, y];
20360         /* arraycopy */ (function (srcPts, srcOff, dstPts, dstOff, size) { if (srcPts !== dstPts || dstOff >= srcOff + size) {
20361             while (--size >= 0)
20362                 dstPts[dstOff++] = srcPts[srcOff++];
20363         }
20364         else {
20365             var tmp = srcPts.slice(srcOff, srcOff + size);
20366             for (var i = 0; i < size; i++)
20367                 dstPts[dstOff++] = tmp[i];
20368         } })(this.points, index, newPoints, index + 1, this.points.length - index);
20369         var oldPoints = this.points;
20370         this.points = newPoints;
20371         this.shapeCache = null;
20372         this.boundsCache = null;
20373         this.areaCache = null;
20374         this.firePropertyChange(/* name */ "POINTS", oldPoints, this.deepCopy(this.points));
20375     };
20376     /**
20377      * Adds a point at the given <code>index</code>.
20378      * @throws IndexOutOfBoundsException if <code>index</code> is negative or > <code>getPointCount()</code>
20379      * @param {number} x
20380      * @param {number} y
20381      * @param {number} index
20382      */
20383     Room.prototype.addPoint = function (x, y, index) {
20384         if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof index === 'number') || index === null)) {
20385             return this.addPoint$float$float$int(x, y, index);
20386         }
20387         else if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && index === undefined) {
20388             return this.addPoint$float$float(x, y);
20389         }
20390         else
20391             throw new Error('invalid overload');
20392     };
20393     /**
20394      * Sets the point at the given <code>index</code>.
20395      * @throws IndexOutOfBoundsException if <code>index</code> is negative or >= <code>getPointCount()</code>
20396      * @param {number} x
20397      * @param {number} y
20398      * @param {number} index
20399      */
20400     Room.prototype.setPoint = function (x, y, index) {
20401         if (index < 0 || index >= this.points.length) {
20402             throw Object.defineProperty(new Error("Invalid index " + index), '__classes', { configurable: true, value: ['java.lang.Throwable', 'java.lang.IndexOutOfBoundsException', 'java.lang.Object', 'java.lang.RuntimeException', 'java.lang.Exception'] });
20403         }
20404         if (this.points[index][0] !== x || this.points[index][1] !== y) {
20405             var oldPoints = this.points;
20406             this.points = this.deepCopy(this.points);
20407             this.points[index][0] = x;
20408             this.points[index][1] = y;
20409             this.shapeCache = null;
20410             this.boundsCache = null;
20411             this.areaCache = null;
20412             this.firePropertyChange(/* name */ "POINTS", oldPoints, this.deepCopy(this.points));
20413         }
20414     };
20415     /**
20416      * Removes the point at the given <code>index</code>.
20417      * @throws IndexOutOfBoundsException if <code>index</code> is negative or >= <code>getPointCount()</code>
20418      * @param {number} index
20419      */
20420     Room.prototype.removePoint = function (index) {
20421         if (index < 0 || index >= this.points.length) {
20422             throw Object.defineProperty(new Error("Invalid index " + index), '__classes', { configurable: true, value: ['java.lang.Throwable', 'java.lang.IndexOutOfBoundsException', 'java.lang.Object', 'java.lang.RuntimeException', 'java.lang.Exception'] });
20423         }
20424         else if (this.points.length <= 1) {
20425             throw new IllegalStateException("Room points must containt at least one point");
20426         }
20427         var newPoints = (function (s) { var a = []; while (s-- > 0)
20428             a.push(null); return a; })(this.points.length - 1);
20429         /* arraycopy */ (function (srcPts, srcOff, dstPts, dstOff, size) { if (srcPts !== dstPts || dstOff >= srcOff + size) {
20430             while (--size >= 0)
20431                 dstPts[dstOff++] = srcPts[srcOff++];
20432         }
20433         else {
20434             var tmp = srcPts.slice(srcOff, srcOff + size);
20435             for (var i = 0; i < size; i++)
20436                 dstPts[dstOff++] = tmp[i];
20437         } })(this.points, 0, newPoints, 0, index);
20438         /* arraycopy */ (function (srcPts, srcOff, dstPts, dstOff, size) { if (srcPts !== dstPts || dstOff >= srcOff + size) {
20439             while (--size >= 0)
20440                 dstPts[dstOff++] = srcPts[srcOff++];
20441         }
20442         else {
20443             var tmp = srcPts.slice(srcOff, srcOff + size);
20444             for (var i = 0; i < size; i++)
20445                 dstPts[dstOff++] = tmp[i];
20446         } })(this.points, index + 1, newPoints, index, this.points.length - index - 1);
20447         var oldPoints = this.points;
20448         this.points = newPoints;
20449         this.shapeCache = null;
20450         this.boundsCache = null;
20451         this.areaCache = null;
20452         this.firePropertyChange(/* name */ "POINTS", oldPoints, this.deepCopy(this.points));
20453     };
20454     /**
20455      * Returns the minimum coordinates of the rectangle bounding this room.
20456      * @return {float[]}
20457      */
20458     Room.prototype.getBoundsMinimumCoordinates = function () {
20459         if (this.boundsCache == null) {
20460             this.boundsCache = this.getShape().getBounds2D();
20461         }
20462         return [this.boundsCache.getMinX(), this.boundsCache.getMinY()];
20463     };
20464     /**
20465      * Returns the maximum coordinates of the rectangle bounding this room.
20466      * @return {float[]}
20467      */
20468     Room.prototype.getBoundsMaximumCoordinates = function () {
20469         if (this.boundsCache == null) {
20470             this.boundsCache = this.getShape().getBounds2D();
20471         }
20472         return [this.boundsCache.getMaxX(), this.boundsCache.getMaxY()];
20473     };
20474     /**
20475      * Returns whether the area of this room is visible or not.
20476      * @return {boolean}
20477      */
20478     Room.prototype.isAreaVisible = function () {
20479         return this.areaVisible;
20480     };
20481     /**
20482      * Sets whether the area of this room is visible or not. Once this room
20483      * is updated, listeners added to this room will receive a change notification.
20484      * @param {boolean} areaVisible
20485      */
20486     Room.prototype.setAreaVisible = function (areaVisible) {
20487         if (areaVisible !== this.areaVisible) {
20488             this.areaVisible = areaVisible;
20489             this.firePropertyChange(/* name */ "AREA_VISIBLE", !areaVisible, areaVisible);
20490         }
20491     };
20492     /**
20493      * Returns the distance along x axis applied to room center abscissa
20494      * to display room area.
20495      * @return {number}
20496      */
20497     Room.prototype.getAreaXOffset = function () {
20498         return this.areaXOffset;
20499     };
20500     /**
20501      * Sets the distance along x axis applied to room center abscissa to display room area.
20502      * Once this room  is updated, listeners added to this room will receive a change notification.
20503      * @param {number} areaXOffset
20504      */
20505     Room.prototype.setAreaXOffset = function (areaXOffset) {
20506         if (areaXOffset !== this.areaXOffset) {
20507             var oldAreaXOffset = this.areaXOffset;
20508             this.areaXOffset = areaXOffset;
20509             this.firePropertyChange(/* name */ "AREA_X_OFFSET", oldAreaXOffset, areaXOffset);
20510         }
20511     };
20512     /**
20513      * Returns the distance along y axis applied to room center ordinate
20514      * to display room area.
20515      * @return {number}
20516      */
20517     Room.prototype.getAreaYOffset = function () {
20518         return this.areaYOffset;
20519     };
20520     /**
20521      * Sets the distance along y axis applied to room center ordinate to display room area.
20522      * Once this room is updated, listeners added to this room will receive a change notification.
20523      * @param {number} areaYOffset
20524      */
20525     Room.prototype.setAreaYOffset = function (areaYOffset) {
20526         if (areaYOffset !== this.areaYOffset) {
20527             var oldAreaYOffset = this.areaYOffset;
20528             this.areaYOffset = areaYOffset;
20529             this.firePropertyChange(/* name */ "AREA_Y_OFFSET", oldAreaYOffset, areaYOffset);
20530         }
20531     };
20532     /**
20533      * Returns the text style used to display room area.
20534      * @return {TextStyle}
20535      */
20536     Room.prototype.getAreaStyle = function () {
20537         return this.areaStyle;
20538     };
20539     /**
20540      * Sets the text style used to display room area.
20541      * Once this room is updated, listeners added to this room will receive a change notification.
20542      * @param {TextStyle} areaStyle
20543      */
20544     Room.prototype.setAreaStyle = function (areaStyle) {
20545         if (areaStyle !== this.areaStyle) {
20546             var oldAreaStyle = this.areaStyle;
20547             this.areaStyle = areaStyle;
20548             this.firePropertyChange(/* name */ "AREA_STYLE", oldAreaStyle, areaStyle);
20549         }
20550     };
20551     /**
20552      * Returns the angle in radians used to display the room area.
20553      * @return {number}
20554      */
20555     Room.prototype.getAreaAngle = function () {
20556         return this.areaAngle;
20557     };
20558     /**
20559      * Sets the angle in radians used to display the room area. Once this piece is updated,
20560      * listeners added to this piece will receive a change notification.
20561      * @param {number} areaAngle
20562      */
20563     Room.prototype.setAreaAngle = function (areaAngle) {
20564         areaAngle = ((areaAngle % Room.TWICE_PI_$LI$() + Room.TWICE_PI_$LI$()) % Room.TWICE_PI_$LI$());
20565         if (areaAngle !== this.areaAngle) {
20566             var oldAreaAngle = this.areaAngle;
20567             this.areaAngle = areaAngle;
20568             this.firePropertyChange(/* name */ "AREA_ANGLE", oldAreaAngle, areaAngle);
20569         }
20570     };
20571     /**
20572      * Returns the abscissa of the center point of this room.
20573      * @return {number}
20574      */
20575     Room.prototype.getXCenter = function () {
20576         var xMin = this.points[0][0];
20577         var xMax = this.points[0][0];
20578         for (var i = 1; i < this.points.length; i++) {
20579             {
20580                 xMin = Math.min(xMin, this.points[i][0]);
20581                 xMax = Math.max(xMax, this.points[i][0]);
20582             }
20583             ;
20584         }
20585         return (xMin + xMax) / 2;
20586     };
20587     /**
20588      * Returns the ordinate of the center point of this room.
20589      * @return {number}
20590      */
20591     Room.prototype.getYCenter = function () {
20592         var yMin = this.points[0][1];
20593         var yMax = this.points[0][1];
20594         for (var i = 1; i < this.points.length; i++) {
20595             {
20596                 yMin = Math.min(yMin, this.points[i][1]);
20597                 yMax = Math.max(yMax, this.points[i][1]);
20598             }
20599             ;
20600         }
20601         return (yMin + yMax) / 2;
20602     };
20603     /**
20604      * Returns the floor color of this room.
20605      * @return {number}
20606      */
20607     Room.prototype.getFloorColor = function () {
20608         return this.floorColor;
20609     };
20610     /**
20611      * Sets the floor color of this room. Once this room is updated,
20612      * listeners added to this room will receive a change notification.
20613      * @param {number} floorColor
20614      */
20615     Room.prototype.setFloorColor = function (floorColor) {
20616         if (floorColor !== this.floorColor && (floorColor == null || !(floorColor === this.floorColor))) {
20617             var oldFloorColor = this.floorColor;
20618             this.floorColor = floorColor;
20619             this.firePropertyChange(/* name */ "FLOOR_COLOR", oldFloorColor, floorColor);
20620         }
20621     };
20622     /**
20623      * Returns the floor texture of this room.
20624      * @return {HomeTexture}
20625      */
20626     Room.prototype.getFloorTexture = function () {
20627         return this.floorTexture;
20628     };
20629     /**
20630      * Sets the floor texture of this room. Once this room is updated,
20631      * listeners added to this room will receive a change notification.
20632      * @param {HomeTexture} floorTexture
20633      */
20634     Room.prototype.setFloorTexture = function (floorTexture) {
20635         if (floorTexture !== this.floorTexture && (floorTexture == null || !floorTexture.equals(this.floorTexture))) {
20636             var oldFloorTexture = this.floorTexture;
20637             this.floorTexture = floorTexture;
20638             this.firePropertyChange(/* name */ "FLOOR_TEXTURE", oldFloorTexture, floorTexture);
20639         }
20640     };
20641     /**
20642      * Returns whether the floor of this room is visible or not.
20643      * @return {boolean}
20644      */
20645     Room.prototype.isFloorVisible = function () {
20646         return this.floorVisible;
20647     };
20648     /**
20649      * Sets whether the floor of this room is visible or not. Once this room
20650      * is updated, listeners added to this room will receive a change notification.
20651      * @param {boolean} floorVisible
20652      */
20653     Room.prototype.setFloorVisible = function (floorVisible) {
20654         if (floorVisible !== this.floorVisible) {
20655             this.floorVisible = floorVisible;
20656             this.firePropertyChange(/* name */ "FLOOR_VISIBLE", !floorVisible, floorVisible);
20657         }
20658     };
20659     /**
20660      * Returns the floor shininess of this room.
20661      * @return {number} a value between 0 (matt) and 1 (very shiny)
20662      */
20663     Room.prototype.getFloorShininess = function () {
20664         return this.floorShininess;
20665     };
20666     /**
20667      * Sets the floor shininess of this room. Once this room is updated,
20668      * listeners added to this room will receive a change notification.
20669      * @param {number} floorShininess
20670      */
20671     Room.prototype.setFloorShininess = function (floorShininess) {
20672         if (floorShininess !== this.floorShininess) {
20673             var oldFloorShininess = this.floorShininess;
20674             this.floorShininess = floorShininess;
20675             this.firePropertyChange(/* name */ "FLOOR_SHININESS", oldFloorShininess, floorShininess);
20676         }
20677     };
20678     /**
20679      * Returns the ceiling color color of this room.
20680      * @return {number}
20681      */
20682     Room.prototype.getCeilingColor = function () {
20683         return this.ceilingColor;
20684     };
20685     /**
20686      * Sets the ceiling color of this room. Once this room is updated,
20687      * listeners added to this room will receive a change notification.
20688      * @param {number} ceilingColor
20689      */
20690     Room.prototype.setCeilingColor = function (ceilingColor) {
20691         if (ceilingColor !== this.ceilingColor && (ceilingColor == null || !(ceilingColor === this.ceilingColor))) {
20692             var oldCeilingColor = this.ceilingColor;
20693             this.ceilingColor = ceilingColor;
20694             this.firePropertyChange(/* name */ "CEILING_COLOR", oldCeilingColor, ceilingColor);
20695         }
20696     };
20697     /**
20698      * Returns the ceiling texture of this room.
20699      * @return {HomeTexture}
20700      */
20701     Room.prototype.getCeilingTexture = function () {
20702         return this.ceilingTexture;
20703     };
20704     /**
20705      * Sets the ceiling texture of this room. Once this room is updated,
20706      * listeners added to this room will receive a change notification.
20707      * @param {HomeTexture} ceilingTexture
20708      */
20709     Room.prototype.setCeilingTexture = function (ceilingTexture) {
20710         if (ceilingTexture !== this.ceilingTexture && (ceilingTexture == null || !ceilingTexture.equals(this.ceilingTexture))) {
20711             var oldCeilingTexture = this.ceilingTexture;
20712             this.ceilingTexture = ceilingTexture;
20713             this.firePropertyChange(/* name */ "CEILING_TEXTURE", oldCeilingTexture, ceilingTexture);
20714         }
20715     };
20716     /**
20717      * Returns whether the ceiling of this room is visible or not.
20718      * @return {boolean}
20719      */
20720     Room.prototype.isCeilingVisible = function () {
20721         return this.ceilingVisible;
20722     };
20723     /**
20724      * Sets whether the ceiling of this room is visible or not. Once this room
20725      * is updated, listeners added to this room will receive a change notification.
20726      * @param {boolean} ceilingVisible
20727      */
20728     Room.prototype.setCeilingVisible = function (ceilingVisible) {
20729         if (ceilingVisible !== this.ceilingVisible) {
20730             this.ceilingVisible = ceilingVisible;
20731             this.firePropertyChange(/* name */ "CEILING_VISIBLE", !ceilingVisible, ceilingVisible);
20732         }
20733     };
20734     /**
20735      * Returns the ceiling shininess of this room.
20736      * @return {number} a value between 0 (matt) and 1 (very shiny)
20737      */
20738     Room.prototype.getCeilingShininess = function () {
20739         return this.ceilingShininess;
20740     };
20741     /**
20742      * Sets the ceiling shininess of this room. Once this room is updated,
20743      * listeners added to this room will receive a change notification.
20744      * @param {number} ceilingShininess
20745      */
20746     Room.prototype.setCeilingShininess = function (ceilingShininess) {
20747         if (ceilingShininess !== this.ceilingShininess) {
20748             var oldCeilingShininess = this.ceilingShininess;
20749             this.ceilingShininess = ceilingShininess;
20750             this.firePropertyChange(/* name */ "CEILING_SHININESS", oldCeilingShininess, ceilingShininess);
20751         }
20752     };
20753     /**
20754      * Returns <code>true</code> if the ceiling should remain flat whatever its environment.
20755      * @return {boolean}
20756      */
20757     Room.prototype.isCeilingFlat = function () {
20758         return this.ceilingFlat;
20759     };
20760     /**
20761      * Sets whether the floor texture should remain flat. Once this room is updated,
20762      * listeners added to this room will receive a change notification.
20763      * @param {boolean} ceilingFlat
20764      */
20765     Room.prototype.setCeilingFlat = function (ceilingFlat) {
20766         if (ceilingFlat !== this.ceilingFlat) {
20767             this.ceilingFlat = ceilingFlat;
20768             this.firePropertyChange(/* name */ "CEILING_FLAT", !ceilingFlat, ceilingFlat);
20769         }
20770     };
20771     /**
20772      * Returns the level which this room belongs to.
20773      * @return {Level}
20774      */
20775     Room.prototype.getLevel = function () {
20776         return this.level;
20777     };
20778     /**
20779      * Sets the level of this room. Once this room is updated,
20780      * listeners added to this room will receive a change notification.
20781      * @param {Level} level
20782      */
20783     Room.prototype.setLevel = function (level) {
20784         if (level !== this.level) {
20785             var oldLevel = this.level;
20786             this.level = level;
20787             this.firePropertyChange(/* name */ "LEVEL", oldLevel, level);
20788         }
20789     };
20790     /**
20791      * Returns <code>true</code> if this room is at the given <code>level</code>
20792      * or at a level with the same elevation and a smaller elevation index.
20793      * @param {Level} level
20794      * @return {boolean}
20795      */
20796     Room.prototype.isAtLevel = function (level) {
20797         return this.level === level || this.level != null && level != null && this.level.getElevation() === level.getElevation() && this.level.getElevationIndex() < level.getElevationIndex();
20798     };
20799     /**
20800      * Returns the area of this room.
20801      * @return {number}
20802      */
20803     Room.prototype.getArea = function () {
20804         if (this.areaCache == null) {
20805             var roomArea = new java.awt.geom.Area(this.getShape());
20806             if (roomArea.isSingular()) {
20807                 this.areaCache = Math.abs(this.getSignedArea(this.getPoints()));
20808             }
20809             else {
20810                 var area = 0;
20811                 var currentPathPoints = ([]);
20812                 for (var it = roomArea.getPathIterator(null); !it.isDone();) {
20813                     {
20814                         var roomPoint = [0, 0];
20815                         switch ((it.currentSegment(roomPoint))) {
20816                             case java.awt.geom.PathIterator.SEG_MOVETO:
20817                                 /* add */ (currentPathPoints.push(roomPoint) > 0);
20818                                 break;
20819                             case java.awt.geom.PathIterator.SEG_LINETO:
20820                                 /* add */ (currentPathPoints.push(roomPoint) > 0);
20821                                 break;
20822                             case java.awt.geom.PathIterator.SEG_CLOSE:
20823                                 var pathPoints = currentPathPoints.slice(0);
20824                                 area += this.getSignedArea(pathPoints);
20825                                 /* clear */ (currentPathPoints.length = 0);
20826                                 break;
20827                         }
20828                         it.next();
20829                     }
20830                     ;
20831                 }
20832                 this.areaCache = area;
20833             }
20834         }
20835         return this.areaCache;
20836     };
20837     Room.prototype.getSignedArea = function (areaPoints) {
20838         var area = 0;
20839         for (var i = 1; i < areaPoints.length; i++) {
20840             {
20841                 area += areaPoints[i][0] * areaPoints[i - 1][1];
20842                 area -= areaPoints[i][1] * areaPoints[i - 1][0];
20843             }
20844             ;
20845         }
20846         area += areaPoints[0][0] * areaPoints[areaPoints.length - 1][1];
20847         area -= areaPoints[0][1] * areaPoints[areaPoints.length - 1][0];
20848         return area / 2;
20849     };
20850     /**
20851      * Returns <code>true</code> if the points of this room are in clockwise order.
20852      * @return {boolean}
20853      */
20854     Room.prototype.isClockwise = function () {
20855         return this.getSignedArea(this.getPoints()) < 0;
20856     };
20857     /**
20858      * Returns <code>true</code> if this room is comprised of only one polygon.
20859      * @return {boolean}
20860      */
20861     Room.prototype.isSingular = function () {
20862         return new java.awt.geom.Area(this.getShape()).isSingular();
20863     };
20864     /**
20865      * Returns <code>true</code> if this room intersects
20866      * with the horizontal rectangle which opposite corners are at points
20867      * (<code>x0</code>, <code>y0</code>) and (<code>x1</code>, <code>y1</code>).
20868      * @param {number} x0
20869      * @param {number} y0
20870      * @param {number} x1
20871      * @param {number} y1
20872      * @return {boolean}
20873      */
20874     Room.prototype.intersectsRectangle = function (x0, y0, x1, y1) {
20875         var rectangle = new java.awt.geom.Rectangle2D.Float(x0, y0, 0, 0);
20876         rectangle.add(x1, y1);
20877         return this.getShape().intersects(rectangle);
20878     };
20879     /**
20880      * Returns <code>true</code> if this room contains
20881      * the point at (<code>x</code>, <code>y</code>) with a given <code>margin</code>.
20882      * @param {number} x
20883      * @param {number} y
20884      * @param {number} margin
20885      * @return {boolean}
20886      */
20887     Room.prototype.containsPoint = function (x, y, margin) {
20888         return this.containsShapeAtWithMargin(this.getShape(), x, y, margin);
20889     };
20890     /**
20891      * Returns the index of the point of this room equal to
20892      * the point at (<code>x</code>, <code>y</code>) with a given <code>margin</code>.
20893      * @return {number} the index of the first found point or -1.
20894      * @param {number} x
20895      * @param {number} y
20896      * @param {number} margin
20897      */
20898     Room.prototype.getPointIndexAt = function (x, y, margin) {
20899         for (var i = 0; i < this.points.length; i++) {
20900             {
20901                 if (Math.abs(x - this.points[i][0]) <= margin && Math.abs(y - this.points[i][1]) <= margin) {
20902                     return i;
20903                 }
20904             }
20905             ;
20906         }
20907         return -1;
20908     };
20909     /**
20910      * Returns <code>true</code> if the center point at which is displayed the name
20911      * of this room is equal to the point at (<code>x</code>, <code>y</code>)
20912      * with a given <code>margin</code>.
20913      * @param {number} x
20914      * @param {number} y
20915      * @param {number} margin
20916      * @return {boolean}
20917      */
20918     Room.prototype.isNameCenterPointAt = function (x, y, margin) {
20919         return Math.abs(x - this.getXCenter() - this.getNameXOffset()) <= margin && Math.abs(y - this.getYCenter() - this.getNameYOffset()) <= margin;
20920     };
20921     /**
20922      * Returns <code>true</code> if the center point at which is displayed the area
20923      * of this room is equal to the point at (<code>x</code>, <code>y</code>)
20924      * with a given <code>margin</code>.
20925      * @param {number} x
20926      * @param {number} y
20927      * @param {number} margin
20928      * @return {boolean}
20929      */
20930     Room.prototype.isAreaCenterPointAt = function (x, y, margin) {
20931         return Math.abs(x - this.getXCenter() - this.getAreaXOffset()) <= margin && Math.abs(y - this.getYCenter() - this.getAreaYOffset()) <= margin;
20932     };
20933     /**
20934      * Returns <code>true</code> if <code>shape</code> contains
20935      * the point at (<code>x</code>, <code>y</code>)
20936      * with a given <code>margin</code>.
20937      * @param {Object} shape
20938      * @param {number} x
20939      * @param {number} y
20940      * @param {number} margin
20941      * @return {boolean}
20942      * @private
20943      */
20944     Room.prototype.containsShapeAtWithMargin = function (shape, x, y, margin) {
20945         if (margin === 0) {
20946             return shape.contains(x, y);
20947         }
20948         else {
20949             return shape.intersects(x - margin, y - margin, 2 * margin, 2 * margin);
20950         }
20951     };
20952     /**
20953      * Returns the shape matching this room.
20954      * @return {Object}
20955      * @private
20956      */
20957     Room.prototype.getShape = function () {
20958         if (this.shapeCache == null) {
20959             var roomShape = new java.awt.geom.GeneralPath();
20960             roomShape.moveTo(this.points[0][0], this.points[0][1]);
20961             for (var i = 1; i < this.points.length; i++) {
20962                 {
20963                     roomShape.lineTo(this.points[i][0], this.points[i][1]);
20964                 }
20965                 ;
20966             }
20967             roomShape.closePath();
20968             this.shapeCache = roomShape;
20969         }
20970         return this.shapeCache;
20971     };
20972     /**
20973      * Moves this room of (<code>dx</code>, <code>dy</code>) units.
20974      * @param {number} dx
20975      * @param {number} dy
20976      */
20977     Room.prototype.move = function (dx, dy) {
20978         if (dx !== 0 || dy !== 0) {
20979             var points = this.getPoints();
20980             for (var i = 0; i < points.length; i++) {
20981                 {
20982                     points[i][0] += dx;
20983                     points[i][1] += dy;
20984                 }
20985                 ;
20986             }
20987             this.updatePoints(points);
20988         }
20989     };
20990     /**
20991      * Returns a clone of this room.
20992      * @return {Room}
20993      */
20994     Room.prototype.clone = function () {
20995         var _this = this;
20996         var clone = (function (o) { if (_super.prototype.clone != undefined) {
20997             return _super.prototype.clone.call(_this);
20998         }
20999         else {
21000             var clone_1 = Object.create(o);
21001             for (var p in o) {
21002                 if (o.hasOwnProperty(p))
21003                     clone_1[p] = o[p];
21004             }
21005             return clone_1;
21006         } })(this);
21007         clone.level = null;
21008         return clone;
21009     };
21010     return Room;
21011 }(HomeObject));
21012 Room["__class"] = "com.eteks.sweethome3d.model.Room";
21013 Room["__interfaces"] = ["com.eteks.sweethome3d.model.Selectable", "com.eteks.sweethome3d.model.Elevatable"];
21014 Room['__transients'] = ['shapeCache', 'boundsCache', 'areaCache', 'propertyChangeSupport'];
21015 /**
21016  * Creates a label with the given <code>text</code>.
21017  * @param {string} id
21018  * @param {string} text
21019  * @param {number} x
21020  * @param {number} y
21021  * @class
21022  * @extends HomeObject
21023  * @author Emmanuel Puybaret
21024  */
21025 var Label = /** @class */ (function (_super) {
21026     __extends(Label, _super);
21027     function Label(id, text, x, y) {
21028         var _this = this;
21029         if (((typeof id === 'string') || id === null) && ((typeof text === 'string') || text === null) && ((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null)) {
21030             var __args = arguments;
21031             _this = _super.call(this, id) || this;
21032             if (_this.text === undefined) {
21033                 _this.text = null;
21034             }
21035             if (_this.x === undefined) {
21036                 _this.x = 0;
21037             }
21038             if (_this.y === undefined) {
21039                 _this.y = 0;
21040             }
21041             if (_this.style === undefined) {
21042                 _this.style = null;
21043             }
21044             if (_this.color === undefined) {
21045                 _this.color = null;
21046             }
21047             if (_this.outlineColor === undefined) {
21048                 _this.outlineColor = null;
21049             }
21050             if (_this.angle === undefined) {
21051                 _this.angle = 0;
21052             }
21053             if (_this.pitch === undefined) {
21054                 _this.pitch = null;
21055             }
21056             if (_this.elevation === undefined) {
21057                 _this.elevation = 0;
21058             }
21059             if (_this.level === undefined) {
21060                 _this.level = null;
21061             }
21062             _this.text = text;
21063             _this.x = x;
21064             _this.y = y;
21065         }
21066         else if (((typeof id === 'string') || id === null) && ((typeof text === 'number') || text === null) && ((typeof x === 'number') || x === null) && y === undefined) {
21067             var __args = arguments;
21068             var text_1 = __args[0];
21069             var x_1 = __args[1];
21070             var y_1 = __args[2];
21071             {
21072                 var __args_68 = arguments;
21073                 var id_7 = HomeObject.createId("label");
21074                 _this = _super.call(this, id_7) || this;
21075                 if (_this.text === undefined) {
21076                     _this.text = null;
21077                 }
21078                 if (_this.x === undefined) {
21079                     _this.x = 0;
21080                 }
21081                 if (_this.y === undefined) {
21082                     _this.y = 0;
21083                 }
21084                 if (_this.style === undefined) {
21085                     _this.style = null;
21086                 }
21087                 if (_this.color === undefined) {
21088                     _this.color = null;
21089                 }
21090                 if (_this.outlineColor === undefined) {
21091                     _this.outlineColor = null;
21092                 }
21093                 if (_this.angle === undefined) {
21094                     _this.angle = 0;
21095                 }
21096                 if (_this.pitch === undefined) {
21097                     _this.pitch = null;
21098                 }
21099                 if (_this.elevation === undefined) {
21100                     _this.elevation = 0;
21101                 }
21102                 if (_this.level === undefined) {
21103                     _this.level = null;
21104                 }
21105                 _this.text = text_1;
21106                 _this.x = x_1;
21107                 _this.y = y_1;
21108             }
21109             if (_this.text === undefined) {
21110                 _this.text = null;
21111             }
21112             if (_this.x === undefined) {
21113                 _this.x = 0;
21114             }
21115             if (_this.y === undefined) {
21116                 _this.y = 0;
21117             }
21118             if (_this.style === undefined) {
21119                 _this.style = null;
21120             }
21121             if (_this.color === undefined) {
21122                 _this.color = null;
21123             }
21124             if (_this.outlineColor === undefined) {
21125                 _this.outlineColor = null;
21126             }
21127             if (_this.angle === undefined) {
21128                 _this.angle = 0;
21129             }
21130             if (_this.pitch === undefined) {
21131                 _this.pitch = null;
21132             }
21133             if (_this.elevation === undefined) {
21134                 _this.elevation = 0;
21135             }
21136             if (_this.level === undefined) {
21137                 _this.level = null;
21138             }
21139         }
21140         else
21141             throw new Error('invalid overload');
21142         return _this;
21143     }
21144     Label.TWICE_PI_$LI$ = function () { if (Label.TWICE_PI == null) {
21145         Label.TWICE_PI = 2 * Math.PI;
21146     } return Label.TWICE_PI; };
21147     /**
21148      * Returns the text of this label.
21149      * @return {string}
21150      */
21151     Label.prototype.getText = function () {
21152         return this.text;
21153     };
21154     /**
21155      * Sets the text of this label. Once this label is updated,
21156      * listeners added to this label will receive a change notification.
21157      * @param {string} text
21158      */
21159     Label.prototype.setText = function (text) {
21160         if (text !== this.text && (text == null || !(text === this.text))) {
21161             var oldText = this.text;
21162             this.text = text;
21163             this.firePropertyChange(/* name */ "TEXT", oldText, text);
21164         }
21165     };
21166     /**
21167      * Returns the abscissa of the text of this label.
21168      * @return {number}
21169      */
21170     Label.prototype.getX = function () {
21171         return this.x;
21172     };
21173     /**
21174      * Sets the abscissa of the text of this label. Once this label is updated,
21175      * listeners added to this label will receive a change notification.
21176      * @param {number} x
21177      */
21178     Label.prototype.setX = function (x) {
21179         if (x !== this.x) {
21180             var oldX = this.x;
21181             this.x = x;
21182             this.firePropertyChange(/* name */ "X", oldX, x);
21183         }
21184     };
21185     /**
21186      * Returns the ordinate of the text of this label.
21187      * @return {number}
21188      */
21189     Label.prototype.getY = function () {
21190         return this.y;
21191     };
21192     /**
21193      * Sets the ordinate of the text of this label. Once this label is updated,
21194      * listeners added to this label will receive a change notification.
21195      * @param {number} y
21196      */
21197     Label.prototype.setY = function (y) {
21198         if (y !== this.y) {
21199             var oldY = this.y;
21200             this.y = y;
21201             this.firePropertyChange(/* name */ "Y", oldY, y);
21202         }
21203     };
21204     /**
21205      * Returns the elevation of this label
21206      * from the ground according to the elevation of its level.
21207      * @return {number}
21208      */
21209     Label.prototype.getGroundElevation = function () {
21210         if (this.level != null) {
21211             return this.elevation + this.level.getElevation();
21212         }
21213         else {
21214             return this.elevation;
21215         }
21216     };
21217     /**
21218      * Returns the elevation of this label on its level.
21219      * @see #getPitch()
21220      * @return {number}
21221      */
21222     Label.prototype.getElevation = function () {
21223         return this.elevation;
21224     };
21225     /**
21226      * Sets the elevation of this label on its level. Once this label is updated,
21227      * listeners added to this label will receive a change notification.
21228      * @param {number} elevation
21229      */
21230     Label.prototype.setElevation = function (elevation) {
21231         if (elevation !== this.elevation) {
21232             var oldElevation = this.elevation;
21233             this.elevation = elevation;
21234             this.firePropertyChange(/* name */ "ELEVATION", oldElevation, elevation);
21235         }
21236     };
21237     /**
21238      * Returns the style used to display the text of this label.
21239      * @return {TextStyle}
21240      */
21241     Label.prototype.getStyle = function () {
21242         return this.style;
21243     };
21244     /**
21245      * Sets the style used to display the text of this label.
21246      * Once this label is updated, listeners added to this label will receive a change notification.
21247      * @param {TextStyle} style
21248      */
21249     Label.prototype.setStyle = function (style) {
21250         if (style !== this.style) {
21251             var oldStyle = this.style;
21252             this.style = style;
21253             this.firePropertyChange(/* name */ "STYLE", oldStyle, style);
21254         }
21255     };
21256     /**
21257      * Returns the color used to display the text of this label.
21258      * @return {number}
21259      */
21260     Label.prototype.getColor = function () {
21261         return this.color;
21262     };
21263     /**
21264      * Sets the color used to display the text of this label.
21265      * Once this label is updated, listeners added to this label will receive a change notification.
21266      * @param {number} color
21267      */
21268     Label.prototype.setColor = function (color) {
21269         if (color !== this.color) {
21270             var oldColor = this.color;
21271             this.color = color;
21272             this.firePropertyChange(/* name */ "COLOR", oldColor, color);
21273         }
21274     };
21275     /**
21276      * Returns the color used to outline the text of this label.
21277      * @return {number}
21278      */
21279     Label.prototype.getOutlineColor = function () {
21280         return this.outlineColor;
21281     };
21282     /**
21283      * Sets the color used to outline the text of this label.
21284      * Once this label is updated, listeners added to this label will receive a change notification.
21285      * @param {number} outlineColor
21286      */
21287     Label.prototype.setOutlineColor = function (outlineColor) {
21288         if (outlineColor !== this.outlineColor) {
21289             var oldOutlineColor = this.outlineColor;
21290             this.outlineColor = outlineColor;
21291             this.firePropertyChange(/* name */ "OUTLINE_COLOR", oldOutlineColor, outlineColor);
21292         }
21293     };
21294     /**
21295      * Returns the angle in radians around vertical axis used to display this label.
21296      * @return {number}
21297      */
21298     Label.prototype.getAngle = function () {
21299         return this.angle;
21300     };
21301     /**
21302      * Sets the angle in radians around vertical axis used to display this label. Once this label is updated,
21303      * listeners added to this label will receive a change notification.
21304      * @param {number} angle
21305      */
21306     Label.prototype.setAngle = function (angle) {
21307         angle = ((angle % Label.TWICE_PI_$LI$() + Label.TWICE_PI_$LI$()) % Label.TWICE_PI_$LI$());
21308         if (angle !== this.angle) {
21309             var oldAngle = this.angle;
21310             this.angle = angle;
21311             this.firePropertyChange(/* name */ "ANGLE", oldAngle, angle);
21312         }
21313     };
21314     /**
21315      * Returns the pitch angle in radians used to rotate this label around horizontal axis in 3D.
21316      * @return {number} an angle in radians or <code>null</code> if the label shouldn't be displayed in 3D.
21317      * A pitch angle equal to 0 should make this label fully visible when seen from top.
21318      */
21319     Label.prototype.getPitch = function () {
21320         return this.pitch;
21321     };
21322     /**
21323      * Sets the angle in radians used to rotate this label around horizontal axis in 3D. Once this label is updated,
21324      * listeners added to this label will receive a change notification.
21325      * Pitch axis is horizontal transverse axis.
21326      * @param {number} pitch
21327      */
21328     Label.prototype.setPitch = function (pitch) {
21329         if (pitch != null) {
21330             pitch = ((pitch % Label.TWICE_PI_$LI$() + Label.TWICE_PI_$LI$()) % Label.TWICE_PI_$LI$());
21331         }
21332         if (pitch !== this.pitch && (pitch == null || !(pitch === this.pitch))) {
21333             var oldPitch = this.pitch;
21334             this.pitch = pitch;
21335             this.firePropertyChange(/* name */ "PITCH", oldPitch, pitch);
21336         }
21337     };
21338     /**
21339      * Returns the level which this label belongs to.
21340      * @return {Level}
21341      */
21342     Label.prototype.getLevel = function () {
21343         return this.level;
21344     };
21345     /**
21346      * Sets the level of this label. Once this label is updated,
21347      * listeners added to this label will receive a change notification.
21348      * @param {Level} level
21349      */
21350     Label.prototype.setLevel = function (level) {
21351         if (level !== this.level) {
21352             var oldLevel = this.level;
21353             this.level = level;
21354             this.firePropertyChange(/* name */ "LEVEL", oldLevel, level);
21355         }
21356     };
21357     /**
21358      * Returns <code>true</code> if this label is at the given <code>level</code>
21359      * or at a level with the same elevation and a smaller elevation index
21360      * or if the elevation of this label is higher than <code>level</code> elevation.
21361      * @param {Level} level
21362      * @return {boolean}
21363      */
21364     Label.prototype.isAtLevel = function (level) {
21365         if (this.level === level) {
21366             return true;
21367         }
21368         else if (this.level != null && level != null) {
21369             var labelLevelElevation = this.level.getElevation();
21370             var levelElevation = level.getElevation();
21371             return labelLevelElevation === levelElevation && this.level.getElevationIndex() < level.getElevationIndex() || labelLevelElevation < levelElevation && labelLevelElevation + this.elevation > levelElevation;
21372         }
21373         else {
21374             return false;
21375         }
21376     };
21377     /**
21378      * Returns the point of this label.
21379      * @return {float[][]} an array of the (x,y) coordinates of this label.
21380      */
21381     Label.prototype.getPoints = function () {
21382         return [[this.x, this.y]];
21383     };
21384     /**
21385      * Returns <code>true</code> if the point of this label is contained
21386      * in the horizontal rectangle which opposite corners are at points
21387      * (<code>x0</code>, <code>y0</code>) and (<code>x1</code>, <code>y1</code>).
21388      * @param {number} x0
21389      * @param {number} y0
21390      * @param {number} x1
21391      * @param {number} y1
21392      * @return {boolean}
21393      */
21394     Label.prototype.intersectsRectangle = function (x0, y0, x1, y1) {
21395         var rectangle = new java.awt.geom.Rectangle2D.Float(x0, y0, 0, 0);
21396         rectangle.add(x1, y1);
21397         return rectangle.contains(this.x, this.y);
21398     };
21399     /**
21400      * Returns <code>true</code> if this text is at the point at (<code>x</code>, <code>y</code>)
21401      * with a given <code>margin</code>.
21402      * @param {number} x
21403      * @param {number} y
21404      * @param {number} margin
21405      * @return {boolean}
21406      */
21407     Label.prototype.containsPoint = function (x, y, margin) {
21408         return Math.abs(x - this.x) <= margin && Math.abs(y - this.y) <= margin;
21409     };
21410     /**
21411      * Moves this label of (<code>dx</code>, <code>dy</code>) units.
21412      * @param {number} dx
21413      * @param {number} dy
21414      */
21415     Label.prototype.move = function (dx, dy) {
21416         this.setX(this.getX() + dx);
21417         this.setY(this.getY() + dy);
21418     };
21419     /**
21420      * Returns a clone of this label.
21421      * @return {Label}
21422      */
21423     Label.prototype.clone = function () {
21424         var _this = this;
21425         var clone = (function (o) { if (_super.prototype.clone != undefined) {
21426             return _super.prototype.clone.call(_this);
21427         }
21428         else {
21429             var clone_2 = Object.create(o);
21430             for (var p in o) {
21431                 if (o.hasOwnProperty(p))
21432                     clone_2[p] = o[p];
21433             }
21434             return clone_2;
21435         } })(this);
21436         clone.level = null;
21437         return clone;
21438     };
21439     return Label;
21440 }(HomeObject));
21441 Label["__class"] = "com.eteks.sweethome3d.model.Label";
21442 Label["__interfaces"] = ["com.eteks.sweethome3d.model.Selectable", "com.eteks.sweethome3d.model.Elevatable"];
21443 Label['__transients'] = ['propertyChangeSupport'];
21444 /**
21445  * Creates home environment from parameters.
21446  * @param {string} id
21447  * @param {number} groundColor
21448  * @param {HomeTexture} groundTexture
21449  * @param {number} skyColor
21450  * @param {HomeTexture} skyTexture
21451  * @param {number} lightColor
21452  * @param {number} wallsAlpha
21453  * @class
21454  * @extends HomeObject
21455  * @author Emmanuel Puybaret
21456  */
21457 var HomeEnvironment = /** @class */ (function (_super) {
21458     __extends(HomeEnvironment, _super);
21459     function HomeEnvironment(id, groundColor, groundTexture, skyColor, skyTexture, lightColor, wallsAlpha) {
21460         var _this = this;
21461         if (((typeof id === 'string') || id === null) && ((typeof groundColor === 'number') || groundColor === null) && ((groundTexture != null && groundTexture instanceof HomeTexture) || groundTexture === null) && ((typeof skyColor === 'number') || skyColor === null) && ((skyTexture != null && skyTexture instanceof HomeTexture) || skyTexture === null) && ((typeof lightColor === 'number') || lightColor === null) && ((typeof wallsAlpha === 'number') || wallsAlpha === null)) {
21462             var __args = arguments;
21463             _this = _super.call(this, id) || this;
21464             if (_this.observerCameraElevationAdjusted === undefined) {
21465                 _this.observerCameraElevationAdjusted = false;
21466             }
21467             if (_this.groundColor === undefined) {
21468                 _this.groundColor = 0;
21469             }
21470             if (_this.groundTexture === undefined) {
21471                 _this.groundTexture = null;
21472             }
21473             if (_this.backgroundImageVisibleOnGround3D === undefined) {
21474                 _this.backgroundImageVisibleOnGround3D = false;
21475             }
21476             if (_this.skyColor === undefined) {
21477                 _this.skyColor = 0;
21478             }
21479             if (_this.skyTexture === undefined) {
21480                 _this.skyTexture = null;
21481             }
21482             if (_this.lightColor === undefined) {
21483                 _this.lightColor = 0;
21484             }
21485             if (_this.ceilingLightColor === undefined) {
21486                 _this.ceilingLightColor = 0;
21487             }
21488             if (_this.wallsAlpha === undefined) {
21489                 _this.wallsAlpha = 0;
21490             }
21491             if (_this.drawingMode === undefined) {
21492                 _this.drawingMode = null;
21493             }
21494             if (_this.subpartSizeUnderLight === undefined) {
21495                 _this.subpartSizeUnderLight = 0;
21496             }
21497             if (_this.allLevelsVisible === undefined) {
21498                 _this.allLevelsVisible = false;
21499             }
21500             if (_this.photoWidth === undefined) {
21501                 _this.photoWidth = 0;
21502             }
21503             if (_this.photoHeight === undefined) {
21504                 _this.photoHeight = 0;
21505             }
21506             if (_this.photoAspectRatio === undefined) {
21507                 _this.photoAspectRatio = null;
21508             }
21509             if (_this.photoAspectRatioName === undefined) {
21510                 _this.photoAspectRatioName = null;
21511             }
21512             if (_this.photoQuality === undefined) {
21513                 _this.photoQuality = 0;
21514             }
21515             if (_this.videoWidth === undefined) {
21516                 _this.videoWidth = 0;
21517             }
21518             if (_this.videoAspectRatio === undefined) {
21519                 _this.videoAspectRatio = null;
21520             }
21521             if (_this.videoAspectRatioName === undefined) {
21522                 _this.videoAspectRatioName = null;
21523             }
21524             if (_this.videoQuality === undefined) {
21525                 _this.videoQuality = 0;
21526             }
21527             if (_this.videoSpeed === undefined) {
21528                 _this.videoSpeed = 0;
21529             }
21530             if (_this.videoFrameRate === undefined) {
21531                 _this.videoFrameRate = 0;
21532             }
21533             if (_this.cameraPath === undefined) {
21534                 _this.cameraPath = null;
21535             }
21536             _this.observerCameraElevationAdjusted = true;
21537             _this.groundColor = groundColor;
21538             _this.groundTexture = groundTexture;
21539             _this.skyColor = skyColor;
21540             _this.skyTexture = skyTexture;
21541             _this.lightColor = lightColor;
21542             _this.ceilingLightColor = 13684944;
21543             _this.wallsAlpha = wallsAlpha;
21544             _this.drawingMode = HomeEnvironment.DrawingMode.FILL;
21545             _this.photoWidth = 400;
21546             _this.photoHeight = 300;
21547             _this.photoAspectRatio = AspectRatio.VIEW_3D_RATIO;
21548             _this.videoWidth = 320;
21549             _this.videoAspectRatio = AspectRatio.RATIO_4_3;
21550             _this.videoSpeed = 2400.0 / 3600;
21551             _this.videoFrameRate = 25;
21552             _this.cameraPath = /* emptyList */ [];
21553         }
21554         else if (((typeof id === 'number') || id === null) && ((groundColor != null && groundColor instanceof HomeTexture) || groundColor === null) && ((typeof groundTexture === 'number') || groundTexture === null) && ((skyColor != null && skyColor instanceof HomeTexture) || skyColor === null) && ((typeof skyTexture === 'number') || skyTexture === null) && ((typeof lightColor === 'number') || lightColor === null) && wallsAlpha === undefined) {
21555             var __args = arguments;
21556             var groundColor_1 = __args[0];
21557             var groundTexture_1 = __args[1];
21558             var skyColor_1 = __args[2];
21559             var skyTexture_1 = __args[3];
21560             var lightColor_1 = __args[4];
21561             var wallsAlpha_1 = __args[5];
21562             {
21563                 var __args_69 = arguments;
21564                 var id_8 = HomeObject.createId("environment");
21565                 _this = _super.call(this, id_8) || this;
21566                 if (_this.observerCameraElevationAdjusted === undefined) {
21567                     _this.observerCameraElevationAdjusted = false;
21568                 }
21569                 if (_this.groundColor === undefined) {
21570                     _this.groundColor = 0;
21571                 }
21572                 if (_this.groundTexture === undefined) {
21573                     _this.groundTexture = null;
21574                 }
21575                 if (_this.backgroundImageVisibleOnGround3D === undefined) {
21576                     _this.backgroundImageVisibleOnGround3D = false;
21577                 }
21578                 if (_this.skyColor === undefined) {
21579                     _this.skyColor = 0;
21580                 }
21581                 if (_this.skyTexture === undefined) {
21582                     _this.skyTexture = null;
21583                 }
21584                 if (_this.lightColor === undefined) {
21585                     _this.lightColor = 0;
21586                 }
21587                 if (_this.ceilingLightColor === undefined) {
21588                     _this.ceilingLightColor = 0;
21589                 }
21590                 if (_this.wallsAlpha === undefined) {
21591                     _this.wallsAlpha = 0;
21592                 }
21593                 if (_this.drawingMode === undefined) {
21594                     _this.drawingMode = null;
21595                 }
21596                 if (_this.subpartSizeUnderLight === undefined) {
21597                     _this.subpartSizeUnderLight = 0;
21598                 }
21599                 if (_this.allLevelsVisible === undefined) {
21600                     _this.allLevelsVisible = false;
21601                 }
21602                 if (_this.photoWidth === undefined) {
21603                     _this.photoWidth = 0;
21604                 }
21605                 if (_this.photoHeight === undefined) {
21606                     _this.photoHeight = 0;
21607                 }
21608                 if (_this.photoAspectRatio === undefined) {
21609                     _this.photoAspectRatio = null;
21610                 }
21611                 if (_this.photoAspectRatioName === undefined) {
21612                     _this.photoAspectRatioName = null;
21613                 }
21614                 if (_this.photoQuality === undefined) {
21615                     _this.photoQuality = 0;
21616                 }
21617                 if (_this.videoWidth === undefined) {
21618                     _this.videoWidth = 0;
21619                 }
21620                 if (_this.videoAspectRatio === undefined) {
21621                     _this.videoAspectRatio = null;
21622                 }
21623                 if (_this.videoAspectRatioName === undefined) {
21624                     _this.videoAspectRatioName = null;
21625                 }
21626                 if (_this.videoQuality === undefined) {
21627                     _this.videoQuality = 0;
21628                 }
21629                 if (_this.videoSpeed === undefined) {
21630                     _this.videoSpeed = 0;
21631                 }
21632                 if (_this.videoFrameRate === undefined) {
21633                     _this.videoFrameRate = 0;
21634                 }
21635                 if (_this.cameraPath === undefined) {
21636                     _this.cameraPath = null;
21637                 }
21638                 _this.observerCameraElevationAdjusted = true;
21639                 _this.groundColor = groundColor_1;
21640                 _this.groundTexture = groundTexture_1;
21641                 _this.skyColor = skyColor_1;
21642                 _this.skyTexture = skyTexture_1;
21643                 _this.lightColor = lightColor_1;
21644                 _this.ceilingLightColor = 13684944;
21645                 _this.wallsAlpha = wallsAlpha_1;
21646                 _this.drawingMode = HomeEnvironment.DrawingMode.FILL;
21647                 _this.photoWidth = 400;
21648                 _this.photoHeight = 300;
21649                 _this.photoAspectRatio = AspectRatio.VIEW_3D_RATIO;
21650                 _this.videoWidth = 320;
21651                 _this.videoAspectRatio = AspectRatio.RATIO_4_3;
21652                 _this.videoSpeed = 2400.0 / 3600;
21653                 _this.videoFrameRate = 25;
21654                 _this.cameraPath = /* emptyList */ [];
21655             }
21656             if (_this.observerCameraElevationAdjusted === undefined) {
21657                 _this.observerCameraElevationAdjusted = false;
21658             }
21659             if (_this.groundColor === undefined) {
21660                 _this.groundColor = 0;
21661             }
21662             if (_this.groundTexture === undefined) {
21663                 _this.groundTexture = null;
21664             }
21665             if (_this.backgroundImageVisibleOnGround3D === undefined) {
21666                 _this.backgroundImageVisibleOnGround3D = false;
21667             }
21668             if (_this.skyColor === undefined) {
21669                 _this.skyColor = 0;
21670             }
21671             if (_this.skyTexture === undefined) {
21672                 _this.skyTexture = null;
21673             }
21674             if (_this.lightColor === undefined) {
21675                 _this.lightColor = 0;
21676             }
21677             if (_this.ceilingLightColor === undefined) {
21678                 _this.ceilingLightColor = 0;
21679             }
21680             if (_this.wallsAlpha === undefined) {
21681                 _this.wallsAlpha = 0;
21682             }
21683             if (_this.drawingMode === undefined) {
21684                 _this.drawingMode = null;
21685             }
21686             if (_this.subpartSizeUnderLight === undefined) {
21687                 _this.subpartSizeUnderLight = 0;
21688             }
21689             if (_this.allLevelsVisible === undefined) {
21690                 _this.allLevelsVisible = false;
21691             }
21692             if (_this.photoWidth === undefined) {
21693                 _this.photoWidth = 0;
21694             }
21695             if (_this.photoHeight === undefined) {
21696                 _this.photoHeight = 0;
21697             }
21698             if (_this.photoAspectRatio === undefined) {
21699                 _this.photoAspectRatio = null;
21700             }
21701             if (_this.photoAspectRatioName === undefined) {
21702                 _this.photoAspectRatioName = null;
21703             }
21704             if (_this.photoQuality === undefined) {
21705                 _this.photoQuality = 0;
21706             }
21707             if (_this.videoWidth === undefined) {
21708                 _this.videoWidth = 0;
21709             }
21710             if (_this.videoAspectRatio === undefined) {
21711                 _this.videoAspectRatio = null;
21712             }
21713             if (_this.videoAspectRatioName === undefined) {
21714                 _this.videoAspectRatioName = null;
21715             }
21716             if (_this.videoQuality === undefined) {
21717                 _this.videoQuality = 0;
21718             }
21719             if (_this.videoSpeed === undefined) {
21720                 _this.videoSpeed = 0;
21721             }
21722             if (_this.videoFrameRate === undefined) {
21723                 _this.videoFrameRate = 0;
21724             }
21725             if (_this.cameraPath === undefined) {
21726                 _this.cameraPath = null;
21727             }
21728         }
21729         else if (((typeof id === 'number') || id === null) && ((groundColor != null && groundColor instanceof HomeTexture) || groundColor === null) && ((typeof groundTexture === 'number') || groundTexture === null) && ((typeof skyColor === 'number') || skyColor === null) && ((typeof skyTexture === 'number') || skyTexture === null) && lightColor === undefined && wallsAlpha === undefined) {
21730             var __args = arguments;
21731             var groundColor_2 = __args[0];
21732             var groundTexture_2 = __args[1];
21733             var skyColor_2 = __args[2];
21734             var lightColor_2 = __args[3];
21735             var wallsAlpha_2 = __args[4];
21736             {
21737                 var __args_70 = arguments;
21738                 var skyTexture_2 = null;
21739                 {
21740                     var __args_71 = arguments;
21741                     var id_9 = HomeObject.createId("environment");
21742                     _this = _super.call(this, id_9) || this;
21743                     if (_this.observerCameraElevationAdjusted === undefined) {
21744                         _this.observerCameraElevationAdjusted = false;
21745                     }
21746                     if (_this.groundColor === undefined) {
21747                         _this.groundColor = 0;
21748                     }
21749                     if (_this.groundTexture === undefined) {
21750                         _this.groundTexture = null;
21751                     }
21752                     if (_this.backgroundImageVisibleOnGround3D === undefined) {
21753                         _this.backgroundImageVisibleOnGround3D = false;
21754                     }
21755                     if (_this.skyColor === undefined) {
21756                         _this.skyColor = 0;
21757                     }
21758                     if (_this.skyTexture === undefined) {
21759                         _this.skyTexture = null;
21760                     }
21761                     if (_this.lightColor === undefined) {
21762                         _this.lightColor = 0;
21763                     }
21764                     if (_this.ceilingLightColor === undefined) {
21765                         _this.ceilingLightColor = 0;
21766                     }
21767                     if (_this.wallsAlpha === undefined) {
21768                         _this.wallsAlpha = 0;
21769                     }
21770                     if (_this.drawingMode === undefined) {
21771                         _this.drawingMode = null;
21772                     }
21773                     if (_this.subpartSizeUnderLight === undefined) {
21774                         _this.subpartSizeUnderLight = 0;
21775                     }
21776                     if (_this.allLevelsVisible === undefined) {
21777                         _this.allLevelsVisible = false;
21778                     }
21779                     if (_this.photoWidth === undefined) {
21780                         _this.photoWidth = 0;
21781                     }
21782                     if (_this.photoHeight === undefined) {
21783                         _this.photoHeight = 0;
21784                     }
21785                     if (_this.photoAspectRatio === undefined) {
21786                         _this.photoAspectRatio = null;
21787                     }
21788                     if (_this.photoAspectRatioName === undefined) {
21789                         _this.photoAspectRatioName = null;
21790                     }
21791                     if (_this.photoQuality === undefined) {
21792                         _this.photoQuality = 0;
21793                     }
21794                     if (_this.videoWidth === undefined) {
21795                         _this.videoWidth = 0;
21796                     }
21797                     if (_this.videoAspectRatio === undefined) {
21798                         _this.videoAspectRatio = null;
21799                     }
21800                     if (_this.videoAspectRatioName === undefined) {
21801                         _this.videoAspectRatioName = null;
21802                     }
21803                     if (_this.videoQuality === undefined) {
21804                         _this.videoQuality = 0;
21805                     }
21806                     if (_this.videoSpeed === undefined) {
21807                         _this.videoSpeed = 0;
21808                     }
21809                     if (_this.videoFrameRate === undefined) {
21810                         _this.videoFrameRate = 0;
21811                     }
21812                     if (_this.cameraPath === undefined) {
21813                         _this.cameraPath = null;
21814                     }
21815                     _this.observerCameraElevationAdjusted = true;
21816                     _this.groundColor = groundColor_2;
21817                     _this.groundTexture = groundTexture_2;
21818                     _this.skyColor = skyColor_2;
21819                     _this.skyTexture = skyTexture_2;
21820                     _this.lightColor = lightColor_2;
21821                     _this.ceilingLightColor = 13684944;
21822                     _this.wallsAlpha = wallsAlpha_2;
21823                     _this.drawingMode = HomeEnvironment.DrawingMode.FILL;
21824                     _this.photoWidth = 400;
21825                     _this.photoHeight = 300;
21826                     _this.photoAspectRatio = AspectRatio.VIEW_3D_RATIO;
21827                     _this.videoWidth = 320;
21828                     _this.videoAspectRatio = AspectRatio.RATIO_4_3;
21829                     _this.videoSpeed = 2400.0 / 3600;
21830                     _this.videoFrameRate = 25;
21831                     _this.cameraPath = /* emptyList */ [];
21832                 }
21833                 if (_this.observerCameraElevationAdjusted === undefined) {
21834                     _this.observerCameraElevationAdjusted = false;
21835                 }
21836                 if (_this.groundColor === undefined) {
21837                     _this.groundColor = 0;
21838                 }
21839                 if (_this.groundTexture === undefined) {
21840                     _this.groundTexture = null;
21841                 }
21842                 if (_this.backgroundImageVisibleOnGround3D === undefined) {
21843                     _this.backgroundImageVisibleOnGround3D = false;
21844                 }
21845                 if (_this.skyColor === undefined) {
21846                     _this.skyColor = 0;
21847                 }
21848                 if (_this.skyTexture === undefined) {
21849                     _this.skyTexture = null;
21850                 }
21851                 if (_this.lightColor === undefined) {
21852                     _this.lightColor = 0;
21853                 }
21854                 if (_this.ceilingLightColor === undefined) {
21855                     _this.ceilingLightColor = 0;
21856                 }
21857                 if (_this.wallsAlpha === undefined) {
21858                     _this.wallsAlpha = 0;
21859                 }
21860                 if (_this.drawingMode === undefined) {
21861                     _this.drawingMode = null;
21862                 }
21863                 if (_this.subpartSizeUnderLight === undefined) {
21864                     _this.subpartSizeUnderLight = 0;
21865                 }
21866                 if (_this.allLevelsVisible === undefined) {
21867                     _this.allLevelsVisible = false;
21868                 }
21869                 if (_this.photoWidth === undefined) {
21870                     _this.photoWidth = 0;
21871                 }
21872                 if (_this.photoHeight === undefined) {
21873                     _this.photoHeight = 0;
21874                 }
21875                 if (_this.photoAspectRatio === undefined) {
21876                     _this.photoAspectRatio = null;
21877                 }
21878                 if (_this.photoAspectRatioName === undefined) {
21879                     _this.photoAspectRatioName = null;
21880                 }
21881                 if (_this.photoQuality === undefined) {
21882                     _this.photoQuality = 0;
21883                 }
21884                 if (_this.videoWidth === undefined) {
21885                     _this.videoWidth = 0;
21886                 }
21887                 if (_this.videoAspectRatio === undefined) {
21888                     _this.videoAspectRatio = null;
21889                 }
21890                 if (_this.videoAspectRatioName === undefined) {
21891                     _this.videoAspectRatioName = null;
21892                 }
21893                 if (_this.videoQuality === undefined) {
21894                     _this.videoQuality = 0;
21895                 }
21896                 if (_this.videoSpeed === undefined) {
21897                     _this.videoSpeed = 0;
21898                 }
21899                 if (_this.videoFrameRate === undefined) {
21900                     _this.videoFrameRate = 0;
21901                 }
21902                 if (_this.cameraPath === undefined) {
21903                     _this.cameraPath = null;
21904                 }
21905             }
21906             if (_this.observerCameraElevationAdjusted === undefined) {
21907                 _this.observerCameraElevationAdjusted = false;
21908             }
21909             if (_this.groundColor === undefined) {
21910                 _this.groundColor = 0;
21911             }
21912             if (_this.groundTexture === undefined) {
21913                 _this.groundTexture = null;
21914             }
21915             if (_this.backgroundImageVisibleOnGround3D === undefined) {
21916                 _this.backgroundImageVisibleOnGround3D = false;
21917             }
21918             if (_this.skyColor === undefined) {
21919                 _this.skyColor = 0;
21920             }
21921             if (_this.skyTexture === undefined) {
21922                 _this.skyTexture = null;
21923             }
21924             if (_this.lightColor === undefined) {
21925                 _this.lightColor = 0;
21926             }
21927             if (_this.ceilingLightColor === undefined) {
21928                 _this.ceilingLightColor = 0;
21929             }
21930             if (_this.wallsAlpha === undefined) {
21931                 _this.wallsAlpha = 0;
21932             }
21933             if (_this.drawingMode === undefined) {
21934                 _this.drawingMode = null;
21935             }
21936             if (_this.subpartSizeUnderLight === undefined) {
21937                 _this.subpartSizeUnderLight = 0;
21938             }
21939             if (_this.allLevelsVisible === undefined) {
21940                 _this.allLevelsVisible = false;
21941             }
21942             if (_this.photoWidth === undefined) {
21943                 _this.photoWidth = 0;
21944             }
21945             if (_this.photoHeight === undefined) {
21946                 _this.photoHeight = 0;
21947             }
21948             if (_this.photoAspectRatio === undefined) {
21949                 _this.photoAspectRatio = null;
21950             }
21951             if (_this.photoAspectRatioName === undefined) {
21952                 _this.photoAspectRatioName = null;
21953             }
21954             if (_this.photoQuality === undefined) {
21955                 _this.photoQuality = 0;
21956             }
21957             if (_this.videoWidth === undefined) {
21958                 _this.videoWidth = 0;
21959             }
21960             if (_this.videoAspectRatio === undefined) {
21961                 _this.videoAspectRatio = null;
21962             }
21963             if (_this.videoAspectRatioName === undefined) {
21964                 _this.videoAspectRatioName = null;
21965             }
21966             if (_this.videoQuality === undefined) {
21967                 _this.videoQuality = 0;
21968             }
21969             if (_this.videoSpeed === undefined) {
21970                 _this.videoSpeed = 0;
21971             }
21972             if (_this.videoFrameRate === undefined) {
21973                 _this.videoFrameRate = 0;
21974             }
21975             if (_this.cameraPath === undefined) {
21976                 _this.cameraPath = null;
21977             }
21978         }
21979         else if (((typeof id === 'string') || id === null) && groundColor === undefined && groundTexture === undefined && skyColor === undefined && skyTexture === undefined && lightColor === undefined && wallsAlpha === undefined) {
21980             var __args = arguments;
21981             {
21982                 var __args_72 = arguments;
21983                 var groundColor_3 = 11053224;
21984                 var groundTexture_3 = null;
21985                 var skyColor_3 = 13427964;
21986                 var skyTexture_3 = null;
21987                 var lightColor_3 = 13684944;
21988                 var wallsAlpha_3 = 0;
21989                 _this = _super.call(this, id) || this;
21990                 if (_this.observerCameraElevationAdjusted === undefined) {
21991                     _this.observerCameraElevationAdjusted = false;
21992                 }
21993                 if (_this.groundColor === undefined) {
21994                     _this.groundColor = 0;
21995                 }
21996                 if (_this.groundTexture === undefined) {
21997                     _this.groundTexture = null;
21998                 }
21999                 if (_this.backgroundImageVisibleOnGround3D === undefined) {
22000                     _this.backgroundImageVisibleOnGround3D = false;
22001                 }
22002                 if (_this.skyColor === undefined) {
22003                     _this.skyColor = 0;
22004                 }
22005                 if (_this.skyTexture === undefined) {
22006                     _this.skyTexture = null;
22007                 }
22008                 if (_this.lightColor === undefined) {
22009                     _this.lightColor = 0;
22010                 }
22011                 if (_this.ceilingLightColor === undefined) {
22012                     _this.ceilingLightColor = 0;
22013                 }
22014                 if (_this.wallsAlpha === undefined) {
22015                     _this.wallsAlpha = 0;
22016                 }
22017                 if (_this.drawingMode === undefined) {
22018                     _this.drawingMode = null;
22019                 }
22020                 if (_this.subpartSizeUnderLight === undefined) {
22021                     _this.subpartSizeUnderLight = 0;
22022                 }
22023                 if (_this.allLevelsVisible === undefined) {
22024                     _this.allLevelsVisible = false;
22025                 }
22026                 if (_this.photoWidth === undefined) {
22027                     _this.photoWidth = 0;
22028                 }
22029                 if (_this.photoHeight === undefined) {
22030                     _this.photoHeight = 0;
22031                 }
22032                 if (_this.photoAspectRatio === undefined) {
22033                     _this.photoAspectRatio = null;
22034                 }
22035                 if (_this.photoAspectRatioName === undefined) {
22036                     _this.photoAspectRatioName = null;
22037                 }
22038                 if (_this.photoQuality === undefined) {
22039                     _this.photoQuality = 0;
22040                 }
22041                 if (_this.videoWidth === undefined) {
22042                     _this.videoWidth = 0;
22043                 }
22044                 if (_this.videoAspectRatio === undefined) {
22045                     _this.videoAspectRatio = null;
22046                 }
22047                 if (_this.videoAspectRatioName === undefined) {
22048                     _this.videoAspectRatioName = null;
22049                 }
22050                 if (_this.videoQuality === undefined) {
22051                     _this.videoQuality = 0;
22052                 }
22053                 if (_this.videoSpeed === undefined) {
22054                     _this.videoSpeed = 0;
22055                 }
22056                 if (_this.videoFrameRate === undefined) {
22057                     _this.videoFrameRate = 0;
22058                 }
22059                 if (_this.cameraPath === undefined) {
22060                     _this.cameraPath = null;
22061                 }
22062                 _this.observerCameraElevationAdjusted = true;
22063                 _this.groundColor = groundColor_3;
22064                 _this.groundTexture = groundTexture_3;
22065                 _this.skyColor = skyColor_3;
22066                 _this.skyTexture = skyTexture_3;
22067                 _this.lightColor = lightColor_3;
22068                 _this.ceilingLightColor = 13684944;
22069                 _this.wallsAlpha = wallsAlpha_3;
22070                 _this.drawingMode = HomeEnvironment.DrawingMode.FILL;
22071                 _this.photoWidth = 400;
22072                 _this.photoHeight = 300;
22073                 _this.photoAspectRatio = AspectRatio.VIEW_3D_RATIO;
22074                 _this.videoWidth = 320;
22075                 _this.videoAspectRatio = AspectRatio.RATIO_4_3;
22076                 _this.videoSpeed = 2400.0 / 3600;
22077                 _this.videoFrameRate = 25;
22078                 _this.cameraPath = /* emptyList */ [];
22079             }
22080             if (_this.observerCameraElevationAdjusted === undefined) {
22081                 _this.observerCameraElevationAdjusted = false;
22082             }
22083             if (_this.groundColor === undefined) {
22084                 _this.groundColor = 0;
22085             }
22086             if (_this.groundTexture === undefined) {
22087                 _this.groundTexture = null;
22088             }
22089             if (_this.backgroundImageVisibleOnGround3D === undefined) {
22090                 _this.backgroundImageVisibleOnGround3D = false;
22091             }
22092             if (_this.skyColor === undefined) {
22093                 _this.skyColor = 0;
22094             }
22095             if (_this.skyTexture === undefined) {
22096                 _this.skyTexture = null;
22097             }
22098             if (_this.lightColor === undefined) {
22099                 _this.lightColor = 0;
22100             }
22101             if (_this.ceilingLightColor === undefined) {
22102                 _this.ceilingLightColor = 0;
22103             }
22104             if (_this.wallsAlpha === undefined) {
22105                 _this.wallsAlpha = 0;
22106             }
22107             if (_this.drawingMode === undefined) {
22108                 _this.drawingMode = null;
22109             }
22110             if (_this.subpartSizeUnderLight === undefined) {
22111                 _this.subpartSizeUnderLight = 0;
22112             }
22113             if (_this.allLevelsVisible === undefined) {
22114                 _this.allLevelsVisible = false;
22115             }
22116             if (_this.photoWidth === undefined) {
22117                 _this.photoWidth = 0;
22118             }
22119             if (_this.photoHeight === undefined) {
22120                 _this.photoHeight = 0;
22121             }
22122             if (_this.photoAspectRatio === undefined) {
22123                 _this.photoAspectRatio = null;
22124             }
22125             if (_this.photoAspectRatioName === undefined) {
22126                 _this.photoAspectRatioName = null;
22127             }
22128             if (_this.photoQuality === undefined) {
22129                 _this.photoQuality = 0;
22130             }
22131             if (_this.videoWidth === undefined) {
22132                 _this.videoWidth = 0;
22133             }
22134             if (_this.videoAspectRatio === undefined) {
22135                 _this.videoAspectRatio = null;
22136             }
22137             if (_this.videoAspectRatioName === undefined) {
22138                 _this.videoAspectRatioName = null;
22139             }
22140             if (_this.videoQuality === undefined) {
22141                 _this.videoQuality = 0;
22142             }
22143             if (_this.videoSpeed === undefined) {
22144                 _this.videoSpeed = 0;
22145             }
22146             if (_this.videoFrameRate === undefined) {
22147                 _this.videoFrameRate = 0;
22148             }
22149             if (_this.cameraPath === undefined) {
22150                 _this.cameraPath = null;
22151             }
22152         }
22153         else if (id === undefined && groundColor === undefined && groundTexture === undefined && skyColor === undefined && skyTexture === undefined && lightColor === undefined && wallsAlpha === undefined) {
22154             var __args = arguments;
22155             {
22156                 var __args_73 = arguments;
22157                 var id_10 = HomeObject.createId("environment");
22158                 {
22159                     var __args_74 = arguments;
22160                     var groundColor_4 = 11053224;
22161                     var groundTexture_4 = null;
22162                     var skyColor_4 = 13427964;
22163                     var skyTexture_4 = null;
22164                     var lightColor_4 = 13684944;
22165                     var wallsAlpha_4 = 0;
22166                     _this = _super.call(this, id_10) || this;
22167                     if (_this.observerCameraElevationAdjusted === undefined) {
22168                         _this.observerCameraElevationAdjusted = false;
22169                     }
22170                     if (_this.groundColor === undefined) {
22171                         _this.groundColor = 0;
22172                     }
22173                     if (_this.groundTexture === undefined) {
22174                         _this.groundTexture = null;
22175                     }
22176                     if (_this.backgroundImageVisibleOnGround3D === undefined) {
22177                         _this.backgroundImageVisibleOnGround3D = false;
22178                     }
22179                     if (_this.skyColor === undefined) {
22180                         _this.skyColor = 0;
22181                     }
22182                     if (_this.skyTexture === undefined) {
22183                         _this.skyTexture = null;
22184                     }
22185                     if (_this.lightColor === undefined) {
22186                         _this.lightColor = 0;
22187                     }
22188                     if (_this.ceilingLightColor === undefined) {
22189                         _this.ceilingLightColor = 0;
22190                     }
22191                     if (_this.wallsAlpha === undefined) {
22192                         _this.wallsAlpha = 0;
22193                     }
22194                     if (_this.drawingMode === undefined) {
22195                         _this.drawingMode = null;
22196                     }
22197                     if (_this.subpartSizeUnderLight === undefined) {
22198                         _this.subpartSizeUnderLight = 0;
22199                     }
22200                     if (_this.allLevelsVisible === undefined) {
22201                         _this.allLevelsVisible = false;
22202                     }
22203                     if (_this.photoWidth === undefined) {
22204                         _this.photoWidth = 0;
22205                     }
22206                     if (_this.photoHeight === undefined) {
22207                         _this.photoHeight = 0;
22208                     }
22209                     if (_this.photoAspectRatio === undefined) {
22210                         _this.photoAspectRatio = null;
22211                     }
22212                     if (_this.photoAspectRatioName === undefined) {
22213                         _this.photoAspectRatioName = null;
22214                     }
22215                     if (_this.photoQuality === undefined) {
22216                         _this.photoQuality = 0;
22217                     }
22218                     if (_this.videoWidth === undefined) {
22219                         _this.videoWidth = 0;
22220                     }
22221                     if (_this.videoAspectRatio === undefined) {
22222                         _this.videoAspectRatio = null;
22223                     }
22224                     if (_this.videoAspectRatioName === undefined) {
22225                         _this.videoAspectRatioName = null;
22226                     }
22227                     if (_this.videoQuality === undefined) {
22228                         _this.videoQuality = 0;
22229                     }
22230                     if (_this.videoSpeed === undefined) {
22231                         _this.videoSpeed = 0;
22232                     }
22233                     if (_this.videoFrameRate === undefined) {
22234                         _this.videoFrameRate = 0;
22235                     }
22236                     if (_this.cameraPath === undefined) {
22237                         _this.cameraPath = null;
22238                     }
22239                     _this.observerCameraElevationAdjusted = true;
22240                     _this.groundColor = groundColor_4;
22241                     _this.groundTexture = groundTexture_4;
22242                     _this.skyColor = skyColor_4;
22243                     _this.skyTexture = skyTexture_4;
22244                     _this.lightColor = lightColor_4;
22245                     _this.ceilingLightColor = 13684944;
22246                     _this.wallsAlpha = wallsAlpha_4;
22247                     _this.drawingMode = HomeEnvironment.DrawingMode.FILL;
22248                     _this.photoWidth = 400;
22249                     _this.photoHeight = 300;
22250                     _this.photoAspectRatio = AspectRatio.VIEW_3D_RATIO;
22251                     _this.videoWidth = 320;
22252                     _this.videoAspectRatio = AspectRatio.RATIO_4_3;
22253                     _this.videoSpeed = 2400.0 / 3600;
22254                     _this.videoFrameRate = 25;
22255                     _this.cameraPath = /* emptyList */ [];
22256                 }
22257                 if (_this.observerCameraElevationAdjusted === undefined) {
22258                     _this.observerCameraElevationAdjusted = false;
22259                 }
22260                 if (_this.groundColor === undefined) {
22261                     _this.groundColor = 0;
22262                 }
22263                 if (_this.groundTexture === undefined) {
22264                     _this.groundTexture = null;
22265                 }
22266                 if (_this.backgroundImageVisibleOnGround3D === undefined) {
22267                     _this.backgroundImageVisibleOnGround3D = false;
22268                 }
22269                 if (_this.skyColor === undefined) {
22270                     _this.skyColor = 0;
22271                 }
22272                 if (_this.skyTexture === undefined) {
22273                     _this.skyTexture = null;
22274                 }
22275                 if (_this.lightColor === undefined) {
22276                     _this.lightColor = 0;
22277                 }
22278                 if (_this.ceilingLightColor === undefined) {
22279                     _this.ceilingLightColor = 0;
22280                 }
22281                 if (_this.wallsAlpha === undefined) {
22282                     _this.wallsAlpha = 0;
22283                 }
22284                 if (_this.drawingMode === undefined) {
22285                     _this.drawingMode = null;
22286                 }
22287                 if (_this.subpartSizeUnderLight === undefined) {
22288                     _this.subpartSizeUnderLight = 0;
22289                 }
22290                 if (_this.allLevelsVisible === undefined) {
22291                     _this.allLevelsVisible = false;
22292                 }
22293                 if (_this.photoWidth === undefined) {
22294                     _this.photoWidth = 0;
22295                 }
22296                 if (_this.photoHeight === undefined) {
22297                     _this.photoHeight = 0;
22298                 }
22299                 if (_this.photoAspectRatio === undefined) {
22300                     _this.photoAspectRatio = null;
22301                 }
22302                 if (_this.photoAspectRatioName === undefined) {
22303                     _this.photoAspectRatioName = null;
22304                 }
22305                 if (_this.photoQuality === undefined) {
22306                     _this.photoQuality = 0;
22307                 }
22308                 if (_this.videoWidth === undefined) {
22309                     _this.videoWidth = 0;
22310                 }
22311                 if (_this.videoAspectRatio === undefined) {
22312                     _this.videoAspectRatio = null;
22313                 }
22314                 if (_this.videoAspectRatioName === undefined) {
22315                     _this.videoAspectRatioName = null;
22316                 }
22317                 if (_this.videoQuality === undefined) {
22318                     _this.videoQuality = 0;
22319                 }
22320                 if (_this.videoSpeed === undefined) {
22321                     _this.videoSpeed = 0;
22322                 }
22323                 if (_this.videoFrameRate === undefined) {
22324                     _this.videoFrameRate = 0;
22325                 }
22326                 if (_this.cameraPath === undefined) {
22327                     _this.cameraPath = null;
22328                 }
22329             }
22330             if (_this.observerCameraElevationAdjusted === undefined) {
22331                 _this.observerCameraElevationAdjusted = false;
22332             }
22333             if (_this.groundColor === undefined) {
22334                 _this.groundColor = 0;
22335             }
22336             if (_this.groundTexture === undefined) {
22337                 _this.groundTexture = null;
22338             }
22339             if (_this.backgroundImageVisibleOnGround3D === undefined) {
22340                 _this.backgroundImageVisibleOnGround3D = false;
22341             }
22342             if (_this.skyColor === undefined) {
22343                 _this.skyColor = 0;
22344             }
22345             if (_this.skyTexture === undefined) {
22346                 _this.skyTexture = null;
22347             }
22348             if (_this.lightColor === undefined) {
22349                 _this.lightColor = 0;
22350             }
22351             if (_this.ceilingLightColor === undefined) {
22352                 _this.ceilingLightColor = 0;
22353             }
22354             if (_this.wallsAlpha === undefined) {
22355                 _this.wallsAlpha = 0;
22356             }
22357             if (_this.drawingMode === undefined) {
22358                 _this.drawingMode = null;
22359             }
22360             if (_this.subpartSizeUnderLight === undefined) {
22361                 _this.subpartSizeUnderLight = 0;
22362             }
22363             if (_this.allLevelsVisible === undefined) {
22364                 _this.allLevelsVisible = false;
22365             }
22366             if (_this.photoWidth === undefined) {
22367                 _this.photoWidth = 0;
22368             }
22369             if (_this.photoHeight === undefined) {
22370                 _this.photoHeight = 0;
22371             }
22372             if (_this.photoAspectRatio === undefined) {
22373                 _this.photoAspectRatio = null;
22374             }
22375             if (_this.photoAspectRatioName === undefined) {
22376                 _this.photoAspectRatioName = null;
22377             }
22378             if (_this.photoQuality === undefined) {
22379                 _this.photoQuality = 0;
22380             }
22381             if (_this.videoWidth === undefined) {
22382                 _this.videoWidth = 0;
22383             }
22384             if (_this.videoAspectRatio === undefined) {
22385                 _this.videoAspectRatio = null;
22386             }
22387             if (_this.videoAspectRatioName === undefined) {
22388                 _this.videoAspectRatioName = null;
22389             }
22390             if (_this.videoQuality === undefined) {
22391                 _this.videoQuality = 0;
22392             }
22393             if (_this.videoSpeed === undefined) {
22394                 _this.videoSpeed = 0;
22395             }
22396             if (_this.videoFrameRate === undefined) {
22397                 _this.videoFrameRate = 0;
22398             }
22399             if (_this.cameraPath === undefined) {
22400                 _this.cameraPath = null;
22401             }
22402         }
22403         else
22404             throw new Error('invalid overload');
22405         return _this;
22406     }
22407     /**
22408      * Returns <code>true</code> if the observer elevation should be adjusted according
22409      * to the elevation of the selected level.
22410      * @return {boolean}
22411      */
22412     HomeEnvironment.prototype.isObserverCameraElevationAdjusted = function () {
22413         return this.observerCameraElevationAdjusted;
22414     };
22415     /**
22416      * Sets whether the observer elevation should be adjusted according
22417      * to the elevation of the selected level and fires a <code>PropertyChangeEvent</code>.
22418      * @param {boolean} observerCameraElevationAdjusted
22419      */
22420     HomeEnvironment.prototype.setObserverCameraElevationAdjusted = function (observerCameraElevationAdjusted) {
22421         if (this.observerCameraElevationAdjusted !== observerCameraElevationAdjusted) {
22422             this.observerCameraElevationAdjusted = observerCameraElevationAdjusted;
22423             this.firePropertyChange(/* name */ "OBSERVER_CAMERA_ELEVATION_ADJUSTED", !observerCameraElevationAdjusted, observerCameraElevationAdjusted);
22424         }
22425     };
22426     /**
22427      * Returns the ground color of this environment.
22428      * @return {number}
22429      */
22430     HomeEnvironment.prototype.getGroundColor = function () {
22431         return this.groundColor;
22432     };
22433     /**
22434      * Sets the ground color of this environment and fires a <code>PropertyChangeEvent</code>.
22435      * @param {number} groundColor
22436      */
22437     HomeEnvironment.prototype.setGroundColor = function (groundColor) {
22438         if (groundColor !== this.groundColor) {
22439             var oldGroundColor = this.groundColor;
22440             this.groundColor = groundColor;
22441             this.firePropertyChange(/* name */ "GROUND_COLOR", oldGroundColor, groundColor);
22442         }
22443     };
22444     /**
22445      * Returns the ground texture of this environment.
22446      * @return {HomeTexture}
22447      */
22448     HomeEnvironment.prototype.getGroundTexture = function () {
22449         return this.groundTexture;
22450     };
22451     /**
22452      * Sets the ground texture of this environment and fires a <code>PropertyChangeEvent</code>.
22453      * @param {HomeTexture} groundTexture
22454      */
22455     HomeEnvironment.prototype.setGroundTexture = function (groundTexture) {
22456         if (groundTexture !== this.groundTexture) {
22457             var oldGroundTexture = this.groundTexture;
22458             this.groundTexture = groundTexture;
22459             this.firePropertyChange(/* name */ "GROUND_TEXTURE", oldGroundTexture, groundTexture);
22460         }
22461     };
22462     /**
22463      * Returns <code>true</code> if the background image should be displayed on the ground in 3D.
22464      * @return {boolean}
22465      */
22466     HomeEnvironment.prototype.isBackgroundImageVisibleOnGround3D = function () {
22467         return this.backgroundImageVisibleOnGround3D;
22468     };
22469     /**
22470      * Sets whether the background image should be displayed on the ground in 3D and
22471      * fires a <code>PropertyChangeEvent</code>.
22472      * @param {boolean} backgroundImageVisibleOnGround3D
22473      */
22474     HomeEnvironment.prototype.setBackgroundImageVisibleOnGround3D = function (backgroundImageVisibleOnGround3D) {
22475         if (this.backgroundImageVisibleOnGround3D !== backgroundImageVisibleOnGround3D) {
22476             this.backgroundImageVisibleOnGround3D = backgroundImageVisibleOnGround3D;
22477             this.firePropertyChange(/* name */ "BACKGROUND_IMAGE_VISIBLE_ON_GROUND_3D", !backgroundImageVisibleOnGround3D, backgroundImageVisibleOnGround3D);
22478         }
22479     };
22480     /**
22481      * Returns the sky color of this environment.
22482      * @return {number}
22483      */
22484     HomeEnvironment.prototype.getSkyColor = function () {
22485         return this.skyColor;
22486     };
22487     /**
22488      * Sets the sky color of this environment and fires a <code>PropertyChangeEvent</code>.
22489      * @param {number} skyColor
22490      */
22491     HomeEnvironment.prototype.setSkyColor = function (skyColor) {
22492         if (skyColor !== this.skyColor) {
22493             var oldSkyColor = this.skyColor;
22494             this.skyColor = skyColor;
22495             this.firePropertyChange(/* name */ "SKY_COLOR", oldSkyColor, skyColor);
22496         }
22497     };
22498     /**
22499      * Returns the sky texture of this environment.
22500      * @return {HomeTexture}
22501      */
22502     HomeEnvironment.prototype.getSkyTexture = function () {
22503         return this.skyTexture;
22504     };
22505     /**
22506      * Sets the sky texture of this environment and fires a <code>PropertyChangeEvent</code>.
22507      * @param {HomeTexture} skyTexture
22508      */
22509     HomeEnvironment.prototype.setSkyTexture = function (skyTexture) {
22510         if (skyTexture !== this.skyTexture) {
22511             var oldSkyTexture = this.skyTexture;
22512             this.skyTexture = skyTexture;
22513             this.firePropertyChange(/* name */ "SKY_TEXTURE", oldSkyTexture, skyTexture);
22514         }
22515     };
22516     /**
22517      * Returns the light color of this environment.
22518      * @return {number}
22519      */
22520     HomeEnvironment.prototype.getLightColor = function () {
22521         return this.lightColor;
22522     };
22523     /**
22524      * Sets the color that lights this environment and fires a <code>PropertyChangeEvent</code>.
22525      * @param {number} lightColor
22526      */
22527     HomeEnvironment.prototype.setLightColor = function (lightColor) {
22528         if (lightColor !== this.lightColor) {
22529             var oldLightColor = this.lightColor;
22530             this.lightColor = lightColor;
22531             this.firePropertyChange(/* name */ "LIGHT_COLOR", oldLightColor, lightColor);
22532         }
22533     };
22534     /**
22535      * Returns the color of ceiling lights.
22536      * @return {number}
22537      */
22538     HomeEnvironment.prototype.getCeillingLightColor = function () {
22539         return this.ceilingLightColor;
22540     };
22541     /**
22542      * Sets the color of ceiling lights and fires a <code>PropertyChangeEvent</code>.
22543      * @param {number} ceilingLightColor
22544      */
22545     HomeEnvironment.prototype.setCeillingLightColor = function (ceilingLightColor) {
22546         if (ceilingLightColor !== this.ceilingLightColor) {
22547             var oldCeilingLightColor = this.ceilingLightColor;
22548             this.ceilingLightColor = ceilingLightColor;
22549             this.firePropertyChange(/* name */ "CEILING_LIGHT_COLOR", oldCeilingLightColor, ceilingLightColor);
22550         }
22551     };
22552     /**
22553      * Returns the walls transparency alpha factor of this environment.
22554      * @return {number}
22555      */
22556     HomeEnvironment.prototype.getWallsAlpha = function () {
22557         return this.wallsAlpha;
22558     };
22559     /**
22560      * Sets the walls transparency alpha of this environment and fires a <code>PropertyChangeEvent</code>.
22561      * @param {number} wallsAlpha a value between 0 and 1, 0 meaning opaque and 1 invisible.
22562      */
22563     HomeEnvironment.prototype.setWallsAlpha = function (wallsAlpha) {
22564         if (wallsAlpha !== this.wallsAlpha) {
22565             var oldWallsAlpha = this.wallsAlpha;
22566             this.wallsAlpha = wallsAlpha;
22567             this.firePropertyChange(/* name */ "WALLS_ALPHA", oldWallsAlpha, wallsAlpha);
22568         }
22569     };
22570     /**
22571      * Returns the drawing mode of this environment.
22572      * @return {HomeEnvironment.DrawingMode}
22573      */
22574     HomeEnvironment.prototype.getDrawingMode = function () {
22575         return this.drawingMode;
22576     };
22577     /**
22578      * Sets the drawing mode of this environment and fires a <code>PropertyChangeEvent</code>.
22579      * @param {HomeEnvironment.DrawingMode} drawingMode
22580      */
22581     HomeEnvironment.prototype.setDrawingMode = function (drawingMode) {
22582         if (drawingMode !== this.drawingMode) {
22583             var oldDrawingMode = this.drawingMode;
22584             this.drawingMode = drawingMode;
22585             this.firePropertyChange(/* name */ "DRAWING_MODE", oldDrawingMode, drawingMode);
22586         }
22587     };
22588     /**
22589      * Returns the size of subparts under home lights in this environment.
22590      * @return {number} a size in centimeters or 0 if home lights don't illuminate home.
22591      */
22592     HomeEnvironment.prototype.getSubpartSizeUnderLight = function () {
22593         return this.subpartSizeUnderLight;
22594     };
22595     /**
22596      * Sets the size of subparts under home lights of this environment and fires a <code>PropertyChangeEvent</code>.
22597      * @param {number} subpartSizeUnderLight
22598      */
22599     HomeEnvironment.prototype.setSubpartSizeUnderLight = function (subpartSizeUnderLight) {
22600         if (subpartSizeUnderLight !== this.subpartSizeUnderLight) {
22601             var oldSubpartWidthUnderLight = this.subpartSizeUnderLight;
22602             this.subpartSizeUnderLight = subpartSizeUnderLight;
22603             this.firePropertyChange(/* name */ "SUBPART_SIZE_UNDER_LIGHT", oldSubpartWidthUnderLight, subpartSizeUnderLight);
22604         }
22605     };
22606     /**
22607      * Returns whether all levels should be visible or not.
22608      * @return {boolean}
22609      */
22610     HomeEnvironment.prototype.isAllLevelsVisible = function () {
22611         return this.allLevelsVisible;
22612     };
22613     /**
22614      * Sets whether all levels should be visible or not and fires a <code>PropertyChangeEvent</code>.
22615      * @param {boolean} allLevelsVisible
22616      */
22617     HomeEnvironment.prototype.setAllLevelsVisible = function (allLevelsVisible) {
22618         if (allLevelsVisible !== this.allLevelsVisible) {
22619             this.allLevelsVisible = allLevelsVisible;
22620             this.firePropertyChange(/* name */ "ALL_LEVELS_VISIBLE", !allLevelsVisible, allLevelsVisible);
22621         }
22622     };
22623     /**
22624      * Returns the preferred photo width.
22625      * @return {number}
22626      */
22627     HomeEnvironment.prototype.getPhotoWidth = function () {
22628         return this.photoWidth;
22629     };
22630     /**
22631      * Sets the preferred photo width, and notifies
22632      * listeners of this change.
22633      * @param {number} photoWidth
22634      */
22635     HomeEnvironment.prototype.setPhotoWidth = function (photoWidth) {
22636         if (this.photoWidth !== photoWidth) {
22637             var oldPhotoWidth = this.photoWidth;
22638             this.photoWidth = photoWidth;
22639             this.firePropertyChange(/* name */ "PHOTO_WIDTH", oldPhotoWidth, photoWidth);
22640         }
22641     };
22642     /**
22643      * Returns the preferred photo height.
22644      * @return {number}
22645      */
22646     HomeEnvironment.prototype.getPhotoHeight = function () {
22647         return this.photoHeight;
22648     };
22649     /**
22650      * Sets the preferred photo height, and notifies
22651      * listeners of this change.
22652      * @param {number} photoHeight
22653      */
22654     HomeEnvironment.prototype.setPhotoHeight = function (photoHeight) {
22655         if (this.photoHeight !== photoHeight) {
22656             var oldPhotoHeight = this.photoHeight;
22657             this.photoHeight = photoHeight;
22658             this.firePropertyChange(/* name */ "PHOTO_HEIGHT", oldPhotoHeight, photoHeight);
22659         }
22660     };
22661     /**
22662      * Returns the preferred photo aspect ratio.
22663      * @return {AspectRatio}
22664      */
22665     HomeEnvironment.prototype.getPhotoAspectRatio = function () {
22666         return this.photoAspectRatio;
22667     };
22668     /**
22669      * Sets the preferred photo aspect ratio, and notifies
22670      * listeners of this change.
22671      * @param {AspectRatio} photoAspectRatio
22672      */
22673     HomeEnvironment.prototype.setPhotoAspectRatio = function (photoAspectRatio) {
22674         if (this.photoAspectRatio !== photoAspectRatio) {
22675             var oldPhotoAspectRatio = this.photoAspectRatio;
22676             this.photoAspectRatio = photoAspectRatio;
22677             this.photoAspectRatioName = /* Enum.name */ AspectRatio[this.photoAspectRatio];
22678             this.firePropertyChange(/* name */ "PHOTO_ASPECT_RATIO", oldPhotoAspectRatio, photoAspectRatio);
22679         }
22680     };
22681     /**
22682      * Returns the preferred photo quality.
22683      * @return {number}
22684      */
22685     HomeEnvironment.prototype.getPhotoQuality = function () {
22686         return this.photoQuality;
22687     };
22688     /**
22689      * Sets preferred photo quality, and notifies
22690      * listeners of this change.
22691      * @param {number} photoQuality
22692      */
22693     HomeEnvironment.prototype.setPhotoQuality = function (photoQuality) {
22694         if (this.photoQuality !== photoQuality) {
22695             var oldPhotoQuality = this.photoQuality;
22696             this.photoQuality = photoQuality;
22697             this.firePropertyChange(/* name */ "PHOTO_QUALITY", oldPhotoQuality, photoQuality);
22698         }
22699     };
22700     /**
22701      * Returns the preferred video width.
22702      * @return {number}
22703      */
22704     HomeEnvironment.prototype.getVideoWidth = function () {
22705         return this.videoWidth;
22706     };
22707     /**
22708      * Sets the preferred video width, and notifies
22709      * listeners of this change.
22710      * @param {number} videoWidth
22711      */
22712     HomeEnvironment.prototype.setVideoWidth = function (videoWidth) {
22713         if (this.videoWidth !== videoWidth) {
22714             var oldVideoWidth = this.videoWidth;
22715             this.videoWidth = videoWidth;
22716             this.firePropertyChange(/* name */ "VIDEO_WIDTH", oldVideoWidth, videoWidth);
22717         }
22718     };
22719     /**
22720      * Returns the preferred video height.
22721      * @return {number}
22722      */
22723     HomeEnvironment.prototype.getVideoHeight = function () {
22724         return Math.round(this.getVideoWidth() / { FREE_RATIO: null, VIEW_3D_RATIO: null, RATIO_4_3: 4 / 3, RATIO_3_2: 1.5, RATIO_16_9: 16 / 9, RATIO_2_1: 2 / 1, SQUARE_RATIO: 1 }[this.getVideoAspectRatio()]);
22725     };
22726     /**
22727      * Returns the preferred video aspect ratio.
22728      * @return {AspectRatio}
22729      */
22730     HomeEnvironment.prototype.getVideoAspectRatio = function () {
22731         return this.videoAspectRatio;
22732     };
22733     /**
22734      * Sets the preferred video aspect ratio, and notifies
22735      * listeners of this change.
22736      * @param {AspectRatio} videoAspectRatio
22737      */
22738     HomeEnvironment.prototype.setVideoAspectRatio = function (videoAspectRatio) {
22739         if (this.videoAspectRatio !== videoAspectRatio) {
22740             if ({ FREE_RATIO: null, VIEW_3D_RATIO: null, RATIO_4_3: 4 / 3, RATIO_3_2: 1.5, RATIO_16_9: 16 / 9, RATIO_2_1: 2 / 1, SQUARE_RATIO: 1 }[videoAspectRatio] == null) {
22741                 throw new IllegalArgumentException("Unsupported aspect ratio " + videoAspectRatio);
22742             }
22743             var oldVideoAspectRatio = this.videoAspectRatio;
22744             this.videoAspectRatio = videoAspectRatio;
22745             this.videoAspectRatioName = /* Enum.name */ AspectRatio[this.videoAspectRatio];
22746             this.firePropertyChange(/* name */ "VIDEO_ASPECT_RATIO", oldVideoAspectRatio, videoAspectRatio);
22747         }
22748     };
22749     /**
22750      * Returns preferred video quality.
22751      * @return {number}
22752      */
22753     HomeEnvironment.prototype.getVideoQuality = function () {
22754         return this.videoQuality;
22755     };
22756     /**
22757      * Sets the preferred video quality, and notifies
22758      * listeners of this change.
22759      * @param {number} videoQuality
22760      */
22761     HomeEnvironment.prototype.setVideoQuality = function (videoQuality) {
22762         if (this.videoQuality !== videoQuality) {
22763             var oldVideoQuality = this.videoQuality;
22764             this.videoQuality = videoQuality;
22765             this.firePropertyChange(/* name */ "VIDEO_QUALITY", oldVideoQuality, videoQuality);
22766         }
22767     };
22768     /**
22769      * Returns the preferred speed of movements in videos in m/s.
22770      * @return {number}
22771      */
22772     HomeEnvironment.prototype.getVideoSpeed = function () {
22773         return this.videoSpeed;
22774     };
22775     /**
22776      * Sets the preferred speed of movements in videos in m/s.
22777      * @param {number} videoSpeed
22778      */
22779     HomeEnvironment.prototype.setVideoSpeed = function (videoSpeed) {
22780         if (this.videoSpeed !== videoSpeed) {
22781             var oldVideoSpeed = this.videoSpeed;
22782             this.videoSpeed = videoSpeed;
22783             this.firePropertyChange(/* name */ "VIDEO_SPEED", oldVideoSpeed, videoSpeed);
22784         }
22785     };
22786     /**
22787      * Returns the preferred video frame rate.
22788      * @return {number}
22789      */
22790     HomeEnvironment.prototype.getVideoFrameRate = function () {
22791         return this.videoFrameRate;
22792     };
22793     /**
22794      * Sets the preferred video frame rate, and notifies
22795      * listeners of this change.
22796      * @param {number} videoFrameRate
22797      */
22798     HomeEnvironment.prototype.setVideoFrameRate = function (videoFrameRate) {
22799         if (this.videoFrameRate !== videoFrameRate) {
22800             var oldVideoFrameRate = this.videoFrameRate;
22801             this.videoFrameRate = videoFrameRate;
22802             this.firePropertyChange(/* name */ "VIDEO_FRAME_RATE", oldVideoFrameRate, videoFrameRate);
22803         }
22804     };
22805     /**
22806      * Returns the preferred video camera path.
22807      * @return {Camera[]}
22808      */
22809     HomeEnvironment.prototype.getVideoCameraPath = function () {
22810         return /* unmodifiableList */ this.cameraPath.slice(0);
22811     };
22812     /**
22813      * Sets the preferred video camera path, and notifies
22814      * listeners of this change.
22815      * @param {Camera[]} cameraPath
22816      */
22817     HomeEnvironment.prototype.setVideoCameraPath = function (cameraPath) {
22818         if (this.cameraPath !== cameraPath) {
22819             var oldCameraPath = this.cameraPath;
22820             if (cameraPath != null) {
22821                 this.cameraPath = (cameraPath.slice(0));
22822             }
22823             else {
22824                 this.cameraPath = /* emptyList */ [];
22825             }
22826             this.firePropertyChange(/* name */ "VIDEO_CAMERA_PATH", oldCameraPath, cameraPath);
22827         }
22828     };
22829     /**
22830      * Returns a clone of this environment.
22831      * @return {HomeEnvironment}
22832      */
22833     HomeEnvironment.prototype.clone = function () {
22834         var _this = this;
22835         var clone = (function (o) { if (_super.prototype.clone != undefined) {
22836             return _super.prototype.clone.call(_this);
22837         }
22838         else {
22839             var clone_3 = Object.create(o);
22840             for (var p in o) {
22841                 if (o.hasOwnProperty(p))
22842                     clone_3[p] = o[p];
22843             }
22844             return clone_3;
22845         } })(this);
22846         clone.cameraPath = ([]);
22847         for (var index = 0; index < this.cameraPath.length; index++) {
22848             var camera = this.cameraPath[index];
22849             {
22850                 /* add */ (clone.cameraPath.push(/* clone */ /* clone */ (function (o) { if (o.clone != undefined) {
22851                     return o.clone();
22852                 }
22853                 else {
22854                     var clone_4 = Object.create(o);
22855                     for (var p in o) {
22856                         if (o.hasOwnProperty(p))
22857                             clone_4[p] = o[p];
22858                     }
22859                     return clone_4;
22860                 } })(camera)) > 0);
22861             }
22862         }
22863         return clone;
22864     };
22865     return HomeEnvironment;
22866 }(HomeObject));
22867 HomeEnvironment["__class"] = "com.eteks.sweethome3d.model.HomeEnvironment";
22868 (function (HomeEnvironment) {
22869     /**
22870      * The various modes used to draw home in 3D.
22871      * @enum
22872      * @property {HomeEnvironment.DrawingMode} FILL
22873      * @property {HomeEnvironment.DrawingMode} OUTLINE
22874      * @property {HomeEnvironment.DrawingMode} FILL_AND_OUTLINE
22875      * @class
22876      */
22877     var DrawingMode;
22878     (function (DrawingMode) {
22879         DrawingMode[DrawingMode["FILL"] = 0] = "FILL";
22880         DrawingMode[DrawingMode["OUTLINE"] = 1] = "OUTLINE";
22881         DrawingMode[DrawingMode["FILL_AND_OUTLINE"] = 2] = "FILL_AND_OUTLINE";
22882     })(DrawingMode = HomeEnvironment.DrawingMode || (HomeEnvironment.DrawingMode = {}));
22883 })(HomeEnvironment || (HomeEnvironment = {}));
22884 HomeEnvironment['__transients'] = ['photoAspectRatio', 'videoAspectRatio', 'propertyChangeSupport'];
22885 /**
22886  * Creates a home piece of furniture from an existing piece.
22887  * @param {string} id    the ID of the piece
22888  * @param {Object} piece the piece from which data are copied
22889  * @param {java.lang.String[]} copiedProperties the names of the additional properties which should be copied from the existing piece
22890  * or <code>null</code> if all properties should be copied.
22891  * @class
22892  * @extends HomeObject
22893  * @author Emmanuel Puybaret
22894  */
22895 var HomePieceOfFurniture = /** @class */ (function (_super) {
22896     __extends(HomePieceOfFurniture, _super);
22897     function HomePieceOfFurniture(id, piece, copiedProperties) {
22898         var _this = this;
22899         if (((typeof id === 'string') || id === null) && ((piece != null && (piece.constructor != null && piece.constructor["__interfaces"] != null && piece.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.PieceOfFurniture") >= 0)) || piece === null) && ((copiedProperties != null && copiedProperties instanceof Array && (copiedProperties.length == 0 || copiedProperties[0] == null || (typeof copiedProperties[0] === 'string'))) || copiedProperties === null)) {
22900             var __args = arguments;
22901             _this = _super.call(this, id) || this;
22902             if (_this.catalogId === undefined) {
22903                 _this.catalogId = null;
22904             }
22905             if (_this.name === undefined) {
22906                 _this.name = null;
22907             }
22908             if (_this.nameVisible === undefined) {
22909                 _this.nameVisible = false;
22910             }
22911             if (_this.nameXOffset === undefined) {
22912                 _this.nameXOffset = 0;
22913             }
22914             if (_this.nameYOffset === undefined) {
22915                 _this.nameYOffset = 0;
22916             }
22917             if (_this.nameStyle === undefined) {
22918                 _this.nameStyle = null;
22919             }
22920             if (_this.nameAngle === undefined) {
22921                 _this.nameAngle = 0;
22922             }
22923             if (_this.description === undefined) {
22924                 _this.description = null;
22925             }
22926             if (_this.information === undefined) {
22927                 _this.information = null;
22928             }
22929             if (_this.creator === undefined) {
22930                 _this.creator = null;
22931             }
22932             if (_this.license === undefined) {
22933                 _this.license = null;
22934             }
22935             if (_this.icon === undefined) {
22936                 _this.icon = null;
22937             }
22938             if (_this.planIcon === undefined) {
22939                 _this.planIcon = null;
22940             }
22941             if (_this.model === undefined) {
22942                 _this.model = null;
22943             }
22944             if (_this.modelSize === undefined) {
22945                 _this.modelSize = null;
22946             }
22947             if (_this.width === undefined) {
22948                 _this.width = 0;
22949             }
22950             if (_this.widthInPlan === undefined) {
22951                 _this.widthInPlan = 0;
22952             }
22953             if (_this.depth === undefined) {
22954                 _this.depth = 0;
22955             }
22956             if (_this.depthInPlan === undefined) {
22957                 _this.depthInPlan = 0;
22958             }
22959             if (_this.height === undefined) {
22960                 _this.height = 0;
22961             }
22962             if (_this.heightInPlan === undefined) {
22963                 _this.heightInPlan = 0;
22964             }
22965             if (_this.elevation === undefined) {
22966                 _this.elevation = 0;
22967             }
22968             if (_this.dropOnTopElevation === undefined) {
22969                 _this.dropOnTopElevation = 0;
22970             }
22971             if (_this.movable === undefined) {
22972                 _this.movable = false;
22973             }
22974             if (_this.doorOrWindow === undefined) {
22975                 _this.doorOrWindow = false;
22976             }
22977             if (_this.modelMaterials === undefined) {
22978                 _this.modelMaterials = null;
22979             }
22980             if (_this.color === undefined) {
22981                 _this.color = null;
22982             }
22983             if (_this.texture === undefined) {
22984                 _this.texture = null;
22985             }
22986             if (_this.shininess === undefined) {
22987                 _this.shininess = null;
22988             }
22989             if (_this.modelRotation === undefined) {
22990                 _this.modelRotation = null;
22991             }
22992             if (_this.modelFlags === undefined) {
22993                 _this.modelFlags = 0;
22994             }
22995             if (_this.modelCenteredAtOrigin === undefined) {
22996                 _this.modelCenteredAtOrigin = false;
22997             }
22998             if (_this.modelTransformations === undefined) {
22999                 _this.modelTransformations = null;
23000             }
23001             if (_this.staircaseCutOutShape === undefined) {
23002                 _this.staircaseCutOutShape = null;
23003             }
23004             if (_this.backFaceShown === undefined) {
23005                 _this.backFaceShown = false;
23006             }
23007             if (_this.resizable === undefined) {
23008                 _this.resizable = false;
23009             }
23010             if (_this.deformable === undefined) {
23011                 _this.deformable = false;
23012             }
23013             if (_this.texturable === undefined) {
23014                 _this.texturable = false;
23015             }
23016             if (_this.horizontallyRotatable === undefined) {
23017                 _this.horizontallyRotatable = false;
23018             }
23019             if (_this.price === undefined) {
23020                 _this.price = null;
23021             }
23022             if (_this.valueAddedTaxPercentage === undefined) {
23023                 _this.valueAddedTaxPercentage = null;
23024             }
23025             if (_this.currency === undefined) {
23026                 _this.currency = null;
23027             }
23028             if (_this.visible === undefined) {
23029                 _this.visible = false;
23030             }
23031             if (_this.x === undefined) {
23032                 _this.x = 0;
23033             }
23034             if (_this.y === undefined) {
23035                 _this.y = 0;
23036             }
23037             if (_this.angle === undefined) {
23038                 _this.angle = 0;
23039             }
23040             if (_this.pitch === undefined) {
23041                 _this.pitch = 0;
23042             }
23043             if (_this.roll === undefined) {
23044                 _this.roll = 0;
23045             }
23046             if (_this.modelMirrored === undefined) {
23047                 _this.modelMirrored = false;
23048             }
23049             if (_this.level === undefined) {
23050                 _this.level = null;
23051             }
23052             if (_this.shapeCache === undefined) {
23053                 _this.shapeCache = null;
23054             }
23055             _this.name = piece.getName();
23056             _this.description = piece.getDescription();
23057             _this.information = piece.getInformation();
23058             _this.creator = piece.getCreator();
23059             _this.license = piece.getLicense();
23060             _this.icon = piece.getIcon();
23061             _this.planIcon = piece.getPlanIcon();
23062             _this.model = piece.getModel();
23063             _this.modelSize = piece.getModelSize();
23064             _this.width = piece.getWidth();
23065             _this.depth = piece.getDepth();
23066             _this.height = piece.getHeight();
23067             _this.elevation = piece.getElevation();
23068             _this.dropOnTopElevation = piece.getDropOnTopElevation();
23069             _this.movable = piece.isMovable();
23070             _this.doorOrWindow = piece.isDoorOrWindow();
23071             _this.color = piece.getColor();
23072             _this.modelRotation = piece.getModelRotation();
23073             _this.staircaseCutOutShape = piece.getStaircaseCutOutShape();
23074             _this.modelFlags = piece.getModelFlags();
23075             _this.resizable = piece.isResizable();
23076             _this.deformable = piece.isDeformable();
23077             _this.texturable = piece.isTexturable();
23078             _this.horizontallyRotatable = piece.isHorizontallyRotatable();
23079             _this.price = piece.getPrice();
23080             _this.valueAddedTaxPercentage = piece.getValueAddedTaxPercentage();
23081             _this.currency = piece.getCurrency();
23082             if (piece != null && piece instanceof HomePieceOfFurniture) {
23083                 var homePiece = piece;
23084                 _this.catalogId = homePiece.getCatalogId();
23085                 _this.nameVisible = homePiece.isNameVisible();
23086                 _this.nameXOffset = homePiece.getNameXOffset();
23087                 _this.nameYOffset = homePiece.getNameYOffset();
23088                 _this.nameAngle = homePiece.getNameAngle();
23089                 _this.nameStyle = homePiece.getNameStyle();
23090                 _this.visible = homePiece.isVisible();
23091                 _this.widthInPlan = homePiece.getWidthInPlan();
23092                 _this.depthInPlan = homePiece.getDepthInPlan();
23093                 _this.heightInPlan = homePiece.getHeightInPlan();
23094                 _this.modelCenteredAtOrigin = homePiece.isModelCenteredAtOrigin();
23095                 _this.modelTransformations = homePiece.getModelTransformations();
23096                 _this.angle = homePiece.getAngle();
23097                 _this.pitch = homePiece.getPitch();
23098                 _this.roll = homePiece.getRoll();
23099                 _this.x = homePiece.getX();
23100                 _this.y = homePiece.getY();
23101                 _this.modelMirrored = homePiece.isModelMirrored();
23102                 _this.texture = homePiece.getTexture();
23103                 _this.shininess = homePiece.getShininess();
23104                 _this.modelMaterials = homePiece.getModelMaterials();
23105                 {
23106                     var array = copiedProperties != null ? /* asList */ copiedProperties.slice(0) : homePiece.getPropertyNames();
23107                     for (var index = 0; index < array.length; index++) {
23108                         var property = array[index];
23109                         {
23110                             var value = homePiece.isContentProperty(property) ? homePiece.getContentProperty(property) : homePiece.getProperty(property);
23111                             if (value != null) {
23112                                 _this.setProperty$java_lang_String$java_lang_Object(property, value);
23113                             }
23114                         }
23115                     }
23116                 }
23117             }
23118             else {
23119                 if (piece != null && piece instanceof CatalogPieceOfFurniture) {
23120                     var catalogPiece = piece;
23121                     _this.catalogId = catalogPiece.getId();
23122                     {
23123                         var array = copiedProperties != null ? /* asList */ copiedProperties.slice(0) : catalogPiece.getPropertyNames();
23124                         for (var index = 0; index < array.length; index++) {
23125                             var property = array[index];
23126                             {
23127                                 var value = catalogPiece.isContentProperty(property) ? catalogPiece.getContentProperty(property) : catalogPiece.getProperty(property);
23128                                 if (value != null) {
23129                                     _this.setProperty$java_lang_String$java_lang_Object(property, value);
23130                                 }
23131                             }
23132                         }
23133                     }
23134                 }
23135                 _this.visible = true;
23136                 _this.widthInPlan = _this.width;
23137                 _this.depthInPlan = _this.depth;
23138                 _this.heightInPlan = _this.height;
23139                 _this.modelCenteredAtOrigin = true;
23140                 _this.x = _this.width / 2;
23141                 _this.y = _this.depth / 2;
23142             }
23143         }
23144         else if (((id != null && (id.constructor != null && id.constructor["__interfaces"] != null && id.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.PieceOfFurniture") >= 0)) || id === null) && ((piece != null && piece instanceof Array && (piece.length == 0 || piece[0] == null || (typeof piece[0] === 'string'))) || piece === null) && copiedProperties === undefined) {
23145             var __args = arguments;
23146             var piece_1 = __args[0];
23147             var copiedProperties_1 = __args[1];
23148             {
23149                 var __args_75 = arguments;
23150                 var id_11 = HomeObject.createId("pieceOfFurniture");
23151                 _this = _super.call(this, id_11) || this;
23152                 if (_this.catalogId === undefined) {
23153                     _this.catalogId = null;
23154                 }
23155                 if (_this.name === undefined) {
23156                     _this.name = null;
23157                 }
23158                 if (_this.nameVisible === undefined) {
23159                     _this.nameVisible = false;
23160                 }
23161                 if (_this.nameXOffset === undefined) {
23162                     _this.nameXOffset = 0;
23163                 }
23164                 if (_this.nameYOffset === undefined) {
23165                     _this.nameYOffset = 0;
23166                 }
23167                 if (_this.nameStyle === undefined) {
23168                     _this.nameStyle = null;
23169                 }
23170                 if (_this.nameAngle === undefined) {
23171                     _this.nameAngle = 0;
23172                 }
23173                 if (_this.description === undefined) {
23174                     _this.description = null;
23175                 }
23176                 if (_this.information === undefined) {
23177                     _this.information = null;
23178                 }
23179                 if (_this.creator === undefined) {
23180                     _this.creator = null;
23181                 }
23182                 if (_this.license === undefined) {
23183                     _this.license = null;
23184                 }
23185                 if (_this.icon === undefined) {
23186                     _this.icon = null;
23187                 }
23188                 if (_this.planIcon === undefined) {
23189                     _this.planIcon = null;
23190                 }
23191                 if (_this.model === undefined) {
23192                     _this.model = null;
23193                 }
23194                 if (_this.modelSize === undefined) {
23195                     _this.modelSize = null;
23196                 }
23197                 if (_this.width === undefined) {
23198                     _this.width = 0;
23199                 }
23200                 if (_this.widthInPlan === undefined) {
23201                     _this.widthInPlan = 0;
23202                 }
23203                 if (_this.depth === undefined) {
23204                     _this.depth = 0;
23205                 }
23206                 if (_this.depthInPlan === undefined) {
23207                     _this.depthInPlan = 0;
23208                 }
23209                 if (_this.height === undefined) {
23210                     _this.height = 0;
23211                 }
23212                 if (_this.heightInPlan === undefined) {
23213                     _this.heightInPlan = 0;
23214                 }
23215                 if (_this.elevation === undefined) {
23216                     _this.elevation = 0;
23217                 }
23218                 if (_this.dropOnTopElevation === undefined) {
23219                     _this.dropOnTopElevation = 0;
23220                 }
23221                 if (_this.movable === undefined) {
23222                     _this.movable = false;
23223                 }
23224                 if (_this.doorOrWindow === undefined) {
23225                     _this.doorOrWindow = false;
23226                 }
23227                 if (_this.modelMaterials === undefined) {
23228                     _this.modelMaterials = null;
23229                 }
23230                 if (_this.color === undefined) {
23231                     _this.color = null;
23232                 }
23233                 if (_this.texture === undefined) {
23234                     _this.texture = null;
23235                 }
23236                 if (_this.shininess === undefined) {
23237                     _this.shininess = null;
23238                 }
23239                 if (_this.modelRotation === undefined) {
23240                     _this.modelRotation = null;
23241                 }
23242                 if (_this.modelFlags === undefined) {
23243                     _this.modelFlags = 0;
23244                 }
23245                 if (_this.modelCenteredAtOrigin === undefined) {
23246                     _this.modelCenteredAtOrigin = false;
23247                 }
23248                 if (_this.modelTransformations === undefined) {
23249                     _this.modelTransformations = null;
23250                 }
23251                 if (_this.staircaseCutOutShape === undefined) {
23252                     _this.staircaseCutOutShape = null;
23253                 }
23254                 if (_this.backFaceShown === undefined) {
23255                     _this.backFaceShown = false;
23256                 }
23257                 if (_this.resizable === undefined) {
23258                     _this.resizable = false;
23259                 }
23260                 if (_this.deformable === undefined) {
23261                     _this.deformable = false;
23262                 }
23263                 if (_this.texturable === undefined) {
23264                     _this.texturable = false;
23265                 }
23266                 if (_this.horizontallyRotatable === undefined) {
23267                     _this.horizontallyRotatable = false;
23268                 }
23269                 if (_this.price === undefined) {
23270                     _this.price = null;
23271                 }
23272                 if (_this.valueAddedTaxPercentage === undefined) {
23273                     _this.valueAddedTaxPercentage = null;
23274                 }
23275                 if (_this.currency === undefined) {
23276                     _this.currency = null;
23277                 }
23278                 if (_this.visible === undefined) {
23279                     _this.visible = false;
23280                 }
23281                 if (_this.x === undefined) {
23282                     _this.x = 0;
23283                 }
23284                 if (_this.y === undefined) {
23285                     _this.y = 0;
23286                 }
23287                 if (_this.angle === undefined) {
23288                     _this.angle = 0;
23289                 }
23290                 if (_this.pitch === undefined) {
23291                     _this.pitch = 0;
23292                 }
23293                 if (_this.roll === undefined) {
23294                     _this.roll = 0;
23295                 }
23296                 if (_this.modelMirrored === undefined) {
23297                     _this.modelMirrored = false;
23298                 }
23299                 if (_this.level === undefined) {
23300                     _this.level = null;
23301                 }
23302                 if (_this.shapeCache === undefined) {
23303                     _this.shapeCache = null;
23304                 }
23305                 _this.name = piece_1.getName();
23306                 _this.description = piece_1.getDescription();
23307                 _this.information = piece_1.getInformation();
23308                 _this.creator = piece_1.getCreator();
23309                 _this.license = piece_1.getLicense();
23310                 _this.icon = piece_1.getIcon();
23311                 _this.planIcon = piece_1.getPlanIcon();
23312                 _this.model = piece_1.getModel();
23313                 _this.modelSize = piece_1.getModelSize();
23314                 _this.width = piece_1.getWidth();
23315                 _this.depth = piece_1.getDepth();
23316                 _this.height = piece_1.getHeight();
23317                 _this.elevation = piece_1.getElevation();
23318                 _this.dropOnTopElevation = piece_1.getDropOnTopElevation();
23319                 _this.movable = piece_1.isMovable();
23320                 _this.doorOrWindow = piece_1.isDoorOrWindow();
23321                 _this.color = piece_1.getColor();
23322                 _this.modelRotation = piece_1.getModelRotation();
23323                 _this.staircaseCutOutShape = piece_1.getStaircaseCutOutShape();
23324                 _this.modelFlags = piece_1.getModelFlags();
23325                 _this.resizable = piece_1.isResizable();
23326                 _this.deformable = piece_1.isDeformable();
23327                 _this.texturable = piece_1.isTexturable();
23328                 _this.horizontallyRotatable = piece_1.isHorizontallyRotatable();
23329                 _this.price = piece_1.getPrice();
23330                 _this.valueAddedTaxPercentage = piece_1.getValueAddedTaxPercentage();
23331                 _this.currency = piece_1.getCurrency();
23332                 if (piece_1 != null && piece_1 instanceof HomePieceOfFurniture) {
23333                     var homePiece = piece_1;
23334                     _this.catalogId = homePiece.getCatalogId();
23335                     _this.nameVisible = homePiece.isNameVisible();
23336                     _this.nameXOffset = homePiece.getNameXOffset();
23337                     _this.nameYOffset = homePiece.getNameYOffset();
23338                     _this.nameAngle = homePiece.getNameAngle();
23339                     _this.nameStyle = homePiece.getNameStyle();
23340                     _this.visible = homePiece.isVisible();
23341                     _this.widthInPlan = homePiece.getWidthInPlan();
23342                     _this.depthInPlan = homePiece.getDepthInPlan();
23343                     _this.heightInPlan = homePiece.getHeightInPlan();
23344                     _this.modelCenteredAtOrigin = homePiece.isModelCenteredAtOrigin();
23345                     _this.modelTransformations = homePiece.getModelTransformations();
23346                     _this.angle = homePiece.getAngle();
23347                     _this.pitch = homePiece.getPitch();
23348                     _this.roll = homePiece.getRoll();
23349                     _this.x = homePiece.getX();
23350                     _this.y = homePiece.getY();
23351                     _this.modelMirrored = homePiece.isModelMirrored();
23352                     _this.texture = homePiece.getTexture();
23353                     _this.shininess = homePiece.getShininess();
23354                     _this.modelMaterials = homePiece.getModelMaterials();
23355                     {
23356                         var array = copiedProperties_1 != null ? /* asList */ copiedProperties_1.slice(0) : homePiece.getPropertyNames();
23357                         for (var index = 0; index < array.length; index++) {
23358                             var property = array[index];
23359                             {
23360                                 var value = homePiece.isContentProperty(property) ? homePiece.getContentProperty(property) : homePiece.getProperty(property);
23361                                 if (value != null) {
23362                                     _this.setProperty$java_lang_String$java_lang_Object(property, value);
23363                                 }
23364                             }
23365                         }
23366                     }
23367                 }
23368                 else {
23369                     if (piece_1 != null && piece_1 instanceof CatalogPieceOfFurniture) {
23370                         var catalogPiece = piece_1;
23371                         _this.catalogId = catalogPiece.getId();
23372                         {
23373                             var array = copiedProperties_1 != null ? /* asList */ copiedProperties_1.slice(0) : catalogPiece.getPropertyNames();
23374                             for (var index = 0; index < array.length; index++) {
23375                                 var property = array[index];
23376                                 {
23377                                     var value = catalogPiece.isContentProperty(property) ? catalogPiece.getContentProperty(property) : catalogPiece.getProperty(property);
23378                                     if (value != null) {
23379                                         _this.setProperty$java_lang_String$java_lang_Object(property, value);
23380                                     }
23381                                 }
23382                             }
23383                         }
23384                     }
23385                     _this.visible = true;
23386                     _this.widthInPlan = _this.width;
23387                     _this.depthInPlan = _this.depth;
23388                     _this.heightInPlan = _this.height;
23389                     _this.modelCenteredAtOrigin = true;
23390                     _this.x = _this.width / 2;
23391                     _this.y = _this.depth / 2;
23392                 }
23393             }
23394             if (_this.catalogId === undefined) {
23395                 _this.catalogId = null;
23396             }
23397             if (_this.name === undefined) {
23398                 _this.name = null;
23399             }
23400             if (_this.nameVisible === undefined) {
23401                 _this.nameVisible = false;
23402             }
23403             if (_this.nameXOffset === undefined) {
23404                 _this.nameXOffset = 0;
23405             }
23406             if (_this.nameYOffset === undefined) {
23407                 _this.nameYOffset = 0;
23408             }
23409             if (_this.nameStyle === undefined) {
23410                 _this.nameStyle = null;
23411             }
23412             if (_this.nameAngle === undefined) {
23413                 _this.nameAngle = 0;
23414             }
23415             if (_this.description === undefined) {
23416                 _this.description = null;
23417             }
23418             if (_this.information === undefined) {
23419                 _this.information = null;
23420             }
23421             if (_this.creator === undefined) {
23422                 _this.creator = null;
23423             }
23424             if (_this.license === undefined) {
23425                 _this.license = null;
23426             }
23427             if (_this.icon === undefined) {
23428                 _this.icon = null;
23429             }
23430             if (_this.planIcon === undefined) {
23431                 _this.planIcon = null;
23432             }
23433             if (_this.model === undefined) {
23434                 _this.model = null;
23435             }
23436             if (_this.modelSize === undefined) {
23437                 _this.modelSize = null;
23438             }
23439             if (_this.width === undefined) {
23440                 _this.width = 0;
23441             }
23442             if (_this.widthInPlan === undefined) {
23443                 _this.widthInPlan = 0;
23444             }
23445             if (_this.depth === undefined) {
23446                 _this.depth = 0;
23447             }
23448             if (_this.depthInPlan === undefined) {
23449                 _this.depthInPlan = 0;
23450             }
23451             if (_this.height === undefined) {
23452                 _this.height = 0;
23453             }
23454             if (_this.heightInPlan === undefined) {
23455                 _this.heightInPlan = 0;
23456             }
23457             if (_this.elevation === undefined) {
23458                 _this.elevation = 0;
23459             }
23460             if (_this.dropOnTopElevation === undefined) {
23461                 _this.dropOnTopElevation = 0;
23462             }
23463             if (_this.movable === undefined) {
23464                 _this.movable = false;
23465             }
23466             if (_this.doorOrWindow === undefined) {
23467                 _this.doorOrWindow = false;
23468             }
23469             if (_this.modelMaterials === undefined) {
23470                 _this.modelMaterials = null;
23471             }
23472             if (_this.color === undefined) {
23473                 _this.color = null;
23474             }
23475             if (_this.texture === undefined) {
23476                 _this.texture = null;
23477             }
23478             if (_this.shininess === undefined) {
23479                 _this.shininess = null;
23480             }
23481             if (_this.modelRotation === undefined) {
23482                 _this.modelRotation = null;
23483             }
23484             if (_this.modelFlags === undefined) {
23485                 _this.modelFlags = 0;
23486             }
23487             if (_this.modelCenteredAtOrigin === undefined) {
23488                 _this.modelCenteredAtOrigin = false;
23489             }
23490             if (_this.modelTransformations === undefined) {
23491                 _this.modelTransformations = null;
23492             }
23493             if (_this.staircaseCutOutShape === undefined) {
23494                 _this.staircaseCutOutShape = null;
23495             }
23496             if (_this.backFaceShown === undefined) {
23497                 _this.backFaceShown = false;
23498             }
23499             if (_this.resizable === undefined) {
23500                 _this.resizable = false;
23501             }
23502             if (_this.deformable === undefined) {
23503                 _this.deformable = false;
23504             }
23505             if (_this.texturable === undefined) {
23506                 _this.texturable = false;
23507             }
23508             if (_this.horizontallyRotatable === undefined) {
23509                 _this.horizontallyRotatable = false;
23510             }
23511             if (_this.price === undefined) {
23512                 _this.price = null;
23513             }
23514             if (_this.valueAddedTaxPercentage === undefined) {
23515                 _this.valueAddedTaxPercentage = null;
23516             }
23517             if (_this.currency === undefined) {
23518                 _this.currency = null;
23519             }
23520             if (_this.visible === undefined) {
23521                 _this.visible = false;
23522             }
23523             if (_this.x === undefined) {
23524                 _this.x = 0;
23525             }
23526             if (_this.y === undefined) {
23527                 _this.y = 0;
23528             }
23529             if (_this.angle === undefined) {
23530                 _this.angle = 0;
23531             }
23532             if (_this.pitch === undefined) {
23533                 _this.pitch = 0;
23534             }
23535             if (_this.roll === undefined) {
23536                 _this.roll = 0;
23537             }
23538             if (_this.modelMirrored === undefined) {
23539                 _this.modelMirrored = false;
23540             }
23541             if (_this.level === undefined) {
23542                 _this.level = null;
23543             }
23544             if (_this.shapeCache === undefined) {
23545                 _this.shapeCache = null;
23546             }
23547         }
23548         else if (((typeof id === 'string') || id === null) && ((piece != null && (piece.constructor != null && piece.constructor["__interfaces"] != null && piece.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.PieceOfFurniture") >= 0)) || piece === null) && copiedProperties === undefined) {
23549             var __args = arguments;
23550             {
23551                 var __args_76 = arguments;
23552                 var copiedProperties_2 = HomePieceOfFurniture.EMPTY_PROPERTY_ARRAY_$LI$();
23553                 _this = _super.call(this, id) || this;
23554                 if (_this.catalogId === undefined) {
23555                     _this.catalogId = null;
23556                 }
23557                 if (_this.name === undefined) {
23558                     _this.name = null;
23559                 }
23560                 if (_this.nameVisible === undefined) {
23561                     _this.nameVisible = false;
23562                 }
23563                 if (_this.nameXOffset === undefined) {
23564                     _this.nameXOffset = 0;
23565                 }
23566                 if (_this.nameYOffset === undefined) {
23567                     _this.nameYOffset = 0;
23568                 }
23569                 if (_this.nameStyle === undefined) {
23570                     _this.nameStyle = null;
23571                 }
23572                 if (_this.nameAngle === undefined) {
23573                     _this.nameAngle = 0;
23574                 }
23575                 if (_this.description === undefined) {
23576                     _this.description = null;
23577                 }
23578                 if (_this.information === undefined) {
23579                     _this.information = null;
23580                 }
23581                 if (_this.creator === undefined) {
23582                     _this.creator = null;
23583                 }
23584                 if (_this.license === undefined) {
23585                     _this.license = null;
23586                 }
23587                 if (_this.icon === undefined) {
23588                     _this.icon = null;
23589                 }
23590                 if (_this.planIcon === undefined) {
23591                     _this.planIcon = null;
23592                 }
23593                 if (_this.model === undefined) {
23594                     _this.model = null;
23595                 }
23596                 if (_this.modelSize === undefined) {
23597                     _this.modelSize = null;
23598                 }
23599                 if (_this.width === undefined) {
23600                     _this.width = 0;
23601                 }
23602                 if (_this.widthInPlan === undefined) {
23603                     _this.widthInPlan = 0;
23604                 }
23605                 if (_this.depth === undefined) {
23606                     _this.depth = 0;
23607                 }
23608                 if (_this.depthInPlan === undefined) {
23609                     _this.depthInPlan = 0;
23610                 }
23611                 if (_this.height === undefined) {
23612                     _this.height = 0;
23613                 }
23614                 if (_this.heightInPlan === undefined) {
23615                     _this.heightInPlan = 0;
23616                 }
23617                 if (_this.elevation === undefined) {
23618                     _this.elevation = 0;
23619                 }
23620                 if (_this.dropOnTopElevation === undefined) {
23621                     _this.dropOnTopElevation = 0;
23622                 }
23623                 if (_this.movable === undefined) {
23624                     _this.movable = false;
23625                 }
23626                 if (_this.doorOrWindow === undefined) {
23627                     _this.doorOrWindow = false;
23628                 }
23629                 if (_this.modelMaterials === undefined) {
23630                     _this.modelMaterials = null;
23631                 }
23632                 if (_this.color === undefined) {
23633                     _this.color = null;
23634                 }
23635                 if (_this.texture === undefined) {
23636                     _this.texture = null;
23637                 }
23638                 if (_this.shininess === undefined) {
23639                     _this.shininess = null;
23640                 }
23641                 if (_this.modelRotation === undefined) {
23642                     _this.modelRotation = null;
23643                 }
23644                 if (_this.modelFlags === undefined) {
23645                     _this.modelFlags = 0;
23646                 }
23647                 if (_this.modelCenteredAtOrigin === undefined) {
23648                     _this.modelCenteredAtOrigin = false;
23649                 }
23650                 if (_this.modelTransformations === undefined) {
23651                     _this.modelTransformations = null;
23652                 }
23653                 if (_this.staircaseCutOutShape === undefined) {
23654                     _this.staircaseCutOutShape = null;
23655                 }
23656                 if (_this.backFaceShown === undefined) {
23657                     _this.backFaceShown = false;
23658                 }
23659                 if (_this.resizable === undefined) {
23660                     _this.resizable = false;
23661                 }
23662                 if (_this.deformable === undefined) {
23663                     _this.deformable = false;
23664                 }
23665                 if (_this.texturable === undefined) {
23666                     _this.texturable = false;
23667                 }
23668                 if (_this.horizontallyRotatable === undefined) {
23669                     _this.horizontallyRotatable = false;
23670                 }
23671                 if (_this.price === undefined) {
23672                     _this.price = null;
23673                 }
23674                 if (_this.valueAddedTaxPercentage === undefined) {
23675                     _this.valueAddedTaxPercentage = null;
23676                 }
23677                 if (_this.currency === undefined) {
23678                     _this.currency = null;
23679                 }
23680                 if (_this.visible === undefined) {
23681                     _this.visible = false;
23682                 }
23683                 if (_this.x === undefined) {
23684                     _this.x = 0;
23685                 }
23686                 if (_this.y === undefined) {
23687                     _this.y = 0;
23688                 }
23689                 if (_this.angle === undefined) {
23690                     _this.angle = 0;
23691                 }
23692                 if (_this.pitch === undefined) {
23693                     _this.pitch = 0;
23694                 }
23695                 if (_this.roll === undefined) {
23696                     _this.roll = 0;
23697                 }
23698                 if (_this.modelMirrored === undefined) {
23699                     _this.modelMirrored = false;
23700                 }
23701                 if (_this.level === undefined) {
23702                     _this.level = null;
23703                 }
23704                 if (_this.shapeCache === undefined) {
23705                     _this.shapeCache = null;
23706                 }
23707                 _this.name = piece.getName();
23708                 _this.description = piece.getDescription();
23709                 _this.information = piece.getInformation();
23710                 _this.creator = piece.getCreator();
23711                 _this.license = piece.getLicense();
23712                 _this.icon = piece.getIcon();
23713                 _this.planIcon = piece.getPlanIcon();
23714                 _this.model = piece.getModel();
23715                 _this.modelSize = piece.getModelSize();
23716                 _this.width = piece.getWidth();
23717                 _this.depth = piece.getDepth();
23718                 _this.height = piece.getHeight();
23719                 _this.elevation = piece.getElevation();
23720                 _this.dropOnTopElevation = piece.getDropOnTopElevation();
23721                 _this.movable = piece.isMovable();
23722                 _this.doorOrWindow = piece.isDoorOrWindow();
23723                 _this.color = piece.getColor();
23724                 _this.modelRotation = piece.getModelRotation();
23725                 _this.staircaseCutOutShape = piece.getStaircaseCutOutShape();
23726                 _this.modelFlags = piece.getModelFlags();
23727                 _this.resizable = piece.isResizable();
23728                 _this.deformable = piece.isDeformable();
23729                 _this.texturable = piece.isTexturable();
23730                 _this.horizontallyRotatable = piece.isHorizontallyRotatable();
23731                 _this.price = piece.getPrice();
23732                 _this.valueAddedTaxPercentage = piece.getValueAddedTaxPercentage();
23733                 _this.currency = piece.getCurrency();
23734                 if (piece != null && piece instanceof HomePieceOfFurniture) {
23735                     var homePiece = piece;
23736                     _this.catalogId = homePiece.getCatalogId();
23737                     _this.nameVisible = homePiece.isNameVisible();
23738                     _this.nameXOffset = homePiece.getNameXOffset();
23739                     _this.nameYOffset = homePiece.getNameYOffset();
23740                     _this.nameAngle = homePiece.getNameAngle();
23741                     _this.nameStyle = homePiece.getNameStyle();
23742                     _this.visible = homePiece.isVisible();
23743                     _this.widthInPlan = homePiece.getWidthInPlan();
23744                     _this.depthInPlan = homePiece.getDepthInPlan();
23745                     _this.heightInPlan = homePiece.getHeightInPlan();
23746                     _this.modelCenteredAtOrigin = homePiece.isModelCenteredAtOrigin();
23747                     _this.modelTransformations = homePiece.getModelTransformations();
23748                     _this.angle = homePiece.getAngle();
23749                     _this.pitch = homePiece.getPitch();
23750                     _this.roll = homePiece.getRoll();
23751                     _this.x = homePiece.getX();
23752                     _this.y = homePiece.getY();
23753                     _this.modelMirrored = homePiece.isModelMirrored();
23754                     _this.texture = homePiece.getTexture();
23755                     _this.shininess = homePiece.getShininess();
23756                     _this.modelMaterials = homePiece.getModelMaterials();
23757                     {
23758                         var array = copiedProperties_2 != null ? /* asList */ copiedProperties_2.slice(0) : homePiece.getPropertyNames();
23759                         for (var index = 0; index < array.length; index++) {
23760                             var property = array[index];
23761                             {
23762                                 var value = homePiece.isContentProperty(property) ? homePiece.getContentProperty(property) : homePiece.getProperty(property);
23763                                 if (value != null) {
23764                                     _this.setProperty$java_lang_String$java_lang_Object(property, value);
23765                                 }
23766                             }
23767                         }
23768                     }
23769                 }
23770                 else {
23771                     if (piece != null && piece instanceof CatalogPieceOfFurniture) {
23772                         var catalogPiece = piece;
23773                         _this.catalogId = catalogPiece.getId();
23774                         {
23775                             var array = copiedProperties_2 != null ? /* asList */ copiedProperties_2.slice(0) : catalogPiece.getPropertyNames();
23776                             for (var index = 0; index < array.length; index++) {
23777                                 var property = array[index];
23778                                 {
23779                                     var value = catalogPiece.isContentProperty(property) ? catalogPiece.getContentProperty(property) : catalogPiece.getProperty(property);
23780                                     if (value != null) {
23781                                         _this.setProperty$java_lang_String$java_lang_Object(property, value);
23782                                     }
23783                                 }
23784                             }
23785                         }
23786                     }
23787                     _this.visible = true;
23788                     _this.widthInPlan = _this.width;
23789                     _this.depthInPlan = _this.depth;
23790                     _this.heightInPlan = _this.height;
23791                     _this.modelCenteredAtOrigin = true;
23792                     _this.x = _this.width / 2;
23793                     _this.y = _this.depth / 2;
23794                 }
23795             }
23796             if (_this.catalogId === undefined) {
23797                 _this.catalogId = null;
23798             }
23799             if (_this.name === undefined) {
23800                 _this.name = null;
23801             }
23802             if (_this.nameVisible === undefined) {
23803                 _this.nameVisible = false;
23804             }
23805             if (_this.nameXOffset === undefined) {
23806                 _this.nameXOffset = 0;
23807             }
23808             if (_this.nameYOffset === undefined) {
23809                 _this.nameYOffset = 0;
23810             }
23811             if (_this.nameStyle === undefined) {
23812                 _this.nameStyle = null;
23813             }
23814             if (_this.nameAngle === undefined) {
23815                 _this.nameAngle = 0;
23816             }
23817             if (_this.description === undefined) {
23818                 _this.description = null;
23819             }
23820             if (_this.information === undefined) {
23821                 _this.information = null;
23822             }
23823             if (_this.creator === undefined) {
23824                 _this.creator = null;
23825             }
23826             if (_this.license === undefined) {
23827                 _this.license = null;
23828             }
23829             if (_this.icon === undefined) {
23830                 _this.icon = null;
23831             }
23832             if (_this.planIcon === undefined) {
23833                 _this.planIcon = null;
23834             }
23835             if (_this.model === undefined) {
23836                 _this.model = null;
23837             }
23838             if (_this.modelSize === undefined) {
23839                 _this.modelSize = null;
23840             }
23841             if (_this.width === undefined) {
23842                 _this.width = 0;
23843             }
23844             if (_this.widthInPlan === undefined) {
23845                 _this.widthInPlan = 0;
23846             }
23847             if (_this.depth === undefined) {
23848                 _this.depth = 0;
23849             }
23850             if (_this.depthInPlan === undefined) {
23851                 _this.depthInPlan = 0;
23852             }
23853             if (_this.height === undefined) {
23854                 _this.height = 0;
23855             }
23856             if (_this.heightInPlan === undefined) {
23857                 _this.heightInPlan = 0;
23858             }
23859             if (_this.elevation === undefined) {
23860                 _this.elevation = 0;
23861             }
23862             if (_this.dropOnTopElevation === undefined) {
23863                 _this.dropOnTopElevation = 0;
23864             }
23865             if (_this.movable === undefined) {
23866                 _this.movable = false;
23867             }
23868             if (_this.doorOrWindow === undefined) {
23869                 _this.doorOrWindow = false;
23870             }
23871             if (_this.modelMaterials === undefined) {
23872                 _this.modelMaterials = null;
23873             }
23874             if (_this.color === undefined) {
23875                 _this.color = null;
23876             }
23877             if (_this.texture === undefined) {
23878                 _this.texture = null;
23879             }
23880             if (_this.shininess === undefined) {
23881                 _this.shininess = null;
23882             }
23883             if (_this.modelRotation === undefined) {
23884                 _this.modelRotation = null;
23885             }
23886             if (_this.modelFlags === undefined) {
23887                 _this.modelFlags = 0;
23888             }
23889             if (_this.modelCenteredAtOrigin === undefined) {
23890                 _this.modelCenteredAtOrigin = false;
23891             }
23892             if (_this.modelTransformations === undefined) {
23893                 _this.modelTransformations = null;
23894             }
23895             if (_this.staircaseCutOutShape === undefined) {
23896                 _this.staircaseCutOutShape = null;
23897             }
23898             if (_this.backFaceShown === undefined) {
23899                 _this.backFaceShown = false;
23900             }
23901             if (_this.resizable === undefined) {
23902                 _this.resizable = false;
23903             }
23904             if (_this.deformable === undefined) {
23905                 _this.deformable = false;
23906             }
23907             if (_this.texturable === undefined) {
23908                 _this.texturable = false;
23909             }
23910             if (_this.horizontallyRotatable === undefined) {
23911                 _this.horizontallyRotatable = false;
23912             }
23913             if (_this.price === undefined) {
23914                 _this.price = null;
23915             }
23916             if (_this.valueAddedTaxPercentage === undefined) {
23917                 _this.valueAddedTaxPercentage = null;
23918             }
23919             if (_this.currency === undefined) {
23920                 _this.currency = null;
23921             }
23922             if (_this.visible === undefined) {
23923                 _this.visible = false;
23924             }
23925             if (_this.x === undefined) {
23926                 _this.x = 0;
23927             }
23928             if (_this.y === undefined) {
23929                 _this.y = 0;
23930             }
23931             if (_this.angle === undefined) {
23932                 _this.angle = 0;
23933             }
23934             if (_this.pitch === undefined) {
23935                 _this.pitch = 0;
23936             }
23937             if (_this.roll === undefined) {
23938                 _this.roll = 0;
23939             }
23940             if (_this.modelMirrored === undefined) {
23941                 _this.modelMirrored = false;
23942             }
23943             if (_this.level === undefined) {
23944                 _this.level = null;
23945             }
23946             if (_this.shapeCache === undefined) {
23947                 _this.shapeCache = null;
23948             }
23949         }
23950         else if (((id != null && (id.constructor != null && id.constructor["__interfaces"] != null && id.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.PieceOfFurniture") >= 0)) || id === null) && piece === undefined && copiedProperties === undefined) {
23951             var __args = arguments;
23952             var piece_2 = __args[0];
23953             {
23954                 var __args_77 = arguments;
23955                 var copiedProperties_3 = HomePieceOfFurniture.EMPTY_PROPERTY_ARRAY_$LI$();
23956                 {
23957                     var __args_78 = arguments;
23958                     var id_12 = HomeObject.createId("pieceOfFurniture");
23959                     _this = _super.call(this, id_12) || this;
23960                     if (_this.catalogId === undefined) {
23961                         _this.catalogId = null;
23962                     }
23963                     if (_this.name === undefined) {
23964                         _this.name = null;
23965                     }
23966                     if (_this.nameVisible === undefined) {
23967                         _this.nameVisible = false;
23968                     }
23969                     if (_this.nameXOffset === undefined) {
23970                         _this.nameXOffset = 0;
23971                     }
23972                     if (_this.nameYOffset === undefined) {
23973                         _this.nameYOffset = 0;
23974                     }
23975                     if (_this.nameStyle === undefined) {
23976                         _this.nameStyle = null;
23977                     }
23978                     if (_this.nameAngle === undefined) {
23979                         _this.nameAngle = 0;
23980                     }
23981                     if (_this.description === undefined) {
23982                         _this.description = null;
23983                     }
23984                     if (_this.information === undefined) {
23985                         _this.information = null;
23986                     }
23987                     if (_this.creator === undefined) {
23988                         _this.creator = null;
23989                     }
23990                     if (_this.license === undefined) {
23991                         _this.license = null;
23992                     }
23993                     if (_this.icon === undefined) {
23994                         _this.icon = null;
23995                     }
23996                     if (_this.planIcon === undefined) {
23997                         _this.planIcon = null;
23998                     }
23999                     if (_this.model === undefined) {
24000                         _this.model = null;
24001                     }
24002                     if (_this.modelSize === undefined) {
24003                         _this.modelSize = null;
24004                     }
24005                     if (_this.width === undefined) {
24006                         _this.width = 0;
24007                     }
24008                     if (_this.widthInPlan === undefined) {
24009                         _this.widthInPlan = 0;
24010                     }
24011                     if (_this.depth === undefined) {
24012                         _this.depth = 0;
24013                     }
24014                     if (_this.depthInPlan === undefined) {
24015                         _this.depthInPlan = 0;
24016                     }
24017                     if (_this.height === undefined) {
24018                         _this.height = 0;
24019                     }
24020                     if (_this.heightInPlan === undefined) {
24021                         _this.heightInPlan = 0;
24022                     }
24023                     if (_this.elevation === undefined) {
24024                         _this.elevation = 0;
24025                     }
24026                     if (_this.dropOnTopElevation === undefined) {
24027                         _this.dropOnTopElevation = 0;
24028                     }
24029                     if (_this.movable === undefined) {
24030                         _this.movable = false;
24031                     }
24032                     if (_this.doorOrWindow === undefined) {
24033                         _this.doorOrWindow = false;
24034                     }
24035                     if (_this.modelMaterials === undefined) {
24036                         _this.modelMaterials = null;
24037                     }
24038                     if (_this.color === undefined) {
24039                         _this.color = null;
24040                     }
24041                     if (_this.texture === undefined) {
24042                         _this.texture = null;
24043                     }
24044                     if (_this.shininess === undefined) {
24045                         _this.shininess = null;
24046                     }
24047                     if (_this.modelRotation === undefined) {
24048                         _this.modelRotation = null;
24049                     }
24050                     if (_this.modelFlags === undefined) {
24051                         _this.modelFlags = 0;
24052                     }
24053                     if (_this.modelCenteredAtOrigin === undefined) {
24054                         _this.modelCenteredAtOrigin = false;
24055                     }
24056                     if (_this.modelTransformations === undefined) {
24057                         _this.modelTransformations = null;
24058                     }
24059                     if (_this.staircaseCutOutShape === undefined) {
24060                         _this.staircaseCutOutShape = null;
24061                     }
24062                     if (_this.backFaceShown === undefined) {
24063                         _this.backFaceShown = false;
24064                     }
24065                     if (_this.resizable === undefined) {
24066                         _this.resizable = false;
24067                     }
24068                     if (_this.deformable === undefined) {
24069                         _this.deformable = false;
24070                     }
24071                     if (_this.texturable === undefined) {
24072                         _this.texturable = false;
24073                     }
24074                     if (_this.horizontallyRotatable === undefined) {
24075                         _this.horizontallyRotatable = false;
24076                     }
24077                     if (_this.price === undefined) {
24078                         _this.price = null;
24079                     }
24080                     if (_this.valueAddedTaxPercentage === undefined) {
24081                         _this.valueAddedTaxPercentage = null;
24082                     }
24083                     if (_this.currency === undefined) {
24084                         _this.currency = null;
24085                     }
24086                     if (_this.visible === undefined) {
24087                         _this.visible = false;
24088                     }
24089                     if (_this.x === undefined) {
24090                         _this.x = 0;
24091                     }
24092                     if (_this.y === undefined) {
24093                         _this.y = 0;
24094                     }
24095                     if (_this.angle === undefined) {
24096                         _this.angle = 0;
24097                     }
24098                     if (_this.pitch === undefined) {
24099                         _this.pitch = 0;
24100                     }
24101                     if (_this.roll === undefined) {
24102                         _this.roll = 0;
24103                     }
24104                     if (_this.modelMirrored === undefined) {
24105                         _this.modelMirrored = false;
24106                     }
24107                     if (_this.level === undefined) {
24108                         _this.level = null;
24109                     }
24110                     if (_this.shapeCache === undefined) {
24111                         _this.shapeCache = null;
24112                     }
24113                     _this.name = piece_2.getName();
24114                     _this.description = piece_2.getDescription();
24115                     _this.information = piece_2.getInformation();
24116                     _this.creator = piece_2.getCreator();
24117                     _this.license = piece_2.getLicense();
24118                     _this.icon = piece_2.getIcon();
24119                     _this.planIcon = piece_2.getPlanIcon();
24120                     _this.model = piece_2.getModel();
24121                     _this.modelSize = piece_2.getModelSize();
24122                     _this.width = piece_2.getWidth();
24123                     _this.depth = piece_2.getDepth();
24124                     _this.height = piece_2.getHeight();
24125                     _this.elevation = piece_2.getElevation();
24126                     _this.dropOnTopElevation = piece_2.getDropOnTopElevation();
24127                     _this.movable = piece_2.isMovable();
24128                     _this.doorOrWindow = piece_2.isDoorOrWindow();
24129                     _this.color = piece_2.getColor();
24130                     _this.modelRotation = piece_2.getModelRotation();
24131                     _this.staircaseCutOutShape = piece_2.getStaircaseCutOutShape();
24132                     _this.modelFlags = piece_2.getModelFlags();
24133                     _this.resizable = piece_2.isResizable();
24134                     _this.deformable = piece_2.isDeformable();
24135                     _this.texturable = piece_2.isTexturable();
24136                     _this.horizontallyRotatable = piece_2.isHorizontallyRotatable();
24137                     _this.price = piece_2.getPrice();
24138                     _this.valueAddedTaxPercentage = piece_2.getValueAddedTaxPercentage();
24139                     _this.currency = piece_2.getCurrency();
24140                     if (piece_2 != null && piece_2 instanceof HomePieceOfFurniture) {
24141                         var homePiece = piece_2;
24142                         _this.catalogId = homePiece.getCatalogId();
24143                         _this.nameVisible = homePiece.isNameVisible();
24144                         _this.nameXOffset = homePiece.getNameXOffset();
24145                         _this.nameYOffset = homePiece.getNameYOffset();
24146                         _this.nameAngle = homePiece.getNameAngle();
24147                         _this.nameStyle = homePiece.getNameStyle();
24148                         _this.visible = homePiece.isVisible();
24149                         _this.widthInPlan = homePiece.getWidthInPlan();
24150                         _this.depthInPlan = homePiece.getDepthInPlan();
24151                         _this.heightInPlan = homePiece.getHeightInPlan();
24152                         _this.modelCenteredAtOrigin = homePiece.isModelCenteredAtOrigin();
24153                         _this.modelTransformations = homePiece.getModelTransformations();
24154                         _this.angle = homePiece.getAngle();
24155                         _this.pitch = homePiece.getPitch();
24156                         _this.roll = homePiece.getRoll();
24157                         _this.x = homePiece.getX();
24158                         _this.y = homePiece.getY();
24159                         _this.modelMirrored = homePiece.isModelMirrored();
24160                         _this.texture = homePiece.getTexture();
24161                         _this.shininess = homePiece.getShininess();
24162                         _this.modelMaterials = homePiece.getModelMaterials();
24163                         {
24164                             var array = copiedProperties_3 != null ? /* asList */ copiedProperties_3.slice(0) : homePiece.getPropertyNames();
24165                             for (var index = 0; index < array.length; index++) {
24166                                 var property = array[index];
24167                                 {
24168                                     var value = homePiece.isContentProperty(property) ? homePiece.getContentProperty(property) : homePiece.getProperty(property);
24169                                     if (value != null) {
24170                                         _this.setProperty$java_lang_String$java_lang_Object(property, value);
24171                                     }
24172                                 }
24173                             }
24174                         }
24175                     }
24176                     else {
24177                         if (piece_2 != null && piece_2 instanceof CatalogPieceOfFurniture) {
24178                             var catalogPiece = piece_2;
24179                             _this.catalogId = catalogPiece.getId();
24180                             {
24181                                 var array = copiedProperties_3 != null ? /* asList */ copiedProperties_3.slice(0) : catalogPiece.getPropertyNames();
24182                                 for (var index = 0; index < array.length; index++) {
24183                                     var property = array[index];
24184                                     {
24185                                         var value = catalogPiece.isContentProperty(property) ? catalogPiece.getContentProperty(property) : catalogPiece.getProperty(property);
24186                                         if (value != null) {
24187                                             _this.setProperty$java_lang_String$java_lang_Object(property, value);
24188                                         }
24189                                     }
24190                                 }
24191                             }
24192                         }
24193                         _this.visible = true;
24194                         _this.widthInPlan = _this.width;
24195                         _this.depthInPlan = _this.depth;
24196                         _this.heightInPlan = _this.height;
24197                         _this.modelCenteredAtOrigin = true;
24198                         _this.x = _this.width / 2;
24199                         _this.y = _this.depth / 2;
24200                     }
24201                 }
24202                 if (_this.catalogId === undefined) {
24203                     _this.catalogId = null;
24204                 }
24205                 if (_this.name === undefined) {
24206                     _this.name = null;
24207                 }
24208                 if (_this.nameVisible === undefined) {
24209                     _this.nameVisible = false;
24210                 }
24211                 if (_this.nameXOffset === undefined) {
24212                     _this.nameXOffset = 0;
24213                 }
24214                 if (_this.nameYOffset === undefined) {
24215                     _this.nameYOffset = 0;
24216                 }
24217                 if (_this.nameStyle === undefined) {
24218                     _this.nameStyle = null;
24219                 }
24220                 if (_this.nameAngle === undefined) {
24221                     _this.nameAngle = 0;
24222                 }
24223                 if (_this.description === undefined) {
24224                     _this.description = null;
24225                 }
24226                 if (_this.information === undefined) {
24227                     _this.information = null;
24228                 }
24229                 if (_this.creator === undefined) {
24230                     _this.creator = null;
24231                 }
24232                 if (_this.license === undefined) {
24233                     _this.license = null;
24234                 }
24235                 if (_this.icon === undefined) {
24236                     _this.icon = null;
24237                 }
24238                 if (_this.planIcon === undefined) {
24239                     _this.planIcon = null;
24240                 }
24241                 if (_this.model === undefined) {
24242                     _this.model = null;
24243                 }
24244                 if (_this.modelSize === undefined) {
24245                     _this.modelSize = null;
24246                 }
24247                 if (_this.width === undefined) {
24248                     _this.width = 0;
24249                 }
24250                 if (_this.widthInPlan === undefined) {
24251                     _this.widthInPlan = 0;
24252                 }
24253                 if (_this.depth === undefined) {
24254                     _this.depth = 0;
24255                 }
24256                 if (_this.depthInPlan === undefined) {
24257                     _this.depthInPlan = 0;
24258                 }
24259                 if (_this.height === undefined) {
24260                     _this.height = 0;
24261                 }
24262                 if (_this.heightInPlan === undefined) {
24263                     _this.heightInPlan = 0;
24264                 }
24265                 if (_this.elevation === undefined) {
24266                     _this.elevation = 0;
24267                 }
24268                 if (_this.dropOnTopElevation === undefined) {
24269                     _this.dropOnTopElevation = 0;
24270                 }
24271                 if (_this.movable === undefined) {
24272                     _this.movable = false;
24273                 }
24274                 if (_this.doorOrWindow === undefined) {
24275                     _this.doorOrWindow = false;
24276                 }
24277                 if (_this.modelMaterials === undefined) {
24278                     _this.modelMaterials = null;
24279                 }
24280                 if (_this.color === undefined) {
24281                     _this.color = null;
24282                 }
24283                 if (_this.texture === undefined) {
24284                     _this.texture = null;
24285                 }
24286                 if (_this.shininess === undefined) {
24287                     _this.shininess = null;
24288                 }
24289                 if (_this.modelRotation === undefined) {
24290                     _this.modelRotation = null;
24291                 }
24292                 if (_this.modelFlags === undefined) {
24293                     _this.modelFlags = 0;
24294                 }
24295                 if (_this.modelCenteredAtOrigin === undefined) {
24296                     _this.modelCenteredAtOrigin = false;
24297                 }
24298                 if (_this.modelTransformations === undefined) {
24299                     _this.modelTransformations = null;
24300                 }
24301                 if (_this.staircaseCutOutShape === undefined) {
24302                     _this.staircaseCutOutShape = null;
24303                 }
24304                 if (_this.backFaceShown === undefined) {
24305                     _this.backFaceShown = false;
24306                 }
24307                 if (_this.resizable === undefined) {
24308                     _this.resizable = false;
24309                 }
24310                 if (_this.deformable === undefined) {
24311                     _this.deformable = false;
24312                 }
24313                 if (_this.texturable === undefined) {
24314                     _this.texturable = false;
24315                 }
24316                 if (_this.horizontallyRotatable === undefined) {
24317                     _this.horizontallyRotatable = false;
24318                 }
24319                 if (_this.price === undefined) {
24320                     _this.price = null;
24321                 }
24322                 if (_this.valueAddedTaxPercentage === undefined) {
24323                     _this.valueAddedTaxPercentage = null;
24324                 }
24325                 if (_this.currency === undefined) {
24326                     _this.currency = null;
24327                 }
24328                 if (_this.visible === undefined) {
24329                     _this.visible = false;
24330                 }
24331                 if (_this.x === undefined) {
24332                     _this.x = 0;
24333                 }
24334                 if (_this.y === undefined) {
24335                     _this.y = 0;
24336                 }
24337                 if (_this.angle === undefined) {
24338                     _this.angle = 0;
24339                 }
24340                 if (_this.pitch === undefined) {
24341                     _this.pitch = 0;
24342                 }
24343                 if (_this.roll === undefined) {
24344                     _this.roll = 0;
24345                 }
24346                 if (_this.modelMirrored === undefined) {
24347                     _this.modelMirrored = false;
24348                 }
24349                 if (_this.level === undefined) {
24350                     _this.level = null;
24351                 }
24352                 if (_this.shapeCache === undefined) {
24353                     _this.shapeCache = null;
24354                 }
24355             }
24356             if (_this.catalogId === undefined) {
24357                 _this.catalogId = null;
24358             }
24359             if (_this.name === undefined) {
24360                 _this.name = null;
24361             }
24362             if (_this.nameVisible === undefined) {
24363                 _this.nameVisible = false;
24364             }
24365             if (_this.nameXOffset === undefined) {
24366                 _this.nameXOffset = 0;
24367             }
24368             if (_this.nameYOffset === undefined) {
24369                 _this.nameYOffset = 0;
24370             }
24371             if (_this.nameStyle === undefined) {
24372                 _this.nameStyle = null;
24373             }
24374             if (_this.nameAngle === undefined) {
24375                 _this.nameAngle = 0;
24376             }
24377             if (_this.description === undefined) {
24378                 _this.description = null;
24379             }
24380             if (_this.information === undefined) {
24381                 _this.information = null;
24382             }
24383             if (_this.creator === undefined) {
24384                 _this.creator = null;
24385             }
24386             if (_this.license === undefined) {
24387                 _this.license = null;
24388             }
24389             if (_this.icon === undefined) {
24390                 _this.icon = null;
24391             }
24392             if (_this.planIcon === undefined) {
24393                 _this.planIcon = null;
24394             }
24395             if (_this.model === undefined) {
24396                 _this.model = null;
24397             }
24398             if (_this.modelSize === undefined) {
24399                 _this.modelSize = null;
24400             }
24401             if (_this.width === undefined) {
24402                 _this.width = 0;
24403             }
24404             if (_this.widthInPlan === undefined) {
24405                 _this.widthInPlan = 0;
24406             }
24407             if (_this.depth === undefined) {
24408                 _this.depth = 0;
24409             }
24410             if (_this.depthInPlan === undefined) {
24411                 _this.depthInPlan = 0;
24412             }
24413             if (_this.height === undefined) {
24414                 _this.height = 0;
24415             }
24416             if (_this.heightInPlan === undefined) {
24417                 _this.heightInPlan = 0;
24418             }
24419             if (_this.elevation === undefined) {
24420                 _this.elevation = 0;
24421             }
24422             if (_this.dropOnTopElevation === undefined) {
24423                 _this.dropOnTopElevation = 0;
24424             }
24425             if (_this.movable === undefined) {
24426                 _this.movable = false;
24427             }
24428             if (_this.doorOrWindow === undefined) {
24429                 _this.doorOrWindow = false;
24430             }
24431             if (_this.modelMaterials === undefined) {
24432                 _this.modelMaterials = null;
24433             }
24434             if (_this.color === undefined) {
24435                 _this.color = null;
24436             }
24437             if (_this.texture === undefined) {
24438                 _this.texture = null;
24439             }
24440             if (_this.shininess === undefined) {
24441                 _this.shininess = null;
24442             }
24443             if (_this.modelRotation === undefined) {
24444                 _this.modelRotation = null;
24445             }
24446             if (_this.modelFlags === undefined) {
24447                 _this.modelFlags = 0;
24448             }
24449             if (_this.modelCenteredAtOrigin === undefined) {
24450                 _this.modelCenteredAtOrigin = false;
24451             }
24452             if (_this.modelTransformations === undefined) {
24453                 _this.modelTransformations = null;
24454             }
24455             if (_this.staircaseCutOutShape === undefined) {
24456                 _this.staircaseCutOutShape = null;
24457             }
24458             if (_this.backFaceShown === undefined) {
24459                 _this.backFaceShown = false;
24460             }
24461             if (_this.resizable === undefined) {
24462                 _this.resizable = false;
24463             }
24464             if (_this.deformable === undefined) {
24465                 _this.deformable = false;
24466             }
24467             if (_this.texturable === undefined) {
24468                 _this.texturable = false;
24469             }
24470             if (_this.horizontallyRotatable === undefined) {
24471                 _this.horizontallyRotatable = false;
24472             }
24473             if (_this.price === undefined) {
24474                 _this.price = null;
24475             }
24476             if (_this.valueAddedTaxPercentage === undefined) {
24477                 _this.valueAddedTaxPercentage = null;
24478             }
24479             if (_this.currency === undefined) {
24480                 _this.currency = null;
24481             }
24482             if (_this.visible === undefined) {
24483                 _this.visible = false;
24484             }
24485             if (_this.x === undefined) {
24486                 _this.x = 0;
24487             }
24488             if (_this.y === undefined) {
24489                 _this.y = 0;
24490             }
24491             if (_this.angle === undefined) {
24492                 _this.angle = 0;
24493             }
24494             if (_this.pitch === undefined) {
24495                 _this.pitch = 0;
24496             }
24497             if (_this.roll === undefined) {
24498                 _this.roll = 0;
24499             }
24500             if (_this.modelMirrored === undefined) {
24501                 _this.modelMirrored = false;
24502             }
24503             if (_this.level === undefined) {
24504                 _this.level = null;
24505             }
24506             if (_this.shapeCache === undefined) {
24507                 _this.shapeCache = null;
24508             }
24509         }
24510         else
24511             throw new Error('invalid overload');
24512         return _this;
24513     }
24514     HomePieceOfFurniture.__static_initialize = function () { if (!HomePieceOfFurniture.__static_initialized) {
24515         HomePieceOfFurniture.__static_initialized = true;
24516         HomePieceOfFurniture.__static_initializer_0();
24517     } };
24518     HomePieceOfFurniture.TWICE_PI_$LI$ = function () { HomePieceOfFurniture.__static_initialize(); if (HomePieceOfFurniture.TWICE_PI == null) {
24519         HomePieceOfFurniture.TWICE_PI = 2 * Math.PI;
24520     } return HomePieceOfFurniture.TWICE_PI; };
24521     HomePieceOfFurniture.STRAIGHT_WALL_ANGLE_MARGIN_$LI$ = function () { HomePieceOfFurniture.__static_initialize(); if (HomePieceOfFurniture.STRAIGHT_WALL_ANGLE_MARGIN == null) {
24522         HomePieceOfFurniture.STRAIGHT_WALL_ANGLE_MARGIN = /* toRadians */ (function (x) { return x * Math.PI / 180; })(1);
24523     } return HomePieceOfFurniture.STRAIGHT_WALL_ANGLE_MARGIN; };
24524     HomePieceOfFurniture.ROUND_WALL_ANGLE_MARGIN_$LI$ = function () { HomePieceOfFurniture.__static_initialize(); if (HomePieceOfFurniture.ROUND_WALL_ANGLE_MARGIN == null) {
24525         HomePieceOfFurniture.ROUND_WALL_ANGLE_MARGIN = /* toRadians */ (function (x) { return x * Math.PI / 180; })(10);
24526     } return HomePieceOfFurniture.ROUND_WALL_ANGLE_MARGIN; };
24527     HomePieceOfFurniture.EMPTY_PROPERTY_ARRAY_$LI$ = function () { HomePieceOfFurniture.__static_initialize(); if (HomePieceOfFurniture.EMPTY_PROPERTY_ARRAY == null) {
24528         HomePieceOfFurniture.EMPTY_PROPERTY_ARRAY = [];
24529     } return HomePieceOfFurniture.EMPTY_PROPERTY_ARRAY; };
24530     HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$ = function () { HomePieceOfFurniture.__static_initialize(); return HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS; };
24531     HomePieceOfFurniture.__static_initializer_0 = function () {
24532         var collator = { compare: function (o1, o2) { return o1.toString().localeCompare(o2.toString()); }, equals: function (o1, o2) { return o1.toString().localeCompare(o2.toString()) === 0; } };
24533         HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS = ({});
24534         /* put */ (function (m, k, v) { if (m.entries == null)
24535             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24536             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24537                 m.entries[i].value = v;
24538                 return;
24539             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "CATALOG_ID", new HomePieceOfFurniture.HomePieceOfFurniture$0(collator));
24540         /* put */ (function (m, k, v) { if (m.entries == null)
24541             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24542             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24543                 m.entries[i].value = v;
24544                 return;
24545             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "NAME", new HomePieceOfFurniture.HomePieceOfFurniture$1(collator));
24546         /* put */ (function (m, k, v) { if (m.entries == null)
24547             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24548             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24549                 m.entries[i].value = v;
24550                 return;
24551             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "DESCRIPTION", new HomePieceOfFurniture.HomePieceOfFurniture$2(collator));
24552         /* put */ (function (m, k, v) { if (m.entries == null)
24553             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24554             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24555                 m.entries[i].value = v;
24556                 return;
24557             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "CREATOR", new HomePieceOfFurniture.HomePieceOfFurniture$3(collator));
24558         /* put */ (function (m, k, v) { if (m.entries == null)
24559             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24560             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24561                 m.entries[i].value = v;
24562                 return;
24563             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "LICENSE", new HomePieceOfFurniture.HomePieceOfFurniture$4(collator));
24564         /* put */ (function (m, k, v) { if (m.entries == null)
24565             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24566             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24567                 m.entries[i].value = v;
24568                 return;
24569             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "WIDTH", new HomePieceOfFurniture.HomePieceOfFurniture$5());
24570         /* put */ (function (m, k, v) { if (m.entries == null)
24571             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24572             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24573                 m.entries[i].value = v;
24574                 return;
24575             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "HEIGHT", new HomePieceOfFurniture.HomePieceOfFurniture$6());
24576         /* put */ (function (m, k, v) { if (m.entries == null)
24577             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24578             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24579                 m.entries[i].value = v;
24580                 return;
24581             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "DEPTH", new HomePieceOfFurniture.HomePieceOfFurniture$7());
24582         /* put */ (function (m, k, v) { if (m.entries == null)
24583             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24584             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24585                 m.entries[i].value = v;
24586                 return;
24587             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "MOVABLE", new HomePieceOfFurniture.HomePieceOfFurniture$8());
24588         /* put */ (function (m, k, v) { if (m.entries == null)
24589             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24590             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24591                 m.entries[i].value = v;
24592                 return;
24593             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "DOOR_OR_WINDOW", new HomePieceOfFurniture.HomePieceOfFurniture$9());
24594         /* put */ (function (m, k, v) { if (m.entries == null)
24595             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24596             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24597                 m.entries[i].value = v;
24598                 return;
24599             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "COLOR", new HomePieceOfFurniture.HomePieceOfFurniture$10());
24600         /* put */ (function (m, k, v) { if (m.entries == null)
24601             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24602             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24603                 m.entries[i].value = v;
24604                 return;
24605             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "TEXTURE", new HomePieceOfFurniture.HomePieceOfFurniture$11(collator));
24606         /* put */ (function (m, k, v) { if (m.entries == null)
24607             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24608             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24609                 m.entries[i].value = v;
24610                 return;
24611             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "VISIBLE", new HomePieceOfFurniture.HomePieceOfFurniture$12());
24612         /* put */ (function (m, k, v) { if (m.entries == null)
24613             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24614             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24615                 m.entries[i].value = v;
24616                 return;
24617             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "X", new HomePieceOfFurniture.HomePieceOfFurniture$13());
24618         /* put */ (function (m, k, v) { if (m.entries == null)
24619             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24620             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24621                 m.entries[i].value = v;
24622                 return;
24623             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "Y", new HomePieceOfFurniture.HomePieceOfFurniture$14());
24624         /* put */ (function (m, k, v) { if (m.entries == null)
24625             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24626             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24627                 m.entries[i].value = v;
24628                 return;
24629             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "ELEVATION", new HomePieceOfFurniture.HomePieceOfFurniture$15());
24630         /* put */ (function (m, k, v) { if (m.entries == null)
24631             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24632             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24633                 m.entries[i].value = v;
24634                 return;
24635             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "ANGLE", new HomePieceOfFurniture.HomePieceOfFurniture$16());
24636         /* put */ (function (m, k, v) { if (m.entries == null)
24637             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24638             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24639                 m.entries[i].value = v;
24640                 return;
24641             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "MODEL_SIZE", new HomePieceOfFurniture.HomePieceOfFurniture$17());
24642         /* put */ (function (m, k, v) { if (m.entries == null)
24643             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24644             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24645                 m.entries[i].value = v;
24646                 return;
24647             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "LEVEL", new HomePieceOfFurniture.HomePieceOfFurniture$18());
24648         /* put */ (function (m, k, v) { if (m.entries == null)
24649             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24650             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24651                 m.entries[i].value = v;
24652                 return;
24653             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "PRICE", new HomePieceOfFurniture.HomePieceOfFurniture$19());
24654         /* put */ (function (m, k, v) { if (m.entries == null)
24655             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24656             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24657                 m.entries[i].value = v;
24658                 return;
24659             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "VALUE_ADDED_TAX_PERCENTAGE", new HomePieceOfFurniture.HomePieceOfFurniture$20());
24660         /* put */ (function (m, k, v) { if (m.entries == null)
24661             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24662             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24663                 m.entries[i].value = v;
24664                 return;
24665             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "VALUE_ADDED_TAX", new HomePieceOfFurniture.HomePieceOfFurniture$21());
24666         /* put */ (function (m, k, v) { if (m.entries == null)
24667             m.entries = []; for (var i = 0; i < m.entries.length; i++)
24668             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
24669                 m.entries[i].value = v;
24670                 return;
24671             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), "PRICE_VALUE_ADDED_TAX_INCLUDED", new HomePieceOfFurniture.HomePieceOfFurniture$22());
24672     };
24673     HomePieceOfFurniture.compare$float$float = function (value1, value2) {
24674         return /* compare */ (value1 - value2);
24675     };
24676     HomePieceOfFurniture.compare$boolean$boolean = function (value1, value2) {
24677         return value1 === value2 ? 0 : (value1 ? -1 : 1);
24678     };
24679     HomePieceOfFurniture.compare$java_math_BigDecimal$java_math_BigDecimal = function (value1, value2) {
24680         if (value1 === value2) {
24681             return 0;
24682         }
24683         else if (value1 == null) {
24684             return -1;
24685         }
24686         else if (value2 == null) {
24687             return 1;
24688         }
24689         else {
24690             return /* compareTo */ value1.cmp(value2);
24691         }
24692     };
24693     HomePieceOfFurniture.compare = function (value1, value2) {
24694         if (((value1 != null && value1 instanceof Big) || value1 === null) && ((value2 != null && value2 instanceof Big) || value2 === null)) {
24695             return HomePieceOfFurniture.compare$java_math_BigDecimal$java_math_BigDecimal(value1, value2);
24696         }
24697         else if (((value1 != null && value1 instanceof Level) || value1 === null) && ((value2 != null && value2 instanceof Level) || value2 === null)) {
24698             return HomePieceOfFurniture.compare$com_eteks_sweethome3d_model_Level$com_eteks_sweethome3d_model_Level(value1, value2);
24699         }
24700         else if (((typeof value1 === 'number') || value1 === null) && ((typeof value2 === 'number') || value2 === null)) {
24701             return HomePieceOfFurniture.compare$float$float(value1, value2);
24702         }
24703         else if (((typeof value1 === 'boolean') || value1 === null) && ((typeof value2 === 'boolean') || value2 === null)) {
24704             return HomePieceOfFurniture.compare$boolean$boolean(value1, value2);
24705         }
24706         else
24707             throw new Error('invalid overload');
24708     };
24709     HomePieceOfFurniture.compare$com_eteks_sweethome3d_model_Level$com_eteks_sweethome3d_model_Level = function (level1, level2) {
24710         if (level1 === level2) {
24711             return 0;
24712         }
24713         else if (level1 == null) {
24714             return -1;
24715         }
24716         else if (level2 == null) {
24717             return 1;
24718         }
24719         else {
24720             var elevationComparison = (level1.getElevation() - level2.getElevation());
24721             if (elevationComparison !== 0) {
24722                 return elevationComparison;
24723             }
24724             else {
24725                 return level1.getElevationIndex() - level2.getElevationIndex();
24726             }
24727         }
24728     };
24729     HomePieceOfFurniture.getComparableModelSize = function (piece) {
24730         if (piece != null && piece instanceof HomeFurnitureGroup) {
24731             var biggestModelSize = null;
24732             {
24733                 var array = piece.getFurniture();
24734                 for (var index = 0; index < array.length; index++) {
24735                     var childPiece = array[index];
24736                     {
24737                         var modelSize = HomePieceOfFurniture.getComparableModelSize(childPiece);
24738                         if (modelSize != null && (biggestModelSize == null || /* longValue */ biggestModelSize < /* longValue */ modelSize)) {
24739                             biggestModelSize = modelSize;
24740                         }
24741                     }
24742                 }
24743             }
24744             return biggestModelSize;
24745         }
24746         else {
24747             return piece.modelSize;
24748         }
24749     };
24750     /**
24751      * Returns the catalog ID of this piece of furniture or <code>null</code> if it doesn't exist.
24752      * @return {string}
24753      */
24754     HomePieceOfFurniture.prototype.getCatalogId = function () {
24755         return this.catalogId;
24756     };
24757     /**
24758      * Sets the catalog ID of this piece of furniture. Once this piece is updated,
24759      * listeners added to this piece will receive a change notification.
24760      * @param {string} catalogId
24761      */
24762     HomePieceOfFurniture.prototype.setCatalogId = function (catalogId) {
24763         if (catalogId !== this.catalogId && (catalogId == null || !(catalogId === this.catalogId))) {
24764             var oldCatalogId = this.catalogId;
24765             this.catalogId = catalogId;
24766             this.firePropertyChange(/* name */ "CATALOG_ID", oldCatalogId, catalogId);
24767         }
24768     };
24769     /**
24770      * Returns the name of this piece of furniture.
24771      * @return {string}
24772      */
24773     HomePieceOfFurniture.prototype.getName = function () {
24774         return this.name;
24775     };
24776     /**
24777      * Sets the name of this piece of furniture. Once this piece is updated,
24778      * listeners added to this piece will receive a change notification.
24779      * @param {string} name
24780      */
24781     HomePieceOfFurniture.prototype.setName = function (name) {
24782         if (name !== this.name && (name == null || !(name === this.name))) {
24783             var oldName = this.name;
24784             this.name = name;
24785             this.firePropertyChange(/* name */ "NAME", oldName, name);
24786         }
24787     };
24788     /**
24789      * Returns whether the name of this piece should be drawn or not.
24790      * @return {boolean}
24791      */
24792     HomePieceOfFurniture.prototype.isNameVisible = function () {
24793         return this.nameVisible;
24794     };
24795     /**
24796      * Sets whether the name of this piece is visible or not. Once this piece of furniture
24797      * is updated, listeners added to this piece will receive a change notification.
24798      * @param {boolean} nameVisible
24799      */
24800     HomePieceOfFurniture.prototype.setNameVisible = function (nameVisible) {
24801         if (nameVisible !== this.nameVisible) {
24802             this.nameVisible = nameVisible;
24803             this.firePropertyChange(/* name */ "NAME_VISIBLE", !nameVisible, nameVisible);
24804         }
24805     };
24806     /**
24807      * Returns the distance along x axis applied to piece abscissa to display piece name.
24808      * @return {number}
24809      */
24810     HomePieceOfFurniture.prototype.getNameXOffset = function () {
24811         return this.nameXOffset;
24812     };
24813     /**
24814      * Sets the distance along x axis applied to piece abscissa to display piece name.
24815      * Once this piece is updated, listeners added to this piece will receive a change notification.
24816      * @param {number} nameXOffset
24817      */
24818     HomePieceOfFurniture.prototype.setNameXOffset = function (nameXOffset) {
24819         if (nameXOffset !== this.nameXOffset) {
24820             var oldNameXOffset = this.nameXOffset;
24821             this.nameXOffset = nameXOffset;
24822             this.firePropertyChange(/* name */ "NAME_X_OFFSET", oldNameXOffset, nameXOffset);
24823         }
24824     };
24825     /**
24826      * Returns the distance along y axis applied to piece ordinate
24827      * to display piece name.
24828      * @return {number}
24829      */
24830     HomePieceOfFurniture.prototype.getNameYOffset = function () {
24831         return this.nameYOffset;
24832     };
24833     /**
24834      * Sets the distance along y axis applied to piece ordinate to display piece name.
24835      * Once this piece is updated, listeners added to this piece will receive a change notification.
24836      * @param {number} nameYOffset
24837      */
24838     HomePieceOfFurniture.prototype.setNameYOffset = function (nameYOffset) {
24839         if (nameYOffset !== this.nameYOffset) {
24840             var oldNameYOffset = this.nameYOffset;
24841             this.nameYOffset = nameYOffset;
24842             this.firePropertyChange(/* name */ "NAME_Y_OFFSET", oldNameYOffset, nameYOffset);
24843         }
24844     };
24845     /**
24846      * Returns the text style used to display piece name.
24847      * @return {TextStyle}
24848      */
24849     HomePieceOfFurniture.prototype.getNameStyle = function () {
24850         return this.nameStyle;
24851     };
24852     /**
24853      * Sets the text style used to display piece name.
24854      * Once this piece is updated, listeners added to this piece will receive a change notification.
24855      * @param {TextStyle} nameStyle
24856      */
24857     HomePieceOfFurniture.prototype.setNameStyle = function (nameStyle) {
24858         if (nameStyle !== this.nameStyle) {
24859             var oldNameStyle = this.nameStyle;
24860             this.nameStyle = nameStyle;
24861             this.firePropertyChange(/* name */ "NAME_STYLE", oldNameStyle, nameStyle);
24862         }
24863     };
24864     /**
24865      * Returns the angle in radians used to display the piece name.
24866      * @return {number}
24867      */
24868     HomePieceOfFurniture.prototype.getNameAngle = function () {
24869         return this.nameAngle;
24870     };
24871     /**
24872      * Sets the angle in radians used to display the piece name. Once this piece is updated,
24873      * listeners added to this piece will receive a change notification.
24874      * @param {number} nameAngle
24875      */
24876     HomePieceOfFurniture.prototype.setNameAngle = function (nameAngle) {
24877         nameAngle = ((nameAngle % HomePieceOfFurniture.TWICE_PI_$LI$() + HomePieceOfFurniture.TWICE_PI_$LI$()) % HomePieceOfFurniture.TWICE_PI_$LI$());
24878         if (nameAngle !== this.nameAngle) {
24879             var oldNameAngle = this.nameAngle;
24880             this.nameAngle = nameAngle;
24881             this.firePropertyChange(/* name */ "NAME_ANGLE", oldNameAngle, nameAngle);
24882         }
24883     };
24884     /**
24885      * Returns the description of this piece of furniture.
24886      * The returned value may be <code>null</code>.
24887      * @return {string}
24888      */
24889     HomePieceOfFurniture.prototype.getDescription = function () {
24890         return this.description;
24891     };
24892     /**
24893      * Sets the description of this piece of furniture. Once this piece is updated,
24894      * listeners added to this piece will receive a change notification.
24895      * @param {string} description
24896      */
24897     HomePieceOfFurniture.prototype.setDescription = function (description) {
24898         if (description !== this.description && (description == null || !(description === this.description))) {
24899             var oldDescription = this.description;
24900             this.description = description;
24901             this.firePropertyChange(/* name */ "DESCRIPTION", oldDescription, description);
24902         }
24903     };
24904     /**
24905      * Returns the additional information associated to this piece, or <code>null</code>.
24906      * @return {string}
24907      */
24908     HomePieceOfFurniture.prototype.getInformation = function () {
24909         return this.information;
24910     };
24911     /**
24912      * Sets the additional information associated to this piece . Once this piece is updated,
24913      * listeners added to this piece will receive a change notification.
24914      * @param {string} information
24915      */
24916     HomePieceOfFurniture.prototype.setInformation = function (information) {
24917         if (information !== this.information && (information == null || !(information === this.information))) {
24918             var oldInformation = this.information;
24919             this.information = information;
24920             this.firePropertyChange(/* name */ "INFORMATION", oldInformation, information);
24921         }
24922     };
24923     /**
24924      * Returns the creator of this piece.
24925      * @return {string}
24926      */
24927     HomePieceOfFurniture.prototype.getCreator = function () {
24928         return this.creator;
24929     };
24930     /**
24931      * Sets the creator of this piece. Once this piece is updated, listeners added to this piece
24932      * will receive a change notification.
24933      * @param {string} creator
24934      */
24935     HomePieceOfFurniture.prototype.setCreator = function (creator) {
24936         if (creator !== this.creator && (creator == null || !(creator === this.creator))) {
24937             var oldCreator = this.creator;
24938             this.creator = creator;
24939             this.firePropertyChange(/* name */ "CREATOR", oldCreator, creator);
24940         }
24941     };
24942     /**
24943      * Returns the license of this piece, or <code>null</code>.
24944      * @return {string}
24945      */
24946     HomePieceOfFurniture.prototype.getLicense = function () {
24947         return this.license;
24948     };
24949     /**
24950      * Sets the the license of this piece . Once this piece is updated,
24951      * listeners added to this piece will receive a change notification.
24952      * @param {string} license
24953      */
24954     HomePieceOfFurniture.prototype.setLicense = function (license) {
24955         if (license !== this.license && (license == null || !(license === this.license))) {
24956             var oldLicense = this.license;
24957             this.license = license;
24958             this.firePropertyChange(/* name */ "LICENSE", oldLicense, license);
24959         }
24960     };
24961     /**
24962      * Returns the depth of this piece of furniture.
24963      * @return {number}
24964      */
24965     HomePieceOfFurniture.prototype.getDepth = function () {
24966         return this.depth;
24967     };
24968     /**
24969      * Sets the depth of this piece of furniture. Once this piece is updated,
24970      * listeners added to this piece will receive a change notification.
24971      * @throws IllegalStateException if this piece of furniture isn't resizable
24972      * @param {number} depth
24973      */
24974     HomePieceOfFurniture.prototype.setDepth = function (depth) {
24975         if (this.isResizable()) {
24976             if (depth !== this.depth) {
24977                 var oldDepth = this.depth;
24978                 this.depth = depth;
24979                 this.shapeCache = null;
24980                 this.firePropertyChange(/* name */ "DEPTH", oldDepth, depth);
24981             }
24982         }
24983         else {
24984             throw new IllegalStateException("Piece isn\'t resizable");
24985         }
24986     };
24987     /**
24988      * Returns the depth of this piece of furniture in the horizontal plan (after pitch or roll is applied to it).
24989      * @return {number}
24990      */
24991     HomePieceOfFurniture.prototype.getDepthInPlan = function () {
24992         return this.depthInPlan;
24993     };
24994     /**
24995      * Sets the depth of this piece of furniture in the horizontal plan (after pitch or roll is applied to it).
24996      * listeners added to this piece will receive a change notification.
24997      * @param {number} depthInPlan
24998      */
24999     HomePieceOfFurniture.prototype.setDepthInPlan = function (depthInPlan) {
25000         if (depthInPlan !== this.depthInPlan) {
25001             var oldDepth = this.depthInPlan;
25002             this.depthInPlan = depthInPlan;
25003             this.shapeCache = null;
25004             this.firePropertyChange(/* name */ "DEPTH_IN_PLAN", oldDepth, depthInPlan);
25005         }
25006     };
25007     /**
25008      * Returns the height of this piece of furniture.
25009      * @return {number}
25010      */
25011     HomePieceOfFurniture.prototype.getHeight = function () {
25012         return this.height;
25013     };
25014     /**
25015      * Sets the height of this piece of furniture. Once this piece is updated,
25016      * listeners added to this piece will receive a change notification.
25017      * @throws IllegalStateException if this piece of furniture isn't resizable
25018      * @param {number} height
25019      */
25020     HomePieceOfFurniture.prototype.setHeight = function (height) {
25021         if (this.isResizable()) {
25022             if (height !== this.height) {
25023                 var oldHeight = this.height;
25024                 this.height = height;
25025                 this.firePropertyChange(/* name */ "HEIGHT", oldHeight, height);
25026             }
25027         }
25028         else {
25029             throw new IllegalStateException("Piece isn\'t resizable");
25030         }
25031     };
25032     /**
25033      * Returns the height of this piece of furniture from the horizontal plan (after pitch or roll is applied to it).
25034      * @return {number}
25035      */
25036     HomePieceOfFurniture.prototype.getHeightInPlan = function () {
25037         return this.heightInPlan;
25038     };
25039     /**
25040      * Sets the height of this piece of furniture from the horizontal plan (after pitch or roll is applied to it).
25041      * Once this piece is updated, listeners added to this piece will receive a change notification.
25042      * @param {number} heightInPlan
25043      */
25044     HomePieceOfFurniture.prototype.setHeightInPlan = function (heightInPlan) {
25045         if (heightInPlan !== this.heightInPlan) {
25046             var oldHeight = this.heightInPlan;
25047             this.heightInPlan = heightInPlan;
25048             this.firePropertyChange(/* name */ "HEIGHT_IN_PLAN", oldHeight, heightInPlan);
25049         }
25050     };
25051     /**
25052      * Returns the width of this piece of furniture.
25053      * @return {number}
25054      */
25055     HomePieceOfFurniture.prototype.getWidth = function () {
25056         return this.width;
25057     };
25058     /**
25059      * Sets the width of this piece of furniture. Once this piece is updated,
25060      * listeners added to this piece will receive a change notification.
25061      * @throws IllegalStateException if this piece of furniture isn't resizable
25062      * @param {number} width
25063      */
25064     HomePieceOfFurniture.prototype.setWidth = function (width) {
25065         if (this.isResizable()) {
25066             if (width !== this.width) {
25067                 var oldWidth = this.width;
25068                 this.width = width;
25069                 this.shapeCache = null;
25070                 this.firePropertyChange(/* name */ "WIDTH", oldWidth, width);
25071             }
25072         }
25073         else {
25074             throw new IllegalStateException("Piece isn\'t resizable");
25075         }
25076     };
25077     /**
25078      * Returns the width of this piece of furniture in the horizontal plan (after pitch or roll is applied to it).
25079      * @return {number}
25080      */
25081     HomePieceOfFurniture.prototype.getWidthInPlan = function () {
25082         return this.widthInPlan;
25083     };
25084     /**
25085      * Sets the width of this piece of furniture in the horizontal plan (after pitch or roll is applied to it).
25086      * Once this piece is updated, listeners added to this piece will receive a change notification.
25087      * @param {number} widthInPlan
25088      */
25089     HomePieceOfFurniture.prototype.setWidthInPlan = function (widthInPlan) {
25090         if (widthInPlan !== this.widthInPlan) {
25091             var oldWidth = this.widthInPlan;
25092             this.widthInPlan = widthInPlan;
25093             this.shapeCache = null;
25094             this.firePropertyChange(/* name */ "WIDTH_IN_PLAN", oldWidth, widthInPlan);
25095         }
25096     };
25097     /**
25098      * Scales this piece of furniture with the given <code>scale</code>.
25099      * Once this piece is updated, listeners added to this piece will receive a change notification.
25100      * @param {number} scale
25101      */
25102     HomePieceOfFurniture.prototype.scale = function (scale) {
25103         this.setWidth(this.getWidth() * scale);
25104         this.setDepth(this.getDepth() * scale);
25105         this.setHeight(this.getHeight() * scale);
25106     };
25107     /**
25108      * Returns the elevation of the bottom of this piece of furniture on its level.
25109      * @return {number}
25110      */
25111     HomePieceOfFurniture.prototype.getElevation = function () {
25112         return this.elevation;
25113     };
25114     /**
25115      * Returns the elevation at which should be placed an object dropped on this piece.
25116      * @return {number} a percentage of the height of this piece. A negative value means that the piece
25117      * should be ignored when an object is dropped on it.
25118      */
25119     HomePieceOfFurniture.prototype.getDropOnTopElevation = function () {
25120         return this.dropOnTopElevation;
25121     };
25122     /**
25123      * Returns the elevation of the bottom of this piece of furniture
25124      * from the ground according to the elevation of its level.
25125      * @return {number}
25126      */
25127     HomePieceOfFurniture.prototype.getGroundElevation = function () {
25128         if (this.level != null) {
25129             return this.elevation + this.level.getElevation();
25130         }
25131         else {
25132             return this.elevation;
25133         }
25134     };
25135     /**
25136      * Sets the elevation of this piece of furniture on its level. Once this piece is updated,
25137      * listeners added to this piece will receive a change notification.
25138      * @param {number} elevation
25139      */
25140     HomePieceOfFurniture.prototype.setElevation = function (elevation) {
25141         if (elevation !== this.elevation) {
25142             var oldElevation = this.elevation;
25143             this.elevation = elevation;
25144             this.firePropertyChange(/* name */ "ELEVATION", oldElevation, elevation);
25145         }
25146     };
25147     /**
25148      * Returns <code>true</code> if this piece of furniture is movable.
25149      * @return {boolean}
25150      */
25151     HomePieceOfFurniture.prototype.isMovable = function () {
25152         return this.movable;
25153     };
25154     /**
25155      * Sets whether this piece is movable or not.
25156      * @param {boolean} movable
25157      */
25158     HomePieceOfFurniture.prototype.setMovable = function (movable) {
25159         if (movable !== this.movable) {
25160             this.movable = movable;
25161             this.firePropertyChange(/* name */ "MOVABLE", !movable, movable);
25162         }
25163     };
25164     /**
25165      * Returns <code>true</code> if this piece of furniture is a door or a window.
25166      * As this method existed before {@linkplain HomeDoorOrWindow HomeDoorOrWindow} class,
25167      * you shouldn't rely on the value returned by this method to guess if a piece
25168      * is an instance of <code>DoorOrWindow</code> class.
25169      * @return {boolean}
25170      */
25171     HomePieceOfFurniture.prototype.isDoorOrWindow = function () {
25172         return this.doorOrWindow;
25173     };
25174     /**
25175      * Returns the icon of this piece of furniture.
25176      * @return {Object}
25177      */
25178     HomePieceOfFurniture.prototype.getIcon = function () {
25179         return this.icon;
25180     };
25181     /**
25182      * Sets the icon of this piece of furniture. Once this piece is updated,
25183      * listeners added to this piece will receive a change notification.
25184      * @param {Object} icon
25185      */
25186     HomePieceOfFurniture.prototype.setIcon = function (icon) {
25187         if (icon !== this.icon && (icon == null || !(function (o1, o2) { if (o1 && o1.equals) {
25188             return o1.equals(o2);
25189         }
25190         else {
25191             return o1 === o2;
25192         } })(icon, this.icon))) {
25193             var oldIcon = this.icon;
25194             this.icon = icon;
25195             this.firePropertyChange(/* name */ "ICON", oldIcon, icon);
25196         }
25197     };
25198     /**
25199      * Returns the icon of this piece of furniture displayed in plan or <code>null</code>.
25200      * @return {Object}
25201      */
25202     HomePieceOfFurniture.prototype.getPlanIcon = function () {
25203         return this.planIcon;
25204     };
25205     /**
25206      * Sets the plan icon of this piece of furniture. Once this piece is updated,
25207      * listeners added to this piece will receive a change notification.
25208      * @param {Object} planIcon
25209      */
25210     HomePieceOfFurniture.prototype.setPlanIcon = function (planIcon) {
25211         if (planIcon !== this.planIcon && (planIcon == null || !(function (o1, o2) { if (o1 && o1.equals) {
25212             return o1.equals(o2);
25213         }
25214         else {
25215             return o1 === o2;
25216         } })(planIcon, this.planIcon))) {
25217             var oldPlanIcon = this.planIcon;
25218             this.planIcon = planIcon;
25219             this.firePropertyChange(/* name */ "PLAN_ICON", oldPlanIcon, planIcon);
25220         }
25221     };
25222     /**
25223      * Returns the 3D model of this piece of furniture.
25224      * @return {Object}
25225      */
25226     HomePieceOfFurniture.prototype.getModel = function () {
25227         return this.model;
25228     };
25229     /**
25230      * Sets the 3D model of this piece of furniture. Once this piece is updated,
25231      * listeners added to this piece will receive a change notification.
25232      * @param {Object} model
25233      */
25234     HomePieceOfFurniture.prototype.setModel = function (model) {
25235         if (model !== this.model && (model == null || !(function (o1, o2) { if (o1 && o1.equals) {
25236             return o1.equals(o2);
25237         }
25238         else {
25239             return o1 === o2;
25240         } })(model, this.model))) {
25241             var oldModel = this.model;
25242             this.model = model;
25243             this.firePropertyChange(/* name */ "MODEL", oldModel, model);
25244         }
25245     };
25246     /**
25247      * Returns the size of the 3D model of this piece of furniture.
25248      * @return {number}
25249      */
25250     HomePieceOfFurniture.prototype.getModelSize = function () {
25251         return this.modelSize;
25252     };
25253     /**
25254      * Sets the size of the 3D model of this piece of furniture.
25255      * This method should be called only to update a piece created with an older version.
25256      * @param {number} modelSize
25257      */
25258     HomePieceOfFurniture.prototype.setModelSize = function (modelSize) {
25259         this.modelSize = modelSize;
25260     };
25261     /**
25262      * Returns the materials applied to the 3D model of this piece of furniture.
25263      * @return {com.eteks.sweethome3d.model.HomeMaterial[]} the materials of the 3D model or <code>null</code>
25264      * if the individual materials of the 3D model are not modified.
25265      */
25266     HomePieceOfFurniture.prototype.getModelMaterials = function () {
25267         if (this.modelMaterials != null) {
25268             return /* clone */ this.modelMaterials.slice(0);
25269         }
25270         else {
25271             return null;
25272         }
25273     };
25274     /**
25275      * Sets the materials of the 3D model of this piece of furniture.
25276      * Once this piece is updated, listeners added to this piece will receive a change notification.
25277      * @param {com.eteks.sweethome3d.model.HomeMaterial[]} modelMaterials the materials of the 3D model or <code>null</code> if they shouldn't be changed
25278      * @throws IllegalStateException if this piece of furniture isn't texturable
25279      */
25280     HomePieceOfFurniture.prototype.setModelMaterials = function (modelMaterials) {
25281         if (this.isTexturable()) {
25282             if (!(function (a1, a2) { if (a1 == null && a2 == null)
25283                 return true; if (a1 == null || a2 == null)
25284                 return false; if (a1.length != a2.length)
25285                 return false; for (var i = 0; i < a1.length; i++) {
25286                 if (a1[i] != a2[i])
25287                     return false;
25288             } return true; })(modelMaterials, this.modelMaterials)) {
25289                 var oldModelMaterials = this.modelMaterials;
25290                 this.modelMaterials = modelMaterials != null ? /* clone */ modelMaterials.slice(0) : null;
25291                 this.firePropertyChange(/* name */ "MODEL_MATERIALS", oldModelMaterials, modelMaterials);
25292             }
25293         }
25294         else {
25295             throw new IllegalStateException("Piece isn\'t texturable");
25296         }
25297     };
25298     /**
25299      * Returns the color of this piece of furniture.
25300      * @return {number} the color of the piece as RGB code or <code>null</code> if piece color is unchanged.
25301      */
25302     HomePieceOfFurniture.prototype.getColor = function () {
25303         return this.color;
25304     };
25305     /**
25306      * Sets the color of this piece of furniture.
25307      * Once this piece is updated, listeners added to this piece will receive a change notification.
25308      * @param {number} color the color of this piece of furniture or <code>null</code> if piece color is the default one
25309      * @throws IllegalStateException if this piece of furniture isn't texturable
25310      */
25311     HomePieceOfFurniture.prototype.setColor = function (color) {
25312         if (this.isTexturable()) {
25313             if (color !== this.color && (color == null || !(color === this.color))) {
25314                 var oldColor = this.color;
25315                 this.color = color;
25316                 this.firePropertyChange(/* name */ "COLOR", oldColor, color);
25317             }
25318         }
25319         else {
25320             throw new IllegalStateException("Piece isn\'t texturable");
25321         }
25322     };
25323     /**
25324      * Returns the texture of this piece of furniture.
25325      * @return {HomeTexture} the texture of the piece or <code>null</code> if piece texture is unchanged.
25326      */
25327     HomePieceOfFurniture.prototype.getTexture = function () {
25328         return this.texture;
25329     };
25330     /**
25331      * Sets the texture of this piece of furniture.
25332      * Once this piece is updated, listeners added to this piece will receive a change notification.
25333      * @param {HomeTexture} texture the texture of this piece of furniture or <code>null</code> if piece texture is the default one
25334      * @throws IllegalStateException if this piece of furniture isn't texturable
25335      */
25336     HomePieceOfFurniture.prototype.setTexture = function (texture) {
25337         if (this.isTexturable()) {
25338             if (texture !== this.texture && (texture == null || !texture.equals(this.texture))) {
25339                 var oldTexture = this.texture;
25340                 this.texture = texture;
25341                 this.firePropertyChange(/* name */ "TEXTURE", oldTexture, texture);
25342             }
25343         }
25344         else {
25345             throw new IllegalStateException("Piece isn\'t texturable");
25346         }
25347     };
25348     /**
25349      * Returns the shininess of this piece of furniture.
25350      * @return {number} a value between 0 (matt) and 1 (very shiny) or <code>null</code> if piece shininess is unchanged.
25351      */
25352     HomePieceOfFurniture.prototype.getShininess = function () {
25353         return this.shininess;
25354     };
25355     /**
25356      * Sets the shininess of this piece of furniture or <code>null</code> if piece shininess is unchanged.
25357      * Once this piece is updated, listeners added to this piece will receive a change notification.
25358      * @throws IllegalStateException if this piece of furniture isn't texturable
25359      * @param {number} shininess
25360      */
25361     HomePieceOfFurniture.prototype.setShininess = function (shininess) {
25362         if (this.isTexturable()) {
25363             if (shininess !== this.shininess && (shininess == null || !(shininess === this.shininess))) {
25364                 var oldShininess = this.shininess;
25365                 this.shininess = shininess;
25366                 this.firePropertyChange(/* name */ "SHININESS", oldShininess, shininess);
25367             }
25368         }
25369         else {
25370             throw new IllegalStateException("Piece isn\'t texturable");
25371         }
25372     };
25373     /**
25374      * Returns <code>true</code> if this piece is resizable.
25375      * @return {boolean}
25376      */
25377     HomePieceOfFurniture.prototype.isResizable = function () {
25378         return this.resizable;
25379     };
25380     /**
25381      * Returns <code>true</code> if this piece is deformable.
25382      * @return {boolean}
25383      */
25384     HomePieceOfFurniture.prototype.isDeformable = function () {
25385         return this.deformable;
25386     };
25387     /**
25388      * Returns <code>true</code> if this piece is deformable.
25389      * @return {boolean}
25390      */
25391     HomePieceOfFurniture.prototype.isWidthDepthDeformable = function () {
25392         return this.isDeformable();
25393     };
25394     /**
25395      * Returns <code>false</code> if this piece should always keep the same color or texture.
25396      * @return {boolean}
25397      */
25398     HomePieceOfFurniture.prototype.isTexturable = function () {
25399         return this.texturable;
25400     };
25401     /**
25402      * Returns <code>false</code> if this piece should not rotate around an horizontal axis.
25403      * @return {boolean}
25404      */
25405     HomePieceOfFurniture.prototype.isHorizontallyRotatable = function () {
25406         return this.horizontallyRotatable;
25407     };
25408     /**
25409      * Returns the price of this piece of furniture or <code>null</code>.
25410      * @return {Big}
25411      */
25412     HomePieceOfFurniture.prototype.getPrice = function () {
25413         return this.price;
25414     };
25415     /**
25416      * Sets the price of this piece of furniture. Once this piece is updated,
25417      * listeners added to this piece will receive a change notification.
25418      * @param {Big} price
25419      */
25420     HomePieceOfFurniture.prototype.setPrice = function (price) {
25421         if (price !== this.price && (price == null || !((this.price) != null ? price.eq(this.price) : (price === (this.price))))) {
25422             var oldPrice = this.price;
25423             this.price = price;
25424             this.firePropertyChange(/* name */ "PRICE", oldPrice, price);
25425         }
25426     };
25427     /**
25428      * Returns the Value Added Tax percentage applied to the price of this piece of furniture.
25429      * @return {Big}
25430      */
25431     HomePieceOfFurniture.prototype.getValueAddedTaxPercentage = function () {
25432         return this.valueAddedTaxPercentage;
25433     };
25434     /**
25435      * Sets the Value Added Tax percentage applied to prices.
25436      * @param {Big} valueAddedTaxPercentage
25437      */
25438     HomePieceOfFurniture.prototype.setValueAddedTaxPercentage = function (valueAddedTaxPercentage) {
25439         if (valueAddedTaxPercentage !== this.valueAddedTaxPercentage && (valueAddedTaxPercentage == null || !((this.valueAddedTaxPercentage) != null ? valueAddedTaxPercentage.eq(this.valueAddedTaxPercentage) : (valueAddedTaxPercentage === (this.valueAddedTaxPercentage))))) {
25440             var oldValueAddedTaxPercentage = this.valueAddedTaxPercentage;
25441             this.valueAddedTaxPercentage = valueAddedTaxPercentage;
25442             this.firePropertyChange(/* name */ "VALUE_ADDED_TAX_PERCENTAGE", oldValueAddedTaxPercentage, valueAddedTaxPercentage);
25443         }
25444     };
25445     /**
25446      * Returns the Value Added Tax applied to the price of this piece of furniture.
25447      * @return {Big}
25448      */
25449     HomePieceOfFurniture.prototype.getValueAddedTax = function () {
25450         if (this.price != null && this.valueAddedTaxPercentage != null) {
25451             return /* setScale */ /* multiply */ this.price.times(this.valueAddedTaxPercentage).round(/* scale */ 2);
25452         }
25453         else {
25454             return null;
25455         }
25456     };
25457     /**
25458      * Returns the price of this piece of furniture, Value Added Tax included.
25459      * @return {Big}
25460      */
25461     HomePieceOfFurniture.prototype.getPriceValueAddedTaxIncluded = function () {
25462         if (this.price != null && this.valueAddedTaxPercentage != null) {
25463             return /* add */ this.price.plus(this.getValueAddedTax());
25464         }
25465         else {
25466             return this.price;
25467         }
25468     };
25469     /**
25470      * Returns the price currency, noted with ISO 4217 code, or <code>null</code>
25471      * if it has no price or default currency should be used.
25472      * @return {string}
25473      */
25474     HomePieceOfFurniture.prototype.getCurrency = function () {
25475         return this.currency;
25476     };
25477     /**
25478      * Sets the price currency, noted with ISO 4217 code. Once this piece is updated,
25479      * listeners added to this piece will receive a change notification.
25480      * @param {string} currency
25481      */
25482     HomePieceOfFurniture.prototype.setCurrency = function (currency) {
25483         if (currency !== this.currency && (currency == null || !(currency === this.currency))) {
25484             var oldCurrency = this.currency;
25485             this.currency = currency;
25486             this.firePropertyChange(/* name */ "CURRENCY", oldCurrency, currency);
25487         }
25488     };
25489     /**
25490      * Returns <code>true</code> if this piece of furniture is visible.
25491      * @return {boolean}
25492      */
25493     HomePieceOfFurniture.prototype.isVisible = function () {
25494         return this.visible;
25495     };
25496     /**
25497      * Sets whether this piece of furniture is visible or not. Once this piece is updated,
25498      * listeners added to this piece will receive a change notification.
25499      * @param {boolean} visible
25500      */
25501     HomePieceOfFurniture.prototype.setVisible = function (visible) {
25502         if (visible !== this.visible) {
25503             this.visible = visible;
25504             this.firePropertyChange(/* name */ "VISIBLE", !visible, visible);
25505         }
25506     };
25507     /**
25508      * Returns the abscissa of the center of this piece of furniture.
25509      * @return {number}
25510      */
25511     HomePieceOfFurniture.prototype.getX = function () {
25512         return this.x;
25513     };
25514     /**
25515      * Sets the abscissa of the center of this piece. Once this piece is updated,
25516      * listeners added to this piece will receive a change notification.
25517      * @param {number} x
25518      */
25519     HomePieceOfFurniture.prototype.setX = function (x) {
25520         if (x !== this.x) {
25521             var oldX = this.x;
25522             this.x = x;
25523             this.shapeCache = null;
25524             this.firePropertyChange(/* name */ "X", oldX, x);
25525         }
25526     };
25527     /**
25528      * Returns the ordinate of the center of this piece of furniture.
25529      * @return {number}
25530      */
25531     HomePieceOfFurniture.prototype.getY = function () {
25532         return this.y;
25533     };
25534     /**
25535      * Sets the ordinate of the center of this piece. Once this piece is updated,
25536      * listeners added to this piece will receive a change notification.
25537      * @param {number} y
25538      */
25539     HomePieceOfFurniture.prototype.setY = function (y) {
25540         if (y !== this.y) {
25541             var oldY = this.y;
25542             this.y = y;
25543             this.shapeCache = null;
25544             this.firePropertyChange(/* name */ "Y", oldY, y);
25545         }
25546     };
25547     /**
25548      * Returns the angle in radians of this piece around vertical axis.
25549      * @return {number}
25550      */
25551     HomePieceOfFurniture.prototype.getAngle = function () {
25552         return this.angle;
25553     };
25554     /**
25555      * Sets the angle of this piece around vertical axis. Once this piece is updated,
25556      * listeners added to this piece will receive a change notification.
25557      * @param {number} angle
25558      */
25559     HomePieceOfFurniture.prototype.setAngle = function (angle) {
25560         angle = ((angle % HomePieceOfFurniture.TWICE_PI_$LI$() + HomePieceOfFurniture.TWICE_PI_$LI$()) % HomePieceOfFurniture.TWICE_PI_$LI$());
25561         if (angle !== this.angle) {
25562             var oldAngle = this.angle;
25563             this.angle = angle;
25564             this.shapeCache = null;
25565             this.firePropertyChange(/* name */ "ANGLE", oldAngle, angle);
25566         }
25567     };
25568     /**
25569      * Returns the pitch angle in radians of this piece of furniture.
25570      * @return {number}
25571      */
25572     HomePieceOfFurniture.prototype.getPitch = function () {
25573         return this.pitch;
25574     };
25575     /**
25576      * Sets the pitch angle in radians of this piece and notifies listeners of this change.
25577      * Pitch axis is horizontal lateral (or transverse) axis.
25578      * @param {number} pitch
25579      */
25580     HomePieceOfFurniture.prototype.setPitch = function (pitch) {
25581         if (this.isHorizontallyRotatable()) {
25582             pitch = ((pitch % HomePieceOfFurniture.TWICE_PI_$LI$() + HomePieceOfFurniture.TWICE_PI_$LI$()) % HomePieceOfFurniture.TWICE_PI_$LI$());
25583             if (pitch !== this.pitch) {
25584                 var oldPitch = this.pitch;
25585                 this.pitch = pitch;
25586                 this.shapeCache = null;
25587                 this.firePropertyChange(/* name */ "PITCH", oldPitch, pitch);
25588             }
25589         }
25590         else {
25591             throw new IllegalStateException("Piece can\'t be rotated around an horizontal axis");
25592         }
25593     };
25594     /**
25595      * Returns the roll angle in radians of this piece of furniture.
25596      * @return {number}
25597      */
25598     HomePieceOfFurniture.prototype.getRoll = function () {
25599         return this.roll;
25600     };
25601     /**
25602      * Sets the roll angle in radians of this piece and notifies listeners of this change.
25603      * Roll axis is horizontal longitudinal axis.
25604      * @param {number} roll
25605      */
25606     HomePieceOfFurniture.prototype.setRoll = function (roll) {
25607         if (this.isHorizontallyRotatable()) {
25608             roll = ((roll % HomePieceOfFurniture.TWICE_PI_$LI$() + HomePieceOfFurniture.TWICE_PI_$LI$()) % HomePieceOfFurniture.TWICE_PI_$LI$());
25609             if (roll !== this.roll) {
25610                 var oldRoll = this.roll;
25611                 this.roll = roll;
25612                 this.shapeCache = null;
25613                 this.firePropertyChange(/* name */ "ROLL", oldRoll, roll);
25614             }
25615         }
25616         else {
25617             throw new IllegalStateException("Piece can\'t be rotated around an horizontal axis");
25618         }
25619     };
25620     /**
25621      * Returns <code>true</code> if the pitch or roll angle of this piece is different from 0.
25622      * @return {boolean}
25623      */
25624     HomePieceOfFurniture.prototype.isHorizontallyRotated = function () {
25625         return this.roll !== 0 || this.pitch !== 0;
25626     };
25627     /**
25628      * Returns the rotation 3 by 3 matrix of this piece of furniture that ensures
25629      * its model is correctly oriented.
25630      * @return {float[][]}
25631      */
25632     HomePieceOfFurniture.prototype.getModelRotation = function () {
25633         return CatalogPieceOfFurniture.deepClone(this.modelRotation);
25634     };
25635     /**
25636      * Sets the rotation 3 by 3 matrix of this piece of furniture and notifies listeners of this change.
25637      * @param {float[][]} modelRotation
25638      */
25639     HomePieceOfFurniture.prototype.setModelRotation = function (modelRotation) {
25640         if (!(JSON.stringify(modelRotation) === JSON.stringify(this.modelRotation))) {
25641             var oldModelRotation = CatalogPieceOfFurniture.deepClone(this.modelRotation);
25642             this.modelRotation = CatalogPieceOfFurniture.deepClone(modelRotation);
25643             this.firePropertyChange(/* name */ "MODEL_ROTATION", oldModelRotation, modelRotation);
25644         }
25645     };
25646     /**
25647      * Returns <code>true</code> if the model of this piece should be mirrored.
25648      * @return {boolean}
25649      */
25650     HomePieceOfFurniture.prototype.isModelMirrored = function () {
25651         return this.modelMirrored;
25652     };
25653     /**
25654      * Sets whether the model of this piece of furniture is mirrored or not. Once this piece is updated,
25655      * listeners added to this piece will receive a change notification.
25656      * @throws IllegalStateException if this piece of furniture isn't resizable
25657      * @param {boolean} modelMirrored
25658      */
25659     HomePieceOfFurniture.prototype.setModelMirrored = function (modelMirrored) {
25660         if (this.isResizable()) {
25661             if (modelMirrored !== this.modelMirrored) {
25662                 this.modelMirrored = modelMirrored;
25663                 this.firePropertyChange(/* name */ "MODEL_MIRRORED", !modelMirrored, modelMirrored);
25664             }
25665         }
25666         else {
25667             throw new IllegalStateException("Piece isn\'t resizable");
25668         }
25669     };
25670     /**
25671      * Returns <code>true</code> if model center should be always centered at the origin
25672      * when model rotation isn't <code>null</code>.
25673      * @return {boolean} <code>false</code> by default if version < 5.5
25674      */
25675     HomePieceOfFurniture.prototype.isModelCenteredAtOrigin = function () {
25676         return this.modelCenteredAtOrigin;
25677     };
25678     /**
25679      * Sets whether model center should be always centered at the origin
25680      * when model rotation isn't <code>null</code>.
25681      * This method should be called only to keep unchanged the (wrong) location
25682      * of a rotated model created with version < 5.5.
25683      * @param {boolean} modelCenteredAtOrigin
25684      */
25685     HomePieceOfFurniture.prototype.setModelCenteredAtOrigin = function (modelCenteredAtOrigin) {
25686         this.modelCenteredAtOrigin = modelCenteredAtOrigin;
25687     };
25688     /**
25689      * Returns <code>true</code> if the back face of the piece of furniture
25690      * model should be displayed.
25691      * @return {boolean}
25692      */
25693     HomePieceOfFurniture.prototype.isBackFaceShown = function () {
25694         return (this.modelFlags & PieceOfFurniture.SHOW_BACK_FACE) === PieceOfFurniture.SHOW_BACK_FACE;
25695     };
25696     /**
25697      * Sets whether the back face of the piece of furniture model should be displayed.
25698      * Once this piece is updated, listeners added to this piece will receive a change notification.
25699      * @deprecated Prefer use {@link #setModelFlags} with {@link #SHOW_BACK_FACE} flag.
25700      * @param {boolean} backFaceShown
25701      */
25702     HomePieceOfFurniture.prototype.setBackFaceShown = function (backFaceShown) {
25703         this.setModelFlags((this.getModelFlags() & ~PieceOfFurniture.SHOW_BACK_FACE) | (backFaceShown ? PieceOfFurniture.SHOW_BACK_FACE : 0));
25704     };
25705     /**
25706      * Returns the flags applied to the piece of furniture model.
25707      * @return {number}
25708      */
25709     HomePieceOfFurniture.prototype.getModelFlags = function () {
25710         return this.modelFlags;
25711     };
25712     /**
25713      * Sets the flags applied to the piece of furniture model.
25714      * Once this piece is updated, listeners added to this piece will receive a change notification.
25715      * @param {number} modelFlags
25716      */
25717     HomePieceOfFurniture.prototype.setModelFlags = function (modelFlags) {
25718         if (modelFlags !== this.modelFlags) {
25719             var oldModelFlags = this.modelFlags;
25720             this.modelFlags = modelFlags;
25721             this.backFaceShown = (modelFlags & PieceOfFurniture.SHOW_BACK_FACE) === PieceOfFurniture.SHOW_BACK_FACE;
25722             this.firePropertyChange(/* name */ "MODEL_FLAGS", oldModelFlags, modelFlags);
25723         }
25724     };
25725     /**
25726      * Returns the transformations applied to the 3D model of this piece of furniture.
25727      * @return {com.eteks.sweethome3d.model.Transformation[]} the transformations of the 3D model or <code>null</code>
25728      * if the 3D model is not transformed.
25729      */
25730     HomePieceOfFurniture.prototype.getModelTransformations = function () {
25731         if (this.modelTransformations != null) {
25732             return /* clone */ this.modelTransformations.slice(0);
25733         }
25734         else {
25735             return null;
25736         }
25737     };
25738     /**
25739      * Sets the transformations applied to some parts of the 3D model of this piece of furniture.
25740      * Once this piece is updated, listeners added to this piece will receive a change notification.
25741      * @param {com.eteks.sweethome3d.model.Transformation[]} modelTransformations the transformations of the 3D model or <code>null</code> if no transformation shouldn't be applied
25742      */
25743     HomePieceOfFurniture.prototype.setModelTransformations = function (modelTransformations) {
25744         if (!(function (a1, a2) { if (a1 == null && a2 == null)
25745             return true; if (a1 == null || a2 == null)
25746             return false; if (a1.length != a2.length)
25747             return false; for (var i = 0; i < a1.length; i++) {
25748             if (a1[i] != a2[i])
25749                 return false;
25750         } return true; })(modelTransformations, this.modelTransformations)) {
25751             var oldModelTransformations = this.modelTransformations;
25752             this.modelTransformations = modelTransformations != null && modelTransformations.length > 0 ? /* clone */ modelTransformations.slice(0) : null;
25753             this.firePropertyChange(/* name */ "MODEL_MATERIALS", oldModelTransformations, modelTransformations);
25754         }
25755     };
25756     /**
25757      * Returns the shape used to cut out upper levels when they intersect with the piece
25758      * like a staircase.
25759      * @return {string}
25760      */
25761     HomePieceOfFurniture.prototype.getStaircaseCutOutShape = function () {
25762         return this.staircaseCutOutShape;
25763     };
25764     /**
25765      * Sets the shape used to cut out upper levels when they intersect with the piece
25766      * like a staircase. Once this piece is updated, listeners added to this piece
25767      * will receive a change notification.
25768      * @param {string} staircaseCutOutShape
25769      */
25770     HomePieceOfFurniture.prototype.setStaircaseCutOutShape = function (staircaseCutOutShape) {
25771         if (staircaseCutOutShape !== this.staircaseCutOutShape && (staircaseCutOutShape == null || !(staircaseCutOutShape === this.staircaseCutOutShape))) {
25772             var oldCutOutShape = this.staircaseCutOutShape;
25773             this.staircaseCutOutShape = staircaseCutOutShape;
25774             this.firePropertyChange(/* name */ "STAIRCASE_CUT_OUT_SHAPE", oldCutOutShape, staircaseCutOutShape);
25775         }
25776     };
25777     /**
25778      * Returns the level which this piece belongs to.
25779      * @return {Level}
25780      */
25781     HomePieceOfFurniture.prototype.getLevel = function () {
25782         return this.level;
25783     };
25784     /**
25785      * Sets the level of this piece of furniture. Once this piece is updated,
25786      * listeners added to this piece will receive a change notification.
25787      * @param {Level} level
25788      */
25789     HomePieceOfFurniture.prototype.setLevel = function (level) {
25790         if (level !== this.level) {
25791             var oldLevel = this.level;
25792             this.level = level;
25793             this.firePropertyChange(/* name */ "LEVEL", oldLevel, level);
25794         }
25795     };
25796     /**
25797      * Returns <code>true</code> if this piece is at the given <code>level</code>
25798      * or at a level with the same elevation and a smaller elevation index
25799      * or if the elevation of its highest point is higher than <code>level</code> elevation.
25800      * @param {Level} level
25801      * @return {boolean}
25802      */
25803     HomePieceOfFurniture.prototype.isAtLevel = function (level) {
25804         if (this.level === level) {
25805             return true;
25806         }
25807         else if (this.level != null && level != null) {
25808             var pieceLevelElevation = this.level.getElevation();
25809             var levelElevation = level.getElevation();
25810             return pieceLevelElevation === levelElevation && this.level.getElevationIndex() < level.getElevationIndex() || pieceLevelElevation < levelElevation && this.isTopAtLevel(level);
25811         }
25812         else {
25813             return false;
25814         }
25815     };
25816     /**
25817      * Returns <code>true</code> if the top of this piece is visible at the given level.
25818      * @param {Level} level
25819      * @return {boolean}
25820      * @private
25821      */
25822     HomePieceOfFurniture.prototype.isTopAtLevel = function (level) {
25823         var topElevation = this.level.getElevation() + this.elevation + this.heightInPlan;
25824         if (this.staircaseCutOutShape != null) {
25825             return topElevation >= level.getElevation();
25826         }
25827         else {
25828             return topElevation > level.getElevation();
25829         }
25830     };
25831     /**
25832      * Returns the points of each corner of a piece.
25833      * @return {float[][]} an array of the 4 (x,y) coordinates of the piece corners.
25834      */
25835     HomePieceOfFurniture.prototype.getPoints = function () {
25836         var piecePoints = (function (dims) { var allocate = function (dims) { if (dims.length === 0) {
25837             return 0;
25838         }
25839         else {
25840             var array = [];
25841             for (var i = 0; i < dims[0]; i++) {
25842                 array.push(allocate(dims.slice(1)));
25843             }
25844             return array;
25845         } }; return allocate(dims); })([4, 2]);
25846         var it = this.getShape().getPathIterator(null);
25847         for (var i = 0; i < piecePoints.length; i++) {
25848             {
25849                 it.currentSegment(piecePoints[i]);
25850                 it.next();
25851             }
25852             ;
25853         }
25854         return piecePoints;
25855     };
25856     /**
25857      * Returns <code>true</code> if this piece intersects
25858      * with the horizontal rectangle which opposite corners are at points
25859      * (<code>x0</code>, <code>y0</code>) and (<code>x1</code>, <code>y1</code>).
25860      * @param {number} x0
25861      * @param {number} y0
25862      * @param {number} x1
25863      * @param {number} y1
25864      * @return {boolean}
25865      */
25866     HomePieceOfFurniture.prototype.intersectsRectangle = function (x0, y0, x1, y1) {
25867         var rectangle = new java.awt.geom.Rectangle2D.Float(x0, y0, 0, 0);
25868         rectangle.add(x1, y1);
25869         return this.getShape().intersects(rectangle);
25870     };
25871     /**
25872      * Returns <code>true</code> if this piece contains
25873      * the point at (<code>x</code>, <code>y</code>)
25874      * with a given <code>margin</code>.
25875      * @param {number} x
25876      * @param {number} y
25877      * @param {number} margin
25878      * @return {boolean}
25879      */
25880     HomePieceOfFurniture.prototype.containsPoint = function (x, y, margin) {
25881         if (margin === 0) {
25882             return this.getShape().contains(x, y);
25883         }
25884         else {
25885             return this.getShape().intersects(x - margin, y - margin, 2 * margin, 2 * margin);
25886         }
25887     };
25888     /**
25889      * Returns <code>true</code> if one of the corner of this piece is
25890      * the point at (<code>x</code>, <code>y</code>) with a given <code>margin</code>.
25891      * @param {number} x
25892      * @param {number} y
25893      * @param {number} margin
25894      * @return {boolean}
25895      */
25896     HomePieceOfFurniture.prototype.isPointAt = function (x, y, margin) {
25897         {
25898             var array = this.getPoints();
25899             for (var index = 0; index < array.length; index++) {
25900                 var point = array[index];
25901                 {
25902                     if (Math.abs(x - point[0]) <= margin && Math.abs(y - point[1]) <= margin) {
25903                         return true;
25904                     }
25905                 }
25906             }
25907         }
25908         return false;
25909     };
25910     /**
25911      * Returns <code>true</code> if the top left point of this piece is
25912      * the point at (<code>x</code>, <code>y</code>) with a given <code>margin</code>,
25913      * and if that point is closer to top left point than to top right and bottom left points.
25914      * @param {number} x
25915      * @param {number} y
25916      * @param {number} margin
25917      * @return {boolean}
25918      */
25919     HomePieceOfFurniture.prototype.isTopLeftPointAt = function (x, y, margin) {
25920         var points = this.getPoints();
25921         var distanceSquareToTopLeftPoint = java.awt.geom.Point2D.distanceSq(x, y, points[0][0], points[0][1]);
25922         return distanceSquareToTopLeftPoint <= margin * margin && distanceSquareToTopLeftPoint < java.awt.geom.Point2D.distanceSq(x, y, points[1][0], points[1][1]) && distanceSquareToTopLeftPoint < java.awt.geom.Point2D.distanceSq(x, y, points[3][0], points[3][1]);
25923     };
25924     /**
25925      * Returns <code>true</code> if the top right point of this piece is
25926      * the point at (<code>x</code>, <code>y</code>) with a given <code>margin</code>,
25927      * and if that point is closer to top right point than to top left and bottom right points.
25928      * @param {number} x
25929      * @param {number} y
25930      * @param {number} margin
25931      * @return {boolean}
25932      */
25933     HomePieceOfFurniture.prototype.isTopRightPointAt = function (x, y, margin) {
25934         var points = this.getPoints();
25935         var distanceSquareToTopRightPoint = java.awt.geom.Point2D.distanceSq(x, y, points[1][0], points[1][1]);
25936         return distanceSquareToTopRightPoint <= margin * margin && distanceSquareToTopRightPoint < java.awt.geom.Point2D.distanceSq(x, y, points[0][0], points[0][1]) && distanceSquareToTopRightPoint < java.awt.geom.Point2D.distanceSq(x, y, points[2][0], points[2][1]);
25937     };
25938     /**
25939      * Returns <code>true</code> if the bottom left point of this piece is
25940      * the point at (<code>x</code>, <code>y</code>) with a given <code>margin</code>,
25941      * and if that point is closer to bottom left point than to top left and bottom right points.
25942      * @param {number} x
25943      * @param {number} y
25944      * @param {number} margin
25945      * @return {boolean}
25946      */
25947     HomePieceOfFurniture.prototype.isBottomLeftPointAt = function (x, y, margin) {
25948         var points = this.getPoints();
25949         var distanceSquareToBottomLeftPoint = java.awt.geom.Point2D.distanceSq(x, y, points[3][0], points[3][1]);
25950         return distanceSquareToBottomLeftPoint <= margin * margin && distanceSquareToBottomLeftPoint < java.awt.geom.Point2D.distanceSq(x, y, points[0][0], points[0][1]) && distanceSquareToBottomLeftPoint < java.awt.geom.Point2D.distanceSq(x, y, points[2][0], points[2][1]);
25951     };
25952     /**
25953      * Returns <code>true</code> if the bottom right point of this piece is
25954      * the point at (<code>x</code>, <code>y</code>) with a given <code>margin</code>,
25955      * and if that point is closer to top left point than to top right and bottom left points.
25956      * @param {number} x
25957      * @param {number} y
25958      * @param {number} margin
25959      * @return {boolean}
25960      */
25961     HomePieceOfFurniture.prototype.isBottomRightPointAt = function (x, y, margin) {
25962         var points = this.getPoints();
25963         var distanceSquareToBottomRightPoint = java.awt.geom.Point2D.distanceSq(x, y, points[2][0], points[2][1]);
25964         return distanceSquareToBottomRightPoint <= margin * margin && distanceSquareToBottomRightPoint < java.awt.geom.Point2D.distanceSq(x, y, points[1][0], points[1][1]) && distanceSquareToBottomRightPoint < java.awt.geom.Point2D.distanceSq(x, y, points[3][0], points[3][1]);
25965     };
25966     /**
25967      * Returns <code>true</code> if the center point at which is displayed the name
25968      * of this piece is equal to the point at (<code>x</code>, <code>y</code>)
25969      * with a given <code>margin</code>.
25970      * @param {number} x
25971      * @param {number} y
25972      * @param {number} margin
25973      * @return {boolean}
25974      */
25975     HomePieceOfFurniture.prototype.isNameCenterPointAt = function (x, y, margin) {
25976         return Math.abs(x - this.getX() - this.getNameXOffset()) <= margin && Math.abs(y - this.getY() - this.getNameYOffset()) <= margin;
25977     };
25978     /**
25979      * Returns <code>true</code> if the front side of this piece is parallel to the given <code>wall</code>
25980      * with a margin.
25981      * @param {Wall} wall
25982      * @return {boolean}
25983      */
25984     HomePieceOfFurniture.prototype.isParallelToWall = function (wall) {
25985         if (wall.getArcExtent() == null) {
25986             var deltaY = wall.getYEnd() - wall.getYStart();
25987             var deltaX = wall.getXEnd() - wall.getXStart();
25988             if (deltaX === 0 && deltaY === 0) {
25989                 return false;
25990             }
25991             else {
25992                 var wallAngle = Math.atan2(deltaY, deltaX);
25993                 var pieceWallAngle = Math.abs(wallAngle - this.getAngle()) % Math.PI;
25994                 return pieceWallAngle <= HomePieceOfFurniture.STRAIGHT_WALL_ANGLE_MARGIN_$LI$() || (Math.PI - pieceWallAngle) <= HomePieceOfFurniture.STRAIGHT_WALL_ANGLE_MARGIN_$LI$();
25995             }
25996         }
25997         else {
25998             var tangentAngle = Math.PI / 2 + Math.atan2(wall.getYArcCircleCenter() - this.getY(), wall.getXArcCircleCenter() - this.getX());
25999             var pieceWallAngle = Math.abs(tangentAngle - this.getAngle()) % Math.PI;
26000             return pieceWallAngle <= HomePieceOfFurniture.ROUND_WALL_ANGLE_MARGIN_$LI$() || (Math.PI - pieceWallAngle) <= HomePieceOfFurniture.ROUND_WALL_ANGLE_MARGIN_$LI$();
26001         }
26002     };
26003     /**
26004      * Returns the shape matching this piece in the horizontal plan.
26005      * @return {Object}
26006      * @private
26007      */
26008     HomePieceOfFurniture.prototype.getShape = function () {
26009         if (this.shapeCache == null) {
26010             var pieceRectangle = new java.awt.geom.Rectangle2D.Float(this.getX() - this.getWidthInPlan() / 2, this.getY() - this.getDepthInPlan() / 2, this.getWidthInPlan(), this.getDepthInPlan());
26011             var rotation = java.awt.geom.AffineTransform.getRotateInstance(this.getAngle(), this.getX(), this.getY());
26012             var it = pieceRectangle.getPathIterator(rotation);
26013             var pieceShape = new java.awt.geom.GeneralPath();
26014             pieceShape.append(it, false);
26015             this.shapeCache = pieceShape;
26016         }
26017         return this.shapeCache;
26018     };
26019     /**
26020      * Moves this piece of (<code>dx</code>, <code>dy</code>) units.
26021      * @param {number} dx
26022      * @param {number} dy
26023      */
26024     HomePieceOfFurniture.prototype.move = function (dx, dy) {
26025         this.setX(this.getX() + dx);
26026         this.setY(this.getY() + dy);
26027     };
26028     /**
26029      * Returns a clone of this piece.
26030      * @return {HomePieceOfFurniture}
26031      */
26032     HomePieceOfFurniture.prototype.clone = function () {
26033         var _this = this;
26034         var clone = (function (o) { if (_super.prototype.clone != undefined) {
26035             return _super.prototype.clone.call(_this);
26036         }
26037         else {
26038             var clone_5 = Object.create(o);
26039             for (var p in o) {
26040                 if (o.hasOwnProperty(p))
26041                     clone_5[p] = o[p];
26042             }
26043             return clone_5;
26044         } })(this);
26045         clone.level = null;
26046         return clone;
26047     };
26048     /**
26049      * Returns a comparator which compares furniture on a given <code>property</code> in ascending order.
26050      * @param {string} property
26051      * @return {Object}
26052      */
26053     HomePieceOfFurniture.getFurnitureComparator = function (property) {
26054         return ((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
26055             return funcInst;
26056         } return function (arg0, arg1) { return (funcInst['compare'] ? funcInst['compare'] : funcInst).call(funcInst, arg0, arg1); }; })(/* get */ (function (m, k) { if (m.entries == null)
26057             m.entries = []; for (var i = 0; i < m.entries.length; i++)
26058             if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
26059                 return m.entries[i].value;
26060             } return null; })(HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$(), property)));
26061     };
26062     HomePieceOfFurniture.__static_initialized = false;
26063     return HomePieceOfFurniture;
26064 }(HomeObject));
26065 HomePieceOfFurniture["__class"] = "com.eteks.sweethome3d.model.HomePieceOfFurniture";
26066 HomePieceOfFurniture["__interfaces"] = ["com.eteks.sweethome3d.model.Selectable", "com.eteks.sweethome3d.model.PieceOfFurniture", "com.eteks.sweethome3d.model.Elevatable"];
26067 (function (HomePieceOfFurniture) {
26068     var HomePieceOfFurniture$0 = /** @class */ (function () {
26069         function HomePieceOfFurniture$0(collator) {
26070             this.collator = collator;
26071         }
26072         HomePieceOfFurniture$0.prototype.compare = function (piece1, piece2) {
26073             if (piece1.catalogId === piece2.catalogId) {
26074                 return 0;
26075             }
26076             else if (piece1.catalogId == null) {
26077                 return -1;
26078             }
26079             else if (piece2.catalogId == null) {
26080                 return 1;
26081             }
26082             else {
26083                 return this.collator.compare(piece1.catalogId, piece2.catalogId);
26084             }
26085         };
26086         return HomePieceOfFurniture$0;
26087     }());
26088     HomePieceOfFurniture.HomePieceOfFurniture$0 = HomePieceOfFurniture$0;
26089     var HomePieceOfFurniture$1 = /** @class */ (function () {
26090         function HomePieceOfFurniture$1(collator) {
26091             this.collator = collator;
26092         }
26093         HomePieceOfFurniture$1.prototype.compare = function (piece1, piece2) {
26094             if (piece1.name === piece2.name) {
26095                 return 0;
26096             }
26097             else if (piece1.name == null) {
26098                 return -1;
26099             }
26100             else if (piece2.name == null) {
26101                 return 1;
26102             }
26103             else {
26104                 return this.collator.compare(piece1.name, piece2.name);
26105             }
26106         };
26107         return HomePieceOfFurniture$1;
26108     }());
26109     HomePieceOfFurniture.HomePieceOfFurniture$1 = HomePieceOfFurniture$1;
26110     var HomePieceOfFurniture$2 = /** @class */ (function () {
26111         function HomePieceOfFurniture$2(collator) {
26112             this.collator = collator;
26113         }
26114         HomePieceOfFurniture$2.prototype.compare = function (piece1, piece2) {
26115             if (piece1.description === piece2.description) {
26116                 return 0;
26117             }
26118             else if (piece1.description == null) {
26119                 return -1;
26120             }
26121             else if (piece2.description == null) {
26122                 return 1;
26123             }
26124             else {
26125                 return this.collator.compare(piece1.description, piece2.description);
26126             }
26127         };
26128         return HomePieceOfFurniture$2;
26129     }());
26130     HomePieceOfFurniture.HomePieceOfFurniture$2 = HomePieceOfFurniture$2;
26131     var HomePieceOfFurniture$3 = /** @class */ (function () {
26132         function HomePieceOfFurniture$3(collator) {
26133             this.collator = collator;
26134         }
26135         HomePieceOfFurniture$3.prototype.compare = function (piece1, piece2) {
26136             if (piece1.creator === piece2.creator) {
26137                 return 0;
26138             }
26139             else if (piece1.creator == null) {
26140                 return -1;
26141             }
26142             else if (piece2.creator == null) {
26143                 return 1;
26144             }
26145             else {
26146                 return this.collator.compare(piece1.creator, piece2.creator);
26147             }
26148         };
26149         return HomePieceOfFurniture$3;
26150     }());
26151     HomePieceOfFurniture.HomePieceOfFurniture$3 = HomePieceOfFurniture$3;
26152     var HomePieceOfFurniture$4 = /** @class */ (function () {
26153         function HomePieceOfFurniture$4(collator) {
26154             this.collator = collator;
26155         }
26156         HomePieceOfFurniture$4.prototype.compare = function (piece1, piece2) {
26157             if (piece1.license === piece2.license) {
26158                 return 0;
26159             }
26160             else if (piece1.license == null) {
26161                 return -1;
26162             }
26163             else if (piece2.license == null) {
26164                 return 1;
26165             }
26166             else {
26167                 return this.collator.compare(piece1.license, piece2.license);
26168             }
26169         };
26170         return HomePieceOfFurniture$4;
26171     }());
26172     HomePieceOfFurniture.HomePieceOfFurniture$4 = HomePieceOfFurniture$4;
26173     var HomePieceOfFurniture$5 = /** @class */ (function () {
26174         function HomePieceOfFurniture$5() {
26175         }
26176         HomePieceOfFurniture$5.prototype.compare = function (piece1, piece2) {
26177             return HomePieceOfFurniture.compare$float$float(piece1.width, piece2.width);
26178         };
26179         return HomePieceOfFurniture$5;
26180     }());
26181     HomePieceOfFurniture.HomePieceOfFurniture$5 = HomePieceOfFurniture$5;
26182     var HomePieceOfFurniture$6 = /** @class */ (function () {
26183         function HomePieceOfFurniture$6() {
26184         }
26185         HomePieceOfFurniture$6.prototype.compare = function (piece1, piece2) {
26186             return HomePieceOfFurniture.compare$float$float(piece1.height, piece2.height);
26187         };
26188         return HomePieceOfFurniture$6;
26189     }());
26190     HomePieceOfFurniture.HomePieceOfFurniture$6 = HomePieceOfFurniture$6;
26191     var HomePieceOfFurniture$7 = /** @class */ (function () {
26192         function HomePieceOfFurniture$7() {
26193         }
26194         HomePieceOfFurniture$7.prototype.compare = function (piece1, piece2) {
26195             return HomePieceOfFurniture.compare$float$float(piece1.depth, piece2.depth);
26196         };
26197         return HomePieceOfFurniture$7;
26198     }());
26199     HomePieceOfFurniture.HomePieceOfFurniture$7 = HomePieceOfFurniture$7;
26200     var HomePieceOfFurniture$8 = /** @class */ (function () {
26201         function HomePieceOfFurniture$8() {
26202         }
26203         HomePieceOfFurniture$8.prototype.compare = function (piece1, piece2) {
26204             return HomePieceOfFurniture.compare$boolean$boolean(piece1.movable, piece2.movable);
26205         };
26206         return HomePieceOfFurniture$8;
26207     }());
26208     HomePieceOfFurniture.HomePieceOfFurniture$8 = HomePieceOfFurniture$8;
26209     var HomePieceOfFurniture$9 = /** @class */ (function () {
26210         function HomePieceOfFurniture$9() {
26211         }
26212         HomePieceOfFurniture$9.prototype.compare = function (piece1, piece2) {
26213             return HomePieceOfFurniture.compare$boolean$boolean(piece1.doorOrWindow, piece2.doorOrWindow);
26214         };
26215         return HomePieceOfFurniture$9;
26216     }());
26217     HomePieceOfFurniture.HomePieceOfFurniture$9 = HomePieceOfFurniture$9;
26218     var HomePieceOfFurniture$10 = /** @class */ (function () {
26219         function HomePieceOfFurniture$10() {
26220         }
26221         HomePieceOfFurniture$10.prototype.compare = function (piece1, piece2) {
26222             if (piece1.color === piece2.color) {
26223                 return 0;
26224             }
26225             else if (piece1.color == null) {
26226                 return -1;
26227             }
26228             else if (piece2.color == null) {
26229                 return 1;
26230             }
26231             else {
26232                 return piece1.color - piece2.color;
26233             }
26234         };
26235         return HomePieceOfFurniture$10;
26236     }());
26237     HomePieceOfFurniture.HomePieceOfFurniture$10 = HomePieceOfFurniture$10;
26238     var HomePieceOfFurniture$11 = /** @class */ (function () {
26239         function HomePieceOfFurniture$11(collator) {
26240             this.collator = collator;
26241         }
26242         HomePieceOfFurniture$11.prototype.compare = function (piece1, piece2) {
26243             if (piece1.texture === piece2.texture) {
26244                 return 0;
26245             }
26246             else if (piece1.texture == null) {
26247                 return -1;
26248             }
26249             else if (piece2.texture == null) {
26250                 return 1;
26251             }
26252             else {
26253                 return this.collator.compare(piece1.texture.getName(), piece2.texture.getName());
26254             }
26255         };
26256         return HomePieceOfFurniture$11;
26257     }());
26258     HomePieceOfFurniture.HomePieceOfFurniture$11 = HomePieceOfFurniture$11;
26259     var HomePieceOfFurniture$12 = /** @class */ (function () {
26260         function HomePieceOfFurniture$12() {
26261         }
26262         HomePieceOfFurniture$12.prototype.compare = function (piece1, piece2) {
26263             return HomePieceOfFurniture.compare$boolean$boolean(piece1.visible, piece2.visible);
26264         };
26265         return HomePieceOfFurniture$12;
26266     }());
26267     HomePieceOfFurniture.HomePieceOfFurniture$12 = HomePieceOfFurniture$12;
26268     var HomePieceOfFurniture$13 = /** @class */ (function () {
26269         function HomePieceOfFurniture$13() {
26270         }
26271         HomePieceOfFurniture$13.prototype.compare = function (piece1, piece2) {
26272             return HomePieceOfFurniture.compare$float$float(piece1.x, piece2.x);
26273         };
26274         return HomePieceOfFurniture$13;
26275     }());
26276     HomePieceOfFurniture.HomePieceOfFurniture$13 = HomePieceOfFurniture$13;
26277     var HomePieceOfFurniture$14 = /** @class */ (function () {
26278         function HomePieceOfFurniture$14() {
26279         }
26280         HomePieceOfFurniture$14.prototype.compare = function (piece1, piece2) {
26281             return HomePieceOfFurniture.compare$float$float(piece1.y, piece2.y);
26282         };
26283         return HomePieceOfFurniture$14;
26284     }());
26285     HomePieceOfFurniture.HomePieceOfFurniture$14 = HomePieceOfFurniture$14;
26286     var HomePieceOfFurniture$15 = /** @class */ (function () {
26287         function HomePieceOfFurniture$15() {
26288         }
26289         HomePieceOfFurniture$15.prototype.compare = function (piece1, piece2) {
26290             return HomePieceOfFurniture.compare$float$float(piece1.elevation, piece2.elevation);
26291         };
26292         return HomePieceOfFurniture$15;
26293     }());
26294     HomePieceOfFurniture.HomePieceOfFurniture$15 = HomePieceOfFurniture$15;
26295     var HomePieceOfFurniture$16 = /** @class */ (function () {
26296         function HomePieceOfFurniture$16() {
26297         }
26298         HomePieceOfFurniture$16.prototype.compare = function (piece1, piece2) {
26299             return HomePieceOfFurniture.compare$float$float(piece1.angle, piece2.angle);
26300         };
26301         return HomePieceOfFurniture$16;
26302     }());
26303     HomePieceOfFurniture.HomePieceOfFurniture$16 = HomePieceOfFurniture$16;
26304     var HomePieceOfFurniture$17 = /** @class */ (function () {
26305         function HomePieceOfFurniture$17() {
26306         }
26307         HomePieceOfFurniture$17.prototype.compare = function (piece1, piece2) {
26308             var piece1ModelSize = HomePieceOfFurniture.getComparableModelSize(piece1);
26309             var piece2ModelSize = HomePieceOfFurniture.getComparableModelSize(piece2);
26310             if (piece1ModelSize === piece2ModelSize) {
26311                 return 0;
26312             }
26313             else if (piece1ModelSize == null) {
26314                 return -1;
26315             }
26316             else if (piece2ModelSize == null) {
26317                 return 1;
26318             }
26319             else {
26320                 return piece1ModelSize < piece2ModelSize ? -1 : ( /* longValue */piece1ModelSize === /* longValue */ piece2ModelSize ? 0 : 1);
26321             }
26322         };
26323         return HomePieceOfFurniture$17;
26324     }());
26325     HomePieceOfFurniture.HomePieceOfFurniture$17 = HomePieceOfFurniture$17;
26326     var HomePieceOfFurniture$18 = /** @class */ (function () {
26327         function HomePieceOfFurniture$18() {
26328         }
26329         HomePieceOfFurniture$18.prototype.compare = function (piece1, piece2) {
26330             return HomePieceOfFurniture.compare$com_eteks_sweethome3d_model_Level$com_eteks_sweethome3d_model_Level(piece1.getLevel(), piece2.getLevel());
26331         };
26332         return HomePieceOfFurniture$18;
26333     }());
26334     HomePieceOfFurniture.HomePieceOfFurniture$18 = HomePieceOfFurniture$18;
26335     var HomePieceOfFurniture$19 = /** @class */ (function () {
26336         function HomePieceOfFurniture$19() {
26337         }
26338         HomePieceOfFurniture$19.prototype.compare = function (piece1, piece2) {
26339             return HomePieceOfFurniture.compare$java_math_BigDecimal$java_math_BigDecimal(piece1.price, piece2.price);
26340         };
26341         return HomePieceOfFurniture$19;
26342     }());
26343     HomePieceOfFurniture.HomePieceOfFurniture$19 = HomePieceOfFurniture$19;
26344     var HomePieceOfFurniture$20 = /** @class */ (function () {
26345         function HomePieceOfFurniture$20() {
26346         }
26347         HomePieceOfFurniture$20.prototype.compare = function (piece1, piece2) {
26348             return HomePieceOfFurniture.compare$java_math_BigDecimal$java_math_BigDecimal(piece1.valueAddedTaxPercentage, piece2.valueAddedTaxPercentage);
26349         };
26350         return HomePieceOfFurniture$20;
26351     }());
26352     HomePieceOfFurniture.HomePieceOfFurniture$20 = HomePieceOfFurniture$20;
26353     var HomePieceOfFurniture$21 = /** @class */ (function () {
26354         function HomePieceOfFurniture$21() {
26355         }
26356         HomePieceOfFurniture$21.prototype.compare = function (piece1, piece2) {
26357             return HomePieceOfFurniture.compare$java_math_BigDecimal$java_math_BigDecimal(piece1.getValueAddedTax(), piece2.getValueAddedTax());
26358         };
26359         return HomePieceOfFurniture$21;
26360     }());
26361     HomePieceOfFurniture.HomePieceOfFurniture$21 = HomePieceOfFurniture$21;
26362     var HomePieceOfFurniture$22 = /** @class */ (function () {
26363         function HomePieceOfFurniture$22() {
26364         }
26365         HomePieceOfFurniture$22.prototype.compare = function (piece1, piece2) {
26366             return HomePieceOfFurniture.compare$java_math_BigDecimal$java_math_BigDecimal(piece1.getPriceValueAddedTaxIncluded(), piece2.getPriceValueAddedTaxIncluded());
26367         };
26368         return HomePieceOfFurniture$22;
26369     }());
26370     HomePieceOfFurniture.HomePieceOfFurniture$22 = HomePieceOfFurniture$22;
26371 })(HomePieceOfFurniture || (HomePieceOfFurniture = {}));
26372 HomePieceOfFurniture['__transients'] = ['shapeCache', 'propertyChangeSupport'];
26373 /**
26374  * Creates a compass drawn at the given point.
26375  * North direction is set to zero, time zone to default
26376  * and the latitude and the longitude of this new compass is equal
26377  * to the geographic point matching the default time zone.
26378  * @param {string} id
26379  * @param {number} x
26380  * @param {number} y
26381  * @param {number} diameter
26382  * @class
26383  * @extends HomeObject
26384  * @author Emmanuel Puybaret
26385  */
26386 var Compass = /** @class */ (function (_super) {
26387     __extends(Compass, _super);
26388     function Compass(id, x, y, diameter) {
26389         var _this = this;
26390         if (((typeof id === 'string') || id === null) && ((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof diameter === 'number') || diameter === null)) {
26391             var __args = arguments;
26392             _this = _super.call(this, id) || this;
26393             if (_this.x === undefined) {
26394                 _this.x = 0;
26395             }
26396             if (_this.y === undefined) {
26397                 _this.y = 0;
26398             }
26399             if (_this.diameter === undefined) {
26400                 _this.diameter = 0;
26401             }
26402             if (_this.visible === undefined) {
26403                 _this.visible = false;
26404             }
26405             if (_this.northDirection === undefined) {
26406                 _this.northDirection = 0;
26407             }
26408             if (_this.latitude === undefined) {
26409                 _this.latitude = 0;
26410             }
26411             if (_this.longitude === undefined) {
26412                 _this.longitude = 0;
26413             }
26414             if (_this.timeZone === undefined) {
26415                 _this.timeZone = null;
26416             }
26417             if (_this.pointsCache === undefined) {
26418                 _this.pointsCache = null;
26419             }
26420             if (_this.dateCache === undefined) {
26421                 _this.dateCache = null;
26422             }
26423             if (_this.sunElevationCache === undefined) {
26424                 _this.sunElevationCache = 0;
26425             }
26426             if (_this.sunAzimuthCache === undefined) {
26427                 _this.sunAzimuthCache = 0;
26428             }
26429             _this.x = x;
26430             _this.y = y;
26431             _this.diameter = diameter;
26432             _this.visible = true;
26433             _this.timeZone = /* getDefault */ "UTC";
26434             _this.initGeographicPoint();
26435         }
26436         else if (((typeof id === 'number') || id === null) && ((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && diameter === undefined) {
26437             var __args = arguments;
26438             var x_2 = __args[0];
26439             var y_2 = __args[1];
26440             var diameter_2 = __args[2];
26441             {
26442                 var __args_79 = arguments;
26443                 var id_13 = HomeObject.createId("compass");
26444                 _this = _super.call(this, id_13) || this;
26445                 if (_this.x === undefined) {
26446                     _this.x = 0;
26447                 }
26448                 if (_this.y === undefined) {
26449                     _this.y = 0;
26450                 }
26451                 if (_this.diameter === undefined) {
26452                     _this.diameter = 0;
26453                 }
26454                 if (_this.visible === undefined) {
26455                     _this.visible = false;
26456                 }
26457                 if (_this.northDirection === undefined) {
26458                     _this.northDirection = 0;
26459                 }
26460                 if (_this.latitude === undefined) {
26461                     _this.latitude = 0;
26462                 }
26463                 if (_this.longitude === undefined) {
26464                     _this.longitude = 0;
26465                 }
26466                 if (_this.timeZone === undefined) {
26467                     _this.timeZone = null;
26468                 }
26469                 if (_this.pointsCache === undefined) {
26470                     _this.pointsCache = null;
26471                 }
26472                 if (_this.dateCache === undefined) {
26473                     _this.dateCache = null;
26474                 }
26475                 if (_this.sunElevationCache === undefined) {
26476                     _this.sunElevationCache = 0;
26477                 }
26478                 if (_this.sunAzimuthCache === undefined) {
26479                     _this.sunAzimuthCache = 0;
26480                 }
26481                 _this.x = x_2;
26482                 _this.y = y_2;
26483                 _this.diameter = diameter_2;
26484                 _this.visible = true;
26485                 _this.timeZone = /* getDefault */ "UTC";
26486                 _this.initGeographicPoint();
26487             }
26488             if (_this.x === undefined) {
26489                 _this.x = 0;
26490             }
26491             if (_this.y === undefined) {
26492                 _this.y = 0;
26493             }
26494             if (_this.diameter === undefined) {
26495                 _this.diameter = 0;
26496             }
26497             if (_this.visible === undefined) {
26498                 _this.visible = false;
26499             }
26500             if (_this.northDirection === undefined) {
26501                 _this.northDirection = 0;
26502             }
26503             if (_this.latitude === undefined) {
26504                 _this.latitude = 0;
26505             }
26506             if (_this.longitude === undefined) {
26507                 _this.longitude = 0;
26508             }
26509             if (_this.timeZone === undefined) {
26510                 _this.timeZone = null;
26511             }
26512             if (_this.pointsCache === undefined) {
26513                 _this.pointsCache = null;
26514             }
26515             if (_this.dateCache === undefined) {
26516                 _this.dateCache = null;
26517             }
26518             if (_this.sunElevationCache === undefined) {
26519                 _this.sunElevationCache = 0;
26520             }
26521             if (_this.sunAzimuthCache === undefined) {
26522                 _this.sunAzimuthCache = 0;
26523             }
26524         }
26525         else
26526             throw new Error('invalid overload');
26527         return _this;
26528     }
26529     /**
26530      * Returns the abscissa of the center of this compass.
26531      * @return {number}
26532      */
26533     Compass.prototype.getX = function () {
26534         return this.x;
26535     };
26536     /**
26537      * Sets the abscissa of the center of this compass. Once this compass is updated,
26538      * listeners added to this compass will receive a change notification.
26539      * @param {number} x
26540      */
26541     Compass.prototype.setX = function (x) {
26542         if (x !== this.x) {
26543             var oldX = this.x;
26544             this.x = x;
26545             this.pointsCache = null;
26546             this.firePropertyChange(/* name */ "X", oldX, x);
26547         }
26548     };
26549     /**
26550      * Returns the ordinate of the center of this compass.
26551      * @return {number}
26552      */
26553     Compass.prototype.getY = function () {
26554         return this.y;
26555     };
26556     /**
26557      * Sets the ordinate of the center of this compass. Once this compass is updated,
26558      * listeners added to this compass will receive a change notification.
26559      * @param {number} y
26560      */
26561     Compass.prototype.setY = function (y) {
26562         if (y !== this.y) {
26563             var oldY = this.y;
26564             this.y = y;
26565             this.pointsCache = null;
26566             this.firePropertyChange(/* name */ "Y", oldY, y);
26567         }
26568     };
26569     /**
26570      * Returns the diameter of this compass.
26571      * @return {number}
26572      */
26573     Compass.prototype.getDiameter = function () {
26574         return this.diameter;
26575     };
26576     /**
26577      * Sets the diameter of this compass. Once this compass is updated,
26578      * listeners added to this compass will receive a change notification.
26579      * @param {number} diameter
26580      */
26581     Compass.prototype.setDiameter = function (diameter) {
26582         if (diameter !== this.diameter) {
26583             var oldDiameter = this.diameter;
26584             this.diameter = diameter;
26585             this.pointsCache = null;
26586             this.firePropertyChange(/* name */ "DIAMETER", oldDiameter, diameter);
26587         }
26588     };
26589     /**
26590      * Returns <code>true</code> if this compass is visible.
26591      * @return {boolean}
26592      */
26593     Compass.prototype.isVisible = function () {
26594         return this.visible;
26595     };
26596     /**
26597      * Sets whether this compass is visible or not. Once this compass is updated,
26598      * listeners added to this piece will receive a change notification.
26599      * @param {boolean} visible
26600      */
26601     Compass.prototype.setVisible = function (visible) {
26602         if (visible !== this.visible) {
26603             this.visible = visible;
26604             this.firePropertyChange(/* name */ "VISIBLE", !visible, visible);
26605         }
26606     };
26607     /**
26608      * Returns the North direction angle of this compass in radians.
26609      * @return {number}
26610      */
26611     Compass.prototype.getNorthDirection = function () {
26612         return this.northDirection;
26613     };
26614     /**
26615      * Sets the North direction angle of this compass. Once this compass is updated,
26616      * listeners added to this compass will receive a change notification.
26617      * @param {number} northDirection
26618      */
26619     Compass.prototype.setNorthDirection = function (northDirection) {
26620         if (northDirection !== this.northDirection) {
26621             var oldNorthDirection = this.northDirection;
26622             this.northDirection = northDirection;
26623             this.pointsCache = null;
26624             this.firePropertyChange(/* name */ "NORTH_DIRECTION", oldNorthDirection, northDirection);
26625         }
26626     };
26627     /**
26628      * Returns the latitude of this compass in radians.
26629      * @return {number}
26630      */
26631     Compass.prototype.getLatitude = function () {
26632         return this.latitude;
26633     };
26634     /**
26635      * Sets the latitude of this compass. Once this compass is updated,
26636      * listeners added to this compass will receive a change notification.
26637      * @param {number} latitude
26638      */
26639     Compass.prototype.setLatitude = function (latitude) {
26640         if (latitude !== this.latitude) {
26641             var oldLatitude = this.latitude;
26642             this.latitude = latitude;
26643             this.dateCache = null;
26644             this.firePropertyChange(/* name */ "LATITUDE", oldLatitude, latitude);
26645         }
26646     };
26647     /**
26648      * Returns the longitude of this compass in radians.
26649      * @return {number}
26650      */
26651     Compass.prototype.getLongitude = function () {
26652         return this.longitude;
26653     };
26654     /**
26655      * Sets the longitude of the center of this compass. Once this compass is updated,
26656      * listeners added to this compass will receive a change notification.
26657      * @param {number} longitude
26658      */
26659     Compass.prototype.setLongitude = function (longitude) {
26660         if (longitude !== this.longitude) {
26661             var oldLongitude = this.longitude;
26662             this.longitude = longitude;
26663             this.dateCache = null;
26664             this.firePropertyChange(/* name */ "LONGITUDE", oldLongitude, longitude);
26665         }
26666     };
26667     /**
26668      * Returns the time zone identifier of this compass.
26669      * @see java.util.TimeZone
26670      * @return {string}
26671      */
26672     Compass.prototype.getTimeZone = function () {
26673         return /* getID */ this.timeZone;
26674     };
26675     /**
26676      * Sets the time zone identifier of this compass. Once this compass is updated,
26677      * listeners added to this compass will receive a change notification.
26678      * @throws IllegalArgumentException if <code>timeZone</code> is <code>null</code> or contains an unknown identifier.
26679      * @see java.util.TimeZone
26680      * @param {string} timeZone
26681      */
26682     Compass.prototype.setTimeZone = function (timeZone) {
26683         if (!( /* getID */this.timeZone === timeZone)) {
26684             if (timeZone == null) {
26685                 throw new IllegalArgumentException("Time zone ID can\'t be null");
26686             }
26687             var oldTimeZone = this.timeZone;
26688             this.timeZone = /* getTimeZone */ timeZone;
26689             this.dateCache = null;
26690             this.firePropertyChange(/* name */ "TIME_ZONE", oldTimeZone, timeZone);
26691         }
26692     };
26693     /**
26694      * Returns the corner points of the square that contains compass disc.
26695      * @return {float[][]}
26696      */
26697     Compass.prototype.getPoints = function () {
26698         if (this.pointsCache == null) {
26699             var pieceRectangle = new java.awt.geom.Rectangle2D.Float(this.getX() - this.getDiameter() / 2, this.getY() - this.getDiameter() / 2, this.getDiameter(), this.getDiameter());
26700             var rotation = java.awt.geom.AffineTransform.getRotateInstance(this.getNorthDirection(), this.getX(), this.getY());
26701             this.pointsCache = (function (dims) { var allocate = function (dims) { if (dims.length === 0) {
26702                 return 0;
26703             }
26704             else {
26705                 var array = [];
26706                 for (var i = 0; i < dims[0]; i++) {
26707                     array.push(allocate(dims.slice(1)));
26708                 }
26709                 return array;
26710             } }; return allocate(dims); })([4, 2]);
26711             var it = pieceRectangle.getPathIterator(rotation);
26712             for (var i = 0; i < this.pointsCache.length; i++) {
26713                 {
26714                     it.currentSegment(this.pointsCache[i]);
26715                     it.next();
26716                 }
26717                 ;
26718             }
26719         }
26720         return [/* clone */ this.pointsCache[0].slice(0), /* clone */ this.pointsCache[1].slice(0), /* clone */ this.pointsCache[2].slice(0), /* clone */ this.pointsCache[3].slice(0)];
26721     };
26722     /**
26723      * Returns <code>true</code> if the disc of this compass intersects
26724      * with the horizontal rectangle which opposite corners are at points
26725      * (<code>x0</code>, <code>y0</code>) and (<code>x1</code>, <code>y1</code>).
26726      * @param {number} x0
26727      * @param {number} y0
26728      * @param {number} x1
26729      * @param {number} y1
26730      * @return {boolean}
26731      */
26732     Compass.prototype.intersectsRectangle = function (x0, y0, x1, y1) {
26733         var rectangle = new java.awt.geom.Rectangle2D.Float(x0, y0, 0, 0);
26734         rectangle.add(x1, y1);
26735         return new java.awt.geom.Ellipse2D.Float(this.getX() - this.getDiameter() / 2, this.getY() - this.getDiameter() / 2, this.getDiameter(), this.getDiameter()).intersects(rectangle);
26736     };
26737     /**
26738      * Returns <code>true</code> if the disc of this compass contains
26739      * the point at (<code>x</code>, <code>y</code>)
26740      * with a given <code>margin</code>.
26741      * @param {number} x
26742      * @param {number} y
26743      * @param {number} margin
26744      * @return {boolean}
26745      */
26746     Compass.prototype.containsPoint = function (x, y, margin) {
26747         var shape = new java.awt.geom.Ellipse2D.Float(this.getX() - this.getDiameter() / 2, this.getY() - this.getDiameter() / 2, this.getDiameter(), this.getDiameter());
26748         if (margin === 0) {
26749             return shape.contains(x, y);
26750         }
26751         else {
26752             return shape.intersects(x - margin, y - margin, 2 * margin, 2 * margin);
26753         }
26754     };
26755     /**
26756      * Moves this compass of (<code>dx</code>, <code>dy</code>) units.
26757      * @param {number} dx
26758      * @param {number} dy
26759      */
26760     Compass.prototype.move = function (dx, dy) {
26761         this.setX(this.getX() + dx);
26762         this.setY(this.getY() + dy);
26763     };
26764     /**
26765      * Returns a clone of this compass.
26766      * @return {Compass}
26767      */
26768     Compass.prototype.clone = function () {
26769         var _this = this;
26770         return (function (o) { if (_super.prototype.clone != undefined) {
26771             return _super.prototype.clone.call(_this);
26772         }
26773         else {
26774             var clone = Object.create(o);
26775             for (var p in o) {
26776                 if (o.hasOwnProperty(p))
26777                     clone[p] = o[p];
26778             }
26779             return clone;
26780         } })(this);
26781     };
26782     Compass.prototype.computeJulianDay = function (year, month, day, hour, minute, second, timeZone, savingTime) {
26783         var dayPart = day + hour / 24.0 + minute / 1440.0 + second / 86400.0;
26784         if (month === 1 || month === 2) {
26785             year -= 1;
26786             month += 12;
26787         }
26788         var a = (year / 100 | 0);
26789         var b = 2 - a + (a / 4 | 0);
26790         var julianDay = ((365.25 * (year + 4716.0)) | 0) + (((30.6001 * (month + 1))) | 0) + dayPart + b - 1524.5;
26791         julianDay -= (timeZone + savingTime) / 24.0;
26792         julianDay -= 2451545.0;
26793         return julianDay;
26794     };
26795     Compass.prototype.toSiderealTime = function (julianDay) {
26796         var centuries = julianDay / 36525.0;
26797         var siderealTime = (24110.54841 + (8640184.812866 * centuries) + (0.093104 * Math.pow(centuries, 2.0)) - (6.2E-6 * Math.pow(centuries, 3.0))) / 3600.0;
26798         return ((siderealTime / 24.0) - ((siderealTime / 24.0) | 0)) * 24.0;
26799     };
26800     /**
26801      * Inits the latitudeInDegrees and longitudeInDegrees where this compass is located from the id of the default time zone.
26802      * @private
26803      */
26804     Compass.prototype.initGeographicPoint = function () {
26805         var timeZoneGeographicPoints;
26806         if (Compass.timeZoneGeographicPointsReference != null) {
26807             timeZoneGeographicPoints = /* get */ Compass.timeZoneGeographicPointsReference;
26808         }
26809         else {
26810             timeZoneGeographicPoints = null;
26811         }
26812         if (timeZoneGeographicPoints == null) {
26813             timeZoneGeographicPoints = ({});
26814             var apia = new Compass.GeographicPoint(-13.833333, -171.73334);
26815             /* put */ (timeZoneGeographicPoints["Etc/GMT+11"] = apia);
26816             /* put */ (timeZoneGeographicPoints["Pacific/Apia"] = apia);
26817             /* put */ (timeZoneGeographicPoints["Pacific/Midway"] = new Compass.GeographicPoint(28.2, -177.35));
26818             /* put */ (timeZoneGeographicPoints["Pacific/Niue"] = new Compass.GeographicPoint(-19.055, -169.92));
26819             /* put */ (timeZoneGeographicPoints["Pacific/Pago_Pago"] = new Compass.GeographicPoint(-14.278055, -170.7025));
26820             /* put */ (timeZoneGeographicPoints["Pacific/Samoa"] = apia);
26821             /* put */ (timeZoneGeographicPoints["US/Samoa"] = apia);
26822             /* put */ (timeZoneGeographicPoints["America/Adak"] = new Compass.GeographicPoint(51.88, -176.65805));
26823             /* put */ (timeZoneGeographicPoints["America/Atka"] = new Compass.GeographicPoint(52.19611, -174.20056));
26824             var honolulu = new Compass.GeographicPoint(21.306944, -157.85834);
26825             /* put */ (timeZoneGeographicPoints["Etc/GMT+10"] = honolulu);
26826             /* put */ (timeZoneGeographicPoints["Pacific/Fakaofo"] = new Compass.GeographicPoint(-9.3653, -171.215));
26827             /* put */ (timeZoneGeographicPoints["Pacific/Honolulu"] = honolulu);
26828             /* put */ (timeZoneGeographicPoints["Pacific/Johnston"] = new Compass.GeographicPoint(16.75, -169.517));
26829             /* put */ (timeZoneGeographicPoints["Pacific/Rarotonga"] = new Compass.GeographicPoint(-21.233, -159.783));
26830             /* put */ (timeZoneGeographicPoints["Pacific/Tahiti"] = new Compass.GeographicPoint(-17.533333, -149.56667));
26831             /* put */ (timeZoneGeographicPoints["SystemV/HST10"] = honolulu);
26832             /* put */ (timeZoneGeographicPoints["US/Aleutian"] = new Compass.GeographicPoint(54.817, 164.033));
26833             /* put */ (timeZoneGeographicPoints["US/Hawaii"] = honolulu);
26834             /* put */ (timeZoneGeographicPoints["Pacific/Marquesas"] = new Compass.GeographicPoint(-9.45, -139.38));
26835             var anchorage = new Compass.GeographicPoint(61.218056, -149.90028);
26836             /* put */ (timeZoneGeographicPoints["America/Anchorage"] = anchorage);
26837             /* put */ (timeZoneGeographicPoints["America/Juneau"] = new Compass.GeographicPoint(58.301945, -134.41972));
26838             /* put */ (timeZoneGeographicPoints["America/Nome"] = new Compass.GeographicPoint(64.501114, -165.40639));
26839             /* put */ (timeZoneGeographicPoints["America/Yakutat"] = new Compass.GeographicPoint(59.546944, -139.72722));
26840             /* put */ (timeZoneGeographicPoints["Etc/GMT+9"] = anchorage);
26841             /* put */ (timeZoneGeographicPoints["Pacific/Gambier"] = new Compass.GeographicPoint(-23.1178, -134.97));
26842             /* put */ (timeZoneGeographicPoints["SystemV/YST9"] = anchorage);
26843             /* put */ (timeZoneGeographicPoints["SystemV/YST9YDT"] = anchorage);
26844             /* put */ (timeZoneGeographicPoints["US/Alaska"] = anchorage);
26845             /* put */ (timeZoneGeographicPoints["America/Dawson"] = new Compass.GeographicPoint(64.066666, -139.41667));
26846             /* put */ (timeZoneGeographicPoints["America/Ensenada"] = new Compass.GeographicPoint(31.866667, -116.61667));
26847             var losAngeles = new Compass.GeographicPoint(34.052223, -118.242775);
26848             /* put */ (timeZoneGeographicPoints["America/Los_Angeles"] = losAngeles);
26849             /* put */ (timeZoneGeographicPoints["America/Santa_Isabel"] = new Compass.GeographicPoint(28.383333, -113.35));
26850             /* put */ (timeZoneGeographicPoints["America/Tijuana"] = new Compass.GeographicPoint(32.533333, -117.01667));
26851             /* put */ (timeZoneGeographicPoints["America/Vancouver"] = new Compass.GeographicPoint(49.25, -123.13333));
26852             /* put */ (timeZoneGeographicPoints["America/Whitehorse"] = new Compass.GeographicPoint(60.716667, -135.05));
26853             /* put */ (timeZoneGeographicPoints["Canada/Pacific"] = new Compass.GeographicPoint(49.25, -123.13333));
26854             /* put */ (timeZoneGeographicPoints["Canada/Yukon"] = new Compass.GeographicPoint(60.716667, -135.05));
26855             /* put */ (timeZoneGeographicPoints["Etc/GMT+8"] = losAngeles);
26856             /* put */ (timeZoneGeographicPoints["Mexico/BajaNorte"] = new Compass.GeographicPoint(32.533333, -117.01667));
26857             /* put */ (timeZoneGeographicPoints["Pacific/Pitcairn"] = new Compass.GeographicPoint(-25.0667, -130.1));
26858             /* put */ (timeZoneGeographicPoints["SystemV/PST8"] = losAngeles);
26859             /* put */ (timeZoneGeographicPoints["SystemV/PST8PDT"] = losAngeles);
26860             /* put */ (timeZoneGeographicPoints["US/Pacific"] = losAngeles);
26861             /* put */ (timeZoneGeographicPoints["US/Pacific-New"] = losAngeles);
26862             /* put */ (timeZoneGeographicPoints["America/Boise"] = new Compass.GeographicPoint(43.61361, -116.2025));
26863             /* put */ (timeZoneGeographicPoints["America/Cambridge_Bay"] = new Compass.GeographicPoint(69.11667, -105.03333));
26864             /* put */ (timeZoneGeographicPoints["America/Chihuahua"] = new Compass.GeographicPoint(28.633333, -106.083336));
26865             /* put */ (timeZoneGeographicPoints["America/Dawson_Creek"] = new Compass.GeographicPoint(55.766666, -120.23333));
26866             var denver = new Compass.GeographicPoint(39.739166, -104.98417);
26867             /* put */ (timeZoneGeographicPoints["America/Denver"] = denver);
26868             /* put */ (timeZoneGeographicPoints["America/Edmonton"] = new Compass.GeographicPoint(53.55, -113.5));
26869             /* put */ (timeZoneGeographicPoints["America/Hermosillo"] = new Compass.GeographicPoint(29.066668, -110.96667));
26870             /* put */ (timeZoneGeographicPoints["America/Inuvik"] = new Compass.GeographicPoint(68.35, -133.7));
26871             /* put */ (timeZoneGeographicPoints["America/Mazatlan"] = new Compass.GeographicPoint(23.216667, -106.416664));
26872             /* put */ (timeZoneGeographicPoints["America/Ojinaga"] = new Compass.GeographicPoint(29.566668, -104.416664));
26873             /* put */ (timeZoneGeographicPoints["America/Phoenix"] = new Compass.GeographicPoint(33.448334, -112.07333));
26874             /* put */ (timeZoneGeographicPoints["America/Shiprock"] = new Compass.GeographicPoint(36.785557, -108.686386));
26875             /* put */ (timeZoneGeographicPoints["America/Yellowknife"] = new Compass.GeographicPoint(62.45, -114.35));
26876             /* put */ (timeZoneGeographicPoints["Canada/Mountain"] = new Compass.GeographicPoint(53.55, -113.5));
26877             /* put */ (timeZoneGeographicPoints["Etc/GMT+7"] = denver);
26878             /* put */ (timeZoneGeographicPoints["Mexico/BajaSur"] = new Compass.GeographicPoint(32.567, -116.633));
26879             /* put */ (timeZoneGeographicPoints["SystemV/MST7"] = denver);
26880             /* put */ (timeZoneGeographicPoints["SystemV/MST7MDT"] = denver);
26881             /* put */ (timeZoneGeographicPoints["US/Arizona"] = new Compass.GeographicPoint(33.448334, -112.07333));
26882             /* put */ (timeZoneGeographicPoints["US/Mountain"] = denver);
26883             /* put */ (timeZoneGeographicPoints["America/Belize"] = new Compass.GeographicPoint(17.483334, -88.183334));
26884             /* put */ (timeZoneGeographicPoints["America/Cancun"] = new Compass.GeographicPoint(21.166668, -86.833336));
26885             var chicago = new Compass.GeographicPoint(41.85, -87.65);
26886             /* put */ (timeZoneGeographicPoints["America/Chicago"] = chicago);
26887             /* put */ (timeZoneGeographicPoints["America/Costa_Rica"] = new Compass.GeographicPoint(9.933333, -84.083336));
26888             /* put */ (timeZoneGeographicPoints["America/El_Salvador"] = new Compass.GeographicPoint(13.7086115, -89.20306));
26889             /* put */ (timeZoneGeographicPoints["America/Guatemala"] = new Compass.GeographicPoint(14.621111, -90.52695));
26890             /* put */ (timeZoneGeographicPoints["America/Knox_IN"] = new Compass.GeographicPoint(41.295834, -86.625));
26891             /* put */ (timeZoneGeographicPoints["America/Managua"] = new Compass.GeographicPoint(12.150833, -86.26833));
26892             /* put */ (timeZoneGeographicPoints["America/Matamoros"] = new Compass.GeographicPoint(25.883333, -97.5));
26893             /* put */ (timeZoneGeographicPoints["America/Menominee"] = new Compass.GeographicPoint(45.107777, -87.61417));
26894             /* put */ (timeZoneGeographicPoints["America/Merida"] = new Compass.GeographicPoint(20.966667, -89.61667));
26895             /* put */ (timeZoneGeographicPoints["America/Mexico_City"] = new Compass.GeographicPoint(19.434168, -99.13861));
26896             /* put */ (timeZoneGeographicPoints["America/Monterrey"] = new Compass.GeographicPoint(25.666668, -100.316666));
26897             /* put */ (timeZoneGeographicPoints["America/Rainy_River"] = new Compass.GeographicPoint(48.716667, -94.566666));
26898             /* put */ (timeZoneGeographicPoints["America/Rankin_Inlet"] = new Compass.GeographicPoint(62.816666, -92.083336));
26899             /* put */ (timeZoneGeographicPoints["America/Regina"] = new Compass.GeographicPoint(50.45, -104.61667));
26900             /* put */ (timeZoneGeographicPoints["America/Swift_Current"] = new Compass.GeographicPoint(50.283333, -107.76667));
26901             /* put */ (timeZoneGeographicPoints["America/Tegucigalpa"] = new Compass.GeographicPoint(14.1, -87.21667));
26902             /* put */ (timeZoneGeographicPoints["America/Winnipeg"] = new Compass.GeographicPoint(49.88333, -97.166664));
26903             /* put */ (timeZoneGeographicPoints["Canada/Central"] = new Compass.GeographicPoint(50.45, -104.61667));
26904             /* put */ (timeZoneGeographicPoints["Canada/East-Saskatchewan"] = new Compass.GeographicPoint(51.216667, -102.46667));
26905             /* put */ (timeZoneGeographicPoints["Canada/Saskatchewan"] = new Compass.GeographicPoint(50.45, -104.61667));
26906             /* put */ (timeZoneGeographicPoints["Chile/EasterIsland"] = new Compass.GeographicPoint(-27.15, -109.425));
26907             /* put */ (timeZoneGeographicPoints["Etc/GMT+6"] = chicago);
26908             /* put */ (timeZoneGeographicPoints["Mexico/General"] = new Compass.GeographicPoint(19.434168, -99.13861));
26909             /* put */ (timeZoneGeographicPoints["Pacific/Easter"] = new Compass.GeographicPoint(-27.15, -109.425));
26910             /* put */ (timeZoneGeographicPoints["Pacific/Galapagos"] = new Compass.GeographicPoint(-0.667, -90.55));
26911             /* put */ (timeZoneGeographicPoints["SystemV/CST6"] = chicago);
26912             /* put */ (timeZoneGeographicPoints["SystemV/CST6CDT"] = chicago);
26913             /* put */ (timeZoneGeographicPoints["US/Central"] = chicago);
26914             /* put */ (timeZoneGeographicPoints["US/Indiana-Starke"] = new Compass.GeographicPoint(41.295834, -86.625));
26915             /* put */ (timeZoneGeographicPoints["America/Atikokan"] = new Compass.GeographicPoint(48.75, -91.61667));
26916             /* put */ (timeZoneGeographicPoints["America/Bogota"] = new Compass.GeographicPoint(4.6, -74.083336));
26917             /* put */ (timeZoneGeographicPoints["America/Cayman"] = new Compass.GeographicPoint(19.3, -81.38333));
26918             /* put */ (timeZoneGeographicPoints["America/Coral_Harbour"] = new Compass.GeographicPoint(64.13333, -83.166664));
26919             /* put */ (timeZoneGeographicPoints["America/Detroit"] = new Compass.GeographicPoint(42.33139, -83.04583));
26920             /* put */ (timeZoneGeographicPoints["America/Fort_Wayne"] = new Compass.GeographicPoint(41.130554, -85.12889));
26921             /* put */ (timeZoneGeographicPoints["America/Grand_Turk"] = new Compass.GeographicPoint(21.466667, -71.13333));
26922             /* put */ (timeZoneGeographicPoints["America/Guayaquil"] = new Compass.GeographicPoint(-2.1666667, -79.9));
26923             /* put */ (timeZoneGeographicPoints["America/Havana"] = new Compass.GeographicPoint(23.131945, -82.36417));
26924             /* put */ (timeZoneGeographicPoints["America/Indianapolis"] = new Compass.GeographicPoint(39.768333, -86.15806));
26925             /* put */ (timeZoneGeographicPoints["America/Iqaluit"] = new Compass.GeographicPoint(63.733334, -68.5));
26926             /* put */ (timeZoneGeographicPoints["America/Jamaica"] = new Compass.GeographicPoint(18.0, -76.8));
26927             /* put */ (timeZoneGeographicPoints["America/Lima"] = new Compass.GeographicPoint(-12.05, -77.05));
26928             /* put */ (timeZoneGeographicPoints["America/Louisville"] = new Compass.GeographicPoint(38.254166, -85.759445));
26929             /* put */ (timeZoneGeographicPoints["America/Montreal"] = new Compass.GeographicPoint(45.5, -73.583336));
26930             /* put */ (timeZoneGeographicPoints["America/Nassau"] = new Compass.GeographicPoint(25.083334, -77.35));
26931             var newYork = new Compass.GeographicPoint(40.71417, -74.006386);
26932             /* put */ (timeZoneGeographicPoints["America/New_York"] = newYork);
26933             /* put */ (timeZoneGeographicPoints["America/Nipigon"] = new Compass.GeographicPoint(49.016666, -88.25));
26934             /* put */ (timeZoneGeographicPoints["America/Panama"] = new Compass.GeographicPoint(8.966667, -79.53333));
26935             /* put */ (timeZoneGeographicPoints["America/Pangnirtung"] = new Compass.GeographicPoint(66.13333, -65.75));
26936             /* put */ (timeZoneGeographicPoints["America/Port-au-Prince"] = new Compass.GeographicPoint(18.539167, -72.335));
26937             /* put */ (timeZoneGeographicPoints["America/Resolute"] = new Compass.GeographicPoint(74.683334, -94.9));
26938             /* put */ (timeZoneGeographicPoints["America/Thunder_Bay"] = new Compass.GeographicPoint(48.4, -89.23333));
26939             /* put */ (timeZoneGeographicPoints["America/Toronto"] = new Compass.GeographicPoint(43.666668, -79.416664));
26940             /* put */ (timeZoneGeographicPoints["Canada/Eastern"] = new Compass.GeographicPoint(43.666668, -79.416664));
26941             /* put */ (timeZoneGeographicPoints["Etc/GMT+5"] = newYork);
26942             /* put */ (timeZoneGeographicPoints["SystemV/EST5"] = newYork);
26943             /* put */ (timeZoneGeographicPoints["SystemV/EST5EDT"] = newYork);
26944             /* put */ (timeZoneGeographicPoints["US/East-Indiana"] = new Compass.GeographicPoint(36.8381, -84.85));
26945             /* put */ (timeZoneGeographicPoints["US/Eastern"] = newYork);
26946             /* put */ (timeZoneGeographicPoints["US/Michigan"] = new Compass.GeographicPoint(42.33139, -83.04583));
26947             /* put */ (timeZoneGeographicPoints["America/Caracas"] = new Compass.GeographicPoint(10.5, -66.916664));
26948             /* put */ (timeZoneGeographicPoints["America/Anguilla"] = new Compass.GeographicPoint(18.216667, -63.05));
26949             /* put */ (timeZoneGeographicPoints["America/Antigua"] = new Compass.GeographicPoint(17.116667, -61.85));
26950             /* put */ (timeZoneGeographicPoints["America/Aruba"] = new Compass.GeographicPoint(10.541111, -72.9175));
26951             /* put */ (timeZoneGeographicPoints["America/Asuncion"] = new Compass.GeographicPoint(-25.266666, -57.666668));
26952             /* put */ (timeZoneGeographicPoints["America/Barbados"] = new Compass.GeographicPoint(13.1, -59.616665));
26953             /* put */ (timeZoneGeographicPoints["America/Blanc-Sablon"] = new Compass.GeographicPoint(51.433334, -57.11667));
26954             /* put */ (timeZoneGeographicPoints["America/Boa_Vista"] = new Compass.GeographicPoint(2.8166666, -60.666668));
26955             /* put */ (timeZoneGeographicPoints["America/Campo_Grande"] = new Compass.GeographicPoint(-20.45, -54.616665));
26956             /* put */ (timeZoneGeographicPoints["America/Cuiaba"] = new Compass.GeographicPoint(-15.583333, -56.083332));
26957             /* put */ (timeZoneGeographicPoints["America/Curacao"] = new Compass.GeographicPoint(12.1167, -68.933));
26958             /* put */ (timeZoneGeographicPoints["America/Dominica"] = new Compass.GeographicPoint(15.3, -61.4));
26959             /* put */ (timeZoneGeographicPoints["America/Eirunepe"] = new Compass.GeographicPoint(-6.6666665, -69.86667));
26960             /* put */ (timeZoneGeographicPoints["America/Glace_Bay"] = new Compass.GeographicPoint(46.2, -59.966667));
26961             /* put */ (timeZoneGeographicPoints["America/Goose_Bay"] = new Compass.GeographicPoint(53.333332, -60.416668));
26962             /* put */ (timeZoneGeographicPoints["America/Grenada"] = new Compass.GeographicPoint(12.05, -61.75));
26963             /* put */ (timeZoneGeographicPoints["America/Guadeloupe"] = new Compass.GeographicPoint(16.233334, -61.516666));
26964             /* put */ (timeZoneGeographicPoints["America/Guyana"] = new Compass.GeographicPoint(6.8, -58.166668));
26965             /* put */ (timeZoneGeographicPoints["America/Halifax"] = new Compass.GeographicPoint(44.65, -63.6));
26966             /* put */ (timeZoneGeographicPoints["America/La_Paz"] = new Compass.GeographicPoint(-16.5, -68.15));
26967             /* put */ (timeZoneGeographicPoints["America/Manaus"] = new Compass.GeographicPoint(-3.1133332, -60.025276));
26968             /* put */ (timeZoneGeographicPoints["America/Marigot"] = new Compass.GeographicPoint(18.073, 63.0844));
26969             /* put */ (timeZoneGeographicPoints["America/Martinique"] = new Compass.GeographicPoint(14.6, -61.083332));
26970             /* put */ (timeZoneGeographicPoints["America/Moncton"] = new Compass.GeographicPoint(46.083332, -64.76667));
26971             /* put */ (timeZoneGeographicPoints["America/Montserrat"] = new Compass.GeographicPoint(16.7, -62.216667));
26972             /* put */ (timeZoneGeographicPoints["America/Port_of_Spain"] = new Compass.GeographicPoint(10.65, -61.516666));
26973             /* put */ (timeZoneGeographicPoints["America/Porto_Acre"] = new Compass.GeographicPoint(-9.587778, -67.53555));
26974             /* put */ (timeZoneGeographicPoints["America/Porto_Velho"] = new Compass.GeographicPoint(-8.766666, -63.9));
26975             /* put */ (timeZoneGeographicPoints["America/Puerto_Rico"] = new Compass.GeographicPoint(18.467, 66.117));
26976             /* put */ (timeZoneGeographicPoints["America/Rio_Branco"] = new Compass.GeographicPoint(-9.966667, -67.8));
26977             var santiago = new Compass.GeographicPoint(-33.45, -70.666664);
26978             /* put */ (timeZoneGeographicPoints["America/Santiago"] = santiago);
26979             /* put */ (timeZoneGeographicPoints["America/Santo_Domingo"] = new Compass.GeographicPoint(18.466667, -69.9));
26980             /* put */ (timeZoneGeographicPoints["America/St_Barthelemy"] = new Compass.GeographicPoint(17.8978, -62.851));
26981             /* put */ (timeZoneGeographicPoints["America/St_Kitts"] = new Compass.GeographicPoint(17.3, -62.733));
26982             /* put */ (timeZoneGeographicPoints["America/St_Lucia"] = new Compass.GeographicPoint(14.0167, -60.9833));
26983             /* put */ (timeZoneGeographicPoints["America/St_Thomas"] = new Compass.GeographicPoint(18.3333, -64.9167));
26984             /* put */ (timeZoneGeographicPoints["America/St_Vincent"] = new Compass.GeographicPoint(13.1667, -61.2333));
26985             /* put */ (timeZoneGeographicPoints["America/Thule"] = new Compass.GeographicPoint(-54.27667, -36.511665));
26986             /* put */ (timeZoneGeographicPoints["America/Tortola"] = new Compass.GeographicPoint(18.416666, -64.61667));
26987             /* put */ (timeZoneGeographicPoints["America/Virgin"] = new Compass.GeographicPoint(18.34389, -64.931114));
26988             /* put */ (timeZoneGeographicPoints["Antarctica/Palmer"] = new Compass.GeographicPoint(-64.25, -62.833));
26989             /* put */ (timeZoneGeographicPoints["Atlantic/Bermuda"] = new Compass.GeographicPoint(32.294167, -64.78389));
26990             /* put */ (timeZoneGeographicPoints["Atlantic/Stanley"] = new Compass.GeographicPoint(-51.7, -57.85));
26991             /* put */ (timeZoneGeographicPoints["Brazil/Acre"] = new Compass.GeographicPoint(-10.883333, -45.083332));
26992             /* put */ (timeZoneGeographicPoints["Brazil/West"] = new Compass.GeographicPoint(-10.883333, -45.083332));
26993             /* put */ (timeZoneGeographicPoints["Canada/Atlantic"] = new Compass.GeographicPoint(44.65, -63.6));
26994             /* put */ (timeZoneGeographicPoints["Chile/Continental"] = santiago);
26995             /* put */ (timeZoneGeographicPoints["Etc/GMT+4"] = santiago);
26996             /* put */ (timeZoneGeographicPoints["SystemV/AST4"] = new Compass.GeographicPoint(44.65, -63.6));
26997             /* put */ (timeZoneGeographicPoints["SystemV/AST4ADT"] = new Compass.GeographicPoint(44.65, -63.6));
26998             /* put */ (timeZoneGeographicPoints["America/St_Johns"] = new Compass.GeographicPoint(47.5675, -52.7072));
26999             /* put */ (timeZoneGeographicPoints["Canada/Newfoundland"] = new Compass.GeographicPoint(47.5675, -52.7072));
27000             /* put */ (timeZoneGeographicPoints["America/Araguaina"] = new Compass.GeographicPoint(-7.16, -48.0575));
27001             /* put */ (timeZoneGeographicPoints["America/Bahia"] = new Compass.GeographicPoint(-12.983334, -38.516666));
27002             /* put */ (timeZoneGeographicPoints["America/Belem"] = new Compass.GeographicPoint(-1.45, -48.483334));
27003             /* put */ (timeZoneGeographicPoints["America/Buenos_Aires"] = new Compass.GeographicPoint(-34.5875, -58.6725));
27004             /* put */ (timeZoneGeographicPoints["America/Catamarca"] = new Compass.GeographicPoint(-28.466667, -65.78333));
27005             /* put */ (timeZoneGeographicPoints["America/Cayenne"] = new Compass.GeographicPoint(4.9333334, -52.333332));
27006             /* put */ (timeZoneGeographicPoints["America/Cordoba"] = new Compass.GeographicPoint(-31.4, -64.183334));
27007             /* put */ (timeZoneGeographicPoints["America/Fortaleza"] = new Compass.GeographicPoint(-3.7166667, -38.5));
27008             /* put */ (timeZoneGeographicPoints["America/Godthab"] = new Compass.GeographicPoint(64.183334, -51.75));
27009             /* put */ (timeZoneGeographicPoints["America/Jujuy"] = new Compass.GeographicPoint(-24.183332, -65.3));
27010             /* put */ (timeZoneGeographicPoints["America/Maceio"] = new Compass.GeographicPoint(-9.666667, -35.716667));
27011             /* put */ (timeZoneGeographicPoints["America/Mendoza"] = new Compass.GeographicPoint(-32.883335, -68.816666));
27012             /* put */ (timeZoneGeographicPoints["America/Miquelon"] = new Compass.GeographicPoint(47.0975, -56.38139));
27013             /* put */ (timeZoneGeographicPoints["America/Montevideo"] = new Compass.GeographicPoint(-34.858055, -56.170834));
27014             /* put */ (timeZoneGeographicPoints["America/Paramaribo"] = new Compass.GeographicPoint(5.8333335, -55.166668));
27015             /* put */ (timeZoneGeographicPoints["America/Recife"] = new Compass.GeographicPoint(-8.05, -34.9));
27016             /* put */ (timeZoneGeographicPoints["America/Rosario"] = new Compass.GeographicPoint(-32.95111, -60.66639));
27017             /* put */ (timeZoneGeographicPoints["America/Santarem"] = new Compass.GeographicPoint(-2.4333334, -54.7));
27018             var saoPaulo = new Compass.GeographicPoint(-23.533333, -46.616665);
27019             /* put */ (timeZoneGeographicPoints["America/Sao_Paulo"] = saoPaulo);
27020             /* put */ (timeZoneGeographicPoints["Antarctica/Rothera"] = new Compass.GeographicPoint(67.567, 68.133));
27021             /* put */ (timeZoneGeographicPoints["Brazil/East"] = saoPaulo);
27022             /* put */ (timeZoneGeographicPoints["Etc/GMT+3"] = saoPaulo);
27023             /* put */ (timeZoneGeographicPoints["America/Noronha"] = new Compass.GeographicPoint(3.85, 25.417));
27024             var southGeorgia = new Compass.GeographicPoint(54.25, 36.75);
27025             /* put */ (timeZoneGeographicPoints["Atlantic/South_Georgia"] = southGeorgia);
27026             /* put */ (timeZoneGeographicPoints["Brazil/DeNoronha"] = new Compass.GeographicPoint(3.85, 25.417));
27027             /* put */ (timeZoneGeographicPoints["Etc/GMT+2"] = southGeorgia);
27028             /* put */ (timeZoneGeographicPoints["America/Scoresbysund"] = new Compass.GeographicPoint(70.48333, -21.966667));
27029             var azores = new Compass.GeographicPoint(37.483334, -2.5666666);
27030             /* put */ (timeZoneGeographicPoints["Atlantic/Azores"] = azores);
27031             /* put */ (timeZoneGeographicPoints["Atlantic/Cape_Verde"] = new Compass.GeographicPoint(14.916667, -23.516666));
27032             /* put */ (timeZoneGeographicPoints["Etc/GMT+1"] = azores);
27033             /* put */ (timeZoneGeographicPoints["Africa/Abidjan"] = new Compass.GeographicPoint(5.341111, -4.028056));
27034             /* put */ (timeZoneGeographicPoints["Africa/Accra"] = new Compass.GeographicPoint(5.55, -0.2166667));
27035             /* put */ (timeZoneGeographicPoints["Africa/Bamako"] = new Compass.GeographicPoint(12.65, -8.0));
27036             /* put */ (timeZoneGeographicPoints["Africa/Banjul"] = new Compass.GeographicPoint(13.453055, -16.5775));
27037             /* put */ (timeZoneGeographicPoints["Africa/Bissau"] = new Compass.GeographicPoint(11.85, -15.583333));
27038             /* put */ (timeZoneGeographicPoints["Africa/Casablanca"] = new Compass.GeographicPoint(33.593056, -7.616389));
27039             /* put */ (timeZoneGeographicPoints["Africa/Conakry"] = new Compass.GeographicPoint(9.509167, -13.712222));
27040             /* put */ (timeZoneGeographicPoints["Africa/Dakar"] = new Compass.GeographicPoint(14.670834, -17.438055));
27041             /* put */ (timeZoneGeographicPoints["Africa/El_Aaiun"] = new Compass.GeographicPoint(27.15361, -13.203333));
27042             /* put */ (timeZoneGeographicPoints["Africa/Freetown"] = new Compass.GeographicPoint(8.49, -13.234167));
27043             /* put */ (timeZoneGeographicPoints["Africa/Lome"] = new Compass.GeographicPoint(6.131944, 1.2227778));
27044             /* put */ (timeZoneGeographicPoints["Africa/Monrovia"] = new Compass.GeographicPoint(6.3105555, -10.804722));
27045             /* put */ (timeZoneGeographicPoints["Africa/Nouakchott"] = new Compass.GeographicPoint(18.08639, -15.975278));
27046             /* put */ (timeZoneGeographicPoints["Africa/Ouagadougou"] = new Compass.GeographicPoint(12.370277, -1.5247222));
27047             /* put */ (timeZoneGeographicPoints["Africa/Sao_Tome"] = new Compass.GeographicPoint(0.3333333, 6.733333));
27048             /* put */ (timeZoneGeographicPoints["Africa/Timbuktu"] = new Compass.GeographicPoint(16.766666, -3.0166667));
27049             /* put */ (timeZoneGeographicPoints["America/Danmarkshavn"] = new Compass.GeographicPoint(76.767, 18.667));
27050             /* put */ (timeZoneGeographicPoints["Atlantic/Canary"] = new Compass.GeographicPoint(28.45, -16.233334));
27051             /* put */ (timeZoneGeographicPoints["Atlantic/Faeroe"] = new Compass.GeographicPoint(62.016666, -6.766667));
27052             /* put */ (timeZoneGeographicPoints["Atlantic/Faroe"] = new Compass.GeographicPoint(62.016666, -6.766667));
27053             /* put */ (timeZoneGeographicPoints["Atlantic/Madeira"] = new Compass.GeographicPoint(32.633335, -16.9));
27054             /* put */ (timeZoneGeographicPoints["Atlantic/Reykjavik"] = new Compass.GeographicPoint(64.15, -21.95));
27055             /* put */ (timeZoneGeographicPoints["Atlantic/St_Helena"] = new Compass.GeographicPoint(-15.933333, -5.7166667));
27056             var greenwich = new Compass.GeographicPoint(51.466667, 0.0);
27057             /* put */ (timeZoneGeographicPoints["Etc/GMT"] = greenwich);
27058             /* put */ (timeZoneGeographicPoints["Etc/GMT+0"] = greenwich);
27059             /* put */ (timeZoneGeographicPoints["Etc/GMT-0"] = greenwich);
27060             /* put */ (timeZoneGeographicPoints["Etc/GMT0"] = greenwich);
27061             /* put */ (timeZoneGeographicPoints["Etc/Greenwich"] = greenwich);
27062             /* put */ (timeZoneGeographicPoints["Etc/UCT"] = greenwich);
27063             /* put */ (timeZoneGeographicPoints["Etc/UTC"] = greenwich);
27064             /* put */ (timeZoneGeographicPoints["Etc/Universal"] = greenwich);
27065             /* put */ (timeZoneGeographicPoints["Etc/Zulu"] = greenwich);
27066             /* put */ (timeZoneGeographicPoints["Europe/Belfast"] = new Compass.GeographicPoint(54.583332, -5.933333));
27067             /* put */ (timeZoneGeographicPoints["Europe/Dublin"] = new Compass.GeographicPoint(53.333057, -6.248889));
27068             /* put */ (timeZoneGeographicPoints["Europe/Guernsey"] = new Compass.GeographicPoint(49.45, -2.533));
27069             /* put */ (timeZoneGeographicPoints["Europe/Isle_of_Man"] = new Compass.GeographicPoint(54.14521, -4.48172));
27070             /* put */ (timeZoneGeographicPoints["Europe/Jersey"] = new Compass.GeographicPoint(49.2, -2.117));
27071             /* put */ (timeZoneGeographicPoints["Europe/Lisbon"] = new Compass.GeographicPoint(38.716667, -9.133333));
27072             /* put */ (timeZoneGeographicPoints["Europe/London"] = new Compass.GeographicPoint(51.5, -0.116667));
27073             /* put */ (timeZoneGeographicPoints["Africa/Algiers"] = new Compass.GeographicPoint(36.763054, 3.0505557));
27074             /* put */ (timeZoneGeographicPoints["Africa/Bangui"] = new Compass.GeographicPoint(4.366667, 18.583334));
27075             /* put */ (timeZoneGeographicPoints["Africa/Brazzaville"] = new Compass.GeographicPoint(-4.2591667, 15.284722));
27076             /* put */ (timeZoneGeographicPoints["Africa/Ceuta"] = new Compass.GeographicPoint(35.890278, -5.3075));
27077             /* put */ (timeZoneGeographicPoints["Africa/Douala"] = new Compass.GeographicPoint(4.0502777, 9.7));
27078             /* put */ (timeZoneGeographicPoints["Africa/Kinshasa"] = new Compass.GeographicPoint(-4.3, 15.3));
27079             /* put */ (timeZoneGeographicPoints["Africa/Lagos"] = new Compass.GeographicPoint(6.4530554, 3.3958333));
27080             /* put */ (timeZoneGeographicPoints["Africa/Libreville"] = new Compass.GeographicPoint(0.3833333, 9.45));
27081             /* put */ (timeZoneGeographicPoints["Africa/Luanda"] = new Compass.GeographicPoint(-8.838333, 13.234445));
27082             /* put */ (timeZoneGeographicPoints["Africa/Malabo"] = new Compass.GeographicPoint(3.75, 8.783333));
27083             /* put */ (timeZoneGeographicPoints["Africa/Ndjamena"] = new Compass.GeographicPoint(12.113055, 15.049167));
27084             /* put */ (timeZoneGeographicPoints["Africa/Niamey"] = new Compass.GeographicPoint(13.516666, 2.1166668));
27085             /* put */ (timeZoneGeographicPoints["Africa/Porto-Novo"] = new Compass.GeographicPoint(6.483333, 2.6166668));
27086             /* put */ (timeZoneGeographicPoints["Africa/Tunis"] = new Compass.GeographicPoint(36.802776, 10.179722));
27087             /* put */ (timeZoneGeographicPoints["Africa/Windhoek"] = new Compass.GeographicPoint(-22.57, 17.08361));
27088             /* put */ (timeZoneGeographicPoints["Arctic/Longyearbyen"] = new Compass.GeographicPoint(78.21667, 15.633333));
27089             /* put */ (timeZoneGeographicPoints["Atlantic/Jan_Mayen"] = new Compass.GeographicPoint(71.0, -8.333));
27090             var paris = new Compass.GeographicPoint(48.86667, 2.333333);
27091             /* put */ (timeZoneGeographicPoints["Etc/GMT-1"] = paris);
27092             /* put */ (timeZoneGeographicPoints["Europe/Amsterdam"] = new Compass.GeographicPoint(52.35, 4.9166665));
27093             /* put */ (timeZoneGeographicPoints["Europe/Andorra"] = new Compass.GeographicPoint(42.5, 1.5166667));
27094             /* put */ (timeZoneGeographicPoints["Europe/Belgrade"] = new Compass.GeographicPoint(44.81861, 20.468056));
27095             /* put */ (timeZoneGeographicPoints["Europe/Berlin"] = new Compass.GeographicPoint(52.516666, 13.4));
27096             /* put */ (timeZoneGeographicPoints["Europe/Bratislava"] = new Compass.GeographicPoint(48.15, 17.116667));
27097             /* put */ (timeZoneGeographicPoints["Europe/Brussels"] = new Compass.GeographicPoint(50.833332, 4.333333));
27098             /* put */ (timeZoneGeographicPoints["Europe/Budapest"] = new Compass.GeographicPoint(47.5, 19.083334));
27099             /* put */ (timeZoneGeographicPoints["Europe/Copenhagen"] = new Compass.GeographicPoint(55.666668, 12.583333));
27100             /* put */ (timeZoneGeographicPoints["Europe/Gibraltar"] = new Compass.GeographicPoint(36.133335, -5.35));
27101             /* put */ (timeZoneGeographicPoints["Europe/Ljubljana"] = new Compass.GeographicPoint(46.05528, 14.514444));
27102             /* put */ (timeZoneGeographicPoints["Europe/Luxembourg"] = new Compass.GeographicPoint(49.611668, 6.13));
27103             /* put */ (timeZoneGeographicPoints["Europe/Madrid"] = new Compass.GeographicPoint(40.4, -3.6833334));
27104             /* put */ (timeZoneGeographicPoints["Europe/Malta"] = new Compass.GeographicPoint(35.899723, 14.514722));
27105             /* put */ (timeZoneGeographicPoints["Europe/Monaco"] = new Compass.GeographicPoint(43.733334, 7.4166665));
27106             /* put */ (timeZoneGeographicPoints["Europe/Oslo"] = new Compass.GeographicPoint(59.916668, 10.75));
27107             /* put */ (timeZoneGeographicPoints["Europe/Paris"] = paris);
27108             /* put */ (timeZoneGeographicPoints["Europe/Podgorica"] = new Compass.GeographicPoint(42.441113, 19.26361));
27109             /* put */ (timeZoneGeographicPoints["Europe/Prague"] = new Compass.GeographicPoint(50.083332, 14.466667));
27110             /* put */ (timeZoneGeographicPoints["Europe/Rome"] = new Compass.GeographicPoint(41.9, 12.483334));
27111             /* put */ (timeZoneGeographicPoints["Europe/San_Marino"] = new Compass.GeographicPoint(43.933334, 12.45));
27112             /* put */ (timeZoneGeographicPoints["Europe/Sarajevo"] = new Compass.GeographicPoint(43.85, 18.383333));
27113             /* put */ (timeZoneGeographicPoints["Europe/Skopje"] = new Compass.GeographicPoint(42.0, 21.433332));
27114             /* put */ (timeZoneGeographicPoints["Europe/Stockholm"] = new Compass.GeographicPoint(59.333332, 18.05));
27115             /* put */ (timeZoneGeographicPoints["Europe/Tirane"] = new Compass.GeographicPoint(41.3275, 19.81889));
27116             /* put */ (timeZoneGeographicPoints["Europe/Vaduz"] = new Compass.GeographicPoint(47.133335, 9.516666));
27117             /* put */ (timeZoneGeographicPoints["Europe/Vatican"] = new Compass.GeographicPoint(41.9, 12.45));
27118             /* put */ (timeZoneGeographicPoints["Europe/Vienna"] = new Compass.GeographicPoint(48.2, 16.366667));
27119             /* put */ (timeZoneGeographicPoints["Europe/Warsaw"] = new Compass.GeographicPoint(52.25, 21.0));
27120             /* put */ (timeZoneGeographicPoints["Europe/Zagreb"] = new Compass.GeographicPoint(45.8, 16.0));
27121             /* put */ (timeZoneGeographicPoints["Europe/Zurich"] = new Compass.GeographicPoint(47.366665, 8.55));
27122             /* put */ (timeZoneGeographicPoints["Africa/Blantyre"] = new Compass.GeographicPoint(-15.783333, 35.0));
27123             /* put */ (timeZoneGeographicPoints["Africa/Bujumbura"] = new Compass.GeographicPoint(-3.376111, 29.36));
27124             /* put */ (timeZoneGeographicPoints["Africa/Cairo"] = new Compass.GeographicPoint(30.05, 31.25));
27125             /* put */ (timeZoneGeographicPoints["Africa/Gaborone"] = new Compass.GeographicPoint(-24.646389, 25.911945));
27126             /* put */ (timeZoneGeographicPoints["Africa/Harare"] = new Compass.GeographicPoint(-17.817778, 31.044722));
27127             /* put */ (timeZoneGeographicPoints["Africa/Johannesburg"] = new Compass.GeographicPoint(-26.2, 28.083334));
27128             /* put */ (timeZoneGeographicPoints["Africa/Kigali"] = new Compass.GeographicPoint(-1.9536111, 30.060556));
27129             /* put */ (timeZoneGeographicPoints["Africa/Lubumbashi"] = new Compass.GeographicPoint(-11.666667, 27.466667));
27130             /* put */ (timeZoneGeographicPoints["Africa/Lusaka"] = new Compass.GeographicPoint(-15.416667, 28.283333));
27131             /* put */ (timeZoneGeographicPoints["Africa/Maputo"] = new Compass.GeographicPoint(-25.965279, 32.58917));
27132             /* put */ (timeZoneGeographicPoints["Africa/Maseru"] = new Compass.GeographicPoint(-29.316668, 27.483334));
27133             /* put */ (timeZoneGeographicPoints["Africa/Mbabane"] = new Compass.GeographicPoint(-26.316668, 31.133333));
27134             /* put */ (timeZoneGeographicPoints["Africa/Tripoli"] = new Compass.GeographicPoint(32.8925, 13.18));
27135             /* put */ (timeZoneGeographicPoints["Asia/Amman"] = new Compass.GeographicPoint(31.95, 35.933334));
27136             /* put */ (timeZoneGeographicPoints["Asia/Beirut"] = new Compass.GeographicPoint(33.871944, 35.509724));
27137             /* put */ (timeZoneGeographicPoints["Asia/Damascus"] = new Compass.GeographicPoint(33.5, 36.3));
27138             /* put */ (timeZoneGeographicPoints["Asia/Gaza"] = new Compass.GeographicPoint(31.5, 34.466667));
27139             /* put */ (timeZoneGeographicPoints["Asia/Istanbul"] = new Compass.GeographicPoint(41.018612, 28.964722));
27140             /* put */ (timeZoneGeographicPoints["Asia/Jerusalem"] = new Compass.GeographicPoint(31.78, 35.23));
27141             /* put */ (timeZoneGeographicPoints["Asia/Nicosia"] = new Compass.GeographicPoint(35.166668, 33.366665));
27142             /* put */ (timeZoneGeographicPoints["Asia/Tel_Aviv"] = new Compass.GeographicPoint(32.066666, 34.766666));
27143             var athens = new Compass.GeographicPoint(37.983334, 23.733334);
27144             /* put */ (timeZoneGeographicPoints["Etc/GMT-2"] = athens);
27145             /* put */ (timeZoneGeographicPoints["Europe/Athens"] = new Compass.GeographicPoint(37.983334, 23.733334));
27146             /* put */ (timeZoneGeographicPoints["Europe/Bucharest"] = new Compass.GeographicPoint(44.433334, 26.1));
27147             /* put */ (timeZoneGeographicPoints["Europe/Chisinau"] = new Compass.GeographicPoint(47.005554, 28.8575));
27148             /* put */ (timeZoneGeographicPoints["Europe/Helsinki"] = new Compass.GeographicPoint(60.175556, 24.934166));
27149             /* put */ (timeZoneGeographicPoints["Europe/Istanbul"] = new Compass.GeographicPoint(41.018612, 28.964722));
27150             /* put */ (timeZoneGeographicPoints["Europe/Kaliningrad"] = new Compass.GeographicPoint(54.71, 20.5));
27151             /* put */ (timeZoneGeographicPoints["Europe/Kiev"] = new Compass.GeographicPoint(50.433334, 30.516666));
27152             /* put */ (timeZoneGeographicPoints["Europe/Mariehamn"] = new Compass.GeographicPoint(60.1, 19.95));
27153             /* put */ (timeZoneGeographicPoints["Europe/Minsk"] = new Compass.GeographicPoint(53.9, 27.566668));
27154             /* put */ (timeZoneGeographicPoints["Europe/Nicosia"] = new Compass.GeographicPoint(35.166668, 33.366665));
27155             /* put */ (timeZoneGeographicPoints["Europe/Riga"] = new Compass.GeographicPoint(56.95, 24.1));
27156             /* put */ (timeZoneGeographicPoints["Europe/Simferopol"] = new Compass.GeographicPoint(44.95, 34.1));
27157             /* put */ (timeZoneGeographicPoints["Europe/Sofia"] = new Compass.GeographicPoint(42.683334, 23.316668));
27158             /* put */ (timeZoneGeographicPoints["Europe/Tallinn"] = new Compass.GeographicPoint(59.433887, 24.728056));
27159             /* put */ (timeZoneGeographicPoints["Europe/Tiraspol"] = new Compass.GeographicPoint(46.84028, 29.643333));
27160             /* put */ (timeZoneGeographicPoints["Europe/Uzhgorod"] = new Compass.GeographicPoint(48.616665, 22.3));
27161             /* put */ (timeZoneGeographicPoints["Europe/Vilnius"] = new Compass.GeographicPoint(54.683334, 25.316668));
27162             /* put */ (timeZoneGeographicPoints["Europe/Zaporozhye"] = new Compass.GeographicPoint(47.833, 35.1667));
27163             /* put */ (timeZoneGeographicPoints["Africa/Addis_Ababa"] = new Compass.GeographicPoint(9.033333, 38.7));
27164             /* put */ (timeZoneGeographicPoints["Africa/Asmara"] = new Compass.GeographicPoint(15.333333, 38.933334));
27165             /* put */ (timeZoneGeographicPoints["Africa/Asmera"] = new Compass.GeographicPoint(15.333333, 38.933334));
27166             /* put */ (timeZoneGeographicPoints["Africa/Dar_es_Salaam"] = new Compass.GeographicPoint(-6.8, 39.283333));
27167             /* put */ (timeZoneGeographicPoints["Africa/Djibouti"] = new Compass.GeographicPoint(11.595, 43.148056));
27168             /* put */ (timeZoneGeographicPoints["Africa/Kampala"] = new Compass.GeographicPoint(0.3155556, 32.565556));
27169             /* put */ (timeZoneGeographicPoints["Africa/Khartoum"] = new Compass.GeographicPoint(15.588056, 32.53417));
27170             /* put */ (timeZoneGeographicPoints["Africa/Mogadishu"] = new Compass.GeographicPoint(2.0666666, 45.366665));
27171             /* put */ (timeZoneGeographicPoints["Africa/Nairobi"] = new Compass.GeographicPoint(-1.2833333, 36.816666));
27172             /* put */ (timeZoneGeographicPoints["Antarctica/Syowa"] = new Compass.GeographicPoint(-69.0, 39.5833));
27173             /* put */ (timeZoneGeographicPoints["Asia/Aden"] = new Compass.GeographicPoint(12.779445, 45.036667));
27174             /* put */ (timeZoneGeographicPoints["Asia/Baghdad"] = new Compass.GeographicPoint(33.33861, 44.39389));
27175             /* put */ (timeZoneGeographicPoints["Asia/Bahrain"] = new Compass.GeographicPoint(26.23611, 50.583057));
27176             /* put */ (timeZoneGeographicPoints["Asia/Kuwait"] = new Compass.GeographicPoint(29.369722, 47.978333));
27177             /* put */ (timeZoneGeographicPoints["Asia/Qatar"] = new Compass.GeographicPoint(25.286667, 51.533333));
27178             /* put */ (timeZoneGeographicPoints["Asia/Riyadh"] = new Compass.GeographicPoint(24.640833, 46.772778));
27179             var moscow = new Compass.GeographicPoint(55.752224, 37.615555);
27180             /* put */ (timeZoneGeographicPoints["Etc/GMT-3"] = moscow);
27181             /* put */ (timeZoneGeographicPoints["Europe/Moscow"] = moscow);
27182             /* put */ (timeZoneGeographicPoints["Europe/Volgograd"] = new Compass.GeographicPoint(48.80472, 44.585835));
27183             /* put */ (timeZoneGeographicPoints["Indian/Antananarivo"] = new Compass.GeographicPoint(-18.916666, 47.516666));
27184             /* put */ (timeZoneGeographicPoints["Indian/Comoro"] = new Compass.GeographicPoint(-11.704166, 43.240276));
27185             /* put */ (timeZoneGeographicPoints["Indian/Mayotte"] = new Compass.GeographicPoint(-12.779445, 45.227222));
27186             /* put */ (timeZoneGeographicPoints["Asia/Riyadh87"] = new Compass.GeographicPoint(24.640833, 46.772778));
27187             /* put */ (timeZoneGeographicPoints["Asia/Riyadh88"] = new Compass.GeographicPoint(24.640833, 46.772778));
27188             /* put */ (timeZoneGeographicPoints["Asia/Riyadh89"] = new Compass.GeographicPoint(24.640833, 46.772778));
27189             /* put */ (timeZoneGeographicPoints["Mideast/Riyadh87"] = new Compass.GeographicPoint(24.640833, 46.772778));
27190             /* put */ (timeZoneGeographicPoints["Mideast/Riyadh88"] = new Compass.GeographicPoint(24.640833, 46.772778));
27191             /* put */ (timeZoneGeographicPoints["Mideast/Riyadh89"] = new Compass.GeographicPoint(24.640833, 46.772778));
27192             /* put */ (timeZoneGeographicPoints["Asia/Tehran"] = new Compass.GeographicPoint(35.671944, 51.424446));
27193             /* put */ (timeZoneGeographicPoints["Asia/Baku"] = new Compass.GeographicPoint(40.39528, 49.88222));
27194             var dubai = new Compass.GeographicPoint(25.252222, 55.28);
27195             /* put */ (timeZoneGeographicPoints["Asia/Dubai"] = dubai);
27196             /* put */ (timeZoneGeographicPoints["Asia/Muscat"] = new Compass.GeographicPoint(23.613333, 58.593334));
27197             /* put */ (timeZoneGeographicPoints["Asia/Tbilisi"] = new Compass.GeographicPoint(41.725, 44.790833));
27198             /* put */ (timeZoneGeographicPoints["Asia/Yerevan"] = new Compass.GeographicPoint(40.18111, 44.51361));
27199             /* put */ (timeZoneGeographicPoints["Etc/GMT-4"] = dubai);
27200             /* put */ (timeZoneGeographicPoints["Europe/Samara"] = new Compass.GeographicPoint(53.2, 50.15));
27201             /* put */ (timeZoneGeographicPoints["Indian/Mahe"] = new Compass.GeographicPoint(-4.616667, 55.45));
27202             /* put */ (timeZoneGeographicPoints["Indian/Mauritius"] = new Compass.GeographicPoint(-20.161945, 57.49889));
27203             /* put */ (timeZoneGeographicPoints["Indian/Reunion"] = new Compass.GeographicPoint(-20.866667, 55.466667));
27204             /* put */ (timeZoneGeographicPoints["Asia/Kabul"] = new Compass.GeographicPoint(34.516666, 69.183334));
27205             /* put */ (timeZoneGeographicPoints["Antarctica/Davis"] = new Compass.GeographicPoint(-68.5764, 77.9689));
27206             /* put */ (timeZoneGeographicPoints["Antarctica/Mawson"] = new Compass.GeographicPoint(-53.104, 73.514));
27207             /* put */ (timeZoneGeographicPoints["Asia/Aqtau"] = new Compass.GeographicPoint(43.65, 51.2));
27208             /* put */ (timeZoneGeographicPoints["Asia/Aqtobe"] = new Compass.GeographicPoint(50.298054, 57.18139));
27209             /* put */ (timeZoneGeographicPoints["Asia/Ashgabat"] = new Compass.GeographicPoint(37.95, 58.383335));
27210             /* put */ (timeZoneGeographicPoints["Asia/Ashkhabad"] = new Compass.GeographicPoint(37.95, 58.383335));
27211             /* put */ (timeZoneGeographicPoints["Asia/Dushanbe"] = new Compass.GeographicPoint(38.56, 68.77389));
27212             /* put */ (timeZoneGeographicPoints["Asia/Karachi"] = new Compass.GeographicPoint(24.866667, 67.05));
27213             /* put */ (timeZoneGeographicPoints["Asia/Oral"] = new Compass.GeographicPoint(51.233334, 51.366665));
27214             /* put */ (timeZoneGeographicPoints["Asia/Samarkand"] = new Compass.GeographicPoint(39.654167, 66.959724));
27215             /* put */ (timeZoneGeographicPoints["Asia/Tashkent"] = new Compass.GeographicPoint(41.316666, 69.25));
27216             /* put */ (timeZoneGeographicPoints["Asia/Yekaterinburg"] = new Compass.GeographicPoint(56.85, 60.6));
27217             var calcutta = new Compass.GeographicPoint(22.569721, 88.36972);
27218             /* put */ (timeZoneGeographicPoints["Etc/GMT-5"] = calcutta);
27219             /* put */ (timeZoneGeographicPoints["Indian/Kerguelen"] = new Compass.GeographicPoint(-49.25, 69.583));
27220             /* put */ (timeZoneGeographicPoints["Indian/Maldives"] = new Compass.GeographicPoint(4.1666665, 73.5));
27221             /* put */ (timeZoneGeographicPoints["Asia/Calcutta"] = calcutta);
27222             /* put */ (timeZoneGeographicPoints["Asia/Colombo"] = new Compass.GeographicPoint(6.9319444, 79.84778));
27223             /* put */ (timeZoneGeographicPoints["Asia/Kolkata"] = calcutta);
27224             /* put */ (timeZoneGeographicPoints["Asia/Kathmandu"] = new Compass.GeographicPoint(27.716667, 85.316666));
27225             /* put */ (timeZoneGeographicPoints["Asia/Katmandu"] = new Compass.GeographicPoint(27.716667, 85.316666));
27226             /* put */ (timeZoneGeographicPoints["Antarctica/Vostok"] = new Compass.GeographicPoint(-78.4644, 106.8372));
27227             /* put */ (timeZoneGeographicPoints["Asia/Almaty"] = new Compass.GeographicPoint(43.25, 76.95));
27228             /* put */ (timeZoneGeographicPoints["Asia/Bishkek"] = new Compass.GeographicPoint(42.873055, 74.60028));
27229             var dacca = new Compass.GeographicPoint(23.723055, 90.40861);
27230             /* put */ (timeZoneGeographicPoints["Asia/Dacca"] = dacca);
27231             /* put */ (timeZoneGeographicPoints["Asia/Dhaka"] = dacca);
27232             /* put */ (timeZoneGeographicPoints["Asia/Novokuznetsk"] = new Compass.GeographicPoint(53.75, 87.1));
27233             /* put */ (timeZoneGeographicPoints["Asia/Novosibirsk"] = new Compass.GeographicPoint(55.04111, 82.93444));
27234             /* put */ (timeZoneGeographicPoints["Asia/Omsk"] = new Compass.GeographicPoint(55.0, 73.4));
27235             /* put */ (timeZoneGeographicPoints["Asia/Qyzylorda"] = new Compass.GeographicPoint(44.85278, 65.50916));
27236             /* put */ (timeZoneGeographicPoints["Asia/Thimbu"] = new Compass.GeographicPoint(27.483334, 89.6));
27237             /* put */ (timeZoneGeographicPoints["Asia/Thimphu"] = new Compass.GeographicPoint(27.483334, 89.6));
27238             /* put */ (timeZoneGeographicPoints["Etc/GMT-6"] = dacca);
27239             /* put */ (timeZoneGeographicPoints["Indian/Chagos"] = new Compass.GeographicPoint(-6.0, 71.5));
27240             /* put */ (timeZoneGeographicPoints["Asia/Rangoon"] = new Compass.GeographicPoint(16.783333, 96.166664));
27241             /* put */ (timeZoneGeographicPoints["Indian/Cocos"] = new Compass.GeographicPoint(-12.1167, 96.9));
27242             var bangkok = new Compass.GeographicPoint(13.75, 100.51667);
27243             /* put */ (timeZoneGeographicPoints["Asia/Bangkok"] = bangkok);
27244             /* put */ (timeZoneGeographicPoints["Asia/Ho_Chi_Minh"] = new Compass.GeographicPoint(10.75, 106.666664));
27245             /* put */ (timeZoneGeographicPoints["Asia/Hovd"] = new Compass.GeographicPoint(48.016666, 91.63333));
27246             /* put */ (timeZoneGeographicPoints["Asia/Jakarta"] = new Compass.GeographicPoint(-6.174444, 106.829445));
27247             /* put */ (timeZoneGeographicPoints["Asia/Krasnoyarsk"] = new Compass.GeographicPoint(56.009724, 92.791664));
27248             /* put */ (timeZoneGeographicPoints["Asia/Phnom_Penh"] = new Compass.GeographicPoint(11.55, 104.916664));
27249             /* put */ (timeZoneGeographicPoints["Asia/Pontianak"] = new Compass.GeographicPoint(-0.0333333, 109.333336));
27250             /* put */ (timeZoneGeographicPoints["Asia/Saigon"] = new Compass.GeographicPoint(10.75, 106.666664));
27251             /* put */ (timeZoneGeographicPoints["Asia/Vientiane"] = new Compass.GeographicPoint(17.966667, 102.6));
27252             /* put */ (timeZoneGeographicPoints["Etc/GMT-7"] = bangkok);
27253             /* put */ (timeZoneGeographicPoints["Indian/Christmas"] = new Compass.GeographicPoint(-10.416667, 105.71667));
27254             /* put */ (timeZoneGeographicPoints["Asia/Brunei"] = new Compass.GeographicPoint(4.883333, 114.933334));
27255             /* put */ (timeZoneGeographicPoints["Asia/Choibalsan"] = new Compass.GeographicPoint(48.066666, 114.5));
27256             /* put */ (timeZoneGeographicPoints["Asia/Chongqing"] = new Compass.GeographicPoint(29.562778, 106.55278));
27257             /* put */ (timeZoneGeographicPoints["Asia/Chungking"] = new Compass.GeographicPoint(29.562778, 106.55278));
27258             /* put */ (timeZoneGeographicPoints["Asia/Harbin"] = new Compass.GeographicPoint(45.75, 126.65));
27259             /* put */ (timeZoneGeographicPoints["Asia/Hong_Kong"] = new Compass.GeographicPoint(22.283333, 114.15));
27260             /* put */ (timeZoneGeographicPoints["Asia/Irkutsk"] = new Compass.GeographicPoint(52.266666, 104.333336));
27261             /* put */ (timeZoneGeographicPoints["Asia/Kashgar"] = new Compass.GeographicPoint(39.391388, 76.04));
27262             /* put */ (timeZoneGeographicPoints["Asia/Kuala_Lumpur"] = new Compass.GeographicPoint(3.1666667, 101.7));
27263             /* put */ (timeZoneGeographicPoints["Asia/Kuching"] = new Compass.GeographicPoint(1.55, 110.333336));
27264             /* put */ (timeZoneGeographicPoints["Asia/Macao"] = new Compass.GeographicPoint(22.2, 113.55));
27265             /* put */ (timeZoneGeographicPoints["Asia/Macau"] = new Compass.GeographicPoint(22.2, 113.55));
27266             /* put */ (timeZoneGeographicPoints["Asia/Makassar"] = new Compass.GeographicPoint(2.45, 99.78333));
27267             /* put */ (timeZoneGeographicPoints["Asia/Manila"] = new Compass.GeographicPoint(14.604167, 120.98222));
27268             var shanghai = new Compass.GeographicPoint(31.005, 121.40861);
27269             /* put */ (timeZoneGeographicPoints["Asia/Shanghai"] = shanghai);
27270             /* put */ (timeZoneGeographicPoints["Asia/Singapore"] = new Compass.GeographicPoint(1.2930557, 103.855835));
27271             /* put */ (timeZoneGeographicPoints["Asia/Taipei"] = new Compass.GeographicPoint(25.039167, 121.525));
27272             /* put */ (timeZoneGeographicPoints["Asia/Ujung_Pandang"] = new Compass.GeographicPoint(-5.1305556, 119.406944));
27273             /* put */ (timeZoneGeographicPoints["Asia/Ulaanbaatar"] = new Compass.GeographicPoint(47.916668, 106.916664));
27274             /* put */ (timeZoneGeographicPoints["Asia/Ulan_Bator"] = new Compass.GeographicPoint(47.916668, 106.916664));
27275             /* put */ (timeZoneGeographicPoints["Asia/Urumqi"] = new Compass.GeographicPoint(43.8, 87.583336));
27276             /* put */ (timeZoneGeographicPoints["Australia/Perth"] = new Compass.GeographicPoint(-31.933332, 115.833336));
27277             /* put */ (timeZoneGeographicPoints["Australia/West"] = new Compass.GeographicPoint(-31.933332, 115.833336));
27278             /* put */ (timeZoneGeographicPoints["Etc/GMT-8"] = shanghai);
27279             /* put */ (timeZoneGeographicPoints["Australia/Eucla"] = new Compass.GeographicPoint(-31.716667, 128.86667));
27280             /* put */ (timeZoneGeographicPoints["Asia/Dili"] = new Compass.GeographicPoint(-8.55, 125.5833));
27281             /* put */ (timeZoneGeographicPoints["Asia/Jayapura"] = new Compass.GeographicPoint(-2.5333333, 140.7));
27282             /* put */ (timeZoneGeographicPoints["Asia/Pyongyang"] = new Compass.GeographicPoint(39.019444, 125.75472));
27283             /* put */ (timeZoneGeographicPoints["Asia/Seoul"] = new Compass.GeographicPoint(37.566387, 126.999725));
27284             var tokyo = new Compass.GeographicPoint(35.685, 139.75139);
27285             /* put */ (timeZoneGeographicPoints["Asia/Tokyo"] = tokyo);
27286             /* put */ (timeZoneGeographicPoints["Asia/Yakutsk"] = new Compass.GeographicPoint(62.03389, 129.73306));
27287             /* put */ (timeZoneGeographicPoints["Etc/GMT-9"] = tokyo);
27288             /* put */ (timeZoneGeographicPoints["Pacific/Palau"] = new Compass.GeographicPoint(7.5, 134.6241));
27289             /* put */ (timeZoneGeographicPoints["Australia/Adelaide"] = new Compass.GeographicPoint(-34.933334, 138.6));
27290             /* put */ (timeZoneGeographicPoints["Australia/Broken_Hill"] = new Compass.GeographicPoint(-31.95, 141.43333));
27291             /* put */ (timeZoneGeographicPoints["Australia/Darwin"] = new Compass.GeographicPoint(-12.466667, 130.83333));
27292             /* put */ (timeZoneGeographicPoints["Australia/North"] = new Compass.GeographicPoint(-12.466667, 130.83333));
27293             /* put */ (timeZoneGeographicPoints["Australia/South"] = new Compass.GeographicPoint(-34.933334, 138.6));
27294             /* put */ (timeZoneGeographicPoints["Australia/Yancowinna"] = new Compass.GeographicPoint(-31.7581, 141.7178));
27295             /* put */ (timeZoneGeographicPoints["Antarctica/DumontDUrville"] = new Compass.GeographicPoint(-66.66277, 140.0014));
27296             /* put */ (timeZoneGeographicPoints["Asia/Sakhalin"] = new Compass.GeographicPoint(51.0, 143.0));
27297             /* put */ (timeZoneGeographicPoints["Asia/Vladivostok"] = new Compass.GeographicPoint(43.133335, 131.9));
27298             /* put */ (timeZoneGeographicPoints["Australia/ACT"] = new Compass.GeographicPoint(-35.283333, 149.21666));
27299             /* put */ (timeZoneGeographicPoints["Australia/Brisbane"] = new Compass.GeographicPoint(-27.5, 153.01666));
27300             /* put */ (timeZoneGeographicPoints["Australia/Canberra"] = new Compass.GeographicPoint(-35.283333, 149.21666));
27301             /* put */ (timeZoneGeographicPoints["Australia/Currie"] = new Compass.GeographicPoint(-39.933334, 143.86667));
27302             /* put */ (timeZoneGeographicPoints["Australia/Hobart"] = new Compass.GeographicPoint(-42.916668, 147.33333));
27303             /* put */ (timeZoneGeographicPoints["Australia/Lindeman"] = new Compass.GeographicPoint(-20.45, 149.0333));
27304             /* put */ (timeZoneGeographicPoints["Australia/Melbourne"] = new Compass.GeographicPoint(-37.816666, 144.96666));
27305             var sydney = new Compass.GeographicPoint(-33.88333, 151.21666);
27306             /* put */ (timeZoneGeographicPoints["Australia/NSW"] = sydney);
27307             /* put */ (timeZoneGeographicPoints["Australia/Queensland"] = new Compass.GeographicPoint(-27.5, 153.01666));
27308             /* put */ (timeZoneGeographicPoints["Australia/Sydney"] = sydney);
27309             /* put */ (timeZoneGeographicPoints["Australia/Tasmania"] = new Compass.GeographicPoint(-42.916668, 147.33333));
27310             /* put */ (timeZoneGeographicPoints["Australia/Victoria"] = new Compass.GeographicPoint(-37.816666, 144.96666));
27311             /* put */ (timeZoneGeographicPoints["Etc/GMT-10"] = sydney);
27312             /* put */ (timeZoneGeographicPoints["Pacific/Guam"] = new Compass.GeographicPoint(13.467, 144.75));
27313             /* put */ (timeZoneGeographicPoints["Pacific/Port_Moresby"] = new Compass.GeographicPoint(-9.464723, 147.1925));
27314             /* put */ (timeZoneGeographicPoints["Pacific/Saipan"] = new Compass.GeographicPoint(15.1833, 145.75));
27315             /* put */ (timeZoneGeographicPoints["Pacific/Truk"] = new Compass.GeographicPoint(7.4167, 151.7833));
27316             /* put */ (timeZoneGeographicPoints["Pacific/Yap"] = new Compass.GeographicPoint(9.514444, 138.12917));
27317             /* put */ (timeZoneGeographicPoints["Australia/LHI"] = new Compass.GeographicPoint(-31.55, 159.083));
27318             /* put */ (timeZoneGeographicPoints["Australia/Lord_Howe"] = new Compass.GeographicPoint(-31.55, 159.083));
27319             /* put */ (timeZoneGeographicPoints["Antarctica/Casey"] = new Compass.GeographicPoint(-66.2833, 110.5333));
27320             /* put */ (timeZoneGeographicPoints["Asia/Magadan"] = new Compass.GeographicPoint(59.566666, 150.8));
27321             var noumea = new Compass.GeographicPoint(-22.266666, 166.45);
27322             /* put */ (timeZoneGeographicPoints["Etc/GMT-11"] = noumea);
27323             /* put */ (timeZoneGeographicPoints["Pacific/Efate"] = new Compass.GeographicPoint(-17.667, 168.417));
27324             /* put */ (timeZoneGeographicPoints["Pacific/Guadalcanal"] = new Compass.GeographicPoint(-9.617, 160.183));
27325             /* put */ (timeZoneGeographicPoints["Pacific/Kosrae"] = new Compass.GeographicPoint(5.317, 162.983));
27326             /* put */ (timeZoneGeographicPoints["Pacific/Noumea"] = noumea);
27327             /* put */ (timeZoneGeographicPoints["Pacific/Ponape"] = new Compass.GeographicPoint(6.963889, 158.20833));
27328             /* put */ (timeZoneGeographicPoints["Pacific/Norfolk"] = new Compass.GeographicPoint(-29.05, 167.95));
27329             /* put */ (timeZoneGeographicPoints["Antarctica/McMurdo"] = new Compass.GeographicPoint(-77.85, 166.667));
27330             /* put */ (timeZoneGeographicPoints["Antarctica/South_Pole"] = new Compass.GeographicPoint(-90.0, 0.0));
27331             /* put */ (timeZoneGeographicPoints["Asia/Anadyr"] = new Compass.GeographicPoint(64.75, 177.48334));
27332             /* put */ (timeZoneGeographicPoints["Asia/Kamchatka"] = new Compass.GeographicPoint(57.0, 160.0));
27333             var auckland = new Compass.GeographicPoint(-36.86667, 174.76666);
27334             /* put */ (timeZoneGeographicPoints["Etc/GMT-12"] = auckland);
27335             /* put */ (timeZoneGeographicPoints["Pacific/Auckland"] = auckland);
27336             /* put */ (timeZoneGeographicPoints["Pacific/Fiji"] = new Compass.GeographicPoint(-18.133333, 178.41667));
27337             /* put */ (timeZoneGeographicPoints["Pacific/Funafuti"] = new Compass.GeographicPoint(-8.516666, 179.21666));
27338             /* put */ (timeZoneGeographicPoints["Pacific/Kwajalein"] = new Compass.GeographicPoint(9.1939, 167.4597));
27339             /* put */ (timeZoneGeographicPoints["Pacific/Majuro"] = new Compass.GeographicPoint(7.1, 171.38333));
27340             /* put */ (timeZoneGeographicPoints["Pacific/Nauru"] = new Compass.GeographicPoint(-0.5322, 166.9328));
27341             /* put */ (timeZoneGeographicPoints["Pacific/Tarawa"] = new Compass.GeographicPoint(1.4167, 173.0333));
27342             /* put */ (timeZoneGeographicPoints["Pacific/Wake"] = new Compass.GeographicPoint(19.2833, 166.6));
27343             /* put */ (timeZoneGeographicPoints["Pacific/Wallis"] = new Compass.GeographicPoint(-13.273, -176.205));
27344             /* put */ (timeZoneGeographicPoints["Pacific/Chatham"] = new Compass.GeographicPoint(-43.883, -176.517));
27345             var enderbury = new Compass.GeographicPoint(-3.133, -171.0833);
27346             /* put */ (timeZoneGeographicPoints["Etc/GMT-13"] = enderbury);
27347             /* put */ (timeZoneGeographicPoints["Pacific/Enderbury"] = enderbury);
27348             /* put */ (timeZoneGeographicPoints["Pacific/Tongatapu"] = new Compass.GeographicPoint(-21.2114, -175.153));
27349             var kiritimati = new Compass.GeographicPoint(1.883, -157.4);
27350             /* put */ (timeZoneGeographicPoints["Etc/GMT-14"] = kiritimati);
27351             /* put */ (timeZoneGeographicPoints["Pacific/Kiritimati"] = kiritimati);
27352             /* put */ (timeZoneGeographicPoints["MIT"] = apia);
27353             /* put */ (timeZoneGeographicPoints["HST"] = honolulu);
27354             /* put */ (timeZoneGeographicPoints["PST"] = losAngeles);
27355             /* put */ (timeZoneGeographicPoints["PST8PDT"] = losAngeles);
27356             /* put */ (timeZoneGeographicPoints["MST"] = denver);
27357             /* put */ (timeZoneGeographicPoints["MST7MDT"] = denver);
27358             /* put */ (timeZoneGeographicPoints["Navajo"] = new Compass.GeographicPoint(35.6728, -109.0622));
27359             /* put */ (timeZoneGeographicPoints["PNT"] = new Compass.GeographicPoint(33.448334, -112.07333));
27360             /* put */ (timeZoneGeographicPoints["America/Indiana/Knox"] = new Compass.GeographicPoint(41.295834, -86.625));
27361             /* put */ (timeZoneGeographicPoints["America/Indiana/Tell_City"] = new Compass.GeographicPoint(37.953, -86.7614));
27362             /* put */ (timeZoneGeographicPoints["America/North_Dakota/Center"] = new Compass.GeographicPoint(47.115, -101.3003));
27363             /* put */ (timeZoneGeographicPoints["America/North_Dakota/New_Salem"] = new Compass.GeographicPoint(46.843, 101.4119));
27364             /* put */ (timeZoneGeographicPoints["CST"] = chicago);
27365             /* put */ (timeZoneGeographicPoints["CST6CDT"] = chicago);
27366             /* put */ (timeZoneGeographicPoints["America/Indiana/Indianapolis"] = new Compass.GeographicPoint(39.768333, -86.15806));
27367             /* put */ (timeZoneGeographicPoints["America/Indiana/Marengo"] = new Compass.GeographicPoint(36.3706, -86.3433));
27368             /* put */ (timeZoneGeographicPoints["America/Indiana/Petersburg"] = new Compass.GeographicPoint(38.4917, -87.2803));
27369             /* put */ (timeZoneGeographicPoints["America/Indiana/Vevay"] = new Compass.GeographicPoint(38.7458, -85.0711));
27370             /* put */ (timeZoneGeographicPoints["America/Indiana/Vincennes"] = new Compass.GeographicPoint(38.6783, -87.5164));
27371             /* put */ (timeZoneGeographicPoints["America/Indiana/Winamac"] = new Compass.GeographicPoint(41.0525, -86.6044));
27372             /* put */ (timeZoneGeographicPoints["America/Kentucky/Louisville"] = new Compass.GeographicPoint(38.2542, -85.7603));
27373             /* put */ (timeZoneGeographicPoints["America/Kentucky/Monticello"] = new Compass.GeographicPoint(36.8381, -84.85));
27374             /* put */ (timeZoneGeographicPoints["Cuba"] = new Compass.GeographicPoint(23.131945, -82.36417));
27375             /* put */ (timeZoneGeographicPoints["EST"] = newYork);
27376             /* put */ (timeZoneGeographicPoints["EST5EDT"] = newYork);
27377             /* put */ (timeZoneGeographicPoints["IET"] = newYork);
27378             /* put */ (timeZoneGeographicPoints["AST"] = new Compass.GeographicPoint(44.65, -63.6));
27379             /* put */ (timeZoneGeographicPoints["Jamaica"] = new Compass.GeographicPoint(18.0, -76.8));
27380             /* put */ (timeZoneGeographicPoints["America/Argentina/San_Luis"] = new Compass.GeographicPoint(-33.3, -66.333));
27381             /* put */ (timeZoneGeographicPoints["PRT"] = new Compass.GeographicPoint(18.467, 66.117));
27382             /* put */ (timeZoneGeographicPoints["CNT"] = new Compass.GeographicPoint(47.5675, -52.7072));
27383             /* put */ (timeZoneGeographicPoints["AGT"] = new Compass.GeographicPoint(-34.5875, -58.6725));
27384             /* put */ (timeZoneGeographicPoints["America/Argentina/Buenos_Aires"] = new Compass.GeographicPoint(-34.5875, -58.6725));
27385             /* put */ (timeZoneGeographicPoints["America/Argentina/Catamarca"] = new Compass.GeographicPoint(-28.466667, -65.78333));
27386             /* put */ (timeZoneGeographicPoints["America/Argentina/ComodRivadavia"] = new Compass.GeographicPoint(-42.7578, -65.0297));
27387             /* put */ (timeZoneGeographicPoints["America/Argentina/Cordoba"] = new Compass.GeographicPoint(-31.4, -64.183334));
27388             /* put */ (timeZoneGeographicPoints["America/Argentina/Jujuy"] = new Compass.GeographicPoint(-24.183332, -65.3));
27389             /* put */ (timeZoneGeographicPoints["America/Argentina/La_Rioja"] = new Compass.GeographicPoint(-29.4144, -66.8552));
27390             /* put */ (timeZoneGeographicPoints["America/Argentina/Mendoza"] = new Compass.GeographicPoint(-32.883335, -68.816666));
27391             /* put */ (timeZoneGeographicPoints["America/Argentina/Rio_Gallegos"] = new Compass.GeographicPoint(-51.625, -69.2286));
27392             /* put */ (timeZoneGeographicPoints["America/Argentina/Salta"] = new Compass.GeographicPoint(-24.783333, -65.416664));
27393             /* put */ (timeZoneGeographicPoints["America/Argentina/San_Juan"] = new Compass.GeographicPoint(-31.5333, -68.5167));
27394             /* put */ (timeZoneGeographicPoints["America/Argentina/Tucuman"] = new Compass.GeographicPoint(-26.8167, 65.2167));
27395             /* put */ (timeZoneGeographicPoints["America/Argentina/Ushuaia"] = new Compass.GeographicPoint(-54.6, -68.3));
27396             /* put */ (timeZoneGeographicPoints["BET"] = saoPaulo);
27397             /* put */ (timeZoneGeographicPoints["Eire"] = new Compass.GeographicPoint(53.333057, -6.248889));
27398             /* put */ (timeZoneGeographicPoints["GB"] = greenwich);
27399             /* put */ (timeZoneGeographicPoints["GB-Eire"] = new Compass.GeographicPoint(53.333057, -6.248889));
27400             /* put */ (timeZoneGeographicPoints["GMT"] = greenwich);
27401             /* put */ (timeZoneGeographicPoints["GMT0"] = greenwich);
27402             /* put */ (timeZoneGeographicPoints["Greenwich"] = greenwich);
27403             /* put */ (timeZoneGeographicPoints["Iceland"] = new Compass.GeographicPoint(64.1333, -21.9333));
27404             /* put */ (timeZoneGeographicPoints["Portugal"] = new Compass.GeographicPoint(38.716667, -9.133333));
27405             /* put */ (timeZoneGeographicPoints["UCT"] = greenwich);
27406             /* put */ (timeZoneGeographicPoints["UTC"] = greenwich);
27407             /* put */ (timeZoneGeographicPoints["Universal"] = greenwich);
27408             /* put */ (timeZoneGeographicPoints["WET"] = greenwich);
27409             /* put */ (timeZoneGeographicPoints["Zulu"] = greenwich);
27410             /* put */ (timeZoneGeographicPoints["CET"] = paris);
27411             /* put */ (timeZoneGeographicPoints["ECT"] = paris);
27412             /* put */ (timeZoneGeographicPoints["MET"] = new Compass.GeographicPoint(35.671944, 51.424446));
27413             /* put */ (timeZoneGeographicPoints["Poland"] = new Compass.GeographicPoint(52.25, 21.0));
27414             /* put */ (timeZoneGeographicPoints["ART"] = new Compass.GeographicPoint(-34.5875, -58.6725));
27415             /* put */ (timeZoneGeographicPoints["CAT"] = new Compass.GeographicPoint(-1.9536111, 30.060556));
27416             /* put */ (timeZoneGeographicPoints["EET"] = new Compass.GeographicPoint(37.983334, 23.733334));
27417             /* put */ (timeZoneGeographicPoints["Egypt"] = new Compass.GeographicPoint(30.05, 31.25));
27418             /* put */ (timeZoneGeographicPoints["Israel"] = new Compass.GeographicPoint(32.066666, 34.766666));
27419             /* put */ (timeZoneGeographicPoints["Libya"] = new Compass.GeographicPoint(32.8925, 13.18));
27420             /* put */ (timeZoneGeographicPoints["Turkey"] = new Compass.GeographicPoint(41.018612, 28.964722));
27421             /* put */ (timeZoneGeographicPoints["EAT"] = new Compass.GeographicPoint(-1.2833333, 36.816666));
27422             /* put */ (timeZoneGeographicPoints["W-SU"] = moscow);
27423             /* put */ (timeZoneGeographicPoints["Iran"] = new Compass.GeographicPoint(35.671944, 51.424446));
27424             /* put */ (timeZoneGeographicPoints["NET"] = new Compass.GeographicPoint(40.18111, 44.51361));
27425             /* put */ (timeZoneGeographicPoints["PLT"] = new Compass.GeographicPoint(24.866667, 67.05));
27426             /* put */ (timeZoneGeographicPoints["IST"] = calcutta);
27427             /* put */ (timeZoneGeographicPoints["BST"] = dacca);
27428             /* put */ (timeZoneGeographicPoints["VST"] = bangkok);
27429             /* put */ (timeZoneGeographicPoints["CTT"] = shanghai);
27430             /* put */ (timeZoneGeographicPoints["Hongkong"] = new Compass.GeographicPoint(22.283333, 114.15));
27431             /* put */ (timeZoneGeographicPoints["PRC"] = shanghai);
27432             /* put */ (timeZoneGeographicPoints["Singapore"] = new Compass.GeographicPoint(1.2930557, 103.855835));
27433             /* put */ (timeZoneGeographicPoints["JST"] = tokyo);
27434             /* put */ (timeZoneGeographicPoints["Japan"] = tokyo);
27435             /* put */ (timeZoneGeographicPoints["ROK"] = new Compass.GeographicPoint(37.566387, 126.999725));
27436             /* put */ (timeZoneGeographicPoints["ACT"] = new Compass.GeographicPoint(-35.283333, 149.21666));
27437             /* put */ (timeZoneGeographicPoints["AET"] = sydney);
27438             /* put */ (timeZoneGeographicPoints["SST"] = new Compass.GeographicPoint(-28.4667, 159.8167));
27439             /* put */ (timeZoneGeographicPoints["Kwajalein"] = new Compass.GeographicPoint(9.1939, 167.4597));
27440             /* put */ (timeZoneGeographicPoints["NST"] = auckland);
27441             /* put */ (timeZoneGeographicPoints["NZ"] = auckland);
27442             /* put */ (timeZoneGeographicPoints["NZ-CHAT"] = new Compass.GeographicPoint(-43.883, -176.517));
27443             Compass.timeZoneGeographicPointsReference = (timeZoneGeographicPoints);
27444         }
27445         var point = (function (m, k) { return m[k] === undefined ? null : m[k]; })(timeZoneGeographicPoints, /* getID */ /* getDefault */ "UTC");
27446         if (point == null) {
27447             point = /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(timeZoneGeographicPoints, "Etc/GMT");
27448         }
27449         this.latitude = (function (x) { return x * Math.PI / 180; })(point.getLatitudeInDegrees());
27450         this.longitude = (function (x) { return x * Math.PI / 180; })(point.getLongitudeInDegrees());
27451     };
27452     Compass.timeZoneGeographicPointsReference = null;
27453     return Compass;
27454 }(HomeObject));
27455 Compass["__class"] = "com.eteks.sweethome3d.model.Compass";
27456 Compass["__interfaces"] = ["com.eteks.sweethome3d.model.Selectable"];
27457 (function (Compass) {
27458     /**
27459      * A geographic point used to store known points.
27460      * @param {number} latitudeInDegrees
27461      * @param {number} longitudeInDegrees
27462      * @class
27463      */
27464     var GeographicPoint = /** @class */ (function () {
27465         function GeographicPoint(latitudeInDegrees, longitudeInDegrees) {
27466             if (this.latitudeInDegrees === undefined) {
27467                 this.latitudeInDegrees = 0;
27468             }
27469             if (this.longitudeInDegrees === undefined) {
27470                 this.longitudeInDegrees = 0;
27471             }
27472             this.latitudeInDegrees = latitudeInDegrees;
27473             this.longitudeInDegrees = longitudeInDegrees;
27474         }
27475         GeographicPoint.prototype.getLatitudeInDegrees = function () {
27476             return this.latitudeInDegrees;
27477         };
27478         GeographicPoint.prototype.getLongitudeInDegrees = function () {
27479             return this.longitudeInDegrees;
27480         };
27481         return GeographicPoint;
27482     }());
27483     Compass.GeographicPoint = GeographicPoint;
27484     GeographicPoint["__class"] = "com.eteks.sweethome3d.model.Compass.GeographicPoint";
27485 })(Compass || (Compass = {}));
27486 Compass['__transients'] = ['pointsCache', 'dateCache', 'sunElevationCache', 'sunAzimuthCache', 'propertyChangeSupport'];
27487 /**
27488  * Creates a wall from (<code>xStart</code>,<code>yStart</code>)
27489  * to (<code>xEnd</code>, <code>yEnd</code>),
27490  * with given thickness, height and pattern.
27491  * Colors are <code>null</code>.
27492  * @param {string} id
27493  * @param {number} xStart
27494  * @param {number} yStart
27495  * @param {number} xEnd
27496  * @param {number} yEnd
27497  * @param {number} thickness
27498  * @param {number} height
27499  * @param {Object} pattern
27500  * @class
27501  * @extends HomeObject
27502  * @author Emmanuel Puybaret
27503  */
27504 var Wall = /** @class */ (function (_super) {
27505     __extends(Wall, _super);
27506     function Wall(id, xStart, yStart, xEnd, yEnd, thickness, height, pattern) {
27507         var _this = this;
27508         if (((typeof id === 'string') || id === null) && ((typeof xStart === 'number') || xStart === null) && ((typeof yStart === 'number') || yStart === null) && ((typeof xEnd === 'number') || xEnd === null) && ((typeof yEnd === 'number') || yEnd === null) && ((typeof thickness === 'number') || thickness === null) && ((typeof height === 'number') || height === null) && ((pattern != null && (pattern.constructor != null && pattern.constructor["__interfaces"] != null && pattern.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.TextureImage") >= 0)) || pattern === null)) {
27509             var __args = arguments;
27510             _this = _super.call(this, id) || this;
27511             if (_this.xStart === undefined) {
27512                 _this.xStart = 0;
27513             }
27514             if (_this.yStart === undefined) {
27515                 _this.yStart = 0;
27516             }
27517             if (_this.xEnd === undefined) {
27518                 _this.xEnd = 0;
27519             }
27520             if (_this.yEnd === undefined) {
27521                 _this.yEnd = 0;
27522             }
27523             if (_this.arcExtent === undefined) {
27524                 _this.arcExtent = null;
27525             }
27526             if (_this.wallAtStart === undefined) {
27527                 _this.wallAtStart = null;
27528             }
27529             if (_this.wallAtEnd === undefined) {
27530                 _this.wallAtEnd = null;
27531             }
27532             if (_this.thickness === undefined) {
27533                 _this.thickness = 0;
27534             }
27535             if (_this.height === undefined) {
27536                 _this.height = null;
27537             }
27538             if (_this.heightAtEnd === undefined) {
27539                 _this.heightAtEnd = null;
27540             }
27541             if (_this.leftSideColor === undefined) {
27542                 _this.leftSideColor = null;
27543             }
27544             if (_this.leftSideTexture === undefined) {
27545                 _this.leftSideTexture = null;
27546             }
27547             if (_this.leftSideShininess === undefined) {
27548                 _this.leftSideShininess = 0;
27549             }
27550             if (_this.leftSideBaseboard === undefined) {
27551                 _this.leftSideBaseboard = null;
27552             }
27553             if (_this.rightSideColor === undefined) {
27554                 _this.rightSideColor = null;
27555             }
27556             if (_this.rightSideTexture === undefined) {
27557                 _this.rightSideTexture = null;
27558             }
27559             if (_this.rightSideShininess === undefined) {
27560                 _this.rightSideShininess = 0;
27561             }
27562             if (_this.rightSideBaseboard === undefined) {
27563                 _this.rightSideBaseboard = null;
27564             }
27565             if (_this.pattern === undefined) {
27566                 _this.pattern = null;
27567             }
27568             if (_this.topColor === undefined) {
27569                 _this.topColor = null;
27570             }
27571             if (_this.level === undefined) {
27572                 _this.level = null;
27573             }
27574             if (_this.shapeCache === undefined) {
27575                 _this.shapeCache = null;
27576             }
27577             if (_this.arcCircleCenterCache === undefined) {
27578                 _this.arcCircleCenterCache = null;
27579             }
27580             if (_this.pointsCache === undefined) {
27581                 _this.pointsCache = null;
27582             }
27583             if (_this.pointsIncludingBaseboardsCache === undefined) {
27584                 _this.pointsIncludingBaseboardsCache = null;
27585             }
27586             _this.symmetric = true;
27587             _this.xStart = xStart;
27588             _this.yStart = yStart;
27589             _this.xEnd = xEnd;
27590             _this.yEnd = yEnd;
27591             _this.thickness = thickness;
27592             _this.height = height;
27593             _this.pattern = pattern;
27594         }
27595         else if (((typeof id === 'string') || id === null) && ((typeof xStart === 'number') || xStart === null) && ((typeof yStart === 'number') || yStart === null) && ((typeof xEnd === 'number') || xEnd === null) && ((typeof yEnd === 'number') || yEnd === null) && ((typeof thickness === 'number') || thickness === null) && ((typeof height === 'number') || height === null) && pattern === undefined) {
27596             var __args = arguments;
27597             {
27598                 var __args_80 = arguments;
27599                 var pattern_1 = null;
27600                 _this = _super.call(this, id) || this;
27601                 if (_this.xStart === undefined) {
27602                     _this.xStart = 0;
27603                 }
27604                 if (_this.yStart === undefined) {
27605                     _this.yStart = 0;
27606                 }
27607                 if (_this.xEnd === undefined) {
27608                     _this.xEnd = 0;
27609                 }
27610                 if (_this.yEnd === undefined) {
27611                     _this.yEnd = 0;
27612                 }
27613                 if (_this.arcExtent === undefined) {
27614                     _this.arcExtent = null;
27615                 }
27616                 if (_this.wallAtStart === undefined) {
27617                     _this.wallAtStart = null;
27618                 }
27619                 if (_this.wallAtEnd === undefined) {
27620                     _this.wallAtEnd = null;
27621                 }
27622                 if (_this.thickness === undefined) {
27623                     _this.thickness = 0;
27624                 }
27625                 if (_this.height === undefined) {
27626                     _this.height = null;
27627                 }
27628                 if (_this.heightAtEnd === undefined) {
27629                     _this.heightAtEnd = null;
27630                 }
27631                 if (_this.leftSideColor === undefined) {
27632                     _this.leftSideColor = null;
27633                 }
27634                 if (_this.leftSideTexture === undefined) {
27635                     _this.leftSideTexture = null;
27636                 }
27637                 if (_this.leftSideShininess === undefined) {
27638                     _this.leftSideShininess = 0;
27639                 }
27640                 if (_this.leftSideBaseboard === undefined) {
27641                     _this.leftSideBaseboard = null;
27642                 }
27643                 if (_this.rightSideColor === undefined) {
27644                     _this.rightSideColor = null;
27645                 }
27646                 if (_this.rightSideTexture === undefined) {
27647                     _this.rightSideTexture = null;
27648                 }
27649                 if (_this.rightSideShininess === undefined) {
27650                     _this.rightSideShininess = 0;
27651                 }
27652                 if (_this.rightSideBaseboard === undefined) {
27653                     _this.rightSideBaseboard = null;
27654                 }
27655                 if (_this.pattern === undefined) {
27656                     _this.pattern = null;
27657                 }
27658                 if (_this.topColor === undefined) {
27659                     _this.topColor = null;
27660                 }
27661                 if (_this.level === undefined) {
27662                     _this.level = null;
27663                 }
27664                 if (_this.shapeCache === undefined) {
27665                     _this.shapeCache = null;
27666                 }
27667                 if (_this.arcCircleCenterCache === undefined) {
27668                     _this.arcCircleCenterCache = null;
27669                 }
27670                 if (_this.pointsCache === undefined) {
27671                     _this.pointsCache = null;
27672                 }
27673                 if (_this.pointsIncludingBaseboardsCache === undefined) {
27674                     _this.pointsIncludingBaseboardsCache = null;
27675                 }
27676                 _this.symmetric = true;
27677                 _this.xStart = xStart;
27678                 _this.yStart = yStart;
27679                 _this.xEnd = xEnd;
27680                 _this.yEnd = yEnd;
27681                 _this.thickness = thickness;
27682                 _this.height = height;
27683                 _this.pattern = pattern_1;
27684             }
27685             if (_this.xStart === undefined) {
27686                 _this.xStart = 0;
27687             }
27688             if (_this.yStart === undefined) {
27689                 _this.yStart = 0;
27690             }
27691             if (_this.xEnd === undefined) {
27692                 _this.xEnd = 0;
27693             }
27694             if (_this.yEnd === undefined) {
27695                 _this.yEnd = 0;
27696             }
27697             if (_this.arcExtent === undefined) {
27698                 _this.arcExtent = null;
27699             }
27700             if (_this.wallAtStart === undefined) {
27701                 _this.wallAtStart = null;
27702             }
27703             if (_this.wallAtEnd === undefined) {
27704                 _this.wallAtEnd = null;
27705             }
27706             if (_this.thickness === undefined) {
27707                 _this.thickness = 0;
27708             }
27709             if (_this.height === undefined) {
27710                 _this.height = null;
27711             }
27712             if (_this.heightAtEnd === undefined) {
27713                 _this.heightAtEnd = null;
27714             }
27715             if (_this.leftSideColor === undefined) {
27716                 _this.leftSideColor = null;
27717             }
27718             if (_this.leftSideTexture === undefined) {
27719                 _this.leftSideTexture = null;
27720             }
27721             if (_this.leftSideShininess === undefined) {
27722                 _this.leftSideShininess = 0;
27723             }
27724             if (_this.leftSideBaseboard === undefined) {
27725                 _this.leftSideBaseboard = null;
27726             }
27727             if (_this.rightSideColor === undefined) {
27728                 _this.rightSideColor = null;
27729             }
27730             if (_this.rightSideTexture === undefined) {
27731                 _this.rightSideTexture = null;
27732             }
27733             if (_this.rightSideShininess === undefined) {
27734                 _this.rightSideShininess = 0;
27735             }
27736             if (_this.rightSideBaseboard === undefined) {
27737                 _this.rightSideBaseboard = null;
27738             }
27739             if (_this.pattern === undefined) {
27740                 _this.pattern = null;
27741             }
27742             if (_this.topColor === undefined) {
27743                 _this.topColor = null;
27744             }
27745             if (_this.level === undefined) {
27746                 _this.level = null;
27747             }
27748             if (_this.shapeCache === undefined) {
27749                 _this.shapeCache = null;
27750             }
27751             if (_this.arcCircleCenterCache === undefined) {
27752                 _this.arcCircleCenterCache = null;
27753             }
27754             if (_this.pointsCache === undefined) {
27755                 _this.pointsCache = null;
27756             }
27757             if (_this.pointsIncludingBaseboardsCache === undefined) {
27758                 _this.pointsIncludingBaseboardsCache = null;
27759             }
27760             _this.symmetric = true;
27761         }
27762         else if (((typeof id === 'number') || id === null) && ((typeof xStart === 'number') || xStart === null) && ((typeof yStart === 'number') || yStart === null) && ((typeof xEnd === 'number') || xEnd === null) && ((typeof yEnd === 'number') || yEnd === null) && ((typeof thickness === 'number') || thickness === null) && ((height != null && (height.constructor != null && height.constructor["__interfaces"] != null && height.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.TextureImage") >= 0)) || height === null) && pattern === undefined) {
27763             var __args = arguments;
27764             var xStart_1 = __args[0];
27765             var yStart_1 = __args[1];
27766             var xEnd_1 = __args[2];
27767             var yEnd_1 = __args[3];
27768             var thickness_2 = __args[4];
27769             var height_13 = __args[5];
27770             var pattern_2 = __args[6];
27771             {
27772                 var __args_81 = arguments;
27773                 var id_14 = HomeObject.createId("wall");
27774                 _this = _super.call(this, id_14) || this;
27775                 if (_this.xStart === undefined) {
27776                     _this.xStart = 0;
27777                 }
27778                 if (_this.yStart === undefined) {
27779                     _this.yStart = 0;
27780                 }
27781                 if (_this.xEnd === undefined) {
27782                     _this.xEnd = 0;
27783                 }
27784                 if (_this.yEnd === undefined) {
27785                     _this.yEnd = 0;
27786                 }
27787                 if (_this.arcExtent === undefined) {
27788                     _this.arcExtent = null;
27789                 }
27790                 if (_this.wallAtStart === undefined) {
27791                     _this.wallAtStart = null;
27792                 }
27793                 if (_this.wallAtEnd === undefined) {
27794                     _this.wallAtEnd = null;
27795                 }
27796                 if (_this.thickness === undefined) {
27797                     _this.thickness = 0;
27798                 }
27799                 if (_this.height === undefined) {
27800                     _this.height = null;
27801                 }
27802                 if (_this.heightAtEnd === undefined) {
27803                     _this.heightAtEnd = null;
27804                 }
27805                 if (_this.leftSideColor === undefined) {
27806                     _this.leftSideColor = null;
27807                 }
27808                 if (_this.leftSideTexture === undefined) {
27809                     _this.leftSideTexture = null;
27810                 }
27811                 if (_this.leftSideShininess === undefined) {
27812                     _this.leftSideShininess = 0;
27813                 }
27814                 if (_this.leftSideBaseboard === undefined) {
27815                     _this.leftSideBaseboard = null;
27816                 }
27817                 if (_this.rightSideColor === undefined) {
27818                     _this.rightSideColor = null;
27819                 }
27820                 if (_this.rightSideTexture === undefined) {
27821                     _this.rightSideTexture = null;
27822                 }
27823                 if (_this.rightSideShininess === undefined) {
27824                     _this.rightSideShininess = 0;
27825                 }
27826                 if (_this.rightSideBaseboard === undefined) {
27827                     _this.rightSideBaseboard = null;
27828                 }
27829                 if (_this.pattern === undefined) {
27830                     _this.pattern = null;
27831                 }
27832                 if (_this.topColor === undefined) {
27833                     _this.topColor = null;
27834                 }
27835                 if (_this.level === undefined) {
27836                     _this.level = null;
27837                 }
27838                 if (_this.shapeCache === undefined) {
27839                     _this.shapeCache = null;
27840                 }
27841                 if (_this.arcCircleCenterCache === undefined) {
27842                     _this.arcCircleCenterCache = null;
27843                 }
27844                 if (_this.pointsCache === undefined) {
27845                     _this.pointsCache = null;
27846                 }
27847                 if (_this.pointsIncludingBaseboardsCache === undefined) {
27848                     _this.pointsIncludingBaseboardsCache = null;
27849                 }
27850                 _this.symmetric = true;
27851                 _this.xStart = xStart_1;
27852                 _this.yStart = yStart_1;
27853                 _this.xEnd = xEnd_1;
27854                 _this.yEnd = yEnd_1;
27855                 _this.thickness = thickness_2;
27856                 _this.height = height_13;
27857                 _this.pattern = pattern_2;
27858             }
27859             if (_this.xStart === undefined) {
27860                 _this.xStart = 0;
27861             }
27862             if (_this.yStart === undefined) {
27863                 _this.yStart = 0;
27864             }
27865             if (_this.xEnd === undefined) {
27866                 _this.xEnd = 0;
27867             }
27868             if (_this.yEnd === undefined) {
27869                 _this.yEnd = 0;
27870             }
27871             if (_this.arcExtent === undefined) {
27872                 _this.arcExtent = null;
27873             }
27874             if (_this.wallAtStart === undefined) {
27875                 _this.wallAtStart = null;
27876             }
27877             if (_this.wallAtEnd === undefined) {
27878                 _this.wallAtEnd = null;
27879             }
27880             if (_this.thickness === undefined) {
27881                 _this.thickness = 0;
27882             }
27883             if (_this.height === undefined) {
27884                 _this.height = null;
27885             }
27886             if (_this.heightAtEnd === undefined) {
27887                 _this.heightAtEnd = null;
27888             }
27889             if (_this.leftSideColor === undefined) {
27890                 _this.leftSideColor = null;
27891             }
27892             if (_this.leftSideTexture === undefined) {
27893                 _this.leftSideTexture = null;
27894             }
27895             if (_this.leftSideShininess === undefined) {
27896                 _this.leftSideShininess = 0;
27897             }
27898             if (_this.leftSideBaseboard === undefined) {
27899                 _this.leftSideBaseboard = null;
27900             }
27901             if (_this.rightSideColor === undefined) {
27902                 _this.rightSideColor = null;
27903             }
27904             if (_this.rightSideTexture === undefined) {
27905                 _this.rightSideTexture = null;
27906             }
27907             if (_this.rightSideShininess === undefined) {
27908                 _this.rightSideShininess = 0;
27909             }
27910             if (_this.rightSideBaseboard === undefined) {
27911                 _this.rightSideBaseboard = null;
27912             }
27913             if (_this.pattern === undefined) {
27914                 _this.pattern = null;
27915             }
27916             if (_this.topColor === undefined) {
27917                 _this.topColor = null;
27918             }
27919             if (_this.level === undefined) {
27920                 _this.level = null;
27921             }
27922             if (_this.shapeCache === undefined) {
27923                 _this.shapeCache = null;
27924             }
27925             if (_this.arcCircleCenterCache === undefined) {
27926                 _this.arcCircleCenterCache = null;
27927             }
27928             if (_this.pointsCache === undefined) {
27929                 _this.pointsCache = null;
27930             }
27931             if (_this.pointsIncludingBaseboardsCache === undefined) {
27932                 _this.pointsIncludingBaseboardsCache = null;
27933             }
27934             _this.symmetric = true;
27935         }
27936         else if (((typeof id === 'number') || id === null) && ((typeof xStart === 'number') || xStart === null) && ((typeof yStart === 'number') || yStart === null) && ((typeof xEnd === 'number') || xEnd === null) && ((typeof yEnd === 'number') || yEnd === null) && ((typeof thickness === 'number') || thickness === null) && height === undefined && pattern === undefined) {
27937             var __args = arguments;
27938             var xStart_2 = __args[0];
27939             var yStart_2 = __args[1];
27940             var xEnd_2 = __args[2];
27941             var yEnd_2 = __args[3];
27942             var thickness_3 = __args[4];
27943             var height_14 = __args[5];
27944             {
27945                 var __args_82 = arguments;
27946                 var pattern_3 = null;
27947                 {
27948                     var __args_83 = arguments;
27949                     var id_15 = HomeObject.createId("wall");
27950                     _this = _super.call(this, id_15) || this;
27951                     if (_this.xStart === undefined) {
27952                         _this.xStart = 0;
27953                     }
27954                     if (_this.yStart === undefined) {
27955                         _this.yStart = 0;
27956                     }
27957                     if (_this.xEnd === undefined) {
27958                         _this.xEnd = 0;
27959                     }
27960                     if (_this.yEnd === undefined) {
27961                         _this.yEnd = 0;
27962                     }
27963                     if (_this.arcExtent === undefined) {
27964                         _this.arcExtent = null;
27965                     }
27966                     if (_this.wallAtStart === undefined) {
27967                         _this.wallAtStart = null;
27968                     }
27969                     if (_this.wallAtEnd === undefined) {
27970                         _this.wallAtEnd = null;
27971                     }
27972                     if (_this.thickness === undefined) {
27973                         _this.thickness = 0;
27974                     }
27975                     if (_this.height === undefined) {
27976                         _this.height = null;
27977                     }
27978                     if (_this.heightAtEnd === undefined) {
27979                         _this.heightAtEnd = null;
27980                     }
27981                     if (_this.leftSideColor === undefined) {
27982                         _this.leftSideColor = null;
27983                     }
27984                     if (_this.leftSideTexture === undefined) {
27985                         _this.leftSideTexture = null;
27986                     }
27987                     if (_this.leftSideShininess === undefined) {
27988                         _this.leftSideShininess = 0;
27989                     }
27990                     if (_this.leftSideBaseboard === undefined) {
27991                         _this.leftSideBaseboard = null;
27992                     }
27993                     if (_this.rightSideColor === undefined) {
27994                         _this.rightSideColor = null;
27995                     }
27996                     if (_this.rightSideTexture === undefined) {
27997                         _this.rightSideTexture = null;
27998                     }
27999                     if (_this.rightSideShininess === undefined) {
28000                         _this.rightSideShininess = 0;
28001                     }
28002                     if (_this.rightSideBaseboard === undefined) {
28003                         _this.rightSideBaseboard = null;
28004                     }
28005                     if (_this.pattern === undefined) {
28006                         _this.pattern = null;
28007                     }
28008                     if (_this.topColor === undefined) {
28009                         _this.topColor = null;
28010                     }
28011                     if (_this.level === undefined) {
28012                         _this.level = null;
28013                     }
28014                     if (_this.shapeCache === undefined) {
28015                         _this.shapeCache = null;
28016                     }
28017                     if (_this.arcCircleCenterCache === undefined) {
28018                         _this.arcCircleCenterCache = null;
28019                     }
28020                     if (_this.pointsCache === undefined) {
28021                         _this.pointsCache = null;
28022                     }
28023                     if (_this.pointsIncludingBaseboardsCache === undefined) {
28024                         _this.pointsIncludingBaseboardsCache = null;
28025                     }
28026                     _this.symmetric = true;
28027                     _this.xStart = xStart_2;
28028                     _this.yStart = yStart_2;
28029                     _this.xEnd = xEnd_2;
28030                     _this.yEnd = yEnd_2;
28031                     _this.thickness = thickness_3;
28032                     _this.height = height_14;
28033                     _this.pattern = pattern_3;
28034                 }
28035                 if (_this.xStart === undefined) {
28036                     _this.xStart = 0;
28037                 }
28038                 if (_this.yStart === undefined) {
28039                     _this.yStart = 0;
28040                 }
28041                 if (_this.xEnd === undefined) {
28042                     _this.xEnd = 0;
28043                 }
28044                 if (_this.yEnd === undefined) {
28045                     _this.yEnd = 0;
28046                 }
28047                 if (_this.arcExtent === undefined) {
28048                     _this.arcExtent = null;
28049                 }
28050                 if (_this.wallAtStart === undefined) {
28051                     _this.wallAtStart = null;
28052                 }
28053                 if (_this.wallAtEnd === undefined) {
28054                     _this.wallAtEnd = null;
28055                 }
28056                 if (_this.thickness === undefined) {
28057                     _this.thickness = 0;
28058                 }
28059                 if (_this.height === undefined) {
28060                     _this.height = null;
28061                 }
28062                 if (_this.heightAtEnd === undefined) {
28063                     _this.heightAtEnd = null;
28064                 }
28065                 if (_this.leftSideColor === undefined) {
28066                     _this.leftSideColor = null;
28067                 }
28068                 if (_this.leftSideTexture === undefined) {
28069                     _this.leftSideTexture = null;
28070                 }
28071                 if (_this.leftSideShininess === undefined) {
28072                     _this.leftSideShininess = 0;
28073                 }
28074                 if (_this.leftSideBaseboard === undefined) {
28075                     _this.leftSideBaseboard = null;
28076                 }
28077                 if (_this.rightSideColor === undefined) {
28078                     _this.rightSideColor = null;
28079                 }
28080                 if (_this.rightSideTexture === undefined) {
28081                     _this.rightSideTexture = null;
28082                 }
28083                 if (_this.rightSideShininess === undefined) {
28084                     _this.rightSideShininess = 0;
28085                 }
28086                 if (_this.rightSideBaseboard === undefined) {
28087                     _this.rightSideBaseboard = null;
28088                 }
28089                 if (_this.pattern === undefined) {
28090                     _this.pattern = null;
28091                 }
28092                 if (_this.topColor === undefined) {
28093                     _this.topColor = null;
28094                 }
28095                 if (_this.level === undefined) {
28096                     _this.level = null;
28097                 }
28098                 if (_this.shapeCache === undefined) {
28099                     _this.shapeCache = null;
28100                 }
28101                 if (_this.arcCircleCenterCache === undefined) {
28102                     _this.arcCircleCenterCache = null;
28103                 }
28104                 if (_this.pointsCache === undefined) {
28105                     _this.pointsCache = null;
28106                 }
28107                 if (_this.pointsIncludingBaseboardsCache === undefined) {
28108                     _this.pointsIncludingBaseboardsCache = null;
28109                 }
28110                 _this.symmetric = true;
28111             }
28112             if (_this.xStart === undefined) {
28113                 _this.xStart = 0;
28114             }
28115             if (_this.yStart === undefined) {
28116                 _this.yStart = 0;
28117             }
28118             if (_this.xEnd === undefined) {
28119                 _this.xEnd = 0;
28120             }
28121             if (_this.yEnd === undefined) {
28122                 _this.yEnd = 0;
28123             }
28124             if (_this.arcExtent === undefined) {
28125                 _this.arcExtent = null;
28126             }
28127             if (_this.wallAtStart === undefined) {
28128                 _this.wallAtStart = null;
28129             }
28130             if (_this.wallAtEnd === undefined) {
28131                 _this.wallAtEnd = null;
28132             }
28133             if (_this.thickness === undefined) {
28134                 _this.thickness = 0;
28135             }
28136             if (_this.height === undefined) {
28137                 _this.height = null;
28138             }
28139             if (_this.heightAtEnd === undefined) {
28140                 _this.heightAtEnd = null;
28141             }
28142             if (_this.leftSideColor === undefined) {
28143                 _this.leftSideColor = null;
28144             }
28145             if (_this.leftSideTexture === undefined) {
28146                 _this.leftSideTexture = null;
28147             }
28148             if (_this.leftSideShininess === undefined) {
28149                 _this.leftSideShininess = 0;
28150             }
28151             if (_this.leftSideBaseboard === undefined) {
28152                 _this.leftSideBaseboard = null;
28153             }
28154             if (_this.rightSideColor === undefined) {
28155                 _this.rightSideColor = null;
28156             }
28157             if (_this.rightSideTexture === undefined) {
28158                 _this.rightSideTexture = null;
28159             }
28160             if (_this.rightSideShininess === undefined) {
28161                 _this.rightSideShininess = 0;
28162             }
28163             if (_this.rightSideBaseboard === undefined) {
28164                 _this.rightSideBaseboard = null;
28165             }
28166             if (_this.pattern === undefined) {
28167                 _this.pattern = null;
28168             }
28169             if (_this.topColor === undefined) {
28170                 _this.topColor = null;
28171             }
28172             if (_this.level === undefined) {
28173                 _this.level = null;
28174             }
28175             if (_this.shapeCache === undefined) {
28176                 _this.shapeCache = null;
28177             }
28178             if (_this.arcCircleCenterCache === undefined) {
28179                 _this.arcCircleCenterCache = null;
28180             }
28181             if (_this.pointsCache === undefined) {
28182                 _this.pointsCache = null;
28183             }
28184             if (_this.pointsIncludingBaseboardsCache === undefined) {
28185                 _this.pointsIncludingBaseboardsCache = null;
28186             }
28187             _this.symmetric = true;
28188         }
28189         else if (((typeof id === 'number') || id === null) && ((typeof xStart === 'number') || xStart === null) && ((typeof yStart === 'number') || yStart === null) && ((typeof xEnd === 'number') || xEnd === null) && ((typeof yEnd === 'number') || yEnd === null) && thickness === undefined && height === undefined && pattern === undefined) {
28190             var __args = arguments;
28191             var xStart_3 = __args[0];
28192             var yStart_3 = __args[1];
28193             var xEnd_3 = __args[2];
28194             var yEnd_3 = __args[3];
28195             var thickness_4 = __args[4];
28196             {
28197                 var __args_84 = arguments;
28198                 var height_15 = 0;
28199                 {
28200                     var __args_85 = arguments;
28201                     var pattern_4 = null;
28202                     {
28203                         var __args_86 = arguments;
28204                         var id_16 = HomeObject.createId("wall");
28205                         _this = _super.call(this, id_16) || this;
28206                         if (_this.xStart === undefined) {
28207                             _this.xStart = 0;
28208                         }
28209                         if (_this.yStart === undefined) {
28210                             _this.yStart = 0;
28211                         }
28212                         if (_this.xEnd === undefined) {
28213                             _this.xEnd = 0;
28214                         }
28215                         if (_this.yEnd === undefined) {
28216                             _this.yEnd = 0;
28217                         }
28218                         if (_this.arcExtent === undefined) {
28219                             _this.arcExtent = null;
28220                         }
28221                         if (_this.wallAtStart === undefined) {
28222                             _this.wallAtStart = null;
28223                         }
28224                         if (_this.wallAtEnd === undefined) {
28225                             _this.wallAtEnd = null;
28226                         }
28227                         if (_this.thickness === undefined) {
28228                             _this.thickness = 0;
28229                         }
28230                         if (_this.height === undefined) {
28231                             _this.height = null;
28232                         }
28233                         if (_this.heightAtEnd === undefined) {
28234                             _this.heightAtEnd = null;
28235                         }
28236                         if (_this.leftSideColor === undefined) {
28237                             _this.leftSideColor = null;
28238                         }
28239                         if (_this.leftSideTexture === undefined) {
28240                             _this.leftSideTexture = null;
28241                         }
28242                         if (_this.leftSideShininess === undefined) {
28243                             _this.leftSideShininess = 0;
28244                         }
28245                         if (_this.leftSideBaseboard === undefined) {
28246                             _this.leftSideBaseboard = null;
28247                         }
28248                         if (_this.rightSideColor === undefined) {
28249                             _this.rightSideColor = null;
28250                         }
28251                         if (_this.rightSideTexture === undefined) {
28252                             _this.rightSideTexture = null;
28253                         }
28254                         if (_this.rightSideShininess === undefined) {
28255                             _this.rightSideShininess = 0;
28256                         }
28257                         if (_this.rightSideBaseboard === undefined) {
28258                             _this.rightSideBaseboard = null;
28259                         }
28260                         if (_this.pattern === undefined) {
28261                             _this.pattern = null;
28262                         }
28263                         if (_this.topColor === undefined) {
28264                             _this.topColor = null;
28265                         }
28266                         if (_this.level === undefined) {
28267                             _this.level = null;
28268                         }
28269                         if (_this.shapeCache === undefined) {
28270                             _this.shapeCache = null;
28271                         }
28272                         if (_this.arcCircleCenterCache === undefined) {
28273                             _this.arcCircleCenterCache = null;
28274                         }
28275                         if (_this.pointsCache === undefined) {
28276                             _this.pointsCache = null;
28277                         }
28278                         if (_this.pointsIncludingBaseboardsCache === undefined) {
28279                             _this.pointsIncludingBaseboardsCache = null;
28280                         }
28281                         _this.symmetric = true;
28282                         _this.xStart = xStart_3;
28283                         _this.yStart = yStart_3;
28284                         _this.xEnd = xEnd_3;
28285                         _this.yEnd = yEnd_3;
28286                         _this.thickness = thickness_4;
28287                         _this.height = height_15;
28288                         _this.pattern = pattern_4;
28289                     }
28290                     if (_this.xStart === undefined) {
28291                         _this.xStart = 0;
28292                     }
28293                     if (_this.yStart === undefined) {
28294                         _this.yStart = 0;
28295                     }
28296                     if (_this.xEnd === undefined) {
28297                         _this.xEnd = 0;
28298                     }
28299                     if (_this.yEnd === undefined) {
28300                         _this.yEnd = 0;
28301                     }
28302                     if (_this.arcExtent === undefined) {
28303                         _this.arcExtent = null;
28304                     }
28305                     if (_this.wallAtStart === undefined) {
28306                         _this.wallAtStart = null;
28307                     }
28308                     if (_this.wallAtEnd === undefined) {
28309                         _this.wallAtEnd = null;
28310                     }
28311                     if (_this.thickness === undefined) {
28312                         _this.thickness = 0;
28313                     }
28314                     if (_this.height === undefined) {
28315                         _this.height = null;
28316                     }
28317                     if (_this.heightAtEnd === undefined) {
28318                         _this.heightAtEnd = null;
28319                     }
28320                     if (_this.leftSideColor === undefined) {
28321                         _this.leftSideColor = null;
28322                     }
28323                     if (_this.leftSideTexture === undefined) {
28324                         _this.leftSideTexture = null;
28325                     }
28326                     if (_this.leftSideShininess === undefined) {
28327                         _this.leftSideShininess = 0;
28328                     }
28329                     if (_this.leftSideBaseboard === undefined) {
28330                         _this.leftSideBaseboard = null;
28331                     }
28332                     if (_this.rightSideColor === undefined) {
28333                         _this.rightSideColor = null;
28334                     }
28335                     if (_this.rightSideTexture === undefined) {
28336                         _this.rightSideTexture = null;
28337                     }
28338                     if (_this.rightSideShininess === undefined) {
28339                         _this.rightSideShininess = 0;
28340                     }
28341                     if (_this.rightSideBaseboard === undefined) {
28342                         _this.rightSideBaseboard = null;
28343                     }
28344                     if (_this.pattern === undefined) {
28345                         _this.pattern = null;
28346                     }
28347                     if (_this.topColor === undefined) {
28348                         _this.topColor = null;
28349                     }
28350                     if (_this.level === undefined) {
28351                         _this.level = null;
28352                     }
28353                     if (_this.shapeCache === undefined) {
28354                         _this.shapeCache = null;
28355                     }
28356                     if (_this.arcCircleCenterCache === undefined) {
28357                         _this.arcCircleCenterCache = null;
28358                     }
28359                     if (_this.pointsCache === undefined) {
28360                         _this.pointsCache = null;
28361                     }
28362                     if (_this.pointsIncludingBaseboardsCache === undefined) {
28363                         _this.pointsIncludingBaseboardsCache = null;
28364                     }
28365                     _this.symmetric = true;
28366                 }
28367                 if (_this.xStart === undefined) {
28368                     _this.xStart = 0;
28369                 }
28370                 if (_this.yStart === undefined) {
28371                     _this.yStart = 0;
28372                 }
28373                 if (_this.xEnd === undefined) {
28374                     _this.xEnd = 0;
28375                 }
28376                 if (_this.yEnd === undefined) {
28377                     _this.yEnd = 0;
28378                 }
28379                 if (_this.arcExtent === undefined) {
28380                     _this.arcExtent = null;
28381                 }
28382                 if (_this.wallAtStart === undefined) {
28383                     _this.wallAtStart = null;
28384                 }
28385                 if (_this.wallAtEnd === undefined) {
28386                     _this.wallAtEnd = null;
28387                 }
28388                 if (_this.thickness === undefined) {
28389                     _this.thickness = 0;
28390                 }
28391                 if (_this.height === undefined) {
28392                     _this.height = null;
28393                 }
28394                 if (_this.heightAtEnd === undefined) {
28395                     _this.heightAtEnd = null;
28396                 }
28397                 if (_this.leftSideColor === undefined) {
28398                     _this.leftSideColor = null;
28399                 }
28400                 if (_this.leftSideTexture === undefined) {
28401                     _this.leftSideTexture = null;
28402                 }
28403                 if (_this.leftSideShininess === undefined) {
28404                     _this.leftSideShininess = 0;
28405                 }
28406                 if (_this.leftSideBaseboard === undefined) {
28407                     _this.leftSideBaseboard = null;
28408                 }
28409                 if (_this.rightSideColor === undefined) {
28410                     _this.rightSideColor = null;
28411                 }
28412                 if (_this.rightSideTexture === undefined) {
28413                     _this.rightSideTexture = null;
28414                 }
28415                 if (_this.rightSideShininess === undefined) {
28416                     _this.rightSideShininess = 0;
28417                 }
28418                 if (_this.rightSideBaseboard === undefined) {
28419                     _this.rightSideBaseboard = null;
28420                 }
28421                 if (_this.pattern === undefined) {
28422                     _this.pattern = null;
28423                 }
28424                 if (_this.topColor === undefined) {
28425                     _this.topColor = null;
28426                 }
28427                 if (_this.level === undefined) {
28428                     _this.level = null;
28429                 }
28430                 if (_this.shapeCache === undefined) {
28431                     _this.shapeCache = null;
28432                 }
28433                 if (_this.arcCircleCenterCache === undefined) {
28434                     _this.arcCircleCenterCache = null;
28435                 }
28436                 if (_this.pointsCache === undefined) {
28437                     _this.pointsCache = null;
28438                 }
28439                 if (_this.pointsIncludingBaseboardsCache === undefined) {
28440                     _this.pointsIncludingBaseboardsCache = null;
28441                 }
28442                 _this.symmetric = true;
28443             }
28444             if (_this.xStart === undefined) {
28445                 _this.xStart = 0;
28446             }
28447             if (_this.yStart === undefined) {
28448                 _this.yStart = 0;
28449             }
28450             if (_this.xEnd === undefined) {
28451                 _this.xEnd = 0;
28452             }
28453             if (_this.yEnd === undefined) {
28454                 _this.yEnd = 0;
28455             }
28456             if (_this.arcExtent === undefined) {
28457                 _this.arcExtent = null;
28458             }
28459             if (_this.wallAtStart === undefined) {
28460                 _this.wallAtStart = null;
28461             }
28462             if (_this.wallAtEnd === undefined) {
28463                 _this.wallAtEnd = null;
28464             }
28465             if (_this.thickness === undefined) {
28466                 _this.thickness = 0;
28467             }
28468             if (_this.height === undefined) {
28469                 _this.height = null;
28470             }
28471             if (_this.heightAtEnd === undefined) {
28472                 _this.heightAtEnd = null;
28473             }
28474             if (_this.leftSideColor === undefined) {
28475                 _this.leftSideColor = null;
28476             }
28477             if (_this.leftSideTexture === undefined) {
28478                 _this.leftSideTexture = null;
28479             }
28480             if (_this.leftSideShininess === undefined) {
28481                 _this.leftSideShininess = 0;
28482             }
28483             if (_this.leftSideBaseboard === undefined) {
28484                 _this.leftSideBaseboard = null;
28485             }
28486             if (_this.rightSideColor === undefined) {
28487                 _this.rightSideColor = null;
28488             }
28489             if (_this.rightSideTexture === undefined) {
28490                 _this.rightSideTexture = null;
28491             }
28492             if (_this.rightSideShininess === undefined) {
28493                 _this.rightSideShininess = 0;
28494             }
28495             if (_this.rightSideBaseboard === undefined) {
28496                 _this.rightSideBaseboard = null;
28497             }
28498             if (_this.pattern === undefined) {
28499                 _this.pattern = null;
28500             }
28501             if (_this.topColor === undefined) {
28502                 _this.topColor = null;
28503             }
28504             if (_this.level === undefined) {
28505                 _this.level = null;
28506             }
28507             if (_this.shapeCache === undefined) {
28508                 _this.shapeCache = null;
28509             }
28510             if (_this.arcCircleCenterCache === undefined) {
28511                 _this.arcCircleCenterCache = null;
28512             }
28513             if (_this.pointsCache === undefined) {
28514                 _this.pointsCache = null;
28515             }
28516             if (_this.pointsIncludingBaseboardsCache === undefined) {
28517                 _this.pointsIncludingBaseboardsCache = null;
28518             }
28519             _this.symmetric = true;
28520         }
28521         else
28522             throw new Error('invalid overload');
28523         return _this;
28524     }
28525     /**
28526      * Returns the start point abscissa of this wall.
28527      * @return {number}
28528      */
28529     Wall.prototype.getXStart = function () {
28530         return this.xStart;
28531     };
28532     /**
28533      * Sets the start point abscissa of this wall. Once this wall is updated,
28534      * listeners added to this wall will receive a change notification.
28535      * @param {number} xStart
28536      */
28537     Wall.prototype.setXStart = function (xStart) {
28538         if (xStart !== this.xStart) {
28539             var oldXStart = this.xStart;
28540             this.xStart = xStart;
28541             this.clearPointsCache();
28542             this.arcCircleCenterCache = null;
28543             this.firePropertyChange(/* name */ "X_START", oldXStart, xStart);
28544         }
28545     };
28546     /**
28547      * Returns the start point ordinate of this wall.
28548      * @return {number}
28549      */
28550     Wall.prototype.getYStart = function () {
28551         return this.yStart;
28552     };
28553     /**
28554      * Sets the start point ordinate of this wall. Once this wall is updated,
28555      * listeners added to this wall will receive a change notification.
28556      * @param {number} yStart
28557      */
28558     Wall.prototype.setYStart = function (yStart) {
28559         if (yStart !== this.yStart) {
28560             var oldYStart = this.yStart;
28561             this.yStart = yStart;
28562             this.clearPointsCache();
28563             this.arcCircleCenterCache = null;
28564             this.firePropertyChange(/* name */ "Y_START", oldYStart, yStart);
28565         }
28566     };
28567     /**
28568      * Returns the end point abscissa of this wall.
28569      * @return {number}
28570      */
28571     Wall.prototype.getXEnd = function () {
28572         return this.xEnd;
28573     };
28574     /**
28575      * Sets the end point abscissa of this wall. Once this wall is updated,
28576      * listeners added to this wall will receive a change notification.
28577      * @param {number} xEnd
28578      */
28579     Wall.prototype.setXEnd = function (xEnd) {
28580         if (xEnd !== this.xEnd) {
28581             var oldXEnd = this.xEnd;
28582             this.xEnd = xEnd;
28583             this.clearPointsCache();
28584             this.arcCircleCenterCache = null;
28585             this.firePropertyChange(/* name */ "X_END", oldXEnd, xEnd);
28586         }
28587     };
28588     /**
28589      * Returns the end point ordinate of this wall.
28590      * @return {number}
28591      */
28592     Wall.prototype.getYEnd = function () {
28593         return this.yEnd;
28594     };
28595     /**
28596      * Sets the end point ordinate of this wall. Once this wall is updated,
28597      * listeners added to this wall will receive a change notification.
28598      * @param {number} yEnd
28599      */
28600     Wall.prototype.setYEnd = function (yEnd) {
28601         if (yEnd !== this.yEnd) {
28602             var oldYEnd = this.yEnd;
28603             this.yEnd = yEnd;
28604             this.clearPointsCache();
28605             this.arcCircleCenterCache = null;
28606             this.firePropertyChange(/* name */ "Y_END", oldYEnd, yEnd);
28607         }
28608     };
28609     /**
28610      * Returns the length of this wall.
28611      * @return {number}
28612      */
28613     Wall.prototype.getLength = function () {
28614         if (this.arcExtent == null || /* floatValue */ this.arcExtent === 0) {
28615             return java.awt.geom.Point2D.distance(this.xStart, this.yStart, this.xEnd, this.yEnd);
28616         }
28617         else {
28618             var arcCircleCenter = this.getArcCircleCenter();
28619             var arcCircleRadius = java.awt.geom.Point2D.distance(this.xStart, this.yStart, arcCircleCenter[0], arcCircleCenter[1]);
28620             return Math.abs(this.arcExtent) * arcCircleRadius;
28621         }
28622     };
28623     /**
28624      * Returns the distance from the start point of this wall to its end point.
28625      * @return {number}
28626      */
28627     Wall.prototype.getStartPointToEndPointDistance = function () {
28628         return java.awt.geom.Point2D.distance(this.xStart, this.yStart, this.xEnd, this.yEnd);
28629     };
28630     /**
28631      * Sets the arc extent of a round wall.
28632      * @param {number} arcExtent
28633      */
28634     Wall.prototype.setArcExtent = function (arcExtent) {
28635         if (arcExtent !== this.arcExtent && (arcExtent == null || !(arcExtent === this.arcExtent))) {
28636             var oldArcExtent = this.arcExtent;
28637             this.arcExtent = arcExtent;
28638             this.clearPointsCache();
28639             this.arcCircleCenterCache = null;
28640             this.firePropertyChange(/* name */ "ARC_EXTENT", oldArcExtent, arcExtent);
28641         }
28642     };
28643     /**
28644      * Returns the arc extent of a round wall or <code>null</code> if this wall isn't round.
28645      * @return {number}
28646      */
28647     Wall.prototype.getArcExtent = function () {
28648         return this.arcExtent;
28649     };
28650     /**
28651      * Returns the abscissa of the arc circle center of this wall.
28652      * If the wall isn't round, the return abscissa is at the middle of the wall.
28653      * @return {number}
28654      */
28655     Wall.prototype.getXArcCircleCenter = function () {
28656         if (this.arcExtent == null) {
28657             return (this.xStart + this.xEnd) / 2;
28658         }
28659         else {
28660             return this.getArcCircleCenter()[0];
28661         }
28662     };
28663     /**
28664      * Returns the ordinate of the arc circle center of this wall.
28665      * If the wall isn't round, the return ordinate is at the middle of the wall.
28666      * @return {number}
28667      */
28668     Wall.prototype.getYArcCircleCenter = function () {
28669         if (this.arcExtent == null) {
28670             return (this.yStart + this.yEnd) / 2;
28671         }
28672         else {
28673             return this.getArcCircleCenter()[1];
28674         }
28675     };
28676     /**
28677      * Returns the coordinates of the arc circle center of this wall.
28678      * @return {float[]}
28679      * @private
28680      */
28681     Wall.prototype.getArcCircleCenter = function () {
28682         if (this.arcCircleCenterCache == null) {
28683             var startToEndPointsDistance = java.awt.geom.Point2D.distance(this.xStart, this.yStart, this.xEnd, this.yEnd);
28684             var wallToStartPointArcCircleCenterAngle = Math.abs(this.arcExtent) > Math.PI ? -(Math.PI + this.arcExtent) / 2 : (Math.PI - this.arcExtent) / 2;
28685             var arcCircleCenterToWallDistance = -(Math.tan(wallToStartPointArcCircleCenterAngle) * startToEndPointsDistance / 2);
28686             var xMiddlePoint = (this.xStart + this.xEnd) / 2;
28687             var yMiddlePoint = (this.yStart + this.yEnd) / 2;
28688             var angle = Math.atan2(this.xStart - this.xEnd, this.yEnd - this.yStart);
28689             this.arcCircleCenterCache = [(xMiddlePoint + arcCircleCenterToWallDistance * Math.cos(angle)), (yMiddlePoint + arcCircleCenterToWallDistance * Math.sin(angle))];
28690         }
28691         return this.arcCircleCenterCache;
28692     };
28693     /**
28694      * Returns the wall joined to this wall at start point.
28695      * @return {Wall}
28696      */
28697     Wall.prototype.getWallAtStart = function () {
28698         return this.wallAtStart;
28699     };
28700     Wall.prototype.setWallAtStart = function (wallAtStart, detachJoinedWallAtStart) {
28701         if (detachJoinedWallAtStart === void 0) { detachJoinedWallAtStart = true; }
28702         if (wallAtStart !== this.wallAtStart) {
28703             var oldWallAtStart = this.wallAtStart;
28704             this.wallAtStart = wallAtStart;
28705             this.clearPointsCache();
28706             this.firePropertyChange(/* name */ "WALL_AT_START", oldWallAtStart, wallAtStart);
28707             if (detachJoinedWallAtStart) {
28708                 this.detachJoinedWall(oldWallAtStart);
28709             }
28710         }
28711     };
28712     /**
28713      * Returns the wall joined to this wall at end point.
28714      * @return {Wall}
28715      */
28716     Wall.prototype.getWallAtEnd = function () {
28717         return this.wallAtEnd;
28718     };
28719     Wall.prototype.setWallAtEnd = function (wallAtEnd, detachJoinedWallAtEnd) {
28720         if (detachJoinedWallAtEnd === void 0) { detachJoinedWallAtEnd = true; }
28721         if (wallAtEnd !== this.wallAtEnd) {
28722             var oldWallAtEnd = this.wallAtEnd;
28723             this.wallAtEnd = wallAtEnd;
28724             this.clearPointsCache();
28725             this.firePropertyChange(/* name */ "WALL_AT_END", oldWallAtEnd, wallAtEnd);
28726             if (detachJoinedWallAtEnd) {
28727                 this.detachJoinedWall(oldWallAtEnd);
28728             }
28729         }
28730     };
28731     /**
28732      * Detaches <code>joinedWall</code> from this wall.
28733      * @param {Wall} joinedWall
28734      * @private
28735      */
28736     Wall.prototype.detachJoinedWall = function (joinedWall) {
28737         if (joinedWall != null) {
28738             if (joinedWall.getWallAtStart() === this) {
28739                 joinedWall.setWallAtStart(null, false);
28740             }
28741             else if (joinedWall.getWallAtEnd() === this) {
28742                 joinedWall.setWallAtEnd(null, false);
28743             }
28744         }
28745     };
28746     /**
28747      * Returns the thickness of this wall.
28748      * @return {number}
28749      */
28750     Wall.prototype.getThickness = function () {
28751         return this.thickness;
28752     };
28753     /**
28754      * Sets wall thickness. Once this wall is updated,
28755      * listeners added to this wall will receive a change notification.
28756      * @param {number} thickness
28757      */
28758     Wall.prototype.setThickness = function (thickness) {
28759         if (thickness !== this.thickness) {
28760             var oldThickness = this.thickness;
28761             this.thickness = thickness;
28762             this.clearPointsCache();
28763             this.firePropertyChange(/* name */ "THICKNESS", oldThickness, thickness);
28764         }
28765     };
28766     /**
28767      * Returns the height of this wall. If {@link #getHeightAtEnd() getHeightAtEnd}
28768      * returns a value not <code>null</code>, the returned height should be
28769      * considered as the height of this wall at its start point.
28770      * @return {number}
28771      */
28772     Wall.prototype.getHeight = function () {
28773         return this.height;
28774     };
28775     /**
28776      * Sets the height of this wall. Once this wall is updated,
28777      * listeners added to this wall will receive a change notification.
28778      * @param {number} height
28779      */
28780     Wall.prototype.setHeight = function (height) {
28781         if (height !== this.height && (height == null || !(height === this.height))) {
28782             var oldHeight = this.height;
28783             this.height = height;
28784             this.firePropertyChange(/* name */ "HEIGHT", oldHeight, height);
28785         }
28786     };
28787     /**
28788      * Returns the height of this wall at its end point.
28789      * @return {number}
28790      */
28791     Wall.prototype.getHeightAtEnd = function () {
28792         return this.heightAtEnd;
28793     };
28794     /**
28795      * Sets the height of this wall at its end point. Once this wall is updated,
28796      * listeners added to this wall will receive a change notification.
28797      * @param {number} heightAtEnd
28798      */
28799     Wall.prototype.setHeightAtEnd = function (heightAtEnd) {
28800         if (heightAtEnd !== this.heightAtEnd && (heightAtEnd == null || !(heightAtEnd === this.heightAtEnd))) {
28801             var oldHeightAtEnd = this.heightAtEnd;
28802             this.heightAtEnd = heightAtEnd;
28803             this.firePropertyChange(/* name */ "HEIGHT_AT_END", oldHeightAtEnd, heightAtEnd);
28804         }
28805     };
28806     /**
28807      * Returns <code>true</code> if the height of this wall is different
28808      * at its start and end points.
28809      * @return {boolean}
28810      */
28811     Wall.prototype.isTrapezoidal = function () {
28812         return this.height != null && this.heightAtEnd != null && !(this.height === this.heightAtEnd);
28813     };
28814     /**
28815      * Returns left side color of this wall. This is the color of the left side
28816      * of this wall when you go through wall from start point to end point.
28817      * @return {number}
28818      */
28819     Wall.prototype.getLeftSideColor = function () {
28820         return this.leftSideColor;
28821     };
28822     /**
28823      * Sets left side color of this wall. Once this wall is updated,
28824      * listeners added to this wall will receive a change notification.
28825      * @param {number} leftSideColor
28826      */
28827     Wall.prototype.setLeftSideColor = function (leftSideColor) {
28828         if (leftSideColor !== this.leftSideColor && (leftSideColor == null || !(leftSideColor === this.leftSideColor))) {
28829             var oldLeftSideColor = this.leftSideColor;
28830             this.leftSideColor = leftSideColor;
28831             this.firePropertyChange(/* name */ "LEFT_SIDE_COLOR", oldLeftSideColor, leftSideColor);
28832         }
28833     };
28834     /**
28835      * Returns right side color of this wall. This is the color of the right side
28836      * of this wall when you go through wall from start point to end point.
28837      * @return {number}
28838      */
28839     Wall.prototype.getRightSideColor = function () {
28840         return this.rightSideColor;
28841     };
28842     /**
28843      * Sets right side color of this wall. Once this wall is updated,
28844      * listeners added to this wall will receive a change notification.
28845      * @param {number} rightSideColor
28846      */
28847     Wall.prototype.setRightSideColor = function (rightSideColor) {
28848         if (rightSideColor !== this.rightSideColor && (rightSideColor == null || !(rightSideColor === this.rightSideColor))) {
28849             var oldLeftSideColor = this.rightSideColor;
28850             this.rightSideColor = rightSideColor;
28851             this.firePropertyChange(/* name */ "RIGHT_SIDE_COLOR", oldLeftSideColor, rightSideColor);
28852         }
28853     };
28854     /**
28855      * Returns the left side texture of this wall.
28856      * @return {HomeTexture}
28857      */
28858     Wall.prototype.getLeftSideTexture = function () {
28859         return this.leftSideTexture;
28860     };
28861     /**
28862      * Sets the left side texture of this wall. Once this wall is updated,
28863      * listeners added to this wall will receive a change notification.
28864      * @param {HomeTexture} leftSideTexture
28865      */
28866     Wall.prototype.setLeftSideTexture = function (leftSideTexture) {
28867         if (leftSideTexture !== this.leftSideTexture && (leftSideTexture == null || !leftSideTexture.equals(this.leftSideTexture))) {
28868             var oldLeftSideTexture = this.leftSideTexture;
28869             this.leftSideTexture = leftSideTexture;
28870             this.firePropertyChange(/* name */ "LEFT_SIDE_TEXTURE", oldLeftSideTexture, leftSideTexture);
28871         }
28872     };
28873     /**
28874      * Returns the right side texture of this wall.
28875      * @return {HomeTexture}
28876      */
28877     Wall.prototype.getRightSideTexture = function () {
28878         return this.rightSideTexture;
28879     };
28880     /**
28881      * Sets the right side texture of this wall. Once this wall is updated,
28882      * listeners added to this wall will receive a change notification.
28883      * @param {HomeTexture} rightSideTexture
28884      */
28885     Wall.prototype.setRightSideTexture = function (rightSideTexture) {
28886         if (rightSideTexture !== this.rightSideTexture && (rightSideTexture == null || !rightSideTexture.equals(this.rightSideTexture))) {
28887             var oldLeftSideTexture = this.rightSideTexture;
28888             this.rightSideTexture = rightSideTexture;
28889             this.firePropertyChange(/* name */ "RIGHT_SIDE_TEXTURE", oldLeftSideTexture, rightSideTexture);
28890         }
28891     };
28892     /**
28893      * Returns the left side shininess of this wall.
28894      * @return {number} a value between 0 (matt) and 1 (very shiny)
28895      */
28896     Wall.prototype.getLeftSideShininess = function () {
28897         return this.leftSideShininess;
28898     };
28899     /**
28900      * Sets the left side shininess of this wall. Once this wall is updated,
28901      * listeners added to this wall will receive a change notification.
28902      * @param {number} leftSideShininess
28903      */
28904     Wall.prototype.setLeftSideShininess = function (leftSideShininess) {
28905         if (leftSideShininess !== this.leftSideShininess) {
28906             var oldLeftSideShininess = this.leftSideShininess;
28907             this.leftSideShininess = leftSideShininess;
28908             this.firePropertyChange(/* name */ "LEFT_SIDE_SHININESS", oldLeftSideShininess, leftSideShininess);
28909         }
28910     };
28911     /**
28912      * Returns the right side shininess of this wall.
28913      * @return {number} a value between 0 (matt) and 1 (very shiny)
28914      */
28915     Wall.prototype.getRightSideShininess = function () {
28916         return this.rightSideShininess;
28917     };
28918     /**
28919      * Sets the right side shininess of this wall. Once this wall is updated,
28920      * listeners added to this wall will receive a change notification.
28921      * @param {number} rightSideShininess
28922      */
28923     Wall.prototype.setRightSideShininess = function (rightSideShininess) {
28924         if (rightSideShininess !== this.rightSideShininess) {
28925             var oldRightSideShininess = this.rightSideShininess;
28926             this.rightSideShininess = rightSideShininess;
28927             this.firePropertyChange(/* name */ "RIGHT_SIDE_SHININESS", oldRightSideShininess, rightSideShininess);
28928         }
28929     };
28930     /**
28931      * Returns the left side baseboard of this wall.
28932      * @return {Baseboard}
28933      */
28934     Wall.prototype.getLeftSideBaseboard = function () {
28935         return this.leftSideBaseboard;
28936     };
28937     /**
28938      * Sets the left side baseboard of this wall. Once this wall is updated,
28939      * listeners added to this wall will receive a change notification.
28940      * @param {Baseboard} leftSideBaseboard
28941      */
28942     Wall.prototype.setLeftSideBaseboard = function (leftSideBaseboard) {
28943         if (leftSideBaseboard !== this.leftSideBaseboard && (leftSideBaseboard == null || !leftSideBaseboard.equals(this.leftSideBaseboard))) {
28944             var oldLeftSideBaseboard = this.leftSideBaseboard;
28945             this.leftSideBaseboard = leftSideBaseboard;
28946             this.clearPointsCache();
28947             this.firePropertyChange(/* name */ "LEFT_SIDE_BASEBOARD", oldLeftSideBaseboard, leftSideBaseboard);
28948         }
28949     };
28950     /**
28951      * Returns the right side baseboard of this wall.
28952      * @return {Baseboard}
28953      */
28954     Wall.prototype.getRightSideBaseboard = function () {
28955         return this.rightSideBaseboard;
28956     };
28957     /**
28958      * Sets the right side baseboard of this wall. Once this wall is updated,
28959      * listeners added to this wall will receive a change notification.
28960      * @param {Baseboard} rightSideBaseboard
28961      */
28962     Wall.prototype.setRightSideBaseboard = function (rightSideBaseboard) {
28963         if (rightSideBaseboard !== this.rightSideBaseboard && (rightSideBaseboard == null || !rightSideBaseboard.equals(this.rightSideBaseboard))) {
28964             var oldRightSideBaseboard = this.rightSideBaseboard;
28965             this.rightSideBaseboard = rightSideBaseboard;
28966             this.clearPointsCache();
28967             this.firePropertyChange(/* name */ "RIGHT_SIDE_BASEBOARD", oldRightSideBaseboard, rightSideBaseboard);
28968         }
28969     };
28970     /**
28971      * Returns the pattern of this wall in the plan.
28972      * @return {Object}
28973      */
28974     Wall.prototype.getPattern = function () {
28975         return this.pattern;
28976     };
28977     /**
28978      * Sets the pattern of this wall in the plan, and notifies
28979      * listeners of this change.
28980      * @param {Object} pattern
28981      */
28982     Wall.prototype.setPattern = function (pattern) {
28983         if (this.pattern !== pattern) {
28984             var oldPattern = this.pattern;
28985             this.pattern = pattern;
28986             this.firePropertyChange(/* name */ "PATTERN", oldPattern, pattern);
28987         }
28988     };
28989     /**
28990      * Returns the color of the top of this wall in the 3D view.
28991      * @return {number}
28992      */
28993     Wall.prototype.getTopColor = function () {
28994         return this.topColor;
28995     };
28996     /**
28997      * Sets the color of the top of this wall in the 3D view, and notifies
28998      * listeners of this change.
28999      * @param {number} topColor
29000      */
29001     Wall.prototype.setTopColor = function (topColor) {
29002         if (this.topColor !== topColor && (topColor == null || !(topColor === this.topColor))) {
29003             var oldTopColor = this.topColor;
29004             this.topColor = topColor;
29005             this.firePropertyChange(/* name */ "TOP_COLOR", oldTopColor, topColor);
29006         }
29007     };
29008     /**
29009      * Returns the level which this wall belongs to.
29010      * @return {Level}
29011      */
29012     Wall.prototype.getLevel = function () {
29013         return this.level;
29014     };
29015     /**
29016      * Sets the level of this wall. Once this wall is updated,
29017      * listeners added to this wall will receive a change notification.
29018      * @param {Level} level
29019      */
29020     Wall.prototype.setLevel = function (level) {
29021         if (level !== this.level) {
29022             var oldLevel = this.level;
29023             this.level = level;
29024             this.firePropertyChange(/* name */ "LEVEL", oldLevel, level);
29025         }
29026     };
29027     /**
29028      * Returns <code>true</code> if this wall is at the given <code>level</code>
29029      * or at a level with the same elevation and a smaller elevation index
29030      * or if the elevation of its highest point is higher than <code>level</code> elevation.
29031      * @param {Level} level
29032      * @return {boolean}
29033      */
29034     Wall.prototype.isAtLevel = function (level) {
29035         if (this.level === level) {
29036             return true;
29037         }
29038         else if (this.level != null && level != null) {
29039             var wallLevelElevation = this.level.getElevation();
29040             var levelElevation = level.getElevation();
29041             return wallLevelElevation === levelElevation && this.level.getElevationIndex() < level.getElevationIndex() || wallLevelElevation < levelElevation && wallLevelElevation + this.getWallMaximumHeight() > levelElevation;
29042         }
29043         else {
29044             return false;
29045         }
29046     };
29047     /**
29048      * Returns the maximum height of the given wall.
29049      * @return {number}
29050      * @private
29051      */
29052     Wall.prototype.getWallMaximumHeight = function () {
29053         if (this.height == null) {
29054             return 0;
29055         }
29056         else if (this.isTrapezoidal()) {
29057             return Math.max(this.height, this.heightAtEnd);
29058         }
29059         else {
29060             return this.height;
29061         }
29062     };
29063     /**
29064      * Clears the points cache of this wall and of the walls attached to it.
29065      * @private
29066      */
29067     Wall.prototype.clearPointsCache = function () {
29068         this.shapeCache = null;
29069         this.pointsCache = null;
29070         this.pointsIncludingBaseboardsCache = null;
29071         if (this.wallAtStart != null) {
29072             this.wallAtStart.pointsCache = null;
29073             this.wallAtStart.pointsIncludingBaseboardsCache = null;
29074         }
29075         if (this.wallAtEnd != null) {
29076             this.wallAtEnd.pointsCache = null;
29077             this.wallAtEnd.pointsIncludingBaseboardsCache = null;
29078         }
29079     };
29080     Wall.prototype.getPoints$ = function () {
29081         return this.getPoints$boolean(false);
29082     };
29083     Wall.prototype.getPoints$boolean = function (includeBaseboards) {
29084         if (includeBaseboards && (this.leftSideBaseboard != null || this.rightSideBaseboard != null)) {
29085             if (this.pointsIncludingBaseboardsCache == null) {
29086                 this.pointsIncludingBaseboardsCache = this.getShapePoints(true);
29087             }
29088             return this.clonePoints(this.pointsIncludingBaseboardsCache);
29089         }
29090         else {
29091             if (this.pointsCache == null) {
29092                 this.pointsCache = this.getShapePoints(false);
29093             }
29094             return this.clonePoints(this.pointsCache);
29095         }
29096     };
29097     /**
29098      * Returns the points of each corner of a wall possibly including its baseboards.
29099      * @param {boolean} includeBaseboards
29100      * @return {float[][]}
29101      */
29102     Wall.prototype.getPoints = function (includeBaseboards) {
29103         if (((typeof includeBaseboards === 'boolean') || includeBaseboards === null)) {
29104             return this.getPoints$boolean(includeBaseboards);
29105         }
29106         else if (includeBaseboards === undefined) {
29107             return this.getPoints$();
29108         }
29109         else
29110             throw new Error('invalid overload');
29111     };
29112     /**
29113      * Return a clone of the given <code>points</code> array.
29114      * @param {float[][]} points
29115      * @return {float[][]}
29116      * @private
29117      */
29118     Wall.prototype.clonePoints = function (points) {
29119         var clonedPoints = (function (s) { var a = []; while (s-- > 0)
29120             a.push(null); return a; })(points.length);
29121         for (var i = 0; i < points.length; i++) {
29122             {
29123                 clonedPoints[i] = /* clone */ points[i].slice(0);
29124             }
29125             ;
29126         }
29127         return clonedPoints;
29128     };
29129     /**
29130      * Returns the points of the wall possibly including baseboards thickness.
29131      * @param {boolean} includeBaseboards
29132      * @return {float[][]}
29133      * @private
29134      */
29135     Wall.prototype.getShapePoints = function (includeBaseboards) {
29136         var epsilon = 0.01;
29137         var wallPoints = this.getUnjoinedShapePoints(includeBaseboards);
29138         var leftSideStartPointIndex = 0;
29139         var rightSideStartPointIndex = wallPoints.length - 1;
29140         var leftSideEndPointIndex = (wallPoints.length / 2 | 0) - 1;
29141         var rightSideEndPointIndex = (wallPoints.length / 2 | 0);
29142         if (this.wallAtStart != null) {
29143             var wallAtStartPoints = this.wallAtStart.getUnjoinedShapePoints(includeBaseboards);
29144             var wallAtStartLeftSideStartPointIndex = 0;
29145             var wallAtStartRightSideStartPointIndex = wallAtStartPoints.length - 1;
29146             var wallAtStartLeftSideEndPointIndex = (wallAtStartPoints.length / 2 | 0) - 1;
29147             var wallAtStartRightSideEndPointIndex = (wallAtStartPoints.length / 2 | 0);
29148             var wallAtStartJoinedAtEnd = this.wallAtStart.getWallAtEnd() === this && (this.wallAtStart.getWallAtStart() !== this || (this.wallAtStart.xEnd === this.xStart && this.wallAtStart.yEnd === this.yStart));
29149             var wallAtStartJoinedAtStart = this.wallAtStart.getWallAtStart() === this && (this.wallAtStart.getWallAtEnd() !== this || (this.wallAtStart.xStart === this.xStart && this.wallAtStart.yStart === this.yStart));
29150             var wallAtStartPointsCache = includeBaseboards ? this.wallAtStart.pointsIncludingBaseboardsCache : this.wallAtStart.pointsCache;
29151             var limit = 2 * Math.max(this.thickness, this.wallAtStart.getThickness());
29152             if (wallAtStartJoinedAtEnd) {
29153                 this.computeIntersection(wallPoints[leftSideStartPointIndex], wallPoints[leftSideStartPointIndex + 1], wallAtStartPoints[wallAtStartLeftSideEndPointIndex], wallAtStartPoints[wallAtStartLeftSideEndPointIndex - 1], limit);
29154                 this.computeIntersection(wallPoints[rightSideStartPointIndex], wallPoints[rightSideStartPointIndex - 1], wallAtStartPoints[wallAtStartRightSideEndPointIndex], wallAtStartPoints[wallAtStartRightSideEndPointIndex + 1], limit);
29155                 if (wallAtStartPointsCache != null) {
29156                     if (Math.abs(wallPoints[leftSideStartPointIndex][0] - wallAtStartPointsCache[wallAtStartLeftSideEndPointIndex][0]) < epsilon && Math.abs(wallPoints[leftSideStartPointIndex][1] - wallAtStartPointsCache[wallAtStartLeftSideEndPointIndex][1]) < epsilon) {
29157                         wallPoints[leftSideStartPointIndex] = wallAtStartPointsCache[wallAtStartLeftSideEndPointIndex];
29158                     }
29159                     if (Math.abs(wallPoints[rightSideStartPointIndex][0] - wallAtStartPointsCache[wallAtStartRightSideEndPointIndex][0]) < epsilon && Math.abs(wallPoints[rightSideStartPointIndex][1] - wallAtStartPointsCache[wallAtStartRightSideEndPointIndex][1]) < epsilon) {
29160                         wallPoints[rightSideStartPointIndex] = wallAtStartPointsCache[wallAtStartRightSideEndPointIndex];
29161                     }
29162                 }
29163             }
29164             else if (wallAtStartJoinedAtStart) {
29165                 this.computeIntersection(wallPoints[leftSideStartPointIndex], wallPoints[leftSideStartPointIndex + 1], wallAtStartPoints[wallAtStartRightSideStartPointIndex], wallAtStartPoints[wallAtStartRightSideStartPointIndex - 1], limit);
29166                 this.computeIntersection(wallPoints[rightSideStartPointIndex], wallPoints[rightSideStartPointIndex - 1], wallAtStartPoints[wallAtStartLeftSideStartPointIndex], wallAtStartPoints[wallAtStartLeftSideStartPointIndex + 1], limit);
29167                 if (wallAtStartPointsCache != null) {
29168                     if (Math.abs(wallPoints[leftSideStartPointIndex][0] - wallAtStartPointsCache[wallAtStartRightSideStartPointIndex][0]) < epsilon && Math.abs(wallPoints[leftSideStartPointIndex][1] - wallAtStartPointsCache[wallAtStartRightSideStartPointIndex][1]) < epsilon) {
29169                         wallPoints[leftSideStartPointIndex] = wallAtStartPointsCache[wallAtStartRightSideStartPointIndex];
29170                     }
29171                     if (wallAtStartPointsCache != null && Math.abs(wallPoints[rightSideStartPointIndex][0] - wallAtStartPointsCache[wallAtStartLeftSideStartPointIndex][0]) < epsilon && Math.abs(wallPoints[rightSideStartPointIndex][1] - wallAtStartPointsCache[wallAtStartLeftSideStartPointIndex][1]) < epsilon) {
29172                         wallPoints[rightSideStartPointIndex] = wallAtStartPointsCache[wallAtStartLeftSideStartPointIndex];
29173                     }
29174                 }
29175             }
29176         }
29177         if (this.wallAtEnd != null) {
29178             var wallAtEndPoints = this.wallAtEnd.getUnjoinedShapePoints(includeBaseboards);
29179             var wallAtEndLeftSideStartPointIndex = 0;
29180             var wallAtEndRightSideStartPointIndex = wallAtEndPoints.length - 1;
29181             var wallAtEndLeftSideEndPointIndex = (wallAtEndPoints.length / 2 | 0) - 1;
29182             var wallAtEndRightSideEndPointIndex = (wallAtEndPoints.length / 2 | 0);
29183             var wallAtEndJoinedAtStart = this.wallAtEnd.getWallAtStart() === this && (this.wallAtEnd.getWallAtEnd() !== this || (this.wallAtEnd.xStart === this.xEnd && this.wallAtEnd.yStart === this.yEnd));
29184             var wallAtEndJoinedAtEnd = this.wallAtEnd.getWallAtEnd() === this && (this.wallAtEnd.getWallAtStart() !== this || (this.wallAtEnd.xEnd === this.xEnd && this.wallAtEnd.yEnd === this.yEnd));
29185             var wallAtEndPointsCache = includeBaseboards ? this.wallAtEnd.pointsIncludingBaseboardsCache : this.wallAtEnd.pointsCache;
29186             var limit = 2 * Math.max(this.thickness, this.wallAtEnd.getThickness());
29187             if (wallAtEndJoinedAtStart) {
29188                 this.computeIntersection(wallPoints[leftSideEndPointIndex], wallPoints[leftSideEndPointIndex - 1], wallAtEndPoints[wallAtEndLeftSideStartPointIndex], wallAtEndPoints[wallAtEndLeftSideStartPointIndex + 1], limit);
29189                 this.computeIntersection(wallPoints[rightSideEndPointIndex], wallPoints[rightSideEndPointIndex + 1], wallAtEndPoints[wallAtEndRightSideStartPointIndex], wallAtEndPoints[wallAtEndRightSideStartPointIndex - 1], limit);
29190                 if (wallAtEndPointsCache != null) {
29191                     if (Math.abs(wallPoints[leftSideEndPointIndex][0] - wallAtEndPointsCache[wallAtEndLeftSideStartPointIndex][0]) < epsilon && Math.abs(wallPoints[leftSideEndPointIndex][1] - wallAtEndPointsCache[wallAtEndLeftSideStartPointIndex][1]) < epsilon) {
29192                         wallPoints[leftSideEndPointIndex] = wallAtEndPointsCache[wallAtEndLeftSideStartPointIndex];
29193                     }
29194                     if (Math.abs(wallPoints[rightSideEndPointIndex][0] - wallAtEndPointsCache[wallAtEndRightSideStartPointIndex][0]) < epsilon && Math.abs(wallPoints[rightSideEndPointIndex][1] - wallAtEndPointsCache[wallAtEndRightSideStartPointIndex][1]) < epsilon) {
29195                         wallPoints[rightSideEndPointIndex] = wallAtEndPointsCache[wallAtEndRightSideStartPointIndex];
29196                     }
29197                 }
29198             }
29199             else if (wallAtEndJoinedAtEnd) {
29200                 this.computeIntersection(wallPoints[leftSideEndPointIndex], wallPoints[leftSideEndPointIndex - 1], wallAtEndPoints[wallAtEndRightSideEndPointIndex], wallAtEndPoints[wallAtEndRightSideEndPointIndex + 1], limit);
29201                 this.computeIntersection(wallPoints[rightSideEndPointIndex], wallPoints[rightSideEndPointIndex + 1], wallAtEndPoints[wallAtEndLeftSideEndPointIndex], wallAtEndPoints[wallAtEndLeftSideEndPointIndex - 1], limit);
29202                 if (wallAtEndPointsCache != null) {
29203                     if (Math.abs(wallPoints[leftSideEndPointIndex][0] - wallAtEndPointsCache[wallAtEndRightSideEndPointIndex][0]) < epsilon && Math.abs(wallPoints[leftSideEndPointIndex][1] - wallAtEndPointsCache[wallAtEndRightSideEndPointIndex][1]) < epsilon) {
29204                         wallPoints[leftSideEndPointIndex] = wallAtEndPointsCache[wallAtEndRightSideEndPointIndex];
29205                     }
29206                     if (Math.abs(wallPoints[rightSideEndPointIndex][0] - wallAtEndPointsCache[wallAtEndLeftSideEndPointIndex][0]) < epsilon && Math.abs(wallPoints[rightSideEndPointIndex][1] - wallAtEndPointsCache[wallAtEndLeftSideEndPointIndex][1]) < epsilon) {
29207                         wallPoints[rightSideEndPointIndex] = wallAtEndPointsCache[wallAtEndLeftSideEndPointIndex];
29208                     }
29209                 }
29210             }
29211         }
29212         return wallPoints;
29213     };
29214     /**
29215      * Computes the rectangle or the circle arc of a wall according to its thickness
29216      * and possibly the thickness of its baseboards.
29217      * @param {boolean} includeBaseboards
29218      * @return {float[][]}
29219      * @private
29220      */
29221     Wall.prototype.getUnjoinedShapePoints = function (includeBaseboards) {
29222         if (this.arcExtent != null && /* floatValue */ this.arcExtent !== 0 && java.awt.geom.Point2D.distanceSq(this.xStart, this.yStart, this.xEnd, this.yEnd) > 1.0E-10) {
29223             var arcCircleCenter = this.getArcCircleCenter();
29224             var startAngle = Math.atan2(arcCircleCenter[1] - this.yStart, arcCircleCenter[0] - this.xStart);
29225             startAngle += 2 * Math.atan2(this.yStart - this.yEnd, this.xEnd - this.xStart);
29226             var arcCircleRadius = java.awt.geom.Point2D.distance(arcCircleCenter[0], arcCircleCenter[1], this.xStart, this.yStart);
29227             var exteriorArcRadius = arcCircleRadius + this.thickness / 2;
29228             var interiorArcRadius = Math.max(0, arcCircleRadius - this.thickness / 2);
29229             var exteriorArcLength = exteriorArcRadius * Math.abs(this.arcExtent);
29230             var angleDelta = this.arcExtent / Math.sqrt(exteriorArcLength);
29231             var angleStepCount = ((this.arcExtent / angleDelta) | 0);
29232             if (includeBaseboards) {
29233                 if (angleDelta > 0) {
29234                     if (this.leftSideBaseboard != null) {
29235                         exteriorArcRadius += this.leftSideBaseboard.getThickness();
29236                     }
29237                     if (this.rightSideBaseboard != null) {
29238                         interiorArcRadius -= this.rightSideBaseboard.getThickness();
29239                     }
29240                 }
29241                 else {
29242                     if (this.leftSideBaseboard != null) {
29243                         interiorArcRadius -= this.leftSideBaseboard.getThickness();
29244                     }
29245                     if (this.rightSideBaseboard != null) {
29246                         exteriorArcRadius += this.rightSideBaseboard.getThickness();
29247                     }
29248                 }
29249             }
29250             var wallPoints = ([]);
29251             if (this.symmetric) {
29252                 if (Math.abs(this.arcExtent - angleStepCount * angleDelta) > 1.0E-6) {
29253                     angleDelta = this.arcExtent / ++angleStepCount;
29254                 }
29255                 for (var i = 0; i <= angleStepCount; i++) {
29256                     {
29257                         this.computeRoundWallShapePoint(wallPoints, startAngle + this.arcExtent - i * angleDelta, i, angleDelta, arcCircleCenter, exteriorArcRadius, interiorArcRadius);
29258                     }
29259                     ;
29260                 }
29261             }
29262             else {
29263                 var i = 0;
29264                 for (var angle = this.arcExtent; angleDelta > 0 ? angle >= angleDelta * 0.1 : angle <= -angleDelta * 0.1; angle -= angleDelta, i++) {
29265                     {
29266                         this.computeRoundWallShapePoint(wallPoints, startAngle + angle, i, angleDelta, arcCircleCenter, exteriorArcRadius, interiorArcRadius);
29267                     }
29268                     ;
29269                 }
29270                 this.computeRoundWallShapePoint(wallPoints, startAngle, i, angleDelta, arcCircleCenter, exteriorArcRadius, interiorArcRadius);
29271             }
29272             return /* toArray */ wallPoints.slice(0);
29273         }
29274         else {
29275             var angle = Math.atan2(this.yEnd - this.yStart, this.xEnd - this.xStart);
29276             var sin = Math.sin(angle);
29277             var cos = Math.cos(angle);
29278             var leftSideTickness = this.thickness / 2;
29279             if (includeBaseboards && this.leftSideBaseboard != null) {
29280                 leftSideTickness += this.leftSideBaseboard.getThickness();
29281             }
29282             var leftSideDx = sin * leftSideTickness;
29283             var leftSideDy = cos * leftSideTickness;
29284             var rightSideTickness = this.thickness / 2;
29285             if (includeBaseboards && this.rightSideBaseboard != null) {
29286                 rightSideTickness += this.rightSideBaseboard.getThickness();
29287             }
29288             var rightSideDx = sin * rightSideTickness;
29289             var rightSideDy = cos * rightSideTickness;
29290             return [[this.xStart + leftSideDx, this.yStart - leftSideDy], [this.xEnd + leftSideDx, this.yEnd - leftSideDy], [this.xEnd - rightSideDx, this.yEnd + rightSideDy], [this.xStart - rightSideDx, this.yStart + rightSideDy]];
29291         }
29292     };
29293     /**
29294      * Computes the exterior and interior arc points of a round wall at the given <code>index</code>.
29295      * @param {float[][]} wallPoints
29296      * @param {number} angle
29297      * @param {number} index
29298      * @param {number} angleDelta
29299      * @param {float[]} arcCircleCenter
29300      * @param {number} exteriorArcRadius
29301      * @param {number} interiorArcRadius
29302      * @private
29303      */
29304     Wall.prototype.computeRoundWallShapePoint = function (wallPoints, angle, index, angleDelta, arcCircleCenter, exteriorArcRadius, interiorArcRadius) {
29305         var cos = Math.cos(angle);
29306         var sin = Math.sin(angle);
29307         var interiorArcPoint = [(arcCircleCenter[0] + interiorArcRadius * cos), (arcCircleCenter[1] - interiorArcRadius * sin)];
29308         var exteriorArcPoint = [(arcCircleCenter[0] + exteriorArcRadius * cos), (arcCircleCenter[1] - exteriorArcRadius * sin)];
29309         if (angleDelta > 0) {
29310             /* add */ wallPoints.splice(index, 0, interiorArcPoint);
29311             /* add */ wallPoints.splice(/* size */ wallPoints.length - 1 - index, 0, exteriorArcPoint);
29312         }
29313         else {
29314             /* add */ wallPoints.splice(index, 0, exteriorArcPoint);
29315             /* add */ wallPoints.splice(/* size */ wallPoints.length - 1 - index, 0, interiorArcPoint);
29316         }
29317     };
29318     /**
29319      * Compute the intersection between the line that joins <code>point1</code> to <code>point2</code>
29320      * and the line that joins <code>point3</code> and <code>point4</code>, and stores the result
29321      * in <code>point1</code>.
29322      * @param {float[]} point1
29323      * @param {float[]} point2
29324      * @param {float[]} point3
29325      * @param {float[]} point4
29326      * @param {number} limit
29327      * @private
29328      */
29329     Wall.prototype.computeIntersection = function (point1, point2, point3, point4, limit) {
29330         var alpha1 = (point2[1] - point1[1]) / (point2[0] - point1[0]);
29331         var alpha2 = (point4[1] - point3[1]) / (point4[0] - point3[0]);
29332         if (alpha1 !== alpha2) {
29333             var x = point1[0];
29334             var y = point1[1];
29335             if (Math.abs(alpha1) > 4000) {
29336                 if (Math.abs(alpha2) < 4000) {
29337                     x = point1[0];
29338                     var beta2 = point4[1] - alpha2 * point4[0];
29339                     y = alpha2 * x + beta2;
29340                 }
29341             }
29342             else if (Math.abs(alpha2) > 4000) {
29343                 if (Math.abs(alpha1) < 4000) {
29344                     x = point3[0];
29345                     var beta1 = point2[1] - alpha1 * point2[0];
29346                     y = alpha1 * x + beta1;
29347                 }
29348             }
29349             else {
29350                 var sameSignum = (function (f) { if (f > 0) {
29351                     return 1;
29352                 }
29353                 else if (f < 0) {
29354                     return -1;
29355                 }
29356                 else {
29357                     return 0;
29358                 } })(alpha1) === /* signum */ (function (f) { if (f > 0) {
29359                     return 1;
29360                 }
29361                 else if (f < 0) {
29362                     return -1;
29363                 }
29364                 else {
29365                     return 0;
29366                 } })(alpha2);
29367                 if (Math.abs(alpha1 - alpha2) > 1.0E-5 && (!sameSignum || (Math.abs(alpha1) > Math.abs(alpha2) ? alpha1 / alpha2 : alpha2 / alpha1) > 1.004)) {
29368                     var beta1 = point2[1] - alpha1 * point2[0];
29369                     var beta2 = point4[1] - alpha2 * point4[0];
29370                     x = (beta2 - beta1) / (alpha1 - alpha2);
29371                     y = alpha1 * x + beta1;
29372                 }
29373             }
29374             if (java.awt.geom.Point2D.distanceSq(x, y, point1[0], point1[1]) < limit * limit) {
29375                 point1[0] = x;
29376                 point1[1] = y;
29377             }
29378         }
29379     };
29380     /**
29381      * Returns <code>true</code> if this wall intersects
29382      * with the horizontal rectangle which opposite corners are at points
29383      * (<code>x0</code>, <code>y0</code>) and (<code>x1</code>, <code>y1</code>).
29384      * @param {number} x0
29385      * @param {number} y0
29386      * @param {number} x1
29387      * @param {number} y1
29388      * @return {boolean}
29389      */
29390     Wall.prototype.intersectsRectangle = function (x0, y0, x1, y1) {
29391         var rectangle = new java.awt.geom.Rectangle2D.Float(x0, y0, 0, 0);
29392         rectangle.add(x1, y1);
29393         return this.getShape(false).intersects(rectangle);
29394     };
29395     Wall.prototype.containsPoint$float$float$float = function (x, y, margin) {
29396         return this.containsPoint$float$float$boolean$float(x, y, false, margin);
29397     };
29398     Wall.prototype.containsPoint$float$float$boolean$float = function (x, y, includeBaseboards, margin) {
29399         return this.containsShapeAtWithMargin(this.getShape(includeBaseboards), x, y, margin);
29400     };
29401     /**
29402      * Returns <code>true</code> if this wall contains the point at (<code>x</code>, <code>y</code>)
29403      * possibly including its baseboards, with a given <code>margin</code>.
29404      * @param {number} x
29405      * @param {number} y
29406      * @param {boolean} includeBaseboards
29407      * @param {number} margin
29408      * @return {boolean}
29409      */
29410     Wall.prototype.containsPoint = function (x, y, includeBaseboards, margin) {
29411         if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof includeBaseboards === 'boolean') || includeBaseboards === null) && ((typeof margin === 'number') || margin === null)) {
29412             return this.containsPoint$float$float$boolean$float(x, y, includeBaseboards, margin);
29413         }
29414         else if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof includeBaseboards === 'number') || includeBaseboards === null) && margin === undefined) {
29415             return this.containsPoint$float$float$float(x, y, includeBaseboards);
29416         }
29417         else
29418             throw new Error('invalid overload');
29419     };
29420     /**
29421      * Returns <code>true</code> if the middle point of this wall is the point at (<code>x</code>, <code>y</code>)
29422      * with a given <code>margin</code>.
29423      * @param {number} x
29424      * @param {number} y
29425      * @param {number} margin
29426      * @return {boolean}
29427      */
29428     Wall.prototype.isMiddlePointAt = function (x, y, margin) {
29429         var wallPoints = this.getPoints$();
29430         var leftSideMiddlePointIndex = (wallPoints.length / 4 | 0);
29431         var rightSideMiddlePointIndex = wallPoints.length - 1 - leftSideMiddlePointIndex;
29432         var middleLine = wallPoints.length % 4 === 0 ? new java.awt.geom.Line2D.Float((wallPoints[leftSideMiddlePointIndex - 1][0] + wallPoints[leftSideMiddlePointIndex][0]) / 2, (wallPoints[leftSideMiddlePointIndex - 1][1] + wallPoints[leftSideMiddlePointIndex][1]) / 2, (wallPoints[rightSideMiddlePointIndex][0] + wallPoints[rightSideMiddlePointIndex + 1][0]) / 2, (wallPoints[rightSideMiddlePointIndex][1] + wallPoints[rightSideMiddlePointIndex + 1][1]) / 2) : new java.awt.geom.Line2D.Float(wallPoints[leftSideMiddlePointIndex][0], wallPoints[leftSideMiddlePointIndex][1], wallPoints[rightSideMiddlePointIndex][0], wallPoints[rightSideMiddlePointIndex][1]);
29433         return this.containsShapeAtWithMargin(middleLine, x, y, margin);
29434     };
29435     /**
29436      * Returns <code>true</code> if this wall start line contains
29437      * the point at (<code>x</code>, <code>y</code>)
29438      * with a given <code>margin</code> around the wall start line.
29439      * @param {number} x
29440      * @param {number} y
29441      * @param {number} margin
29442      * @return {boolean}
29443      */
29444     Wall.prototype.containsWallStartAt = function (x, y, margin) {
29445         var wallPoints = this.getPoints$();
29446         var startLine = new java.awt.geom.Line2D.Float(wallPoints[0][0], wallPoints[0][1], wallPoints[wallPoints.length - 1][0], wallPoints[wallPoints.length - 1][1]);
29447         return this.containsShapeAtWithMargin(startLine, x, y, margin);
29448     };
29449     /**
29450      * Returns <code>true</code> if this wall end line contains
29451      * the point at (<code>x</code>, <code>y</code>)
29452      * with a given <code>margin</code> around the wall end line.
29453      * @param {number} x
29454      * @param {number} y
29455      * @param {number} margin
29456      * @return {boolean}
29457      */
29458     Wall.prototype.containsWallEndAt = function (x, y, margin) {
29459         var wallPoints = this.getPoints$();
29460         var endLine = new java.awt.geom.Line2D.Float(wallPoints[(wallPoints.length / 2 | 0) - 1][0], wallPoints[(wallPoints.length / 2 | 0) - 1][1], wallPoints[(wallPoints.length / 2 | 0)][0], wallPoints[(wallPoints.length / 2 | 0)][1]);
29461         return this.containsShapeAtWithMargin(endLine, x, y, margin);
29462     };
29463     /**
29464      * Returns <code>true</code> if <code>shape</code> contains
29465      * the point at (<code>x</code>, <code>y</code>)
29466      * with a given <code>margin</code>.
29467      * @param {Object} shape
29468      * @param {number} x
29469      * @param {number} y
29470      * @param {number} margin
29471      * @return {boolean}
29472      * @private
29473      */
29474     Wall.prototype.containsShapeAtWithMargin = function (shape, x, y, margin) {
29475         if (margin === 0) {
29476             return shape.contains(x, y);
29477         }
29478         else {
29479             return shape.intersects(x - margin, y - margin, 2 * margin, 2 * margin);
29480         }
29481     };
29482     /**
29483      * Returns the shape matching this wall.
29484      * @param {boolean} includeBaseboards
29485      * @return {Object}
29486      * @private
29487      */
29488     Wall.prototype.getShape = function (includeBaseboards) {
29489         if (this.shapeCache == null) {
29490             var wallPoints = this.getPoints$boolean(includeBaseboards);
29491             var wallPath = new java.awt.geom.GeneralPath();
29492             wallPath.moveTo(wallPoints[0][0], wallPoints[0][1]);
29493             for (var i = 1; i < wallPoints.length; i++) {
29494                 {
29495                     wallPath.lineTo(wallPoints[i][0], wallPoints[i][1]);
29496                 }
29497                 ;
29498             }
29499             wallPath.closePath();
29500             this.shapeCache = wallPath;
29501         }
29502         return this.shapeCache;
29503     };
29504     /**
29505      * Moves this wall of (<code>dx</code>, <code>dy</code>) units.
29506      * @param {number} dx
29507      * @param {number} dy
29508      */
29509     Wall.prototype.move = function (dx, dy) {
29510         this.setXStart(this.getXStart() + dx);
29511         this.setYStart(this.getYStart() + dy);
29512         this.setXEnd(this.getXEnd() + dx);
29513         this.setYEnd(this.getYEnd() + dy);
29514     };
29515     /**
29516      * Returns a duplicate of the <code>walls</code> list. All existing walls
29517      * are copied and their wall at start and end point are set with copied
29518      * walls only if they belong to the returned list.
29519      * The id of duplicated walls are regenerated.
29520      * @param {Wall[]} walls
29521      * @return {Wall[]}
29522      */
29523     Wall.duplicate = function (walls) {
29524         var wallsCopy = ([]);
29525         for (var index = 0; index < walls.length; index++) {
29526             var wall = walls[index];
29527             {
29528                 /* add */ (wallsCopy.push(wall.duplicate()) > 0);
29529             }
29530         }
29531         Wall.updateBoundWalls(wallsCopy, walls);
29532         return wallsCopy;
29533     };
29534     /**
29535      * Returns a clone of the <code>walls</code> list. All existing walls
29536      * are copied and their wall at start and end point are set with copied
29537      * walls only if they belong to the returned list.
29538      * @param {Wall[]} walls
29539      * @return {Wall[]}
29540      */
29541     Wall.clone = function (walls) {
29542         var wallsCopy = ([]);
29543         for (var index = 0; index < walls.length; index++) {
29544             var wall = walls[index];
29545             {
29546                 /* add */ (wallsCopy.push(/* clone */ /* clone */ (function (o) { if (o.clone != undefined) {
29547                     return o.clone();
29548                 }
29549                 else {
29550                     var clone = Object.create(o);
29551                     for (var p in o) {
29552                         if (o.hasOwnProperty(p))
29553                             clone[p] = o[p];
29554                     }
29555                     return clone;
29556                 } })(wall)) > 0);
29557             }
29558         }
29559         Wall.updateBoundWalls(wallsCopy, walls);
29560         return wallsCopy;
29561     };
29562     Wall.updateBoundWalls = function (wallsCopy, walls) {
29563         for (var i = 0; i < /* size */ walls.length; i++) {
29564             {
29565                 var wall = walls[i];
29566                 var wallAtStartIndex = walls.indexOf(wall.getWallAtStart());
29567                 if (wallAtStartIndex !== -1) {
29568                     /* get */ wallsCopy[i].setWallAtStart(/* get */ wallsCopy[wallAtStartIndex]);
29569                 }
29570                 var wallAtEndIndex = walls.indexOf(wall.getWallAtEnd());
29571                 if (wallAtEndIndex !== -1) {
29572                     /* get */ wallsCopy[i].setWallAtEnd(/* get */ wallsCopy[wallAtEndIndex]);
29573                 }
29574             }
29575             ;
29576         }
29577     };
29578     /**
29579      * Returns a clone of this wall expected
29580      * its wall at start and wall at end aren't copied.
29581      * @return {Wall}
29582      */
29583     Wall.prototype.clone = function () {
29584         var _this = this;
29585         var clone = (function (o) { if (_super.prototype.clone != undefined) {
29586             return _super.prototype.clone.call(_this);
29587         }
29588         else {
29589             var clone_6 = Object.create(o);
29590             for (var p in o) {
29591                 if (o.hasOwnProperty(p))
29592                     clone_6[p] = o[p];
29593             }
29594             return clone_6;
29595         } })(this);
29596         clone.wallAtStart = null;
29597         clone.wallAtEnd = null;
29598         clone.level = null;
29599         clone.shapeCache = null;
29600         clone.pointsCache = null;
29601         clone.pointsIncludingBaseboardsCache = null;
29602         return clone;
29603     };
29604     return Wall;
29605 }(HomeObject));
29606 Wall["__class"] = "com.eteks.sweethome3d.model.Wall";
29607 Wall["__interfaces"] = ["com.eteks.sweethome3d.model.Selectable", "com.eteks.sweethome3d.model.Elevatable"];
29608 Wall['__transients'] = ['shapeCache', 'arcCircleCenterCache', 'pointsCache', 'pointsIncludingBaseboardsCache', 'propertyChangeSupport'];
29609 /**
29610  * Creates a dimension line from (<code>xStart</code>, <code>yStart</code>, <code>elevationStart</code>)
29611  * to (<code>xEnd</code>, <code>yEnd</code>, <code>elevationEnd</code>), with a given offset.
29612  * @param {string} id
29613  * @param {number} xStart
29614  * @param {number} yStart
29615  * @param {number} elevationStart
29616  * @param {number} xEnd
29617  * @param {number} yEnd
29618  * @param {number} elevationEnd
29619  * @param {number} offset
29620  * @class
29621  * @extends HomeObject
29622  * @author Emmanuel Puybaret
29623  */
29624 var DimensionLine = /** @class */ (function (_super) {
29625     __extends(DimensionLine, _super);
29626     function DimensionLine(id, xStart, yStart, elevationStart, xEnd, yEnd, elevationEnd, offset) {
29627         var _this = this;
29628         if (((typeof id === 'string') || id === null) && ((typeof xStart === 'number') || xStart === null) && ((typeof yStart === 'number') || yStart === null) && ((typeof elevationStart === 'number') || elevationStart === null) && ((typeof xEnd === 'number') || xEnd === null) && ((typeof yEnd === 'number') || yEnd === null) && ((typeof elevationEnd === 'number') || elevationEnd === null) && ((typeof offset === 'number') || offset === null)) {
29629             var __args = arguments;
29630             _this = _super.call(this, id) || this;
29631             if (_this.xStart === undefined) {
29632                 _this.xStart = 0;
29633             }
29634             if (_this.yStart === undefined) {
29635                 _this.yStart = 0;
29636             }
29637             if (_this.elevationStart === undefined) {
29638                 _this.elevationStart = 0;
29639             }
29640             if (_this.xEnd === undefined) {
29641                 _this.xEnd = 0;
29642             }
29643             if (_this.yEnd === undefined) {
29644                 _this.yEnd = 0;
29645             }
29646             if (_this.elevationEnd === undefined) {
29647                 _this.elevationEnd = 0;
29648             }
29649             if (_this.offset === undefined) {
29650                 _this.offset = 0;
29651             }
29652             if (_this.endMarkSize === undefined) {
29653                 _this.endMarkSize = 0;
29654             }
29655             if (_this.pitch === undefined) {
29656                 _this.pitch = 0;
29657             }
29658             if (_this.lengthStyle === undefined) {
29659                 _this.lengthStyle = null;
29660             }
29661             if (_this.color === undefined) {
29662                 _this.color = null;
29663             }
29664             if (_this.visibleIn3D === undefined) {
29665                 _this.visibleIn3D = false;
29666             }
29667             if (_this.level === undefined) {
29668                 _this.level = null;
29669             }
29670             if (_this.shapeCache === undefined) {
29671                 _this.shapeCache = null;
29672             }
29673             _this.xStart = xStart;
29674             _this.yStart = yStart;
29675             _this.elevationStart = elevationStart;
29676             _this.xEnd = xEnd;
29677             _this.yEnd = yEnd;
29678             _this.elevationEnd = elevationEnd;
29679             _this.offset = offset;
29680             _this.endMarkSize = 10;
29681         }
29682         else if (((typeof id === 'number') || id === null) && ((typeof xStart === 'number') || xStart === null) && ((typeof yStart === 'number') || yStart === null) && ((typeof elevationStart === 'number') || elevationStart === null) && ((typeof xEnd === 'number') || xEnd === null) && ((typeof yEnd === 'number') || yEnd === null) && ((typeof elevationEnd === 'number') || elevationEnd === null) && offset === undefined) {
29683             var __args = arguments;
29684             var xStart_4 = __args[0];
29685             var yStart_4 = __args[1];
29686             var elevationStart_1 = __args[2];
29687             var xEnd_4 = __args[3];
29688             var yEnd_4 = __args[4];
29689             var elevationEnd_1 = __args[5];
29690             var offset_1 = __args[6];
29691             {
29692                 var __args_87 = arguments;
29693                 var id_17 = HomeObject.createId("dimensionLine");
29694                 _this = _super.call(this, id_17) || this;
29695                 if (_this.xStart === undefined) {
29696                     _this.xStart = 0;
29697                 }
29698                 if (_this.yStart === undefined) {
29699                     _this.yStart = 0;
29700                 }
29701                 if (_this.elevationStart === undefined) {
29702                     _this.elevationStart = 0;
29703                 }
29704                 if (_this.xEnd === undefined) {
29705                     _this.xEnd = 0;
29706                 }
29707                 if (_this.yEnd === undefined) {
29708                     _this.yEnd = 0;
29709                 }
29710                 if (_this.elevationEnd === undefined) {
29711                     _this.elevationEnd = 0;
29712                 }
29713                 if (_this.offset === undefined) {
29714                     _this.offset = 0;
29715                 }
29716                 if (_this.endMarkSize === undefined) {
29717                     _this.endMarkSize = 0;
29718                 }
29719                 if (_this.pitch === undefined) {
29720                     _this.pitch = 0;
29721                 }
29722                 if (_this.lengthStyle === undefined) {
29723                     _this.lengthStyle = null;
29724                 }
29725                 if (_this.color === undefined) {
29726                     _this.color = null;
29727                 }
29728                 if (_this.visibleIn3D === undefined) {
29729                     _this.visibleIn3D = false;
29730                 }
29731                 if (_this.level === undefined) {
29732                     _this.level = null;
29733                 }
29734                 if (_this.shapeCache === undefined) {
29735                     _this.shapeCache = null;
29736                 }
29737                 _this.xStart = xStart_4;
29738                 _this.yStart = yStart_4;
29739                 _this.elevationStart = elevationStart_1;
29740                 _this.xEnd = xEnd_4;
29741                 _this.yEnd = yEnd_4;
29742                 _this.elevationEnd = elevationEnd_1;
29743                 _this.offset = offset_1;
29744                 _this.endMarkSize = 10;
29745             }
29746             if (_this.xStart === undefined) {
29747                 _this.xStart = 0;
29748             }
29749             if (_this.yStart === undefined) {
29750                 _this.yStart = 0;
29751             }
29752             if (_this.elevationStart === undefined) {
29753                 _this.elevationStart = 0;
29754             }
29755             if (_this.xEnd === undefined) {
29756                 _this.xEnd = 0;
29757             }
29758             if (_this.yEnd === undefined) {
29759                 _this.yEnd = 0;
29760             }
29761             if (_this.elevationEnd === undefined) {
29762                 _this.elevationEnd = 0;
29763             }
29764             if (_this.offset === undefined) {
29765                 _this.offset = 0;
29766             }
29767             if (_this.endMarkSize === undefined) {
29768                 _this.endMarkSize = 0;
29769             }
29770             if (_this.pitch === undefined) {
29771                 _this.pitch = 0;
29772             }
29773             if (_this.lengthStyle === undefined) {
29774                 _this.lengthStyle = null;
29775             }
29776             if (_this.color === undefined) {
29777                 _this.color = null;
29778             }
29779             if (_this.visibleIn3D === undefined) {
29780                 _this.visibleIn3D = false;
29781             }
29782             if (_this.level === undefined) {
29783                 _this.level = null;
29784             }
29785             if (_this.shapeCache === undefined) {
29786                 _this.shapeCache = null;
29787             }
29788         }
29789         else if (((typeof id === 'string') || id === null) && ((typeof xStart === 'number') || xStart === null) && ((typeof yStart === 'number') || yStart === null) && ((typeof elevationStart === 'number') || elevationStart === null) && ((typeof xEnd === 'number') || xEnd === null) && ((typeof yEnd === 'number') || yEnd === null) && elevationEnd === undefined && offset === undefined) {
29790             var __args = arguments;
29791             var xEnd_5 = __args[3];
29792             var yEnd_5 = __args[4];
29793             var offset_2 = __args[5];
29794             {
29795                 var __args_88 = arguments;
29796                 var elevationStart_2 = 0;
29797                 var elevationEnd_2 = 0;
29798                 _this = _super.call(this, id) || this;
29799                 if (_this.xStart === undefined) {
29800                     _this.xStart = 0;
29801                 }
29802                 if (_this.yStart === undefined) {
29803                     _this.yStart = 0;
29804                 }
29805                 if (_this.elevationStart === undefined) {
29806                     _this.elevationStart = 0;
29807                 }
29808                 if (_this.xEnd === undefined) {
29809                     _this.xEnd = 0;
29810                 }
29811                 if (_this.yEnd === undefined) {
29812                     _this.yEnd = 0;
29813                 }
29814                 if (_this.elevationEnd === undefined) {
29815                     _this.elevationEnd = 0;
29816                 }
29817                 if (_this.offset === undefined) {
29818                     _this.offset = 0;
29819                 }
29820                 if (_this.endMarkSize === undefined) {
29821                     _this.endMarkSize = 0;
29822                 }
29823                 if (_this.pitch === undefined) {
29824                     _this.pitch = 0;
29825                 }
29826                 if (_this.lengthStyle === undefined) {
29827                     _this.lengthStyle = null;
29828                 }
29829                 if (_this.color === undefined) {
29830                     _this.color = null;
29831                 }
29832                 if (_this.visibleIn3D === undefined) {
29833                     _this.visibleIn3D = false;
29834                 }
29835                 if (_this.level === undefined) {
29836                     _this.level = null;
29837                 }
29838                 if (_this.shapeCache === undefined) {
29839                     _this.shapeCache = null;
29840                 }
29841                 _this.xStart = xStart;
29842                 _this.yStart = yStart;
29843                 _this.elevationStart = elevationStart_2;
29844                 _this.xEnd = xEnd_5;
29845                 _this.yEnd = yEnd_5;
29846                 _this.elevationEnd = elevationEnd_2;
29847                 _this.offset = offset_2;
29848                 _this.endMarkSize = 10;
29849             }
29850             if (_this.xStart === undefined) {
29851                 _this.xStart = 0;
29852             }
29853             if (_this.yStart === undefined) {
29854                 _this.yStart = 0;
29855             }
29856             if (_this.elevationStart === undefined) {
29857                 _this.elevationStart = 0;
29858             }
29859             if (_this.xEnd === undefined) {
29860                 _this.xEnd = 0;
29861             }
29862             if (_this.yEnd === undefined) {
29863                 _this.yEnd = 0;
29864             }
29865             if (_this.elevationEnd === undefined) {
29866                 _this.elevationEnd = 0;
29867             }
29868             if (_this.offset === undefined) {
29869                 _this.offset = 0;
29870             }
29871             if (_this.endMarkSize === undefined) {
29872                 _this.endMarkSize = 0;
29873             }
29874             if (_this.pitch === undefined) {
29875                 _this.pitch = 0;
29876             }
29877             if (_this.lengthStyle === undefined) {
29878                 _this.lengthStyle = null;
29879             }
29880             if (_this.color === undefined) {
29881                 _this.color = null;
29882             }
29883             if (_this.visibleIn3D === undefined) {
29884                 _this.visibleIn3D = false;
29885             }
29886             if (_this.level === undefined) {
29887                 _this.level = null;
29888             }
29889             if (_this.shapeCache === undefined) {
29890                 _this.shapeCache = null;
29891             }
29892         }
29893         else if (((typeof id === 'number') || id === null) && ((typeof xStart === 'number') || xStart === null) && ((typeof yStart === 'number') || yStart === null) && ((typeof elevationStart === 'number') || elevationStart === null) && ((typeof xEnd === 'number') || xEnd === null) && yEnd === undefined && elevationEnd === undefined && offset === undefined) {
29894             var __args = arguments;
29895             var xStart_5 = __args[0];
29896             var yStart_5 = __args[1];
29897             var xEnd_6 = __args[2];
29898             var yEnd_6 = __args[3];
29899             var offset_3 = __args[4];
29900             {
29901                 var __args_89 = arguments;
29902                 var elevationStart_3 = 0;
29903                 var elevationEnd_3 = 0;
29904                 {
29905                     var __args_90 = arguments;
29906                     var id_18 = HomeObject.createId("dimensionLine");
29907                     _this = _super.call(this, id_18) || this;
29908                     if (_this.xStart === undefined) {
29909                         _this.xStart = 0;
29910                     }
29911                     if (_this.yStart === undefined) {
29912                         _this.yStart = 0;
29913                     }
29914                     if (_this.elevationStart === undefined) {
29915                         _this.elevationStart = 0;
29916                     }
29917                     if (_this.xEnd === undefined) {
29918                         _this.xEnd = 0;
29919                     }
29920                     if (_this.yEnd === undefined) {
29921                         _this.yEnd = 0;
29922                     }
29923                     if (_this.elevationEnd === undefined) {
29924                         _this.elevationEnd = 0;
29925                     }
29926                     if (_this.offset === undefined) {
29927                         _this.offset = 0;
29928                     }
29929                     if (_this.endMarkSize === undefined) {
29930                         _this.endMarkSize = 0;
29931                     }
29932                     if (_this.pitch === undefined) {
29933                         _this.pitch = 0;
29934                     }
29935                     if (_this.lengthStyle === undefined) {
29936                         _this.lengthStyle = null;
29937                     }
29938                     if (_this.color === undefined) {
29939                         _this.color = null;
29940                     }
29941                     if (_this.visibleIn3D === undefined) {
29942                         _this.visibleIn3D = false;
29943                     }
29944                     if (_this.level === undefined) {
29945                         _this.level = null;
29946                     }
29947                     if (_this.shapeCache === undefined) {
29948                         _this.shapeCache = null;
29949                     }
29950                     _this.xStart = xStart_5;
29951                     _this.yStart = yStart_5;
29952                     _this.elevationStart = elevationStart_3;
29953                     _this.xEnd = xEnd_6;
29954                     _this.yEnd = yEnd_6;
29955                     _this.elevationEnd = elevationEnd_3;
29956                     _this.offset = offset_3;
29957                     _this.endMarkSize = 10;
29958                 }
29959                 if (_this.xStart === undefined) {
29960                     _this.xStart = 0;
29961                 }
29962                 if (_this.yStart === undefined) {
29963                     _this.yStart = 0;
29964                 }
29965                 if (_this.elevationStart === undefined) {
29966                     _this.elevationStart = 0;
29967                 }
29968                 if (_this.xEnd === undefined) {
29969                     _this.xEnd = 0;
29970                 }
29971                 if (_this.yEnd === undefined) {
29972                     _this.yEnd = 0;
29973                 }
29974                 if (_this.elevationEnd === undefined) {
29975                     _this.elevationEnd = 0;
29976                 }
29977                 if (_this.offset === undefined) {
29978                     _this.offset = 0;
29979                 }
29980                 if (_this.endMarkSize === undefined) {
29981                     _this.endMarkSize = 0;
29982                 }
29983                 if (_this.pitch === undefined) {
29984                     _this.pitch = 0;
29985                 }
29986                 if (_this.lengthStyle === undefined) {
29987                     _this.lengthStyle = null;
29988                 }
29989                 if (_this.color === undefined) {
29990                     _this.color = null;
29991                 }
29992                 if (_this.visibleIn3D === undefined) {
29993                     _this.visibleIn3D = false;
29994                 }
29995                 if (_this.level === undefined) {
29996                     _this.level = null;
29997                 }
29998                 if (_this.shapeCache === undefined) {
29999                     _this.shapeCache = null;
30000                 }
30001             }
30002             if (_this.xStart === undefined) {
30003                 _this.xStart = 0;
30004             }
30005             if (_this.yStart === undefined) {
30006                 _this.yStart = 0;
30007             }
30008             if (_this.elevationStart === undefined) {
30009                 _this.elevationStart = 0;
30010             }
30011             if (_this.xEnd === undefined) {
30012                 _this.xEnd = 0;
30013             }
30014             if (_this.yEnd === undefined) {
30015                 _this.yEnd = 0;
30016             }
30017             if (_this.elevationEnd === undefined) {
30018                 _this.elevationEnd = 0;
30019             }
30020             if (_this.offset === undefined) {
30021                 _this.offset = 0;
30022             }
30023             if (_this.endMarkSize === undefined) {
30024                 _this.endMarkSize = 0;
30025             }
30026             if (_this.pitch === undefined) {
30027                 _this.pitch = 0;
30028             }
30029             if (_this.lengthStyle === undefined) {
30030                 _this.lengthStyle = null;
30031             }
30032             if (_this.color === undefined) {
30033                 _this.color = null;
30034             }
30035             if (_this.visibleIn3D === undefined) {
30036                 _this.visibleIn3D = false;
30037             }
30038             if (_this.level === undefined) {
30039                 _this.level = null;
30040             }
30041             if (_this.shapeCache === undefined) {
30042                 _this.shapeCache = null;
30043             }
30044         }
30045         else
30046             throw new Error('invalid overload');
30047         return _this;
30048     }
30049     /**
30050      * Returns the start point abscissa of this dimension line.
30051      * @return {number}
30052      */
30053     DimensionLine.prototype.getXStart = function () {
30054         return this.xStart;
30055     };
30056     /**
30057      * Sets the start point abscissa of this dimension line. Once this dimension line
30058      * is updated, listeners added to this dimension line will receive a change notification.
30059      * @param {number} xStart
30060      */
30061     DimensionLine.prototype.setXStart = function (xStart) {
30062         if (xStart !== this.xStart) {
30063             var oldXStart = this.xStart;
30064             this.xStart = xStart;
30065             this.shapeCache = null;
30066             this.firePropertyChange(/* name */ "X_START", oldXStart, xStart);
30067         }
30068     };
30069     /**
30070      * Returns the start point ordinate of this dimension line.
30071      * @return {number}
30072      */
30073     DimensionLine.prototype.getYStart = function () {
30074         return this.yStart;
30075     };
30076     /**
30077      * Sets the start point ordinate of this dimension line. Once this dimension line
30078      * is updated, listeners added to this dimension line will receive a change notification.
30079      * @param {number} yStart
30080      */
30081     DimensionLine.prototype.setYStart = function (yStart) {
30082         if (yStart !== this.yStart) {
30083             var oldYStart = this.yStart;
30084             this.yStart = yStart;
30085             this.shapeCache = null;
30086             this.firePropertyChange(/* name */ "Y_START", oldYStart, yStart);
30087         }
30088     };
30089     /**
30090      * Returns the start point elevation of this dimension line.
30091      * @return {number}
30092      */
30093     DimensionLine.prototype.getElevationStart = function () {
30094         return this.elevationStart;
30095     };
30096     /**
30097      * Sets the start point elevation of this dimension line. Once this dimension line
30098      * is updated, listeners added to this dimension line will receive a change notification.
30099      * @param {number} elevationStart
30100      */
30101     DimensionLine.prototype.setElevationStart = function (elevationStart) {
30102         if (elevationStart !== this.elevationStart) {
30103             var oldElevationStart = this.elevationStart;
30104             this.elevationStart = elevationStart;
30105             this.shapeCache = null;
30106             this.firePropertyChange(/* name */ "ELEVATION_START", oldElevationStart, elevationStart);
30107         }
30108     };
30109     /**
30110      * Returns the end point abscissa of this dimension line.
30111      * @return {number}
30112      */
30113     DimensionLine.prototype.getXEnd = function () {
30114         return this.xEnd;
30115     };
30116     /**
30117      * Sets the end point abscissa of this dimension line. Once this dimension line
30118      * is updated, listeners added to this dimension line will receive a change notification.
30119      * @param {number} xEnd
30120      */
30121     DimensionLine.prototype.setXEnd = function (xEnd) {
30122         if (xEnd !== this.xEnd) {
30123             var oldXEnd = this.xEnd;
30124             this.xEnd = xEnd;
30125             this.shapeCache = null;
30126             this.firePropertyChange(/* name */ "X_END", oldXEnd, xEnd);
30127         }
30128     };
30129     /**
30130      * Returns the end point ordinate of this dimension line.
30131      * @return {number}
30132      */
30133     DimensionLine.prototype.getYEnd = function () {
30134         return this.yEnd;
30135     };
30136     /**
30137      * Sets the end point ordinate of this dimension line. Once this dimension line
30138      * is updated, listeners added to this dimension line will receive a change notification.
30139      * @param {number} yEnd
30140      */
30141     DimensionLine.prototype.setYEnd = function (yEnd) {
30142         if (yEnd !== this.yEnd) {
30143             var oldYEnd = this.yEnd;
30144             this.yEnd = yEnd;
30145             this.shapeCache = null;
30146             this.firePropertyChange(/* name */ "Y_END", oldYEnd, yEnd);
30147         }
30148     };
30149     /**
30150      * Returns the end point elevation of this dimension line.
30151      * @return {number}
30152      */
30153     DimensionLine.prototype.getElevationEnd = function () {
30154         return this.elevationEnd;
30155     };
30156     /**
30157      * Sets the end point elevation of this dimension line. Once this dimension line
30158      * is updated, listeners added to this dimension line will receive a change notification.
30159      * @param {number} elevationEnd
30160      */
30161     DimensionLine.prototype.setElevationEnd = function (elevationEnd) {
30162         if (elevationEnd !== this.elevationEnd) {
30163             var oldElevationEnd = this.elevationEnd;
30164             this.elevationEnd = elevationEnd;
30165             this.shapeCache = null;
30166             this.firePropertyChange(/* name */ "ELEVATION_END", oldElevationEnd, elevationEnd);
30167         }
30168     };
30169     /**
30170      * Returns <code>true</code> if this dimension line is an elevation (vertical) dimension line.
30171      * @return {boolean}
30172      */
30173     DimensionLine.prototype.isElevationDimensionLine = function () {
30174         return this.xStart === this.xEnd && this.yStart === this.yEnd && this.elevationStart !== this.elevationEnd;
30175     };
30176     /**
30177      * Returns the offset of this dimension line.
30178      * @return {number}
30179      */
30180     DimensionLine.prototype.getOffset = function () {
30181         return this.offset;
30182     };
30183     /**
30184      * Sets the offset of this dimension line. Once this dimension line
30185      * is updated, listeners added to this dimension line will receive a change notification.
30186      * @param {number} offset
30187      */
30188     DimensionLine.prototype.setOffset = function (offset) {
30189         if (offset !== this.offset) {
30190             var oldOffset = this.offset;
30191             this.offset = offset;
30192             this.shapeCache = null;
30193             this.firePropertyChange(/* name */ "OFFSET", oldOffset, offset);
30194         }
30195     };
30196     /**
30197      * Returns the pitch angle in radians of this dimension line around its axis.
30198      * @return {number}
30199      */
30200     DimensionLine.prototype.getPitch = function () {
30201         return this.pitch;
30202     };
30203     /**
30204      * Sets the pitch angle of this dimension line. Once this dimension line
30205      * is updated, listeners added to this dimension line will receive a change notification.
30206      * @param {number} pitch
30207      */
30208     DimensionLine.prototype.setPitch = function (pitch) {
30209         if (pitch !== this.pitch) {
30210             var oldPitch = this.pitch;
30211             this.pitch = pitch;
30212             this.shapeCache = null;
30213             this.firePropertyChange(/* name */ "PITCH", oldPitch, pitch);
30214         }
30215     };
30216     /**
30217      * Returns the length of this dimension line.
30218      * @return {number}
30219      */
30220     DimensionLine.prototype.getLength = function () {
30221         var deltaX = this.xEnd - this.xStart;
30222         var deltaY = this.yEnd - this.yStart;
30223         var deltaElevation = this.elevationEnd - this.elevationStart;
30224         return Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaElevation * deltaElevation);
30225     };
30226     /**
30227      * Returns the text style used to display dimension line length.
30228      * @return {TextStyle}
30229      */
30230     DimensionLine.prototype.getLengthStyle = function () {
30231         return this.lengthStyle;
30232     };
30233     /**
30234      * Sets the text style used to display dimension line length.
30235      * Once this dimension line is updated, listeners added to it will receive a change notification.
30236      * @param {TextStyle} lengthStyle
30237      */
30238     DimensionLine.prototype.setLengthStyle = function (lengthStyle) {
30239         if (lengthStyle !== this.lengthStyle) {
30240             var oldLengthStyle = this.lengthStyle;
30241             this.lengthStyle = lengthStyle;
30242             this.firePropertyChange(/* name */ "LENGTH_STYLE", oldLengthStyle, lengthStyle);
30243         }
30244     };
30245     /**
30246      * Returns the color used to display the text of this dimension line.
30247      * @return {number}
30248      */
30249     DimensionLine.prototype.getColor = function () {
30250         return this.color;
30251     };
30252     /**
30253      * Sets the color used to display the text of this dimension line.
30254      * Once this dimension line is updated, listeners added to this dimension line
30255      * will receive a change notification.
30256      * @param {number} color
30257      */
30258     DimensionLine.prototype.setColor = function (color) {
30259         if (color !== this.color) {
30260             var oldColor = this.color;
30261             this.color = color;
30262             this.firePropertyChange(/* name */ "COLOR", oldColor, color);
30263         }
30264     };
30265     /**
30266      * Returns the size of marks drawn at the end of the dimension line.
30267      * @return {number}
30268      */
30269     DimensionLine.prototype.getEndMarkSize = function () {
30270         return this.endMarkSize;
30271     };
30272     /**
30273      * Sets the size of marks drawn at the end of the dimension line.
30274      * @param {number} endMarkSize
30275      */
30276     DimensionLine.prototype.setEndMarkSize = function (endMarkSize) {
30277         if (endMarkSize !== this.endMarkSize) {
30278             var oldEndMarkSize = this.endMarkSize;
30279             this.endMarkSize = endMarkSize;
30280             this.shapeCache = null;
30281             this.firePropertyChange(/* name */ "END_MARK_SIZE", oldEndMarkSize, endMarkSize);
30282         }
30283     };
30284     /**
30285      * Returns <code>true</code> if this dimension line should be displayed in 3D.
30286      * @return {boolean}
30287      */
30288     DimensionLine.prototype.isVisibleIn3D = function () {
30289         return this.visibleIn3D;
30290     };
30291     /**
30292      * Sets whether this dimension line should be displayed in 3D.
30293      * Once this dimension line is updated, listeners added to this dimension line
30294      * will receive a change notification.
30295      * @param {boolean} visibleIn3D
30296      */
30297     DimensionLine.prototype.setVisibleIn3D = function (visibleIn3D) {
30298         if (visibleIn3D !== this.visibleIn3D) {
30299             this.visibleIn3D = visibleIn3D;
30300             this.firePropertyChange(/* name */ "VISIBLE_IN_3D", !visibleIn3D, visibleIn3D);
30301         }
30302     };
30303     /**
30304      * Returns the level which this dimension line belongs to.
30305      * @return {Level}
30306      */
30307     DimensionLine.prototype.getLevel = function () {
30308         return this.level;
30309     };
30310     /**
30311      * Sets the level of this dimension line. Once this dimension line is updated,
30312      * listeners added to this dimension line will receive a change notification.
30313      * @param {Level} level
30314      */
30315     DimensionLine.prototype.setLevel = function (level) {
30316         if (level !== this.level) {
30317             var oldLevel = this.level;
30318             this.level = level;
30319             this.firePropertyChange(/* name */ "LEVEL", oldLevel, level);
30320         }
30321     };
30322     /**
30323      * Returns <code>true</code> if this dimension line is at the given <code>level</code>
30324      * or at a level with the same elevation and a smaller elevation index
30325      * or if the elevation of its highest end is higher than <code>level</code> elevation.
30326      * @param {Level} level
30327      * @return {boolean}
30328      */
30329     DimensionLine.prototype.isAtLevel = function (level) {
30330         if (this.level === level) {
30331             return true;
30332         }
30333         else if (this.level != null && level != null) {
30334             var dimensionLineLevelElevation = this.level.getElevation();
30335             var levelElevation = level.getElevation();
30336             return dimensionLineLevelElevation === levelElevation && this.level.getElevationIndex() < level.getElevationIndex() || dimensionLineLevelElevation < levelElevation && dimensionLineLevelElevation + Math.max(this.elevationStart, this.elevationEnd) > levelElevation;
30337         }
30338         else {
30339             return false;
30340         }
30341     };
30342     /**
30343      * Returns the points of the rectangle surrounding
30344      * this dimension line and its extension lines.
30345      * @return {float[][]} an array of the 4 (x,y) coordinates of the rectangle.
30346      */
30347     DimensionLine.prototype.getPoints = function () {
30348         var angle = this.isElevationDimensionLine() ? this.pitch : Math.atan2(this.yEnd - this.yStart, this.xEnd - this.xStart);
30349         var dx = -Math.sin(angle) * this.offset;
30350         var dy = Math.cos(angle) * this.offset;
30351         return [[this.xStart, this.yStart], [this.xStart + dx, this.yStart + dy], [this.xEnd + dx, this.yEnd + dy], [this.xEnd, this.yEnd]];
30352     };
30353     /**
30354      * Returns <code>true</code> if this dimension line intersects
30355      * with the horizontal rectangle which opposite corners are at points
30356      * (<code>x0</code>, <code>y0</code>) and (<code>x1</code>, <code>y1</code>).
30357      * @param {number} x0
30358      * @param {number} y0
30359      * @param {number} x1
30360      * @param {number} y1
30361      * @return {boolean}
30362      */
30363     DimensionLine.prototype.intersectsRectangle = function (x0, y0, x1, y1) {
30364         var rectangle = new java.awt.geom.Rectangle2D.Float(x0, y0, 0, 0);
30365         rectangle.add(x1, y1);
30366         return this.getShape().intersects(rectangle);
30367     };
30368     /**
30369      * Returns <code>true</code> if this dimension line contains
30370      * the point at (<code>x</code>, <code>y</code>)
30371      * with a given <code>margin</code>.
30372      * @param {number} x
30373      * @param {number} y
30374      * @param {number} margin
30375      * @return {boolean}
30376      */
30377     DimensionLine.prototype.containsPoint = function (x, y, margin) {
30378         return this.containsShapeAtWithMargin(this.getShape(), x, y, margin);
30379     };
30380     /**
30381      * Returns <code>true</code> if the middle point of this dimension line
30382      * is the point at (<code>x</code>, <code>y</code>)
30383      * with a given <code>margin</code>.
30384      * @param {number} x
30385      * @param {number} y
30386      * @param {number} margin
30387      * @return {boolean}
30388      */
30389     DimensionLine.prototype.isMiddlePointAt = function (x, y, margin) {
30390         if (this.elevationStart === this.elevationEnd) {
30391             var angle = Math.atan2(this.yEnd - this.yStart, this.xEnd - this.xStart);
30392             var dx = -Math.sin(angle) * this.offset;
30393             var dy = Math.cos(angle) * this.offset;
30394             var xMiddle = (this.xStart + this.xEnd) / 2 + dx;
30395             var yMiddle = (this.yStart + this.yEnd) / 2 + dy;
30396             return Math.abs(x - xMiddle) <= margin && Math.abs(y - yMiddle) <= margin;
30397         }
30398         else {
30399             return false;
30400         }
30401     };
30402     /**
30403      * Returns <code>true</code> if the extension line at the start of this dimension line
30404      * contains the point at (<code>x</code>, <code>y</code>)
30405      * with a given <code>margin</code> around the extension line.
30406      * @param {number} x
30407      * @param {number} y
30408      * @param {number} margin
30409      * @return {boolean}
30410      */
30411     DimensionLine.prototype.containsStartExtensionLinetAt = function (x, y, margin) {
30412         if (this.elevationStart === this.elevationEnd) {
30413             var angle = Math.atan2(this.yEnd - this.yStart, this.xEnd - this.xStart);
30414             var startExtensionLine = new java.awt.geom.Line2D.Float(this.xStart, this.yStart, this.xStart + -Math.sin(angle) * this.offset, this.yStart + Math.cos(angle) * this.offset);
30415             return this.containsShapeAtWithMargin(startExtensionLine, x, y, margin);
30416         }
30417         else {
30418             return false;
30419         }
30420     };
30421     /**
30422      * Returns <code>true</code> if the extension line at the end of this dimension line
30423      * contains the point at (<code>x</code>, <code>y</code>)
30424      * with a given <code>margin</code> around the extension line.
30425      * @param {number} x
30426      * @param {number} y
30427      * @param {number} margin
30428      * @return {boolean}
30429      */
30430     DimensionLine.prototype.containsEndExtensionLineAt = function (x, y, margin) {
30431         if (this.elevationStart === this.elevationEnd) {
30432             var angle = Math.atan2(this.yEnd - this.yStart, this.xEnd - this.xStart);
30433             var endExtensionLine = new java.awt.geom.Line2D.Float(this.xEnd, this.yEnd, this.xEnd + -Math.sin(angle) * this.offset, this.yEnd + Math.cos(angle) * this.offset);
30434             return this.containsShapeAtWithMargin(endExtensionLine, x, y, margin);
30435         }
30436         else {
30437             return false;
30438         }
30439     };
30440     /**
30441      * Returns <code>true</code> if the top point of this dimension line is
30442      * the point at (<code>x</code>, <code>y</code>) with a given <code>margin</code>.
30443      * @param {number} x
30444      * @param {number} y
30445      * @param {number} margin
30446      * @return {boolean}
30447      */
30448     DimensionLine.prototype.isTopPointAt = function (x, y, margin) {
30449         if (this.elevationStart !== this.elevationEnd) {
30450             var angle = this.yEnd !== this.yStart || this.xEnd !== this.xStart ? Math.atan2(this.yEnd - this.yStart, this.xEnd - this.xStart) : this.pitch;
30451             var dx = -Math.sin(angle) * (this.offset - this.endMarkSize / 2 * ( /* signum */(function (f) { if (f > 0) {
30452                 return 1;
30453             }
30454             else if (f < 0) {
30455                 return -1;
30456             }
30457             else {
30458                 return 0;
30459             } })(this.offset) === 0 ? -1 : /* signum */ (function (f) { if (f > 0) {
30460                 return 1;
30461             }
30462             else if (f < 0) {
30463                 return -1;
30464             }
30465             else {
30466                 return 0;
30467             } })(this.offset)));
30468             var dy = Math.cos(angle) * (this.offset - this.endMarkSize / 2 * ( /* signum */(function (f) { if (f > 0) {
30469                 return 1;
30470             }
30471             else if (f < 0) {
30472                 return -1;
30473             }
30474             else {
30475                 return 0;
30476             } })(this.offset) === 0 ? -1 : /* signum */ (function (f) { if (f > 0) {
30477                 return 1;
30478             }
30479             else if (f < 0) {
30480                 return -1;
30481             }
30482             else {
30483                 return 0;
30484             } })(this.offset)));
30485             var distanceSquareToTopPoint = java.awt.geom.Point2D.distanceSq(x, y, this.xStart + dx, this.yStart + dy);
30486             return distanceSquareToTopPoint <= margin * margin;
30487         }
30488         else {
30489             return false;
30490         }
30491     };
30492     /**
30493      * Returns <code>true</code> if the right point of this dimension line is
30494      * the point at (<code>x</code>, <code>y</code>) with a given <code>margin</code>.
30495      * @param {number} x
30496      * @param {number} y
30497      * @param {number} margin
30498      * @return {boolean}
30499      */
30500     DimensionLine.prototype.isRightPointAt = function (x, y, margin) {
30501         if (this.elevationStart !== this.elevationEnd) {
30502             var angle = this.yEnd !== this.yStart || this.xEnd !== this.xStart ? Math.atan2(this.yEnd - this.yStart, this.xEnd - this.xStart) : this.pitch;
30503             var sin = Math.sin(angle);
30504             var cos = Math.cos(angle);
30505             var dx = -sin * this.offset + cos * this.endMarkSize / 2;
30506             var dy = cos * this.offset + sin * this.endMarkSize / 2;
30507             var distanceSquareToTopPoint = java.awt.geom.Point2D.distanceSq(x, y, this.xStart + dx, this.yStart + dy);
30508             return distanceSquareToTopPoint <= margin * margin;
30509         }
30510         else {
30511             return false;
30512         }
30513     };
30514     /**
30515      * Returns <code>true</code> if the bottom left point of this dimension line is
30516      * the point at (<code>x</code>, <code>y</code>) with a given <code>margin</code>.
30517      * @param {number} x
30518      * @param {number} y
30519      * @param {number} margin
30520      * @return {boolean}
30521      */
30522     DimensionLine.prototype.isBottomPointAt = function (x, y, margin) {
30523         if (this.elevationStart !== this.elevationEnd) {
30524             var angle = this.yEnd !== this.yStart || this.xEnd !== this.xStart ? Math.atan2(this.yEnd - this.yStart, this.xEnd - this.xStart) : this.pitch;
30525             var dx = -Math.sin(angle) * (this.offset + this.endMarkSize / 2 * ( /* signum */(function (f) { if (f > 0) {
30526                 return 1;
30527             }
30528             else if (f < 0) {
30529                 return -1;
30530             }
30531             else {
30532                 return 0;
30533             } })(this.offset) === 0 ? -1 : /* signum */ (function (f) { if (f > 0) {
30534                 return 1;
30535             }
30536             else if (f < 0) {
30537                 return -1;
30538             }
30539             else {
30540                 return 0;
30541             } })(this.offset)));
30542             var dy = Math.cos(angle) * (this.offset + this.endMarkSize / 2 * ( /* signum */(function (f) { if (f > 0) {
30543                 return 1;
30544             }
30545             else if (f < 0) {
30546                 return -1;
30547             }
30548             else {
30549                 return 0;
30550             } })(this.offset) === 0 ? -1 : /* signum */ (function (f) { if (f > 0) {
30551                 return 1;
30552             }
30553             else if (f < 0) {
30554                 return -1;
30555             }
30556             else {
30557                 return 0;
30558             } })(this.offset)));
30559             var distanceSquareToTopPoint = java.awt.geom.Point2D.distanceSq(x, y, this.xStart + dx, this.yStart + dy);
30560             return distanceSquareToTopPoint <= margin * margin;
30561         }
30562         else {
30563             return false;
30564         }
30565     };
30566     /**
30567      * Returns <code>true</code> if the left point of this dimension line is
30568      * the point at (<code>x</code>, <code>y</code>) with a given <code>margin</code>.
30569      * @param {number} x
30570      * @param {number} y
30571      * @param {number} margin
30572      * @return {boolean}
30573      */
30574     DimensionLine.prototype.isLeftPointAt = function (x, y, margin) {
30575         if (this.elevationStart !== this.elevationEnd) {
30576             var angle = this.yEnd !== this.yStart || this.xEnd !== this.xStart ? Math.atan2(this.yEnd - this.yStart, this.xEnd - this.xStart) : this.pitch;
30577             var sin = Math.sin(angle);
30578             var cos = Math.cos(angle);
30579             var dx = -sin * this.offset - cos * this.endMarkSize / 2;
30580             var dy = cos * this.offset - sin * this.endMarkSize / 2;
30581             var distanceSquareToTopPoint = java.awt.geom.Point2D.distanceSq(x, y, this.xStart + dx, this.yStart + dy);
30582             return distanceSquareToTopPoint <= margin * margin;
30583         }
30584         else {
30585             return false;
30586         }
30587     };
30588     /**
30589      * Returns <code>true</code> if <code>shape</code> contains
30590      * the point at (<code>x</code>, <code>y</code>)
30591      * with a given <code>margin</code>.
30592      * @param {Object} shape
30593      * @param {number} x
30594      * @param {number} y
30595      * @param {number} margin
30596      * @return {boolean}
30597      * @private
30598      */
30599     DimensionLine.prototype.containsShapeAtWithMargin = function (shape, x, y, margin) {
30600         if (margin === 0) {
30601             return shape.contains(x, y);
30602         }
30603         else {
30604             return shape.intersects(x - margin, y - margin, 2 * margin, 2 * margin);
30605         }
30606     };
30607     /**
30608      * Returns the shape matching this dimension line.
30609      * @return {Object}
30610      * @private
30611      */
30612     DimensionLine.prototype.getShape = function () {
30613         if (this.shapeCache == null) {
30614             var angle = this.yEnd !== this.yStart || this.xEnd !== this.xStart ? Math.atan2(this.yEnd - this.yStart, this.xEnd - this.xStart) : this.pitch;
30615             var horizontalDimensionLine = this.elevationStart === this.elevationEnd;
30616             var dx = -Math.sin(angle) * this.offset;
30617             var dy = Math.cos(angle) * this.offset;
30618             var dimensionLineShape = new java.awt.geom.GeneralPath();
30619             if (horizontalDimensionLine) {
30620                 dimensionLineShape.append(new java.awt.geom.Line2D.Float(this.xStart + dx, this.yStart + dy, this.xEnd + dx, this.yEnd + dy), false);
30621                 dimensionLineShape.append(new java.awt.geom.Line2D.Float(this.xEnd, this.yEnd, this.xEnd + dx, this.yEnd + dy), false);
30622             }
30623             else {
30624                 dimensionLineShape.append(new java.awt.geom.Ellipse2D.Float(this.xStart + dx - this.endMarkSize / 2, this.yStart + dy - this.endMarkSize / 2, this.endMarkSize, this.endMarkSize), false);
30625             }
30626             dimensionLineShape.append(new java.awt.geom.Line2D.Float(this.xStart, this.yStart, this.xStart + dx, this.yStart + dy), false);
30627             this.shapeCache = dimensionLineShape;
30628         }
30629         return this.shapeCache;
30630     };
30631     /**
30632      * Moves this dimension line of (<code>dx</code>, <code>dy</code>) units.
30633      * @param {number} dx
30634      * @param {number} dy
30635      */
30636     DimensionLine.prototype.move = function (dx, dy) {
30637         this.setXStart(this.getXStart() + dx);
30638         this.setYStart(this.getYStart() + dy);
30639         this.setXEnd(this.getXEnd() + dx);
30640         this.setYEnd(this.getYEnd() + dy);
30641     };
30642     /**
30643      * Returns a clone of this dimension line.
30644      * @return {DimensionLine}
30645      */
30646     DimensionLine.prototype.clone = function () {
30647         var _this = this;
30648         var clone = (function (o) { if (_super.prototype.clone != undefined) {
30649             return _super.prototype.clone.call(_this);
30650         }
30651         else {
30652             var clone_7 = Object.create(o);
30653             for (var p in o) {
30654                 if (o.hasOwnProperty(p))
30655                     clone_7[p] = o[p];
30656             }
30657             return clone_7;
30658         } })(this);
30659         clone.level = null;
30660         return clone;
30661     };
30662     return DimensionLine;
30663 }(HomeObject));
30664 DimensionLine["__class"] = "com.eteks.sweethome3d.model.DimensionLine";
30665 DimensionLine["__interfaces"] = ["com.eteks.sweethome3d.model.Selectable", "com.eteks.sweethome3d.model.Elevatable"];
30666 DimensionLine['__transients'] = ['shapeCache', 'propertyChangeSupport'];
30667 /**
30668  * Creates a camera at given location and angles.
30669  * @param {string} id
30670  * @param {number} x
30671  * @param {number} y
30672  * @param {number} z
30673  * @param {number} yaw
30674  * @param {number} pitch
30675  * @param {number} fieldOfView
30676  * @param {number} time
30677  * @param {Camera.Lens} lens
30678  * @class
30679  * @extends HomeObject
30680  * @author Emmanuel Puybaret
30681  */
30682 var Camera = /** @class */ (function (_super) {
30683     __extends(Camera, _super);
30684     function Camera(id, x, y, z, yaw, pitch, fieldOfView, time, lens) {
30685         var _this = this;
30686         if (((typeof id === 'string') || id === null) && ((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof z === 'number') || z === null) && ((typeof yaw === 'number') || yaw === null) && ((typeof pitch === 'number') || pitch === null) && ((typeof fieldOfView === 'number') || fieldOfView === null) && ((typeof time === 'number') || time === null) && ((typeof lens === 'number') || lens === null)) {
30687             var __args = arguments;
30688             _this = _super.call(this, id) || this;
30689             if (_this.name === undefined) {
30690                 _this.name = null;
30691             }
30692             if (_this.x === undefined) {
30693                 _this.x = 0;
30694             }
30695             if (_this.y === undefined) {
30696                 _this.y = 0;
30697             }
30698             if (_this.z === undefined) {
30699                 _this.z = 0;
30700             }
30701             if (_this.yaw === undefined) {
30702                 _this.yaw = 0;
30703             }
30704             if (_this.pitch === undefined) {
30705                 _this.pitch = 0;
30706             }
30707             if (_this.fieldOfView === undefined) {
30708                 _this.fieldOfView = 0;
30709             }
30710             if (_this.time === undefined) {
30711                 _this.time = 0;
30712             }
30713             if (_this.lens === undefined) {
30714                 _this.lens = null;
30715             }
30716             if (_this.lensName === undefined) {
30717                 _this.lensName = null;
30718             }
30719             if (_this.renderer === undefined) {
30720                 _this.renderer = null;
30721             }
30722             _this.x = x;
30723             _this.y = y;
30724             _this.z = z;
30725             _this.yaw = yaw;
30726             _this.pitch = pitch;
30727             _this.fieldOfView = fieldOfView;
30728             _this.time = time;
30729             _this.lens = lens;
30730         }
30731         else if (((typeof id === 'number') || id === null) && ((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof z === 'number') || z === null) && ((typeof yaw === 'number') || yaw === null) && ((typeof pitch === 'number') || pitch === null) && ((typeof fieldOfView === 'number') || fieldOfView === null) && ((typeof time === 'number') || time === null) && lens === undefined) {
30732             var __args = arguments;
30733             var x_3 = __args[0];
30734             var y_3 = __args[1];
30735             var z_1 = __args[2];
30736             var yaw_1 = __args[3];
30737             var pitch_1 = __args[4];
30738             var fieldOfView_1 = __args[5];
30739             var time_1 = __args[6];
30740             var lens_1 = __args[7];
30741             {
30742                 var __args_91 = arguments;
30743                 var id_19 = HomeObject.createId("camera");
30744                 _this = _super.call(this, id_19) || this;
30745                 if (_this.name === undefined) {
30746                     _this.name = null;
30747                 }
30748                 if (_this.x === undefined) {
30749                     _this.x = 0;
30750                 }
30751                 if (_this.y === undefined) {
30752                     _this.y = 0;
30753                 }
30754                 if (_this.z === undefined) {
30755                     _this.z = 0;
30756                 }
30757                 if (_this.yaw === undefined) {
30758                     _this.yaw = 0;
30759                 }
30760                 if (_this.pitch === undefined) {
30761                     _this.pitch = 0;
30762                 }
30763                 if (_this.fieldOfView === undefined) {
30764                     _this.fieldOfView = 0;
30765                 }
30766                 if (_this.time === undefined) {
30767                     _this.time = 0;
30768                 }
30769                 if (_this.lens === undefined) {
30770                     _this.lens = null;
30771                 }
30772                 if (_this.lensName === undefined) {
30773                     _this.lensName = null;
30774                 }
30775                 if (_this.renderer === undefined) {
30776                     _this.renderer = null;
30777                 }
30778                 _this.x = x_3;
30779                 _this.y = y_3;
30780                 _this.z = z_1;
30781                 _this.yaw = yaw_1;
30782                 _this.pitch = pitch_1;
30783                 _this.fieldOfView = fieldOfView_1;
30784                 _this.time = time_1;
30785                 _this.lens = lens_1;
30786             }
30787             if (_this.name === undefined) {
30788                 _this.name = null;
30789             }
30790             if (_this.x === undefined) {
30791                 _this.x = 0;
30792             }
30793             if (_this.y === undefined) {
30794                 _this.y = 0;
30795             }
30796             if (_this.z === undefined) {
30797                 _this.z = 0;
30798             }
30799             if (_this.yaw === undefined) {
30800                 _this.yaw = 0;
30801             }
30802             if (_this.pitch === undefined) {
30803                 _this.pitch = 0;
30804             }
30805             if (_this.fieldOfView === undefined) {
30806                 _this.fieldOfView = 0;
30807             }
30808             if (_this.time === undefined) {
30809                 _this.time = 0;
30810             }
30811             if (_this.lens === undefined) {
30812                 _this.lens = null;
30813             }
30814             if (_this.lensName === undefined) {
30815                 _this.lensName = null;
30816             }
30817             if (_this.renderer === undefined) {
30818                 _this.renderer = null;
30819             }
30820         }
30821         else if (((typeof id === 'string') || id === null) && ((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof z === 'number') || z === null) && ((typeof yaw === 'number') || yaw === null) && ((typeof pitch === 'number') || pitch === null) && ((typeof fieldOfView === 'number') || fieldOfView === null) && time === undefined && lens === undefined) {
30822             var __args = arguments;
30823             {
30824                 var __args_92 = arguments;
30825                 var time_2 = Camera.midday();
30826                 var lens_2 = Camera.Lens.PINHOLE;
30827                 _this = _super.call(this, id) || this;
30828                 if (_this.name === undefined) {
30829                     _this.name = null;
30830                 }
30831                 if (_this.x === undefined) {
30832                     _this.x = 0;
30833                 }
30834                 if (_this.y === undefined) {
30835                     _this.y = 0;
30836                 }
30837                 if (_this.z === undefined) {
30838                     _this.z = 0;
30839                 }
30840                 if (_this.yaw === undefined) {
30841                     _this.yaw = 0;
30842                 }
30843                 if (_this.pitch === undefined) {
30844                     _this.pitch = 0;
30845                 }
30846                 if (_this.fieldOfView === undefined) {
30847                     _this.fieldOfView = 0;
30848                 }
30849                 if (_this.time === undefined) {
30850                     _this.time = 0;
30851                 }
30852                 if (_this.lens === undefined) {
30853                     _this.lens = null;
30854                 }
30855                 if (_this.lensName === undefined) {
30856                     _this.lensName = null;
30857                 }
30858                 if (_this.renderer === undefined) {
30859                     _this.renderer = null;
30860                 }
30861                 _this.x = x;
30862                 _this.y = y;
30863                 _this.z = z;
30864                 _this.yaw = yaw;
30865                 _this.pitch = pitch;
30866                 _this.fieldOfView = fieldOfView;
30867                 _this.time = time_2;
30868                 _this.lens = lens_2;
30869             }
30870             if (_this.name === undefined) {
30871                 _this.name = null;
30872             }
30873             if (_this.x === undefined) {
30874                 _this.x = 0;
30875             }
30876             if (_this.y === undefined) {
30877                 _this.y = 0;
30878             }
30879             if (_this.z === undefined) {
30880                 _this.z = 0;
30881             }
30882             if (_this.yaw === undefined) {
30883                 _this.yaw = 0;
30884             }
30885             if (_this.pitch === undefined) {
30886                 _this.pitch = 0;
30887             }
30888             if (_this.fieldOfView === undefined) {
30889                 _this.fieldOfView = 0;
30890             }
30891             if (_this.time === undefined) {
30892                 _this.time = 0;
30893             }
30894             if (_this.lens === undefined) {
30895                 _this.lens = null;
30896             }
30897             if (_this.lensName === undefined) {
30898                 _this.lensName = null;
30899             }
30900             if (_this.renderer === undefined) {
30901                 _this.renderer = null;
30902             }
30903         }
30904         else if (((typeof id === 'number') || id === null) && ((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof z === 'number') || z === null) && ((typeof yaw === 'number') || yaw === null) && ((typeof pitch === 'number') || pitch === null) && fieldOfView === undefined && time === undefined && lens === undefined) {
30905             var __args = arguments;
30906             var x_4 = __args[0];
30907             var y_4 = __args[1];
30908             var z_2 = __args[2];
30909             var yaw_2 = __args[3];
30910             var pitch_2 = __args[4];
30911             var fieldOfView_2 = __args[5];
30912             {
30913                 var __args_93 = arguments;
30914                 var time_3 = Camera.midday();
30915                 var lens_3 = Camera.Lens.PINHOLE;
30916                 {
30917                     var __args_94 = arguments;
30918                     var id_20 = HomeObject.createId("camera");
30919                     _this = _super.call(this, id_20) || this;
30920                     if (_this.name === undefined) {
30921                         _this.name = null;
30922                     }
30923                     if (_this.x === undefined) {
30924                         _this.x = 0;
30925                     }
30926                     if (_this.y === undefined) {
30927                         _this.y = 0;
30928                     }
30929                     if (_this.z === undefined) {
30930                         _this.z = 0;
30931                     }
30932                     if (_this.yaw === undefined) {
30933                         _this.yaw = 0;
30934                     }
30935                     if (_this.pitch === undefined) {
30936                         _this.pitch = 0;
30937                     }
30938                     if (_this.fieldOfView === undefined) {
30939                         _this.fieldOfView = 0;
30940                     }
30941                     if (_this.time === undefined) {
30942                         _this.time = 0;
30943                     }
30944                     if (_this.lens === undefined) {
30945                         _this.lens = null;
30946                     }
30947                     if (_this.lensName === undefined) {
30948                         _this.lensName = null;
30949                     }
30950                     if (_this.renderer === undefined) {
30951                         _this.renderer = null;
30952                     }
30953                     _this.x = x_4;
30954                     _this.y = y_4;
30955                     _this.z = z_2;
30956                     _this.yaw = yaw_2;
30957                     _this.pitch = pitch_2;
30958                     _this.fieldOfView = fieldOfView_2;
30959                     _this.time = time_3;
30960                     _this.lens = lens_3;
30961                 }
30962                 if (_this.name === undefined) {
30963                     _this.name = null;
30964                 }
30965                 if (_this.x === undefined) {
30966                     _this.x = 0;
30967                 }
30968                 if (_this.y === undefined) {
30969                     _this.y = 0;
30970                 }
30971                 if (_this.z === undefined) {
30972                     _this.z = 0;
30973                 }
30974                 if (_this.yaw === undefined) {
30975                     _this.yaw = 0;
30976                 }
30977                 if (_this.pitch === undefined) {
30978                     _this.pitch = 0;
30979                 }
30980                 if (_this.fieldOfView === undefined) {
30981                     _this.fieldOfView = 0;
30982                 }
30983                 if (_this.time === undefined) {
30984                     _this.time = 0;
30985                 }
30986                 if (_this.lens === undefined) {
30987                     _this.lens = null;
30988                 }
30989                 if (_this.lensName === undefined) {
30990                     _this.lensName = null;
30991                 }
30992                 if (_this.renderer === undefined) {
30993                     _this.renderer = null;
30994                 }
30995             }
30996             if (_this.name === undefined) {
30997                 _this.name = null;
30998             }
30999             if (_this.x === undefined) {
31000                 _this.x = 0;
31001             }
31002             if (_this.y === undefined) {
31003                 _this.y = 0;
31004             }
31005             if (_this.z === undefined) {
31006                 _this.z = 0;
31007             }
31008             if (_this.yaw === undefined) {
31009                 _this.yaw = 0;
31010             }
31011             if (_this.pitch === undefined) {
31012                 _this.pitch = 0;
31013             }
31014             if (_this.fieldOfView === undefined) {
31015                 _this.fieldOfView = 0;
31016             }
31017             if (_this.time === undefined) {
31018                 _this.time = 0;
31019             }
31020             if (_this.lens === undefined) {
31021                 _this.lens = null;
31022             }
31023             if (_this.lensName === undefined) {
31024                 _this.lensName = null;
31025             }
31026             if (_this.renderer === undefined) {
31027                 _this.renderer = null;
31028             }
31029         }
31030         else
31031             throw new Error('invalid overload');
31032         return _this;
31033     }
31034     /**
31035      * Returns the time of midday today in milliseconds since the Epoch in UTC time zone.
31036      * @return {number}
31037      * @private
31038      */
31039     Camera.midday = function () {
31040         var midday = new Date();
31041         /* set */ (function (d, p) { return d["UTC"] ? d.setUTCHours(p) : d.setHours(p); })(midday, 12);
31042         /* set */ (function (d, p) { return d["UTC"] ? d.setUTCMinutes(p) : d.setMinutes(p); })(midday, 0);
31043         /* set */ (function (d, p) { return d["UTC"] ? d.setUTCSeconds(p) : d.setSeconds(p); })(midday, 0);
31044         /* set */ (function (d, p) { return d["UTC"] ? d.setUTCMilliseconds(p) : d.setMilliseconds(p); })(midday, 0);
31045         return /* getTimeInMillis */ midday.getTime();
31046     };
31047     /**
31048      * Returns the name of this camera.
31049      * @return {string}
31050      */
31051     Camera.prototype.getName = function () {
31052         return this.name;
31053     };
31054     /**
31055      * Sets the name of this camera and notifies listeners of this change.
31056      * @param {string} name
31057      */
31058     Camera.prototype.setName = function (name) {
31059         if (name !== this.name && (name == null || !(name === this.name))) {
31060             var oldName = this.name;
31061             this.name = name;
31062             this.firePropertyChange(/* name */ "NAME", oldName, name);
31063         }
31064     };
31065     /**
31066      * Returns the yaw angle in radians of this camera.
31067      * @return {number}
31068      */
31069     Camera.prototype.getYaw = function () {
31070         return this.yaw;
31071     };
31072     /**
31073      * Sets the yaw angle in radians of this camera and notifies listeners of this change.
31074      * Yaw axis is vertical axis.
31075      * @param {number} yaw
31076      */
31077     Camera.prototype.setYaw = function (yaw) {
31078         if (yaw !== this.yaw) {
31079             var oldYaw = this.yaw;
31080             this.yaw = yaw;
31081             this.firePropertyChange(/* name */ "YAW", oldYaw, yaw);
31082         }
31083     };
31084     /**
31085      * Returns the pitch angle in radians of this camera.
31086      * @return {number}
31087      */
31088     Camera.prototype.getPitch = function () {
31089         return this.pitch;
31090     };
31091     /**
31092      * Sets the pitch angle in radians of this camera and notifies listeners of this change.
31093      * Pitch axis is horizontal transverse axis.
31094      * @param {number} pitch
31095      */
31096     Camera.prototype.setPitch = function (pitch) {
31097         if (pitch !== this.pitch) {
31098             var oldPitch = this.pitch;
31099             this.pitch = pitch;
31100             this.firePropertyChange(/* name */ "PITCH", oldPitch, pitch);
31101         }
31102     };
31103     /**
31104      * Returns the field of view in radians of this camera.
31105      * @return {number}
31106      */
31107     Camera.prototype.getFieldOfView = function () {
31108         return this.fieldOfView;
31109     };
31110     /**
31111      * Sets the field of view in radians of this camera and notifies listeners of this change.
31112      * @param {number} fieldOfView
31113      */
31114     Camera.prototype.setFieldOfView = function (fieldOfView) {
31115         if (fieldOfView !== this.fieldOfView) {
31116             var oldFieldOfView = this.fieldOfView;
31117             this.fieldOfView = fieldOfView;
31118             this.firePropertyChange(/* name */ "FIELD_OF_VIEW", oldFieldOfView, fieldOfView);
31119         }
31120     };
31121     /**
31122      * Returns the abscissa of this camera.
31123      * @return {number}
31124      */
31125     Camera.prototype.getX = function () {
31126         return this.x;
31127     };
31128     /**
31129      * Sets the abscissa of this camera and notifies listeners of this change.
31130      * @param {number} x
31131      */
31132     Camera.prototype.setX = function (x) {
31133         if (x !== this.x) {
31134             var oldX = this.x;
31135             this.x = x;
31136             this.firePropertyChange(/* name */ "X", oldX, x);
31137         }
31138     };
31139     /**
31140      * Returns the ordinate of this camera.
31141      * @return {number}
31142      */
31143     Camera.prototype.getY = function () {
31144         return this.y;
31145     };
31146     /**
31147      * Sets the ordinate of this camera and notifies listeners of this change.
31148      * @param {number} y
31149      */
31150     Camera.prototype.setY = function (y) {
31151         if (y !== this.y) {
31152             var oldY = this.y;
31153             this.y = y;
31154             this.firePropertyChange(/* name */ "Y", oldY, y);
31155         }
31156     };
31157     /**
31158      * Returns the elevation of this camera.
31159      * @return {number}
31160      */
31161     Camera.prototype.getZ = function () {
31162         return this.z;
31163     };
31164     /**
31165      * Sets the elevation of this camera and notifies listeners of this change.
31166      * @param {number} z
31167      */
31168     Camera.prototype.setZ = function (z) {
31169         if (z !== this.z) {
31170             var oldZ = this.z;
31171             this.z = z;
31172             this.firePropertyChange(/* name */ "Z", oldZ, z);
31173         }
31174     };
31175     /**
31176      * Returns the time in milliseconds when this camera is used.
31177      * @return {number} a time in milliseconds since the Epoch in UTC time zone
31178      */
31179     Camera.prototype.getTime = function () {
31180         return this.time;
31181     };
31182     /**
31183      * Sets the use time in milliseconds since the Epoch in UTC time zone,
31184      * and notifies listeners of this change.
31185      * @param {number} time
31186      */
31187     Camera.prototype.setTime = function (time) {
31188         if (this.time !== time) {
31189             var oldTime = this.time;
31190             this.time = time;
31191             this.firePropertyChange(/* name */ "TIME", oldTime, time);
31192         }
31193     };
31194     /**
31195      * Returns a time expressed in UTC time zone converted to the given time zone.
31196      * @param {number} utcTime
31197      * @param {string} timeZone
31198      * @return {number}
31199      */
31200     Camera.convertTimeToTimeZone = function (utcTime, timeZone) {
31201         var utcCalendar = new Date();
31202         /* setTimeInMillis */ utcCalendar.setTime(utcTime);
31203         var convertedCalendar = new Date();
31204         /* set */ (function (d, p) { return d["UTC"] ? d.setUTCFullYear(p) : d.setFullYear(p); })(convertedCalendar, /* get */ (function (d) { return d["UTC"] ? d.getUTCFullYear() : d.getFullYear(); })(utcCalendar));
31205         /* set */ (function (d, p) { return d["UTC"] ? d.setUTCMonth(p) : d.setMonth(p); })(convertedCalendar, /* get */ (function (d) { return d["UTC"] ? d.getUTCMonth() : d.getMonth(); })(utcCalendar));
31206         /* set */ (function (d, p) { return d["UTC"] ? d.setUTCDate(p) : d.setDate(p); })(convertedCalendar, /* get */ (function (d) { return d["UTC"] ? d.getUTCDate() : d.getDate(); })(utcCalendar));
31207         /* set */ (function (d, p) { return d["UTC"] ? d.setUTCHours(p) : d.setHours(p); })(convertedCalendar, /* get */ (function (d) { return d["UTC"] ? d.getUTCHours() : d.getHours(); })(utcCalendar));
31208         /* set */ (function (d, p) { return d["UTC"] ? d.setUTCMinutes(p) : d.setMinutes(p); })(convertedCalendar, /* get */ (function (d) { return d["UTC"] ? d.getUTCMinutes() : d.getMinutes(); })(utcCalendar));
31209         /* set */ (function (d, p) { return d["UTC"] ? d.setUTCSeconds(p) : d.setSeconds(p); })(convertedCalendar, /* get */ (function (d) { return d["UTC"] ? d.getUTCSeconds() : d.getSeconds(); })(utcCalendar));
31210         /* set */ (function (d, p) { return d["UTC"] ? d.setUTCMilliseconds(p) : d.setMilliseconds(p); })(convertedCalendar, /* get */ (function (d) { return d["UTC"] ? d.getUTCMilliseconds() : d.getMilliseconds(); })(utcCalendar));
31211         return /* getTimeInMillis */ convertedCalendar.getTime();
31212     };
31213     /**
31214      * Returns the lens of this camera.
31215      * @return {Camera.Lens}
31216      */
31217     Camera.prototype.getLens = function () {
31218         return this.lens;
31219     };
31220     /**
31221      * Sets the lens of this camera and notifies listeners of this change.
31222      * @param {Camera.Lens} lens
31223      */
31224     Camera.prototype.setLens = function (lens) {
31225         if (lens !== this.lens) {
31226             var oldLens = this.lens;
31227             this.lens = lens;
31228             this.lensName = /* Enum.name */ Camera.Lens[this.lens];
31229             this.firePropertyChange(/* name */ "LENS", oldLens, lens);
31230         }
31231     };
31232     /**
31233      * Sets the rendering engine used to create photos.
31234      * @param {string} renderer
31235      */
31236     Camera.prototype.setRenderer = function (renderer) {
31237         if (renderer !== this.renderer && (renderer == null || !(renderer === this.renderer))) {
31238             var oldRenderer = this.renderer;
31239             this.renderer = renderer;
31240             this.firePropertyChange(/* name */ "RENDERER", oldRenderer, renderer);
31241         }
31242     };
31243     /**
31244      * Returns the rendering engine used to create photos.
31245      * @return {string}
31246      */
31247     Camera.prototype.getRenderer = function () {
31248         return this.renderer;
31249     };
31250     /**
31251      * Sets the location and angles of this camera from the <code>camera</code> in parameter.
31252      * @param {Camera} camera
31253      */
31254     Camera.prototype.setCamera = function (camera) {
31255         this.setX(camera.getX());
31256         this.setY(camera.getY());
31257         this.setZ(camera.getZ());
31258         this.setYaw(camera.getYaw());
31259         this.setPitch(camera.getPitch());
31260         this.setFieldOfView(camera.getFieldOfView());
31261     };
31262     /**
31263      * Returns a clone of this camera.
31264      * @return {Camera}
31265      */
31266     Camera.prototype.clone = function () {
31267         var _this = this;
31268         return (function (o) { if (_super.prototype.clone != undefined) {
31269             return _super.prototype.clone.call(_this);
31270         }
31271         else {
31272             var clone = Object.create(o);
31273             for (var p in o) {
31274                 if (o.hasOwnProperty(p))
31275                     clone[p] = o[p];
31276             }
31277             return clone;
31278         } })(this);
31279     };
31280     return Camera;
31281 }(HomeObject));
31282 Camera["__class"] = "com.eteks.sweethome3d.model.Camera";
31283 (function (Camera) {
31284     /**
31285      * The kind of lens that can be used with a camera.
31286      * @author Emmanuel Puybaret
31287      * @enum
31288      * @property {Camera.Lens} PINHOLE
31289      * @property {Camera.Lens} NORMAL
31290      * @property {Camera.Lens} FISHEYE
31291      * @property {Camera.Lens} SPHERICAL
31292      * @class
31293      */
31294     var Lens;
31295     (function (Lens) {
31296         Lens[Lens["PINHOLE"] = 0] = "PINHOLE";
31297         Lens[Lens["NORMAL"] = 1] = "NORMAL";
31298         Lens[Lens["FISHEYE"] = 2] = "FISHEYE";
31299         Lens[Lens["SPHERICAL"] = 3] = "SPHERICAL";
31300     })(Lens = Camera.Lens || (Camera.Lens = {}));
31301 })(Camera || (Camera = {}));
31302 Camera['__transients'] = ['lens', 'propertyChangeSupport'];
31303 /**
31304  * Creates a home level.
31305  * @param {string} id    the ID of the level
31306  * @param {string} name  the name of the level
31307  * @param {number} elevation the elevation of the bottom of the level
31308  * @param {number} floorThickness the floor thickness of the level
31309  * @param {number} height the height of the level
31310  * @class
31311  * @extends HomeObject
31312  * @author Emmanuel Puybaret
31313  */
31314 var Level = /** @class */ (function (_super) {
31315     __extends(Level, _super);
31316     function Level(id, name, elevation, floorThickness, height) {
31317         var _this = this;
31318         if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof floorThickness === 'number') || floorThickness === null) && ((typeof height === 'number') || height === null)) {
31319             var __args = arguments;
31320             _this = _super.call(this, id) || this;
31321             if (_this.name === undefined) {
31322                 _this.name = null;
31323             }
31324             if (_this.elevation === undefined) {
31325                 _this.elevation = 0;
31326             }
31327             if (_this.floorThickness === undefined) {
31328                 _this.floorThickness = 0;
31329             }
31330             if (_this.height === undefined) {
31331                 _this.height = 0;
31332             }
31333             if (_this.backgroundImage === undefined) {
31334                 _this.backgroundImage = null;
31335             }
31336             if (_this.visible === undefined) {
31337                 _this.visible = false;
31338             }
31339             if (_this.viewable === undefined) {
31340                 _this.viewable = false;
31341             }
31342             if (_this.elevationIndex === undefined) {
31343                 _this.elevationIndex = 0;
31344             }
31345             _this.name = name;
31346             _this.elevation = elevation;
31347             _this.floorThickness = floorThickness;
31348             _this.height = height;
31349             _this.visible = true;
31350             _this.viewable = true;
31351             _this.elevationIndex = -1;
31352         }
31353         else if (((typeof id === 'string') || id === null) && ((typeof name === 'number') || name === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof floorThickness === 'number') || floorThickness === null) && height === undefined) {
31354             var __args = arguments;
31355             var name_5 = __args[0];
31356             var elevation_10 = __args[1];
31357             var floorThickness_1 = __args[2];
31358             var height_16 = __args[3];
31359             {
31360                 var __args_95 = arguments;
31361                 var id_21 = HomeObject.createId("level");
31362                 _this = _super.call(this, id_21) || this;
31363                 if (_this.name === undefined) {
31364                     _this.name = null;
31365                 }
31366                 if (_this.elevation === undefined) {
31367                     _this.elevation = 0;
31368                 }
31369                 if (_this.floorThickness === undefined) {
31370                     _this.floorThickness = 0;
31371                 }
31372                 if (_this.height === undefined) {
31373                     _this.height = 0;
31374                 }
31375                 if (_this.backgroundImage === undefined) {
31376                     _this.backgroundImage = null;
31377                 }
31378                 if (_this.visible === undefined) {
31379                     _this.visible = false;
31380                 }
31381                 if (_this.viewable === undefined) {
31382                     _this.viewable = false;
31383                 }
31384                 if (_this.elevationIndex === undefined) {
31385                     _this.elevationIndex = 0;
31386                 }
31387                 _this.name = name_5;
31388                 _this.elevation = elevation_10;
31389                 _this.floorThickness = floorThickness_1;
31390                 _this.height = height_16;
31391                 _this.visible = true;
31392                 _this.viewable = true;
31393                 _this.elevationIndex = -1;
31394             }
31395             if (_this.name === undefined) {
31396                 _this.name = null;
31397             }
31398             if (_this.elevation === undefined) {
31399                 _this.elevation = 0;
31400             }
31401             if (_this.floorThickness === undefined) {
31402                 _this.floorThickness = 0;
31403             }
31404             if (_this.height === undefined) {
31405                 _this.height = 0;
31406             }
31407             if (_this.backgroundImage === undefined) {
31408                 _this.backgroundImage = null;
31409             }
31410             if (_this.visible === undefined) {
31411                 _this.visible = false;
31412             }
31413             if (_this.viewable === undefined) {
31414                 _this.viewable = false;
31415             }
31416             if (_this.elevationIndex === undefined) {
31417                 _this.elevationIndex = 0;
31418             }
31419         }
31420         else
31421             throw new Error('invalid overload');
31422         return _this;
31423     }
31424     /**
31425      * Returns the name of this level.
31426      * @return {string}
31427      */
31428     Level.prototype.getName = function () {
31429         return this.name;
31430     };
31431     /**
31432      * Sets the name of this level. Once this level
31433      * is updated, listeners added to this level will receive a change notification.
31434      * @param {string} name
31435      */
31436     Level.prototype.setName = function (name) {
31437         if (name !== this.name && (name == null || !(name === this.name))) {
31438             var oldName = this.name;
31439             this.name = name;
31440             this.firePropertyChange(/* name */ "NAME", oldName, name);
31441         }
31442     };
31443     /**
31444      * Returns the elevation of the bottom of this level.
31445      * @return {number}
31446      */
31447     Level.prototype.getElevation = function () {
31448         return this.elevation;
31449     };
31450     /**
31451      * Sets the elevation of this level. Once this level is updated,
31452      * listeners added to this level will receive a change notification.
31453      * @param {number} elevation
31454      */
31455     Level.prototype.setElevation = function (elevation) {
31456         if (elevation !== this.elevation) {
31457             var oldElevation = this.elevation;
31458             this.elevation = elevation;
31459             this.firePropertyChange(/* name */ "ELEVATION", oldElevation, elevation);
31460         }
31461     };
31462     /**
31463      * Returns the floor thickness of this level.
31464      * @return {number}
31465      */
31466     Level.prototype.getFloorThickness = function () {
31467         return this.floorThickness;
31468     };
31469     /**
31470      * Sets the floor thickness of this level. Once this level is updated,
31471      * listeners added to this level will receive a change notification.
31472      * @param {number} floorThickness
31473      */
31474     Level.prototype.setFloorThickness = function (floorThickness) {
31475         if (floorThickness !== this.floorThickness) {
31476             var oldFloorThickness = this.floorThickness;
31477             this.floorThickness = floorThickness;
31478             this.firePropertyChange(/* name */ "FLOOR_THICKNESS", oldFloorThickness, floorThickness);
31479         }
31480     };
31481     /**
31482      * Returns the height of this level.
31483      * @return {number}
31484      */
31485     Level.prototype.getHeight = function () {
31486         return this.height;
31487     };
31488     /**
31489      * Sets the height of this level. Once this level is updated,
31490      * listeners added to this level will receive a change notification.
31491      * @param {number} height
31492      */
31493     Level.prototype.setHeight = function (height) {
31494         if (height !== this.height) {
31495             var oldHeight = this.height;
31496             this.height = height;
31497             this.firePropertyChange(/* name */ "HEIGHT", oldHeight, height);
31498         }
31499     };
31500     /**
31501      * Returns the plan background image of this level.
31502      * @return {BackgroundImage}
31503      */
31504     Level.prototype.getBackgroundImage = function () {
31505         return this.backgroundImage;
31506     };
31507     /**
31508      * Sets the plan background image of this level and fires a <code>PropertyChangeEvent</code>.
31509      * @param {BackgroundImage} backgroundImage
31510      */
31511     Level.prototype.setBackgroundImage = function (backgroundImage) {
31512         if (backgroundImage !== this.backgroundImage) {
31513             var oldBackgroundImage = this.backgroundImage;
31514             this.backgroundImage = backgroundImage;
31515             this.firePropertyChange(/* name */ "BACKGROUND_IMAGE", oldBackgroundImage, backgroundImage);
31516         }
31517     };
31518     /**
31519      * Returns <code>true</code> if this level is visible.
31520      * @return {boolean}
31521      */
31522     Level.prototype.isVisible = function () {
31523         return this.visible;
31524     };
31525     /**
31526      * Sets whether this level is visible or not. Once this level is updated,
31527      * listeners added to this level will receive a change notification.
31528      * @param {boolean} visible
31529      */
31530     Level.prototype.setVisible = function (visible) {
31531         if (visible !== this.visible) {
31532             this.visible = visible;
31533             this.firePropertyChange(/* name */ "VISIBLE", !visible, visible);
31534         }
31535     };
31536     /**
31537      * Returns <code>true</code> if this level is viewable.
31538      * @return {boolean}
31539      */
31540     Level.prototype.isViewable = function () {
31541         return this.viewable;
31542     };
31543     /**
31544      * Sets whether this level is viewable or not. Once this level is updated,
31545      * listeners added to this level will receive a change notification.
31546      * @param {boolean} viewable
31547      */
31548     Level.prototype.setViewable = function (viewable) {
31549         if (viewable !== this.viewable) {
31550             this.viewable = viewable;
31551             this.firePropertyChange(/* name */ "VIEWABLE", !viewable, viewable);
31552         }
31553     };
31554     /**
31555      * Returns <code>true</code> if this level is viewable and visible.
31556      * @return {boolean}
31557      */
31558     Level.prototype.isViewableAndVisible = function () {
31559         return this.viewable && this.visible;
31560     };
31561     /**
31562      * Returns the index of this level used to order levels at the same elevation.
31563      * @return {number}
31564      */
31565     Level.prototype.getElevationIndex = function () {
31566         return this.elevationIndex;
31567     };
31568     /**
31569      * Sets the index of this level used to order levels at the same elevation.
31570      * @param {number} elevationIndex
31571      */
31572     Level.prototype.setElevationIndex = function (elevationIndex) {
31573         if (elevationIndex !== this.elevationIndex) {
31574             var oldElevationIndex = this.elevationIndex;
31575             this.elevationIndex = elevationIndex;
31576             this.firePropertyChange(/* name */ "ELEVATION_INDEX", oldElevationIndex, elevationIndex);
31577         }
31578     };
31579     /**
31580      * Returns a clone of this level.
31581      * @return {Level}
31582      */
31583     Level.prototype.clone = function () {
31584         var _this = this;
31585         return (function (o) { if (_super.prototype.clone != undefined) {
31586             return _super.prototype.clone.call(_this);
31587         }
31588         else {
31589             var clone = Object.create(o);
31590             for (var p in o) {
31591                 if (o.hasOwnProperty(p))
31592                     clone[p] = o[p];
31593             }
31594             return clone;
31595         } })(this);
31596     };
31597     return Level;
31598 }(HomeObject));
31599 Level["__class"] = "com.eteks.sweethome3d.model.Level";
31600 Level['__transients'] = ['propertyChangeSupport'];
31601 /**
31602  * Creates a polyline from the given coordinates.
31603  * @param {string} id
31604  * @param {float[][]} points
31605  * @param {number} thickness
31606  * @param {Polyline.CapStyle} capStyle
31607  * @param {Polyline.JoinStyle} joinStyle
31608  * @param {Polyline.DashStyle} dashStyle
31609  * @param {number} dashOffset
31610  * @param {Polyline.ArrowStyle} startArrowStyle
31611  * @param {Polyline.ArrowStyle} endArrowStyle
31612  * @param {boolean} closedPath
31613  * @param {number} color
31614  * @class
31615  * @extends HomeObject
31616  * @author Emmanuel Puybaret
31617  */
31618 var Polyline = /** @class */ (function (_super) {
31619     __extends(Polyline, _super);
31620     function Polyline(id, points, thickness, capStyle, joinStyle, dashStyle, dashOffset, startArrowStyle, endArrowStyle, closedPath, color) {
31621         var _this = this;
31622         if (((typeof id === 'string') || id === null) && ((points != null && points instanceof Array && (points.length == 0 || points[0] == null || points[0] instanceof Array)) || points === null) && ((typeof thickness === 'number') || thickness === null) && ((typeof capStyle === 'number') || capStyle === null) && ((typeof joinStyle === 'number') || joinStyle === null) && ((typeof dashStyle === 'number') || dashStyle === null) && ((typeof dashOffset === 'number') || dashOffset === null) && ((typeof startArrowStyle === 'number') || startArrowStyle === null) && ((typeof endArrowStyle === 'number') || endArrowStyle === null) && ((typeof closedPath === 'boolean') || closedPath === null) && ((typeof color === 'number') || color === null)) {
31623             var __args = arguments;
31624             _this = _super.call(this, id) || this;
31625             if (_this.points === undefined) {
31626                 _this.points = null;
31627             }
31628             if (_this.thickness === undefined) {
31629                 _this.thickness = 0;
31630             }
31631             if (_this.capStyle === undefined) {
31632                 _this.capStyle = null;
31633             }
31634             if (_this.capStyleName === undefined) {
31635                 _this.capStyleName = null;
31636             }
31637             if (_this.joinStyle === undefined) {
31638                 _this.joinStyle = null;
31639             }
31640             if (_this.joinStyleName === undefined) {
31641                 _this.joinStyleName = null;
31642             }
31643             if (_this.dashStyle === undefined) {
31644                 _this.dashStyle = null;
31645             }
31646             if (_this.dashStyleName === undefined) {
31647                 _this.dashStyleName = null;
31648             }
31649             if (_this.dashPattern === undefined) {
31650                 _this.dashPattern = null;
31651             }
31652             if (_this.dashOffset === undefined) {
31653                 _this.dashOffset = 0;
31654             }
31655             if (_this.startArrowStyle === undefined) {
31656                 _this.startArrowStyle = null;
31657             }
31658             if (_this.startArrowStyleName === undefined) {
31659                 _this.startArrowStyleName = null;
31660             }
31661             if (_this.endArrowStyle === undefined) {
31662                 _this.endArrowStyle = null;
31663             }
31664             if (_this.endArrowStyleName === undefined) {
31665                 _this.endArrowStyleName = null;
31666             }
31667             if (_this.closedPath === undefined) {
31668                 _this.closedPath = false;
31669             }
31670             if (_this.color === undefined) {
31671                 _this.color = 0;
31672             }
31673             if (_this.elevation === undefined) {
31674                 _this.elevation = null;
31675             }
31676             if (_this.level === undefined) {
31677                 _this.level = null;
31678             }
31679             if (_this.polylinePathCache === undefined) {
31680                 _this.polylinePathCache = null;
31681             }
31682             if (_this.shapeCache === undefined) {
31683                 _this.shapeCache = null;
31684             }
31685             _this.points = _this.deepCopy(points);
31686             _this.thickness = thickness;
31687             _this.capStyle = capStyle;
31688             _this.joinStyle = joinStyle;
31689             _this.dashStyle = dashStyle;
31690             _this.dashOffset = dashOffset;
31691             _this.startArrowStyle = startArrowStyle;
31692             _this.endArrowStyle = endArrowStyle;
31693             _this.closedPath = closedPath;
31694             _this.color = color;
31695         }
31696         else if (((id != null && id instanceof Array && (id.length == 0 || id[0] == null || id[0] instanceof Array)) || id === null) && ((typeof points === 'number') || points === null) && ((typeof thickness === 'number') || thickness === null) && ((typeof capStyle === 'number') || capStyle === null) && ((typeof joinStyle === 'number') || joinStyle === null) && ((typeof dashStyle === 'number') || dashStyle === null) && ((typeof dashOffset === 'number') || dashOffset === null) && ((typeof startArrowStyle === 'number') || startArrowStyle === null) && ((typeof endArrowStyle === 'boolean') || endArrowStyle === null) && ((typeof closedPath === 'number') || closedPath === null) && color === undefined) {
31697             var __args = arguments;
31698             var points_2 = __args[0];
31699             var thickness_5 = __args[1];
31700             var capStyle_1 = __args[2];
31701             var joinStyle_1 = __args[3];
31702             var dashStyle_1 = __args[4];
31703             var dashOffset_1 = __args[5];
31704             var startArrowStyle_1 = __args[6];
31705             var endArrowStyle_1 = __args[7];
31706             var closedPath_1 = __args[8];
31707             var color_9 = __args[9];
31708             {
31709                 var __args_96 = arguments;
31710                 var id_22 = HomeObject.createId("polyline");
31711                 _this = _super.call(this, id_22) || this;
31712                 if (_this.points === undefined) {
31713                     _this.points = null;
31714                 }
31715                 if (_this.thickness === undefined) {
31716                     _this.thickness = 0;
31717                 }
31718                 if (_this.capStyle === undefined) {
31719                     _this.capStyle = null;
31720                 }
31721                 if (_this.capStyleName === undefined) {
31722                     _this.capStyleName = null;
31723                 }
31724                 if (_this.joinStyle === undefined) {
31725                     _this.joinStyle = null;
31726                 }
31727                 if (_this.joinStyleName === undefined) {
31728                     _this.joinStyleName = null;
31729                 }
31730                 if (_this.dashStyle === undefined) {
31731                     _this.dashStyle = null;
31732                 }
31733                 if (_this.dashStyleName === undefined) {
31734                     _this.dashStyleName = null;
31735                 }
31736                 if (_this.dashPattern === undefined) {
31737                     _this.dashPattern = null;
31738                 }
31739                 if (_this.dashOffset === undefined) {
31740                     _this.dashOffset = 0;
31741                 }
31742                 if (_this.startArrowStyle === undefined) {
31743                     _this.startArrowStyle = null;
31744                 }
31745                 if (_this.startArrowStyleName === undefined) {
31746                     _this.startArrowStyleName = null;
31747                 }
31748                 if (_this.endArrowStyle === undefined) {
31749                     _this.endArrowStyle = null;
31750                 }
31751                 if (_this.endArrowStyleName === undefined) {
31752                     _this.endArrowStyleName = null;
31753                 }
31754                 if (_this.closedPath === undefined) {
31755                     _this.closedPath = false;
31756                 }
31757                 if (_this.color === undefined) {
31758                     _this.color = 0;
31759                 }
31760                 if (_this.elevation === undefined) {
31761                     _this.elevation = null;
31762                 }
31763                 if (_this.level === undefined) {
31764                     _this.level = null;
31765                 }
31766                 if (_this.polylinePathCache === undefined) {
31767                     _this.polylinePathCache = null;
31768                 }
31769                 if (_this.shapeCache === undefined) {
31770                     _this.shapeCache = null;
31771                 }
31772                 _this.points = _this.deepCopy(points_2);
31773                 _this.thickness = thickness_5;
31774                 _this.capStyle = capStyle_1;
31775                 _this.joinStyle = joinStyle_1;
31776                 _this.dashStyle = dashStyle_1;
31777                 _this.dashOffset = dashOffset_1;
31778                 _this.startArrowStyle = startArrowStyle_1;
31779                 _this.endArrowStyle = endArrowStyle_1;
31780                 _this.closedPath = closedPath_1;
31781                 _this.color = color_9;
31782             }
31783             if (_this.points === undefined) {
31784                 _this.points = null;
31785             }
31786             if (_this.thickness === undefined) {
31787                 _this.thickness = 0;
31788             }
31789             if (_this.capStyle === undefined) {
31790                 _this.capStyle = null;
31791             }
31792             if (_this.capStyleName === undefined) {
31793                 _this.capStyleName = null;
31794             }
31795             if (_this.joinStyle === undefined) {
31796                 _this.joinStyle = null;
31797             }
31798             if (_this.joinStyleName === undefined) {
31799                 _this.joinStyleName = null;
31800             }
31801             if (_this.dashStyle === undefined) {
31802                 _this.dashStyle = null;
31803             }
31804             if (_this.dashStyleName === undefined) {
31805                 _this.dashStyleName = null;
31806             }
31807             if (_this.dashPattern === undefined) {
31808                 _this.dashPattern = null;
31809             }
31810             if (_this.dashOffset === undefined) {
31811                 _this.dashOffset = 0;
31812             }
31813             if (_this.startArrowStyle === undefined) {
31814                 _this.startArrowStyle = null;
31815             }
31816             if (_this.startArrowStyleName === undefined) {
31817                 _this.startArrowStyleName = null;
31818             }
31819             if (_this.endArrowStyle === undefined) {
31820                 _this.endArrowStyle = null;
31821             }
31822             if (_this.endArrowStyleName === undefined) {
31823                 _this.endArrowStyleName = null;
31824             }
31825             if (_this.closedPath === undefined) {
31826                 _this.closedPath = false;
31827             }
31828             if (_this.color === undefined) {
31829                 _this.color = 0;
31830             }
31831             if (_this.elevation === undefined) {
31832                 _this.elevation = null;
31833             }
31834             if (_this.level === undefined) {
31835                 _this.level = null;
31836             }
31837             if (_this.polylinePathCache === undefined) {
31838                 _this.polylinePathCache = null;
31839             }
31840             if (_this.shapeCache === undefined) {
31841                 _this.shapeCache = null;
31842             }
31843         }
31844         else if (((id != null && id instanceof Array && (id.length == 0 || id[0] == null || id[0] instanceof Array)) || id === null) && ((typeof points === 'number') || points === null) && ((typeof thickness === 'number') || thickness === null) && ((typeof capStyle === 'number') || capStyle === null) && ((typeof joinStyle === 'number') || joinStyle === null) && ((typeof dashStyle === 'number') || dashStyle === null) && ((typeof dashOffset === 'number') || dashOffset === null) && ((typeof startArrowStyle === 'boolean') || startArrowStyle === null) && ((typeof endArrowStyle === 'number') || endArrowStyle === null) && closedPath === undefined && color === undefined) {
31845             var __args = arguments;
31846             var points_3 = __args[0];
31847             var thickness_6 = __args[1];
31848             var capStyle_2 = __args[2];
31849             var joinStyle_2 = __args[3];
31850             var dashStyle_2 = __args[4];
31851             var startArrowStyle_2 = __args[5];
31852             var endArrowStyle_2 = __args[6];
31853             var closedPath_2 = __args[7];
31854             var color_10 = __args[8];
31855             {
31856                 var __args_97 = arguments;
31857                 var dashOffset_2 = 0.0;
31858                 {
31859                     var __args_98 = arguments;
31860                     var id_23 = HomeObject.createId("polyline");
31861                     _this = _super.call(this, id_23) || this;
31862                     if (_this.points === undefined) {
31863                         _this.points = null;
31864                     }
31865                     if (_this.thickness === undefined) {
31866                         _this.thickness = 0;
31867                     }
31868                     if (_this.capStyle === undefined) {
31869                         _this.capStyle = null;
31870                     }
31871                     if (_this.capStyleName === undefined) {
31872                         _this.capStyleName = null;
31873                     }
31874                     if (_this.joinStyle === undefined) {
31875                         _this.joinStyle = null;
31876                     }
31877                     if (_this.joinStyleName === undefined) {
31878                         _this.joinStyleName = null;
31879                     }
31880                     if (_this.dashStyle === undefined) {
31881                         _this.dashStyle = null;
31882                     }
31883                     if (_this.dashStyleName === undefined) {
31884                         _this.dashStyleName = null;
31885                     }
31886                     if (_this.dashPattern === undefined) {
31887                         _this.dashPattern = null;
31888                     }
31889                     if (_this.dashOffset === undefined) {
31890                         _this.dashOffset = 0;
31891                     }
31892                     if (_this.startArrowStyle === undefined) {
31893                         _this.startArrowStyle = null;
31894                     }
31895                     if (_this.startArrowStyleName === undefined) {
31896                         _this.startArrowStyleName = null;
31897                     }
31898                     if (_this.endArrowStyle === undefined) {
31899                         _this.endArrowStyle = null;
31900                     }
31901                     if (_this.endArrowStyleName === undefined) {
31902                         _this.endArrowStyleName = null;
31903                     }
31904                     if (_this.closedPath === undefined) {
31905                         _this.closedPath = false;
31906                     }
31907                     if (_this.color === undefined) {
31908                         _this.color = 0;
31909                     }
31910                     if (_this.elevation === undefined) {
31911                         _this.elevation = null;
31912                     }
31913                     if (_this.level === undefined) {
31914                         _this.level = null;
31915                     }
31916                     if (_this.polylinePathCache === undefined) {
31917                         _this.polylinePathCache = null;
31918                     }
31919                     if (_this.shapeCache === undefined) {
31920                         _this.shapeCache = null;
31921                     }
31922                     _this.points = _this.deepCopy(points_3);
31923                     _this.thickness = thickness_6;
31924                     _this.capStyle = capStyle_2;
31925                     _this.joinStyle = joinStyle_2;
31926                     _this.dashStyle = dashStyle_2;
31927                     _this.dashOffset = dashOffset_2;
31928                     _this.startArrowStyle = startArrowStyle_2;
31929                     _this.endArrowStyle = endArrowStyle_2;
31930                     _this.closedPath = closedPath_2;
31931                     _this.color = color_10;
31932                 }
31933                 if (_this.points === undefined) {
31934                     _this.points = null;
31935                 }
31936                 if (_this.thickness === undefined) {
31937                     _this.thickness = 0;
31938                 }
31939                 if (_this.capStyle === undefined) {
31940                     _this.capStyle = null;
31941                 }
31942                 if (_this.capStyleName === undefined) {
31943                     _this.capStyleName = null;
31944                 }
31945                 if (_this.joinStyle === undefined) {
31946                     _this.joinStyle = null;
31947                 }
31948                 if (_this.joinStyleName === undefined) {
31949                     _this.joinStyleName = null;
31950                 }
31951                 if (_this.dashStyle === undefined) {
31952                     _this.dashStyle = null;
31953                 }
31954                 if (_this.dashStyleName === undefined) {
31955                     _this.dashStyleName = null;
31956                 }
31957                 if (_this.dashPattern === undefined) {
31958                     _this.dashPattern = null;
31959                 }
31960                 if (_this.dashOffset === undefined) {
31961                     _this.dashOffset = 0;
31962                 }
31963                 if (_this.startArrowStyle === undefined) {
31964                     _this.startArrowStyle = null;
31965                 }
31966                 if (_this.startArrowStyleName === undefined) {
31967                     _this.startArrowStyleName = null;
31968                 }
31969                 if (_this.endArrowStyle === undefined) {
31970                     _this.endArrowStyle = null;
31971                 }
31972                 if (_this.endArrowStyleName === undefined) {
31973                     _this.endArrowStyleName = null;
31974                 }
31975                 if (_this.closedPath === undefined) {
31976                     _this.closedPath = false;
31977                 }
31978                 if (_this.color === undefined) {
31979                     _this.color = 0;
31980                 }
31981                 if (_this.elevation === undefined) {
31982                     _this.elevation = null;
31983                 }
31984                 if (_this.level === undefined) {
31985                     _this.level = null;
31986                 }
31987                 if (_this.polylinePathCache === undefined) {
31988                     _this.polylinePathCache = null;
31989                 }
31990                 if (_this.shapeCache === undefined) {
31991                     _this.shapeCache = null;
31992                 }
31993             }
31994             if (_this.points === undefined) {
31995                 _this.points = null;
31996             }
31997             if (_this.thickness === undefined) {
31998                 _this.thickness = 0;
31999             }
32000             if (_this.capStyle === undefined) {
32001                 _this.capStyle = null;
32002             }
32003             if (_this.capStyleName === undefined) {
32004                 _this.capStyleName = null;
32005             }
32006             if (_this.joinStyle === undefined) {
32007                 _this.joinStyle = null;
32008             }
32009             if (_this.joinStyleName === undefined) {
32010                 _this.joinStyleName = null;
32011             }
32012             if (_this.dashStyle === undefined) {
32013                 _this.dashStyle = null;
32014             }
32015             if (_this.dashStyleName === undefined) {
32016                 _this.dashStyleName = null;
32017             }
32018             if (_this.dashPattern === undefined) {
32019                 _this.dashPattern = null;
32020             }
32021             if (_this.dashOffset === undefined) {
32022                 _this.dashOffset = 0;
32023             }
32024             if (_this.startArrowStyle === undefined) {
32025                 _this.startArrowStyle = null;
32026             }
32027             if (_this.startArrowStyleName === undefined) {
32028                 _this.startArrowStyleName = null;
32029             }
32030             if (_this.endArrowStyle === undefined) {
32031                 _this.endArrowStyle = null;
32032             }
32033             if (_this.endArrowStyleName === undefined) {
32034                 _this.endArrowStyleName = null;
32035             }
32036             if (_this.closedPath === undefined) {
32037                 _this.closedPath = false;
32038             }
32039             if (_this.color === undefined) {
32040                 _this.color = 0;
32041             }
32042             if (_this.elevation === undefined) {
32043                 _this.elevation = null;
32044             }
32045             if (_this.level === undefined) {
32046                 _this.level = null;
32047             }
32048             if (_this.polylinePathCache === undefined) {
32049                 _this.polylinePathCache = null;
32050             }
32051             if (_this.shapeCache === undefined) {
32052                 _this.shapeCache = null;
32053             }
32054         }
32055         else if (((typeof id === 'string') || id === null) && ((points != null && points instanceof Array && (points.length == 0 || points[0] == null || points[0] instanceof Array)) || points === null) && thickness === undefined && capStyle === undefined && joinStyle === undefined && dashStyle === undefined && dashOffset === undefined && startArrowStyle === undefined && endArrowStyle === undefined && closedPath === undefined && color === undefined) {
32056             var __args = arguments;
32057             {
32058                 var __args_99 = arguments;
32059                 var thickness_7 = 1;
32060                 var capStyle_3 = Polyline.CapStyle.BUTT;
32061                 var joinStyle_3 = Polyline.JoinStyle.MITER;
32062                 var dashStyle_3 = Polyline.DashStyle.SOLID;
32063                 var dashOffset_3 = 0.0;
32064                 var startArrowStyle_3 = Polyline.ArrowStyle.NONE;
32065                 var endArrowStyle_3 = Polyline.ArrowStyle.NONE;
32066                 var closedPath_3 = false;
32067                 var color_11 = -16777216;
32068                 _this = _super.call(this, id) || this;
32069                 if (_this.points === undefined) {
32070                     _this.points = null;
32071                 }
32072                 if (_this.thickness === undefined) {
32073                     _this.thickness = 0;
32074                 }
32075                 if (_this.capStyle === undefined) {
32076                     _this.capStyle = null;
32077                 }
32078                 if (_this.capStyleName === undefined) {
32079                     _this.capStyleName = null;
32080                 }
32081                 if (_this.joinStyle === undefined) {
32082                     _this.joinStyle = null;
32083                 }
32084                 if (_this.joinStyleName === undefined) {
32085                     _this.joinStyleName = null;
32086                 }
32087                 if (_this.dashStyle === undefined) {
32088                     _this.dashStyle = null;
32089                 }
32090                 if (_this.dashStyleName === undefined) {
32091                     _this.dashStyleName = null;
32092                 }
32093                 if (_this.dashPattern === undefined) {
32094                     _this.dashPattern = null;
32095                 }
32096                 if (_this.dashOffset === undefined) {
32097                     _this.dashOffset = 0;
32098                 }
32099                 if (_this.startArrowStyle === undefined) {
32100                     _this.startArrowStyle = null;
32101                 }
32102                 if (_this.startArrowStyleName === undefined) {
32103                     _this.startArrowStyleName = null;
32104                 }
32105                 if (_this.endArrowStyle === undefined) {
32106                     _this.endArrowStyle = null;
32107                 }
32108                 if (_this.endArrowStyleName === undefined) {
32109                     _this.endArrowStyleName = null;
32110                 }
32111                 if (_this.closedPath === undefined) {
32112                     _this.closedPath = false;
32113                 }
32114                 if (_this.color === undefined) {
32115                     _this.color = 0;
32116                 }
32117                 if (_this.elevation === undefined) {
32118                     _this.elevation = null;
32119                 }
32120                 if (_this.level === undefined) {
32121                     _this.level = null;
32122                 }
32123                 if (_this.polylinePathCache === undefined) {
32124                     _this.polylinePathCache = null;
32125                 }
32126                 if (_this.shapeCache === undefined) {
32127                     _this.shapeCache = null;
32128                 }
32129                 _this.points = _this.deepCopy(points);
32130                 _this.thickness = thickness_7;
32131                 _this.capStyle = capStyle_3;
32132                 _this.joinStyle = joinStyle_3;
32133                 _this.dashStyle = dashStyle_3;
32134                 _this.dashOffset = dashOffset_3;
32135                 _this.startArrowStyle = startArrowStyle_3;
32136                 _this.endArrowStyle = endArrowStyle_3;
32137                 _this.closedPath = closedPath_3;
32138                 _this.color = color_11;
32139             }
32140             if (_this.points === undefined) {
32141                 _this.points = null;
32142             }
32143             if (_this.thickness === undefined) {
32144                 _this.thickness = 0;
32145             }
32146             if (_this.capStyle === undefined) {
32147                 _this.capStyle = null;
32148             }
32149             if (_this.capStyleName === undefined) {
32150                 _this.capStyleName = null;
32151             }
32152             if (_this.joinStyle === undefined) {
32153                 _this.joinStyle = null;
32154             }
32155             if (_this.joinStyleName === undefined) {
32156                 _this.joinStyleName = null;
32157             }
32158             if (_this.dashStyle === undefined) {
32159                 _this.dashStyle = null;
32160             }
32161             if (_this.dashStyleName === undefined) {
32162                 _this.dashStyleName = null;
32163             }
32164             if (_this.dashPattern === undefined) {
32165                 _this.dashPattern = null;
32166             }
32167             if (_this.dashOffset === undefined) {
32168                 _this.dashOffset = 0;
32169             }
32170             if (_this.startArrowStyle === undefined) {
32171                 _this.startArrowStyle = null;
32172             }
32173             if (_this.startArrowStyleName === undefined) {
32174                 _this.startArrowStyleName = null;
32175             }
32176             if (_this.endArrowStyle === undefined) {
32177                 _this.endArrowStyle = null;
32178             }
32179             if (_this.endArrowStyleName === undefined) {
32180                 _this.endArrowStyleName = null;
32181             }
32182             if (_this.closedPath === undefined) {
32183                 _this.closedPath = false;
32184             }
32185             if (_this.color === undefined) {
32186                 _this.color = 0;
32187             }
32188             if (_this.elevation === undefined) {
32189                 _this.elevation = null;
32190             }
32191             if (_this.level === undefined) {
32192                 _this.level = null;
32193             }
32194             if (_this.polylinePathCache === undefined) {
32195                 _this.polylinePathCache = null;
32196             }
32197             if (_this.shapeCache === undefined) {
32198                 _this.shapeCache = null;
32199             }
32200         }
32201         else if (((id != null && id instanceof Array && (id.length == 0 || id[0] == null || id[0] instanceof Array)) || id === null) && points === undefined && thickness === undefined && capStyle === undefined && joinStyle === undefined && dashStyle === undefined && dashOffset === undefined && startArrowStyle === undefined && endArrowStyle === undefined && closedPath === undefined && color === undefined) {
32202             var __args = arguments;
32203             var points_4 = __args[0];
32204             {
32205                 var __args_100 = arguments;
32206                 var thickness_8 = 1;
32207                 var capStyle_4 = Polyline.CapStyle.BUTT;
32208                 var joinStyle_4 = Polyline.JoinStyle.MITER;
32209                 var dashStyle_4 = Polyline.DashStyle.SOLID;
32210                 var startArrowStyle_4 = Polyline.ArrowStyle.NONE;
32211                 var endArrowStyle_4 = Polyline.ArrowStyle.NONE;
32212                 var closedPath_4 = false;
32213                 var color_12 = -16777216;
32214                 {
32215                     var __args_101 = arguments;
32216                     var dashOffset_4 = 0.0;
32217                     {
32218                         var __args_102 = arguments;
32219                         var id_24 = HomeObject.createId("polyline");
32220                         _this = _super.call(this, id_24) || this;
32221                         if (_this.points === undefined) {
32222                             _this.points = null;
32223                         }
32224                         if (_this.thickness === undefined) {
32225                             _this.thickness = 0;
32226                         }
32227                         if (_this.capStyle === undefined) {
32228                             _this.capStyle = null;
32229                         }
32230                         if (_this.capStyleName === undefined) {
32231                             _this.capStyleName = null;
32232                         }
32233                         if (_this.joinStyle === undefined) {
32234                             _this.joinStyle = null;
32235                         }
32236                         if (_this.joinStyleName === undefined) {
32237                             _this.joinStyleName = null;
32238                         }
32239                         if (_this.dashStyle === undefined) {
32240                             _this.dashStyle = null;
32241                         }
32242                         if (_this.dashStyleName === undefined) {
32243                             _this.dashStyleName = null;
32244                         }
32245                         if (_this.dashPattern === undefined) {
32246                             _this.dashPattern = null;
32247                         }
32248                         if (_this.dashOffset === undefined) {
32249                             _this.dashOffset = 0;
32250                         }
32251                         if (_this.startArrowStyle === undefined) {
32252                             _this.startArrowStyle = null;
32253                         }
32254                         if (_this.startArrowStyleName === undefined) {
32255                             _this.startArrowStyleName = null;
32256                         }
32257                         if (_this.endArrowStyle === undefined) {
32258                             _this.endArrowStyle = null;
32259                         }
32260                         if (_this.endArrowStyleName === undefined) {
32261                             _this.endArrowStyleName = null;
32262                         }
32263                         if (_this.closedPath === undefined) {
32264                             _this.closedPath = false;
32265                         }
32266                         if (_this.color === undefined) {
32267                             _this.color = 0;
32268                         }
32269                         if (_this.elevation === undefined) {
32270                             _this.elevation = null;
32271                         }
32272                         if (_this.level === undefined) {
32273                             _this.level = null;
32274                         }
32275                         if (_this.polylinePathCache === undefined) {
32276                             _this.polylinePathCache = null;
32277                         }
32278                         if (_this.shapeCache === undefined) {
32279                             _this.shapeCache = null;
32280                         }
32281                         _this.points = _this.deepCopy(points_4);
32282                         _this.thickness = thickness_8;
32283                         _this.capStyle = capStyle_4;
32284                         _this.joinStyle = joinStyle_4;
32285                         _this.dashStyle = dashStyle_4;
32286                         _this.dashOffset = dashOffset_4;
32287                         _this.startArrowStyle = startArrowStyle_4;
32288                         _this.endArrowStyle = endArrowStyle_4;
32289                         _this.closedPath = closedPath_4;
32290                         _this.color = color_12;
32291                     }
32292                     if (_this.points === undefined) {
32293                         _this.points = null;
32294                     }
32295                     if (_this.thickness === undefined) {
32296                         _this.thickness = 0;
32297                     }
32298                     if (_this.capStyle === undefined) {
32299                         _this.capStyle = null;
32300                     }
32301                     if (_this.capStyleName === undefined) {
32302                         _this.capStyleName = null;
32303                     }
32304                     if (_this.joinStyle === undefined) {
32305                         _this.joinStyle = null;
32306                     }
32307                     if (_this.joinStyleName === undefined) {
32308                         _this.joinStyleName = null;
32309                     }
32310                     if (_this.dashStyle === undefined) {
32311                         _this.dashStyle = null;
32312                     }
32313                     if (_this.dashStyleName === undefined) {
32314                         _this.dashStyleName = null;
32315                     }
32316                     if (_this.dashPattern === undefined) {
32317                         _this.dashPattern = null;
32318                     }
32319                     if (_this.dashOffset === undefined) {
32320                         _this.dashOffset = 0;
32321                     }
32322                     if (_this.startArrowStyle === undefined) {
32323                         _this.startArrowStyle = null;
32324                     }
32325                     if (_this.startArrowStyleName === undefined) {
32326                         _this.startArrowStyleName = null;
32327                     }
32328                     if (_this.endArrowStyle === undefined) {
32329                         _this.endArrowStyle = null;
32330                     }
32331                     if (_this.endArrowStyleName === undefined) {
32332                         _this.endArrowStyleName = null;
32333                     }
32334                     if (_this.closedPath === undefined) {
32335                         _this.closedPath = false;
32336                     }
32337                     if (_this.color === undefined) {
32338                         _this.color = 0;
32339                     }
32340                     if (_this.elevation === undefined) {
32341                         _this.elevation = null;
32342                     }
32343                     if (_this.level === undefined) {
32344                         _this.level = null;
32345                     }
32346                     if (_this.polylinePathCache === undefined) {
32347                         _this.polylinePathCache = null;
32348                     }
32349                     if (_this.shapeCache === undefined) {
32350                         _this.shapeCache = null;
32351                     }
32352                 }
32353                 if (_this.points === undefined) {
32354                     _this.points = null;
32355                 }
32356                 if (_this.thickness === undefined) {
32357                     _this.thickness = 0;
32358                 }
32359                 if (_this.capStyle === undefined) {
32360                     _this.capStyle = null;
32361                 }
32362                 if (_this.capStyleName === undefined) {
32363                     _this.capStyleName = null;
32364                 }
32365                 if (_this.joinStyle === undefined) {
32366                     _this.joinStyle = null;
32367                 }
32368                 if (_this.joinStyleName === undefined) {
32369                     _this.joinStyleName = null;
32370                 }
32371                 if (_this.dashStyle === undefined) {
32372                     _this.dashStyle = null;
32373                 }
32374                 if (_this.dashStyleName === undefined) {
32375                     _this.dashStyleName = null;
32376                 }
32377                 if (_this.dashPattern === undefined) {
32378                     _this.dashPattern = null;
32379                 }
32380                 if (_this.dashOffset === undefined) {
32381                     _this.dashOffset = 0;
32382                 }
32383                 if (_this.startArrowStyle === undefined) {
32384                     _this.startArrowStyle = null;
32385                 }
32386                 if (_this.startArrowStyleName === undefined) {
32387                     _this.startArrowStyleName = null;
32388                 }
32389                 if (_this.endArrowStyle === undefined) {
32390                     _this.endArrowStyle = null;
32391                 }
32392                 if (_this.endArrowStyleName === undefined) {
32393                     _this.endArrowStyleName = null;
32394                 }
32395                 if (_this.closedPath === undefined) {
32396                     _this.closedPath = false;
32397                 }
32398                 if (_this.color === undefined) {
32399                     _this.color = 0;
32400                 }
32401                 if (_this.elevation === undefined) {
32402                     _this.elevation = null;
32403                 }
32404                 if (_this.level === undefined) {
32405                     _this.level = null;
32406                 }
32407                 if (_this.polylinePathCache === undefined) {
32408                     _this.polylinePathCache = null;
32409                 }
32410                 if (_this.shapeCache === undefined) {
32411                     _this.shapeCache = null;
32412                 }
32413             }
32414             if (_this.points === undefined) {
32415                 _this.points = null;
32416             }
32417             if (_this.thickness === undefined) {
32418                 _this.thickness = 0;
32419             }
32420             if (_this.capStyle === undefined) {
32421                 _this.capStyle = null;
32422             }
32423             if (_this.capStyleName === undefined) {
32424                 _this.capStyleName = null;
32425             }
32426             if (_this.joinStyle === undefined) {
32427                 _this.joinStyle = null;
32428             }
32429             if (_this.joinStyleName === undefined) {
32430                 _this.joinStyleName = null;
32431             }
32432             if (_this.dashStyle === undefined) {
32433                 _this.dashStyle = null;
32434             }
32435             if (_this.dashStyleName === undefined) {
32436                 _this.dashStyleName = null;
32437             }
32438             if (_this.dashPattern === undefined) {
32439                 _this.dashPattern = null;
32440             }
32441             if (_this.dashOffset === undefined) {
32442                 _this.dashOffset = 0;
32443             }
32444             if (_this.startArrowStyle === undefined) {
32445                 _this.startArrowStyle = null;
32446             }
32447             if (_this.startArrowStyleName === undefined) {
32448                 _this.startArrowStyleName = null;
32449             }
32450             if (_this.endArrowStyle === undefined) {
32451                 _this.endArrowStyle = null;
32452             }
32453             if (_this.endArrowStyleName === undefined) {
32454                 _this.endArrowStyleName = null;
32455             }
32456             if (_this.closedPath === undefined) {
32457                 _this.closedPath = false;
32458             }
32459             if (_this.color === undefined) {
32460                 _this.color = 0;
32461             }
32462             if (_this.elevation === undefined) {
32463                 _this.elevation = null;
32464             }
32465             if (_this.level === undefined) {
32466                 _this.level = null;
32467             }
32468             if (_this.polylinePathCache === undefined) {
32469                 _this.polylinePathCache = null;
32470             }
32471             if (_this.shapeCache === undefined) {
32472                 _this.shapeCache = null;
32473             }
32474         }
32475         else
32476             throw new Error('invalid overload');
32477         return _this;
32478     }
32479     /**
32480      * Returns the points of the polygon matching this polyline.
32481      * @return {float[][]} an array of the (x,y) coordinates of the polyline points.
32482      */
32483     Polyline.prototype.getPoints = function () {
32484         return this.deepCopy(this.points);
32485     };
32486     /**
32487      * Returns the number of points of the polygon matching this polyline.
32488      * @return {number}
32489      */
32490     Polyline.prototype.getPointCount = function () {
32491         return this.points.length;
32492     };
32493     Polyline.prototype.deepCopy = function (points) {
32494         var pointsCopy = (function (s) { var a = []; while (s-- > 0)
32495             a.push(null); return a; })(points.length);
32496         for (var i = 0; i < points.length; i++) {
32497             {
32498                 pointsCopy[i] = /* clone */ points[i].slice(0);
32499             }
32500             ;
32501         }
32502         return pointsCopy;
32503     };
32504     /**
32505      * Sets the points of the polygon matching this polyline. Once this polyline
32506      * is updated, listeners added to this polyline will receive a change notification.
32507      * @param {float[][]} points
32508      */
32509     Polyline.prototype.setPoints = function (points) {
32510         if (!(JSON.stringify(this.points) === JSON.stringify(points))) {
32511             this.updatePoints(points);
32512         }
32513     };
32514     /**
32515      * Update the points of the polygon matching this polyline.
32516      * @param {float[][]} points
32517      * @private
32518      */
32519     Polyline.prototype.updatePoints = function (points) {
32520         var oldPoints = this.points;
32521         this.points = this.deepCopy(points);
32522         this.polylinePathCache = null;
32523         this.shapeCache = null;
32524         this.firePropertyChange(/* name */ "POINTS", oldPoints, points);
32525     };
32526     Polyline.prototype.addPoint$float$float = function (x, y) {
32527         this.addPoint$float$float$int(x, y, this.points.length);
32528     };
32529     Polyline.prototype.addPoint$float$float$int = function (x, y, index) {
32530         if (index < 0 || index > this.points.length) {
32531             throw Object.defineProperty(new Error("Invalid index " + index), '__classes', { configurable: true, value: ['java.lang.Throwable', 'java.lang.IndexOutOfBoundsException', 'java.lang.Object', 'java.lang.RuntimeException', 'java.lang.Exception'] });
32532         }
32533         var newPoints = (function (s) { var a = []; while (s-- > 0)
32534             a.push(null); return a; })(this.points.length + 1);
32535         /* arraycopy */ (function (srcPts, srcOff, dstPts, dstOff, size) { if (srcPts !== dstPts || dstOff >= srcOff + size) {
32536             while (--size >= 0)
32537                 dstPts[dstOff++] = srcPts[srcOff++];
32538         }
32539         else {
32540             var tmp = srcPts.slice(srcOff, srcOff + size);
32541             for (var i = 0; i < size; i++)
32542                 dstPts[dstOff++] = tmp[i];
32543         } })(this.points, 0, newPoints, 0, index);
32544         newPoints[index] = [x, y];
32545         /* arraycopy */ (function (srcPts, srcOff, dstPts, dstOff, size) { if (srcPts !== dstPts || dstOff >= srcOff + size) {
32546             while (--size >= 0)
32547                 dstPts[dstOff++] = srcPts[srcOff++];
32548         }
32549         else {
32550             var tmp = srcPts.slice(srcOff, srcOff + size);
32551             for (var i = 0; i < size; i++)
32552                 dstPts[dstOff++] = tmp[i];
32553         } })(this.points, index, newPoints, index + 1, this.points.length - index);
32554         var oldPoints = this.points;
32555         this.points = newPoints;
32556         this.polylinePathCache = null;
32557         this.shapeCache = null;
32558         this.firePropertyChange(/* name */ "POINTS", oldPoints, this.deepCopy(this.points));
32559     };
32560     /**
32561      * Adds a point at the given <code>index</code>.
32562      * @throws IndexOutOfBoundsException if <code>index</code> is negative or > <code>getPointCount()</code>
32563      * @param {number} x
32564      * @param {number} y
32565      * @param {number} index
32566      */
32567     Polyline.prototype.addPoint = function (x, y, index) {
32568         if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof index === 'number') || index === null)) {
32569             return this.addPoint$float$float$int(x, y, index);
32570         }
32571         else if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && index === undefined) {
32572             return this.addPoint$float$float(x, y);
32573         }
32574         else
32575             throw new Error('invalid overload');
32576     };
32577     /**
32578      * Sets the point at the given <code>index</code>.
32579      * @throws IndexOutOfBoundsException if <code>index</code> is negative or >= <code>getPointCount()</code>
32580      * @param {number} x
32581      * @param {number} y
32582      * @param {number} index
32583      */
32584     Polyline.prototype.setPoint = function (x, y, index) {
32585         if (index < 0 || index >= this.points.length) {
32586             throw Object.defineProperty(new Error("Invalid index " + index), '__classes', { configurable: true, value: ['java.lang.Throwable', 'java.lang.IndexOutOfBoundsException', 'java.lang.Object', 'java.lang.RuntimeException', 'java.lang.Exception'] });
32587         }
32588         if (this.points[index][0] !== x || this.points[index][1] !== y) {
32589             var oldPoints = this.points;
32590             this.points = this.deepCopy(this.points);
32591             this.points[index][0] = x;
32592             this.points[index][1] = y;
32593             this.polylinePathCache = null;
32594             this.shapeCache = null;
32595             this.firePropertyChange(/* name */ "POINTS", oldPoints, this.deepCopy(this.points));
32596         }
32597     };
32598     /**
32599      * Removes the point at the given <code>index</code>.
32600      * @throws IndexOutOfBoundsException if <code>index</code> is negative or >= <code>getPointCount()</code>
32601      * @param {number} index
32602      */
32603     Polyline.prototype.removePoint = function (index) {
32604         if (index < 0 || index >= this.points.length) {
32605             throw Object.defineProperty(new Error("Invalid index " + index), '__classes', { configurable: true, value: ['java.lang.Throwable', 'java.lang.IndexOutOfBoundsException', 'java.lang.Object', 'java.lang.RuntimeException', 'java.lang.Exception'] });
32606         }
32607         var newPoints = (function (s) { var a = []; while (s-- > 0)
32608             a.push(null); return a; })(this.points.length - 1);
32609         /* arraycopy */ (function (srcPts, srcOff, dstPts, dstOff, size) { if (srcPts !== dstPts || dstOff >= srcOff + size) {
32610             while (--size >= 0)
32611                 dstPts[dstOff++] = srcPts[srcOff++];
32612         }
32613         else {
32614             var tmp = srcPts.slice(srcOff, srcOff + size);
32615             for (var i = 0; i < size; i++)
32616                 dstPts[dstOff++] = tmp[i];
32617         } })(this.points, 0, newPoints, 0, index);
32618         /* arraycopy */ (function (srcPts, srcOff, dstPts, dstOff, size) { if (srcPts !== dstPts || dstOff >= srcOff + size) {
32619             while (--size >= 0)
32620                 dstPts[dstOff++] = srcPts[srcOff++];
32621         }
32622         else {
32623             var tmp = srcPts.slice(srcOff, srcOff + size);
32624             for (var i = 0; i < size; i++)
32625                 dstPts[dstOff++] = tmp[i];
32626         } })(this.points, index + 1, newPoints, index, this.points.length - index - 1);
32627         var oldPoints = this.points;
32628         this.points = newPoints;
32629         this.polylinePathCache = null;
32630         this.shapeCache = null;
32631         this.firePropertyChange(/* name */ "POINTS", oldPoints, this.deepCopy(this.points));
32632     };
32633     /**
32634      * Returns the thickness of this polyline.
32635      * @return {number}
32636      */
32637     Polyline.prototype.getThickness = function () {
32638         return this.thickness;
32639     };
32640     /**
32641      * Sets the thickness of this polyline.
32642      * Once this polyline is updated, listeners added to this polyline will receive a change notification.
32643      * @param {number} thickness
32644      */
32645     Polyline.prototype.setThickness = function (thickness) {
32646         if (thickness !== this.thickness) {
32647             var oldThickness = this.thickness;
32648             this.thickness = thickness;
32649             this.firePropertyChange(/* name */ "THICKNESS", oldThickness, thickness);
32650         }
32651     };
32652     /**
32653      * Returns the cap style of this polyline.
32654      * @return {Polyline.CapStyle}
32655      */
32656     Polyline.prototype.getCapStyle = function () {
32657         return this.capStyle;
32658     };
32659     /**
32660      * Sets the cap style of this polyline.
32661      * Once this polyline is updated, listeners added to this polyline will receive a change notification.
32662      * @param {Polyline.CapStyle} capStyle
32663      */
32664     Polyline.prototype.setCapStyle = function (capStyle) {
32665         if (capStyle !== this.capStyle) {
32666             var oldStyle = this.capStyle;
32667             this.capStyle = capStyle;
32668             this.capStyleName = /* Enum.name */ Polyline.CapStyle[this.capStyle];
32669             this.firePropertyChange(/* name */ "CAP_STYLE", oldStyle, capStyle);
32670         }
32671     };
32672     /**
32673      * Returns the join style of this polyline.
32674      * @return {Polyline.JoinStyle}
32675      */
32676     Polyline.prototype.getJoinStyle = function () {
32677         return this.joinStyle;
32678     };
32679     /**
32680      * Sets the join style of this polyline.
32681      * Once this polyline is updated, listeners added to this polyline will receive a change notification.
32682      * @param {Polyline.JoinStyle} joinStyle
32683      */
32684     Polyline.prototype.setJoinStyle = function (joinStyle) {
32685         if (joinStyle !== this.joinStyle) {
32686             var oldJoinStyle = this.joinStyle;
32687             this.joinStyle = joinStyle;
32688             this.joinStyleName = /* Enum.name */ Polyline.JoinStyle[this.joinStyle];
32689             this.polylinePathCache = null;
32690             this.shapeCache = null;
32691             this.firePropertyChange(/* name */ "JOIN_STYLE", oldJoinStyle, joinStyle);
32692         }
32693     };
32694     /**
32695      * Returns the dash style of this polyline. If <code>DashStyle.CUSTOMIZED</code> is returned,
32696      * the actual dash pattern will be returned by {@link #getDashPattern()}.
32697      * @return {Polyline.DashStyle}
32698      */
32699     Polyline.prototype.getDashStyle = function () {
32700         return this.dashStyle;
32701     };
32702     /**
32703      * Sets the dash style of this polyline.
32704      * Once this polyline is updated, listeners added to this polyline will receive a change notification.
32705      * @param {Polyline.DashStyle} dashStyle
32706      */
32707     Polyline.prototype.setDashStyle = function (dashStyle) {
32708         if (dashStyle !== this.dashStyle) {
32709             var oldDashPattern = this.getDashPattern();
32710             var oldDashStyle = this.dashStyle;
32711             this.dashStyle = dashStyle;
32712             this.dashStyleName = /* Enum.name */ Polyline.DashStyle[this.dashStyle];
32713             if (dashStyle !== Polyline.DashStyle.CUSTOMIZED) {
32714                 this.dashPattern = null;
32715             }
32716             this.firePropertyChange(/* name */ "DASH_PATTERN", oldDashPattern, this.getDashPattern());
32717             this.firePropertyChange(/* name */ "DASH_STYLE", oldDashStyle, dashStyle);
32718         }
32719     };
32720     /**
32721      * Returns the dash pattern of this polyline in percentage of its thickness.
32722      * @return {float[]}
32723      */
32724     Polyline.prototype.getDashPattern = function () {
32725         var dashPattern = null;
32726         if (this.dashStyle !== Polyline.DashStyle.CUSTOMIZED) {
32727             return Polyline.DashStyle["_$wrappers"][this.dashStyle].getDashPattern();
32728         }
32729         else if (this.dashPattern != null) {
32730             dashPattern = /* clone */ this.dashPattern.slice(0);
32731         }
32732         return dashPattern;
32733     };
32734     /**
32735      * Sets the dash pattern of this polyline in percentage of its thickness.
32736      * Once this polyline is updated, listeners added to this polyline will receive a change notification.
32737      * @param {float[]} dashPattern
32738      */
32739     Polyline.prototype.setDashPattern = function (dashPattern) {
32740         {
32741             var array = /* Enum.values */ function () { var result = []; for (var val in Polyline.DashStyle) {
32742                 if (!isNaN(val)) {
32743                     result.push(parseInt(val, 10));
32744                 }
32745             } return result; }();
32746             for (var index = 0; index < array.length; index++) {
32747                 var dashStyle = array[index];
32748                 {
32749                     if (this.dashStyle !== Polyline.DashStyle.CUSTOMIZED) {
32750                         if ( /* equals */(function (a1, a2) { if (a1 == null && a2 == null)
32751                             return true; if (a1 == null || a2 == null)
32752                             return false; if (a1.length != a2.length)
32753                             return false; for (var i = 0; i < a1.length; i++) {
32754                             if (a1[i] != a2[i])
32755                                 return false;
32756                         } return true; })(dashPattern, Polyline.DashStyle["_$wrappers"][dashStyle].getDashPattern())) {
32757                             this.setDashStyle(dashStyle);
32758                             return;
32759                         }
32760                     }
32761                 }
32762             }
32763         }
32764         if (!(function (a1, a2) { if (a1 == null && a2 == null)
32765             return true; if (a1 == null || a2 == null)
32766             return false; if (a1.length != a2.length)
32767             return false; for (var i = 0; i < a1.length; i++) {
32768             if (a1[i] != a2[i])
32769                 return false;
32770         } return true; })(dashPattern, this.dashPattern)) {
32771             var oldDashPattern = this.getDashPattern();
32772             this.dashPattern = /* clone */ dashPattern.slice(0);
32773             this.firePropertyChange(/* name */ "DASH_PATTERN", oldDashPattern, dashPattern);
32774             var oldDashStyle = this.dashStyle;
32775             this.dashStyle = Polyline.DashStyle.CUSTOMIZED;
32776             this.dashStyleName = /* Enum.name */ Polyline.DashStyle[this.dashStyle];
32777             this.firePropertyChange(/* name */ "DASH_STYLE", oldDashStyle, Polyline.DashStyle.CUSTOMIZED);
32778         }
32779     };
32780     /**
32781      * Returns the offset from which the dash of this polyline should start.
32782      * @return {number} the offset in percentage of the dash pattern
32783      */
32784     Polyline.prototype.getDashOffset = function () {
32785         return this.dashOffset;
32786     };
32787     /**
32788      * Sets the offset from which the dash of this polyline should start.
32789      * Once this polyline is updated, listeners added to this polyline will receive a change notification.
32790      * @param {number} dashOffset the offset in percentage of the dash pattern
32791      */
32792     Polyline.prototype.setDashOffset = function (dashOffset) {
32793         if (dashOffset !== this.dashOffset) {
32794             var oldDashOffset = this.dashOffset;
32795             this.dashOffset = dashOffset;
32796             this.firePropertyChange(/* name */ "DASH_OFFSET", oldDashOffset, dashOffset);
32797         }
32798     };
32799     /**
32800      * Returns the arrow style at the start of this polyline.
32801      * @return {Polyline.ArrowStyle}
32802      */
32803     Polyline.prototype.getStartArrowStyle = function () {
32804         return this.startArrowStyle;
32805     };
32806     /**
32807      * Sets the arrow style at the start of this polyline.
32808      * Once this polyline is updated, listeners added to this polyline will receive a change notification.
32809      * @param {Polyline.ArrowStyle} startArrowStyle
32810      */
32811     Polyline.prototype.setStartArrowStyle = function (startArrowStyle) {
32812         if (startArrowStyle !== this.startArrowStyle) {
32813             var oldStartArrowStyle = this.startArrowStyle;
32814             this.startArrowStyle = startArrowStyle;
32815             this.startArrowStyleName = /* Enum.name */ Polyline.ArrowStyle[this.startArrowStyle];
32816             this.firePropertyChange(/* name */ "START_ARROW_STYLE", oldStartArrowStyle, startArrowStyle);
32817         }
32818     };
32819     /**
32820      * Returns the arrow style at the end of this polyline.
32821      * @return {Polyline.ArrowStyle}
32822      */
32823     Polyline.prototype.getEndArrowStyle = function () {
32824         return this.endArrowStyle;
32825     };
32826     /**
32827      * Sets the arrow style at the end of this polyline.
32828      * Once this polyline is updated, listeners added to this polyline will receive a change notification.
32829      * @param {Polyline.ArrowStyle} endArrowStyle
32830      */
32831     Polyline.prototype.setEndArrowStyle = function (endArrowStyle) {
32832         if (endArrowStyle !== this.endArrowStyle) {
32833             var oldEndArrowStyle = this.endArrowStyle;
32834             this.endArrowStyle = endArrowStyle;
32835             this.endArrowStyleName = /* Enum.name */ Polyline.ArrowStyle[this.endArrowStyle];
32836             this.firePropertyChange(/* name */ "END_ARROW_STYLE", oldEndArrowStyle, endArrowStyle);
32837         }
32838     };
32839     /**
32840      * Returns <code>true</code> if the first and last points of this polyline should be joined to form a polygon.
32841      * @return {boolean}
32842      */
32843     Polyline.prototype.isClosedPath = function () {
32844         return this.closedPath;
32845     };
32846     /**
32847      * Sets whether the first and last points of this polyline should be joined.
32848      * Once this polyline is updated, listeners added to this polyline will receive a change notification.
32849      * @param {boolean} closedPath
32850      */
32851     Polyline.prototype.setClosedPath = function (closedPath) {
32852         if (closedPath !== this.closedPath) {
32853             this.closedPath = closedPath;
32854             this.firePropertyChange(/* name */ "CLOSED_PATH", !closedPath, closedPath);
32855         }
32856     };
32857     /**
32858      * Returns the color of this polyline.
32859      * @return {number}
32860      */
32861     Polyline.prototype.getColor = function () {
32862         return this.color;
32863     };
32864     /**
32865      * Sets the color of this polyline. Once this polyline is updated,
32866      * listeners added to this polyline will receive a change notification.
32867      * @param {number} color
32868      */
32869     Polyline.prototype.setColor = function (color) {
32870         if (color !== this.color) {
32871             var oldColor = this.color;
32872             this.color = color;
32873             this.firePropertyChange(/* name */ "COLOR", oldColor, color);
32874         }
32875     };
32876     /**
32877      * Returns the elevation of this polyline
32878      * from the ground according to the elevation of its level.
32879      * @return {number}
32880      */
32881     Polyline.prototype.getGroundElevation = function () {
32882         var elevation = this.getElevation();
32883         if (this.level != null) {
32884             return elevation + this.level.getElevation();
32885         }
32886         else {
32887             return elevation;
32888         }
32889     };
32890     /**
32891      * Returns the elevation of this polyline in 3D.
32892      * @return {number}
32893      */
32894     Polyline.prototype.getElevation = function () {
32895         return this.elevation != null ? this.elevation : 0;
32896     };
32897     /**
32898      * Sets the elevation of this polyline in 3D. Once this polyline is updated,
32899      * listeners added to this polyline will receive a change notification.
32900      * @param {number} elevation
32901      */
32902     Polyline.prototype.setElevation = function (elevation) {
32903         if (this.elevation != null && elevation !== this.elevation) {
32904             var oldElevation = this.elevation;
32905             this.elevation = elevation;
32906             this.firePropertyChange(/* name */ "ELEVATION", oldElevation, elevation);
32907         }
32908     };
32909     /**
32910      * Returns <code>true</code> if this polyline should be displayed in 3D.
32911      * @return {boolean}
32912      */
32913     Polyline.prototype.isVisibleIn3D = function () {
32914         return this.elevation != null;
32915     };
32916     /**
32917      * Sets whether this polyline should be displayed in 3D and fires a <code>PropertyChangeEvent</code>.
32918      * @param {boolean} visibleIn3D
32919      */
32920     Polyline.prototype.setVisibleIn3D = function (visibleIn3D) {
32921         if ((visibleIn3D) !== ((this.elevation != null))) {
32922             this.elevation = visibleIn3D ? 0 : null;
32923             this.firePropertyChange(/* name */ "VISIBLE_IN_3D", !visibleIn3D, visibleIn3D);
32924         }
32925     };
32926     /**
32927      * Returns the level which this polyline belongs to.
32928      * @return {Level}
32929      */
32930     Polyline.prototype.getLevel = function () {
32931         return this.level;
32932     };
32933     /**
32934      * Sets the level of this polyline. Once this polyline is updated,
32935      * listeners added to this polyline will receive a change notification.
32936      * @param {Level} level
32937      */
32938     Polyline.prototype.setLevel = function (level) {
32939         if (level !== this.level) {
32940             var oldLevel = this.level;
32941             this.level = level;
32942             this.firePropertyChange(/* name */ "LEVEL", oldLevel, level);
32943         }
32944     };
32945     /**
32946      * Returns <code>true</code> if this polyline is at the given <code>level</code>
32947      * or at a level with the same elevation and a smaller elevation index.
32948      * @param {Level} level
32949      * @return {boolean}
32950      */
32951     Polyline.prototype.isAtLevel = function (level) {
32952         return this.level === level || this.level != null && level != null && this.level.getElevation() === level.getElevation() && this.level.getElevationIndex() < level.getElevationIndex();
32953     };
32954     /**
32955      * Returns an approximate length of this polyline.
32956      * @return {number}
32957      */
32958     Polyline.prototype.getLength = function () {
32959         var firstPoint = [0, 0];
32960         var previousPoint = [0, 0];
32961         var point = [0, 0];
32962         var length = 0;
32963         for (var it = this.getPolylinePath().getPathIterator(null, 0.1); !it.isDone(); it.next()) {
32964             {
32965                 switch ((it.currentSegment(point))) {
32966                     case java.awt.geom.PathIterator.SEG_CLOSE:
32967                         length += java.awt.geom.Point2D.distance(firstPoint[0], firstPoint[1], previousPoint[0], previousPoint[1]);
32968                         break;
32969                     case java.awt.geom.PathIterator.SEG_MOVETO:
32970                         /* arraycopy */ (function (srcPts, srcOff, dstPts, dstOff, size) { if (srcPts !== dstPts || dstOff >= srcOff + size) {
32971                             while (--size >= 0)
32972                                 dstPts[dstOff++] = srcPts[srcOff++];
32973                         }
32974                         else {
32975                             var tmp = srcPts.slice(srcOff, srcOff + size);
32976                             for (var i = 0; i < size; i++)
32977                                 dstPts[dstOff++] = tmp[i];
32978                         } })(point, 0, firstPoint, 0, 2);
32979                         /* arraycopy */ (function (srcPts, srcOff, dstPts, dstOff, size) { if (srcPts !== dstPts || dstOff >= srcOff + size) {
32980                             while (--size >= 0)
32981                                 dstPts[dstOff++] = srcPts[srcOff++];
32982                         }
32983                         else {
32984                             var tmp = srcPts.slice(srcOff, srcOff + size);
32985                             for (var i = 0; i < size; i++)
32986                                 dstPts[dstOff++] = tmp[i];
32987                         } })(point, 0, previousPoint, 0, 2);
32988                         break;
32989                     case java.awt.geom.PathIterator.SEG_LINETO:
32990                         length += java.awt.geom.Point2D.distance(previousPoint[0], previousPoint[1], point[0], point[1]);
32991                         /* arraycopy */ (function (srcPts, srcOff, dstPts, dstOff, size) { if (srcPts !== dstPts || dstOff >= srcOff + size) {
32992                             while (--size >= 0)
32993                                 dstPts[dstOff++] = srcPts[srcOff++];
32994                         }
32995                         else {
32996                             var tmp = srcPts.slice(srcOff, srcOff + size);
32997                             for (var i = 0; i < size; i++)
32998                                 dstPts[dstOff++] = tmp[i];
32999                         } })(point, 0, previousPoint, 0, 2);
33000                         break;
33001                 }
33002             }
33003             ;
33004         }
33005         return length;
33006     };
33007     /**
33008      * Returns <code>true</code> if this polyline intersects
33009      * with the horizontal rectangle which opposite corners are at points
33010      * (<code>x0</code>, <code>y0</code>) and (<code>x1</code>, <code>y1</code>).
33011      * @param {number} x0
33012      * @param {number} y0
33013      * @param {number} x1
33014      * @param {number} y1
33015      * @return {boolean}
33016      */
33017     Polyline.prototype.intersectsRectangle = function (x0, y0, x1, y1) {
33018         var rectangle = new java.awt.geom.Rectangle2D.Float(x0, y0, 0, 0);
33019         rectangle.add(x1, y1);
33020         return this.getShape().intersects(rectangle);
33021     };
33022     /**
33023      * Returns <code>true</code> if this polyline contains
33024      * the point at (<code>x</code>, <code>y</code>) with a given <code>margin</code>.
33025      * @param {number} x
33026      * @param {number} y
33027      * @param {number} margin
33028      * @return {boolean}
33029      */
33030     Polyline.prototype.containsPoint = function (x, y, margin) {
33031         return this.containsShapeAtWithMargin(this.getShape(), x, y, margin);
33032     };
33033     /**
33034      * Returns the index of the point of this polyline equal to
33035      * the point at (<code>x</code>, <code>y</code>) with a given <code>margin</code>.
33036      * @return {number} the index of the first found point or -1.
33037      * @param {number} x
33038      * @param {number} y
33039      * @param {number} margin
33040      */
33041     Polyline.prototype.getPointIndexAt = function (x, y, margin) {
33042         for (var i = 0; i < this.points.length; i++) {
33043             {
33044                 if (Math.abs(x - this.points[i][0]) <= margin && Math.abs(y - this.points[i][1]) <= margin) {
33045                     return i;
33046                 }
33047             }
33048             ;
33049         }
33050         return -1;
33051     };
33052     /**
33053      * Returns <code>true</code> if <code>shape</code> contains
33054      * the point at (<code>x</code>, <code>y</code>)
33055      * with a given <code>margin</code>.
33056      * @param {Object} shape
33057      * @param {number} x
33058      * @param {number} y
33059      * @param {number} margin
33060      * @return {boolean}
33061      * @private
33062      */
33063     Polyline.prototype.containsShapeAtWithMargin = function (shape, x, y, margin) {
33064         if (margin === 0) {
33065             return shape.contains(x, y);
33066         }
33067         else {
33068             return shape.intersects(x - margin, y - margin, 2 * margin, 2 * margin);
33069         }
33070     };
33071     /**
33072      * Returns the path matching this polyline.
33073      * @return {Object}
33074      * @private
33075      */
33076     Polyline.prototype.getPolylinePath = function () {
33077         if (this.polylinePathCache == null) {
33078             var polylinePath = new java.awt.geom.GeneralPath();
33079             if (this.joinStyle === Polyline.JoinStyle.CURVED) {
33080                 for (var i = 0, n = this.closedPath ? this.points.length : this.points.length - 1; i < n; i++) {
33081                     {
33082                         var curve2D = new java.awt.geom.CubicCurve2D.Float();
33083                         var previousPoint = this.points[i === 0 ? this.points.length - 1 : i - 1];
33084                         var point = this.points[i];
33085                         var nextPoint = this.points[i === this.points.length - 1 ? 0 : i + 1];
33086                         var vectorToBisectorPoint = [nextPoint[0] - previousPoint[0], nextPoint[1] - previousPoint[1]];
33087                         var nextNextPoint = this.points[(i + 2) % this.points.length];
33088                         var vectorToBisectorNextPoint = [point[0] - nextNextPoint[0], point[1] - nextNextPoint[1]];
33089                         curve2D.setCurve(point[0], point[1], point[0] + (i !== 0 || this.closedPath ? vectorToBisectorPoint[0] / 3.625 : 0), point[1] + (i !== 0 || this.closedPath ? vectorToBisectorPoint[1] / 3.625 : 0), nextPoint[0] + (i !== this.points.length - 2 || this.closedPath ? vectorToBisectorNextPoint[0] / 3.625 : 0), nextPoint[1] + (i !== this.points.length - 2 || this.closedPath ? vectorToBisectorNextPoint[1] / 3.625 : 0), nextPoint[0], nextPoint[1]);
33090                         polylinePath.append(curve2D, true);
33091                     }
33092                     ;
33093                 }
33094             }
33095             else {
33096                 polylinePath.moveTo(this.points[0][0], this.points[0][1]);
33097                 for (var i = 1; i < this.points.length; i++) {
33098                     {
33099                         polylinePath.lineTo(this.points[i][0], this.points[i][1]);
33100                     }
33101                     ;
33102                 }
33103                 if (this.closedPath) {
33104                     polylinePath.closePath();
33105                 }
33106             }
33107             this.polylinePathCache = polylinePath;
33108         }
33109         return this.polylinePathCache;
33110     };
33111     /**
33112      * Returns the shape matching this polyline.
33113      * @return {Object}
33114      * @private
33115      */
33116     Polyline.prototype.getShape = function () {
33117         if (this.shapeCache == null) {
33118             this.shapeCache = new java['awt']['BasicStroke'](this.thickness).createStrokedShape(this.getPolylinePath());
33119         }
33120         return this.shapeCache;
33121     };
33122     /**
33123      * Moves this polyline of (<code>dx</code>, <code>dy</code>) units.
33124      * @param {number} dx
33125      * @param {number} dy
33126      */
33127     Polyline.prototype.move = function (dx, dy) {
33128         if (dx !== 0 || dy !== 0) {
33129             var points = this.getPoints();
33130             for (var i = 0; i < points.length; i++) {
33131                 {
33132                     points[i][0] += dx;
33133                     points[i][1] += dy;
33134                 }
33135                 ;
33136             }
33137             this.updatePoints(points);
33138         }
33139     };
33140     /**
33141      * Returns a clone of this polyline.
33142      * @return {Polyline}
33143      */
33144     Polyline.prototype.clone = function () {
33145         var _this = this;
33146         var clone = (function (o) { if (_super.prototype.clone != undefined) {
33147             return _super.prototype.clone.call(_this);
33148         }
33149         else {
33150             var clone_8 = Object.create(o);
33151             for (var p in o) {
33152                 if (o.hasOwnProperty(p))
33153                     clone_8[p] = o[p];
33154             }
33155             return clone_8;
33156         } })(this);
33157         clone.level = null;
33158         return clone;
33159     };
33160     return Polyline;
33161 }(HomeObject));
33162 Polyline["__class"] = "com.eteks.sweethome3d.model.Polyline";
33163 Polyline["__interfaces"] = ["com.eteks.sweethome3d.model.Selectable", "com.eteks.sweethome3d.model.Elevatable"];
33164 (function (Polyline) {
33165     var CapStyle;
33166     (function (CapStyle) {
33167         CapStyle[CapStyle["BUTT"] = 0] = "BUTT";
33168         CapStyle[CapStyle["SQUARE"] = 1] = "SQUARE";
33169         CapStyle[CapStyle["ROUND"] = 2] = "ROUND";
33170     })(CapStyle = Polyline.CapStyle || (Polyline.CapStyle = {}));
33171     var JoinStyle;
33172     (function (JoinStyle) {
33173         JoinStyle[JoinStyle["BEVEL"] = 0] = "BEVEL";
33174         JoinStyle[JoinStyle["MITER"] = 1] = "MITER";
33175         JoinStyle[JoinStyle["ROUND"] = 2] = "ROUND";
33176         JoinStyle[JoinStyle["CURVED"] = 3] = "CURVED";
33177     })(JoinStyle = Polyline.JoinStyle || (Polyline.JoinStyle = {}));
33178     var ArrowStyle;
33179     (function (ArrowStyle) {
33180         ArrowStyle[ArrowStyle["NONE"] = 0] = "NONE";
33181         ArrowStyle[ArrowStyle["DELTA"] = 1] = "DELTA";
33182         ArrowStyle[ArrowStyle["OPEN"] = 2] = "OPEN";
33183         ArrowStyle[ArrowStyle["DISC"] = 3] = "DISC";
33184     })(ArrowStyle = Polyline.ArrowStyle || (Polyline.ArrowStyle = {}));
33185     var DashStyle;
33186     (function (DashStyle) {
33187         DashStyle[DashStyle["SOLID"] = 0] = "SOLID";
33188         DashStyle[DashStyle["DOT"] = 1] = "DOT";
33189         DashStyle[DashStyle["DASH"] = 2] = "DASH";
33190         DashStyle[DashStyle["DASH_DOT"] = 3] = "DASH_DOT";
33191         DashStyle[DashStyle["DASH_DOT_DOT"] = 4] = "DASH_DOT_DOT";
33192         DashStyle[DashStyle["CUSTOMIZED"] = 5] = "CUSTOMIZED";
33193     })(DashStyle = Polyline.DashStyle || (Polyline.DashStyle = {}));
33194     /** @ignore */
33195     var DashStyle_$WRAPPER = /** @class */ (function () {
33196         function DashStyle_$WRAPPER(_$ordinal, _$name) {
33197             this._$ordinal = _$ordinal;
33198             this._$name = _$name;
33199         }
33200         /**
33201          * Returns an array describing the length of dashes and spaces between them
33202          * for a 1 cm thick polyline.
33203          * @return {float[]}
33204          */
33205         DashStyle_$WRAPPER.prototype.getDashPattern = function () {
33206             switch ((this._$ordinal)) {
33207                 case Polyline.DashStyle.SOLID:
33208                     return [1.0, 0.0];
33209                 case Polyline.DashStyle.DOT:
33210                     return [1.0, 1.0];
33211                 case Polyline.DashStyle.DASH:
33212                     return [4.0, 2.0];
33213                 case Polyline.DashStyle.DASH_DOT:
33214                     return [8.0, 2.0, 2.0, 2.0];
33215                 case Polyline.DashStyle.DASH_DOT_DOT:
33216                     return [8.0, 2.0, 2.0, 2.0, 2.0, 2.0];
33217                 default:
33218                     return null;
33219             }
33220         };
33221         DashStyle_$WRAPPER.prototype.name = function () { return this._$name; };
33222         DashStyle_$WRAPPER.prototype.ordinal = function () { return this._$ordinal; };
33223         DashStyle_$WRAPPER.prototype.compareTo = function (other) { return this._$ordinal - (isNaN(other) ? other._$ordinal : other); };
33224         return DashStyle_$WRAPPER;
33225     }());
33226     Polyline.DashStyle_$WRAPPER = DashStyle_$WRAPPER;
33227     DashStyle["__class"] = "com.eteks.sweethome3d.model.Polyline.DashStyle";
33228     DashStyle["_$wrappers"] = { 0: new DashStyle_$WRAPPER(0, "SOLID"), 1: new DashStyle_$WRAPPER(1, "DOT"), 2: new DashStyle_$WRAPPER(2, "DASH"), 3: new DashStyle_$WRAPPER(3, "DASH_DOT"), 4: new DashStyle_$WRAPPER(4, "DASH_DOT_DOT"), 5: new DashStyle_$WRAPPER(5, "CUSTOMIZED") };
33229 })(Polyline || (Polyline = {}));
33230 Polyline['__transients'] = ['capStyle', 'joinStyle', 'dashStyle', 'startArrowStyle', 'endArrowStyle', 'polylinePathCache', 'shapeCache', 'propertyChangeSupport'];
33231 /**
33232  * Creates a catalog door or window of the default catalog.
33233  * @param {string} id    the id of the new door or window, or <code>null</code>
33234  * @param {string} name  the name of the new door or window
33235  * @param {string} description the description of the new door or window
33236  * @param {string} information additional information associated to the new door or window
33237  * @param {string} license license of the new door or window
33238  * @param {java.lang.String[]} tags tags associated to the new door or window
33239  * @param {number} creationDate creation date of the new door or window in milliseconds since the epoch
33240  * @param {number} grade grade of the new door or window or <code>null</code>
33241  * @param {Object} icon content of the icon of the new door or window
33242  * @param {Object} planIcon content of the icon of the new piece displayed in plan
33243  * @param {Object} model content of the 3D model of the new door or window
33244  * @param {number} width  the width in centimeters of the new door or window
33245  * @param {number} depth  the depth in centimeters of the new door or window
33246  * @param {number} height  the height in centimeters of the new door or window
33247  * @param {number} elevation  the elevation in centimeters of the new door or window
33248  * @param {number} dropOnTopElevation a percentage of the height at which should be placed
33249  * an object dropped on the new piece
33250  * @param {boolean} movable if <code>true</code>, the new door or window is movable
33251  * @param {string} cutOutShape the shape used to cut out walls that intersect the new door or window
33252  * @param {number} wallThickness a value in percentage of the depth of the new door or window
33253  * @param {number} wallDistance a distance in percentage of the depth of the new door or window
33254  * @param {boolean} wallCutOutOnBothSides  if <code>true</code> the new door or window should cut out
33255  * the both sides of the walls it intersects
33256  * @param {boolean} widthDepthDeformable if <code>false</code>, the width and depth of the new door or window may
33257  * not be changed independently from each other
33258  * @param {com.eteks.sweethome3d.model.Sash[]} sashes the sashes attached to the new door or window
33259  * @param {float[][]} modelRotation the rotation 3 by 3 matrix applied to the door or window model
33260  * @param {number} modelFlags flags which should be applied to piece model
33261  * @param {number} modelSize size of the 3D model of the new light
33262  * @param {string} creator the creator of the model
33263  * @param {boolean} resizable if <code>true</code>, the size of the new door or window may be edited
33264  * @param {boolean} deformable if <code>true</code>, the width, depth and height of the new piece may
33265  * change independently from each other
33266  * @param {boolean} texturable if <code>false</code> this piece should always keep the same color or texture.
33267  * @param {Big} price the price of the new door or window, or <code>null</code>
33268  * @param {Big} valueAddedTaxPercentage the Value Added Tax percentage applied to the
33269  * price of the new door or window or <code>null</code>
33270  * @param {string} currency the price currency, noted with ISO 4217 code, or <code>null</code>
33271  * @param {Object} properties additional properties associating a key to a value or <code>null</code>
33272  * @param {Object} contents   additional contents associating a key to a value or <code>null</code>
33273  * @class
33274  * @extends CatalogPieceOfFurniture
33275  * @author Emmanuel Puybaret
33276  */
33277 var CatalogDoorOrWindow = /** @class */ (function (_super) {
33278     __extends(CatalogDoorOrWindow, _super);
33279     function CatalogDoorOrWindow(id, name, description, information, license, tags, creationDate, grade, icon, planIcon, model, width, depth, height, elevation, dropOnTopElevation, movable, cutOutShape, wallThickness, wallDistance, wallCutOutOnBothSides, widthDepthDeformable, sashes, modelRotation, modelFlags, modelSize, creator, resizable, deformable, texturable, price, valueAddedTaxPercentage, currency, properties, contents) {
33280         var _this = this;
33281         if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((typeof information === 'string') || information === null) && ((typeof license === 'string') || license === null) && ((tags != null && tags instanceof Array && (tags.length == 0 || tags[0] == null || (typeof tags[0] === 'string'))) || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((typeof grade === 'number') || grade === null) && ((icon != null && (icon.constructor != null && icon.constructor["__interfaces"] != null && icon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || icon === null) && ((planIcon != null && (planIcon.constructor != null && planIcon.constructor["__interfaces"] != null && planIcon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || planIcon === null) && ((model != null && (model.constructor != null && model.constructor["__interfaces"] != null && model.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || model === null) && ((typeof width === 'number') || width === null) && ((typeof depth === 'number') || depth === null) && ((typeof height === 'number') || height === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof dropOnTopElevation === 'number') || dropOnTopElevation === null) && ((typeof movable === 'boolean') || movable === null) && ((typeof cutOutShape === 'string') || cutOutShape === null) && ((typeof wallThickness === 'number') || wallThickness === null) && ((typeof wallDistance === 'number') || wallDistance === null) && ((typeof wallCutOutOnBothSides === 'boolean') || wallCutOutOnBothSides === null) && ((typeof widthDepthDeformable === 'boolean') || widthDepthDeformable === null) && ((sashes != null && sashes instanceof Array && (sashes.length == 0 || sashes[0] == null || (sashes[0] != null && sashes[0] instanceof Sash))) || sashes === null) && ((modelRotation != null && modelRotation instanceof Array && (modelRotation.length == 0 || modelRotation[0] == null || modelRotation[0] instanceof Array)) || modelRotation === null) && ((typeof modelFlags === 'number') || modelFlags === null) && ((typeof modelSize === 'number') || modelSize === null) && ((typeof creator === 'string') || creator === null) && ((typeof resizable === 'boolean') || resizable === null) && ((typeof deformable === 'boolean') || deformable === null) && ((typeof texturable === 'boolean') || texturable === null) && ((price != null && price instanceof Big) || price === null) && ((valueAddedTaxPercentage != null && valueAddedTaxPercentage instanceof Big) || valueAddedTaxPercentage === null) && ((typeof currency === 'string') || currency === null) && ((properties != null && (properties instanceof Object)) || properties === null) && ((contents != null && (contents instanceof Object)) || contents === null)) {
33282             var __args = arguments;
33283             _this = _super.call(this, id, name, description, information, license, tags, creationDate, grade, icon, planIcon, model, width, depth, height, elevation, dropOnTopElevation, movable, null, modelRotation, modelFlags, modelSize, creator, resizable, deformable, texturable, false, price, valueAddedTaxPercentage, currency, properties, contents) || this;
33284             if (_this.wallThickness === undefined) {
33285                 _this.wallThickness = 0;
33286             }
33287             if (_this.wallDistance === undefined) {
33288                 _this.wallDistance = 0;
33289             }
33290             if (_this.wallCutOutOnBothSides === undefined) {
33291                 _this.wallCutOutOnBothSides = false;
33292             }
33293             if (_this.widthDepthDeformable === undefined) {
33294                 _this.widthDepthDeformable = false;
33295             }
33296             if (_this.sashes === undefined) {
33297                 _this.sashes = null;
33298             }
33299             if (_this.cutOutShape === undefined) {
33300                 _this.cutOutShape = null;
33301             }
33302             _this.cutOutShape = cutOutShape;
33303             _this.wallThickness = wallThickness;
33304             _this.wallDistance = wallDistance;
33305             _this.wallCutOutOnBothSides = wallCutOutOnBothSides;
33306             _this.widthDepthDeformable = widthDepthDeformable;
33307             _this.sashes = sashes;
33308         }
33309         else if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((typeof information === 'string') || information === null) && ((license != null && license instanceof Array && (license.length == 0 || license[0] == null || (typeof license[0] === 'string'))) || license === null) && ((typeof tags === 'number') || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((grade != null && (grade.constructor != null && grade.constructor["__interfaces"] != null && grade.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || grade === null) && ((icon != null && (icon.constructor != null && icon.constructor["__interfaces"] != null && icon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || icon === null) && ((planIcon != null && (planIcon.constructor != null && planIcon.constructor["__interfaces"] != null && planIcon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || planIcon === null) && ((typeof model === 'number') || model === null) && ((typeof width === 'number') || width === null) && ((typeof depth === 'number') || depth === null) && ((typeof height === 'number') || height === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof dropOnTopElevation === 'boolean') || dropOnTopElevation === null) && ((typeof movable === 'string') || movable === null) && ((typeof cutOutShape === 'number') || cutOutShape === null) && ((typeof wallThickness === 'number') || wallThickness === null) && ((typeof wallDistance === 'boolean') || wallDistance === null) && ((typeof wallCutOutOnBothSides === 'boolean') || wallCutOutOnBothSides === null) && ((widthDepthDeformable != null && widthDepthDeformable instanceof Array && (widthDepthDeformable.length == 0 || widthDepthDeformable[0] == null || (widthDepthDeformable[0] != null && widthDepthDeformable[0] instanceof Sash))) || widthDepthDeformable === null) && ((sashes != null && sashes instanceof Array && (sashes.length == 0 || sashes[0] == null || sashes[0] instanceof Array)) || sashes === null) && ((typeof modelRotation === 'boolean') || modelRotation === null) && ((typeof modelFlags === 'number') || modelFlags === null) && ((typeof modelSize === 'string') || modelSize === null) && ((typeof creator === 'boolean') || creator === null) && ((typeof resizable === 'boolean') || resizable === null) && ((typeof deformable === 'boolean') || deformable === null) && ((texturable != null && texturable instanceof Big) || texturable === null) && ((price != null && price instanceof Big) || price === null) && ((typeof valueAddedTaxPercentage === 'string') || valueAddedTaxPercentage === null) && ((currency != null && (currency instanceof Object)) || currency === null) && properties === undefined && contents === undefined) {
33310             var __args = arguments;
33311             var tags_7 = __args[4];
33312             var creationDate_7 = __args[5];
33313             var grade_7 = __args[6];
33314             var icon_10 = __args[7];
33315             var planIcon_9 = __args[8];
33316             var model_10 = __args[9];
33317             var width_12 = __args[10];
33318             var depth_10 = __args[11];
33319             var height_17 = __args[12];
33320             var elevation_11 = __args[13];
33321             var dropOnTopElevation_7 = __args[14];
33322             var movable_10 = __args[15];
33323             var cutOutShape_1 = __args[16];
33324             var wallThickness_1 = __args[17];
33325             var wallDistance_1 = __args[18];
33326             var wallCutOutOnBothSides_1 = __args[19];
33327             var widthDepthDeformable_1 = __args[20];
33328             var sashes_1 = __args[21];
33329             var modelRotation_11 = __args[22];
33330             var backFaceShown = __args[23];
33331             var modelSize_8 = __args[24];
33332             var creator_13 = __args[25];
33333             var resizable_11 = __args[26];
33334             var deformable_10 = __args[27];
33335             var texturable_10 = __args[28];
33336             var price_11 = __args[29];
33337             var valueAddedTaxPercentage_11 = __args[30];
33338             var currency_8 = __args[31];
33339             var properties_8 = __args[32];
33340             {
33341                 var __args_103 = arguments;
33342                 var modelFlags_8 = backFaceShown ? PieceOfFurniture.SHOW_BACK_FACE : 0;
33343                 {
33344                     var __args_104 = arguments;
33345                     var license_7 = null;
33346                     var contents_8 = null;
33347                     _this = _super.call(this, id, name, description, information, license_7, tags_7, creationDate_7, grade_7, icon_10, planIcon_9, model_10, width_12, depth_10, height_17, elevation_11, dropOnTopElevation_7, movable_10, null, modelRotation_11, modelFlags_8, modelSize_8, creator_13, resizable_11, deformable_10, texturable_10, false, price_11, valueAddedTaxPercentage_11, currency_8, properties_8, contents_8) || this;
33348                     if (_this.wallThickness === undefined) {
33349                         _this.wallThickness = 0;
33350                     }
33351                     if (_this.wallDistance === undefined) {
33352                         _this.wallDistance = 0;
33353                     }
33354                     if (_this.wallCutOutOnBothSides === undefined) {
33355                         _this.wallCutOutOnBothSides = false;
33356                     }
33357                     if (_this.widthDepthDeformable === undefined) {
33358                         _this.widthDepthDeformable = false;
33359                     }
33360                     if (_this.sashes === undefined) {
33361                         _this.sashes = null;
33362                     }
33363                     if (_this.cutOutShape === undefined) {
33364                         _this.cutOutShape = null;
33365                     }
33366                     _this.cutOutShape = cutOutShape_1;
33367                     _this.wallThickness = wallThickness_1;
33368                     _this.wallDistance = wallDistance_1;
33369                     _this.wallCutOutOnBothSides = wallCutOutOnBothSides_1;
33370                     _this.widthDepthDeformable = widthDepthDeformable_1;
33371                     _this.sashes = sashes_1;
33372                 }
33373                 if (_this.wallThickness === undefined) {
33374                     _this.wallThickness = 0;
33375                 }
33376                 if (_this.wallDistance === undefined) {
33377                     _this.wallDistance = 0;
33378                 }
33379                 if (_this.wallCutOutOnBothSides === undefined) {
33380                     _this.wallCutOutOnBothSides = false;
33381                 }
33382                 if (_this.widthDepthDeformable === undefined) {
33383                     _this.widthDepthDeformable = false;
33384                 }
33385                 if (_this.sashes === undefined) {
33386                     _this.sashes = null;
33387                 }
33388                 if (_this.cutOutShape === undefined) {
33389                     _this.cutOutShape = null;
33390                 }
33391             }
33392             if (_this.wallThickness === undefined) {
33393                 _this.wallThickness = 0;
33394             }
33395             if (_this.wallDistance === undefined) {
33396                 _this.wallDistance = 0;
33397             }
33398             if (_this.wallCutOutOnBothSides === undefined) {
33399                 _this.wallCutOutOnBothSides = false;
33400             }
33401             if (_this.widthDepthDeformable === undefined) {
33402                 _this.widthDepthDeformable = false;
33403             }
33404             if (_this.sashes === undefined) {
33405                 _this.sashes = null;
33406             }
33407             if (_this.cutOutShape === undefined) {
33408                 _this.cutOutShape = null;
33409             }
33410         }
33411         else if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((typeof information === 'string') || information === null) && ((license != null && license instanceof Array && (license.length == 0 || license[0] == null || (typeof license[0] === 'string'))) || license === null) && ((typeof tags === 'number') || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((grade != null && (grade.constructor != null && grade.constructor["__interfaces"] != null && grade.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || grade === null) && ((icon != null && (icon.constructor != null && icon.constructor["__interfaces"] != null && icon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || icon === null) && ((planIcon != null && (planIcon.constructor != null && planIcon.constructor["__interfaces"] != null && planIcon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || planIcon === null) && ((typeof model === 'number') || model === null) && ((typeof width === 'number') || width === null) && ((typeof depth === 'number') || depth === null) && ((typeof height === 'number') || height === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof dropOnTopElevation === 'boolean') || dropOnTopElevation === null) && ((typeof movable === 'string') || movable === null) && ((typeof cutOutShape === 'number') || cutOutShape === null) && ((typeof wallThickness === 'number') || wallThickness === null) && ((typeof wallDistance === 'boolean') || wallDistance === null) && ((typeof wallCutOutOnBothSides === 'boolean') || wallCutOutOnBothSides === null) && ((widthDepthDeformable != null && widthDepthDeformable instanceof Array && (widthDepthDeformable.length == 0 || widthDepthDeformable[0] == null || (widthDepthDeformable[0] != null && widthDepthDeformable[0] instanceof Sash))) || widthDepthDeformable === null) && ((sashes != null && sashes instanceof Array && (sashes.length == 0 || sashes[0] == null || sashes[0] instanceof Array)) || sashes === null) && ((typeof modelRotation === 'number') || modelRotation === null) && ((typeof modelFlags === 'number') || modelFlags === null) && ((typeof modelSize === 'string') || modelSize === null) && ((typeof creator === 'boolean') || creator === null) && ((typeof resizable === 'boolean') || resizable === null) && ((typeof deformable === 'boolean') || deformable === null) && ((texturable != null && texturable instanceof Big) || texturable === null) && ((price != null && price instanceof Big) || price === null) && ((typeof valueAddedTaxPercentage === 'string') || valueAddedTaxPercentage === null) && ((currency != null && (currency instanceof Object)) || currency === null) && properties === undefined && contents === undefined) {
33412             var __args = arguments;
33413             var tags_8 = __args[4];
33414             var creationDate_8 = __args[5];
33415             var grade_8 = __args[6];
33416             var icon_11 = __args[7];
33417             var planIcon_10 = __args[8];
33418             var model_11 = __args[9];
33419             var width_13 = __args[10];
33420             var depth_11 = __args[11];
33421             var height_18 = __args[12];
33422             var elevation_12 = __args[13];
33423             var dropOnTopElevation_8 = __args[14];
33424             var movable_11 = __args[15];
33425             var cutOutShape_2 = __args[16];
33426             var wallThickness_2 = __args[17];
33427             var wallDistance_2 = __args[18];
33428             var wallCutOutOnBothSides_2 = __args[19];
33429             var widthDepthDeformable_2 = __args[20];
33430             var sashes_2 = __args[21];
33431             var modelRotation_12 = __args[22];
33432             var modelFlags_9 = __args[23];
33433             var modelSize_9 = __args[24];
33434             var creator_14 = __args[25];
33435             var resizable_12 = __args[26];
33436             var deformable_11 = __args[27];
33437             var texturable_11 = __args[28];
33438             var price_12 = __args[29];
33439             var valueAddedTaxPercentage_12 = __args[30];
33440             var currency_9 = __args[31];
33441             var properties_9 = __args[32];
33442             {
33443                 var __args_105 = arguments;
33444                 var license_8 = null;
33445                 var contents_9 = null;
33446                 _this = _super.call(this, id, name, description, information, license_8, tags_8, creationDate_8, grade_8, icon_11, planIcon_10, model_11, width_13, depth_11, height_18, elevation_12, dropOnTopElevation_8, movable_11, null, modelRotation_12, modelFlags_9, modelSize_9, creator_14, resizable_12, deformable_11, texturable_11, false, price_12, valueAddedTaxPercentage_12, currency_9, properties_9, contents_9) || this;
33447                 if (_this.wallThickness === undefined) {
33448                     _this.wallThickness = 0;
33449                 }
33450                 if (_this.wallDistance === undefined) {
33451                     _this.wallDistance = 0;
33452                 }
33453                 if (_this.wallCutOutOnBothSides === undefined) {
33454                     _this.wallCutOutOnBothSides = false;
33455                 }
33456                 if (_this.widthDepthDeformable === undefined) {
33457                     _this.widthDepthDeformable = false;
33458                 }
33459                 if (_this.sashes === undefined) {
33460                     _this.sashes = null;
33461                 }
33462                 if (_this.cutOutShape === undefined) {
33463                     _this.cutOutShape = null;
33464                 }
33465                 _this.cutOutShape = cutOutShape_2;
33466                 _this.wallThickness = wallThickness_2;
33467                 _this.wallDistance = wallDistance_2;
33468                 _this.wallCutOutOnBothSides = wallCutOutOnBothSides_2;
33469                 _this.widthDepthDeformable = widthDepthDeformable_2;
33470                 _this.sashes = sashes_2;
33471             }
33472             if (_this.wallThickness === undefined) {
33473                 _this.wallThickness = 0;
33474             }
33475             if (_this.wallDistance === undefined) {
33476                 _this.wallDistance = 0;
33477             }
33478             if (_this.wallCutOutOnBothSides === undefined) {
33479                 _this.wallCutOutOnBothSides = false;
33480             }
33481             if (_this.widthDepthDeformable === undefined) {
33482                 _this.widthDepthDeformable = false;
33483             }
33484             if (_this.sashes === undefined) {
33485                 _this.sashes = null;
33486             }
33487             if (_this.cutOutShape === undefined) {
33488                 _this.cutOutShape = null;
33489             }
33490         }
33491         else if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((typeof information === 'string') || information === null) && ((license != null && license instanceof Array && (license.length == 0 || license[0] == null || (typeof license[0] === 'string'))) || license === null) && ((typeof tags === 'number') || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((grade != null && (grade.constructor != null && grade.constructor["__interfaces"] != null && grade.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || grade === null) && ((icon != null && (icon.constructor != null && icon.constructor["__interfaces"] != null && icon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || icon === null) && ((planIcon != null && (planIcon.constructor != null && planIcon.constructor["__interfaces"] != null && planIcon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || planIcon === null) && ((typeof model === 'number') || model === null) && ((typeof width === 'number') || width === null) && ((typeof depth === 'number') || depth === null) && ((typeof height === 'number') || height === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof dropOnTopElevation === 'boolean') || dropOnTopElevation === null) && ((typeof movable === 'string') || movable === null) && ((typeof cutOutShape === 'number') || cutOutShape === null) && ((typeof wallThickness === 'number') || wallThickness === null) && ((typeof wallDistance === 'boolean') || wallDistance === null) && ((typeof wallCutOutOnBothSides === 'boolean') || wallCutOutOnBothSides === null) && ((widthDepthDeformable != null && widthDepthDeformable instanceof Array && (widthDepthDeformable.length == 0 || widthDepthDeformable[0] == null || (widthDepthDeformable[0] != null && widthDepthDeformable[0] instanceof Sash))) || widthDepthDeformable === null) && ((sashes != null && sashes instanceof Array && (sashes.length == 0 || sashes[0] == null || sashes[0] instanceof Array)) || sashes === null) && ((typeof modelRotation === 'boolean') || modelRotation === null) && ((typeof modelFlags === 'number') || modelFlags === null) && ((typeof modelSize === 'string') || modelSize === null) && ((typeof creator === 'boolean') || creator === null) && ((typeof resizable === 'boolean') || resizable === null) && ((typeof deformable === 'boolean') || deformable === null) && ((texturable != null && texturable instanceof Big) || texturable === null) && ((price != null && price instanceof Big) || price === null) && ((typeof valueAddedTaxPercentage === 'string') || valueAddedTaxPercentage === null) && currency === undefined && properties === undefined && contents === undefined) {
33492             var __args = arguments;
33493             var tags_9 = __args[4];
33494             var creationDate_9 = __args[5];
33495             var grade_9 = __args[6];
33496             var icon_12 = __args[7];
33497             var planIcon_11 = __args[8];
33498             var model_12 = __args[9];
33499             var width_14 = __args[10];
33500             var depth_12 = __args[11];
33501             var height_19 = __args[12];
33502             var elevation_13 = __args[13];
33503             var dropOnTopElevation_9 = __args[14];
33504             var movable_12 = __args[15];
33505             var cutOutShape_3 = __args[16];
33506             var wallThickness_3 = __args[17];
33507             var wallDistance_3 = __args[18];
33508             var wallCutOutOnBothSides_3 = __args[19];
33509             var widthDepthDeformable_3 = __args[20];
33510             var sashes_3 = __args[21];
33511             var modelRotation_13 = __args[22];
33512             var backFaceShown = __args[23];
33513             var modelSize_10 = __args[24];
33514             var creator_15 = __args[25];
33515             var resizable_13 = __args[26];
33516             var deformable_12 = __args[27];
33517             var texturable_12 = __args[28];
33518             var price_13 = __args[29];
33519             var valueAddedTaxPercentage_13 = __args[30];
33520             var currency_10 = __args[31];
33521             {
33522                 var __args_106 = arguments;
33523                 var properties_10 = null;
33524                 {
33525                     var __args_107 = arguments;
33526                     var modelFlags_10 = backFaceShown ? PieceOfFurniture.SHOW_BACK_FACE : 0;
33527                     {
33528                         var __args_108 = arguments;
33529                         var license_9 = null;
33530                         var contents_10 = null;
33531                         _this = _super.call(this, id, name, description, information, license_9, tags_9, creationDate_9, grade_9, icon_12, planIcon_11, model_12, width_14, depth_12, height_19, elevation_13, dropOnTopElevation_9, movable_12, null, modelRotation_13, modelFlags_10, modelSize_10, creator_15, resizable_13, deformable_12, texturable_12, false, price_13, valueAddedTaxPercentage_13, currency_10, properties_10, contents_10) || this;
33532                         if (_this.wallThickness === undefined) {
33533                             _this.wallThickness = 0;
33534                         }
33535                         if (_this.wallDistance === undefined) {
33536                             _this.wallDistance = 0;
33537                         }
33538                         if (_this.wallCutOutOnBothSides === undefined) {
33539                             _this.wallCutOutOnBothSides = false;
33540                         }
33541                         if (_this.widthDepthDeformable === undefined) {
33542                             _this.widthDepthDeformable = false;
33543                         }
33544                         if (_this.sashes === undefined) {
33545                             _this.sashes = null;
33546                         }
33547                         if (_this.cutOutShape === undefined) {
33548                             _this.cutOutShape = null;
33549                         }
33550                         _this.cutOutShape = cutOutShape_3;
33551                         _this.wallThickness = wallThickness_3;
33552                         _this.wallDistance = wallDistance_3;
33553                         _this.wallCutOutOnBothSides = wallCutOutOnBothSides_3;
33554                         _this.widthDepthDeformable = widthDepthDeformable_3;
33555                         _this.sashes = sashes_3;
33556                     }
33557                     if (_this.wallThickness === undefined) {
33558                         _this.wallThickness = 0;
33559                     }
33560                     if (_this.wallDistance === undefined) {
33561                         _this.wallDistance = 0;
33562                     }
33563                     if (_this.wallCutOutOnBothSides === undefined) {
33564                         _this.wallCutOutOnBothSides = false;
33565                     }
33566                     if (_this.widthDepthDeformable === undefined) {
33567                         _this.widthDepthDeformable = false;
33568                     }
33569                     if (_this.sashes === undefined) {
33570                         _this.sashes = null;
33571                     }
33572                     if (_this.cutOutShape === undefined) {
33573                         _this.cutOutShape = null;
33574                     }
33575                 }
33576                 if (_this.wallThickness === undefined) {
33577                     _this.wallThickness = 0;
33578                 }
33579                 if (_this.wallDistance === undefined) {
33580                     _this.wallDistance = 0;
33581                 }
33582                 if (_this.wallCutOutOnBothSides === undefined) {
33583                     _this.wallCutOutOnBothSides = false;
33584                 }
33585                 if (_this.widthDepthDeformable === undefined) {
33586                     _this.widthDepthDeformable = false;
33587                 }
33588                 if (_this.sashes === undefined) {
33589                     _this.sashes = null;
33590                 }
33591                 if (_this.cutOutShape === undefined) {
33592                     _this.cutOutShape = null;
33593                 }
33594             }
33595             if (_this.wallThickness === undefined) {
33596                 _this.wallThickness = 0;
33597             }
33598             if (_this.wallDistance === undefined) {
33599                 _this.wallDistance = 0;
33600             }
33601             if (_this.wallCutOutOnBothSides === undefined) {
33602                 _this.wallCutOutOnBothSides = false;
33603             }
33604             if (_this.widthDepthDeformable === undefined) {
33605                 _this.widthDepthDeformable = false;
33606             }
33607             if (_this.sashes === undefined) {
33608                 _this.sashes = null;
33609             }
33610             if (_this.cutOutShape === undefined) {
33611                 _this.cutOutShape = null;
33612             }
33613         }
33614         else if (((typeof id === 'string') || id === null) && ((name != null && (name.constructor != null && name.constructor["__interfaces"] != null && name.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || name === null) && ((description != null && (description.constructor != null && description.constructor["__interfaces"] != null && description.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || description === null) && ((typeof information === 'number') || information === null) && ((typeof license === 'number') || license === null) && ((typeof tags === 'number') || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((typeof grade === 'boolean') || grade === null) && ((typeof icon === 'number') || icon === null) && ((typeof planIcon === 'number') || planIcon === null) && ((model != null && model instanceof Array && (model.length == 0 || model[0] == null || (model[0] != null && model[0] instanceof Sash))) || model === null) && ((typeof width === 'number') || width === null) && ((depth != null && depth instanceof Array && (depth.length == 0 || depth[0] == null || depth[0] instanceof Array)) || depth === null) && ((typeof height === 'boolean') || height === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof dropOnTopElevation === 'string') || dropOnTopElevation === null) && ((typeof movable === 'number') || movable === null) && ((typeof cutOutShape === 'boolean') || cutOutShape === null) && wallThickness === undefined && wallDistance === undefined && wallCutOutOnBothSides === undefined && widthDepthDeformable === undefined && sashes === undefined && modelRotation === undefined && modelFlags === undefined && modelSize === undefined && creator === undefined && resizable === undefined && deformable === undefined && texturable === undefined && price === undefined && valueAddedTaxPercentage === undefined && currency === undefined && properties === undefined && contents === undefined) {
33615             var __args = arguments;
33616             var name_6 = __args[0];
33617             var icon_13 = __args[1];
33618             var model_13 = __args[2];
33619             var width_15 = __args[3];
33620             var depth_13 = __args[4];
33621             var height_20 = __args[5];
33622             var elevation_14 = __args[6];
33623             var movable_13 = __args[7];
33624             var wallThickness_4 = __args[8];
33625             var wallDistance_4 = __args[9];
33626             var sashes_4 = __args[10];
33627             var color = __args[11];
33628             var modelRotation_14 = __args[12];
33629             var backFaceShown = __args[13];
33630             var modelSize_11 = __args[14];
33631             var creator_16 = __args[15];
33632             var iconYaw = __args[16];
33633             var proportional = __args[17];
33634             if (_this.wallThickness === undefined) {
33635                 _this.wallThickness = 0;
33636             }
33637             if (_this.wallDistance === undefined) {
33638                 _this.wallDistance = 0;
33639             }
33640             if (_this.wallCutOutOnBothSides === undefined) {
33641                 _this.wallCutOutOnBothSides = false;
33642             }
33643             if (_this.widthDepthDeformable === undefined) {
33644                 _this.widthDepthDeformable = false;
33645             }
33646             if (_this.sashes === undefined) {
33647                 _this.sashes = null;
33648             }
33649             if (_this.cutOutShape === undefined) {
33650                 _this.cutOutShape = null;
33651             }
33652         }
33653         else if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((information != null && (information.constructor != null && information.constructor["__interfaces"] != null && information.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || information === null) && ((license != null && (license.constructor != null && license.constructor["__interfaces"] != null && license.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || license === null) && ((typeof tags === 'number') || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((typeof grade === 'number') || grade === null) && ((typeof icon === 'number') || icon === null) && ((typeof planIcon === 'boolean') || planIcon === null) && ((typeof model === 'number') || model === null) && ((typeof width === 'number') || width === null) && ((depth != null && depth instanceof Array && (depth.length == 0 || depth[0] == null || (depth[0] != null && depth[0] instanceof Sash))) || depth === null) && ((height != null && height instanceof Array && (height.length == 0 || height[0] == null || height[0] instanceof Array)) || height === null) && ((typeof elevation === 'string') || elevation === null) && ((typeof dropOnTopElevation === 'boolean') || dropOnTopElevation === null) && ((movable != null && movable instanceof Big) || movable === null) && ((cutOutShape != null && cutOutShape instanceof Big) || cutOutShape === null) && wallThickness === undefined && wallDistance === undefined && wallCutOutOnBothSides === undefined && widthDepthDeformable === undefined && sashes === undefined && modelRotation === undefined && modelFlags === undefined && modelSize === undefined && creator === undefined && resizable === undefined && deformable === undefined && texturable === undefined && price === undefined && valueAddedTaxPercentage === undefined && currency === undefined && properties === undefined && contents === undefined) {
33654             var __args = arguments;
33655             var icon_14 = __args[3];
33656             var model_14 = __args[4];
33657             var width_16 = __args[5];
33658             var depth_14 = __args[6];
33659             var height_21 = __args[7];
33660             var elevation_15 = __args[8];
33661             var movable_14 = __args[9];
33662             var wallThickness_5 = __args[10];
33663             var wallDistance_5 = __args[11];
33664             var sashes_5 = __args[12];
33665             var modelRotation_15 = __args[13];
33666             var creator_17 = __args[14];
33667             var resizable_14 = __args[15];
33668             var price_14 = __args[16];
33669             var valueAddedTaxPercentage_14 = __args[17];
33670             if (_this.wallThickness === undefined) {
33671                 _this.wallThickness = 0;
33672             }
33673             if (_this.wallDistance === undefined) {
33674                 _this.wallDistance = 0;
33675             }
33676             if (_this.wallCutOutOnBothSides === undefined) {
33677                 _this.wallCutOutOnBothSides = false;
33678             }
33679             if (_this.widthDepthDeformable === undefined) {
33680                 _this.widthDepthDeformable = false;
33681             }
33682             if (_this.sashes === undefined) {
33683                 _this.sashes = null;
33684             }
33685             if (_this.cutOutShape === undefined) {
33686                 _this.cutOutShape = null;
33687             }
33688         }
33689         else
33690             throw new Error('invalid overload');
33691         return _this;
33692     }
33693     /**
33694      * Returns the default thickness of the wall in which this door or window should be placed.
33695      * @return {number} a value in percentage of the depth of the door or the window.
33696      */
33697     CatalogDoorOrWindow.prototype.getWallThickness = function () {
33698         return this.wallThickness;
33699     };
33700     /**
33701      * Returns the default distance that should lie at the back side of this door or window.
33702      * @return {number} a distance in percentage of the depth of the door or the window.
33703      */
33704     CatalogDoorOrWindow.prototype.getWallDistance = function () {
33705         return this.wallDistance;
33706     };
33707     /**
33708      * Returns <code>true</code> if this door or window should cut out the both sides
33709      * of the walls it intersects, even if its front or back side are within the wall thickness.
33710      * @return {boolean}
33711      */
33712     CatalogDoorOrWindow.prototype.isWallCutOutOnBothSides = function () {
33713         return this.wallCutOutOnBothSides;
33714     };
33715     /**
33716      * Returns <code>false</code> if the width and depth of the new door or window may
33717      * not be changed independently from each other.
33718      * @return {boolean}
33719      */
33720     CatalogDoorOrWindow.prototype.isWidthDepthDeformable = function () {
33721         return this.widthDepthDeformable;
33722     };
33723     /**
33724      * Returns a copy of the sashes attached to this door or window.
33725      * If no sash is defined an empty array is returned.
33726      * @return {com.eteks.sweethome3d.model.Sash[]}
33727      */
33728     CatalogDoorOrWindow.prototype.getSashes = function () {
33729         if (this.sashes.length === 0) {
33730             return this.sashes;
33731         }
33732         else {
33733             return /* clone */ this.sashes.slice(0);
33734         }
33735     };
33736     /**
33737      * Returns the shape used to cut out walls that intersect this new door or window.
33738      * @return {string}
33739      */
33740     CatalogDoorOrWindow.prototype.getCutOutShape = function () {
33741         return this.cutOutShape;
33742     };
33743     /**
33744      * Returns always <code>true</code>.
33745      * @return {boolean}
33746      */
33747     CatalogDoorOrWindow.prototype.isDoorOrWindow = function () {
33748         return true;
33749     };
33750     /**
33751      * Returns always <code>false</code>.
33752      * @return {boolean}
33753      */
33754     CatalogDoorOrWindow.prototype.isHorizontallyRotatable = function () {
33755         return false;
33756     };
33757     return CatalogDoorOrWindow;
33758 }(CatalogPieceOfFurniture));
33759 CatalogDoorOrWindow["__class"] = "com.eteks.sweethome3d.model.CatalogDoorOrWindow";
33760 CatalogDoorOrWindow["__interfaces"] = ["com.eteks.sweethome3d.model.CatalogItem", "com.eteks.sweethome3d.model.DoorOrWindow", "com.eteks.sweethome3d.model.PieceOfFurniture"];
33761 /**
33762  * Creates a catalog shelf unit of the default catalog.
33763  * @param {string} id    the id of the shelf unit or <code>null</code>
33764  * @param {string} name  the name of the shelf unit
33765  * @param {string} description the description of the shelf unit
33766  * @param {string} information additional information associated to the shelf unit
33767  * @param {string} license license of the shelf unit
33768  * @param {java.lang.String[]} tags tags associated to the shelf unit
33769  * @param {number} creationDate creation date of the shelf unit in milliseconds since the epoch
33770  * @param {number} grade grade of the piece of furniture or <code>null</code>
33771  * @param {Object} icon content of the icon of the shelf unit
33772  * @param {Object} planIcon content of the icon of the shelf unit displayed in plan
33773  * @param {Object} model content of the 3D model of the shelf unit
33774  * @param {number} width  the width in centimeters of the shelf unit
33775  * @param {number} depth  the depth in centimeters of the shelf unit
33776  * @param {number} height  the height in centimeters of the shelf unit
33777  * @param {number} elevation  the elevation in centimeters of the shelf unit
33778  * @param {number} dropOnTopElevation  a percentage of the height at which should be placed
33779  * an object dropped on the shelf unit
33780  * @param {float[]} shelfElevations shelf elevation(s) at which other objects can be placed on the shelf unit
33781  * @param {com.eteks.sweethome3d.model.BoxBounds[]} shelfBoxes coordinates of the shelf box(es) in which other objects can be placed in the shelf unit
33782  * @param {boolean} movable if <code>true</code>, the shelf unit is movable
33783  * @param {string} staircaseCutOutShape the shape used to cut out upper levels when they intersect
33784  * with the piece like a staircase
33785  * @param {float[][]} modelRotation the rotation 3 by 3 matrix applied to the piece model
33786  * @param {number} modelFlags flags which should be applied to piece model
33787  * @param {number} modelSize size of the 3D model of the shelf unit
33788  * @param {string} creator the creator of the model
33789  * @param {boolean} resizable if <code>true</code>, the size of the shelf unit may be edited
33790  * @param {boolean} deformable if <code>true</code>, the width, depth and height of the shelf unit may
33791  * change independently from each other
33792  * @param {boolean} texturable if <code>false</code> this piece should always keep the same color or texture
33793  * @param {boolean} horizontallyRotatable if <code>false</code> this piece
33794  * should not rotate around an horizontal axis
33795  * @param {Big} price the price of the shelf unit or <code>null</code>
33796  * @param {Big} valueAddedTaxPercentage the Value Added Tax percentage applied to the
33797  * price of the shelf unit or <code>null</code>
33798  * @param {string} currency the price currency, noted with ISO 4217 code, or <code>null</code>
33799  * @param {Object} properties additional properties associating a key to a value or <code>null</code>
33800  * @param {Object} contents   additional contents associating a key to a value or <code>null</code>
33801  * @class
33802  * @extends CatalogPieceOfFurniture
33803  * @author Emmanuel Puybaret
33804  */
33805 var CatalogShelfUnit = /** @class */ (function (_super) {
33806     __extends(CatalogShelfUnit, _super);
33807     function CatalogShelfUnit(id, name, description, information, license, tags, creationDate, grade, icon, planIcon, model, width, depth, height, elevation, dropOnTopElevation, shelfElevations, shelfBoxes, movable, staircaseCutOutShape, modelRotation, modelFlags, modelSize, creator, resizable, deformable, texturable, horizontallyRotatable, price, valueAddedTaxPercentage, currency, properties, contents) {
33808         var _this = _super.call(this, id, name, description, information, license, tags, creationDate, grade, icon, planIcon, model, width, depth, height, elevation, dropOnTopElevation, movable, staircaseCutOutShape, modelRotation, modelFlags, modelSize, creator, resizable, deformable, texturable, horizontallyRotatable, price, valueAddedTaxPercentage, currency, properties, contents) || this;
33809         if (_this.shelfElevations === undefined) {
33810             _this.shelfElevations = null;
33811         }
33812         if (_this.shelfBoxes === undefined) {
33813             _this.shelfBoxes = null;
33814         }
33815         _this.shelfElevations = shelfElevations != null && shelfElevations.length > 0 ? /* clone */ shelfElevations.slice(0) : CatalogShelfUnit.EMPTY_SHELF_ELEVATIONS_$LI$();
33816         _this.shelfBoxes = shelfBoxes != null && shelfBoxes.length > 0 ? /* clone */ shelfBoxes.slice(0) : CatalogShelfUnit.EMPTY_SHELF_BOXES_$LI$();
33817         return _this;
33818     }
33819     CatalogShelfUnit.EMPTY_SHELF_ELEVATIONS_$LI$ = function () { if (CatalogShelfUnit.EMPTY_SHELF_ELEVATIONS == null) {
33820         CatalogShelfUnit.EMPTY_SHELF_ELEVATIONS = [];
33821     } return CatalogShelfUnit.EMPTY_SHELF_ELEVATIONS; };
33822     CatalogShelfUnit.EMPTY_SHELF_BOXES_$LI$ = function () { if (CatalogShelfUnit.EMPTY_SHELF_BOXES == null) {
33823         CatalogShelfUnit.EMPTY_SHELF_BOXES = [];
33824     } return CatalogShelfUnit.EMPTY_SHELF_BOXES; };
33825     /**
33826      * Returns the elevation(s) at which other objects can be placed on this shelf unit.
33827      * @return {float[]}
33828      */
33829     CatalogShelfUnit.prototype.getShelfElevations = function () {
33830         return this.shelfElevations != null ? /* clone */ this.shelfElevations.slice(0) : null;
33831     };
33832     /**
33833      * Returns the coordinates of the shelf box(es) in which other objects can be placed in this shelf unit.
33834      * @return {com.eteks.sweethome3d.model.BoxBounds[]}
33835      */
33836     CatalogShelfUnit.prototype.getShelfBoxes = function () {
33837         return /* clone */ this.shelfBoxes.slice(0);
33838     };
33839     return CatalogShelfUnit;
33840 }(CatalogPieceOfFurniture));
33841 CatalogShelfUnit["__class"] = "com.eteks.sweethome3d.model.CatalogShelfUnit";
33842 CatalogShelfUnit["__interfaces"] = ["com.eteks.sweethome3d.model.CatalogItem", "com.eteks.sweethome3d.model.PieceOfFurniture", "com.eteks.sweethome3d.model.ShelfUnit"];
33843 /**
33844  * Creates a catalog light of the default catalog.
33845  * @param {string} id    the id of the new light, or <code>null</code>
33846  * @param {string} name  the name of the new light
33847  * @param {string} description the description of the new light
33848  * @param {string} information additional information associated to the new light
33849  * @param {string} license license of the new light
33850  * @param {java.lang.String[]} tags tags associated to the new light
33851  * @param {number} creationDate creation date of the new light in milliseconds since the epoch
33852  * @param {number} grade grade of the new light or <code>null</code>
33853  * @param {Object} icon content of the icon of the new light
33854  * @param {Object} planIcon content of the icon of the new piece displayed in plan
33855  * @param {Object} model content of the 3D model of the new light
33856  * @param {number} width  the width in centimeters of the new light
33857  * @param {number} depth  the depth in centimeters of the new light
33858  * @param {number} height  the height in centimeters of the new light
33859  * @param {number} dropOnTopElevation a percentage of the height at which should be placed
33860  * an object dropped on the new piece
33861  * @param {number} elevation  the elevation in centimeters of the new light
33862  * @param {boolean} movable if <code>true</code>, the new light is movable
33863  * @param {com.eteks.sweethome3d.model.LightSource[]} lightSources the light sources of the new light
33864  * @param {java.lang.String[]} lightSourceMaterialNames the material names of the light source in the 3D model of the new light
33865  * @param {string} staircaseCutOutShape the shape used to cut out upper levels when they intersect
33866  * with the piece like a staircase
33867  * @param {float[][]} modelRotation the rotation 3 by 3 matrix applied to the light model
33868  * @param {number} modelFlags flags which should be applied to piece model
33869  * @param {number} modelSize size of the 3D model of the new light
33870  * @param {string} creator the creator of the model
33871  * @param {boolean} resizable if <code>true</code>, the size of the new light may be edited
33872  * @param {boolean} deformable if <code>true</code>, the width, depth and height of the new piece may
33873  * change independently from each other
33874  * @param {boolean} texturable if <code>false</code> this piece should always keep the same color or texture
33875  * @param {boolean} horizontallyRotatable if <code>false</code> this piece
33876  * should not rotate around an horizontal axis
33877  * @param {Big} price the price of the new light, or <code>null</code>
33878  * @param {Big} valueAddedTaxPercentage the Value Added Tax percentage applied to the
33879  * price of the new light or <code>null</code>
33880  * @param {string} currency the price currency, noted with ISO 4217 code, or <code>null</code>
33881  * @param {Object} properties additional properties associating a key to a value or <code>null</code>
33882  * @param {Object} contents   additional contents associating a key to a value or <code>null</code>
33883  * @class
33884  * @extends CatalogPieceOfFurniture
33885  * @author Emmanuel Puybaret
33886  */
33887 var CatalogLight = /** @class */ (function (_super) {
33888     __extends(CatalogLight, _super);
33889     function CatalogLight(id, name, description, information, license, tags, creationDate, grade, icon, planIcon, model, width, depth, height, elevation, dropOnTopElevation, movable, lightSources, lightSourceMaterialNames, staircaseCutOutShape, modelRotation, modelFlags, modelSize, creator, resizable, deformable, texturable, horizontallyRotatable, price, valueAddedTaxPercentage, currency, properties, contents) {
33890         var _this = this;
33891         if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((typeof information === 'string') || information === null) && ((typeof license === 'string') || license === null) && ((tags != null && tags instanceof Array && (tags.length == 0 || tags[0] == null || (typeof tags[0] === 'string'))) || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((typeof grade === 'number') || grade === null) && ((icon != null && (icon.constructor != null && icon.constructor["__interfaces"] != null && icon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || icon === null) && ((planIcon != null && (planIcon.constructor != null && planIcon.constructor["__interfaces"] != null && planIcon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || planIcon === null) && ((model != null && (model.constructor != null && model.constructor["__interfaces"] != null && model.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || model === null) && ((typeof width === 'number') || width === null) && ((typeof depth === 'number') || depth === null) && ((typeof height === 'number') || height === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof dropOnTopElevation === 'number') || dropOnTopElevation === null) && ((typeof movable === 'boolean') || movable === null) && ((lightSources != null && lightSources instanceof Array && (lightSources.length == 0 || lightSources[0] == null || (lightSources[0] != null && lightSources[0] instanceof LightSource))) || lightSources === null) && ((lightSourceMaterialNames != null && lightSourceMaterialNames instanceof Array && (lightSourceMaterialNames.length == 0 || lightSourceMaterialNames[0] == null || (typeof lightSourceMaterialNames[0] === 'string'))) || lightSourceMaterialNames === null) && ((typeof staircaseCutOutShape === 'string') || staircaseCutOutShape === null) && ((modelRotation != null && modelRotation instanceof Array && (modelRotation.length == 0 || modelRotation[0] == null || modelRotation[0] instanceof Array)) || modelRotation === null) && ((typeof modelFlags === 'number') || modelFlags === null) && ((typeof modelSize === 'number') || modelSize === null) && ((typeof creator === 'string') || creator === null) && ((typeof resizable === 'boolean') || resizable === null) && ((typeof deformable === 'boolean') || deformable === null) && ((typeof texturable === 'boolean') || texturable === null) && ((typeof horizontallyRotatable === 'boolean') || horizontallyRotatable === null) && ((price != null && price instanceof Big) || price === null) && ((valueAddedTaxPercentage != null && valueAddedTaxPercentage instanceof Big) || valueAddedTaxPercentage === null) && ((typeof currency === 'string') || currency === null) && ((properties != null && (properties instanceof Object)) || properties === null) && ((contents != null && (contents instanceof Object)) || contents === null)) {
33892             var __args = arguments;
33893             _this = _super.call(this, id, name, description, information, license, tags, creationDate, grade, icon, planIcon, model, width, depth, height, elevation, dropOnTopElevation, movable, staircaseCutOutShape, modelRotation, modelFlags, modelSize, creator, resizable, deformable, texturable, horizontallyRotatable, price, valueAddedTaxPercentage, currency, properties, contents) || this;
33894             if (_this.lightSources === undefined) {
33895                 _this.lightSources = null;
33896             }
33897             if (_this.lightSourceMaterialNames === undefined) {
33898                 _this.lightSourceMaterialNames = null;
33899             }
33900             _this.lightSources = lightSources != null && lightSources.length > 0 ? /* clone */ lightSources.slice(0) : CatalogLight.EMPTY_LIGHT_SOURCES_$LI$();
33901             _this.lightSourceMaterialNames = lightSourceMaterialNames != null && lightSourceMaterialNames.length > 0 ? /* clone */ lightSourceMaterialNames.slice(0) : CatalogLight.EMPTY_LIGHT_SOURCE_MATERIAL_NAMES_$LI$();
33902         }
33903         else if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((typeof information === 'string') || information === null) && ((license != null && license instanceof Array && (license.length == 0 || license[0] == null || (typeof license[0] === 'string'))) || license === null) && ((typeof tags === 'number') || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((grade != null && (grade.constructor != null && grade.constructor["__interfaces"] != null && grade.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || grade === null) && ((icon != null && (icon.constructor != null && icon.constructor["__interfaces"] != null && icon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || icon === null) && ((planIcon != null && (planIcon.constructor != null && planIcon.constructor["__interfaces"] != null && planIcon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || planIcon === null) && ((typeof model === 'number') || model === null) && ((typeof width === 'number') || width === null) && ((typeof depth === 'number') || depth === null) && ((typeof height === 'number') || height === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof dropOnTopElevation === 'boolean') || dropOnTopElevation === null) && ((movable != null && movable instanceof Array && (movable.length == 0 || movable[0] == null || (movable[0] != null && movable[0] instanceof LightSource))) || movable === null) && ((lightSources != null && lightSources instanceof Array && (lightSources.length == 0 || lightSources[0] == null || (typeof lightSources[0] === 'string'))) || lightSources === null) && ((typeof lightSourceMaterialNames === 'string') || lightSourceMaterialNames === null) && ((staircaseCutOutShape != null && staircaseCutOutShape instanceof Array && (staircaseCutOutShape.length == 0 || staircaseCutOutShape[0] == null || staircaseCutOutShape[0] instanceof Array)) || staircaseCutOutShape === null) && ((typeof modelRotation === 'number') || modelRotation === null) && ((typeof modelFlags === 'number') || modelFlags === null) && ((typeof modelSize === 'string') || modelSize === null) && ((typeof creator === 'boolean') || creator === null) && ((typeof resizable === 'boolean') || resizable === null) && ((typeof deformable === 'boolean') || deformable === null) && ((typeof texturable === 'boolean') || texturable === null) && ((horizontallyRotatable != null && horizontallyRotatable instanceof Big) || horizontallyRotatable === null) && ((price != null && price instanceof Big) || price === null) && ((typeof valueAddedTaxPercentage === 'string') || valueAddedTaxPercentage === null) && ((currency != null && (currency instanceof Object)) || currency === null) && properties === undefined && contents === undefined) {
33904             var __args = arguments;
33905             var tags_10 = __args[4];
33906             var creationDate_10 = __args[5];
33907             var grade_10 = __args[6];
33908             var icon_15 = __args[7];
33909             var planIcon_12 = __args[8];
33910             var model_15 = __args[9];
33911             var width_17 = __args[10];
33912             var depth_15 = __args[11];
33913             var height_22 = __args[12];
33914             var elevation_16 = __args[13];
33915             var dropOnTopElevation_10 = __args[14];
33916             var movable_15 = __args[15];
33917             var lightSources_1 = __args[16];
33918             var lightSourceMaterialNames_1 = __args[17];
33919             var staircaseCutOutShape_8 = __args[18];
33920             var modelRotation_16 = __args[19];
33921             var modelFlags_11 = __args[20];
33922             var modelSize_12 = __args[21];
33923             var creator_18 = __args[22];
33924             var resizable_15 = __args[23];
33925             var deformable_13 = __args[24];
33926             var texturable_13 = __args[25];
33927             var horizontallyRotatable_8 = __args[26];
33928             var price_15 = __args[27];
33929             var valueAddedTaxPercentage_15 = __args[28];
33930             var currency_11 = __args[29];
33931             var properties_11 = __args[30];
33932             {
33933                 var __args_109 = arguments;
33934                 var license_10 = null;
33935                 var contents_11 = null;
33936                 _this = _super.call(this, id, name, description, information, license_10, tags_10, creationDate_10, grade_10, icon_15, planIcon_12, model_15, width_17, depth_15, height_22, elevation_16, dropOnTopElevation_10, movable_15, staircaseCutOutShape_8, modelRotation_16, modelFlags_11, modelSize_12, creator_18, resizable_15, deformable_13, texturable_13, horizontallyRotatable_8, price_15, valueAddedTaxPercentage_15, currency_11, properties_11, contents_11) || this;
33937                 if (_this.lightSources === undefined) {
33938                     _this.lightSources = null;
33939                 }
33940                 if (_this.lightSourceMaterialNames === undefined) {
33941                     _this.lightSourceMaterialNames = null;
33942                 }
33943                 _this.lightSources = lightSources_1 != null && lightSources_1.length > 0 ? /* clone */ lightSources_1.slice(0) : CatalogLight.EMPTY_LIGHT_SOURCES_$LI$();
33944                 _this.lightSourceMaterialNames = lightSourceMaterialNames_1 != null && lightSourceMaterialNames_1.length > 0 ? /* clone */ lightSourceMaterialNames_1.slice(0) : CatalogLight.EMPTY_LIGHT_SOURCE_MATERIAL_NAMES_$LI$();
33945             }
33946             if (_this.lightSources === undefined) {
33947                 _this.lightSources = null;
33948             }
33949             if (_this.lightSourceMaterialNames === undefined) {
33950                 _this.lightSourceMaterialNames = null;
33951             }
33952         }
33953         else if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((typeof information === 'string') || information === null) && ((license != null && license instanceof Array && (license.length == 0 || license[0] == null || (typeof license[0] === 'string'))) || license === null) && ((typeof tags === 'number') || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((grade != null && (grade.constructor != null && grade.constructor["__interfaces"] != null && grade.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || grade === null) && ((icon != null && (icon.constructor != null && icon.constructor["__interfaces"] != null && icon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || icon === null) && ((planIcon != null && (planIcon.constructor != null && planIcon.constructor["__interfaces"] != null && planIcon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || planIcon === null) && ((typeof model === 'number') || model === null) && ((typeof width === 'number') || width === null) && ((typeof depth === 'number') || depth === null) && ((typeof height === 'number') || height === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof dropOnTopElevation === 'boolean') || dropOnTopElevation === null) && ((movable != null && movable instanceof Array && (movable.length == 0 || movable[0] == null || (movable[0] != null && movable[0] instanceof LightSource))) || movable === null) && ((typeof lightSources === 'string') || lightSources === null) && ((lightSourceMaterialNames != null && lightSourceMaterialNames instanceof Array && (lightSourceMaterialNames.length == 0 || lightSourceMaterialNames[0] == null || lightSourceMaterialNames[0] instanceof Array)) || lightSourceMaterialNames === null) && ((typeof staircaseCutOutShape === 'boolean') || staircaseCutOutShape === null) && ((typeof modelRotation === 'number') || modelRotation === null) && ((typeof modelFlags === 'string') || modelFlags === null) && ((typeof modelSize === 'boolean') || modelSize === null) && ((typeof creator === 'boolean') || creator === null) && ((typeof resizable === 'boolean') || resizable === null) && ((typeof deformable === 'boolean') || deformable === null) && ((texturable != null && texturable instanceof Big) || texturable === null) && ((horizontallyRotatable != null && horizontallyRotatable instanceof Big) || horizontallyRotatable === null) && ((typeof price === 'string') || price === null) && ((valueAddedTaxPercentage != null && (valueAddedTaxPercentage instanceof Object)) || valueAddedTaxPercentage === null) && currency === undefined && properties === undefined && contents === undefined) {
33954             var __args = arguments;
33955             var tags_11 = __args[4];
33956             var creationDate_11 = __args[5];
33957             var grade_11 = __args[6];
33958             var icon_16 = __args[7];
33959             var planIcon_13 = __args[8];
33960             var model_16 = __args[9];
33961             var width_18 = __args[10];
33962             var depth_16 = __args[11];
33963             var height_23 = __args[12];
33964             var elevation_17 = __args[13];
33965             var dropOnTopElevation_11 = __args[14];
33966             var movable_16 = __args[15];
33967             var lightSources_2 = __args[16];
33968             var staircaseCutOutShape_9 = __args[17];
33969             var modelRotation_17 = __args[18];
33970             var backFaceShown = __args[19];
33971             var modelSize_13 = __args[20];
33972             var creator_19 = __args[21];
33973             var resizable_16 = __args[22];
33974             var deformable_14 = __args[23];
33975             var texturable_14 = __args[24];
33976             var horizontallyRotatable_9 = __args[25];
33977             var price_16 = __args[26];
33978             var valueAddedTaxPercentage_16 = __args[27];
33979             var currency_12 = __args[28];
33980             var properties_12 = __args[29];
33981             {
33982                 var __args_110 = arguments;
33983                 var lightSourceMaterialNames_2 = null;
33984                 var modelFlags_12 = backFaceShown ? PieceOfFurniture.SHOW_BACK_FACE : 0;
33985                 {
33986                     var __args_111 = arguments;
33987                     var license_11 = null;
33988                     var contents_12 = null;
33989                     _this = _super.call(this, id, name, description, information, license_11, tags_11, creationDate_11, grade_11, icon_16, planIcon_13, model_16, width_18, depth_16, height_23, elevation_17, dropOnTopElevation_11, movable_16, staircaseCutOutShape_9, modelRotation_17, modelFlags_12, modelSize_13, creator_19, resizable_16, deformable_14, texturable_14, horizontallyRotatable_9, price_16, valueAddedTaxPercentage_16, currency_12, properties_12, contents_12) || this;
33990                     if (_this.lightSources === undefined) {
33991                         _this.lightSources = null;
33992                     }
33993                     if (_this.lightSourceMaterialNames === undefined) {
33994                         _this.lightSourceMaterialNames = null;
33995                     }
33996                     _this.lightSources = lightSources_2 != null && lightSources_2.length > 0 ? /* clone */ lightSources_2.slice(0) : CatalogLight.EMPTY_LIGHT_SOURCES_$LI$();
33997                     _this.lightSourceMaterialNames = lightSourceMaterialNames_2 != null && lightSourceMaterialNames_2.length > 0 ? /* clone */ lightSourceMaterialNames_2.slice(0) : CatalogLight.EMPTY_LIGHT_SOURCE_MATERIAL_NAMES_$LI$();
33998                 }
33999                 if (_this.lightSources === undefined) {
34000                     _this.lightSources = null;
34001                 }
34002                 if (_this.lightSourceMaterialNames === undefined) {
34003                     _this.lightSourceMaterialNames = null;
34004                 }
34005             }
34006             if (_this.lightSources === undefined) {
34007                 _this.lightSources = null;
34008             }
34009             if (_this.lightSourceMaterialNames === undefined) {
34010                 _this.lightSourceMaterialNames = null;
34011             }
34012         }
34013         else if (((typeof id === 'string') || id === null) && ((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null) && ((typeof information === 'string') || information === null) && ((license != null && license instanceof Array && (license.length == 0 || license[0] == null || (typeof license[0] === 'string'))) || license === null) && ((typeof tags === 'number') || tags === null) && ((typeof creationDate === 'number') || creationDate === null) && ((grade != null && (grade.constructor != null && grade.constructor["__interfaces"] != null && grade.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || grade === null) && ((icon != null && (icon.constructor != null && icon.constructor["__interfaces"] != null && icon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || icon === null) && ((planIcon != null && (planIcon.constructor != null && planIcon.constructor["__interfaces"] != null && planIcon.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Content") >= 0)) || planIcon === null) && ((typeof model === 'number') || model === null) && ((typeof width === 'number') || width === null) && ((typeof depth === 'number') || depth === null) && ((typeof height === 'number') || height === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof dropOnTopElevation === 'boolean') || dropOnTopElevation === null) && ((movable != null && movable instanceof Array && (movable.length == 0 || movable[0] == null || (movable[0] != null && movable[0] instanceof LightSource))) || movable === null) && ((typeof lightSources === 'string') || lightSources === null) && ((lightSourceMaterialNames != null && lightSourceMaterialNames instanceof Array && (lightSourceMaterialNames.length == 0 || lightSourceMaterialNames[0] == null || lightSourceMaterialNames[0] instanceof Array)) || lightSourceMaterialNames === null) && ((typeof staircaseCutOutShape === 'boolean') || staircaseCutOutShape === null) && ((typeof modelRotation === 'number') || modelRotation === null) && ((typeof modelFlags === 'string') || modelFlags === null) && ((typeof modelSize === 'boolean') || modelSize === null) && ((typeof creator === 'boolean') || creator === null) && ((typeof resizable === 'boolean') || resizable === null) && ((typeof deformable === 'boolean') || deformable === null) && ((texturable != null && texturable instanceof Big) || texturable === null) && ((horizontallyRotatable != null && horizontallyRotatable instanceof Big) || horizontallyRotatable === null) && ((typeof price === 'string') || price === null) && valueAddedTaxPercentage === undefined && currency === undefined && properties === undefined && contents === undefined) {
34014             var __args = arguments;
34015             var tags_12 = __args[4];
34016             var creationDate_12 = __args[5];
34017             var grade_12 = __args[6];
34018             var icon_17 = __args[7];
34019             var planIcon_14 = __args[8];
34020             var model_17 = __args[9];
34021             var width_19 = __args[10];
34022             var depth_17 = __args[11];
34023             var height_24 = __args[12];
34024             var elevation_18 = __args[13];
34025             var dropOnTopElevation_12 = __args[14];
34026             var movable_17 = __args[15];
34027             var lightSources_3 = __args[16];
34028             var staircaseCutOutShape_10 = __args[17];
34029             var modelRotation_18 = __args[18];
34030             var backFaceShown = __args[19];
34031             var modelSize_14 = __args[20];
34032             var creator_20 = __args[21];
34033             var resizable_17 = __args[22];
34034             var deformable_15 = __args[23];
34035             var texturable_15 = __args[24];
34036             var horizontallyRotatable_10 = __args[25];
34037             var price_17 = __args[26];
34038             var valueAddedTaxPercentage_17 = __args[27];
34039             var currency_13 = __args[28];
34040             {
34041                 var __args_112 = arguments;
34042                 var properties_13 = null;
34043                 {
34044                     var __args_113 = arguments;
34045                     var lightSourceMaterialNames_3 = null;
34046                     var modelFlags_13 = backFaceShown ? PieceOfFurniture.SHOW_BACK_FACE : 0;
34047                     {
34048                         var __args_114 = arguments;
34049                         var license_12 = null;
34050                         var contents_13 = null;
34051                         _this = _super.call(this, id, name, description, information, license_12, tags_12, creationDate_12, grade_12, icon_17, planIcon_14, model_17, width_19, depth_17, height_24, elevation_18, dropOnTopElevation_12, movable_17, staircaseCutOutShape_10, modelRotation_18, modelFlags_13, modelSize_14, creator_20, resizable_17, deformable_15, texturable_15, horizontallyRotatable_10, price_17, valueAddedTaxPercentage_17, currency_13, properties_13, contents_13) || this;
34052                         if (_this.lightSources === undefined) {
34053                             _this.lightSources = null;
34054                         }
34055                         if (_this.lightSourceMaterialNames === undefined) {
34056                             _this.lightSourceMaterialNames = null;
34057                         }
34058                         _this.lightSources = lightSources_3 != null && lightSources_3.length > 0 ? /* clone */ lightSources_3.slice(0) : CatalogLight.EMPTY_LIGHT_SOURCES_$LI$();
34059                         _this.lightSourceMaterialNames = lightSourceMaterialNames_3 != null && lightSourceMaterialNames_3.length > 0 ? /* clone */ lightSourceMaterialNames_3.slice(0) : CatalogLight.EMPTY_LIGHT_SOURCE_MATERIAL_NAMES_$LI$();
34060                     }
34061                     if (_this.lightSources === undefined) {
34062                         _this.lightSources = null;
34063                     }
34064                     if (_this.lightSourceMaterialNames === undefined) {
34065                         _this.lightSourceMaterialNames = null;
34066                     }
34067                 }
34068                 if (_this.lightSources === undefined) {
34069                     _this.lightSources = null;
34070                 }
34071                 if (_this.lightSourceMaterialNames === undefined) {
34072                     _this.lightSourceMaterialNames = null;
34073                 }
34074             }
34075             if (_this.lightSources === undefined) {
34076                 _this.lightSources = null;
34077             }
34078             if (_this.lightSourceMaterialNames === undefined) {
34079                 _this.lightSourceMaterialNames = null;
34080             }
34081         }
34082         else
34083             throw new Error('invalid overload');
34084         return _this;
34085     }
34086     CatalogLight.EMPTY_LIGHT_SOURCES_$LI$ = function () { if (CatalogLight.EMPTY_LIGHT_SOURCES == null) {
34087         CatalogLight.EMPTY_LIGHT_SOURCES = [];
34088     } return CatalogLight.EMPTY_LIGHT_SOURCES; };
34089     CatalogLight.EMPTY_LIGHT_SOURCE_MATERIAL_NAMES_$LI$ = function () { if (CatalogLight.EMPTY_LIGHT_SOURCE_MATERIAL_NAMES == null) {
34090         CatalogLight.EMPTY_LIGHT_SOURCE_MATERIAL_NAMES = [];
34091     } return CatalogLight.EMPTY_LIGHT_SOURCE_MATERIAL_NAMES; };
34092     /**
34093      * Returns the sources managed by this light. Each light source point
34094      * is a percentage of the width, the depth and the height of this light,
34095      * with the abscissa origin at the left side of the piece,
34096      * the ordinate origin at the front side of the piece
34097      * and the elevation origin at the bottom side of the piece.
34098      * @return {com.eteks.sweethome3d.model.LightSource[]} a copy of light sources array.
34099      */
34100     CatalogLight.prototype.getLightSources = function () {
34101         if (this.lightSources.length === 0) {
34102             return this.lightSources;
34103         }
34104         else {
34105             return /* clone */ this.lightSources.slice(0);
34106         }
34107     };
34108     /**
34109      * Returns the material names of the light sources in the 3D model managed by this light.
34110      * @return {java.lang.String[]} a copy of light source material names array.
34111      */
34112     CatalogLight.prototype.getLightSourceMaterialNames = function () {
34113         if (this.lightSourceMaterialNames.length === 0) {
34114             return this.lightSourceMaterialNames;
34115         }
34116         else {
34117             return /* clone */ this.lightSourceMaterialNames.slice(0);
34118         }
34119     };
34120     return CatalogLight;
34121 }(CatalogPieceOfFurniture));
34122 CatalogLight["__class"] = "com.eteks.sweethome3d.model.CatalogLight";
34123 CatalogLight["__interfaces"] = ["com.eteks.sweethome3d.model.CatalogItem", "com.eteks.sweethome3d.model.PieceOfFurniture", "com.eteks.sweethome3d.model.Light"];
34124 /**
34125  * Creates a controller that edits a new catalog texture with a given
34126  * <code>textureName</code>.
34127  * @param {string} textureName
34128  * @param {UserPreferences} preferences
34129  * @param {Object} viewFactory
34130  * @param {Object} contentManager
34131  * @class
34132  * @extends WizardController
34133  * @author Emmanuel Puybaret
34134  */
34135 var ImportedTextureWizardController = /** @class */ (function (_super) {
34136     __extends(ImportedTextureWizardController, _super);
34137     function ImportedTextureWizardController(texture, textureName, preferences, viewFactory, contentManager) {
34138         var _this = this;
34139         if (((texture != null && texture instanceof CatalogTexture) || texture === null) && ((typeof textureName === 'string') || textureName === null) && ((preferences != null && preferences instanceof UserPreferences) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || viewFactory === null) && ((contentManager != null && (contentManager.constructor != null && contentManager.constructor["__interfaces"] != null && contentManager.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || contentManager === null)) {
34140             var __args = arguments;
34141             _this = _super.call(this, preferences, viewFactory) || this;
34142             if (_this.texture === undefined) {
34143                 _this.texture = null;
34144             }
34145             if (_this.textureName === undefined) {
34146                 _this.textureName = null;
34147             }
34148             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences === undefined) {
34149                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences = null;
34150             }
34151             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory === undefined) {
34152                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory = null;
34153             }
34154             if (_this.contentManager === undefined) {
34155                 _this.contentManager = null;
34156             }
34157             if (_this.textureImageStepState === undefined) {
34158                 _this.textureImageStepState = null;
34159             }
34160             if (_this.textureAttributesStepState === undefined) {
34161                 _this.textureAttributesStepState = null;
34162             }
34163             if (_this.stepsView === undefined) {
34164                 _this.stepsView = null;
34165             }
34166             if (_this.step === undefined) {
34167                 _this.step = null;
34168             }
34169             if (_this.image === undefined) {
34170                 _this.image = null;
34171             }
34172             if (_this.name === undefined) {
34173                 _this.name = null;
34174             }
34175             if (_this.category === undefined) {
34176                 _this.category = null;
34177             }
34178             if (_this.creator === undefined) {
34179                 _this.creator = null;
34180             }
34181             if (_this.width === undefined) {
34182                 _this.width = 0;
34183             }
34184             if (_this.height === undefined) {
34185                 _this.height = 0;
34186             }
34187             _this.texture = texture;
34188             _this.textureName = textureName;
34189             _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences = preferences;
34190             _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory = viewFactory;
34191             _this.contentManager = contentManager;
34192             /* Use propertyChangeSupport defined in super class */ ;
34193             _this.setTitle(_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences.getLocalizedString(ImportedTextureWizardController, texture == null ? "importTextureWizard.title" : "modifyTextureWizard.title"));
34194             _this.textureImageStepState = new ImportedTextureWizardController.TextureImageStepState(_this);
34195             _this.textureAttributesStepState = new ImportedTextureWizardController.TextureAttributesStepState(_this);
34196             _this.setStepState(_this.textureImageStepState);
34197         }
34198         else if (((typeof texture === 'string') || texture === null) && ((textureName != null && textureName instanceof UserPreferences) || textureName === null) && ((preferences != null && (preferences.constructor != null && preferences.constructor["__interfaces"] != null && preferences.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || viewFactory === null) && contentManager === undefined) {
34199             var __args = arguments;
34200             var textureName_1 = __args[0];
34201             var preferences_6 = __args[1];
34202             var viewFactory_5 = __args[2];
34203             var contentManager_5 = __args[3];
34204             {
34205                 var __args_115 = arguments;
34206                 var texture_2 = null;
34207                 _this = _super.call(this, preferences_6, viewFactory_5) || this;
34208                 if (_this.texture === undefined) {
34209                     _this.texture = null;
34210                 }
34211                 if (_this.textureName === undefined) {
34212                     _this.textureName = null;
34213                 }
34214                 if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences === undefined) {
34215                     _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences = null;
34216                 }
34217                 if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory === undefined) {
34218                     _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory = null;
34219                 }
34220                 if (_this.contentManager === undefined) {
34221                     _this.contentManager = null;
34222                 }
34223                 if (_this.textureImageStepState === undefined) {
34224                     _this.textureImageStepState = null;
34225                 }
34226                 if (_this.textureAttributesStepState === undefined) {
34227                     _this.textureAttributesStepState = null;
34228                 }
34229                 if (_this.stepsView === undefined) {
34230                     _this.stepsView = null;
34231                 }
34232                 if (_this.step === undefined) {
34233                     _this.step = null;
34234                 }
34235                 if (_this.image === undefined) {
34236                     _this.image = null;
34237                 }
34238                 if (_this.name === undefined) {
34239                     _this.name = null;
34240                 }
34241                 if (_this.category === undefined) {
34242                     _this.category = null;
34243                 }
34244                 if (_this.creator === undefined) {
34245                     _this.creator = null;
34246                 }
34247                 if (_this.width === undefined) {
34248                     _this.width = 0;
34249                 }
34250                 if (_this.height === undefined) {
34251                     _this.height = 0;
34252                 }
34253                 _this.texture = texture_2;
34254                 _this.textureName = textureName_1;
34255                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences = preferences_6;
34256                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory = viewFactory_5;
34257                 _this.contentManager = contentManager_5;
34258                 /* Use propertyChangeSupport defined in super class */ ;
34259                 _this.setTitle(_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences.getLocalizedString(ImportedTextureWizardController, texture_2 == null ? "importTextureWizard.title" : "modifyTextureWizard.title"));
34260                 _this.textureImageStepState = new ImportedTextureWizardController.TextureImageStepState(_this);
34261                 _this.textureAttributesStepState = new ImportedTextureWizardController.TextureAttributesStepState(_this);
34262                 _this.setStepState(_this.textureImageStepState);
34263             }
34264             if (_this.texture === undefined) {
34265                 _this.texture = null;
34266             }
34267             if (_this.textureName === undefined) {
34268                 _this.textureName = null;
34269             }
34270             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences === undefined) {
34271                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences = null;
34272             }
34273             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory === undefined) {
34274                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory = null;
34275             }
34276             if (_this.contentManager === undefined) {
34277                 _this.contentManager = null;
34278             }
34279             if (_this.textureImageStepState === undefined) {
34280                 _this.textureImageStepState = null;
34281             }
34282             if (_this.textureAttributesStepState === undefined) {
34283                 _this.textureAttributesStepState = null;
34284             }
34285             if (_this.stepsView === undefined) {
34286                 _this.stepsView = null;
34287             }
34288             if (_this.step === undefined) {
34289                 _this.step = null;
34290             }
34291             if (_this.image === undefined) {
34292                 _this.image = null;
34293             }
34294             if (_this.name === undefined) {
34295                 _this.name = null;
34296             }
34297             if (_this.category === undefined) {
34298                 _this.category = null;
34299             }
34300             if (_this.creator === undefined) {
34301                 _this.creator = null;
34302             }
34303             if (_this.width === undefined) {
34304                 _this.width = 0;
34305             }
34306             if (_this.height === undefined) {
34307                 _this.height = 0;
34308             }
34309         }
34310         else if (((texture != null && texture instanceof CatalogTexture) || texture === null) && ((textureName != null && textureName instanceof UserPreferences) || textureName === null) && ((preferences != null && (preferences.constructor != null && preferences.constructor["__interfaces"] != null && preferences.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || viewFactory === null) && contentManager === undefined) {
34311             var __args = arguments;
34312             var preferences_7 = __args[1];
34313             var viewFactory_6 = __args[2];
34314             var contentManager_6 = __args[3];
34315             {
34316                 var __args_116 = arguments;
34317                 var textureName_2 = null;
34318                 _this = _super.call(this, preferences_7, viewFactory_6) || this;
34319                 if (_this.texture === undefined) {
34320                     _this.texture = null;
34321                 }
34322                 if (_this.textureName === undefined) {
34323                     _this.textureName = null;
34324                 }
34325                 if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences === undefined) {
34326                     _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences = null;
34327                 }
34328                 if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory === undefined) {
34329                     _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory = null;
34330                 }
34331                 if (_this.contentManager === undefined) {
34332                     _this.contentManager = null;
34333                 }
34334                 if (_this.textureImageStepState === undefined) {
34335                     _this.textureImageStepState = null;
34336                 }
34337                 if (_this.textureAttributesStepState === undefined) {
34338                     _this.textureAttributesStepState = null;
34339                 }
34340                 if (_this.stepsView === undefined) {
34341                     _this.stepsView = null;
34342                 }
34343                 if (_this.step === undefined) {
34344                     _this.step = null;
34345                 }
34346                 if (_this.image === undefined) {
34347                     _this.image = null;
34348                 }
34349                 if (_this.name === undefined) {
34350                     _this.name = null;
34351                 }
34352                 if (_this.category === undefined) {
34353                     _this.category = null;
34354                 }
34355                 if (_this.creator === undefined) {
34356                     _this.creator = null;
34357                 }
34358                 if (_this.width === undefined) {
34359                     _this.width = 0;
34360                 }
34361                 if (_this.height === undefined) {
34362                     _this.height = 0;
34363                 }
34364                 _this.texture = texture;
34365                 _this.textureName = textureName_2;
34366                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences = preferences_7;
34367                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory = viewFactory_6;
34368                 _this.contentManager = contentManager_6;
34369                 /* Use propertyChangeSupport defined in super class */ ;
34370                 _this.setTitle(_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences.getLocalizedString(ImportedTextureWizardController, texture == null ? "importTextureWizard.title" : "modifyTextureWizard.title"));
34371                 _this.textureImageStepState = new ImportedTextureWizardController.TextureImageStepState(_this);
34372                 _this.textureAttributesStepState = new ImportedTextureWizardController.TextureAttributesStepState(_this);
34373                 _this.setStepState(_this.textureImageStepState);
34374             }
34375             if (_this.texture === undefined) {
34376                 _this.texture = null;
34377             }
34378             if (_this.textureName === undefined) {
34379                 _this.textureName = null;
34380             }
34381             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences === undefined) {
34382                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences = null;
34383             }
34384             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory === undefined) {
34385                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory = null;
34386             }
34387             if (_this.contentManager === undefined) {
34388                 _this.contentManager = null;
34389             }
34390             if (_this.textureImageStepState === undefined) {
34391                 _this.textureImageStepState = null;
34392             }
34393             if (_this.textureAttributesStepState === undefined) {
34394                 _this.textureAttributesStepState = null;
34395             }
34396             if (_this.stepsView === undefined) {
34397                 _this.stepsView = null;
34398             }
34399             if (_this.step === undefined) {
34400                 _this.step = null;
34401             }
34402             if (_this.image === undefined) {
34403                 _this.image = null;
34404             }
34405             if (_this.name === undefined) {
34406                 _this.name = null;
34407             }
34408             if (_this.category === undefined) {
34409                 _this.category = null;
34410             }
34411             if (_this.creator === undefined) {
34412                 _this.creator = null;
34413             }
34414             if (_this.width === undefined) {
34415                 _this.width = 0;
34416             }
34417             if (_this.height === undefined) {
34418                 _this.height = 0;
34419             }
34420         }
34421         else if (((texture != null && texture instanceof UserPreferences) || texture === null) && ((textureName != null && (textureName.constructor != null && textureName.constructor["__interfaces"] != null && textureName.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || textureName === null) && ((preferences != null && (preferences.constructor != null && preferences.constructor["__interfaces"] != null && preferences.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || preferences === null) && viewFactory === undefined && contentManager === undefined) {
34422             var __args = arguments;
34423             var preferences_8 = __args[0];
34424             var viewFactory_7 = __args[1];
34425             var contentManager_7 = __args[2];
34426             {
34427                 var __args_117 = arguments;
34428                 var texture_3 = null;
34429                 var textureName_3 = null;
34430                 _this = _super.call(this, preferences_8, viewFactory_7) || this;
34431                 if (_this.texture === undefined) {
34432                     _this.texture = null;
34433                 }
34434                 if (_this.textureName === undefined) {
34435                     _this.textureName = null;
34436                 }
34437                 if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences === undefined) {
34438                     _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences = null;
34439                 }
34440                 if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory === undefined) {
34441                     _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory = null;
34442                 }
34443                 if (_this.contentManager === undefined) {
34444                     _this.contentManager = null;
34445                 }
34446                 if (_this.textureImageStepState === undefined) {
34447                     _this.textureImageStepState = null;
34448                 }
34449                 if (_this.textureAttributesStepState === undefined) {
34450                     _this.textureAttributesStepState = null;
34451                 }
34452                 if (_this.stepsView === undefined) {
34453                     _this.stepsView = null;
34454                 }
34455                 if (_this.step === undefined) {
34456                     _this.step = null;
34457                 }
34458                 if (_this.image === undefined) {
34459                     _this.image = null;
34460                 }
34461                 if (_this.name === undefined) {
34462                     _this.name = null;
34463                 }
34464                 if (_this.category === undefined) {
34465                     _this.category = null;
34466                 }
34467                 if (_this.creator === undefined) {
34468                     _this.creator = null;
34469                 }
34470                 if (_this.width === undefined) {
34471                     _this.width = 0;
34472                 }
34473                 if (_this.height === undefined) {
34474                     _this.height = 0;
34475                 }
34476                 _this.texture = texture_3;
34477                 _this.textureName = textureName_3;
34478                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences = preferences_8;
34479                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory = viewFactory_7;
34480                 _this.contentManager = contentManager_7;
34481                 /* Use propertyChangeSupport defined in super class */ ;
34482                 _this.setTitle(_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences.getLocalizedString(ImportedTextureWizardController, texture_3 == null ? "importTextureWizard.title" : "modifyTextureWizard.title"));
34483                 _this.textureImageStepState = new ImportedTextureWizardController.TextureImageStepState(_this);
34484                 _this.textureAttributesStepState = new ImportedTextureWizardController.TextureAttributesStepState(_this);
34485                 _this.setStepState(_this.textureImageStepState);
34486             }
34487             if (_this.texture === undefined) {
34488                 _this.texture = null;
34489             }
34490             if (_this.textureName === undefined) {
34491                 _this.textureName = null;
34492             }
34493             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences === undefined) {
34494                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences = null;
34495             }
34496             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory === undefined) {
34497                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory = null;
34498             }
34499             if (_this.contentManager === undefined) {
34500                 _this.contentManager = null;
34501             }
34502             if (_this.textureImageStepState === undefined) {
34503                 _this.textureImageStepState = null;
34504             }
34505             if (_this.textureAttributesStepState === undefined) {
34506                 _this.textureAttributesStepState = null;
34507             }
34508             if (_this.stepsView === undefined) {
34509                 _this.stepsView = null;
34510             }
34511             if (_this.step === undefined) {
34512                 _this.step = null;
34513             }
34514             if (_this.image === undefined) {
34515                 _this.image = null;
34516             }
34517             if (_this.name === undefined) {
34518                 _this.name = null;
34519             }
34520             if (_this.category === undefined) {
34521                 _this.category = null;
34522             }
34523             if (_this.creator === undefined) {
34524                 _this.creator = null;
34525             }
34526             if (_this.width === undefined) {
34527                 _this.width = 0;
34528             }
34529             if (_this.height === undefined) {
34530                 _this.height = 0;
34531             }
34532         }
34533         else
34534             throw new Error('invalid overload');
34535         return _this;
34536     }
34537     /**
34538      * Changes background image in model and posts an undoable operation.
34539      */
34540     ImportedTextureWizardController.prototype.finish = function () {
34541         var newTexture = new CatalogTexture(null, this.getName(), this.getImage(), this.getWidth(), this.getHeight(), this.getCreator(), true);
34542         var catalog = this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences.getTexturesCatalog();
34543         if (this.texture != null) {
34544             catalog["delete"](this.texture);
34545         }
34546         catalog.add(this.category, newTexture);
34547     };
34548     /**
34549      * Returns the content manager of this controller.
34550      * @return {Object}
34551      */
34552     ImportedTextureWizardController.prototype.getContentManager = function () {
34553         return this.contentManager;
34554     };
34555     /**
34556      * Returns the current step state.
34557      * @return {ImportedTextureWizardController.ImportedTextureWizardStepState}
34558      */
34559     ImportedTextureWizardController.prototype.getStepState = function () {
34560         return _super.prototype.getStepState.call(this);
34561     };
34562     /**
34563      * Returns the texture image step state.
34564      * @return {ImportedTextureWizardController.ImportedTextureWizardStepState}
34565      */
34566     ImportedTextureWizardController.prototype.getTextureImageStepState = function () {
34567         return this.textureImageStepState;
34568     };
34569     /**
34570      * Returns the texture attributes step state.
34571      * @return {ImportedTextureWizardController.ImportedTextureWizardStepState}
34572      */
34573     ImportedTextureWizardController.prototype.getTextureAttributesStepState = function () {
34574         return this.textureAttributesStepState;
34575     };
34576     /**
34577      * Returns the unique wizard view used for all steps.
34578      * @return {Object}
34579      */
34580     ImportedTextureWizardController.prototype.getStepsView = function () {
34581         if (this.stepsView == null) {
34582             this.stepsView = this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_viewFactory.createImportedTextureWizardStepsView(this.texture, this.textureName, this.__com_eteks_sweethome3d_viewcontroller_ImportedTextureWizardController_preferences, this);
34583         }
34584         return this.stepsView;
34585     };
34586     /**
34587      * Switch in the wizard view to the given <code>step</code>.
34588      * @param {ImportedTextureWizardController.Step} step
34589      */
34590     ImportedTextureWizardController.prototype.setStep = function (step) {
34591         if (step !== this.step) {
34592             var oldStep = this.step;
34593             this.step = step;
34594             this.propertyChangeSupport.firePropertyChange(/* name */ "STEP", oldStep, step);
34595         }
34596     };
34597     /**
34598      * Returns the current step in wizard view.
34599      * @return {ImportedTextureWizardController.Step}
34600      */
34601     ImportedTextureWizardController.prototype.getStep = function () {
34602         return this.step;
34603     };
34604     /**
34605      * Sets the image content of the imported texture.
34606      * @param {Object} image
34607      */
34608     ImportedTextureWizardController.prototype.setImage = function (image) {
34609         if (image !== this.image) {
34610             var oldImage = this.image;
34611             this.image = image;
34612             this.propertyChangeSupport.firePropertyChange(/* name */ "IMAGE", oldImage, image);
34613         }
34614     };
34615     /**
34616      * Returns the image content of the imported texture.
34617      * @return {Object}
34618      */
34619     ImportedTextureWizardController.prototype.getImage = function () {
34620         return this.image;
34621     };
34622     /**
34623      * Returns the name of the imported texture.
34624      * @return {string}
34625      */
34626     ImportedTextureWizardController.prototype.getName = function () {
34627         return this.name;
34628     };
34629     /**
34630      * Sets the name of the imported texture.
34631      * @param {string} name
34632      */
34633     ImportedTextureWizardController.prototype.setName = function (name) {
34634         if (name !== this.name) {
34635             var oldName = this.name;
34636             this.name = name;
34637             if (this.propertyChangeSupport != null) {
34638                 this.propertyChangeSupport.firePropertyChange(/* name */ "NAME", oldName, name);
34639             }
34640         }
34641     };
34642     /**
34643      * Returns the category of the imported texture.
34644      * @return {TexturesCategory}
34645      */
34646     ImportedTextureWizardController.prototype.getCategory = function () {
34647         return this.category;
34648     };
34649     /**
34650      * Sets the category of the imported texture.
34651      * @param {TexturesCategory} category
34652      */
34653     ImportedTextureWizardController.prototype.setCategory = function (category) {
34654         if (category !== this.category) {
34655             var oldCategory = this.category;
34656             this.category = category;
34657             this.propertyChangeSupport.firePropertyChange(/* name */ "CATEGORY", oldCategory, category);
34658         }
34659     };
34660     /**
34661      * Returns the creator of the imported piece.
34662      * @return {string}
34663      */
34664     ImportedTextureWizardController.prototype.getCreator = function () {
34665         return this.creator;
34666     };
34667     /**
34668      * Sets the creator of the imported piece.
34669      * @param {string} creator
34670      */
34671     ImportedTextureWizardController.prototype.setCreator = function (creator) {
34672         if (creator !== this.creator) {
34673             var oldCreator = this.creator;
34674             this.creator = creator;
34675             if (this.propertyChangeSupport != null) {
34676                 this.propertyChangeSupport.firePropertyChange(/* name */ "CREATOR", oldCreator, creator);
34677             }
34678         }
34679     };
34680     /**
34681      * Returns the width.
34682      * @return {number}
34683      */
34684     ImportedTextureWizardController.prototype.getWidth = function () {
34685         return this.width;
34686     };
34687     /**
34688      * Sets the width of the imported texture.
34689      * @param {number} width
34690      */
34691     ImportedTextureWizardController.prototype.setWidth = function (width) {
34692         if (width !== this.width) {
34693             var oldWidth = this.width;
34694             this.width = width;
34695             this.propertyChangeSupport.firePropertyChange(/* name */ "WIDTH", oldWidth, width);
34696         }
34697     };
34698     /**
34699      * Returns the height.
34700      * @return {number}
34701      */
34702     ImportedTextureWizardController.prototype.getHeight = function () {
34703         return this.height;
34704     };
34705     /**
34706      * Sets the size of the imported texture.
34707      * @param {number} height
34708      */
34709     ImportedTextureWizardController.prototype.setHeight = function (height) {
34710         if (height !== this.height) {
34711             var oldHeight = this.height;
34712             this.height = height;
34713             this.propertyChangeSupport.firePropertyChange(/* name */ "HEIGHT", oldHeight, height);
34714         }
34715     };
34716     /**
34717      * Returns <code>true</code> if texture name is valid.
34718      * @return {boolean}
34719      */
34720     ImportedTextureWizardController.prototype.isTextureNameValid = function () {
34721         return this.name != null && this.name.length > 0 && this.category != null;
34722     };
34723     return ImportedTextureWizardController;
34724 }(WizardController));
34725 ImportedTextureWizardController["__class"] = "com.eteks.sweethome3d.viewcontroller.ImportedTextureWizardController";
34726 ImportedTextureWizardController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
34727 (function (ImportedTextureWizardController) {
34728     var Step;
34729     (function (Step) {
34730         Step[Step["IMAGE"] = 0] = "IMAGE";
34731         Step[Step["ATTRIBUTES"] = 1] = "ATTRIBUTES";
34732     })(Step = ImportedTextureWizardController.Step || (ImportedTextureWizardController.Step = {}));
34733     /**
34734      * Step state superclass. All step state share the same step view,
34735      * that will display a different component depending on their class name.
34736      * @extends WizardController.WizardControllerStepState
34737      * @class
34738      */
34739     var ImportedTextureWizardStepState = /** @class */ (function (_super) {
34740         __extends(ImportedTextureWizardStepState, _super);
34741         function ImportedTextureWizardStepState(__parent) {
34742             var _this = _super.call(this) || this;
34743             _this.__parent = __parent;
34744             _this.icon = /* getResource */ "resources/importedTextureWizard.png";
34745             return _this;
34746         }
34747         /**
34748          *
34749          */
34750         ImportedTextureWizardStepState.prototype.enter = function () {
34751             this.__parent.setStep(this.getStep());
34752         };
34753         /**
34754          *
34755          * @return {Object}
34756          */
34757         ImportedTextureWizardStepState.prototype.getView = function () {
34758             return this.__parent.getStepsView();
34759         };
34760         /**
34761          *
34762          * @return {string}
34763          */
34764         ImportedTextureWizardStepState.prototype.getIcon = function () {
34765             return this.icon;
34766         };
34767         return ImportedTextureWizardStepState;
34768     }(WizardController.WizardControllerStepState));
34769     ImportedTextureWizardController.ImportedTextureWizardStepState = ImportedTextureWizardStepState;
34770     ImportedTextureWizardStepState["__class"] = "com.eteks.sweethome3d.viewcontroller.ImportedTextureWizardController.ImportedTextureWizardStepState";
34771     /**
34772      * Texture image choice step state (first step).
34773      * @class
34774      * @extends ImportedTextureWizardController.ImportedTextureWizardStepState
34775      */
34776     var TextureImageStepState = /** @class */ (function (_super) {
34777         __extends(TextureImageStepState, _super);
34778         function TextureImageStepState(__parent) {
34779             var _this = _super.call(this, __parent) || this;
34780             _this.__parent = __parent;
34781             __parent.addPropertyChangeListener("IMAGE", new TextureImageStepState.TextureImageStepState$0(_this));
34782             return _this;
34783         }
34784         /**
34785          *
34786          */
34787         TextureImageStepState.prototype.enter = function () {
34788             _super.prototype.enter.call(this);
34789             this.setFirstStep(true);
34790             this.setNextStepEnabled(this.__parent.getImage() != null);
34791         };
34792         /**
34793          *
34794          * @return {ImportedTextureWizardController.Step}
34795          */
34796         TextureImageStepState.prototype.getStep = function () {
34797             return ImportedTextureWizardController.Step.IMAGE;
34798         };
34799         /**
34800          *
34801          */
34802         TextureImageStepState.prototype.goToNextStep = function () {
34803             this.__parent.setStepState(this.__parent.getTextureAttributesStepState());
34804         };
34805         return TextureImageStepState;
34806     }(ImportedTextureWizardController.ImportedTextureWizardStepState));
34807     ImportedTextureWizardController.TextureImageStepState = TextureImageStepState;
34808     TextureImageStepState["__class"] = "com.eteks.sweethome3d.viewcontroller.ImportedTextureWizardController.TextureImageStepState";
34809     (function (TextureImageStepState) {
34810         var TextureImageStepState$0 = /** @class */ (function () {
34811             function TextureImageStepState$0(__parent) {
34812                 this.__parent = __parent;
34813             }
34814             TextureImageStepState$0.prototype.propertyChange = function (evt) {
34815                 this.__parent.setNextStepEnabled(this.__parent.__parent.getImage() != null);
34816             };
34817             return TextureImageStepState$0;
34818         }());
34819         TextureImageStepState.TextureImageStepState$0 = TextureImageStepState$0;
34820     })(TextureImageStepState = ImportedTextureWizardController.TextureImageStepState || (ImportedTextureWizardController.TextureImageStepState = {}));
34821     /**
34822      * Texture image attributes step state (last step).
34823      * @class
34824      * @extends ImportedTextureWizardController.ImportedTextureWizardStepState
34825      */
34826     var TextureAttributesStepState = /** @class */ (function (_super) {
34827         __extends(TextureAttributesStepState, _super);
34828         function TextureAttributesStepState(__parent) {
34829             var _this = _super.call(this, __parent) || this;
34830             _this.__parent = __parent;
34831             if (_this.widthChangeListener === undefined) {
34832                 _this.widthChangeListener = null;
34833             }
34834             if (_this.heightChangeListener === undefined) {
34835                 _this.heightChangeListener = null;
34836             }
34837             if (_this.nameAndCategoryChangeListener === undefined) {
34838                 _this.nameAndCategoryChangeListener = null;
34839             }
34840             _this.widthChangeListener = new TextureAttributesStepState.TextureAttributesStepState$0(_this);
34841             _this.heightChangeListener = new TextureAttributesStepState.TextureAttributesStepState$1(_this);
34842             _this.nameAndCategoryChangeListener = new TextureAttributesStepState.TextureAttributesStepState$2(_this);
34843             return _this;
34844         }
34845         /**
34846          *
34847          */
34848         TextureAttributesStepState.prototype.enter = function () {
34849             _super.prototype.enter.call(this);
34850             this.setLastStep(true);
34851             this.__parent.addPropertyChangeListener("WIDTH", this.widthChangeListener);
34852             this.__parent.addPropertyChangeListener("HEIGHT", this.heightChangeListener);
34853             this.__parent.addPropertyChangeListener("NAME", this.nameAndCategoryChangeListener);
34854             this.__parent.addPropertyChangeListener("CATEGORY", this.nameAndCategoryChangeListener);
34855             this.setNextStepEnabled(this.__parent.isTextureNameValid());
34856         };
34857         /**
34858          *
34859          * @return {ImportedTextureWizardController.Step}
34860          */
34861         TextureAttributesStepState.prototype.getStep = function () {
34862             return ImportedTextureWizardController.Step.ATTRIBUTES;
34863         };
34864         /**
34865          *
34866          */
34867         TextureAttributesStepState.prototype.goBackToPreviousStep = function () {
34868             this.__parent.setStepState(this.__parent.getTextureImageStepState());
34869         };
34870         /**
34871          *
34872          */
34873         TextureAttributesStepState.prototype.exit = function () {
34874             this.__parent.removePropertyChangeListener("WIDTH", this.widthChangeListener);
34875             this.__parent.removePropertyChangeListener("HEIGHT", this.heightChangeListener);
34876             this.__parent.removePropertyChangeListener("NAME", this.nameAndCategoryChangeListener);
34877             this.__parent.removePropertyChangeListener("CATEGORY", this.nameAndCategoryChangeListener);
34878         };
34879         return TextureAttributesStepState;
34880     }(ImportedTextureWizardController.ImportedTextureWizardStepState));
34881     ImportedTextureWizardController.TextureAttributesStepState = TextureAttributesStepState;
34882     TextureAttributesStepState["__class"] = "com.eteks.sweethome3d.viewcontroller.ImportedTextureWizardController.TextureAttributesStepState";
34883     (function (TextureAttributesStepState) {
34884         var TextureAttributesStepState$0 = /** @class */ (function () {
34885             function TextureAttributesStepState$0(__parent) {
34886                 this.__parent = __parent;
34887             }
34888             TextureAttributesStepState$0.prototype.propertyChange = function (ev) {
34889                 this.__parent.__parent.removePropertyChangeListener("HEIGHT", this.__parent.heightChangeListener);
34890                 var ratio = ev.getNewValue() / ev.getOldValue();
34891                 this.__parent.__parent.setHeight(this.__parent.__parent.getHeight() * ratio);
34892                 this.__parent.__parent.addPropertyChangeListener("HEIGHT", this.__parent.heightChangeListener);
34893             };
34894             return TextureAttributesStepState$0;
34895         }());
34896         TextureAttributesStepState.TextureAttributesStepState$0 = TextureAttributesStepState$0;
34897         var TextureAttributesStepState$1 = /** @class */ (function () {
34898             function TextureAttributesStepState$1(__parent) {
34899                 this.__parent = __parent;
34900             }
34901             TextureAttributesStepState$1.prototype.propertyChange = function (ev) {
34902                 this.__parent.__parent.removePropertyChangeListener("WIDTH", this.__parent.widthChangeListener);
34903                 var ratio = ev.getNewValue() / ev.getOldValue();
34904                 this.__parent.__parent.setWidth(this.__parent.__parent.getWidth() * ratio);
34905                 this.__parent.__parent.addPropertyChangeListener("WIDTH", this.__parent.widthChangeListener);
34906             };
34907             return TextureAttributesStepState$1;
34908         }());
34909         TextureAttributesStepState.TextureAttributesStepState$1 = TextureAttributesStepState$1;
34910         var TextureAttributesStepState$2 = /** @class */ (function () {
34911             function TextureAttributesStepState$2(__parent) {
34912                 this.__parent = __parent;
34913             }
34914             TextureAttributesStepState$2.prototype.propertyChange = function (ev) {
34915                 this.__parent.setNextStepEnabled(this.__parent.__parent.isTextureNameValid());
34916             };
34917             return TextureAttributesStepState$2;
34918         }());
34919         TextureAttributesStepState.TextureAttributesStepState$2 = TextureAttributesStepState$2;
34920     })(TextureAttributesStepState = ImportedTextureWizardController.TextureAttributesStepState || (ImportedTextureWizardController.TextureAttributesStepState = {}));
34921 })(ImportedTextureWizardController || (ImportedTextureWizardController = {}));
34922 /**
34923  * Creates the controller of dimension line view with undo support.
34924  * @param {Home} home
34925  * @param {number} x
34926  * @param {number} y
34927  * @param {UserPreferences} preferences
34928  * @param {Object} viewFactory
34929  * @param {javax.swing.undo.UndoableEditSupport} undoSupport
34930  * @class
34931  * @author Emmanuel Puybaret
34932  */
34933 var DimensionLineController = /** @class */ (function () {
34934     function DimensionLineController(home, x, y, preferences, viewFactory, undoSupport) {
34935         if (((home != null && home instanceof Home) || home === null) && ((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((preferences != null && preferences instanceof UserPreferences) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || viewFactory === null) && ((undoSupport != null && undoSupport instanceof javax.swing.undo.UndoableEditSupport) || undoSupport === null)) {
34936             var __args = arguments;
34937             if (this.home === undefined) {
34938                 this.home = null;
34939             }
34940             if (this.preferences === undefined) {
34941                 this.preferences = null;
34942             }
34943             if (this.viewFactory === undefined) {
34944                 this.viewFactory = null;
34945             }
34946             if (this.undoSupport === undefined) {
34947                 this.undoSupport = null;
34948             }
34949             if (this.propertyChangeSupport === undefined) {
34950                 this.propertyChangeSupport = null;
34951             }
34952             if (this.dimensionLineView === undefined) {
34953                 this.dimensionLineView = null;
34954             }
34955             if (this.dimensionLineModification === undefined) {
34956                 this.dimensionLineModification = false;
34957             }
34958             if (this.editableDistance === undefined) {
34959                 this.editableDistance = false;
34960             }
34961             if (this.xStart === undefined) {
34962                 this.xStart = null;
34963             }
34964             if (this.yStart === undefined) {
34965                 this.yStart = null;
34966             }
34967             if (this.elevationStart === undefined) {
34968                 this.elevationStart = null;
34969             }
34970             if (this.xEnd === undefined) {
34971                 this.xEnd = null;
34972             }
34973             if (this.yEnd === undefined) {
34974                 this.yEnd = null;
34975             }
34976             if (this.elevationEnd === undefined) {
34977                 this.elevationEnd = null;
34978             }
34979             if (this.distanceToEndPoint === undefined) {
34980                 this.distanceToEndPoint = null;
34981             }
34982             if (this.orientation === undefined) {
34983                 this.orientation = null;
34984             }
34985             if (this.offset === undefined) {
34986                 this.offset = null;
34987             }
34988             if (this.lengthFontSize === undefined) {
34989                 this.lengthFontSize = null;
34990             }
34991             if (this.color === undefined) {
34992                 this.color = null;
34993             }
34994             if (this.visibleIn3D === undefined) {
34995                 this.visibleIn3D = null;
34996             }
34997             if (this.pitch === undefined) {
34998                 this.pitch = null;
34999             }
35000             this.home = home;
35001             this.preferences = preferences;
35002             this.viewFactory = viewFactory;
35003             this.undoSupport = undoSupport;
35004             this.propertyChangeSupport = new PropertyChangeSupport(this);
35005             this.dimensionLineModification = false;
35006             this.xStart = this.xEnd = x;
35007             this.yStart = this.yEnd = y;
35008             this.editableDistance = true;
35009             this.elevationStart = 0.0;
35010             this.elevationEnd = this.distanceToEndPoint = home.getWallHeight();
35011             this.offset = 20.0;
35012             this.orientation = DimensionLineController.DimensionLineOrientation.ELEVATION;
35013             this.lengthFontSize = preferences.getDefaultTextStyle(DimensionLine).getFontSize();
35014             this.visibleIn3D = true;
35015             this.pitch = (-Math.PI / 2);
35016         }
35017         else if (((home != null && home instanceof Home) || home === null) && ((x != null && x instanceof UserPreferences) || x === null) && ((y != null && (y.constructor != null && y.constructor["__interfaces"] != null && y.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || y === null) && ((preferences != null && preferences instanceof javax.swing.undo.UndoableEditSupport) || preferences === null) && viewFactory === undefined && undoSupport === undefined) {
35018             var __args = arguments;
35019             var preferences_9 = __args[1];
35020             var viewFactory_8 = __args[2];
35021             var undoSupport_2 = __args[3];
35022             if (this.home === undefined) {
35023                 this.home = null;
35024             }
35025             if (this.preferences === undefined) {
35026                 this.preferences = null;
35027             }
35028             if (this.viewFactory === undefined) {
35029                 this.viewFactory = null;
35030             }
35031             if (this.undoSupport === undefined) {
35032                 this.undoSupport = null;
35033             }
35034             if (this.propertyChangeSupport === undefined) {
35035                 this.propertyChangeSupport = null;
35036             }
35037             if (this.dimensionLineView === undefined) {
35038                 this.dimensionLineView = null;
35039             }
35040             if (this.dimensionLineModification === undefined) {
35041                 this.dimensionLineModification = false;
35042             }
35043             if (this.editableDistance === undefined) {
35044                 this.editableDistance = false;
35045             }
35046             if (this.xStart === undefined) {
35047                 this.xStart = null;
35048             }
35049             if (this.yStart === undefined) {
35050                 this.yStart = null;
35051             }
35052             if (this.elevationStart === undefined) {
35053                 this.elevationStart = null;
35054             }
35055             if (this.xEnd === undefined) {
35056                 this.xEnd = null;
35057             }
35058             if (this.yEnd === undefined) {
35059                 this.yEnd = null;
35060             }
35061             if (this.elevationEnd === undefined) {
35062                 this.elevationEnd = null;
35063             }
35064             if (this.distanceToEndPoint === undefined) {
35065                 this.distanceToEndPoint = null;
35066             }
35067             if (this.orientation === undefined) {
35068                 this.orientation = null;
35069             }
35070             if (this.offset === undefined) {
35071                 this.offset = null;
35072             }
35073             if (this.lengthFontSize === undefined) {
35074                 this.lengthFontSize = null;
35075             }
35076             if (this.color === undefined) {
35077                 this.color = null;
35078             }
35079             if (this.visibleIn3D === undefined) {
35080                 this.visibleIn3D = null;
35081             }
35082             if (this.pitch === undefined) {
35083                 this.pitch = null;
35084             }
35085             this.home = home;
35086             this.preferences = preferences_9;
35087             this.viewFactory = viewFactory_8;
35088             this.undoSupport = undoSupport_2;
35089             this.propertyChangeSupport = new PropertyChangeSupport(this);
35090             this.dimensionLineModification = true;
35091             this.updateProperties();
35092         }
35093         else
35094             throw new Error('invalid overload');
35095     }
35096     /**
35097      * Returns the view associated with this controller.
35098      * @return {Object}
35099      */
35100     DimensionLineController.prototype.getView = function () {
35101         if (this.dimensionLineView == null) {
35102             this.dimensionLineView = this.viewFactory.createDimensionLineView(this.dimensionLineModification, this.preferences, this);
35103         }
35104         return this.dimensionLineView;
35105     };
35106     /**
35107      * Displays the view controlled by this controller.
35108      * @param {Object} parentView
35109      */
35110     DimensionLineController.prototype.displayView = function (parentView) {
35111         this.getView().displayView(parentView);
35112     };
35113     /**
35114      * Adds the property change <code>listener</code> in parameter to this controller.
35115      * @param {string} property
35116      * @param {PropertyChangeListener} listener
35117      */
35118     DimensionLineController.prototype.addPropertyChangeListener = function (property, listener) {
35119         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
35120     };
35121     /**
35122      * Removes the property change <code>listener</code> in parameter from this controller.
35123      * @param {string} property
35124      * @param {PropertyChangeListener} listener
35125      */
35126     DimensionLineController.prototype.removePropertyChangeListener = function (property, listener) {
35127         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
35128     };
35129     /**
35130      * Updates edited properties from selected dimension lines in the home edited by this controller.
35131      */
35132     DimensionLineController.prototype.updateProperties = function () {
35133         var selectedDimensionLines = Home.getDimensionLinesSubList(this.home.getSelectedItems());
35134         if ( /* isEmpty */(selectedDimensionLines.length == 0)) {
35135             this.setXStart(null);
35136             this.setYStart(null);
35137             this.setElevationStart(null);
35138             this.setXEnd(null);
35139             this.setYEnd(null);
35140             this.setElevationEnd(null);
35141             this.setEditableDistance(false);
35142             this.setOrientation(null);
35143             this.setOffset(null);
35144             this.setLengthFontSize(null);
35145             this.setColor(null);
35146             this.setVisibleIn3D(null);
35147             this.setPitch(null);
35148         }
35149         else {
35150             var firstDimensionLine = selectedDimensionLines[0];
35151             var xStart = firstDimensionLine.getXStart();
35152             for (var i = 1; i < /* size */ selectedDimensionLines.length; i++) {
35153                 {
35154                     if (!(xStart === /* get */ selectedDimensionLines[i].getXStart())) {
35155                         xStart = null;
35156                         break;
35157                     }
35158                 }
35159                 ;
35160             }
35161             this.setXStart(xStart);
35162             var yStart = firstDimensionLine.getYStart();
35163             for (var i = 1; i < /* size */ selectedDimensionLines.length; i++) {
35164                 {
35165                     if (!(yStart === /* get */ selectedDimensionLines[i].getYStart())) {
35166                         yStart = null;
35167                         break;
35168                     }
35169                 }
35170                 ;
35171             }
35172             this.setYStart(yStart);
35173             var elevationStart = firstDimensionLine.getElevationStart();
35174             for (var i = 1; i < /* size */ selectedDimensionLines.length; i++) {
35175                 {
35176                     if (!(elevationStart === /* get */ selectedDimensionLines[i].getElevationStart())) {
35177                         elevationStart = null;
35178                         break;
35179                     }
35180                 }
35181                 ;
35182             }
35183             this.setElevationStart(elevationStart);
35184             var xEnd = firstDimensionLine.getXEnd();
35185             for (var i = 1; i < /* size */ selectedDimensionLines.length; i++) {
35186                 {
35187                     if (!(xEnd === /* get */ selectedDimensionLines[i].getXEnd())) {
35188                         xEnd = null;
35189                         break;
35190                     }
35191                 }
35192                 ;
35193             }
35194             this.setXEnd(xEnd);
35195             var yEnd = firstDimensionLine.getYEnd();
35196             for (var i = 1; i < /* size */ selectedDimensionLines.length; i++) {
35197                 {
35198                     if (!(yEnd === /* get */ selectedDimensionLines[i].getYEnd())) {
35199                         yEnd = null;
35200                         break;
35201                     }
35202                 }
35203                 ;
35204             }
35205             this.setYEnd(yEnd);
35206             var elevationEnd = firstDimensionLine.getElevationEnd();
35207             var elevationDimensionLine = firstDimensionLine.isElevationDimensionLine();
35208             for (var i = 1; i < /* size */ selectedDimensionLines.length; i++) {
35209                 {
35210                     if (!(elevationEnd === /* get */ selectedDimensionLines[i].getElevationEnd()) || elevationDimensionLine !== /* get */ selectedDimensionLines[i].isElevationDimensionLine()) {
35211                         elevationEnd = null;
35212                         break;
35213                     }
35214                 }
35215                 ;
35216             }
35217             this.setElevationEnd(elevationEnd);
35218             this.setEditableDistance(this.getXStart() != null && this.getYStart() != null && this.getElevationStart() != null && this.getXEnd() != null && this.getYEnd() != null && this.getElevationEnd() != null);
35219             var orientation_1 = null;
35220             if (firstDimensionLine.isElevationDimensionLine()) {
35221                 orientation_1 = DimensionLineController.DimensionLineOrientation.ELEVATION;
35222             }
35223             else if (firstDimensionLine.getElevationStart() === firstDimensionLine.getElevationEnd()) {
35224                 orientation_1 = DimensionLineController.DimensionLineOrientation.PLAN;
35225             }
35226             for (var i = 1; i < /* size */ selectedDimensionLines.length; i++) {
35227                 {
35228                     var dimensionLine = selectedDimensionLines[i];
35229                     if (dimensionLine.isElevationDimensionLine() && orientation_1 !== DimensionLineController.DimensionLineOrientation.ELEVATION || dimensionLine.getElevationStart() === dimensionLine.getElevationEnd() && orientation_1 !== DimensionLineController.DimensionLineOrientation.PLAN) {
35230                         orientation_1 = null;
35231                         break;
35232                     }
35233                 }
35234                 ;
35235             }
35236             this.setOrientation(orientation_1, false);
35237             var offset = firstDimensionLine.getOffset();
35238             for (var i = 1; i < /* size */ selectedDimensionLines.length; i++) {
35239                 {
35240                     if (!(offset === /* get */ selectedDimensionLines[i].getOffset())) {
35241                         offset = null;
35242                         break;
35243                     }
35244                 }
35245                 ;
35246             }
35247             this.setOffset(offset);
35248             var defaultFontSize = this.preferences.getDefaultTextStyle(DimensionLine).getFontSize();
35249             var fontSize = firstDimensionLine.getLengthStyle() != null ? firstDimensionLine.getLengthStyle().getFontSize() : defaultFontSize;
35250             for (var i = 1; i < /* size */ selectedDimensionLines.length; i++) {
35251                 {
35252                     var dimensionLine = selectedDimensionLines[i];
35253                     if (!(fontSize === (dimensionLine.getLengthStyle() != null ? dimensionLine.getLengthStyle().getFontSize() : defaultFontSize))) {
35254                         fontSize = null;
35255                         break;
35256                     }
35257                 }
35258                 ;
35259             }
35260             this.setLengthFontSize(fontSize);
35261             var color = firstDimensionLine.getColor();
35262             if (color != null) {
35263                 for (var i = 1; i < /* size */ selectedDimensionLines.length; i++) {
35264                     {
35265                         if (!(color === /* get */ selectedDimensionLines[i].getColor())) {
35266                             color = null;
35267                             break;
35268                         }
35269                     }
35270                     ;
35271                 }
35272             }
35273             this.setColor(color);
35274             var visibleIn3D = firstDimensionLine.isVisibleIn3D();
35275             for (var i = 1; i < /* size */ selectedDimensionLines.length; i++) {
35276                 {
35277                     if (!(visibleIn3D === /* get */ selectedDimensionLines[i].isVisibleIn3D())) {
35278                         visibleIn3D = null;
35279                         break;
35280                     }
35281                 }
35282                 ;
35283             }
35284             this.setVisibleIn3D(visibleIn3D);
35285             var pitch = firstDimensionLine.getPitch();
35286             for (var i = 1; i < /* size */ selectedDimensionLines.length; i++) {
35287                 {
35288                     if (!(pitch === /* get */ selectedDimensionLines[i].getPitch())) {
35289                         pitch = null;
35290                         break;
35291                     }
35292                 }
35293                 ;
35294             }
35295             this.setPitch(pitch);
35296         }
35297     };
35298     DimensionLineController.prototype.setXStart = function (xStart, updateXEnd) {
35299         if (updateXEnd === void 0) { updateXEnd = true; }
35300         if (xStart !== this.xStart) {
35301             var oldXStart = this.xStart;
35302             this.xStart = xStart;
35303             this.propertyChangeSupport.firePropertyChange(/* name */ "X_START", oldXStart, xStart);
35304             if (updateXEnd && this.orientation === DimensionLineController.DimensionLineOrientation.ELEVATION) {
35305                 this.setXEnd(xStart, false);
35306             }
35307             else {
35308                 this.updateDistanceToEndPoint();
35309             }
35310         }
35311     };
35312     /**
35313      * Returns the edited abscissa of the start point.
35314      * @return {number}
35315      */
35316     DimensionLineController.prototype.getXStart = function () {
35317         return this.xStart;
35318     };
35319     DimensionLineController.prototype.setYStart = function (yStart, updateYEnd) {
35320         if (updateYEnd === void 0) { updateYEnd = true; }
35321         if (yStart !== this.yStart) {
35322             var oldYStart = this.yStart;
35323             this.yStart = yStart;
35324             this.propertyChangeSupport.firePropertyChange(/* name */ "Y_START", oldYStart, yStart);
35325             if (updateYEnd && this.orientation === DimensionLineController.DimensionLineOrientation.ELEVATION) {
35326                 this.setYEnd(yStart, false);
35327             }
35328             else {
35329                 this.updateDistanceToEndPoint();
35330             }
35331         }
35332     };
35333     /**
35334      * Returns the edited ordinate of the start point.
35335      * @return {number}
35336      */
35337     DimensionLineController.prototype.getYStart = function () {
35338         return this.yStart;
35339     };
35340     DimensionLineController.prototype.setElevationStart = function (elevationStart, updateElevationEnd) {
35341         if (updateElevationEnd === void 0) { updateElevationEnd = true; }
35342         if (elevationStart !== this.elevationStart) {
35343             var oldElevationStart = this.elevationStart;
35344             this.elevationStart = elevationStart;
35345             this.propertyChangeSupport.firePropertyChange(/* name */ "ELEVATION_START", oldElevationStart, elevationStart);
35346             if (updateElevationEnd && this.orientation === DimensionLineController.DimensionLineOrientation.PLAN) {
35347                 this.setElevationEnd(elevationStart, false);
35348             }
35349             else {
35350                 this.updateDistanceToEndPoint();
35351             }
35352         }
35353     };
35354     /**
35355      * Returns the edited elevation of the start point.
35356      * @return {number}
35357      */
35358     DimensionLineController.prototype.getElevationStart = function () {
35359         return this.elevationStart;
35360     };
35361     DimensionLineController.prototype.setXEnd = function (xEnd, updateXStart) {
35362         if (updateXStart === void 0) { updateXStart = true; }
35363         if (xEnd !== this.xEnd) {
35364             var oldXEnd = this.xEnd;
35365             this.xEnd = xEnd;
35366             this.propertyChangeSupport.firePropertyChange(/* name */ "X_END", oldXEnd, xEnd);
35367             if (updateXStart && this.orientation === DimensionLineController.DimensionLineOrientation.ELEVATION) {
35368                 this.setXStart(xEnd, false);
35369             }
35370             else {
35371                 this.updateDistanceToEndPoint();
35372             }
35373         }
35374     };
35375     /**
35376      * Returns the edited abscissa of the end point.
35377      * @return {number}
35378      */
35379     DimensionLineController.prototype.getXEnd = function () {
35380         return this.xEnd;
35381     };
35382     DimensionLineController.prototype.setYEnd = function (yEnd, updateYStart) {
35383         if (updateYStart === void 0) { updateYStart = true; }
35384         if (yEnd !== this.yEnd) {
35385             var oldYEnd = this.yEnd;
35386             this.yEnd = yEnd;
35387             this.propertyChangeSupport.firePropertyChange(/* name */ "Y_END", oldYEnd, yEnd);
35388             if (updateYStart && this.orientation === DimensionLineController.DimensionLineOrientation.ELEVATION) {
35389                 this.setYStart(yEnd, false);
35390             }
35391             else {
35392                 this.updateDistanceToEndPoint();
35393             }
35394         }
35395     };
35396     /**
35397      * Returns the edited ordinate of the end point.
35398      * @return {number}
35399      */
35400     DimensionLineController.prototype.getYEnd = function () {
35401         return this.yEnd;
35402     };
35403     DimensionLineController.prototype.setElevationEnd = function (elevationEnd, updateElevationStart) {
35404         if (updateElevationStart === void 0) { updateElevationStart = true; }
35405         if (elevationEnd !== this.elevationEnd) {
35406             var oldElevationEnd = this.elevationEnd;
35407             this.elevationEnd = elevationEnd;
35408             this.propertyChangeSupport.firePropertyChange(/* name */ "ELEVATION_END", oldElevationEnd, elevationEnd);
35409             if (updateElevationStart && this.orientation === DimensionLineController.DimensionLineOrientation.PLAN) {
35410                 this.setElevationStart(elevationEnd, false);
35411             }
35412             else {
35413                 this.updateDistanceToEndPoint();
35414             }
35415         }
35416     };
35417     /**
35418      * Returns the edited elevation of the end point.
35419      * @return {number}
35420      */
35421     DimensionLineController.prototype.getElevationEnd = function () {
35422         return this.elevationEnd;
35423     };
35424     /**
35425      * Updates the edited distance to end point after its coordinates change.
35426      * @private
35427      */
35428     DimensionLineController.prototype.updateDistanceToEndPoint = function () {
35429         var xStart = this.getXStart();
35430         var yStart = this.getYStart();
35431         var elevationStart = this.getElevationStart();
35432         var xEnd = this.getXEnd();
35433         var yEnd = this.getYEnd();
35434         var elevationEnd = this.getElevationEnd();
35435         if (xStart != null && yStart != null && elevationStart != null && xEnd != null && yEnd != null && elevationEnd != null) {
35436             var dimensionLine = new DimensionLine(xStart, yStart, elevationStart, xEnd, yEnd, elevationEnd, 0);
35437             this.setDistanceToEndPoint(dimensionLine.getLength(), false);
35438         }
35439         else {
35440             this.setDistanceToEndPoint(null, false);
35441         }
35442     };
35443     DimensionLineController.prototype.setDistanceToEndPoint = function (distanceToEndPoint, updateEndPoint) {
35444         if (updateEndPoint === void 0) { updateEndPoint = true; }
35445         if (distanceToEndPoint !== this.distanceToEndPoint) {
35446             var oldDistance = this.distanceToEndPoint;
35447             this.distanceToEndPoint = distanceToEndPoint;
35448             this.propertyChangeSupport.firePropertyChange(/* name */ "DISTANCE_TO_END_POINT", oldDistance, distanceToEndPoint);
35449             if (updateEndPoint) {
35450                 var xStart = this.getXStart();
35451                 var yStart = this.getYStart();
35452                 var elevationStart = this.getElevationStart();
35453                 var xEnd = this.getXEnd();
35454                 var yEnd = this.getYEnd();
35455                 var elevationEnd = this.getElevationEnd();
35456                 if (xStart != null && yStart != null && elevationStart != null && xEnd != null && yEnd != null && elevationEnd != null && distanceToEndPoint != null) {
35457                     var dimensionLinePlanAngle = Math.atan2(yStart - yEnd, xEnd - xStart);
35458                     var dimensionLineVerticalAngle = Math.atan2(elevationEnd - elevationStart, xEnd - xStart);
35459                     this.setXEnd((xStart + distanceToEndPoint * Math.cos(dimensionLinePlanAngle) * Math.cos(dimensionLineVerticalAngle)));
35460                     this.setYEnd((yStart - distanceToEndPoint * Math.sin(dimensionLinePlanAngle) * Math.cos(dimensionLineVerticalAngle)));
35461                     this.setElevationEnd((elevationStart + distanceToEndPoint * Math.sin(dimensionLineVerticalAngle)));
35462                 }
35463                 else {
35464                     this.setXEnd(null);
35465                     this.setYEnd(null);
35466                     this.setElevationEnd(null);
35467                 }
35468             }
35469         }
35470     };
35471     /**
35472      * Returns the edited distance to end point.
35473      * @return {number}
35474      */
35475     DimensionLineController.prototype.getDistanceToEndPoint = function () {
35476         return this.distanceToEndPoint;
35477     };
35478     DimensionLineController.prototype.setOrientation = function (orientation, updateEndPointAndPitch) {
35479         if (updateEndPointAndPitch === void 0) { updateEndPointAndPitch = true; }
35480         if (orientation !== this.orientation) {
35481             var oldOrientation = this.orientation;
35482             this.orientation = orientation;
35483             this.propertyChangeSupport.firePropertyChange(/* name */ "ORIENTATION", oldOrientation, orientation);
35484             if (updateEndPointAndPitch) {
35485                 if (orientation === DimensionLineController.DimensionLineOrientation.PLAN && this.pitch !== 0 && this.pitch !== (Math.PI / 2)) {
35486                     this.setPitch(0.0);
35487                 }
35488                 if (this.distanceToEndPoint != null) {
35489                     var distanceToEndPoint = this.distanceToEndPoint;
35490                     var xStart = this.getXStart();
35491                     var yStart = this.getYStart();
35492                     var elevationStart = this.getElevationStart();
35493                     if (orientation === DimensionLineController.DimensionLineOrientation.PLAN) {
35494                         this.setElevationEnd(elevationStart, false);
35495                         this.setYEnd(yStart, false);
35496                         this.setXEnd(xStart + distanceToEndPoint, false);
35497                     }
35498                     else if (orientation === DimensionLineController.DimensionLineOrientation.ELEVATION) {
35499                         this.setXEnd(xStart, false);
35500                         this.setYEnd(yStart, false);
35501                         this.setElevationEnd(elevationStart + distanceToEndPoint, false);
35502                     }
35503                 }
35504             }
35505         }
35506     };
35507     /**
35508      * Returns the edited orientation.
35509      * @return {DimensionLineController.DimensionLineOrientation}
35510      */
35511     DimensionLineController.prototype.getOrientation = function () {
35512         return this.orientation;
35513     };
35514     /**
35515      * Sets whether the distance can be be edited or not.
35516      * @param {boolean} editableDistance
35517      */
35518     DimensionLineController.prototype.setEditableDistance = function (editableDistance) {
35519         if (editableDistance !== this.editableDistance) {
35520             this.editableDistance = editableDistance;
35521             this.propertyChangeSupport.firePropertyChange(/* name */ "EDITABLE_DISTANCE", !editableDistance, editableDistance);
35522         }
35523     };
35524     /**
35525      * Returns whether the distance can be be edited or not.
35526      * @return {boolean}
35527      */
35528     DimensionLineController.prototype.isEditableDistance = function () {
35529         return this.editableDistance;
35530     };
35531     /**
35532      * Sets the edited offset.
35533      * @param {number} offset
35534      */
35535     DimensionLineController.prototype.setOffset = function (offset) {
35536         if (offset !== this.offset) {
35537             var oldOffset = this.offset;
35538             this.offset = offset;
35539             this.propertyChangeSupport.firePropertyChange(/* name */ "OFFSET", oldOffset, offset);
35540         }
35541     };
35542     /**
35543      * Returns the edited offset.
35544      * @return {number}
35545      */
35546     DimensionLineController.prototype.getOffset = function () {
35547         return this.offset;
35548     };
35549     /**
35550      * Sets the edited font size.
35551      * @param {number} lengthFontSize
35552      */
35553     DimensionLineController.prototype.setLengthFontSize = function (lengthFontSize) {
35554         if (lengthFontSize !== this.lengthFontSize) {
35555             var oldLengthFontSize = this.lengthFontSize;
35556             this.lengthFontSize = lengthFontSize;
35557             this.propertyChangeSupport.firePropertyChange(/* name */ "LENGTH_FONT_SIZE", oldLengthFontSize, lengthFontSize);
35558         }
35559     };
35560     /**
35561      * Returns the edited font size.
35562      * @return {number}
35563      */
35564     DimensionLineController.prototype.getLengthFontSize = function () {
35565         return this.lengthFontSize;
35566     };
35567     /**
35568      * Sets the edited color.
35569      * @param {number} color
35570      */
35571     DimensionLineController.prototype.setColor = function (color) {
35572         if (color !== this.color) {
35573             var oldColor = this.color;
35574             this.color = color;
35575             this.propertyChangeSupport.firePropertyChange(/* name */ "COLOR", oldColor, color);
35576         }
35577     };
35578     /**
35579      * Returns the edited color.
35580      * @return {number}
35581      */
35582     DimensionLineController.prototype.getColor = function () {
35583         return this.color;
35584     };
35585     /**
35586      * Sets whether all edited dimension lines are viewed in 3D.
35587      * @param {boolean} visibleIn3D
35588      */
35589     DimensionLineController.prototype.setVisibleIn3D = function (visibleIn3D) {
35590         if (visibleIn3D !== this.visibleIn3D) {
35591             var oldVisibleIn3D = this.visibleIn3D;
35592             this.visibleIn3D = visibleIn3D;
35593             this.propertyChangeSupport.firePropertyChange(/* name */ "VISIBLE_IN_3D", oldVisibleIn3D, visibleIn3D);
35594         }
35595     };
35596     /**
35597      * Returns <code>Boolean.TRUE</code> if all edited dimension lines are viewed in 3D,
35598      * or <code>Boolean.FALSE</code> if no dimension line is viewed in 3D.
35599      * @return {boolean}
35600      */
35601     DimensionLineController.prototype.isVisibleIn3D = function () {
35602         return this.visibleIn3D;
35603     };
35604     /**
35605      * Sets the edited pitch angle.
35606      * @param {number} pitch
35607      */
35608     DimensionLineController.prototype.setPitch = function (pitch) {
35609         if (pitch !== this.pitch) {
35610             var oldPitch = this.pitch;
35611             this.pitch = pitch;
35612             this.propertyChangeSupport.firePropertyChange(/* name */ "PITCH", oldPitch, pitch);
35613         }
35614     };
35615     /**
35616      * Returns the edited pitch.
35617      * @return {number}
35618      */
35619     DimensionLineController.prototype.getPitch = function () {
35620         return this.pitch;
35621     };
35622     DimensionLineController.prototype.createDimensionLine$float$float$float$float$float$float$float = function (xStart, yStart, elevationStart, xEnd, yEnd, elevationEnd, offset) {
35623         var dimensionLine = new DimensionLine(this.getXStart(), this.getYStart(), this.getElevationStart(), this.getXEnd(), this.getYEnd(), this.getElevationEnd(), this.getOffset());
35624         this.home.addDimensionLine(dimensionLine);
35625         return dimensionLine;
35626     };
35627     /**
35628      * Returns a new dimension line instance added to home.
35629      * @param {number} xStart
35630      * @param {number} yStart
35631      * @param {number} elevationStart
35632      * @param {number} xEnd
35633      * @param {number} yEnd
35634      * @param {number} elevationEnd
35635      * @param {number} offset
35636      * @return {DimensionLine}
35637      */
35638     DimensionLineController.prototype.createDimensionLine = function (xStart, yStart, elevationStart, xEnd, yEnd, elevationEnd, offset) {
35639         if (((typeof xStart === 'number') || xStart === null) && ((typeof yStart === 'number') || yStart === null) && ((typeof elevationStart === 'number') || elevationStart === null) && ((typeof xEnd === 'number') || xEnd === null) && ((typeof yEnd === 'number') || yEnd === null) && ((typeof elevationEnd === 'number') || elevationEnd === null) && ((typeof offset === 'number') || offset === null)) {
35640             return this.createDimensionLine$float$float$float$float$float$float$float(xStart, yStart, elevationStart, xEnd, yEnd, elevationEnd, offset);
35641         }
35642         else if (xStart === undefined && yStart === undefined && elevationStart === undefined && xEnd === undefined && yEnd === undefined && elevationEnd === undefined && offset === undefined) {
35643             return this.createDimensionLine$();
35644         }
35645         else
35646             throw new Error('invalid overload');
35647     };
35648     DimensionLineController.prototype.createDimensionLine$ = function () {
35649         var oldSelection = this.home.getSelectedItems();
35650         var basePlanLocked = this.home.isBasePlanLocked();
35651         var allLevelsSelection = this.home.isAllLevelsSelection();
35652         var dimensionLine = this.createDimensionLine$float$float$float$float$float$float$float(this.getXStart(), this.getYStart(), this.getElevationStart(), this.getXEnd(), this.getYEnd(), this.getElevationEnd(), this.getOffset());
35653         var fontSize = this.getLengthFontSize();
35654         if (fontSize != null) {
35655             var style = this.preferences.getDefaultTextStyle(DimensionLine).deriveStyle$float(fontSize);
35656             dimensionLine.setLengthStyle(style);
35657         }
35658         dimensionLine.setColor(this.getColor());
35659         dimensionLine.setVisibleIn3D(this.isVisibleIn3D());
35660         dimensionLine.setPitch(this.getPitch());
35661         DimensionLineController.doAddAndSelectDimensionLine(this.home, dimensionLine, false);
35662         if (this.undoSupport != null) {
35663             var undoableEdit = new DimensionLineController.DimensionLineCreationUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), basePlanLocked, allLevelsSelection, dimensionLine);
35664             this.undoSupport.postEdit(undoableEdit);
35665         }
35666     };
35667     /**
35668      * Adds dimension line to home and selects it.
35669      * @param {Home} home
35670      * @param {DimensionLine} dimensionLine
35671      * @param {boolean} addToHome
35672      * @private
35673      */
35674     DimensionLineController.doAddAndSelectDimensionLine = function (home, dimensionLine, addToHome) {
35675         if (addToHome) {
35676             home.addDimensionLine(dimensionLine);
35677         }
35678         home.setBasePlanLocked(false);
35679         home.setSelectedItems(/* asList */ [dimensionLine].slice(0));
35680         home.setAllLevelsSelection(false);
35681     };
35682     /**
35683      * Deletes dimensionLine from home.
35684      * @param {Home} home
35685      * @param {DimensionLine} dimensionLine
35686      * @param {boolean} basePlanLocked
35687      * @private
35688      */
35689     DimensionLineController.doDeleteDimensionLine = function (home, dimensionLine, basePlanLocked) {
35690         home.deleteDimensionLine(dimensionLine);
35691         home.setBasePlanLocked(basePlanLocked);
35692     };
35693     /**
35694      * Controls the modification of selected dimension lines in edited home.
35695      */
35696     DimensionLineController.prototype.modifyDimensionLines = function () {
35697         var oldSelection = this.home.getSelectedItems();
35698         var selectedDimensionLines = Home.getDimensionLinesSubList(oldSelection);
35699         if (!(selectedDimensionLines.length == 0)) {
35700             var xStart = this.getXStart();
35701             var yStart = this.getYStart();
35702             var elevationStart = this.getElevationStart();
35703             var xEnd = this.getXEnd();
35704             var yEnd = this.getYEnd();
35705             var elevationEnd = this.getElevationEnd();
35706             var offset = this.getOffset();
35707             var lengthFontSize = this.getLengthFontSize();
35708             var color = this.getColor();
35709             var visibleIn3D = this.isVisibleIn3D();
35710             var pitch = this.getPitch();
35711             var modifiedDimensionLines = (function (s) { var a = []; while (s-- > 0)
35712                 a.push(null); return a; })(/* size */ selectedDimensionLines.length);
35713             for (var i = 0; i < modifiedDimensionLines.length; i++) {
35714                 {
35715                     modifiedDimensionLines[i] = new DimensionLineController.ModifiedDimensionLine(/* get */ selectedDimensionLines[i]);
35716                 }
35717                 ;
35718             }
35719             var defaultStyle = this.preferences.getDefaultTextStyle(DimensionLine);
35720             DimensionLineController.doModifyDimensionLines(modifiedDimensionLines, xStart, yStart, elevationStart, xEnd, yEnd, elevationEnd, offset, lengthFontSize, defaultStyle, color, visibleIn3D, pitch);
35721             if (this.undoSupport != null) {
35722                 var undoableEdit = new DimensionLineController.DimensionLinesModificationUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), modifiedDimensionLines, xStart, yStart, elevationStart, xEnd, yEnd, elevationEnd, offset, lengthFontSize, defaultStyle, color, visibleIn3D, pitch);
35723                 this.undoSupport.postEdit(undoableEdit);
35724             }
35725         }
35726     };
35727     /**
35728      * Modifies dimension lines properties with the values in parameter.
35729      * @param {com.eteks.sweethome3d.viewcontroller.DimensionLineController.ModifiedDimensionLine[]} modifiedDimensionLines
35730      * @param {number} xStart
35731      * @param {number} yStart
35732      * @param {number} elevationStart
35733      * @param {number} xEnd
35734      * @param {number} yEnd
35735      * @param {number} elevationEnd
35736      * @param {number} offset
35737      * @param {number} lengthFontSize
35738      * @param {TextStyle} defaultStyle
35739      * @param {number} color
35740      * @param {boolean} visibleIn3D
35741      * @param {number} pitch
35742      * @private
35743      */
35744     DimensionLineController.doModifyDimensionLines = function (modifiedDimensionLines, xStart, yStart, elevationStart, xEnd, yEnd, elevationEnd, offset, lengthFontSize, defaultStyle, color, visibleIn3D, pitch) {
35745         for (var index = 0; index < modifiedDimensionLines.length; index++) {
35746             var modifiedDimensionLine = modifiedDimensionLines[index];
35747             {
35748                 var dimensionLine = modifiedDimensionLine.getDimensionLine();
35749                 if (xStart != null) {
35750                     dimensionLine.setXStart(xStart);
35751                 }
35752                 if (yStart != null) {
35753                     dimensionLine.setYStart(yStart);
35754                 }
35755                 if (elevationStart != null) {
35756                     if (elevationEnd == null) {
35757                         if (dimensionLine.isElevationDimensionLine()) {
35758                             dimensionLine.setElevationEnd(elevationStart + dimensionLine.getElevationEnd() - dimensionLine.getElevationStart());
35759                         }
35760                         else {
35761                             dimensionLine.setElevationEnd(elevationStart);
35762                         }
35763                     }
35764                     dimensionLine.setElevationStart(elevationStart);
35765                 }
35766                 if (xEnd != null) {
35767                     dimensionLine.setXEnd(xEnd);
35768                 }
35769                 if (yEnd != null) {
35770                     dimensionLine.setYEnd(yEnd);
35771                 }
35772                 if (elevationEnd != null) {
35773                     dimensionLine.setElevationEnd(elevationEnd);
35774                 }
35775                 if (offset != null) {
35776                     dimensionLine.setOffset(offset);
35777                 }
35778                 if (lengthFontSize != null) {
35779                     dimensionLine.setLengthStyle(dimensionLine.getLengthStyle() != null ? dimensionLine.getLengthStyle().deriveStyle$float(lengthFontSize) : defaultStyle.deriveStyle$float(lengthFontSize));
35780                 }
35781                 if (color != null) {
35782                     dimensionLine.setColor(color);
35783                 }
35784                 if (visibleIn3D != null) {
35785                     dimensionLine.setVisibleIn3D(visibleIn3D);
35786                 }
35787                 if (pitch != null) {
35788                     dimensionLine.setPitch(pitch);
35789                 }
35790             }
35791         }
35792     };
35793     /**
35794      * Restores dimension line properties from the values stored in <code>modifiedDimensionLines</code>.
35795      * @param {com.eteks.sweethome3d.viewcontroller.DimensionLineController.ModifiedDimensionLine[]} modifiedDimensionLines
35796      * @private
35797      */
35798     DimensionLineController.undoModifyDimensionLines = function (modifiedDimensionLines) {
35799         for (var index = 0; index < modifiedDimensionLines.length; index++) {
35800             var modifiedDimensionLine = modifiedDimensionLines[index];
35801             {
35802                 modifiedDimensionLine.reset();
35803             }
35804         }
35805     };
35806     return DimensionLineController;
35807 }());
35808 DimensionLineController["__class"] = "com.eteks.sweethome3d.viewcontroller.DimensionLineController";
35809 DimensionLineController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
35810 (function (DimensionLineController) {
35811     /**
35812      * The possible values for {@linkplain #getOrientation() dimension line type}.
35813      * @enum
35814      * @property {DimensionLineController.DimensionLineOrientation} PLAN
35815      * @property {DimensionLineController.DimensionLineOrientation} ELEVATION
35816      * @property {DimensionLineController.DimensionLineOrientation} DIAGONAL
35817      * @class
35818      */
35819     var DimensionLineOrientation;
35820     (function (DimensionLineOrientation) {
35821         DimensionLineOrientation[DimensionLineOrientation["PLAN"] = 0] = "PLAN";
35822         DimensionLineOrientation[DimensionLineOrientation["ELEVATION"] = 1] = "ELEVATION";
35823         DimensionLineOrientation[DimensionLineOrientation["DIAGONAL"] = 2] = "DIAGONAL";
35824     })(DimensionLineOrientation = DimensionLineController.DimensionLineOrientation || (DimensionLineController.DimensionLineOrientation = {}));
35825     /**
35826      * Undoable edit for dimension line creation. This class isn't anonymous to avoid
35827      * being bound to controller and its view.
35828      * @extends LocalizedUndoableEdit
35829      * @class
35830      */
35831     var DimensionLineCreationUndoableEdit = /** @class */ (function (_super) {
35832         __extends(DimensionLineCreationUndoableEdit, _super);
35833         function DimensionLineCreationUndoableEdit(home, preferences, oldSelection, oldBasePlanLocked, oldAllLevelsSelection, dimensionLine) {
35834             var _this = _super.call(this, preferences, DimensionLineController, "undoCreateDimensionLineName") || this;
35835             if (_this.home === undefined) {
35836                 _this.home = null;
35837             }
35838             if (_this.oldSelection === undefined) {
35839                 _this.oldSelection = null;
35840             }
35841             if (_this.oldBasePlanLocked === undefined) {
35842                 _this.oldBasePlanLocked = false;
35843             }
35844             if (_this.oldAllLevelsSelection === undefined) {
35845                 _this.oldAllLevelsSelection = false;
35846             }
35847             if (_this.dimensionLine === undefined) {
35848                 _this.dimensionLine = null;
35849             }
35850             _this.home = home;
35851             _this.oldSelection = oldSelection;
35852             _this.oldBasePlanLocked = oldBasePlanLocked;
35853             _this.oldAllLevelsSelection = oldAllLevelsSelection;
35854             _this.dimensionLine = dimensionLine;
35855             return _this;
35856         }
35857         /**
35858          *
35859          */
35860         DimensionLineCreationUndoableEdit.prototype.undo = function () {
35861             _super.prototype.undo.call(this);
35862             DimensionLineController.doDeleteDimensionLine(this.home, this.dimensionLine, this.oldBasePlanLocked);
35863             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
35864             this.home.setAllLevelsSelection(this.oldAllLevelsSelection);
35865         };
35866         /**
35867          *
35868          */
35869         DimensionLineCreationUndoableEdit.prototype.redo = function () {
35870             _super.prototype.redo.call(this);
35871             DimensionLineController.doAddAndSelectDimensionLine(this.home, this.dimensionLine, true);
35872         };
35873         return DimensionLineCreationUndoableEdit;
35874     }(LocalizedUndoableEdit));
35875     DimensionLineController.DimensionLineCreationUndoableEdit = DimensionLineCreationUndoableEdit;
35876     DimensionLineCreationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.DimensionLineController.DimensionLineCreationUndoableEdit";
35877     DimensionLineCreationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
35878     /**
35879      * Undoable edit for dimension lines modification. This class isn't anonymous to avoid
35880      * being bound to controller and its view.
35881      * @extends LocalizedUndoableEdit
35882      * @class
35883      */
35884     var DimensionLinesModificationUndoableEdit = /** @class */ (function (_super) {
35885         __extends(DimensionLinesModificationUndoableEdit, _super);
35886         function DimensionLinesModificationUndoableEdit(home, preferences, oldSelection, modifiedDimensionLines, xStart, yStart, elevationStart, xEnd, yEnd, elevationEnd, offset, lengthFontSize, defaultStyle, color, visibleIn3D, pitch) {
35887             var _this = _super.call(this, preferences, DimensionLineController, "undoModifyDimensionLinesName") || this;
35888             if (_this.home === undefined) {
35889                 _this.home = null;
35890             }
35891             if (_this.oldSelection === undefined) {
35892                 _this.oldSelection = null;
35893             }
35894             if (_this.modifiedDimensionLines === undefined) {
35895                 _this.modifiedDimensionLines = null;
35896             }
35897             if (_this.xStart === undefined) {
35898                 _this.xStart = null;
35899             }
35900             if (_this.yStart === undefined) {
35901                 _this.yStart = null;
35902             }
35903             if (_this.elevationStart === undefined) {
35904                 _this.elevationStart = null;
35905             }
35906             if (_this.xEnd === undefined) {
35907                 _this.xEnd = null;
35908             }
35909             if (_this.yEnd === undefined) {
35910                 _this.yEnd = null;
35911             }
35912             if (_this.elevationEnd === undefined) {
35913                 _this.elevationEnd = null;
35914             }
35915             if (_this.offset === undefined) {
35916                 _this.offset = null;
35917             }
35918             if (_this.lengthFontSize === undefined) {
35919                 _this.lengthFontSize = null;
35920             }
35921             if (_this.defaultStyle === undefined) {
35922                 _this.defaultStyle = null;
35923             }
35924             if (_this.color === undefined) {
35925                 _this.color = null;
35926             }
35927             if (_this.visibleIn3D === undefined) {
35928                 _this.visibleIn3D = null;
35929             }
35930             if (_this.pitch === undefined) {
35931                 _this.pitch = null;
35932             }
35933             _this.home = home;
35934             _this.oldSelection = oldSelection;
35935             _this.modifiedDimensionLines = modifiedDimensionLines;
35936             _this.xStart = xStart;
35937             _this.yStart = yStart;
35938             _this.elevationStart = elevationStart;
35939             _this.xEnd = xEnd;
35940             _this.yEnd = yEnd;
35941             _this.elevationEnd = elevationEnd;
35942             _this.offset = offset;
35943             _this.lengthFontSize = lengthFontSize;
35944             _this.defaultStyle = defaultStyle;
35945             _this.color = color;
35946             _this.visibleIn3D = visibleIn3D;
35947             _this.pitch = pitch;
35948             return _this;
35949         }
35950         /**
35951          *
35952          */
35953         DimensionLinesModificationUndoableEdit.prototype.undo = function () {
35954             _super.prototype.undo.call(this);
35955             DimensionLineController.undoModifyDimensionLines(this.modifiedDimensionLines);
35956             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
35957         };
35958         /**
35959          *
35960          */
35961         DimensionLinesModificationUndoableEdit.prototype.redo = function () {
35962             _super.prototype.redo.call(this);
35963             DimensionLineController.doModifyDimensionLines(this.modifiedDimensionLines, this.xStart, this.yStart, this.elevationStart, this.xEnd, this.yEnd, this.elevationEnd, this.offset, this.lengthFontSize, this.defaultStyle, this.color, this.visibleIn3D, this.pitch);
35964             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
35965         };
35966         return DimensionLinesModificationUndoableEdit;
35967     }(LocalizedUndoableEdit));
35968     DimensionLineController.DimensionLinesModificationUndoableEdit = DimensionLinesModificationUndoableEdit;
35969     DimensionLinesModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.DimensionLineController.DimensionLinesModificationUndoableEdit";
35970     DimensionLinesModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
35971     /**
35972      * Stores the current properties values of a modified dimension line.
35973      * @param {DimensionLine} dimensionLine
35974      * @class
35975      */
35976     var ModifiedDimensionLine = /** @class */ (function () {
35977         function ModifiedDimensionLine(dimensionLine) {
35978             if (this.dimensionLine === undefined) {
35979                 this.dimensionLine = null;
35980             }
35981             if (this.xStart === undefined) {
35982                 this.xStart = 0;
35983             }
35984             if (this.yStart === undefined) {
35985                 this.yStart = 0;
35986             }
35987             if (this.elevationStart === undefined) {
35988                 this.elevationStart = 0;
35989             }
35990             if (this.xEnd === undefined) {
35991                 this.xEnd = 0;
35992             }
35993             if (this.yEnd === undefined) {
35994                 this.yEnd = 0;
35995             }
35996             if (this.elevationEnd === undefined) {
35997                 this.elevationEnd = 0;
35998             }
35999             if (this.offset === undefined) {
36000                 this.offset = 0;
36001             }
36002             if (this.lengthStyle === undefined) {
36003                 this.lengthStyle = null;
36004             }
36005             if (this.color === undefined) {
36006                 this.color = null;
36007             }
36008             if (this.visibleIn3D === undefined) {
36009                 this.visibleIn3D = false;
36010             }
36011             if (this.pitch === undefined) {
36012                 this.pitch = 0;
36013             }
36014             this.dimensionLine = dimensionLine;
36015             this.xStart = dimensionLine.getXStart();
36016             this.yStart = dimensionLine.getYStart();
36017             this.elevationStart = dimensionLine.getElevationStart();
36018             this.xEnd = dimensionLine.getXEnd();
36019             this.yEnd = dimensionLine.getYEnd();
36020             this.elevationEnd = dimensionLine.getElevationEnd();
36021             this.offset = dimensionLine.getOffset();
36022             this.lengthStyle = dimensionLine.getLengthStyle();
36023             this.color = dimensionLine.getColor();
36024             this.visibleIn3D = dimensionLine.isVisibleIn3D();
36025             this.pitch = dimensionLine.getPitch();
36026         }
36027         ModifiedDimensionLine.prototype.getDimensionLine = function () {
36028             return this.dimensionLine;
36029         };
36030         ModifiedDimensionLine.prototype.reset = function () {
36031             this.dimensionLine.setXStart(this.xStart);
36032             this.dimensionLine.setYStart(this.yStart);
36033             this.dimensionLine.setElevationStart(this.elevationStart);
36034             this.dimensionLine.setXEnd(this.xEnd);
36035             this.dimensionLine.setYEnd(this.yEnd);
36036             this.dimensionLine.setElevationEnd(this.elevationEnd);
36037             this.dimensionLine.setOffset(this.offset);
36038             this.dimensionLine.setLengthStyle(this.lengthStyle);
36039             this.dimensionLine.setColor(this.color);
36040             this.dimensionLine.setVisibleIn3D(this.visibleIn3D);
36041             this.dimensionLine.setPitch(this.pitch);
36042         };
36043         return ModifiedDimensionLine;
36044     }());
36045     DimensionLineController.ModifiedDimensionLine = ModifiedDimensionLine;
36046     ModifiedDimensionLine["__class"] = "com.eteks.sweethome3d.viewcontroller.DimensionLineController.ModifiedDimensionLine";
36047 })(DimensionLineController || (DimensionLineController = {}));
36048 /**
36049  * Wizard controller for background image in plan.
36050  * @author Emmanuel Puybaret
36051  * @param {Home} home
36052  * @param {UserPreferences} preferences
36053  * @param {Object} viewFactory
36054  * @param {Object} contentManager
36055  * @param {javax.swing.undo.UndoableEditSupport} undoSupport
36056  * @class
36057  * @extends WizardController
36058  */
36059 var BackgroundImageWizardController = /** @class */ (function (_super) {
36060     __extends(BackgroundImageWizardController, _super);
36061     function BackgroundImageWizardController(home, preferences, viewFactory, contentManager, undoSupport) {
36062         var _this = _super.call(this, preferences, viewFactory) || this;
36063         if (_this.home === undefined) {
36064             _this.home = null;
36065         }
36066         if (_this.__com_eteks_sweethome3d_viewcontroller_BackgroundImageWizardController_preferences === undefined) {
36067             _this.__com_eteks_sweethome3d_viewcontroller_BackgroundImageWizardController_preferences = null;
36068         }
36069         if (_this.__com_eteks_sweethome3d_viewcontroller_BackgroundImageWizardController_viewFactory === undefined) {
36070             _this.__com_eteks_sweethome3d_viewcontroller_BackgroundImageWizardController_viewFactory = null;
36071         }
36072         if (_this.contentManager === undefined) {
36073             _this.contentManager = null;
36074         }
36075         if (_this.undoSupport === undefined) {
36076             _this.undoSupport = null;
36077         }
36078         if (_this.imageChoiceStepState === undefined) {
36079             _this.imageChoiceStepState = null;
36080         }
36081         if (_this.imageScaleStepState === undefined) {
36082             _this.imageScaleStepState = null;
36083         }
36084         if (_this.imageOriginStepState === undefined) {
36085             _this.imageOriginStepState = null;
36086         }
36087         if (_this.stepsView === undefined) {
36088             _this.stepsView = null;
36089         }
36090         if (_this.step === undefined) {
36091             _this.step = null;
36092         }
36093         if (_this.referenceBackgroundImage === undefined) {
36094             _this.referenceBackgroundImage = null;
36095         }
36096         if (_this.image === undefined) {
36097             _this.image = null;
36098         }
36099         if (_this.scaleDistance === undefined) {
36100             _this.scaleDistance = null;
36101         }
36102         if (_this.scaleDistanceXStart === undefined) {
36103             _this.scaleDistanceXStart = 0;
36104         }
36105         if (_this.scaleDistanceYStart === undefined) {
36106             _this.scaleDistanceYStart = 0;
36107         }
36108         if (_this.scaleDistanceXEnd === undefined) {
36109             _this.scaleDistanceXEnd = 0;
36110         }
36111         if (_this.scaleDistanceYEnd === undefined) {
36112             _this.scaleDistanceYEnd = 0;
36113         }
36114         if (_this.xOrigin === undefined) {
36115             _this.xOrigin = 0;
36116         }
36117         if (_this.yOrigin === undefined) {
36118             _this.yOrigin = 0;
36119         }
36120         _this.home = home;
36121         _this.__com_eteks_sweethome3d_viewcontroller_BackgroundImageWizardController_preferences = preferences;
36122         _this.__com_eteks_sweethome3d_viewcontroller_BackgroundImageWizardController_viewFactory = viewFactory;
36123         _this.contentManager = contentManager;
36124         _this.undoSupport = undoSupport;
36125         /* Use propertyChangeSupport defined in super class */ ;
36126         _this.setTitle(preferences.getLocalizedString(BackgroundImageWizardController, "wizard.title"));
36127         _this.setResizable(true);
36128         _this.imageChoiceStepState = new BackgroundImageWizardController.ImageChoiceStepState(_this);
36129         _this.imageScaleStepState = new BackgroundImageWizardController.ImageScaleStepState(_this);
36130         _this.imageOriginStepState = new BackgroundImageWizardController.ImageOriginStepState(_this);
36131         _this.setStepState(_this.imageChoiceStepState);
36132         var selectedLevel = _this.home.getSelectedLevel();
36133         if (selectedLevel != null) {
36134             var levels = _this.home.getLevels();
36135             var levelIndex = levels.indexOf(selectedLevel);
36136             for (var i = levelIndex - 1; i >= 0 && _this.referenceBackgroundImage == null; i--) {
36137                 {
36138                     _this.referenceBackgroundImage = /* get */ levels[i].getBackgroundImage();
36139                 }
36140                 ;
36141             }
36142             for (var i = levelIndex + 1; i < /* size */ levels.length && _this.referenceBackgroundImage == null; i++) {
36143                 {
36144                     _this.referenceBackgroundImage = /* get */ levels[i].getBackgroundImage();
36145                 }
36146                 ;
36147             }
36148         }
36149         return _this;
36150     }
36151     /**
36152      * Changes background image in model and posts an undoable operation.
36153      */
36154     BackgroundImageWizardController.prototype.finish = function () {
36155         var selectedLevel = this.home.getSelectedLevel();
36156         var oldImage = selectedLevel != null ? selectedLevel.getBackgroundImage() : this.home.getBackgroundImage();
36157         var scaleDistancePoints = this.getScaleDistancePoints();
36158         var image = new BackgroundImage(this.getImage(), this.getScaleDistance(), scaleDistancePoints[0][0], scaleDistancePoints[0][1], scaleDistancePoints[1][0], scaleDistancePoints[1][1], this.getXOrigin(), this.getYOrigin());
36159         if (selectedLevel != null) {
36160             selectedLevel.setBackgroundImage(image);
36161         }
36162         else {
36163             this.home.setBackgroundImage(image);
36164         }
36165         var modification = oldImage == null;
36166         this.undoSupport.postEdit(new BackgroundImageWizardController.BackgroundImageUndoableEdit(this.home, this.__com_eteks_sweethome3d_viewcontroller_BackgroundImageWizardController_preferences, selectedLevel, oldImage, image, modification));
36167     };
36168     /**
36169      * Returns the content manager of this controller.
36170      * @return {Object}
36171      */
36172     BackgroundImageWizardController.prototype.getContentManager = function () {
36173         return this.contentManager;
36174     };
36175     /**
36176      * Returns the current step state.
36177      * @return {BackgroundImageWizardController.BackgroundImageWizardStepState}
36178      */
36179     BackgroundImageWizardController.prototype.getStepState = function () {
36180         return _super.prototype.getStepState.call(this);
36181     };
36182     /**
36183      * Returns the image choice step state.
36184      * @return {BackgroundImageWizardController.BackgroundImageWizardStepState}
36185      */
36186     BackgroundImageWizardController.prototype.getImageChoiceStepState = function () {
36187         return this.imageChoiceStepState;
36188     };
36189     /**
36190      * Returns the image origin step state.
36191      * @return {BackgroundImageWizardController.BackgroundImageWizardStepState}
36192      */
36193     BackgroundImageWizardController.prototype.getImageOriginStepState = function () {
36194         return this.imageOriginStepState;
36195     };
36196     /**
36197      * Returns the image scale step state.
36198      * @return {BackgroundImageWizardController.BackgroundImageWizardStepState}
36199      */
36200     BackgroundImageWizardController.prototype.getImageScaleStepState = function () {
36201         return this.imageScaleStepState;
36202     };
36203     /**
36204      * Returns the unique wizard view used for all steps.
36205      * @return {Object}
36206      */
36207     BackgroundImageWizardController.prototype.getStepsView = function () {
36208         if (this.stepsView == null) {
36209             var image = this.home.getSelectedLevel() != null ? this.home.getSelectedLevel().getBackgroundImage() : this.home.getBackgroundImage();
36210             this.stepsView = this.__com_eteks_sweethome3d_viewcontroller_BackgroundImageWizardController_viewFactory.createBackgroundImageWizardStepsView(image, this.__com_eteks_sweethome3d_viewcontroller_BackgroundImageWizardController_preferences, this);
36211         }
36212         return this.stepsView;
36213     };
36214     /**
36215      * Switch in the wizard view to the given <code>step</code>.
36216      * @param {BackgroundImageWizardController.Step} step
36217      */
36218     BackgroundImageWizardController.prototype.setStep = function (step) {
36219         if (step !== this.step) {
36220             var oldStep = this.step;
36221             this.step = step;
36222             this.propertyChangeSupport.firePropertyChange(/* name */ "STEP", oldStep, step);
36223         }
36224     };
36225     /**
36226      * Returns the current step in wizard view.
36227      * @return {BackgroundImageWizardController.Step}
36228      */
36229     BackgroundImageWizardController.prototype.getStep = function () {
36230         return this.step;
36231     };
36232     /**
36233      * Returns the background image of another level that can be used to initialize
36234      * the scale values of the edited image.
36235      * @return {BackgroundImage}
36236      */
36237     BackgroundImageWizardController.prototype.getReferenceBackgroundImage = function () {
36238         return this.referenceBackgroundImage;
36239     };
36240     /**
36241      * Sets the image content of the background image.
36242      * @param {Object} image
36243      */
36244     BackgroundImageWizardController.prototype.setImage = function (image) {
36245         if (image !== this.image) {
36246             var oldImage = this.image;
36247             this.image = image;
36248             this.propertyChangeSupport.firePropertyChange(/* name */ "IMAGE", oldImage, image);
36249         }
36250     };
36251     /**
36252      * Returns the image content of the background image.
36253      * @return {Object}
36254      */
36255     BackgroundImageWizardController.prototype.getImage = function () {
36256         return this.image;
36257     };
36258     /**
36259      * Sets the scale distance of the background image.
36260      * @param {number} scaleDistance
36261      */
36262     BackgroundImageWizardController.prototype.setScaleDistance = function (scaleDistance) {
36263         if (scaleDistance !== this.scaleDistance) {
36264             var oldScaleDistance = this.scaleDistance;
36265             this.scaleDistance = scaleDistance;
36266             this.propertyChangeSupport.firePropertyChange(/* name */ "SCALE_DISTANCE", oldScaleDistance, scaleDistance);
36267         }
36268     };
36269     /**
36270      * Returns the scale distance of the background image.
36271      * @return {number}
36272      */
36273     BackgroundImageWizardController.prototype.getScaleDistance = function () {
36274         return this.scaleDistance;
36275     };
36276     /**
36277      * Sets the coordinates of the scale distance points of the background image.
36278      * @param {number} scaleDistanceXStart
36279      * @param {number} scaleDistanceYStart
36280      * @param {number} scaleDistanceXEnd
36281      * @param {number} scaleDistanceYEnd
36282      */
36283     BackgroundImageWizardController.prototype.setScaleDistancePoints = function (scaleDistanceXStart, scaleDistanceYStart, scaleDistanceXEnd, scaleDistanceYEnd) {
36284         if (scaleDistanceXStart !== this.scaleDistanceXStart || scaleDistanceYStart !== this.scaleDistanceYStart || scaleDistanceXEnd !== this.scaleDistanceXEnd || scaleDistanceYEnd !== this.scaleDistanceYEnd) {
36285             var oldDistancePoints = [[this.scaleDistanceXStart, this.scaleDistanceYStart], [this.scaleDistanceXEnd, this.scaleDistanceYEnd]];
36286             this.scaleDistanceXStart = scaleDistanceXStart;
36287             this.scaleDistanceYStart = scaleDistanceYStart;
36288             this.scaleDistanceXEnd = scaleDistanceXEnd;
36289             this.scaleDistanceYEnd = scaleDistanceYEnd;
36290             this.propertyChangeSupport.firePropertyChange(/* name */ "SCALE_DISTANCE_POINTS", oldDistancePoints, [[scaleDistanceXStart, scaleDistanceYStart], [scaleDistanceXEnd, scaleDistanceYEnd]]);
36291         }
36292     };
36293     /**
36294      * Returns the coordinates of the scale distance points of the background image.
36295      * @return {float[][]}
36296      */
36297     BackgroundImageWizardController.prototype.getScaleDistancePoints = function () {
36298         return [[this.scaleDistanceXStart, this.scaleDistanceYStart], [this.scaleDistanceXEnd, this.scaleDistanceYEnd]];
36299     };
36300     /**
36301      * Sets the origin of the background image.
36302      * @param {number} xOrigin
36303      * @param {number} yOrigin
36304      */
36305     BackgroundImageWizardController.prototype.setOrigin = function (xOrigin, yOrigin) {
36306         if (xOrigin !== this.xOrigin) {
36307             var oldXOrigin = this.xOrigin;
36308             this.xOrigin = xOrigin;
36309             this.propertyChangeSupport.firePropertyChange(/* name */ "X_ORIGIN", oldXOrigin, xOrigin);
36310         }
36311         if (yOrigin !== this.yOrigin) {
36312             var oldYOrigin = this.yOrigin;
36313             this.yOrigin = yOrigin;
36314             this.propertyChangeSupport.firePropertyChange(/* name */ "Y_ORIGIN", oldYOrigin, yOrigin);
36315         }
36316     };
36317     /**
36318      * Returns the abscissa of the origin of the background image.
36319      * @return {number}
36320      */
36321     BackgroundImageWizardController.prototype.getXOrigin = function () {
36322         return this.xOrigin;
36323     };
36324     /**
36325      * Returns the ordinate of the origin of the background image.
36326      * @return {number}
36327      */
36328     BackgroundImageWizardController.prototype.getYOrigin = function () {
36329         return this.yOrigin;
36330     };
36331     return BackgroundImageWizardController;
36332 }(WizardController));
36333 BackgroundImageWizardController["__class"] = "com.eteks.sweethome3d.viewcontroller.BackgroundImageWizardController";
36334 BackgroundImageWizardController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
36335 (function (BackgroundImageWizardController) {
36336     var Step;
36337     (function (Step) {
36338         Step[Step["CHOICE"] = 0] = "CHOICE";
36339         Step[Step["SCALE"] = 1] = "SCALE";
36340         Step[Step["ORIGIN"] = 2] = "ORIGIN";
36341     })(Step = BackgroundImageWizardController.Step || (BackgroundImageWizardController.Step = {}));
36342     /**
36343      * Undoable edit for background image. This class isn't anonymous to avoid
36344      * being bound to controller and its view.
36345      * @extends LocalizedUndoableEdit
36346      * @class
36347      */
36348     var BackgroundImageUndoableEdit = /** @class */ (function (_super) {
36349         __extends(BackgroundImageUndoableEdit, _super);
36350         function BackgroundImageUndoableEdit(home, preferences, level, oldImage, image, modification) {
36351             var _this = _super.call(this, preferences, BackgroundImageWizardController, modification ? "undoImportBackgroundImageName" : "undoModifyBackgroundImageName") || this;
36352             if (_this.home === undefined) {
36353                 _this.home = null;
36354             }
36355             if (_this.level === undefined) {
36356                 _this.level = null;
36357             }
36358             if (_this.oldImage === undefined) {
36359                 _this.oldImage = null;
36360             }
36361             if (_this.image === undefined) {
36362                 _this.image = null;
36363             }
36364             _this.home = home;
36365             _this.level = level;
36366             _this.oldImage = oldImage;
36367             _this.image = image;
36368             return _this;
36369         }
36370         /**
36371          *
36372          */
36373         BackgroundImageUndoableEdit.prototype.undo = function () {
36374             _super.prototype.undo.call(this);
36375             this.home.setSelectedLevel(this.level);
36376             if (this.level != null) {
36377                 this.level.setBackgroundImage(this.oldImage);
36378             }
36379             else {
36380                 this.home.setBackgroundImage(this.oldImage);
36381             }
36382         };
36383         /**
36384          *
36385          */
36386         BackgroundImageUndoableEdit.prototype.redo = function () {
36387             _super.prototype.redo.call(this);
36388             this.home.setSelectedLevel(this.level);
36389             if (this.level != null) {
36390                 this.level.setBackgroundImage(this.image);
36391             }
36392             else {
36393                 this.home.setBackgroundImage(this.image);
36394             }
36395         };
36396         return BackgroundImageUndoableEdit;
36397     }(LocalizedUndoableEdit));
36398     BackgroundImageWizardController.BackgroundImageUndoableEdit = BackgroundImageUndoableEdit;
36399     BackgroundImageUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.BackgroundImageWizardController.BackgroundImageUndoableEdit";
36400     BackgroundImageUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
36401     /**
36402      * Step state superclass. All step state share the same step view,
36403      * that will display a different component depending on their class name.
36404      * @extends WizardController.WizardControllerStepState
36405      * @class
36406      */
36407     var BackgroundImageWizardStepState = /** @class */ (function (_super) {
36408         __extends(BackgroundImageWizardStepState, _super);
36409         function BackgroundImageWizardStepState(__parent) {
36410             var _this = _super.call(this) || this;
36411             _this.__parent = __parent;
36412             _this.icon = /* getResource */ "resources/backgroundImageWizard.png";
36413             return _this;
36414         }
36415         /**
36416          *
36417          */
36418         BackgroundImageWizardStepState.prototype.enter = function () {
36419             this.__parent.setStep(this.getStep());
36420         };
36421         /**
36422          *
36423          * @return {Object}
36424          */
36425         BackgroundImageWizardStepState.prototype.getView = function () {
36426             return this.__parent.getStepsView();
36427         };
36428         /**
36429          *
36430          * @return {string}
36431          */
36432         BackgroundImageWizardStepState.prototype.getIcon = function () {
36433             return this.icon;
36434         };
36435         return BackgroundImageWizardStepState;
36436     }(WizardController.WizardControllerStepState));
36437     BackgroundImageWizardController.BackgroundImageWizardStepState = BackgroundImageWizardStepState;
36438     BackgroundImageWizardStepState["__class"] = "com.eteks.sweethome3d.viewcontroller.BackgroundImageWizardController.BackgroundImageWizardStepState";
36439     /**
36440      * Image choice step state (first step).
36441      * @class
36442      * @extends BackgroundImageWizardController.BackgroundImageWizardStepState
36443      */
36444     var ImageChoiceStepState = /** @class */ (function (_super) {
36445         __extends(ImageChoiceStepState, _super);
36446         function ImageChoiceStepState(__parent) {
36447             var _this = _super.call(this, __parent) || this;
36448             _this.__parent = __parent;
36449             __parent.addPropertyChangeListener("IMAGE", new ImageChoiceStepState.ImageChoiceStepState$0(_this));
36450             return _this;
36451         }
36452         /**
36453          *
36454          */
36455         ImageChoiceStepState.prototype.enter = function () {
36456             _super.prototype.enter.call(this);
36457             this.setFirstStep(true);
36458             this.setNextStepEnabled(this.__parent.getImage() != null);
36459         };
36460         /**
36461          *
36462          * @return {BackgroundImageWizardController.Step}
36463          */
36464         ImageChoiceStepState.prototype.getStep = function () {
36465             return BackgroundImageWizardController.Step.CHOICE;
36466         };
36467         /**
36468          *
36469          */
36470         ImageChoiceStepState.prototype.goToNextStep = function () {
36471             this.__parent.setStepState(this.__parent.getImageScaleStepState());
36472         };
36473         return ImageChoiceStepState;
36474     }(BackgroundImageWizardController.BackgroundImageWizardStepState));
36475     BackgroundImageWizardController.ImageChoiceStepState = ImageChoiceStepState;
36476     ImageChoiceStepState["__class"] = "com.eteks.sweethome3d.viewcontroller.BackgroundImageWizardController.ImageChoiceStepState";
36477     (function (ImageChoiceStepState) {
36478         var ImageChoiceStepState$0 = /** @class */ (function () {
36479             function ImageChoiceStepState$0(__parent) {
36480                 this.__parent = __parent;
36481             }
36482             ImageChoiceStepState$0.prototype.propertyChange = function (evt) {
36483                 this.__parent.setNextStepEnabled(this.__parent.__parent.getImage() != null);
36484             };
36485             return ImageChoiceStepState$0;
36486         }());
36487         ImageChoiceStepState.ImageChoiceStepState$0 = ImageChoiceStepState$0;
36488     })(ImageChoiceStepState = BackgroundImageWizardController.ImageChoiceStepState || (BackgroundImageWizardController.ImageChoiceStepState = {}));
36489     /**
36490      * Image scale step state (second step).
36491      * @class
36492      * @extends BackgroundImageWizardController.BackgroundImageWizardStepState
36493      */
36494     var ImageScaleStepState = /** @class */ (function (_super) {
36495         __extends(ImageScaleStepState, _super);
36496         function ImageScaleStepState(__parent) {
36497             var _this = _super.call(this, __parent) || this;
36498             _this.__parent = __parent;
36499             __parent.addPropertyChangeListener("SCALE_DISTANCE", new ImageScaleStepState.ImageScaleStepState$0(_this));
36500             return _this;
36501         }
36502         /**
36503          *
36504          */
36505         ImageScaleStepState.prototype.enter = function () {
36506             _super.prototype.enter.call(this);
36507             this.setNextStepEnabled(this.__parent.getScaleDistance() != null);
36508         };
36509         /**
36510          *
36511          * @return {BackgroundImageWizardController.Step}
36512          */
36513         ImageScaleStepState.prototype.getStep = function () {
36514             return BackgroundImageWizardController.Step.SCALE;
36515         };
36516         /**
36517          *
36518          */
36519         ImageScaleStepState.prototype.goBackToPreviousStep = function () {
36520             this.__parent.setStepState(this.__parent.getImageChoiceStepState());
36521         };
36522         /**
36523          *
36524          */
36525         ImageScaleStepState.prototype.goToNextStep = function () {
36526             this.__parent.setStepState(this.__parent.getImageOriginStepState());
36527         };
36528         return ImageScaleStepState;
36529     }(BackgroundImageWizardController.BackgroundImageWizardStepState));
36530     BackgroundImageWizardController.ImageScaleStepState = ImageScaleStepState;
36531     ImageScaleStepState["__class"] = "com.eteks.sweethome3d.viewcontroller.BackgroundImageWizardController.ImageScaleStepState";
36532     (function (ImageScaleStepState) {
36533         var ImageScaleStepState$0 = /** @class */ (function () {
36534             function ImageScaleStepState$0(__parent) {
36535                 this.__parent = __parent;
36536             }
36537             ImageScaleStepState$0.prototype.propertyChange = function (evt) {
36538                 this.__parent.setNextStepEnabled(this.__parent.__parent.getScaleDistance() != null);
36539             };
36540             return ImageScaleStepState$0;
36541         }());
36542         ImageScaleStepState.ImageScaleStepState$0 = ImageScaleStepState$0;
36543     })(ImageScaleStepState = BackgroundImageWizardController.ImageScaleStepState || (BackgroundImageWizardController.ImageScaleStepState = {}));
36544     /**
36545      * Image origin step state (last step).
36546      * @extends BackgroundImageWizardController.BackgroundImageWizardStepState
36547      * @class
36548      */
36549     var ImageOriginStepState = /** @class */ (function (_super) {
36550         __extends(ImageOriginStepState, _super);
36551         function ImageOriginStepState(__parent) {
36552             var _this = _super.call(this, __parent) || this;
36553             _this.__parent = __parent;
36554             return _this;
36555         }
36556         /**
36557          *
36558          */
36559         ImageOriginStepState.prototype.enter = function () {
36560             _super.prototype.enter.call(this);
36561             this.setLastStep(true);
36562             this.setNextStepEnabled(true);
36563         };
36564         /**
36565          *
36566          * @return {BackgroundImageWizardController.Step}
36567          */
36568         ImageOriginStepState.prototype.getStep = function () {
36569             return BackgroundImageWizardController.Step.ORIGIN;
36570         };
36571         /**
36572          *
36573          */
36574         ImageOriginStepState.prototype.goBackToPreviousStep = function () {
36575             this.__parent.setStepState(this.__parent.getImageScaleStepState());
36576         };
36577         return ImageOriginStepState;
36578     }(BackgroundImageWizardController.BackgroundImageWizardStepState));
36579     BackgroundImageWizardController.ImageOriginStepState = ImageOriginStepState;
36580     ImageOriginStepState["__class"] = "com.eteks.sweethome3d.viewcontroller.BackgroundImageWizardController.ImageOriginStepState";
36581 })(BackgroundImageWizardController || (BackgroundImageWizardController = {}));
36582 /**
36583  * Creates the controller of room view with undo support.
36584  * @param {Home} home
36585  * @param {UserPreferences} preferences
36586  * @param {Object} viewFactory
36587  * @param {Object} contentManager
36588  * @param {javax.swing.undo.UndoableEditSupport} undoSupport
36589  * @class
36590  * @author Emmanuel Puybaret
36591  */
36592 var RoomController = /** @class */ (function () {
36593     function RoomController(home, preferences, viewFactory, contentManager, undoSupport) {
36594         if (this.home === undefined) {
36595             this.home = null;
36596         }
36597         if (this.preferences === undefined) {
36598             this.preferences = null;
36599         }
36600         if (this.viewFactory === undefined) {
36601             this.viewFactory = null;
36602         }
36603         if (this.contentManager === undefined) {
36604             this.contentManager = null;
36605         }
36606         if (this.undoSupport === undefined) {
36607             this.undoSupport = null;
36608         }
36609         if (this.floorTextureController === undefined) {
36610             this.floorTextureController = null;
36611         }
36612         if (this.ceilingTextureController === undefined) {
36613             this.ceilingTextureController = null;
36614         }
36615         if (this.wallSidesTextureController === undefined) {
36616             this.wallSidesTextureController = null;
36617         }
36618         if (this.wallSidesBaseboardController === undefined) {
36619             this.wallSidesBaseboardController = null;
36620         }
36621         if (this.propertyChangeSupport === undefined) {
36622             this.propertyChangeSupport = null;
36623         }
36624         if (this.roomView === undefined) {
36625             this.roomView = null;
36626         }
36627         if (this.name === undefined) {
36628             this.name = null;
36629         }
36630         if (this.areaVisible === undefined) {
36631             this.areaVisible = null;
36632         }
36633         if (this.floorVisible === undefined) {
36634             this.floorVisible = null;
36635         }
36636         if (this.floorColor === undefined) {
36637             this.floorColor = null;
36638         }
36639         if (this.floorPaint === undefined) {
36640             this.floorPaint = null;
36641         }
36642         if (this.floorShininess === undefined) {
36643             this.floorShininess = null;
36644         }
36645         if (this.ceilingVisible === undefined) {
36646             this.ceilingVisible = null;
36647         }
36648         if (this.ceilingColor === undefined) {
36649             this.ceilingColor = null;
36650         }
36651         if (this.ceilingPaint === undefined) {
36652             this.ceilingPaint = null;
36653         }
36654         if (this.ceilingShininess === undefined) {
36655             this.ceilingShininess = null;
36656         }
36657         if (this.ceilingFlat === undefined) {
36658             this.ceilingFlat = null;
36659         }
36660         if (this.wallSidesEditable === undefined) {
36661             this.wallSidesEditable = false;
36662         }
36663         if (this.splitSurroundingWalls === undefined) {
36664             this.splitSurroundingWalls = false;
36665         }
36666         if (this.splitSurroundingWallsNeeded === undefined) {
36667             this.splitSurroundingWallsNeeded = false;
36668         }
36669         if (this.wallSidesColor === undefined) {
36670             this.wallSidesColor = null;
36671         }
36672         if (this.wallSidesPaint === undefined) {
36673             this.wallSidesPaint = null;
36674         }
36675         if (this.wallSidesShininess === undefined) {
36676             this.wallSidesShininess = null;
36677         }
36678         this.home = home;
36679         this.preferences = preferences;
36680         this.viewFactory = viewFactory;
36681         this.contentManager = contentManager;
36682         this.undoSupport = undoSupport;
36683         this.propertyChangeSupport = new PropertyChangeSupport(this);
36684         this.updateProperties();
36685     }
36686     /**
36687      * Returns the texture controller of the room floor.
36688      * @return {TextureChoiceController}
36689      */
36690     RoomController.prototype.getFloorTextureController = function () {
36691         if (this.floorTextureController == null) {
36692             this.floorTextureController = new TextureChoiceController(this.preferences.getLocalizedString(RoomController, "floorTextureTitle"), this.preferences, this.viewFactory, this.contentManager);
36693             this.floorTextureController.addPropertyChangeListener("TEXTURE", new RoomController.RoomController$0(this));
36694         }
36695         return this.floorTextureController;
36696     };
36697     /**
36698      * Returns the texture controller of the room ceiling.
36699      * @return {TextureChoiceController}
36700      */
36701     RoomController.prototype.getCeilingTextureController = function () {
36702         if (this.ceilingTextureController == null) {
36703             this.ceilingTextureController = new TextureChoiceController(this.preferences.getLocalizedString(RoomController, "ceilingTextureTitle"), this.preferences, this.viewFactory, this.contentManager);
36704             this.ceilingTextureController.addPropertyChangeListener("TEXTURE", new RoomController.RoomController$1(this));
36705         }
36706         return this.ceilingTextureController;
36707     };
36708     /**
36709      * Returns the texture controller of the room wall sides.
36710      * @return {TextureChoiceController}
36711      */
36712     RoomController.prototype.getWallSidesTextureController = function () {
36713         if (this.wallSidesTextureController == null) {
36714             this.wallSidesTextureController = new TextureChoiceController(this.preferences.getLocalizedString(RoomController, "wallSidesTextureTitle"), this.preferences, this.viewFactory, this.contentManager);
36715             this.wallSidesTextureController.addPropertyChangeListener("TEXTURE", new RoomController.RoomController$2(this));
36716         }
36717         return this.wallSidesTextureController;
36718     };
36719     /**
36720      * Returns the controller of the wall sides baseboard.
36721      * @return {BaseboardChoiceController}
36722      */
36723     RoomController.prototype.getWallSidesBaseboardController = function () {
36724         if (this.wallSidesBaseboardController == null) {
36725             this.wallSidesBaseboardController = new BaseboardChoiceController(this.preferences, this.viewFactory, this.contentManager);
36726         }
36727         return this.wallSidesBaseboardController;
36728     };
36729     /**
36730      * Returns the view associated with this controller.
36731      * @return {Object}
36732      */
36733     RoomController.prototype.getView = function () {
36734         if (this.roomView == null) {
36735             this.roomView = this.viewFactory.createRoomView(this.preferences, this);
36736         }
36737         return this.roomView;
36738     };
36739     /**
36740      * Displays the view controlled by this controller.
36741      * @param {Object} parentView
36742      */
36743     RoomController.prototype.displayView = function (parentView) {
36744         this.getView().displayView(parentView);
36745     };
36746     /**
36747      * Adds the property change <code>listener</code> in parameter to this controller.
36748      * @param {string} property
36749      * @param {PropertyChangeListener} listener
36750      */
36751     RoomController.prototype.addPropertyChangeListener = function (property, listener) {
36752         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
36753     };
36754     /**
36755      * Removes the property change <code>listener</code> in parameter from this controller.
36756      * @param {string} property
36757      * @param {PropertyChangeListener} listener
36758      */
36759     RoomController.prototype.removePropertyChangeListener = function (property, listener) {
36760         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
36761     };
36762     /**
36763      * Returns <code>true</code> if the given <code>property</code> is editable.
36764      * Depending on whether a property is editable or not, the view associated to this controller
36765      * may render it differently.
36766      * The implementation of this method always returns <code>true</code> except for <code>WALL</code> properties.
36767      * @param {string} property
36768      * @return {boolean}
36769      */
36770     RoomController.prototype.isPropertyEditable = function (property) {
36771         switch ((property)) {
36772             case "SPLIT_SURROUNDING_WALLS":
36773             case "WALL_SIDES_COLOR":
36774             case "WALL_SIDES_PAINT":
36775             case "WALL_SIDES_SHININESS":
36776             case "WALL_SIDES_BASEBOARD":
36777                 return this.wallSidesEditable;
36778             default:
36779                 return true;
36780         }
36781     };
36782     /**
36783      * Updates edited properties from selected rooms in the home edited by this controller.
36784      */
36785     RoomController.prototype.updateProperties = function () {
36786         var selectedRooms = Home.getRoomsSubList(this.home.getSelectedItems());
36787         if ( /* isEmpty */(selectedRooms.length == 0)) {
36788             this.setAreaVisible(null);
36789             this.setFloorColor(null);
36790             this.getFloorTextureController().setTexture(null);
36791             this.setFloorPaint(null);
36792             this.setFloorShininess(null);
36793             this.setCeilingColor(null);
36794             this.getCeilingTextureController().setTexture(null);
36795             this.setCeilingPaint(null);
36796             this.setCeilingShininess(null);
36797             this.setCeilingFlat(null);
36798         }
36799         else {
36800             var firstRoom = selectedRooms[0];
36801             var name_7 = firstRoom.getName();
36802             if (name_7 != null) {
36803                 for (var i = 1; i < /* size */ selectedRooms.length; i++) {
36804                     {
36805                         if (!(name_7 === /* get */ selectedRooms[i].getName())) {
36806                             name_7 = null;
36807                             break;
36808                         }
36809                     }
36810                     ;
36811                 }
36812             }
36813             this.setName(name_7);
36814             var areaVisible = firstRoom.isAreaVisible();
36815             for (var i = 1; i < /* size */ selectedRooms.length; i++) {
36816                 {
36817                     if (areaVisible !== /* get */ selectedRooms[i].isAreaVisible()) {
36818                         areaVisible = null;
36819                         break;
36820                     }
36821                 }
36822                 ;
36823             }
36824             this.setAreaVisible(areaVisible);
36825             var floorVisible = firstRoom.isFloorVisible();
36826             for (var i = 1; i < /* size */ selectedRooms.length; i++) {
36827                 {
36828                     if (floorVisible !== /* get */ selectedRooms[i].isFloorVisible()) {
36829                         floorVisible = null;
36830                         break;
36831                     }
36832                 }
36833                 ;
36834             }
36835             this.setFloorVisible(floorVisible);
36836             var floorColor = firstRoom.getFloorColor();
36837             if (floorColor != null) {
36838                 for (var i = 1; i < /* size */ selectedRooms.length; i++) {
36839                     {
36840                         if (!(floorColor === /* get */ selectedRooms[i].getFloorColor())) {
36841                             floorColor = null;
36842                             break;
36843                         }
36844                     }
36845                     ;
36846                 }
36847             }
36848             this.setFloorColor(floorColor);
36849             var floorTexture = firstRoom.getFloorTexture();
36850             if (floorTexture != null) {
36851                 for (var i = 1; i < /* size */ selectedRooms.length; i++) {
36852                     {
36853                         if (!floorTexture.equals(/* get */ selectedRooms[i].getFloorTexture())) {
36854                             floorTexture = null;
36855                             break;
36856                         }
36857                     }
36858                     ;
36859                 }
36860             }
36861             this.getFloorTextureController().setTexture(floorTexture);
36862             var defaultColorsAndTextures = true;
36863             for (var i = 0; i < /* size */ selectedRooms.length; i++) {
36864                 {
36865                     var room = selectedRooms[i];
36866                     if (room.getFloorColor() != null || room.getFloorTexture() != null) {
36867                         defaultColorsAndTextures = false;
36868                         break;
36869                     }
36870                 }
36871                 ;
36872             }
36873             if (floorColor != null) {
36874                 this.setFloorPaint(RoomController.RoomPaint.COLORED);
36875             }
36876             else if (floorTexture != null) {
36877                 this.setFloorPaint(RoomController.RoomPaint.TEXTURED);
36878             }
36879             else if (defaultColorsAndTextures) {
36880                 this.setFloorPaint(RoomController.RoomPaint.DEFAULT);
36881             }
36882             else {
36883                 this.setFloorPaint(null);
36884             }
36885             var floorShininess = firstRoom.getFloorShininess();
36886             for (var i = 1; i < /* size */ selectedRooms.length; i++) {
36887                 {
36888                     if (!(floorShininess === /* get */ selectedRooms[i].getFloorShininess())) {
36889                         floorShininess = null;
36890                         break;
36891                     }
36892                 }
36893                 ;
36894             }
36895             this.setFloorShininess(floorShininess);
36896             var ceilingVisible = firstRoom.isCeilingVisible();
36897             for (var i = 1; i < /* size */ selectedRooms.length; i++) {
36898                 {
36899                     if (ceilingVisible !== /* get */ selectedRooms[i].isCeilingVisible()) {
36900                         ceilingVisible = null;
36901                         break;
36902                     }
36903                 }
36904                 ;
36905             }
36906             this.setCeilingVisible(ceilingVisible);
36907             var ceilingColor = firstRoom.getCeilingColor();
36908             if (ceilingColor != null) {
36909                 for (var i = 1; i < /* size */ selectedRooms.length; i++) {
36910                     {
36911                         if (!(ceilingColor === /* get */ selectedRooms[i].getCeilingColor())) {
36912                             ceilingColor = null;
36913                             break;
36914                         }
36915                     }
36916                     ;
36917                 }
36918             }
36919             this.setCeilingColor(ceilingColor);
36920             var ceilingTexture = firstRoom.getCeilingTexture();
36921             if (ceilingTexture != null) {
36922                 for (var i = 1; i < /* size */ selectedRooms.length; i++) {
36923                     {
36924                         if (!ceilingTexture.equals(/* get */ selectedRooms[i].getCeilingTexture())) {
36925                             ceilingTexture = null;
36926                             break;
36927                         }
36928                     }
36929                     ;
36930                 }
36931             }
36932             this.getCeilingTextureController().setTexture(ceilingTexture);
36933             defaultColorsAndTextures = true;
36934             for (var i = 0; i < /* size */ selectedRooms.length; i++) {
36935                 {
36936                     var room = selectedRooms[i];
36937                     if (room.getCeilingColor() != null || room.getCeilingTexture() != null) {
36938                         defaultColorsAndTextures = false;
36939                         break;
36940                     }
36941                 }
36942                 ;
36943             }
36944             if (ceilingColor != null) {
36945                 this.setCeilingPaint(RoomController.RoomPaint.COLORED);
36946             }
36947             else if (ceilingTexture != null) {
36948                 this.setCeilingPaint(RoomController.RoomPaint.TEXTURED);
36949             }
36950             else if (defaultColorsAndTextures) {
36951                 this.setCeilingPaint(RoomController.RoomPaint.DEFAULT);
36952             }
36953             else {
36954                 this.setCeilingPaint(null);
36955             }
36956             var ceilingShininess = firstRoom.getCeilingShininess();
36957             for (var i = 1; i < /* size */ selectedRooms.length; i++) {
36958                 {
36959                     if (!(ceilingShininess === /* get */ selectedRooms[i].getCeilingShininess())) {
36960                         ceilingShininess = null;
36961                         break;
36962                     }
36963                 }
36964                 ;
36965             }
36966             this.setCeilingShininess(ceilingShininess);
36967             var ceilingFlat = firstRoom.isCeilingFlat();
36968             for (var i = 1; i < /* size */ selectedRooms.length; i++) {
36969                 {
36970                     if (ceilingFlat !== /* get */ selectedRooms[i].isCeilingFlat()) {
36971                         ceilingFlat = null;
36972                         break;
36973                     }
36974                 }
36975                 ;
36976             }
36977             this.setCeilingFlat(ceilingFlat);
36978         }
36979         var wallSides = this.getRoomsWallSides(selectedRooms, null);
36980         if ( /* isEmpty */(wallSides.length == 0)) {
36981             this.wallSidesEditable = this.splitSurroundingWallsNeeded = this.splitSurroundingWalls = false;
36982             this.setWallSidesColor(null);
36983             this.setWallSidesPaint(null);
36984             this.setWallSidesShininess(null);
36985             this.getWallSidesBaseboardController().setVisible(null);
36986             this.getWallSidesBaseboardController().setThickness(null);
36987             this.getWallSidesBaseboardController().setHeight(null);
36988             this.getWallSidesBaseboardController().setColor(null);
36989             this.getWallSidesBaseboardController().getTextureController().setTexture(null);
36990             this.getWallSidesBaseboardController().setPaint(null);
36991         }
36992         else {
36993             this.wallSidesEditable = true;
36994             this.splitSurroundingWallsNeeded = this.splitWalls(wallSides, null, null, null);
36995             this.splitSurroundingWalls = false;
36996             var firstWallSide = wallSides[0];
36997             var wallSidesColor = firstWallSide.getSide() === RoomController.WallSide.LEFT_SIDE ? firstWallSide.getWall().getLeftSideColor() : firstWallSide.getWall().getRightSideColor();
36998             if (wallSidesColor != null) {
36999                 for (var i = 1; i < /* size */ wallSides.length; i++) {
37000                     {
37001                         var wallSide = wallSides[i];
37002                         if (!(wallSidesColor === (wallSide.getSide() === RoomController.WallSide.LEFT_SIDE ? wallSide.getWall().getLeftSideColor() : wallSide.getWall().getRightSideColor()))) {
37003                             wallSidesColor = null;
37004                             break;
37005                         }
37006                     }
37007                     ;
37008                 }
37009             }
37010             this.setWallSidesColor(wallSidesColor);
37011             var wallSidesTexture = firstWallSide.getSide() === RoomController.WallSide.LEFT_SIDE ? firstWallSide.getWall().getLeftSideTexture() : firstWallSide.getWall().getRightSideTexture();
37012             if (wallSidesTexture != null) {
37013                 for (var i = 1; i < /* size */ wallSides.length; i++) {
37014                     {
37015                         var wallSide = wallSides[i];
37016                         if (!wallSidesTexture.equals(wallSide.getSide() === RoomController.WallSide.LEFT_SIDE ? wallSide.getWall().getLeftSideTexture() : wallSide.getWall().getRightSideTexture())) {
37017                             wallSidesTexture = null;
37018                             break;
37019                         }
37020                     }
37021                     ;
37022                 }
37023             }
37024             this.getWallSidesTextureController().setTexture(wallSidesTexture);
37025             var defaultColorsAndTextures = true;
37026             for (var i = 0; i < /* size */ wallSides.length; i++) {
37027                 {
37028                     var wallSide = wallSides[i];
37029                     if ((wallSide.getSide() === RoomController.WallSide.LEFT_SIDE ? wallSide.getWall().getLeftSideColor() : wallSide.getWall().getRightSideColor()) != null || (wallSide.getSide() === RoomController.WallSide.LEFT_SIDE ? wallSide.getWall().getLeftSideTexture() : wallSide.getWall().getRightSideTexture()) != null) {
37030                         defaultColorsAndTextures = false;
37031                         break;
37032                     }
37033                 }
37034                 ;
37035             }
37036             if (wallSidesColor != null) {
37037                 this.setWallSidesPaint(RoomController.RoomPaint.COLORED);
37038             }
37039             else if (wallSidesTexture != null) {
37040                 this.setWallSidesPaint(RoomController.RoomPaint.TEXTURED);
37041             }
37042             else if (defaultColorsAndTextures) {
37043                 this.setWallSidesPaint(RoomController.RoomPaint.DEFAULT);
37044             }
37045             else {
37046                 this.setWallSidesPaint(null);
37047             }
37048             var wallSidesShininess = firstWallSide.getSide() === RoomController.WallSide.LEFT_SIDE ? firstWallSide.getWall().getLeftSideShininess() : firstWallSide.getWall().getRightSideShininess();
37049             if (wallSidesShininess != null) {
37050                 for (var i = 1; i < /* size */ wallSides.length; i++) {
37051                     {
37052                         var wallSide = wallSides[i];
37053                         if (!(wallSidesShininess === (wallSide.getSide() === RoomController.WallSide.LEFT_SIDE ? wallSide.getWall().getLeftSideShininess() : wallSide.getWall().getRightSideShininess()))) {
37054                             wallSidesShininess = null;
37055                             break;
37056                         }
37057                     }
37058                     ;
37059                 }
37060             }
37061             this.setWallSidesShininess(wallSidesShininess);
37062             var firstWallSideBaseboard = firstWallSide.getSide() === RoomController.WallSide.LEFT_SIDE ? firstWallSide.getWall().getLeftSideBaseboard() : firstWallSide.getWall().getRightSideBaseboard();
37063             var wallSidesBaseboardVisible = firstWallSideBaseboard != null;
37064             for (var i = 1; i < /* size */ wallSides.length; i++) {
37065                 {
37066                     var wallSide = wallSides[i];
37067                     if (wallSidesBaseboardVisible !== (wallSide.getSide() === RoomController.WallSide.LEFT_SIDE ? wallSide.getWall().getLeftSideBaseboard() != null : wallSide.getWall().getRightSideBaseboard() != null)) {
37068                         wallSidesBaseboardVisible = null;
37069                         break;
37070                     }
37071                 }
37072                 ;
37073             }
37074             this.getWallSidesBaseboardController().setVisible(wallSidesBaseboardVisible);
37075             var wallSidesBaseboardThickness = firstWallSideBaseboard != null ? firstWallSideBaseboard.getThickness() : this.preferences.getNewWallBaseboardThickness();
37076             for (var i = 1; i < /* size */ wallSides.length; i++) {
37077                 {
37078                     var wallSide = wallSides[i];
37079                     var baseboard = wallSide.getSide() === RoomController.WallSide.LEFT_SIDE ? wallSide.getWall().getLeftSideBaseboard() : wallSide.getWall().getRightSideBaseboard();
37080                     if (!(wallSidesBaseboardThickness === (baseboard != null ? baseboard.getThickness() : this.preferences.getNewWallBaseboardThickness()))) {
37081                         wallSidesBaseboardThickness = null;
37082                         break;
37083                     }
37084                 }
37085                 ;
37086             }
37087             this.getWallSidesBaseboardController().setThickness(wallSidesBaseboardThickness);
37088             var wallSidesBaseboardHeight = firstWallSideBaseboard != null ? firstWallSideBaseboard.getHeight() : this.preferences.getNewWallBaseboardHeight();
37089             for (var i = 1; i < /* size */ wallSides.length; i++) {
37090                 {
37091                     var wallSide = wallSides[i];
37092                     var baseboard = wallSide.getSide() === RoomController.WallSide.LEFT_SIDE ? wallSide.getWall().getLeftSideBaseboard() : wallSide.getWall().getRightSideBaseboard();
37093                     if (!(wallSidesBaseboardHeight === (baseboard != null ? baseboard.getHeight() : this.preferences.getNewWallBaseboardHeight()))) {
37094                         wallSidesBaseboardHeight = null;
37095                         break;
37096                     }
37097                 }
37098                 ;
37099             }
37100             this.getWallSidesBaseboardController().setHeight(wallSidesBaseboardHeight);
37101             var maxBaseboardHeight = firstWallSide.getWall().isTrapezoidal() ? Math.max(firstWallSide.getWall().getHeight(), firstWallSide.getWall().getHeightAtEnd()) : firstWallSide.getWall().getHeight();
37102             for (var i = 1; i < /* size */ wallSides.length; i++) {
37103                 {
37104                     var wall = wallSides[i].getWall();
37105                     maxBaseboardHeight = Math.max(maxBaseboardHeight, wall.isTrapezoidal() ? Math.max(wall.getHeight(), wall.getHeightAtEnd()) : wall.getHeight());
37106                 }
37107                 ;
37108             }
37109             this.getWallSidesBaseboardController().setMaxHeight(maxBaseboardHeight);
37110             var wallSidesBaseboardColor = firstWallSideBaseboard != null ? firstWallSideBaseboard.getColor() : null;
37111             if (wallSidesBaseboardColor != null) {
37112                 for (var i = 1; i < /* size */ wallSides.length; i++) {
37113                     {
37114                         var wallSide = wallSides[i];
37115                         var baseboard = wallSide.getSide() === RoomController.WallSide.LEFT_SIDE ? wallSide.getWall().getLeftSideBaseboard() : wallSide.getWall().getRightSideBaseboard();
37116                         if (baseboard == null || !(wallSidesBaseboardColor === baseboard.getColor())) {
37117                             wallSidesBaseboardColor = null;
37118                             break;
37119                         }
37120                     }
37121                     ;
37122                 }
37123             }
37124             this.getWallSidesBaseboardController().setColor(wallSidesBaseboardColor);
37125             var wallSidesBaseboardTexture = firstWallSideBaseboard != null ? firstWallSideBaseboard.getTexture() : null;
37126             if (wallSidesBaseboardTexture != null) {
37127                 for (var i = 1; i < /* size */ wallSides.length; i++) {
37128                     {
37129                         var wallSide = wallSides[i];
37130                         var baseboard = wallSide.getSide() === RoomController.WallSide.LEFT_SIDE ? wallSide.getWall().getLeftSideBaseboard() : wallSide.getWall().getRightSideBaseboard();
37131                         if (baseboard == null || !wallSidesBaseboardTexture.equals(baseboard.getTexture())) {
37132                             wallSidesBaseboardTexture = null;
37133                             break;
37134                         }
37135                     }
37136                     ;
37137                 }
37138             }
37139             this.getWallSidesBaseboardController().getTextureController().setTexture(wallSidesBaseboardTexture);
37140             defaultColorsAndTextures = true;
37141             for (var i = 0; i < /* size */ wallSides.length; i++) {
37142                 {
37143                     var wallSide = wallSides[i];
37144                     var baseboard = wallSide.getSide() === RoomController.WallSide.LEFT_SIDE ? wallSide.getWall().getLeftSideBaseboard() : wallSide.getWall().getRightSideBaseboard();
37145                     if (baseboard != null && (baseboard.getColor() != null || baseboard.getTexture() != null)) {
37146                         defaultColorsAndTextures = false;
37147                         break;
37148                     }
37149                 }
37150                 ;
37151             }
37152             if (wallSidesBaseboardColor != null) {
37153                 this.getWallSidesBaseboardController().setPaint(BaseboardChoiceController.BaseboardPaint.COLORED);
37154             }
37155             else if (wallSidesBaseboardTexture != null) {
37156                 this.getWallSidesBaseboardController().setPaint(BaseboardChoiceController.BaseboardPaint.TEXTURED);
37157             }
37158             else if (defaultColorsAndTextures) {
37159                 this.getWallSidesBaseboardController().setPaint(BaseboardChoiceController.BaseboardPaint.DEFAULT);
37160             }
37161             else {
37162                 this.getWallSidesBaseboardController().setPaint(null);
37163             }
37164         }
37165     };
37166     /**
37167      * Returns the wall sides close to each room of <code>rooms</code>.
37168      * @param {Room[]} rooms
37169      * @param {RoomController.WallSide[]} defaultWallSides
37170      * @return {RoomController.WallSide[]}
37171      * @private
37172      */
37173     RoomController.prototype.getRoomsWallSides = function (rooms, defaultWallSides) {
37174         var wallSides = ([]);
37175         for (var index = 0; index < rooms.length; index++) {
37176             var room = rooms[index];
37177             {
37178                 var roomArea = new java.awt.geom.Area(this.getPath(room.getPoints(), true));
37179                 if (defaultWallSides != null) {
37180                     for (var index1 = 0; index1 < defaultWallSides.length; index1++) {
37181                         var wallSide = defaultWallSides[index1];
37182                         {
37183                             if (this.isRoomItersectingWallSide(wallSide.getWall().getPoints$(), wallSide.getSide(), roomArea)) {
37184                                 /* add */ (wallSides.push(wallSide) > 0);
37185                             }
37186                         }
37187                     }
37188                 }
37189                 else {
37190                     {
37191                         var array = this.home.getWalls();
37192                         for (var index1 = 0; index1 < array.length; index1++) {
37193                             var wall = array[index1];
37194                             {
37195                                 if ((wall.getLevel() == null || wall.getLevel().isViewable()) && wall.isAtLevel(this.home.getSelectedLevel())) {
37196                                     var wallPoints = wall.getPoints$();
37197                                     if (this.isRoomItersectingWallSide(wallPoints, RoomController.WallSide.LEFT_SIDE, roomArea)) {
37198                                         /* add */ (wallSides.push(new RoomController.WallSide(wall, RoomController.WallSide.LEFT_SIDE)) > 0);
37199                                     }
37200                                     if (this.isRoomItersectingWallSide(wallPoints, RoomController.WallSide.RIGHT_SIDE, roomArea)) {
37201                                         /* add */ (wallSides.push(new RoomController.WallSide(wall, RoomController.WallSide.RIGHT_SIDE)) > 0);
37202                                     }
37203                                 }
37204                             }
37205                         }
37206                     }
37207                 }
37208             }
37209         }
37210         return wallSides;
37211     };
37212     /**
37213      * Returns <code>true</code> if the wall points on the given <code>wallSide</code>
37214      * intersects room area.
37215      * @param {float[][]} wallPoints
37216      * @param {number} wallSide
37217      * @param {java.awt.geom.Area} roomArea
37218      * @return {boolean}
37219      * @private
37220      */
37221     RoomController.prototype.isRoomItersectingWallSide = function (wallPoints, wallSide, roomArea) {
37222         var wallSideTestArea = this.getWallSideArea(wallPoints, wallSide);
37223         var wallSideTestAreaSurface = this.getSurface(wallSideTestArea);
37224         wallSideTestArea.intersect(roomArea);
37225         if (!wallSideTestArea.isEmpty()) {
37226             var wallSideIntersectionSurface = this.getSurface(wallSideTestArea);
37227             if (wallSideIntersectionSurface > wallSideTestAreaSurface * 0.02) {
37228                 return true;
37229             }
37230         }
37231         return false;
37232     };
37233     /**
37234      * Returns the area of the side of the given <code>wall</code>.
37235      * @param {float[][]} wallPoints
37236      * @param {number} wallSide
37237      * @return {java.awt.geom.Area}
37238      * @private
37239      */
37240     RoomController.prototype.getWallSideArea = function (wallPoints, wallSide) {
37241         var thickness = 2.0;
37242         if (wallPoints.length === 4) {
37243             if (wallSide === RoomController.WallSide.LEFT_SIDE) {
37244                 return new java.awt.geom.Area(this.getPath(new Wall(wallPoints[0][0], wallPoints[0][1], wallPoints[1][0], wallPoints[1][1], thickness, 0).getPoints$(), true));
37245             }
37246             else {
37247                 return new java.awt.geom.Area(this.getPath(new Wall(wallPoints[2][0], wallPoints[2][1], wallPoints[3][0], wallPoints[3][1], thickness, 0).getPoints$(), true));
37248             }
37249         }
37250         else {
37251             var wallSidePoints = (function (s) { var a = []; while (s-- > 0)
37252                 a.push(null); return a; })((wallPoints.length / 2 | 0));
37253             /* arraycopy */ (function (srcPts, srcOff, dstPts, dstOff, size) { if (srcPts !== dstPts || dstOff >= srcOff + size) {
37254                 while (--size >= 0)
37255                     dstPts[dstOff++] = srcPts[srcOff++];
37256             }
37257             else {
37258                 var tmp = srcPts.slice(srcOff, srcOff + size);
37259                 for (var i = 0; i < size; i++)
37260                     dstPts[dstOff++] = tmp[i];
37261             } })(wallPoints, wallSide === RoomController.WallSide.LEFT_SIDE ? 0 : wallSidePoints.length, wallSidePoints, 0, wallSidePoints.length);
37262             var wallSideWalls = (function (s) { var a = []; while (s-- > 0)
37263                 a.push(null); return a; })(wallSidePoints.length - 1);
37264             for (var i = 0; i < wallSideWalls.length; i++) {
37265                 {
37266                     wallSideWalls[i] = new Wall(wallSidePoints[i][0], wallSidePoints[i][1], wallSidePoints[i + 1][0], wallSidePoints[i + 1][1], thickness, 0);
37267                     if (i > 0) {
37268                         wallSideWalls[i].setWallAtStart(wallSideWalls[i - 1]);
37269                         wallSideWalls[i - 1].setWallAtEnd(wallSideWalls[i]);
37270                     }
37271                 }
37272                 ;
37273             }
37274             wallSidePoints = (function (s) { var a = []; while (s-- > 0)
37275                 a.push(null); return a; })(wallPoints.length);
37276             var wallSideWallPoints = null;
37277             for (var i = 0; i < wallSideWalls.length; i++) {
37278                 {
37279                     wallSideWallPoints = wallSideWalls[i].getPoints$();
37280                     wallSidePoints[i] = wallSideWallPoints[0];
37281                     wallSidePoints[wallSidePoints.length - i - 1] = wallSideWallPoints[3];
37282                 }
37283                 ;
37284             }
37285             wallSidePoints[(wallSidePoints.length / 2 | 0) - 1] = wallSideWallPoints[1];
37286             wallSidePoints[(wallSidePoints.length / 2 | 0)] = wallSideWallPoints[2];
37287             return new java.awt.geom.Area(this.getPath(wallSidePoints, true));
37288         }
37289     };
37290     /**
37291      * Returns the shape matching the coordinates in <code>points</code> array.
37292      * @param {float[][]} points
37293      * @param {boolean} closedPath
37294      * @return {java.awt.geom.GeneralPath}
37295      * @private
37296      */
37297     RoomController.prototype.getPath = function (points, closedPath) {
37298         var path = new java.awt.geom.GeneralPath();
37299         path.moveTo(points[0][0], points[0][1]);
37300         for (var i = 1; i < points.length; i++) {
37301             {
37302                 path.lineTo(points[i][0], points[i][1]);
37303             }
37304             ;
37305         }
37306         if (closedPath) {
37307             path.closePath();
37308         }
37309         return path;
37310     };
37311     /**
37312      * Returns the surface of the given <code>area</code>.
37313      * @param {java.awt.geom.Area} area
37314      * @return {number}
37315      * @private
37316      */
37317     RoomController.prototype.getSurface = function (area) {
37318         var surface = 0;
37319         var currentPathPoints = ([]);
37320         for (var it = area.getPathIterator(null); !it.isDone();) {
37321             {
37322                 var roomPoint = [0, 0];
37323                 switch ((it.currentSegment(roomPoint))) {
37324                     case java.awt.geom.PathIterator.SEG_MOVETO:
37325                         /* add */ (currentPathPoints.push(roomPoint) > 0);
37326                         break;
37327                     case java.awt.geom.PathIterator.SEG_LINETO:
37328                         /* add */ (currentPathPoints.push(roomPoint) > 0);
37329                         break;
37330                     case java.awt.geom.PathIterator.SEG_CLOSE:
37331                         var pathPoints = currentPathPoints.slice(0);
37332                         surface += Math.abs(this.getSignedSurface(pathPoints));
37333                         /* clear */ (currentPathPoints.length = 0);
37334                         break;
37335                 }
37336                 it.next();
37337             }
37338             ;
37339         }
37340         return surface;
37341     };
37342     RoomController.prototype.getSignedSurface = function (areaPoints) {
37343         var area = 0;
37344         for (var i = 1; i < areaPoints.length; i++) {
37345             {
37346                 area += areaPoints[i][0] * areaPoints[i - 1][1];
37347                 area -= areaPoints[i][1] * areaPoints[i - 1][0];
37348             }
37349             ;
37350         }
37351         area += areaPoints[0][0] * areaPoints[areaPoints.length - 1][1];
37352         area -= areaPoints[0][1] * areaPoints[areaPoints.length - 1][0];
37353         return area / 2;
37354     };
37355     /**
37356      * Sets the edited name.
37357      * @param {string} name
37358      */
37359     RoomController.prototype.setName = function (name) {
37360         if (name !== this.name) {
37361             var oldName = this.name;
37362             this.name = name;
37363             this.propertyChangeSupport.firePropertyChange(/* name */ "NAME", oldName, name);
37364         }
37365     };
37366     /**
37367      * Returns the edited name.
37368      * @return {string}
37369      */
37370     RoomController.prototype.getName = function () {
37371         return this.name;
37372     };
37373     /**
37374      * Sets whether room area is visible or not.
37375      * @param {boolean} areaVisible
37376      */
37377     RoomController.prototype.setAreaVisible = function (areaVisible) {
37378         if (areaVisible !== this.areaVisible) {
37379             var oldAreaVisible = this.areaVisible;
37380             this.areaVisible = areaVisible;
37381             this.propertyChangeSupport.firePropertyChange(/* name */ "AREA_VISIBLE", oldAreaVisible, areaVisible);
37382         }
37383     };
37384     /**
37385      * Returns whether room area is visible or not.
37386      * @return {boolean}
37387      */
37388     RoomController.prototype.getAreaVisible = function () {
37389         return this.areaVisible;
37390     };
37391     /**
37392      * Sets whether room floor is visible or not.
37393      * @param {boolean} floorVisible
37394      */
37395     RoomController.prototype.setFloorVisible = function (floorVisible) {
37396         if (floorVisible !== this.floorVisible) {
37397             var oldFloorVisible = this.floorVisible;
37398             this.floorVisible = floorVisible;
37399             this.propertyChangeSupport.firePropertyChange(/* name */ "FLOOR_VISIBLE", oldFloorVisible, floorVisible);
37400         }
37401     };
37402     /**
37403      * Returns whether room floor is visible or not.
37404      * @return {boolean}
37405      */
37406     RoomController.prototype.getFloorVisible = function () {
37407         return this.floorVisible;
37408     };
37409     /**
37410      * Sets the edited color of the floor.
37411      * @param {number} floorColor
37412      */
37413     RoomController.prototype.setFloorColor = function (floorColor) {
37414         if (floorColor !== this.floorColor) {
37415             var oldFloorColor = this.floorColor;
37416             this.floorColor = floorColor;
37417             this.propertyChangeSupport.firePropertyChange(/* name */ "FLOOR_COLOR", oldFloorColor, floorColor);
37418             this.setFloorPaint(RoomController.RoomPaint.COLORED);
37419         }
37420     };
37421     /**
37422      * Returns the edited color of the floor.
37423      * @return {number}
37424      */
37425     RoomController.prototype.getFloorColor = function () {
37426         return this.floorColor;
37427     };
37428     /**
37429      * Sets whether the floor is colored, textured or unknown painted.
37430      * @param {RoomController.RoomPaint} floorPaint
37431      */
37432     RoomController.prototype.setFloorPaint = function (floorPaint) {
37433         if (floorPaint !== this.floorPaint) {
37434             var oldFloorPaint = this.floorPaint;
37435             this.floorPaint = floorPaint;
37436             this.propertyChangeSupport.firePropertyChange(/* name */ "FLOOR_PAINT", oldFloorPaint, floorPaint);
37437         }
37438     };
37439     /**
37440      * Returns whether the floor is colored, textured or unknown painted.
37441      * @return {RoomController.RoomPaint}
37442      */
37443     RoomController.prototype.getFloorPaint = function () {
37444         return this.floorPaint;
37445     };
37446     /**
37447      * Sets the edited shininess of the floor.
37448      * @param {number} floorShininess
37449      */
37450     RoomController.prototype.setFloorShininess = function (floorShininess) {
37451         if (floorShininess !== this.floorShininess) {
37452             var oldFloorShininess = this.floorShininess;
37453             this.floorShininess = floorShininess;
37454             this.propertyChangeSupport.firePropertyChange(/* name */ "FLOOR_SHININESS", oldFloorShininess, floorShininess);
37455         }
37456     };
37457     /**
37458      * Returns the edited shininess of the floor.
37459      * @return {number}
37460      */
37461     RoomController.prototype.getFloorShininess = function () {
37462         return this.floorShininess;
37463     };
37464     /**
37465      * Sets whether room ceiling is visible or not.
37466      * @param {boolean} ceilingCeilingVisible
37467      */
37468     RoomController.prototype.setCeilingVisible = function (ceilingCeilingVisible) {
37469         if (ceilingCeilingVisible !== this.ceilingVisible) {
37470             var oldCeilingVisible = this.ceilingVisible;
37471             this.ceilingVisible = ceilingCeilingVisible;
37472             this.propertyChangeSupport.firePropertyChange(/* name */ "CEILING_VISIBLE", oldCeilingVisible, ceilingCeilingVisible);
37473         }
37474     };
37475     /**
37476      * Returns whether room ceiling is visible or not.
37477      * @return {boolean}
37478      */
37479     RoomController.prototype.getCeilingVisible = function () {
37480         return this.ceilingVisible;
37481     };
37482     /**
37483      * Sets the edited color of the ceiling.
37484      * @param {number} ceilingColor
37485      */
37486     RoomController.prototype.setCeilingColor = function (ceilingColor) {
37487         if (ceilingColor !== this.ceilingColor) {
37488             var oldCeilingColor = this.ceilingColor;
37489             this.ceilingColor = ceilingColor;
37490             this.propertyChangeSupport.firePropertyChange(/* name */ "CEILING_COLOR", oldCeilingColor, ceilingColor);
37491             this.setCeilingPaint(RoomController.RoomPaint.COLORED);
37492         }
37493     };
37494     /**
37495      * Returns the edited color of the ceiling.
37496      * @return {number}
37497      */
37498     RoomController.prototype.getCeilingColor = function () {
37499         return this.ceilingColor;
37500     };
37501     /**
37502      * Sets whether the ceiling is colored, textured or unknown painted.
37503      * @param {RoomController.RoomPaint} ceilingPaint
37504      */
37505     RoomController.prototype.setCeilingPaint = function (ceilingPaint) {
37506         if (ceilingPaint !== this.ceilingPaint) {
37507             var oldCeilingPaint = this.ceilingPaint;
37508             this.ceilingPaint = ceilingPaint;
37509             this.propertyChangeSupport.firePropertyChange(/* name */ "CEILING_PAINT", oldCeilingPaint, ceilingPaint);
37510         }
37511     };
37512     /**
37513      * Returns whether the ceiling is colored, textured or unknown painted.
37514      * @return {RoomController.RoomPaint}
37515      */
37516     RoomController.prototype.getCeilingPaint = function () {
37517         return this.ceilingPaint;
37518     };
37519     /**
37520      * Sets the edited shininess of the ceiling.
37521      * @param {number} ceilingShininess
37522      */
37523     RoomController.prototype.setCeilingShininess = function (ceilingShininess) {
37524         if (ceilingShininess !== this.ceilingShininess) {
37525             var oldCeilingShininess = this.ceilingShininess;
37526             this.ceilingShininess = ceilingShininess;
37527             this.propertyChangeSupport.firePropertyChange(/* name */ "CEILING_SHININESS", oldCeilingShininess, ceilingShininess);
37528         }
37529     };
37530     /**
37531      * Returns the edited shininess of the ceiling.
37532      * @return {number}
37533      */
37534     RoomController.prototype.getCeilingShininess = function () {
37535         return this.ceilingShininess;
37536     };
37537     /**
37538      * Sets whether room ceiling should remain flat whatever its environment or not.
37539      * @param {boolean} ceilingCeilingFlat
37540      */
37541     RoomController.prototype.setCeilingFlat = function (ceilingCeilingFlat) {
37542         if (ceilingCeilingFlat !== this.ceilingFlat) {
37543             var oldCeilingFlat = this.ceilingFlat;
37544             this.ceilingFlat = ceilingCeilingFlat;
37545             this.propertyChangeSupport.firePropertyChange(/* name */ "CEILING_FLAT", oldCeilingFlat, ceilingCeilingFlat);
37546         }
37547     };
37548     /**
37549      * Returns whether room ceiling should remain flat whatever its environment or not.
37550      * @return {boolean}
37551      */
37552     RoomController.prototype.getCeilingFlat = function () {
37553         return this.ceilingFlat;
37554     };
37555     /**
37556      * Returns <code>true</code> if walls around the edited rooms should be split.
37557      * @return {boolean}
37558      */
37559     RoomController.prototype.isSplitSurroundingWalls = function () {
37560         return this.splitSurroundingWalls;
37561     };
37562     /**
37563      * Sets whether walls around the edited rooms should be split or not.
37564      * @param {boolean} splitSurroundingWalls
37565      */
37566     RoomController.prototype.setSplitSurroundingWalls = function (splitSurroundingWalls) {
37567         if (splitSurroundingWalls !== this.splitSurroundingWalls) {
37568             this.splitSurroundingWalls = splitSurroundingWalls;
37569             this.propertyChangeSupport.firePropertyChange(/* name */ "SPLIT_SURROUNDING_WALLS", !splitSurroundingWalls, splitSurroundingWalls);
37570         }
37571     };
37572     /**
37573      * Returns <code>true</code> if walls around the edited rooms need to be split
37574      * to avoid changing the color of wall sides that belong to neighborhood rooms.
37575      * @return {boolean}
37576      */
37577     RoomController.prototype.isSplitSurroundingWallsNeeded = function () {
37578         return this.splitSurroundingWallsNeeded;
37579     };
37580     /**
37581      * Sets the edited color of the wall sides.
37582      * @param {number} wallSidesColor
37583      */
37584     RoomController.prototype.setWallSidesColor = function (wallSidesColor) {
37585         if (wallSidesColor !== this.wallSidesColor) {
37586             var oldWallSidesColor = this.wallSidesColor;
37587             this.wallSidesColor = wallSidesColor;
37588             this.propertyChangeSupport.firePropertyChange(/* name */ "WALL_SIDES_COLOR", oldWallSidesColor, wallSidesColor);
37589             this.setWallSidesPaint(RoomController.RoomPaint.COLORED);
37590         }
37591     };
37592     /**
37593      * Returns the edited color of the wall sides.
37594      * @return {number}
37595      */
37596     RoomController.prototype.getWallSidesColor = function () {
37597         return this.wallSidesColor;
37598     };
37599     /**
37600      * Sets whether the wall sides are colored, textured or unknown painted.
37601      * @param {RoomController.RoomPaint} wallSidesPaint
37602      */
37603     RoomController.prototype.setWallSidesPaint = function (wallSidesPaint) {
37604         if (wallSidesPaint !== this.wallSidesPaint) {
37605             var oldWallSidesPaint = this.wallSidesPaint;
37606             this.wallSidesPaint = wallSidesPaint;
37607             this.propertyChangeSupport.firePropertyChange(/* name */ "WALL_SIDES_PAINT", oldWallSidesPaint, wallSidesPaint);
37608         }
37609     };
37610     /**
37611      * Returns whether the wall sides are colored, textured or unknown painted.
37612      * @return {RoomController.RoomPaint}
37613      */
37614     RoomController.prototype.getWallSidesPaint = function () {
37615         return this.wallSidesPaint;
37616     };
37617     /**
37618      * Sets the edited shininess of the wall sides.
37619      * @param {number} wallSidesShininess
37620      */
37621     RoomController.prototype.setWallSidesShininess = function (wallSidesShininess) {
37622         if (wallSidesShininess !== this.wallSidesShininess) {
37623             var oldWallSidesShininess = this.wallSidesShininess;
37624             this.wallSidesShininess = wallSidesShininess;
37625             this.propertyChangeSupport.firePropertyChange(/* name */ "WALL_SIDES_SHININESS", oldWallSidesShininess, wallSidesShininess);
37626         }
37627     };
37628     /**
37629      * Returns the edited shininess of the wall sides.
37630      * @return {number}
37631      */
37632     RoomController.prototype.getWallSidesShininess = function () {
37633         return this.wallSidesShininess;
37634     };
37635     /**
37636      * Controls the modification of selected rooms in edited home.
37637      */
37638     RoomController.prototype.modifyRooms = function () {
37639         var oldSelection = this.home.getSelectedItems();
37640         var selectedRooms = Home.getRoomsSubList(oldSelection);
37641         if (!(selectedRooms.length == 0)) {
37642             var name_8 = this.getName();
37643             var areaVisible = this.getAreaVisible();
37644             var floorVisible = this.getFloorVisible();
37645             var floorPaint = this.getFloorPaint();
37646             var floorColor = floorPaint === RoomController.RoomPaint.COLORED ? this.getFloorColor() : null;
37647             var floorTexture = floorPaint === RoomController.RoomPaint.TEXTURED ? this.getFloorTextureController().getTexture() : null;
37648             var floorShininess = this.getFloorShininess();
37649             var ceilingVisible = this.getCeilingVisible();
37650             var ceilingPaint = this.getCeilingPaint();
37651             var ceilingColor = ceilingPaint === RoomController.RoomPaint.COLORED ? this.getCeilingColor() : null;
37652             var ceilingTexture = ceilingPaint === RoomController.RoomPaint.TEXTURED ? this.getCeilingTextureController().getTexture() : null;
37653             var ceilingShininess = this.getCeilingShininess();
37654             var ceilingFlat = this.getCeilingFlat();
37655             var wallSidesPaint = this.getWallSidesPaint();
37656             var wallSidesColor = wallSidesPaint === RoomController.RoomPaint.COLORED ? this.getWallSidesColor() : null;
37657             var wallSidesTexture = wallSidesPaint === RoomController.RoomPaint.TEXTURED ? this.getWallSidesTextureController().getTexture() : null;
37658             var wallSidesShininess = this.getWallSidesShininess();
37659             var wallSidesBaseboardVisible = this.getWallSidesBaseboardController().getVisible();
37660             var wallSidesBaseboardThickness = this.getWallSidesBaseboardController().getThickness();
37661             var wallSidesBaseboardHeight = this.getWallSidesBaseboardController().getHeight();
37662             var wallSidesBaseboardPaint = this.getWallSidesBaseboardController().getPaint();
37663             var wallSidesBaseboardColor = wallSidesBaseboardPaint === BaseboardChoiceController.BaseboardPaint.COLORED ? this.getWallSidesBaseboardController().getColor() : null;
37664             var wallSidesBaseboardTexture = wallSidesBaseboardPaint === BaseboardChoiceController.BaseboardPaint.TEXTURED ? this.getWallSidesBaseboardController().getTextureController().getTexture() : null;
37665             var selectedRoomsWallSides = this.getRoomsWallSides(selectedRooms, null);
37666             var modifiedRooms = (function (s) { var a = []; while (s-- > 0)
37667                 a.push(null); return a; })(/* size */ selectedRooms.length);
37668             for (var i = 0; i < modifiedRooms.length; i++) {
37669                 {
37670                     modifiedRooms[i] = new RoomController.ModifiedRoom(/* get */ selectedRooms[i]);
37671                 }
37672                 ;
37673             }
37674             var deletedWalls = ([]);
37675             var addedWalls = ([]);
37676             var newSelection = (oldSelection.slice(0));
37677             if (this.splitSurroundingWalls) {
37678                 if (this.splitWalls(selectedRoomsWallSides, deletedWalls, addedWalls, newSelection)) {
37679                     this.home.setSelectedItems(newSelection);
37680                     selectedRoomsWallSides = this.getRoomsWallSides(selectedRooms, selectedRoomsWallSides);
37681                 }
37682             }
37683             var modifiedWallSides = (function (s) { var a = []; while (s-- > 0)
37684                 a.push(null); return a; })(/* size */ selectedRoomsWallSides.length);
37685             for (var i = 0; i < modifiedWallSides.length; i++) {
37686                 {
37687                     modifiedWallSides[i] = new RoomController.ModifiedWallSide(/* get */ selectedRoomsWallSides[i]);
37688                 }
37689                 ;
37690             }
37691             RoomController.doModifyRoomsAndWallSides(this.home, modifiedRooms, name_8, areaVisible, floorVisible, floorPaint, floorColor, floorTexture, floorShininess, ceilingVisible, ceilingPaint, ceilingColor, ceilingTexture, ceilingShininess, ceilingFlat, modifiedWallSides, this.preferences.getNewWallBaseboardThickness(), this.preferences.getNewWallBaseboardHeight(), wallSidesPaint, wallSidesColor, wallSidesTexture, wallSidesShininess, wallSidesBaseboardVisible, wallSidesBaseboardThickness, wallSidesBaseboardHeight, wallSidesBaseboardPaint, wallSidesBaseboardColor, wallSidesBaseboardTexture, null, null);
37692             if (this.undoSupport != null) {
37693                 this.undoSupport.postEdit(new RoomController.RoomsAndWallSidesModificationUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), /* toArray */ newSelection.slice(0), modifiedRooms, name_8, areaVisible, floorVisible, floorPaint, floorColor, floorTexture, floorShininess, ceilingVisible, ceilingPaint, ceilingColor, ceilingTexture, ceilingShininess, ceilingFlat, modifiedWallSides, this.preferences.getNewWallBaseboardThickness(), this.preferences.getNewWallBaseboardHeight(), wallSidesPaint, wallSidesColor, wallSidesTexture, wallSidesShininess, wallSidesBaseboardVisible, wallSidesBaseboardThickness, wallSidesBaseboardHeight, wallSidesBaseboardPaint, wallSidesBaseboardColor, wallSidesBaseboardTexture, /* toArray */ deletedWalls.slice(0), /* toArray */ addedWalls.slice(0)));
37694             }
37695             if (name_8 != null) {
37696                 this.preferences.addAutoCompletionString("RoomName", name_8);
37697             }
37698         }
37699     };
37700     /**
37701      * Splits walls that overfill on other rooms if needed and returns <code>false</code> if the operation wasn't needed.
37702      * @param {RoomController.WallSide[]} wallSides
37703      * @param {RoomController.ModifiedWall[]} deletedWalls
37704      * @param {RoomController.ModifiedWall[]} addedWalls
37705      * @param {*[]} selectedItems
37706      * @return {boolean}
37707      * @private
37708      */
37709     RoomController.prototype.splitWalls = function (wallSides, deletedWalls, addedWalls, selectedItems) {
37710         var existingWalls = null;
37711         var newWalls = ([]);
37712         var splitWallSide;
37713         var _loop_3 = function () {
37714             {
37715                 splitWallSide = null;
37716                 var firstWall = null;
37717                 var secondWall = null;
37718                 var deletedWall = null;
37719                 for (var i = 0; i < /* size */ wallSides.length && splitWallSide == null; i++) {
37720                     {
37721                         var wallSide = wallSides[i];
37722                         var wall = wallSide.getWall();
37723                         var arcExtent = wall.getArcExtent();
37724                         if (arcExtent == null || /* floatValue */ arcExtent === 0) {
37725                             var wallArea = new java.awt.geom.Area(this_1.getPath(wall.getPoints$(), true));
37726                             for (var index = 0; index < wallSides.length; index++) {
37727                                 var intersectedWallSide = wallSides[index];
37728                                 {
37729                                     var intersectedWall = intersectedWallSide.getWall();
37730                                     if (wall !== intersectedWall) {
37731                                         var intersectedWallArea = new java.awt.geom.Area(this_1.getPath(intersectedWall.getPoints$(), true));
37732                                         intersectedWallArea.intersect(wallArea);
37733                                         if (!intersectedWallArea.isEmpty() && intersectedWallArea.isSingular()) {
37734                                             var intersection = this_1.computeIntersection(wall.getXStart(), wall.getYStart(), wall.getXEnd(), wall.getYEnd(), intersectedWall.getXStart(), intersectedWall.getYStart(), intersectedWall.getXEnd(), intersectedWall.getYEnd());
37735                                             if (intersection != null) {
37736                                                 firstWall = wall.duplicate();
37737                                                 secondWall = wall.duplicate();
37738                                                 firstWall.setLevel(wall.getLevel());
37739                                                 secondWall.setLevel(wall.getLevel());
37740                                                 firstWall.setXEnd(intersection[0]);
37741                                                 firstWall.setYEnd(intersection[1]);
37742                                                 secondWall.setXStart(intersection[0]);
37743                                                 secondWall.setYStart(intersection[1]);
37744                                                 if (firstWall.getLength() > intersectedWall.getThickness() / 2 && secondWall.getLength() > intersectedWall.getThickness() / 2) {
37745                                                     if (deletedWalls == null) {
37746                                                         return { value: true };
37747                                                     }
37748                                                     if (existingWalls == null) {
37749                                                         existingWalls = ({});
37750                                                         for (var index1 = 0; index1 < wallSides.length; index1++) {
37751                                                             var side = wallSides[index1];
37752                                                             {
37753                                                                 if (!(function (m, k) { if (m.entries == null)
37754                                                                     m.entries = []; for (var i_1 = 0; i_1 < m.entries.length; i_1++)
37755                                                                     if (m.entries[i_1].key == null && k == null || m.entries[i_1].key.equals != null && m.entries[i_1].key.equals(k) || m.entries[i_1].key === k) {
37756                                                                         return true;
37757                                                                     } return false; })(existingWalls, side.getWall())) {
37758                                                                     /* put */ (function (m, k, v) { if (m.entries == null)
37759                                                                         m.entries = []; for (var i_2 = 0; i_2 < m.entries.length; i_2++)
37760                                                                         if (m.entries[i_2].key == null && k == null || m.entries[i_2].key.equals != null && m.entries[i_2].key.equals(k) || m.entries[i_2].key === k) {
37761                                                                             m.entries[i_2].value = v;
37762                                                                             return;
37763                                                                         } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(existingWalls, side.getWall(), new RoomController.ModifiedWall(side.getWall()));
37764                                                                 }
37765                                                             }
37766                                                         }
37767                                                     }
37768                                                     deletedWall = /* get */ (function (m, k) { if (m.entries == null)
37769                                                         m.entries = []; for (var i_3 = 0; i_3 < m.entries.length; i_3++)
37770                                                         if (m.entries[i_3].key == null && k == null || m.entries[i_3].key.equals != null && m.entries[i_3].key.equals(k) || m.entries[i_3].key === k) {
37771                                                             return m.entries[i_3].value;
37772                                                         } return null; })(existingWalls, wall);
37773                                                     var wallAtStart = wall.getWallAtStart();
37774                                                     if (wallAtStart != null) {
37775                                                         firstWall.setWallAtStart(wallAtStart);
37776                                                         if (wallAtStart.getWallAtEnd() === wall) {
37777                                                             wallAtStart.setWallAtEnd(firstWall);
37778                                                         }
37779                                                         else {
37780                                                             wallAtStart.setWallAtStart(firstWall);
37781                                                         }
37782                                                     }
37783                                                     var wallAtEnd = wall.getWallAtEnd();
37784                                                     if (wallAtEnd != null) {
37785                                                         secondWall.setWallAtEnd(wallAtEnd);
37786                                                         if (wallAtEnd.getWallAtEnd() === wall) {
37787                                                             wallAtEnd.setWallAtEnd(secondWall);
37788                                                         }
37789                                                         else {
37790                                                             wallAtEnd.setWallAtStart(secondWall);
37791                                                         }
37792                                                     }
37793                                                     firstWall.setWallAtEnd(secondWall);
37794                                                     secondWall.setWallAtStart(firstWall);
37795                                                     if (wall.getHeightAtEnd() != null) {
37796                                                         var heightAtIntersecion = wall.getHeight() + (wall.getHeightAtEnd() - wall.getHeight()) * java.awt.geom.Point2D.distance(wall.getXStart(), wall.getYStart(), intersection[0], intersection[1]) / wall.getLength();
37797                                                         firstWall.setHeightAtEnd(heightAtIntersecion);
37798                                                         secondWall.setHeight(heightAtIntersecion);
37799                                                     }
37800                                                     splitWallSide = wallSide;
37801                                                     break;
37802                                                 }
37803                                             }
37804                                         }
37805                                     }
37806                                 }
37807                             }
37808                         }
37809                     }
37810                     ;
37811                 }
37812                 if (splitWallSide != null) {
37813                     /* add */ (newWalls.push(firstWall) > 0);
37814                     /* add */ (newWalls.push(secondWall) > 0);
37815                     var splitWall_1 = splitWallSide.getWall();
37816                     if ( /* contains */(this_1.home.getWalls().indexOf((splitWall_1)) >= 0)) {
37817                         /* add */ (deletedWalls.push(deletedWall) > 0);
37818                     }
37819                     else {
37820                         for (var i = newWalls.length - 1; i >= 0; i--) {
37821                             {
37822                                 if ( /* get */newWalls[i] === splitWall_1) {
37823                                     /* remove */ newWalls.splice(i, 1)[0];
37824                                     break;
37825                                 }
37826                             }
37827                             ;
37828                         }
37829                     }
37830                     if ( /* remove */(function (a) { var index = a.indexOf(splitWall_1); if (index >= 0) {
37831                         a.splice(index, 1);
37832                         return true;
37833                     }
37834                     else {
37835                         return false;
37836                     } })(selectedItems)) {
37837                         /* add */ (selectedItems.push(firstWall) > 0);
37838                         /* add */ (selectedItems.push(secondWall) > 0);
37839                     }
37840                     /* remove */ (function (a) { var index = a.indexOf(splitWallSide); if (index >= 0) {
37841                         a.splice(index, 1);
37842                         return true;
37843                     }
37844                     else {
37845                         return false;
37846                     } })(wallSides);
37847                     /* add */ (wallSides.push(new RoomController.WallSide(firstWall, splitWallSide.getSide())) > 0);
37848                     /* add */ (wallSides.push(new RoomController.WallSide(secondWall, splitWallSide.getSide())) > 0);
37849                     var sameWallSides = ([]);
37850                     for (var i = wallSides.length - 1; i >= 0; i--) {
37851                         {
37852                             var wallSide = wallSides[i];
37853                             if (wallSide.getWall() === splitWall_1) {
37854                                 /* remove */ wallSides.splice(i, 1)[0];
37855                                 /* add */ (sameWallSides.push(new RoomController.WallSide(firstWall, wallSide.getSide())) > 0);
37856                                 /* add */ (sameWallSides.push(new RoomController.WallSide(secondWall, wallSide.getSide())) > 0);
37857                             }
37858                         }
37859                         ;
37860                     }
37861                     /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(wallSides, sameWallSides);
37862                 }
37863             }
37864         };
37865         var this_1 = this;
37866         do {
37867             var state_1 = _loop_3();
37868             if (typeof state_1 === "object")
37869                 return state_1.value;
37870         } while ((splitWallSide != null));
37871         if (deletedWalls == null) {
37872             return false;
37873         }
37874         else {
37875             for (var index = 0; index < newWalls.length; index++) {
37876                 var newWall = newWalls[index];
37877                 {
37878                     var addedWall = new RoomController.ModifiedWall(newWall);
37879                     /* add */ (addedWalls.push(addedWall) > 0);
37880                     this.home.addWall(newWall);
37881                     newWall.setLevel(addedWall.getLevel());
37882                 }
37883             }
37884             for (var index = 0; index < deletedWalls.length; index++) {
37885                 var deletedWall = deletedWalls[index];
37886                 {
37887                     this.home.deleteWall(deletedWall.getWall());
37888                 }
37889             }
37890             return !(deletedWalls.length == 0);
37891         }
37892     };
37893     /**
37894      * Returns the intersection between a line segment and a second line.
37895      * @param {number} xPoint1
37896      * @param {number} yPoint1
37897      * @param {number} xPoint2
37898      * @param {number} yPoint2
37899      * @param {number} xPoint3
37900      * @param {number} yPoint3
37901      * @param {number} xPoint4
37902      * @param {number} yPoint4
37903      * @return {float[]}
37904      * @private
37905      */
37906     RoomController.prototype.computeIntersection = function (xPoint1, yPoint1, xPoint2, yPoint2, xPoint3, yPoint3, xPoint4, yPoint4) {
37907         var point = PlanController.computeIntersection$float$float$float$float$float$float$float$float(xPoint1, yPoint1, xPoint2, yPoint2, xPoint3, yPoint3, xPoint4, yPoint4);
37908         if (java.awt.geom.Line2D.ptSegDistSq(xPoint1, yPoint1, xPoint2, yPoint2, point[0], point[1]) < 1.0E-7 && (Math.abs(xPoint1 - point[0]) > 1.0E-4 || Math.abs(yPoint1 - point[1]) > 1.0E-4) && (Math.abs(xPoint2 - point[0]) > 1.0E-4 || Math.abs(yPoint2 - point[1]) > 1.0E-4)) {
37909             return point;
37910         }
37911         else {
37912             return null;
37913         }
37914     };
37915     /**
37916      * Modifies rooms and walls properties with the values in parameter.
37917      * @param {Home} home
37918      * @param {com.eteks.sweethome3d.viewcontroller.RoomController.ModifiedRoom[]} modifiedRooms
37919      * @param {string} name
37920      * @param {boolean} areaVisible
37921      * @param {boolean} floorVisible
37922      * @param {RoomController.RoomPaint} floorPaint
37923      * @param {number} floorColor
37924      * @param {HomeTexture} floorTexture
37925      * @param {number} floorShininess
37926      * @param {boolean} ceilingVisible
37927      * @param {RoomController.RoomPaint} ceilingPaint
37928      * @param {number} ceilingColor
37929      * @param {HomeTexture} ceilingTexture
37930      * @param {number} ceilingShininess
37931      * @param {boolean} ceilingFlat
37932      * @param {com.eteks.sweethome3d.viewcontroller.RoomController.ModifiedWallSide[]} modifiedWallSides
37933      * @param {number} newWallBaseboardThickness
37934      * @param {number} newWallBaseboardHeight
37935      * @param {RoomController.RoomPaint} wallSidesPaint
37936      * @param {number} wallSidesColor
37937      * @param {HomeTexture} wallSidesTexture
37938      * @param {number} wallSidesShininess
37939      * @param {boolean} wallSidesBaseboardVisible
37940      * @param {number} wallSidesBaseboardThickness
37941      * @param {number} wallSidesBaseboardHeight
37942      * @param {BaseboardChoiceController.BaseboardPaint} wallSidesBaseboardPaint
37943      * @param {number} wallSidesBaseboardColor
37944      * @param {HomeTexture} wallSidesBaseboardTexture
37945      * @param {com.eteks.sweethome3d.viewcontroller.RoomController.ModifiedWall[]} deletedWalls
37946      * @param {com.eteks.sweethome3d.viewcontroller.RoomController.ModifiedWall[]} addedWalls
37947      * @private
37948      */
37949     RoomController.doModifyRoomsAndWallSides = function (home, modifiedRooms, name, areaVisible, floorVisible, floorPaint, floorColor, floorTexture, floorShininess, ceilingVisible, ceilingPaint, ceilingColor, ceilingTexture, ceilingShininess, ceilingFlat, modifiedWallSides, newWallBaseboardThickness, newWallBaseboardHeight, wallSidesPaint, wallSidesColor, wallSidesTexture, wallSidesShininess, wallSidesBaseboardVisible, wallSidesBaseboardThickness, wallSidesBaseboardHeight, wallSidesBaseboardPaint, wallSidesBaseboardColor, wallSidesBaseboardTexture, deletedWalls, addedWalls) {
37950         if (deletedWalls != null) {
37951             for (var index = 0; index < addedWalls.length; index++) {
37952                 var newWall = addedWalls[index];
37953                 {
37954                     newWall.resetJoinedWalls();
37955                     home.addWall(newWall.getWall());
37956                     newWall.getWall().setLevel(newWall.getLevel());
37957                 }
37958             }
37959             for (var index = 0; index < deletedWalls.length; index++) {
37960                 var deletedWall = deletedWalls[index];
37961                 {
37962                     home.deleteWall(deletedWall.getWall());
37963                 }
37964             }
37965         }
37966         for (var index = 0; index < modifiedRooms.length; index++) {
37967             var modifiedRoom = modifiedRooms[index];
37968             {
37969                 var room = modifiedRoom.getRoom();
37970                 if (name != null) {
37971                     room.setName(name);
37972                 }
37973                 if (areaVisible != null) {
37974                     room.setAreaVisible(areaVisible);
37975                 }
37976                 if (floorVisible != null) {
37977                     room.setFloorVisible(floorVisible);
37978                 }
37979                 if (floorPaint != null) {
37980                     switch ((floorPaint)) {
37981                         case RoomController.RoomPaint.DEFAULT:
37982                             room.setFloorColor(null);
37983                             room.setFloorTexture(null);
37984                             break;
37985                         case RoomController.RoomPaint.COLORED:
37986                             room.setFloorColor(floorColor);
37987                             room.setFloorTexture(null);
37988                             break;
37989                         case RoomController.RoomPaint.TEXTURED:
37990                             room.setFloorColor(null);
37991                             room.setFloorTexture(floorTexture);
37992                             break;
37993                     }
37994                 }
37995                 if (floorShininess != null) {
37996                     room.setFloorShininess(floorShininess);
37997                 }
37998                 if (ceilingVisible != null) {
37999                     room.setCeilingVisible(ceilingVisible);
38000                 }
38001                 if (ceilingPaint != null) {
38002                     switch ((ceilingPaint)) {
38003                         case RoomController.RoomPaint.DEFAULT:
38004                             room.setCeilingColor(null);
38005                             room.setCeilingTexture(null);
38006                             break;
38007                         case RoomController.RoomPaint.COLORED:
38008                             room.setCeilingColor(ceilingColor);
38009                             room.setCeilingTexture(null);
38010                             break;
38011                         case RoomController.RoomPaint.TEXTURED:
38012                             room.setCeilingColor(null);
38013                             room.setCeilingTexture(ceilingTexture);
38014                             break;
38015                     }
38016                 }
38017                 if (ceilingShininess != null) {
38018                     room.setCeilingShininess(ceilingShininess);
38019                 }
38020                 if (ceilingFlat != null) {
38021                     room.setCeilingFlat(ceilingFlat);
38022                 }
38023             }
38024         }
38025         for (var index = 0; index < modifiedWallSides.length; index++) {
38026             var modifiedWallSide = modifiedWallSides[index];
38027             {
38028                 var wallSide = modifiedWallSide.getWallSide();
38029                 var wall = wallSide.getWall();
38030                 if (wallSide.getSide() === RoomController.WallSide.LEFT_SIDE) {
38031                     if (wallSidesPaint != null) {
38032                         switch ((wallSidesPaint)) {
38033                             case RoomController.RoomPaint.DEFAULT:
38034                                 wall.setLeftSideColor(null);
38035                                 wall.setLeftSideTexture(null);
38036                                 break;
38037                             case RoomController.RoomPaint.COLORED:
38038                                 wall.setLeftSideColor(wallSidesColor);
38039                                 wall.setLeftSideTexture(null);
38040                                 break;
38041                             case RoomController.RoomPaint.TEXTURED:
38042                                 wall.setLeftSideColor(null);
38043                                 wall.setLeftSideTexture(wallSidesTexture);
38044                                 break;
38045                         }
38046                     }
38047                     if (wallSidesShininess != null) {
38048                         wall.setLeftSideShininess(wallSidesShininess);
38049                     }
38050                 }
38051                 else {
38052                     if (wallSidesPaint != null) {
38053                         switch ((wallSidesPaint)) {
38054                             case RoomController.RoomPaint.DEFAULT:
38055                                 wall.setRightSideColor(null);
38056                                 wall.setRightSideTexture(null);
38057                                 break;
38058                             case RoomController.RoomPaint.COLORED:
38059                                 wall.setRightSideColor(wallSidesColor);
38060                                 wall.setRightSideTexture(null);
38061                                 break;
38062                             case RoomController.RoomPaint.TEXTURED:
38063                                 wall.setRightSideColor(null);
38064                                 wall.setRightSideTexture(wallSidesTexture);
38065                                 break;
38066                         }
38067                     }
38068                     if (wallSidesShininess != null) {
38069                         wall.setRightSideShininess(wallSidesShininess);
38070                     }
38071                 }
38072                 if (wallSidesBaseboardVisible === false) {
38073                     if (wallSide.getSide() === RoomController.WallSide.LEFT_SIDE) {
38074                         wall.setLeftSideBaseboard(null);
38075                     }
38076                     else {
38077                         wall.setRightSideBaseboard(null);
38078                     }
38079                 }
38080                 else {
38081                     var baseboard = wallSide.getSide() === RoomController.WallSide.LEFT_SIDE ? wall.getLeftSideBaseboard() : wall.getRightSideBaseboard();
38082                     if (wallSidesBaseboardVisible === true || baseboard != null) {
38083                         var baseboardThickness = baseboard != null ? baseboard.getThickness() : newWallBaseboardThickness;
38084                         var baseboardHeight = baseboard != null ? baseboard.getHeight() : newWallBaseboardHeight;
38085                         var baseboardColor = baseboard != null ? baseboard.getColor() : null;
38086                         var baseboardTexture = baseboard != null ? baseboard.getTexture() : null;
38087                         if (wallSidesBaseboardPaint != null) {
38088                             switch ((wallSidesBaseboardPaint)) {
38089                                 case BaseboardChoiceController.BaseboardPaint.DEFAULT:
38090                                     baseboardColor = null;
38091                                     baseboardTexture = null;
38092                                     break;
38093                                 case BaseboardChoiceController.BaseboardPaint.COLORED:
38094                                     if (wallSidesBaseboardColor != null) {
38095                                         baseboardColor = wallSidesBaseboardColor;
38096                                     }
38097                                     baseboardTexture = null;
38098                                     break;
38099                                 case BaseboardChoiceController.BaseboardPaint.TEXTURED:
38100                                     baseboardColor = null;
38101                                     if (wallSidesBaseboardTexture != null) {
38102                                         baseboardTexture = wallSidesBaseboardTexture;
38103                                     }
38104                                     break;
38105                             }
38106                         }
38107                         baseboard = Baseboard.getInstance(wallSidesBaseboardThickness != null ? wallSidesBaseboardThickness : baseboardThickness, wallSidesBaseboardHeight != null ? wallSidesBaseboardHeight : baseboardHeight, baseboardColor, baseboardTexture);
38108                         if (wallSide.getSide() === RoomController.WallSide.LEFT_SIDE) {
38109                             wall.setLeftSideBaseboard(baseboard);
38110                         }
38111                         else {
38112                             wall.setRightSideBaseboard(baseboard);
38113                         }
38114                     }
38115                 }
38116             }
38117         }
38118     };
38119     /**
38120      * Restores room properties from the values stored in <code>modifiedRooms</code> and <code>modifiedWallSides</code>.
38121      * @param {Home} home
38122      * @param {com.eteks.sweethome3d.viewcontroller.RoomController.ModifiedRoom[]} modifiedRooms
38123      * @param {com.eteks.sweethome3d.viewcontroller.RoomController.ModifiedWallSide[]} modifiedWallSides
38124      * @param {com.eteks.sweethome3d.viewcontroller.RoomController.ModifiedWall[]} deletedWalls
38125      * @param {com.eteks.sweethome3d.viewcontroller.RoomController.ModifiedWall[]} addedWalls
38126      * @private
38127      */
38128     RoomController.undoModifyRoomsAndWallSides = function (home, modifiedRooms, modifiedWallSides, deletedWalls, addedWalls) {
38129         for (var index = 0; index < modifiedRooms.length; index++) {
38130             var modifiedRoom = modifiedRooms[index];
38131             {
38132                 modifiedRoom.reset();
38133             }
38134         }
38135         for (var index = 0; index < modifiedWallSides.length; index++) {
38136             var modifiedWallSide = modifiedWallSides[index];
38137             {
38138                 modifiedWallSide.reset();
38139             }
38140         }
38141         for (var index = 0; index < addedWalls.length; index++) {
38142             var newWall = addedWalls[index];
38143             {
38144                 home.deleteWall(newWall.getWall());
38145             }
38146         }
38147         for (var index = 0; index < deletedWalls.length; index++) {
38148             var deletedWall = deletedWalls[index];
38149             {
38150                 deletedWall.resetJoinedWalls();
38151                 home.addWall(deletedWall.getWall());
38152                 deletedWall.getWall().setLevel(deletedWall.getLevel());
38153             }
38154         }
38155     };
38156     return RoomController;
38157 }());
38158 RoomController["__class"] = "com.eteks.sweethome3d.viewcontroller.RoomController";
38159 RoomController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
38160 (function (RoomController) {
38161     /**
38162      * The possible values for {@linkplain #getFloorPaint() room paint type}.
38163      * @enum
38164      * @property {RoomController.RoomPaint} DEFAULT
38165      * @property {RoomController.RoomPaint} COLORED
38166      * @property {RoomController.RoomPaint} TEXTURED
38167      * @class
38168      */
38169     var RoomPaint;
38170     (function (RoomPaint) {
38171         RoomPaint[RoomPaint["DEFAULT"] = 0] = "DEFAULT";
38172         RoomPaint[RoomPaint["COLORED"] = 1] = "COLORED";
38173         RoomPaint[RoomPaint["TEXTURED"] = 2] = "TEXTURED";
38174     })(RoomPaint = RoomController.RoomPaint || (RoomController.RoomPaint = {}));
38175     /**
38176      * Undoable edit for rooms modification. This class isn't anonymous to avoid
38177      * being bound to controller and its view.
38178      * @extends LocalizedUndoableEdit
38179      * @class
38180      */
38181     var RoomsAndWallSidesModificationUndoableEdit = /** @class */ (function (_super) {
38182         __extends(RoomsAndWallSidesModificationUndoableEdit, _super);
38183         function RoomsAndWallSidesModificationUndoableEdit(home, preferences, oldSelection, newSelection, modifiedRooms, name, areaVisible, floorVisible, floorPaint, floorColor, floorTexture, floorShininess, ceilingVisible, ceilingPaint, ceilingColor, ceilingTexture, ceilingShininess, ceilingFlat, modifiedWallSides, newWallBaseboardThickness, newWallBaseboardHeight, wallSidesPaint, wallSidesColor, wallSidesTexture, wallSidesShininess, wallSidesBaseboardVisible, wallSidesBaseboardThickness, wallSidesBaseboardHeight, wallSidesBaseboardPaint, wallSidesBaseboardColor, wallSidesBaseboardTexture, deletedWalls, addedWalls) {
38184             var _this = _super.call(this, preferences, RoomController, "undoModifyRoomsName") || this;
38185             if (_this.home === undefined) {
38186                 _this.home = null;
38187             }
38188             if (_this.oldSelection === undefined) {
38189                 _this.oldSelection = null;
38190             }
38191             if (_this.newSelection === undefined) {
38192                 _this.newSelection = null;
38193             }
38194             if (_this.modifiedRooms === undefined) {
38195                 _this.modifiedRooms = null;
38196             }
38197             if (_this.name === undefined) {
38198                 _this.name = null;
38199             }
38200             if (_this.areaVisible === undefined) {
38201                 _this.areaVisible = null;
38202             }
38203             if (_this.floorVisible === undefined) {
38204                 _this.floorVisible = null;
38205             }
38206             if (_this.floorPaint === undefined) {
38207                 _this.floorPaint = null;
38208             }
38209             if (_this.floorColor === undefined) {
38210                 _this.floorColor = null;
38211             }
38212             if (_this.floorTexture === undefined) {
38213                 _this.floorTexture = null;
38214             }
38215             if (_this.floorShininess === undefined) {
38216                 _this.floorShininess = null;
38217             }
38218             if (_this.ceilingVisible === undefined) {
38219                 _this.ceilingVisible = null;
38220             }
38221             if (_this.ceilingPaint === undefined) {
38222                 _this.ceilingPaint = null;
38223             }
38224             if (_this.ceilingColor === undefined) {
38225                 _this.ceilingColor = null;
38226             }
38227             if (_this.ceilingTexture === undefined) {
38228                 _this.ceilingTexture = null;
38229             }
38230             if (_this.ceilingShininess === undefined) {
38231                 _this.ceilingShininess = null;
38232             }
38233             if (_this.ceilingFlat === undefined) {
38234                 _this.ceilingFlat = null;
38235             }
38236             if (_this.modifiedWallSides === undefined) {
38237                 _this.modifiedWallSides = null;
38238             }
38239             if (_this.newWallBaseboardHeight === undefined) {
38240                 _this.newWallBaseboardHeight = 0;
38241             }
38242             if (_this.newWallBaseboardThickness === undefined) {
38243                 _this.newWallBaseboardThickness = 0;
38244             }
38245             if (_this.wallSidesPaint === undefined) {
38246                 _this.wallSidesPaint = null;
38247             }
38248             if (_this.wallSidesColor === undefined) {
38249                 _this.wallSidesColor = null;
38250             }
38251             if (_this.wallSidesTexture === undefined) {
38252                 _this.wallSidesTexture = null;
38253             }
38254             if (_this.wallSidesShininess === undefined) {
38255                 _this.wallSidesShininess = null;
38256             }
38257             if (_this.wallSidesBaseboardVisible === undefined) {
38258                 _this.wallSidesBaseboardVisible = null;
38259             }
38260             if (_this.wallSidesBaseboardThickness === undefined) {
38261                 _this.wallSidesBaseboardThickness = null;
38262             }
38263             if (_this.wallSidesBaseboardHeight === undefined) {
38264                 _this.wallSidesBaseboardHeight = null;
38265             }
38266             if (_this.wallSidesBaseboardPaint === undefined) {
38267                 _this.wallSidesBaseboardPaint = null;
38268             }
38269             if (_this.wallSidesBaseboardColor === undefined) {
38270                 _this.wallSidesBaseboardColor = null;
38271             }
38272             if (_this.wallSidesBaseboardTexture === undefined) {
38273                 _this.wallSidesBaseboardTexture = null;
38274             }
38275             if (_this.deletedWalls === undefined) {
38276                 _this.deletedWalls = null;
38277             }
38278             if (_this.addedWalls === undefined) {
38279                 _this.addedWalls = null;
38280             }
38281             _this.home = home;
38282             _this.oldSelection = oldSelection;
38283             _this.newSelection = newSelection;
38284             _this.modifiedRooms = modifiedRooms;
38285             _this.name = name;
38286             _this.areaVisible = areaVisible;
38287             _this.floorVisible = floorVisible;
38288             _this.floorPaint = floorPaint;
38289             _this.floorColor = floorColor;
38290             _this.floorTexture = floorTexture;
38291             _this.floorShininess = floorShininess;
38292             _this.ceilingVisible = ceilingVisible;
38293             _this.ceilingPaint = ceilingPaint;
38294             _this.ceilingColor = ceilingColor;
38295             _this.ceilingTexture = ceilingTexture;
38296             _this.ceilingShininess = ceilingShininess;
38297             _this.ceilingFlat = ceilingFlat;
38298             _this.modifiedWallSides = modifiedWallSides;
38299             _this.newWallBaseboardThickness = newWallBaseboardThickness;
38300             _this.newWallBaseboardHeight = newWallBaseboardHeight;
38301             _this.wallSidesPaint = wallSidesPaint;
38302             _this.wallSidesColor = wallSidesColor;
38303             _this.wallSidesTexture = wallSidesTexture;
38304             _this.wallSidesShininess = wallSidesShininess;
38305             _this.wallSidesBaseboardVisible = wallSidesBaseboardVisible;
38306             _this.wallSidesBaseboardThickness = wallSidesBaseboardThickness;
38307             _this.wallSidesBaseboardHeight = wallSidesBaseboardHeight;
38308             _this.wallSidesBaseboardPaint = wallSidesBaseboardPaint;
38309             _this.wallSidesBaseboardColor = wallSidesBaseboardColor;
38310             _this.wallSidesBaseboardTexture = wallSidesBaseboardTexture;
38311             _this.deletedWalls = deletedWalls;
38312             _this.addedWalls = addedWalls;
38313             return _this;
38314         }
38315         /**
38316          *
38317          */
38318         RoomsAndWallSidesModificationUndoableEdit.prototype.undo = function () {
38319             _super.prototype.undo.call(this);
38320             RoomController.undoModifyRoomsAndWallSides(this.home, this.modifiedRooms, this.modifiedWallSides, this.deletedWalls, this.addedWalls);
38321             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
38322         };
38323         /**
38324          *
38325          */
38326         RoomsAndWallSidesModificationUndoableEdit.prototype.redo = function () {
38327             _super.prototype.redo.call(this);
38328             RoomController.doModifyRoomsAndWallSides(this.home, this.modifiedRooms, this.name, this.areaVisible, this.floorVisible, this.floorPaint, this.floorColor, this.floorTexture, this.floorShininess, this.ceilingVisible, this.ceilingPaint, this.ceilingColor, this.ceilingTexture, this.ceilingShininess, this.ceilingFlat, this.modifiedWallSides, this.newWallBaseboardThickness, this.newWallBaseboardHeight, this.wallSidesPaint, this.wallSidesColor, this.wallSidesTexture, this.wallSidesShininess, this.wallSidesBaseboardVisible, this.wallSidesBaseboardThickness, this.wallSidesBaseboardHeight, this.wallSidesBaseboardPaint, this.wallSidesBaseboardColor, this.wallSidesBaseboardTexture, this.deletedWalls, this.addedWalls);
38329             this.home.setSelectedItems(/* asList */ this.newSelection.slice(0));
38330         };
38331         return RoomsAndWallSidesModificationUndoableEdit;
38332     }(LocalizedUndoableEdit));
38333     RoomController.RoomsAndWallSidesModificationUndoableEdit = RoomsAndWallSidesModificationUndoableEdit;
38334     RoomsAndWallSidesModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.RoomController.RoomsAndWallSidesModificationUndoableEdit";
38335     RoomsAndWallSidesModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
38336     /**
38337      * Stores the current properties values of a modified room.
38338      * @param {Room} room
38339      * @class
38340      */
38341     var ModifiedRoom = /** @class */ (function () {
38342         function ModifiedRoom(room) {
38343             if (this.room === undefined) {
38344                 this.room = null;
38345             }
38346             if (this.name === undefined) {
38347                 this.name = null;
38348             }
38349             if (this.areaVisible === undefined) {
38350                 this.areaVisible = false;
38351             }
38352             if (this.floorVisible === undefined) {
38353                 this.floorVisible = false;
38354             }
38355             if (this.floorColor === undefined) {
38356                 this.floorColor = null;
38357             }
38358             if (this.floorTexture === undefined) {
38359                 this.floorTexture = null;
38360             }
38361             if (this.floorShininess === undefined) {
38362                 this.floorShininess = 0;
38363             }
38364             if (this.ceilingVisible === undefined) {
38365                 this.ceilingVisible = false;
38366             }
38367             if (this.ceilingColor === undefined) {
38368                 this.ceilingColor = null;
38369             }
38370             if (this.ceilingTexture === undefined) {
38371                 this.ceilingTexture = null;
38372             }
38373             if (this.ceilingShininess === undefined) {
38374                 this.ceilingShininess = 0;
38375             }
38376             if (this.ceilingFlat === undefined) {
38377                 this.ceilingFlat = false;
38378             }
38379             this.room = room;
38380             this.name = room.getName();
38381             this.areaVisible = room.isAreaVisible();
38382             this.floorVisible = room.isFloorVisible();
38383             this.floorColor = room.getFloorColor();
38384             this.floorTexture = room.getFloorTexture();
38385             this.floorShininess = room.getFloorShininess();
38386             this.ceilingVisible = room.isCeilingVisible();
38387             this.ceilingColor = room.getCeilingColor();
38388             this.ceilingTexture = room.getCeilingTexture();
38389             this.ceilingShininess = room.getCeilingShininess();
38390             this.ceilingFlat = room.isCeilingFlat();
38391         }
38392         ModifiedRoom.prototype.getRoom = function () {
38393             return this.room;
38394         };
38395         ModifiedRoom.prototype.reset = function () {
38396             this.room.setName(this.name);
38397             this.room.setAreaVisible(this.areaVisible);
38398             this.room.setFloorVisible(this.floorVisible);
38399             this.room.setFloorColor(this.floorColor);
38400             this.room.setFloorTexture(this.floorTexture);
38401             this.room.setFloorShininess(this.floorShininess);
38402             this.room.setCeilingVisible(this.ceilingVisible);
38403             this.room.setCeilingColor(this.ceilingColor);
38404             this.room.setCeilingTexture(this.ceilingTexture);
38405             this.room.setCeilingShininess(this.ceilingShininess);
38406             this.room.setCeilingFlat(this.ceilingFlat);
38407         };
38408         return ModifiedRoom;
38409     }());
38410     RoomController.ModifiedRoom = ModifiedRoom;
38411     ModifiedRoom["__class"] = "com.eteks.sweethome3d.viewcontroller.RoomController.ModifiedRoom";
38412     /**
38413      * A wall side.
38414      * @param {Wall} wall
38415      * @param {number} side
38416      * @class
38417      */
38418     var WallSide = /** @class */ (function () {
38419         function WallSide(wall, side) {
38420             if (this.wall === undefined) {
38421                 this.wall = null;
38422             }
38423             if (this.side === undefined) {
38424                 this.side = 0;
38425             }
38426             if (this.wallAtStart === undefined) {
38427                 this.wallAtStart = null;
38428             }
38429             if (this.wallAtEnd === undefined) {
38430                 this.wallAtEnd = null;
38431             }
38432             if (this.joinedAtEndOfWallAtStart === undefined) {
38433                 this.joinedAtEndOfWallAtStart = false;
38434             }
38435             if (this.joinedAtStartOfWallAtEnd === undefined) {
38436                 this.joinedAtStartOfWallAtEnd = false;
38437             }
38438             this.wall = wall;
38439             this.side = side;
38440             this.wallAtStart = wall.getWallAtStart();
38441             this.joinedAtEndOfWallAtStart = this.wallAtStart != null && this.wallAtStart.getWallAtEnd() === wall;
38442             this.wallAtEnd = wall.getWallAtEnd();
38443             this.joinedAtStartOfWallAtEnd = this.wallAtEnd != null && this.wallAtEnd.getWallAtStart() === wall;
38444         }
38445         WallSide.prototype.getWall = function () {
38446             return this.wall;
38447         };
38448         WallSide.prototype.getSide = function () {
38449             return this.side;
38450         };
38451         WallSide.prototype.getWallAtStart = function () {
38452             return this.wallAtStart;
38453         };
38454         WallSide.prototype.getWallAtEnd = function () {
38455             return this.wallAtEnd;
38456         };
38457         WallSide.prototype.isJoinedAtEndOfWallAtStart = function () {
38458             return this.joinedAtEndOfWallAtStart;
38459         };
38460         WallSide.prototype.isJoinedAtStartOfWallAtEnd = function () {
38461             return this.joinedAtStartOfWallAtEnd;
38462         };
38463         WallSide.LEFT_SIDE = 0;
38464         WallSide.RIGHT_SIDE = 1;
38465         return WallSide;
38466     }());
38467     RoomController.WallSide = WallSide;
38468     WallSide["__class"] = "com.eteks.sweethome3d.viewcontroller.RoomController.WallSide";
38469     /**
38470      * A modified wall.
38471      * @param {Wall} wall
38472      * @class
38473      */
38474     var ModifiedWall = /** @class */ (function () {
38475         function ModifiedWall(wall) {
38476             if (this.wall === undefined) {
38477                 this.wall = null;
38478             }
38479             if (this.level === undefined) {
38480                 this.level = null;
38481             }
38482             if (this.wallAtStart === undefined) {
38483                 this.wallAtStart = null;
38484             }
38485             if (this.wallAtEnd === undefined) {
38486                 this.wallAtEnd = null;
38487             }
38488             if (this.joinedAtEndOfWallAtStart === undefined) {
38489                 this.joinedAtEndOfWallAtStart = false;
38490             }
38491             if (this.joinedAtStartOfWallAtEnd === undefined) {
38492                 this.joinedAtStartOfWallAtEnd = false;
38493             }
38494             this.wall = wall;
38495             this.level = wall.getLevel();
38496             this.wallAtStart = wall.getWallAtStart();
38497             this.joinedAtEndOfWallAtStart = this.wallAtStart != null && this.wallAtStart.getWallAtEnd() === wall;
38498             this.wallAtEnd = wall.getWallAtEnd();
38499             this.joinedAtStartOfWallAtEnd = this.wallAtEnd != null && this.wallAtEnd.getWallAtStart() === wall;
38500         }
38501         ModifiedWall.prototype.getWall = function () {
38502             return this.wall;
38503         };
38504         ModifiedWall.prototype.getLevel = function () {
38505             return this.level;
38506         };
38507         ModifiedWall.prototype.resetJoinedWalls = function () {
38508             if (this.wallAtStart != null) {
38509                 this.wall.setWallAtStart(this.wallAtStart);
38510                 if (this.joinedAtEndOfWallAtStart) {
38511                     this.wallAtStart.setWallAtEnd(this.wall);
38512                 }
38513                 else {
38514                     this.wallAtStart.setWallAtStart(this.wall);
38515                 }
38516             }
38517             if (this.wallAtEnd != null) {
38518                 this.wall.setWallAtEnd(this.wallAtEnd);
38519                 if (this.joinedAtStartOfWallAtEnd) {
38520                     this.wallAtEnd.setWallAtStart(this.wall);
38521                 }
38522                 else {
38523                     this.wallAtEnd.setWallAtEnd(this.wall);
38524                 }
38525             }
38526         };
38527         return ModifiedWall;
38528     }());
38529     RoomController.ModifiedWall = ModifiedWall;
38530     ModifiedWall["__class"] = "com.eteks.sweethome3d.viewcontroller.RoomController.ModifiedWall";
38531     /**
38532      * Stores the current properties values of a modified wall side.
38533      * @param {RoomController.WallSide} wallSide
38534      * @class
38535      */
38536     var ModifiedWallSide = /** @class */ (function () {
38537         function ModifiedWallSide(wallSide) {
38538             if (this.wallSide === undefined) {
38539                 this.wallSide = null;
38540             }
38541             if (this.wallColor === undefined) {
38542                 this.wallColor = null;
38543             }
38544             if (this.wallTexture === undefined) {
38545                 this.wallTexture = null;
38546             }
38547             if (this.wallShininess === undefined) {
38548                 this.wallShininess = null;
38549             }
38550             if (this.wallBaseboard === undefined) {
38551                 this.wallBaseboard = null;
38552             }
38553             this.wallSide = wallSide;
38554             var wall = wallSide.getWall();
38555             if (wallSide.getSide() === RoomController.WallSide.LEFT_SIDE) {
38556                 this.wallColor = wall.getLeftSideColor();
38557                 this.wallTexture = wall.getLeftSideTexture();
38558                 this.wallShininess = wall.getLeftSideShininess();
38559                 this.wallBaseboard = wall.getLeftSideBaseboard();
38560             }
38561             else {
38562                 this.wallColor = wall.getRightSideColor();
38563                 this.wallTexture = wall.getRightSideTexture();
38564                 this.wallShininess = wall.getRightSideShininess();
38565                 this.wallBaseboard = wall.getRightSideBaseboard();
38566             }
38567         }
38568         ModifiedWallSide.prototype.getWallSide = function () {
38569             return this.wallSide;
38570         };
38571         ModifiedWallSide.prototype.reset = function () {
38572             var wall = this.wallSide.getWall();
38573             if (this.wallSide.getSide() === RoomController.WallSide.LEFT_SIDE) {
38574                 wall.setLeftSideColor(this.wallColor);
38575                 wall.setLeftSideTexture(this.wallTexture);
38576                 wall.setLeftSideShininess(this.wallShininess);
38577                 wall.setLeftSideBaseboard(this.wallBaseboard);
38578             }
38579             else {
38580                 wall.setRightSideColor(this.wallColor);
38581                 wall.setRightSideTexture(this.wallTexture);
38582                 wall.setRightSideShininess(this.wallShininess);
38583                 wall.setRightSideBaseboard(this.wallBaseboard);
38584             }
38585             var wallAtStart = this.wallSide.getWallAtStart();
38586             if (wallAtStart != null) {
38587                 wall.setWallAtStart(wallAtStart);
38588                 if (this.wallSide.isJoinedAtEndOfWallAtStart()) {
38589                     wallAtStart.setWallAtEnd(wall);
38590                 }
38591                 else {
38592                     wallAtStart.setWallAtStart(wall);
38593                 }
38594             }
38595             var wallAtEnd = this.wallSide.getWallAtEnd();
38596             if (wallAtEnd != null) {
38597                 wall.setWallAtEnd(wallAtEnd);
38598                 if (this.wallSide.isJoinedAtStartOfWallAtEnd()) {
38599                     wallAtEnd.setWallAtStart(wall);
38600                 }
38601                 else {
38602                     wallAtEnd.setWallAtEnd(wall);
38603                 }
38604             }
38605         };
38606         return ModifiedWallSide;
38607     }());
38608     RoomController.ModifiedWallSide = ModifiedWallSide;
38609     ModifiedWallSide["__class"] = "com.eteks.sweethome3d.viewcontroller.RoomController.ModifiedWallSide";
38610     var RoomController$0 = /** @class */ (function () {
38611         function RoomController$0(__parent) {
38612             this.__parent = __parent;
38613         }
38614         RoomController$0.prototype.propertyChange = function (ev) {
38615             this.__parent.setFloorPaint(RoomController.RoomPaint.TEXTURED);
38616         };
38617         return RoomController$0;
38618     }());
38619     RoomController.RoomController$0 = RoomController$0;
38620     var RoomController$1 = /** @class */ (function () {
38621         function RoomController$1(__parent) {
38622             this.__parent = __parent;
38623         }
38624         RoomController$1.prototype.propertyChange = function (ev) {
38625             this.__parent.setCeilingPaint(RoomController.RoomPaint.TEXTURED);
38626         };
38627         return RoomController$1;
38628     }());
38629     RoomController.RoomController$1 = RoomController$1;
38630     var RoomController$2 = /** @class */ (function () {
38631         function RoomController$2(__parent) {
38632             this.__parent = __parent;
38633         }
38634         RoomController$2.prototype.propertyChange = function (ev) {
38635             this.__parent.setWallSidesPaint(RoomController.RoomPaint.TEXTURED);
38636         };
38637         return RoomController$2;
38638     }());
38639     RoomController.RoomController$2 = RoomController$2;
38640 })(RoomController || (RoomController = {}));
38641 /**
38642  * A MVC controller for the compass view.
38643  * @author Emmanuel Puybaret
38644  * @param {Home} home
38645  * @param {UserPreferences} preferences
38646  * @param {Object} viewFactory
38647  * @param {javax.swing.undo.UndoableEditSupport} undoSupport
38648  * @class
38649  */
38650 var CompassController = /** @class */ (function () {
38651     function CompassController(home, preferences, viewFactory, undoSupport) {
38652         if (this.home === undefined) {
38653             this.home = null;
38654         }
38655         if (this.preferences === undefined) {
38656             this.preferences = null;
38657         }
38658         if (this.viewFactory === undefined) {
38659             this.viewFactory = null;
38660         }
38661         if (this.undoSupport === undefined) {
38662             this.undoSupport = null;
38663         }
38664         if (this.propertyChangeSupport === undefined) {
38665             this.propertyChangeSupport = null;
38666         }
38667         if (this.compassView === undefined) {
38668             this.compassView = null;
38669         }
38670         if (this.x === undefined) {
38671             this.x = 0;
38672         }
38673         if (this.y === undefined) {
38674             this.y = 0;
38675         }
38676         if (this.diameter === undefined) {
38677             this.diameter = 0;
38678         }
38679         if (this.visible === undefined) {
38680             this.visible = false;
38681         }
38682         if (this.northDirectionInDegrees === undefined) {
38683             this.northDirectionInDegrees = 0;
38684         }
38685         if (this.latitudeInDegrees === undefined) {
38686             this.latitudeInDegrees = 0;
38687         }
38688         if (this.longitudeInDegrees === undefined) {
38689             this.longitudeInDegrees = 0;
38690         }
38691         if (this.timeZone === undefined) {
38692             this.timeZone = null;
38693         }
38694         this.home = home;
38695         this.preferences = preferences;
38696         this.viewFactory = viewFactory;
38697         this.undoSupport = undoSupport;
38698         this.propertyChangeSupport = new PropertyChangeSupport(this);
38699         this.updateProperties();
38700     }
38701     /**
38702      * Returns the view associated with this controller.
38703      * @return {Object}
38704      */
38705     CompassController.prototype.getView = function () {
38706         if (this.compassView == null) {
38707             this.compassView = this.viewFactory.createCompassView(this.preferences, this);
38708         }
38709         return this.compassView;
38710     };
38711     /**
38712      * Displays the view controlled by this controller.
38713      * @param {Object} parentView
38714      */
38715     CompassController.prototype.displayView = function (parentView) {
38716         this.getView().displayView(parentView);
38717     };
38718     /**
38719      * Adds the property change <code>listener</code> in parameter to this controller.
38720      * @param {string} property
38721      * @param {PropertyChangeListener} listener
38722      */
38723     CompassController.prototype.addPropertyChangeListener = function (property, listener) {
38724         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
38725     };
38726     /**
38727      * Removes the property change <code>listener</code> in parameter from this controller.
38728      * @param {string} property
38729      * @param {PropertyChangeListener} listener
38730      */
38731     CompassController.prototype.removePropertyChangeListener = function (property, listener) {
38732         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
38733     };
38734     /**
38735      * Updates compass properties edited by this controller.
38736      */
38737     CompassController.prototype.updateProperties = function () {
38738         var compass = this.home.getCompass();
38739         this.setX(compass.getX());
38740         this.setY(compass.getY());
38741         this.setDiameter(compass.getDiameter());
38742         this.setVisible(compass.isVisible());
38743         this.setNorthDirectionInDegrees((function (x) { return x * 180 / Math.PI; })(compass.getNorthDirection()));
38744         this.setLatitudeInDegrees((function (x) { return x * 180 / Math.PI; })(compass.getLatitude()));
38745         this.setLongitudeInDegrees((function (x) { return x * 180 / Math.PI; })(compass.getLongitude()));
38746         this.setTimeZone(compass.getTimeZone());
38747     };
38748     /**
38749      * Returns the edited abscissa of the center.
38750      * @return {number}
38751      */
38752     CompassController.prototype.getX = function () {
38753         return this.x;
38754     };
38755     /**
38756      * Sets the edited abscissa of the center.
38757      * @param {number} x
38758      */
38759     CompassController.prototype.setX = function (x) {
38760         if (x !== this.x) {
38761             var oldX = this.x;
38762             this.x = x;
38763             this.propertyChangeSupport.firePropertyChange(/* name */ "X", oldX, x);
38764         }
38765     };
38766     /**
38767      * Returns the edited ordinate of the center.
38768      * @return {number}
38769      */
38770     CompassController.prototype.getY = function () {
38771         return this.y;
38772     };
38773     /**
38774      * Sets the edited ordinate of the center.
38775      * @param {number} y
38776      */
38777     CompassController.prototype.setY = function (y) {
38778         if (y !== this.y) {
38779             var oldY = this.y;
38780             this.y = y;
38781             this.propertyChangeSupport.firePropertyChange(/* name */ "Y", oldY, y);
38782         }
38783     };
38784     /**
38785      * Returns the edited diameter.
38786      * @return {number}
38787      */
38788     CompassController.prototype.getDiameter = function () {
38789         return this.diameter;
38790     };
38791     /**
38792      * Sets the edited diameter.
38793      * @param {number} diameter
38794      */
38795     CompassController.prototype.setDiameter = function (diameter) {
38796         if (diameter !== this.diameter) {
38797             var oldDiameter = this.diameter;
38798             this.diameter = diameter;
38799             this.propertyChangeSupport.firePropertyChange(/* name */ "DIAMETER", oldDiameter, diameter);
38800         }
38801     };
38802     /**
38803      * Returns whether compass is visible or not.
38804      * @return {boolean}
38805      */
38806     CompassController.prototype.isVisible = function () {
38807         return this.visible;
38808     };
38809     /**
38810      * Sets whether this compass is visible or not.
38811      * @param {boolean} visible
38812      */
38813     CompassController.prototype.setVisible = function (visible) {
38814         if (visible !== this.visible) {
38815             this.visible = visible;
38816             this.propertyChangeSupport.firePropertyChange(/* name */ "VISIBLE", !visible, visible);
38817         }
38818     };
38819     /**
38820      * Returns the edited North direction angle in degrees.
38821      * @return {number}
38822      */
38823     CompassController.prototype.getNorthDirectionInDegrees = function () {
38824         return this.northDirectionInDegrees;
38825     };
38826     /**
38827      * Sets the edited North direction angle.
38828      * @param {number} northDirectionInDegrees
38829      */
38830     CompassController.prototype.setNorthDirectionInDegrees = function (northDirectionInDegrees) {
38831         if (northDirectionInDegrees !== this.northDirectionInDegrees) {
38832             var oldNorthDirectionInDegrees = this.northDirectionInDegrees;
38833             this.northDirectionInDegrees = northDirectionInDegrees;
38834             this.propertyChangeSupport.firePropertyChange(/* name */ "NORTH_DIRECTION_IN_DEGREES", oldNorthDirectionInDegrees, northDirectionInDegrees);
38835         }
38836     };
38837     /**
38838      * Returns the edited latitude in degrees.
38839      * @return {number}
38840      */
38841     CompassController.prototype.getLatitudeInDegrees = function () {
38842         return this.latitudeInDegrees;
38843     };
38844     /**
38845      * Sets the edited latitude in degrees.
38846      * @param {number} latitudeInDegrees
38847      */
38848     CompassController.prototype.setLatitudeInDegrees = function (latitudeInDegrees) {
38849         if (latitudeInDegrees !== this.latitudeInDegrees) {
38850             var oldLatitudeInDegrees = this.latitudeInDegrees;
38851             this.latitudeInDegrees = latitudeInDegrees;
38852             this.propertyChangeSupport.firePropertyChange(/* name */ "LATITUDE_IN_DEGREES", oldLatitudeInDegrees, latitudeInDegrees);
38853         }
38854     };
38855     /**
38856      * Returns the edited longitude in degrees.
38857      * @return {number}
38858      */
38859     CompassController.prototype.getLongitudeInDegrees = function () {
38860         return this.longitudeInDegrees;
38861     };
38862     /**
38863      * Sets the edited longitude of the center.
38864      * @param {number} longitudeInDegrees
38865      */
38866     CompassController.prototype.setLongitudeInDegrees = function (longitudeInDegrees) {
38867         if (longitudeInDegrees !== this.longitudeInDegrees) {
38868             var oldLongitudeInDegrees = this.longitudeInDegrees;
38869             this.longitudeInDegrees = longitudeInDegrees;
38870             this.propertyChangeSupport.firePropertyChange(/* name */ "LONGITUDE_IN_DEGREES", oldLongitudeInDegrees, longitudeInDegrees);
38871         }
38872     };
38873     /**
38874      * Returns the edited time zone identifier.
38875      * @return {string}
38876      */
38877     CompassController.prototype.getTimeZone = function () {
38878         return this.timeZone;
38879     };
38880     /**
38881      * Sets the edited time zone identifier.
38882      * @param {string} timeZone
38883      */
38884     CompassController.prototype.setTimeZone = function (timeZone) {
38885         if (!(timeZone === this.timeZone)) {
38886             var oldTimeZone = this.timeZone;
38887             this.timeZone = timeZone;
38888             this.propertyChangeSupport.firePropertyChange(/* name */ "TIME_ZONE", oldTimeZone, timeZone);
38889         }
38890     };
38891     /**
38892      * Modifies home compass from the values stored in this controller.
38893      */
38894     CompassController.prototype.modifyCompass = function () {
38895         var x = this.getX();
38896         var y = this.getY();
38897         var diameter = this.getDiameter();
38898         var visible = this.isVisible();
38899         var northDirection = (function (x) { return x * Math.PI / 180; })(this.getNorthDirectionInDegrees());
38900         var latitude = (function (x) { return x * Math.PI / 180; })(this.getLatitudeInDegrees());
38901         var longitude = (function (x) { return x * Math.PI / 180; })(this.getLongitudeInDegrees());
38902         var timeZone = this.getTimeZone();
38903         var undoableEdit = new CompassController.CompassUndoableEdit(this.home.getCompass(), this.preferences, x, y, diameter, visible, northDirection, latitude, longitude, timeZone);
38904         CompassController.doModifyCompass(this.home.getCompass(), x, y, diameter, visible, northDirection, latitude, longitude, timeZone);
38905         this.undoSupport.postEdit(undoableEdit);
38906     };
38907     CompassController.doModifyCompass = function (compass, x, y, diameter, visible, northDirection, latitude, longitude, timeZone) {
38908         compass.setX(x);
38909         compass.setY(y);
38910         compass.setDiameter(diameter);
38911         compass.setVisible(visible);
38912         compass.setNorthDirection(northDirection);
38913         compass.setLatitude(latitude);
38914         compass.setLongitude(longitude);
38915         compass.setTimeZone(timeZone);
38916     };
38917     return CompassController;
38918 }());
38919 CompassController["__class"] = "com.eteks.sweethome3d.viewcontroller.CompassController";
38920 CompassController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
38921 (function (CompassController) {
38922     /**
38923      * Undoable edit for compass. This class isn't anonymous to avoid
38924      * being bound to controller and its view.
38925      * @param {Compass} compass
38926      * @param {UserPreferences} preferences
38927      * @param {number} newX
38928      * @param {number} newY
38929      * @param {number} newDiameter
38930      * @param {boolean} newVisible
38931      * @param {number} newNorthDirection
38932      * @param {number} newLatitude
38933      * @param {number} newLongitude
38934      * @param {string} newTimeZone
38935      * @class
38936      * @extends LocalizedUndoableEdit
38937      */
38938     var CompassUndoableEdit = /** @class */ (function (_super) {
38939         __extends(CompassUndoableEdit, _super);
38940         function CompassUndoableEdit(compass, preferences, newX, newY, newDiameter, newVisible, newNorthDirection, newLatitude, newLongitude, newTimeZone) {
38941             var _this = _super.call(this, preferences, CompassController, "undoModifyCompassName") || this;
38942             if (_this.compass === undefined) {
38943                 _this.compass = null;
38944             }
38945             if (_this.oldX === undefined) {
38946                 _this.oldX = 0;
38947             }
38948             if (_this.oldY === undefined) {
38949                 _this.oldY = 0;
38950             }
38951             if (_this.oldDiameter === undefined) {
38952                 _this.oldDiameter = 0;
38953             }
38954             if (_this.oldNorthDirection === undefined) {
38955                 _this.oldNorthDirection = 0;
38956             }
38957             if (_this.oldLatitude === undefined) {
38958                 _this.oldLatitude = 0;
38959             }
38960             if (_this.oldLongitude === undefined) {
38961                 _this.oldLongitude = 0;
38962             }
38963             if (_this.oldTimeZone === undefined) {
38964                 _this.oldTimeZone = null;
38965             }
38966             if (_this.oldVisible === undefined) {
38967                 _this.oldVisible = false;
38968             }
38969             if (_this.newX === undefined) {
38970                 _this.newX = 0;
38971             }
38972             if (_this.newY === undefined) {
38973                 _this.newY = 0;
38974             }
38975             if (_this.newDiameter === undefined) {
38976                 _this.newDiameter = 0;
38977             }
38978             if (_this.newNorthDirection === undefined) {
38979                 _this.newNorthDirection = 0;
38980             }
38981             if (_this.newLatitude === undefined) {
38982                 _this.newLatitude = 0;
38983             }
38984             if (_this.newLongitude === undefined) {
38985                 _this.newLongitude = 0;
38986             }
38987             if (_this.newTimeZone === undefined) {
38988                 _this.newTimeZone = null;
38989             }
38990             if (_this.newVisible === undefined) {
38991                 _this.newVisible = false;
38992             }
38993             _this.compass = compass;
38994             _this.oldX = compass.getX();
38995             _this.oldY = compass.getY();
38996             _this.oldDiameter = compass.getDiameter();
38997             _this.oldVisible = compass.isVisible();
38998             _this.oldNorthDirection = compass.getNorthDirection();
38999             _this.oldLatitude = compass.getLatitude();
39000             _this.oldLongitude = compass.getLongitude();
39001             _this.oldTimeZone = compass.getTimeZone();
39002             _this.newX = newX;
39003             _this.newY = newY;
39004             _this.newDiameter = newDiameter;
39005             _this.newVisible = newVisible;
39006             _this.newNorthDirection = newNorthDirection;
39007             _this.newLatitude = newLatitude;
39008             _this.newLongitude = newLongitude;
39009             _this.newTimeZone = newTimeZone;
39010             return _this;
39011         }
39012         /**
39013          *
39014          */
39015         CompassUndoableEdit.prototype.undo = function () {
39016             _super.prototype.undo.call(this);
39017             CompassController.doModifyCompass(this.compass, this.oldX, this.oldY, this.oldDiameter, this.oldVisible, this.oldNorthDirection, this.oldLatitude, this.oldLongitude, this.oldTimeZone);
39018         };
39019         /**
39020          *
39021          */
39022         CompassUndoableEdit.prototype.redo = function () {
39023             _super.prototype.redo.call(this);
39024             CompassController.doModifyCompass(this.compass, this.newX, this.newY, this.newDiameter, this.newVisible, this.newNorthDirection, this.newLatitude, this.newLongitude, this.newTimeZone);
39025         };
39026         return CompassUndoableEdit;
39027     }(LocalizedUndoableEdit));
39028     CompassController.CompassUndoableEdit = CompassUndoableEdit;
39029     CompassUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.CompassController.CompassUndoableEdit";
39030     CompassUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
39031 })(CompassController || (CompassController = {}));
39032 /**
39033  * Creates the controller of polyline view with undo support.
39034  * @param {Home} home
39035  * @param {UserPreferences} preferences
39036  * @param {Object} viewFactory
39037  * @param {Object} contentManager
39038  * @param {javax.swing.undo.UndoableEditSupport} undoSupport
39039  * @class
39040  * @author Emmanuel Puybaret
39041  */
39042 var PolylineController = /** @class */ (function () {
39043     function PolylineController(home, preferences, viewFactory, contentManager, undoSupport) {
39044         if (this.home === undefined) {
39045             this.home = null;
39046         }
39047         if (this.preferences === undefined) {
39048             this.preferences = null;
39049         }
39050         if (this.viewFactory === undefined) {
39051             this.viewFactory = null;
39052         }
39053         if (this.undoSupport === undefined) {
39054             this.undoSupport = null;
39055         }
39056         if (this.propertyChangeSupport === undefined) {
39057             this.propertyChangeSupport = null;
39058         }
39059         if (this.polylineView === undefined) {
39060             this.polylineView = null;
39061         }
39062         if (this.thickness === undefined) {
39063             this.thickness = null;
39064         }
39065         if (this.capStyleEditable === undefined) {
39066             this.capStyleEditable = false;
39067         }
39068         if (this.capStyle === undefined) {
39069             this.capStyle = null;
39070         }
39071         if (this.joinStyle === undefined) {
39072             this.joinStyle = null;
39073         }
39074         if (this.joinStyleEditable === undefined) {
39075             this.joinStyleEditable = false;
39076         }
39077         if (this.dashStyle === undefined) {
39078             this.dashStyle = null;
39079         }
39080         if (this.dashPattern === undefined) {
39081             this.dashPattern = null;
39082         }
39083         if (this.dashOffset === undefined) {
39084             this.dashOffset = null;
39085         }
39086         if (this.arrowsStyleEditable === undefined) {
39087             this.arrowsStyleEditable = false;
39088         }
39089         if (this.startArrowStyle === undefined) {
39090             this.startArrowStyle = null;
39091         }
39092         if (this.endArrowStyle === undefined) {
39093             this.endArrowStyle = null;
39094         }
39095         if (this.color === undefined) {
39096             this.color = null;
39097         }
39098         if (this.elevation === undefined) {
39099             this.elevation = null;
39100         }
39101         if (this.elevationEnabled === undefined) {
39102             this.elevationEnabled = null;
39103         }
39104         this.home = home;
39105         this.preferences = preferences;
39106         this.viewFactory = viewFactory;
39107         this.undoSupport = undoSupport;
39108         this.propertyChangeSupport = new PropertyChangeSupport(this);
39109         this.updateProperties();
39110     }
39111     /**
39112      * Returns the view associated with this controller.
39113      * @return {Object}
39114      */
39115     PolylineController.prototype.getView = function () {
39116         if (this.polylineView == null) {
39117             this.polylineView = this.viewFactory.createPolylineView(this.preferences, this);
39118         }
39119         return this.polylineView;
39120     };
39121     /**
39122      * Displays the view controlled by this controller.
39123      * @param {Object} parentView
39124      */
39125     PolylineController.prototype.displayView = function (parentView) {
39126         this.getView().displayView(parentView);
39127     };
39128     /**
39129      * Adds the property change <code>listener</code> in parameter to this controller.
39130      * @param {string} property
39131      * @param {PropertyChangeListener} listener
39132      */
39133     PolylineController.prototype.addPropertyChangeListener = function (property, listener) {
39134         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
39135     };
39136     /**
39137      * Removes the property change <code>listener</code> in parameter from this controller.
39138      * @param {string} property
39139      * @param {PropertyChangeListener} listener
39140      */
39141     PolylineController.prototype.removePropertyChangeListener = function (property, listener) {
39142         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
39143     };
39144     /**
39145      * Updates edited properties from selected polylines in the home edited by this controller.
39146      */
39147     PolylineController.prototype.updateProperties = function () {
39148         var selectedPolylines = Home.getPolylinesSubList(this.home.getSelectedItems());
39149         if ( /* isEmpty */(selectedPolylines.length == 0)) {
39150             this.setThickness(null);
39151             this.capStyleEditable = false;
39152             this.setCapStyle(null);
39153             this.joinStyleEditable = false;
39154             this.setJoinStyle(null);
39155             this.setDashStyle(null);
39156             this.dashPattern = null;
39157             this.setDashOffset(null);
39158             this.arrowsStyleEditable = false;
39159             this.setStartArrowStyle(null);
39160             this.setEndArrowStyle(null);
39161             this.setColor(null);
39162             this.elevationEnabled = false;
39163         }
39164         else {
39165             var firstPolyline = selectedPolylines[0];
39166             var thickness = firstPolyline.getThickness();
39167             for (var i = 1; i < /* size */ selectedPolylines.length; i++) {
39168                 {
39169                     if (thickness !== /* get */ selectedPolylines[i].getThickness()) {
39170                         thickness = null;
39171                         break;
39172                     }
39173                 }
39174                 ;
39175             }
39176             this.setThickness(thickness);
39177             this.capStyleEditable = false;
39178             for (var i = 0; i < /* size */ selectedPolylines.length; i++) {
39179                 {
39180                     if (!selectedPolylines[i].isClosedPath()) {
39181                         this.capStyleEditable = true;
39182                         break;
39183                     }
39184                 }
39185                 ;
39186             }
39187             if (this.capStyleEditable) {
39188                 var capStyle = firstPolyline.getCapStyle();
39189                 if (capStyle != null) {
39190                     for (var i = 1; i < /* size */ selectedPolylines.length; i++) {
39191                         {
39192                             if (capStyle !== /* get */ selectedPolylines[i].getCapStyle()) {
39193                                 capStyle = null;
39194                                 break;
39195                             }
39196                         }
39197                         ;
39198                     }
39199                 }
39200                 this.setCapStyle(capStyle);
39201             }
39202             else {
39203                 this.setCapStyle(null);
39204             }
39205             this.joinStyleEditable = false;
39206             for (var i = 0; i < /* size */ selectedPolylines.length; i++) {
39207                 {
39208                     if ( /* get */selectedPolylines[i].getPointCount() > 2) {
39209                         this.joinStyleEditable = true;
39210                         break;
39211                     }
39212                 }
39213                 ;
39214             }
39215             if (this.joinStyleEditable) {
39216                 var joinStyle = firstPolyline.getJoinStyle();
39217                 if (joinStyle != null) {
39218                     for (var i = 1; i < /* size */ selectedPolylines.length; i++) {
39219                         {
39220                             if (joinStyle !== /* get */ selectedPolylines[i].getJoinStyle()) {
39221                                 joinStyle = null;
39222                                 break;
39223                             }
39224                         }
39225                         ;
39226                     }
39227                 }
39228                 this.setJoinStyle(joinStyle);
39229             }
39230             else {
39231                 this.setJoinStyle(null);
39232             }
39233             var dashPattern = firstPolyline.getDashPattern();
39234             if (dashPattern != null) {
39235                 for (var i = 1; i < /* size */ selectedPolylines.length; i++) {
39236                     {
39237                         if (!(function (a1, a2) { if (a1 == null && a2 == null)
39238                             return true; if (a1 == null || a2 == null)
39239                             return false; if (a1.length != a2.length)
39240                             return false; for (var i_4 = 0; i_4 < a1.length; i_4++) {
39241                             if (a1[i_4] != a2[i_4])
39242                                 return false;
39243                         } return true; })(dashPattern, /* get */ selectedPolylines[i].getDashPattern())) {
39244                             dashPattern = null;
39245                             break;
39246                         }
39247                     }
39248                     ;
39249                 }
39250             }
39251             this.setDashPattern(dashPattern);
39252             if (dashPattern != null) {
39253                 var dashStyle = firstPolyline.getDashStyle();
39254                 if (dashStyle != null) {
39255                     for (var i = 1; i < /* size */ selectedPolylines.length; i++) {
39256                         {
39257                             if (dashStyle !== /* get */ selectedPolylines[i].getDashStyle()) {
39258                                 dashStyle = null;
39259                                 break;
39260                             }
39261                         }
39262                         ;
39263                     }
39264                 }
39265                 if (dashStyle === Polyline.DashStyle.CUSTOMIZED) {
39266                 }
39267                 this.setDashStyle(dashStyle);
39268             }
39269             else {
39270                 this.setDashStyle(null);
39271             }
39272             var dashOffset = firstPolyline.getDashOffset();
39273             for (var i = 1; i < /* size */ selectedPolylines.length; i++) {
39274                 {
39275                     if (dashOffset !== /* get */ selectedPolylines[i].getDashOffset()) {
39276                         dashOffset = null;
39277                         break;
39278                     }
39279                 }
39280                 ;
39281             }
39282             this.setDashOffset(dashOffset);
39283             this.arrowsStyleEditable = this.capStyleEditable;
39284             if (this.arrowsStyleEditable) {
39285                 var startArrowStyle = firstPolyline.getStartArrowStyle();
39286                 if (startArrowStyle != null) {
39287                     for (var i = 1; i < /* size */ selectedPolylines.length; i++) {
39288                         {
39289                             if (startArrowStyle !== /* get */ selectedPolylines[i].getStartArrowStyle()) {
39290                                 startArrowStyle = null;
39291                                 break;
39292                             }
39293                         }
39294                         ;
39295                     }
39296                 }
39297                 this.setStartArrowStyle(startArrowStyle);
39298                 var endArrowStyle = firstPolyline.getEndArrowStyle();
39299                 if (endArrowStyle != null) {
39300                     for (var i = 1; i < /* size */ selectedPolylines.length; i++) {
39301                         {
39302                             if (endArrowStyle !== /* get */ selectedPolylines[i].getEndArrowStyle()) {
39303                                 endArrowStyle = null;
39304                                 break;
39305                             }
39306                         }
39307                         ;
39308                     }
39309                 }
39310                 this.setEndArrowStyle(endArrowStyle);
39311             }
39312             else {
39313                 this.setStartArrowStyle(null);
39314                 this.setEndArrowStyle(null);
39315             }
39316             var color = firstPolyline.getColor();
39317             if (color != null) {
39318                 for (var i = 1; i < /* size */ selectedPolylines.length; i++) {
39319                     {
39320                         if (color !== /* get */ selectedPolylines[i].getColor()) {
39321                             color = null;
39322                             break;
39323                         }
39324                     }
39325                     ;
39326                 }
39327             }
39328             this.setColor(color);
39329             var elevation = firstPolyline.getElevation();
39330             for (var i = 1; i < /* size */ selectedPolylines.length; i++) {
39331                 {
39332                     if (elevation !== /* get */ selectedPolylines[i].getElevation()) {
39333                         elevation = null;
39334                         break;
39335                     }
39336                 }
39337                 ;
39338             }
39339             this.setElevation(elevation);
39340             var elevationEnabled = firstPolyline.isVisibleIn3D();
39341             for (var i = 1; i < /* size */ selectedPolylines.length; i++) {
39342                 {
39343                     if (!(elevationEnabled === /* get */ selectedPolylines[i].isVisibleIn3D())) {
39344                         elevationEnabled = null;
39345                         break;
39346                     }
39347                 }
39348                 ;
39349             }
39350             this.elevationEnabled = elevationEnabled;
39351         }
39352     };
39353     /**
39354      * Sets the edited thickness.
39355      * @param {number} thickness
39356      */
39357     PolylineController.prototype.setThickness = function (thickness) {
39358         if (thickness !== this.thickness) {
39359             var oldThickness = this.thickness;
39360             this.thickness = thickness;
39361             this.propertyChangeSupport.firePropertyChange(/* name */ "THICKNESS", oldThickness, thickness);
39362         }
39363     };
39364     /**
39365      * Returns the edited thickness.
39366      * @return {number}
39367      */
39368     PolylineController.prototype.getThickness = function () {
39369         return this.thickness;
39370     };
39371     /**
39372      * Sets the edited capStyle.
39373      * @param {Polyline.CapStyle} capStyle
39374      */
39375     PolylineController.prototype.setCapStyle = function (capStyle) {
39376         if (capStyle !== this.capStyle) {
39377             var oldCapStyle = this.capStyle;
39378             this.capStyle = capStyle;
39379             this.propertyChangeSupport.firePropertyChange(/* name */ "CAP_STYLE", oldCapStyle, capStyle);
39380         }
39381     };
39382     /**
39383      * Returns the edited capStyle.
39384      * @return {Polyline.CapStyle}
39385      */
39386     PolylineController.prototype.getCapStyle = function () {
39387         return this.capStyle;
39388     };
39389     /**
39390      * Returns <code>true</code> if cap style is editable.
39391      * @return {boolean}
39392      */
39393     PolylineController.prototype.isCapStyleEditable = function () {
39394         return this.capStyleEditable;
39395     };
39396     /**
39397      * Sets the edited joinStyle.
39398      * @param {Polyline.JoinStyle} joinStyle
39399      */
39400     PolylineController.prototype.setJoinStyle = function (joinStyle) {
39401         if (joinStyle !== this.joinStyle) {
39402             var oldJoinStyle = this.joinStyle;
39403             this.joinStyle = joinStyle;
39404             this.propertyChangeSupport.firePropertyChange(/* name */ "JOIN_STYLE", oldJoinStyle, joinStyle);
39405         }
39406     };
39407     /**
39408      * Returns the edited joinStyle.
39409      * @return {Polyline.JoinStyle}
39410      */
39411     PolylineController.prototype.getJoinStyle = function () {
39412         return this.joinStyle;
39413     };
39414     /**
39415      * Returns <code>true</code> if join style is editable.
39416      * @return {boolean}
39417      */
39418     PolylineController.prototype.isJoinStyleEditable = function () {
39419         return this.joinStyleEditable;
39420     };
39421     /**
39422      * Sets the edited dash style.
39423      * @param {Polyline.DashStyle} dashStyle
39424      */
39425     PolylineController.prototype.setDashStyle = function (dashStyle) {
39426         if (dashStyle !== this.dashStyle) {
39427             var oldDashStyle = this.dashStyle;
39428             this.dashStyle = dashStyle;
39429             this.propertyChangeSupport.firePropertyChange(/* name */ "DASH_STYLE", oldDashStyle, dashStyle);
39430         }
39431     };
39432     /**
39433      * Returns the edited dash style.
39434      * @return {Polyline.DashStyle}
39435      */
39436     PolylineController.prototype.getDashStyle = function () {
39437         return this.dashStyle;
39438     };
39439     /**
39440      * Sets the edited dash pattern.
39441      * @param {float[]} dashPattern
39442      */
39443     PolylineController.prototype.setDashPattern = function (dashPattern) {
39444         if (!(function (a1, a2) { if (a1 == null && a2 == null)
39445             return true; if (a1 == null || a2 == null)
39446             return false; if (a1.length != a2.length)
39447             return false; for (var i = 0; i < a1.length; i++) {
39448             if (a1[i] != a2[i])
39449                 return false;
39450         } return true; })(dashPattern, this.dashPattern)) {
39451             var oldDashPattern = this.dashPattern;
39452             this.dashPattern = dashPattern;
39453             this.propertyChangeSupport.firePropertyChange(/* name */ "DASH_PATTERN", oldDashPattern, dashPattern);
39454         }
39455     };
39456     /**
39457      * Returns the edited dash pattern.
39458      * @return {float[]}
39459      */
39460     PolylineController.prototype.getDashPattern = function () {
39461         return this.dashPattern;
39462     };
39463     /**
39464      * Sets the edited dash offset.
39465      * @param {number} dashOffset
39466      */
39467     PolylineController.prototype.setDashOffset = function (dashOffset) {
39468         if (dashOffset !== this.dashOffset) {
39469             var oldDashOffset = this.dashOffset;
39470             this.dashOffset = dashOffset;
39471             this.propertyChangeSupport.firePropertyChange(/* name */ "DASH_OFFSET", oldDashOffset, dashOffset);
39472         }
39473     };
39474     /**
39475      * Returns the edited dash offset.
39476      * @return {number}
39477      */
39478     PolylineController.prototype.getDashOffset = function () {
39479         return this.dashOffset;
39480     };
39481     /**
39482      * Sets the edited start arrow style.
39483      * @param {Polyline.ArrowStyle} startArrowStyle
39484      */
39485     PolylineController.prototype.setStartArrowStyle = function (startArrowStyle) {
39486         if (startArrowStyle !== this.startArrowStyle) {
39487             var oldStartArrowStyle = this.startArrowStyle;
39488             this.startArrowStyle = startArrowStyle;
39489             this.propertyChangeSupport.firePropertyChange(/* name */ "START_ARROW_STYLE", oldStartArrowStyle, startArrowStyle);
39490         }
39491     };
39492     /**
39493      * Returns the edited start arrow style.
39494      * @return {Polyline.ArrowStyle}
39495      */
39496     PolylineController.prototype.getStartArrowStyle = function () {
39497         return this.startArrowStyle;
39498     };
39499     /**
39500      * Sets the edited end arrow style.
39501      * @param {Polyline.ArrowStyle} endArrowStyle
39502      */
39503     PolylineController.prototype.setEndArrowStyle = function (endArrowStyle) {
39504         if (endArrowStyle !== this.endArrowStyle) {
39505             var oldEndArrowStyle = this.endArrowStyle;
39506             this.endArrowStyle = endArrowStyle;
39507             this.propertyChangeSupport.firePropertyChange(/* name */ "END_ARROW_STYLE", oldEndArrowStyle, endArrowStyle);
39508         }
39509     };
39510     /**
39511      * Returns the edited end arrow style.
39512      * @return {Polyline.ArrowStyle}
39513      */
39514     PolylineController.prototype.getEndArrowStyle = function () {
39515         return this.endArrowStyle;
39516     };
39517     /**
39518      * Returns <code>true</code> if arrows style is editable.
39519      * @return {boolean}
39520      */
39521     PolylineController.prototype.isArrowsStyleEditable = function () {
39522         return this.arrowsStyleEditable;
39523     };
39524     /**
39525      * Sets the edited color.
39526      * @param {number} color
39527      */
39528     PolylineController.prototype.setColor = function (color) {
39529         if (color !== this.color) {
39530             var oldColor = this.color;
39531             this.color = color;
39532             this.propertyChangeSupport.firePropertyChange(/* name */ "COLOR", oldColor, color);
39533         }
39534     };
39535     /**
39536      * Returns the edited color.
39537      * @return {number}
39538      */
39539     PolylineController.prototype.getColor = function () {
39540         return this.color;
39541     };
39542     /**
39543      * Sets the edited elevation.
39544      * @param {number} elevation
39545      */
39546     PolylineController.prototype.setElevation = function (elevation) {
39547         if (elevation !== this.elevation) {
39548             var oldElevation = this.elevation;
39549             this.elevation = elevation;
39550             this.propertyChangeSupport.firePropertyChange(/* name */ "ELEVATION", oldElevation, elevation);
39551         }
39552         this.elevationEnabled = elevation != null;
39553     };
39554     /**
39555      * Returns the edited elevation.
39556      * @return {number}
39557      */
39558     PolylineController.prototype.getElevation = function () {
39559         return this.elevation;
39560     };
39561     /**
39562      * Returns <code>Boolean.TRUE</code> if all edited polylines are viewed in 3D,
39563      * or <code>Boolean.FALSE</code> if no polyline is viewed in 3D.
39564      * @return {boolean}
39565      */
39566     PolylineController.prototype.isElevationEnabled = function () {
39567         return this.elevationEnabled;
39568     };
39569     /**
39570      * Controls the modification of selected polylines in edited home.
39571      */
39572     PolylineController.prototype.modifyPolylines = function () {
39573         var oldSelection = this.home.getSelectedItems();
39574         var selectedPolylines = Home.getPolylinesSubList(oldSelection);
39575         if (!(selectedPolylines.length == 0)) {
39576             var thickness = this.getThickness();
39577             var capStyle = this.getCapStyle();
39578             var joinStyle = this.getJoinStyle();
39579             var dashStyle = this.getDashStyle();
39580             var dashPattern = this.getDashPattern();
39581             var dashOffset = this.getDashOffset();
39582             var startArrowStyle = this.getStartArrowStyle();
39583             var endArrowStyle = this.getEndArrowStyle();
39584             var color = this.getColor();
39585             var elevation = this.getElevation();
39586             var elevationEnabled = this.isElevationEnabled();
39587             var modifiedPolylines = (function (s) { var a = []; while (s-- > 0)
39588                 a.push(null); return a; })(/* size */ selectedPolylines.length);
39589             for (var i = 0; i < modifiedPolylines.length; i++) {
39590                 {
39591                     modifiedPolylines[i] = new PolylineController.ModifiedPolyline(/* get */ selectedPolylines[i]);
39592                 }
39593                 ;
39594             }
39595             PolylineController.doModifyPolylines(modifiedPolylines, thickness, capStyle, joinStyle, dashStyle, dashPattern, dashOffset, startArrowStyle, endArrowStyle, color, elevation, elevationEnabled);
39596             if (this.undoSupport != null) {
39597                 var undoableEdit = new PolylineController.PolylinesModificationUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), modifiedPolylines, thickness, capStyle, joinStyle, dashStyle, dashPattern, dashOffset, startArrowStyle, endArrowStyle, color, elevation, elevationEnabled);
39598                 this.undoSupport.postEdit(undoableEdit);
39599             }
39600         }
39601     };
39602     /**
39603      * Modifies polylines properties with the values in parameter.
39604      * @param {com.eteks.sweethome3d.viewcontroller.PolylineController.ModifiedPolyline[]} modifiedPolylines
39605      * @param {number} thickness
39606      * @param {Polyline.CapStyle} capStyle
39607      * @param {Polyline.JoinStyle} joinStyle
39608      * @param {Polyline.DashStyle} dashStyle
39609      * @param {float[]} dashPattern
39610      * @param {number} dashOffset
39611      * @param {Polyline.ArrowStyle} startArrowStyle
39612      * @param {Polyline.ArrowStyle} endArrowStyle
39613      * @param {number} color
39614      * @param {number} elevation
39615      * @param {boolean} elevationEnabled
39616      * @private
39617      */
39618     PolylineController.doModifyPolylines = function (modifiedPolylines, thickness, capStyle, joinStyle, dashStyle, dashPattern, dashOffset, startArrowStyle, endArrowStyle, color, elevation, elevationEnabled) {
39619         for (var index = 0; index < modifiedPolylines.length; index++) {
39620             var modifiedPolyline = modifiedPolylines[index];
39621             {
39622                 var polyline = modifiedPolyline.getPolyline();
39623                 if (thickness != null) {
39624                     polyline.setThickness(thickness);
39625                 }
39626                 if (capStyle != null) {
39627                     polyline.setCapStyle(capStyle);
39628                 }
39629                 if (joinStyle != null) {
39630                     polyline.setJoinStyle(joinStyle);
39631                 }
39632                 if (dashStyle != null) {
39633                     polyline.setDashStyle(dashStyle);
39634                 }
39635                 if (dashStyle === Polyline.DashStyle.CUSTOMIZED && dashPattern != null) {
39636                     polyline.setDashPattern(dashPattern);
39637                 }
39638                 if (dashOffset != null) {
39639                     polyline.setDashOffset(polyline.getDashStyle() !== Polyline.DashStyle.SOLID ? dashOffset : 0);
39640                 }
39641                 if (startArrowStyle != null) {
39642                     polyline.setStartArrowStyle(startArrowStyle);
39643                 }
39644                 if (endArrowStyle != null) {
39645                     polyline.setEndArrowStyle(endArrowStyle);
39646                 }
39647                 if (color != null) {
39648                     polyline.setColor(color);
39649                 }
39650                 if (elevationEnabled != null) {
39651                     if (false === elevationEnabled) {
39652                         polyline.setVisibleIn3D(false);
39653                     }
39654                     else if (elevation != null) {
39655                         polyline.setVisibleIn3D(true);
39656                         polyline.setElevation(elevation);
39657                     }
39658                 }
39659             }
39660         }
39661     };
39662     /**
39663      * Restores polyline properties from the values stored in <code>modifiedPolylines</code>.
39664      * @param {com.eteks.sweethome3d.viewcontroller.PolylineController.ModifiedPolyline[]} modifiedPolylines
39665      * @private
39666      */
39667     PolylineController.undoModifyPolylines = function (modifiedPolylines) {
39668         for (var index = 0; index < modifiedPolylines.length; index++) {
39669             var modifiedPolyline = modifiedPolylines[index];
39670             {
39671                 modifiedPolyline.reset();
39672             }
39673         }
39674     };
39675     return PolylineController;
39676 }());
39677 PolylineController["__class"] = "com.eteks.sweethome3d.viewcontroller.PolylineController";
39678 PolylineController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
39679 (function (PolylineController) {
39680     /**
39681      * Undoable edit for polylines modification. This class isn't anonymous to avoid
39682      * being bound to controller and its view.
39683      * @extends LocalizedUndoableEdit
39684      * @class
39685      */
39686     var PolylinesModificationUndoableEdit = /** @class */ (function (_super) {
39687         __extends(PolylinesModificationUndoableEdit, _super);
39688         function PolylinesModificationUndoableEdit(home, preferences, oldSelection, modifiedPolylines, thickness, capStyle, joinStyle, dashStyle, dashPattern, dashOffset, startArrowStyle, endArrowStyle, color, elevation, elevationEnabled) {
39689             var _this = _super.call(this, preferences, PolylineController, "undoModifyPolylinesName") || this;
39690             if (_this.home === undefined) {
39691                 _this.home = null;
39692             }
39693             if (_this.oldSelection === undefined) {
39694                 _this.oldSelection = null;
39695             }
39696             if (_this.modifiedPolylines === undefined) {
39697                 _this.modifiedPolylines = null;
39698             }
39699             if (_this.thickness === undefined) {
39700                 _this.thickness = null;
39701             }
39702             if (_this.capStyle === undefined) {
39703                 _this.capStyle = null;
39704             }
39705             if (_this.joinStyle === undefined) {
39706                 _this.joinStyle = null;
39707             }
39708             if (_this.dashStyle === undefined) {
39709                 _this.dashStyle = null;
39710             }
39711             if (_this.dashPattern === undefined) {
39712                 _this.dashPattern = null;
39713             }
39714             if (_this.dashOffset === undefined) {
39715                 _this.dashOffset = null;
39716             }
39717             if (_this.startArrowStyle === undefined) {
39718                 _this.startArrowStyle = null;
39719             }
39720             if (_this.endArrowStyle === undefined) {
39721                 _this.endArrowStyle = null;
39722             }
39723             if (_this.color === undefined) {
39724                 _this.color = null;
39725             }
39726             if (_this.elevation === undefined) {
39727                 _this.elevation = null;
39728             }
39729             if (_this.elevationEnabled === undefined) {
39730                 _this.elevationEnabled = null;
39731             }
39732             _this.home = home;
39733             _this.oldSelection = oldSelection;
39734             _this.modifiedPolylines = modifiedPolylines;
39735             _this.thickness = thickness;
39736             _this.capStyle = capStyle;
39737             _this.joinStyle = joinStyle;
39738             _this.dashStyle = dashStyle;
39739             _this.dashPattern = dashPattern;
39740             _this.dashOffset = dashOffset;
39741             _this.startArrowStyle = startArrowStyle;
39742             _this.endArrowStyle = endArrowStyle;
39743             _this.color = color;
39744             _this.elevation = elevation;
39745             _this.elevationEnabled = elevationEnabled;
39746             return _this;
39747         }
39748         /**
39749          *
39750          */
39751         PolylinesModificationUndoableEdit.prototype.undo = function () {
39752             _super.prototype.undo.call(this);
39753             PolylineController.undoModifyPolylines(this.modifiedPolylines);
39754             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
39755         };
39756         /**
39757          *
39758          */
39759         PolylinesModificationUndoableEdit.prototype.redo = function () {
39760             _super.prototype.redo.call(this);
39761             PolylineController.doModifyPolylines(this.modifiedPolylines, this.thickness, this.capStyle, this.joinStyle, this.dashStyle, this.dashPattern, this.dashOffset, this.startArrowStyle, this.endArrowStyle, this.color, this.elevation, this.elevationEnabled);
39762             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
39763         };
39764         return PolylinesModificationUndoableEdit;
39765     }(LocalizedUndoableEdit));
39766     PolylineController.PolylinesModificationUndoableEdit = PolylinesModificationUndoableEdit;
39767     PolylinesModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PolylineController.PolylinesModificationUndoableEdit";
39768     PolylinesModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
39769     /**
39770      * Stores the current properties values of a modified polyline.
39771      * @param {Polyline} polyline
39772      * @class
39773      */
39774     var ModifiedPolyline = /** @class */ (function () {
39775         function ModifiedPolyline(polyline) {
39776             if (this.polyline === undefined) {
39777                 this.polyline = null;
39778             }
39779             if (this.thickness === undefined) {
39780                 this.thickness = 0;
39781             }
39782             if (this.capStyle === undefined) {
39783                 this.capStyle = null;
39784             }
39785             if (this.joinStyle === undefined) {
39786                 this.joinStyle = null;
39787             }
39788             if (this.dashPattern === undefined) {
39789                 this.dashPattern = null;
39790             }
39791             if (this.dashOffset === undefined) {
39792                 this.dashOffset = null;
39793             }
39794             if (this.startArrowStyle === undefined) {
39795                 this.startArrowStyle = null;
39796             }
39797             if (this.endArrowStyle === undefined) {
39798                 this.endArrowStyle = null;
39799             }
39800             if (this.color === undefined) {
39801                 this.color = 0;
39802             }
39803             if (this.visibleIn3D === undefined) {
39804                 this.visibleIn3D = false;
39805             }
39806             if (this.elevation === undefined) {
39807                 this.elevation = 0;
39808             }
39809             this.polyline = polyline;
39810             this.thickness = polyline.getThickness();
39811             this.capStyle = polyline.getCapStyle();
39812             this.joinStyle = polyline.getJoinStyle();
39813             this.dashPattern = polyline.getDashPattern();
39814             this.dashOffset = polyline.getDashOffset();
39815             this.startArrowStyle = polyline.getStartArrowStyle();
39816             this.endArrowStyle = polyline.getEndArrowStyle();
39817             this.color = polyline.getColor();
39818             this.visibleIn3D = polyline.isVisibleIn3D();
39819             this.elevation = polyline.getElevation();
39820         }
39821         ModifiedPolyline.prototype.getPolyline = function () {
39822             return this.polyline;
39823         };
39824         ModifiedPolyline.prototype.reset = function () {
39825             this.polyline.setThickness(this.thickness);
39826             this.polyline.setCapStyle(this.capStyle);
39827             this.polyline.setJoinStyle(this.joinStyle);
39828             this.polyline.setDashPattern(this.dashPattern);
39829             this.polyline.setDashOffset(this.dashOffset);
39830             this.polyline.setStartArrowStyle(this.startArrowStyle);
39831             this.polyline.setEndArrowStyle(this.endArrowStyle);
39832             this.polyline.setColor(this.color);
39833             this.polyline.setVisibleIn3D(this.visibleIn3D);
39834             this.polyline.setElevation(this.elevation);
39835         };
39836         return ModifiedPolyline;
39837     }());
39838     PolylineController.ModifiedPolyline = ModifiedPolyline;
39839     ModifiedPolyline["__class"] = "com.eteks.sweethome3d.viewcontroller.PolylineController.ModifiedPolyline";
39840 })(PolylineController || (PolylineController = {}));
39841 /**
39842  * Creates the controller of home furniture view with undo support.
39843  * @param {Home} home
39844  * @param {UserPreferences} preferences
39845  * @param {Object} viewFactory
39846  * @param {Object} contentManager
39847  * @param {javax.swing.undo.UndoableEditSupport} undoSupport
39848  * @class
39849  * @author Emmanuel Puybaret
39850  */
39851 var HomeFurnitureController = /** @class */ (function () {
39852     function HomeFurnitureController(home, preferences, viewFactory, contentManager, undoSupport) {
39853         if (((home != null && home instanceof Home) || home === null) && ((preferences != null && preferences instanceof UserPreferences) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || viewFactory === null) && ((contentManager != null && (contentManager.constructor != null && contentManager.constructor["__interfaces"] != null && contentManager.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || contentManager === null) && ((undoSupport != null && undoSupport instanceof javax.swing.undo.UndoableEditSupport) || undoSupport === null)) {
39854             var __args = arguments;
39855             if (this.home === undefined) {
39856                 this.home = null;
39857             }
39858             if (this.preferences === undefined) {
39859                 this.preferences = null;
39860             }
39861             if (this.viewFactory === undefined) {
39862                 this.viewFactory = null;
39863             }
39864             if (this.contentManager === undefined) {
39865                 this.contentManager = null;
39866             }
39867             if (this.undoSupport === undefined) {
39868                 this.undoSupport = null;
39869             }
39870             if (this.propertyChangeSupport === undefined) {
39871                 this.propertyChangeSupport = null;
39872             }
39873             if (this.textureController === undefined) {
39874                 this.textureController = null;
39875             }
39876             if (this.modelMaterialsController === undefined) {
39877                 this.modelMaterialsController = null;
39878             }
39879             if (this.homeFurnitureView === undefined) {
39880                 this.homeFurnitureView = null;
39881             }
39882             if (this.icon === undefined) {
39883                 this.icon = null;
39884             }
39885             if (this.name === undefined) {
39886                 this.name = null;
39887             }
39888             if (this.description === undefined) {
39889                 this.description = null;
39890             }
39891             if (this.additionalProperties === undefined) {
39892                 this.additionalProperties = null;
39893             }
39894             if (this.priceEditable === undefined) {
39895                 this.priceEditable = false;
39896             }
39897             if (this.price === undefined) {
39898                 this.price = null;
39899             }
39900             if (this.valueAddedTaxPercentageEditable === undefined) {
39901                 this.valueAddedTaxPercentageEditable = false;
39902             }
39903             if (this.valueAddedTaxPercentage === undefined) {
39904                 this.valueAddedTaxPercentage = null;
39905             }
39906             if (this.nameVisible === undefined) {
39907                 this.nameVisible = null;
39908             }
39909             if (this.x === undefined) {
39910                 this.x = null;
39911             }
39912             if (this.y === undefined) {
39913                 this.y = null;
39914             }
39915             if (this.elevation === undefined) {
39916                 this.elevation = null;
39917             }
39918             if (this.angleInDegrees === undefined) {
39919                 this.angleInDegrees = null;
39920             }
39921             if (this.angle === undefined) {
39922                 this.angle = null;
39923             }
39924             if (this.rollAndPitchEditable === undefined) {
39925                 this.rollAndPitchEditable = false;
39926             }
39927             if (this.roll === undefined) {
39928                 this.roll = null;
39929             }
39930             if (this.pitch === undefined) {
39931                 this.pitch = null;
39932             }
39933             if (this.horizontalAxis === undefined) {
39934                 this.horizontalAxis = null;
39935             }
39936             if (this.width === undefined) {
39937                 this.width = null;
39938             }
39939             if (this.proportionalWidth === undefined) {
39940                 this.proportionalWidth = null;
39941             }
39942             if (this.depth === undefined) {
39943                 this.depth = null;
39944             }
39945             if (this.proportionalDepth === undefined) {
39946                 this.proportionalDepth = null;
39947             }
39948             if (this.height === undefined) {
39949                 this.height = null;
39950             }
39951             if (this.proportionalHeight === undefined) {
39952                 this.proportionalHeight = null;
39953             }
39954             if (this.proportional === undefined) {
39955                 this.proportional = false;
39956             }
39957             if (this.modelTransformations === undefined) {
39958                 this.modelTransformations = null;
39959             }
39960             if (this.modelPresetTransformationsNames === undefined) {
39961                 this.modelPresetTransformationsNames = null;
39962             }
39963             if (this.modelPresetTransformations === undefined) {
39964                 this.modelPresetTransformations = null;
39965             }
39966             if (this.color === undefined) {
39967                 this.color = null;
39968             }
39969             if (this.paint === undefined) {
39970                 this.paint = null;
39971             }
39972             if (this.shininess === undefined) {
39973                 this.shininess = null;
39974             }
39975             if (this.visible === undefined) {
39976                 this.visible = null;
39977             }
39978             if (this.modelMirrored === undefined) {
39979                 this.modelMirrored = null;
39980             }
39981             if (this.basePlanItem === undefined) {
39982                 this.basePlanItem = null;
39983             }
39984             if (this.basePlanItemEnabled === undefined) {
39985                 this.basePlanItemEnabled = false;
39986             }
39987             if (this.lightPowerEditable === undefined) {
39988                 this.lightPowerEditable = false;
39989             }
39990             if (this.lightPower === undefined) {
39991                 this.lightPower = null;
39992             }
39993             if (this.resizable === undefined) {
39994                 this.resizable = false;
39995             }
39996             if (this.deformable === undefined) {
39997                 this.deformable = false;
39998             }
39999             if (this.widthDepthDeformable === undefined) {
40000                 this.widthDepthDeformable = false;
40001             }
40002             if (this.texturable === undefined) {
40003                 this.texturable = false;
40004             }
40005             if (this.visibleEditable === undefined) {
40006                 this.visibleEditable = false;
40007             }
40008             if (this.doorOrWindow === undefined) {
40009                 this.doorOrWindow = false;
40010             }
40011             if (this.wallThickness === undefined) {
40012                 this.wallThickness = 0;
40013             }
40014             if (this.wallDistance === undefined) {
40015                 this.wallDistance = 0;
40016             }
40017             if (this.wallWidth === undefined) {
40018                 this.wallWidth = 0;
40019             }
40020             if (this.wallLeft === undefined) {
40021                 this.wallLeft = 0;
40022             }
40023             if (this.wallHeight === undefined) {
40024                 this.wallHeight = 0;
40025             }
40026             if (this.wallTop === undefined) {
40027                 this.wallTop = 0;
40028             }
40029             if (this.sashes === undefined) {
40030                 this.sashes = null;
40031             }
40032             this.home = home;
40033             this.preferences = preferences;
40034             this.viewFactory = viewFactory;
40035             this.contentManager = contentManager;
40036             this.undoSupport = undoSupport;
40037             this.propertyChangeSupport = new PropertyChangeSupport(this);
40038             this.updateProperties();
40039         }
40040         else if (((home != null && home instanceof Home) || home === null) && ((preferences != null && preferences instanceof UserPreferences) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || viewFactory === null) && ((contentManager != null && contentManager instanceof javax.swing.undo.UndoableEditSupport) || contentManager === null) && undoSupport === undefined) {
40041             var __args = arguments;
40042             var undoSupport_3 = __args[3];
40043             {
40044                 var __args_118 = arguments;
40045                 var contentManager_8 = null;
40046                 if (this.home === undefined) {
40047                     this.home = null;
40048                 }
40049                 if (this.preferences === undefined) {
40050                     this.preferences = null;
40051                 }
40052                 if (this.viewFactory === undefined) {
40053                     this.viewFactory = null;
40054                 }
40055                 if (this.contentManager === undefined) {
40056                     this.contentManager = null;
40057                 }
40058                 if (this.undoSupport === undefined) {
40059                     this.undoSupport = null;
40060                 }
40061                 if (this.propertyChangeSupport === undefined) {
40062                     this.propertyChangeSupport = null;
40063                 }
40064                 if (this.textureController === undefined) {
40065                     this.textureController = null;
40066                 }
40067                 if (this.modelMaterialsController === undefined) {
40068                     this.modelMaterialsController = null;
40069                 }
40070                 if (this.homeFurnitureView === undefined) {
40071                     this.homeFurnitureView = null;
40072                 }
40073                 if (this.icon === undefined) {
40074                     this.icon = null;
40075                 }
40076                 if (this.name === undefined) {
40077                     this.name = null;
40078                 }
40079                 if (this.description === undefined) {
40080                     this.description = null;
40081                 }
40082                 if (this.additionalProperties === undefined) {
40083                     this.additionalProperties = null;
40084                 }
40085                 if (this.priceEditable === undefined) {
40086                     this.priceEditable = false;
40087                 }
40088                 if (this.price === undefined) {
40089                     this.price = null;
40090                 }
40091                 if (this.valueAddedTaxPercentageEditable === undefined) {
40092                     this.valueAddedTaxPercentageEditable = false;
40093                 }
40094                 if (this.valueAddedTaxPercentage === undefined) {
40095                     this.valueAddedTaxPercentage = null;
40096                 }
40097                 if (this.nameVisible === undefined) {
40098                     this.nameVisible = null;
40099                 }
40100                 if (this.x === undefined) {
40101                     this.x = null;
40102                 }
40103                 if (this.y === undefined) {
40104                     this.y = null;
40105                 }
40106                 if (this.elevation === undefined) {
40107                     this.elevation = null;
40108                 }
40109                 if (this.angleInDegrees === undefined) {
40110                     this.angleInDegrees = null;
40111                 }
40112                 if (this.angle === undefined) {
40113                     this.angle = null;
40114                 }
40115                 if (this.rollAndPitchEditable === undefined) {
40116                     this.rollAndPitchEditable = false;
40117                 }
40118                 if (this.roll === undefined) {
40119                     this.roll = null;
40120                 }
40121                 if (this.pitch === undefined) {
40122                     this.pitch = null;
40123                 }
40124                 if (this.horizontalAxis === undefined) {
40125                     this.horizontalAxis = null;
40126                 }
40127                 if (this.width === undefined) {
40128                     this.width = null;
40129                 }
40130                 if (this.proportionalWidth === undefined) {
40131                     this.proportionalWidth = null;
40132                 }
40133                 if (this.depth === undefined) {
40134                     this.depth = null;
40135                 }
40136                 if (this.proportionalDepth === undefined) {
40137                     this.proportionalDepth = null;
40138                 }
40139                 if (this.height === undefined) {
40140                     this.height = null;
40141                 }
40142                 if (this.proportionalHeight === undefined) {
40143                     this.proportionalHeight = null;
40144                 }
40145                 if (this.proportional === undefined) {
40146                     this.proportional = false;
40147                 }
40148                 if (this.modelTransformations === undefined) {
40149                     this.modelTransformations = null;
40150                 }
40151                 if (this.modelPresetTransformationsNames === undefined) {
40152                     this.modelPresetTransformationsNames = null;
40153                 }
40154                 if (this.modelPresetTransformations === undefined) {
40155                     this.modelPresetTransformations = null;
40156                 }
40157                 if (this.color === undefined) {
40158                     this.color = null;
40159                 }
40160                 if (this.paint === undefined) {
40161                     this.paint = null;
40162                 }
40163                 if (this.shininess === undefined) {
40164                     this.shininess = null;
40165                 }
40166                 if (this.visible === undefined) {
40167                     this.visible = null;
40168                 }
40169                 if (this.modelMirrored === undefined) {
40170                     this.modelMirrored = null;
40171                 }
40172                 if (this.basePlanItem === undefined) {
40173                     this.basePlanItem = null;
40174                 }
40175                 if (this.basePlanItemEnabled === undefined) {
40176                     this.basePlanItemEnabled = false;
40177                 }
40178                 if (this.lightPowerEditable === undefined) {
40179                     this.lightPowerEditable = false;
40180                 }
40181                 if (this.lightPower === undefined) {
40182                     this.lightPower = null;
40183                 }
40184                 if (this.resizable === undefined) {
40185                     this.resizable = false;
40186                 }
40187                 if (this.deformable === undefined) {
40188                     this.deformable = false;
40189                 }
40190                 if (this.widthDepthDeformable === undefined) {
40191                     this.widthDepthDeformable = false;
40192                 }
40193                 if (this.texturable === undefined) {
40194                     this.texturable = false;
40195                 }
40196                 if (this.visibleEditable === undefined) {
40197                     this.visibleEditable = false;
40198                 }
40199                 if (this.doorOrWindow === undefined) {
40200                     this.doorOrWindow = false;
40201                 }
40202                 if (this.wallThickness === undefined) {
40203                     this.wallThickness = 0;
40204                 }
40205                 if (this.wallDistance === undefined) {
40206                     this.wallDistance = 0;
40207                 }
40208                 if (this.wallWidth === undefined) {
40209                     this.wallWidth = 0;
40210                 }
40211                 if (this.wallLeft === undefined) {
40212                     this.wallLeft = 0;
40213                 }
40214                 if (this.wallHeight === undefined) {
40215                     this.wallHeight = 0;
40216                 }
40217                 if (this.wallTop === undefined) {
40218                     this.wallTop = 0;
40219                 }
40220                 if (this.sashes === undefined) {
40221                     this.sashes = null;
40222                 }
40223                 this.home = home;
40224                 this.preferences = preferences;
40225                 this.viewFactory = viewFactory;
40226                 this.contentManager = contentManager_8;
40227                 this.undoSupport = undoSupport_3;
40228                 this.propertyChangeSupport = new PropertyChangeSupport(this);
40229                 this.updateProperties();
40230             }
40231             if (this.home === undefined) {
40232                 this.home = null;
40233             }
40234             if (this.preferences === undefined) {
40235                 this.preferences = null;
40236             }
40237             if (this.viewFactory === undefined) {
40238                 this.viewFactory = null;
40239             }
40240             if (this.contentManager === undefined) {
40241                 this.contentManager = null;
40242             }
40243             if (this.undoSupport === undefined) {
40244                 this.undoSupport = null;
40245             }
40246             if (this.propertyChangeSupport === undefined) {
40247                 this.propertyChangeSupport = null;
40248             }
40249             if (this.textureController === undefined) {
40250                 this.textureController = null;
40251             }
40252             if (this.modelMaterialsController === undefined) {
40253                 this.modelMaterialsController = null;
40254             }
40255             if (this.homeFurnitureView === undefined) {
40256                 this.homeFurnitureView = null;
40257             }
40258             if (this.icon === undefined) {
40259                 this.icon = null;
40260             }
40261             if (this.name === undefined) {
40262                 this.name = null;
40263             }
40264             if (this.description === undefined) {
40265                 this.description = null;
40266             }
40267             if (this.additionalProperties === undefined) {
40268                 this.additionalProperties = null;
40269             }
40270             if (this.priceEditable === undefined) {
40271                 this.priceEditable = false;
40272             }
40273             if (this.price === undefined) {
40274                 this.price = null;
40275             }
40276             if (this.valueAddedTaxPercentageEditable === undefined) {
40277                 this.valueAddedTaxPercentageEditable = false;
40278             }
40279             if (this.valueAddedTaxPercentage === undefined) {
40280                 this.valueAddedTaxPercentage = null;
40281             }
40282             if (this.nameVisible === undefined) {
40283                 this.nameVisible = null;
40284             }
40285             if (this.x === undefined) {
40286                 this.x = null;
40287             }
40288             if (this.y === undefined) {
40289                 this.y = null;
40290             }
40291             if (this.elevation === undefined) {
40292                 this.elevation = null;
40293             }
40294             if (this.angleInDegrees === undefined) {
40295                 this.angleInDegrees = null;
40296             }
40297             if (this.angle === undefined) {
40298                 this.angle = null;
40299             }
40300             if (this.rollAndPitchEditable === undefined) {
40301                 this.rollAndPitchEditable = false;
40302             }
40303             if (this.roll === undefined) {
40304                 this.roll = null;
40305             }
40306             if (this.pitch === undefined) {
40307                 this.pitch = null;
40308             }
40309             if (this.horizontalAxis === undefined) {
40310                 this.horizontalAxis = null;
40311             }
40312             if (this.width === undefined) {
40313                 this.width = null;
40314             }
40315             if (this.proportionalWidth === undefined) {
40316                 this.proportionalWidth = null;
40317             }
40318             if (this.depth === undefined) {
40319                 this.depth = null;
40320             }
40321             if (this.proportionalDepth === undefined) {
40322                 this.proportionalDepth = null;
40323             }
40324             if (this.height === undefined) {
40325                 this.height = null;
40326             }
40327             if (this.proportionalHeight === undefined) {
40328                 this.proportionalHeight = null;
40329             }
40330             if (this.proportional === undefined) {
40331                 this.proportional = false;
40332             }
40333             if (this.modelTransformations === undefined) {
40334                 this.modelTransformations = null;
40335             }
40336             if (this.modelPresetTransformationsNames === undefined) {
40337                 this.modelPresetTransformationsNames = null;
40338             }
40339             if (this.modelPresetTransformations === undefined) {
40340                 this.modelPresetTransformations = null;
40341             }
40342             if (this.color === undefined) {
40343                 this.color = null;
40344             }
40345             if (this.paint === undefined) {
40346                 this.paint = null;
40347             }
40348             if (this.shininess === undefined) {
40349                 this.shininess = null;
40350             }
40351             if (this.visible === undefined) {
40352                 this.visible = null;
40353             }
40354             if (this.modelMirrored === undefined) {
40355                 this.modelMirrored = null;
40356             }
40357             if (this.basePlanItem === undefined) {
40358                 this.basePlanItem = null;
40359             }
40360             if (this.basePlanItemEnabled === undefined) {
40361                 this.basePlanItemEnabled = false;
40362             }
40363             if (this.lightPowerEditable === undefined) {
40364                 this.lightPowerEditable = false;
40365             }
40366             if (this.lightPower === undefined) {
40367                 this.lightPower = null;
40368             }
40369             if (this.resizable === undefined) {
40370                 this.resizable = false;
40371             }
40372             if (this.deformable === undefined) {
40373                 this.deformable = false;
40374             }
40375             if (this.widthDepthDeformable === undefined) {
40376                 this.widthDepthDeformable = false;
40377             }
40378             if (this.texturable === undefined) {
40379                 this.texturable = false;
40380             }
40381             if (this.visibleEditable === undefined) {
40382                 this.visibleEditable = false;
40383             }
40384             if (this.doorOrWindow === undefined) {
40385                 this.doorOrWindow = false;
40386             }
40387             if (this.wallThickness === undefined) {
40388                 this.wallThickness = 0;
40389             }
40390             if (this.wallDistance === undefined) {
40391                 this.wallDistance = 0;
40392             }
40393             if (this.wallWidth === undefined) {
40394                 this.wallWidth = 0;
40395             }
40396             if (this.wallLeft === undefined) {
40397                 this.wallLeft = 0;
40398             }
40399             if (this.wallHeight === undefined) {
40400                 this.wallHeight = 0;
40401             }
40402             if (this.wallTop === undefined) {
40403                 this.wallTop = 0;
40404             }
40405             if (this.sashes === undefined) {
40406                 this.sashes = null;
40407             }
40408         }
40409         else
40410             throw new Error('invalid overload');
40411     }
40412     /**
40413      * Returns the texture controller of the piece.
40414      * @return {TextureChoiceController}
40415      */
40416     HomeFurnitureController.prototype.getTextureController = function () {
40417         if (this.textureController == null) {
40418             this.textureController = new TextureChoiceController(this.preferences.getLocalizedString(HomeFurnitureController, "textureTitle"), this.preferences, this.viewFactory, this.contentManager);
40419             this.textureController.addPropertyChangeListener("TEXTURE", new HomeFurnitureController.HomeFurnitureController$0(this));
40420         }
40421         return this.textureController;
40422     };
40423     /**
40424      * Returns the model materials controller of the piece.
40425      * @return {ModelMaterialsController}
40426      */
40427     HomeFurnitureController.prototype.getModelMaterialsController = function () {
40428         if (this.modelMaterialsController == null) {
40429             this.modelMaterialsController = new ModelMaterialsController(this.preferences.getLocalizedString(HomeFurnitureController, "modelMaterialsTitle"), this.preferences, this.viewFactory, this.contentManager);
40430             this.modelMaterialsController.addPropertyChangeListener("MATERIALS", new HomeFurnitureController.HomeFurnitureController$1(this));
40431             var sizeChangeListener = new HomeFurnitureController.HomeFurnitureController$2(this);
40432             this.addPropertyChangeListener("WIDTH", sizeChangeListener);
40433             this.addPropertyChangeListener("DEPTH", sizeChangeListener);
40434             this.addPropertyChangeListener("HEIGHT", sizeChangeListener);
40435             this.addPropertyChangeListener("MODEL_TRANSFORMATIONS", new HomeFurnitureController.HomeFurnitureController$3(this));
40436         }
40437         return this.modelMaterialsController;
40438     };
40439     /**
40440      * Returns the view associated with this controller.
40441      * @return {Object}
40442      */
40443     HomeFurnitureController.prototype.getView = function () {
40444         if (this.homeFurnitureView == null) {
40445             this.homeFurnitureView = this.viewFactory.createHomeFurnitureView(this.preferences, this);
40446         }
40447         return this.homeFurnitureView;
40448     };
40449     /**
40450      * Returns the content manager associated to this controller.
40451      * @return {Object}
40452      */
40453     HomeFurnitureController.prototype.getContentManager = function () {
40454         return this.contentManager;
40455     };
40456     /**
40457      * Displays the view controlled by this controller.
40458      * @param {Object} parentView
40459      */
40460     HomeFurnitureController.prototype.displayView = function (parentView) {
40461         this.getView().displayView(parentView);
40462     };
40463     /**
40464      * Adds the property change <code>listener</code> in parameter to this controller.
40465      * @param {string} property
40466      * @param {PropertyChangeListener} listener
40467      */
40468     HomeFurnitureController.prototype.addPropertyChangeListener = function (property, listener) {
40469         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
40470     };
40471     /**
40472      * Removes the property change <code>listener</code> in parameter from this controller.
40473      * @param {string} property
40474      * @param {PropertyChangeListener} listener
40475      */
40476     HomeFurnitureController.prototype.removePropertyChangeListener = function (property, listener) {
40477         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
40478     };
40479     /**
40480      * Updates edited properties from selected furniture in the home edited by this controller.
40481      */
40482     HomeFurnitureController.prototype.updateProperties = function () {
40483         var selectedFurniture = Home.getFurnitureSubList(this.home.getSelectedItems());
40484         var textureController = this.getTextureController();
40485         var modelMaterialsController = this.getModelMaterialsController();
40486         if ( /* isEmpty */(selectedFurniture.length == 0)) {
40487             this.setIcon(null);
40488             this.setName(null);
40489             this.setNameVisible(null);
40490             this.setDescription(null);
40491             this.setAdditionalProperties(null);
40492             this.setPrice(null, false);
40493             this.priceEditable = false;
40494             this.setValueAddedTaxPercentage(null);
40495             this.valueAddedTaxPercentageEditable = false;
40496             this.setX(null);
40497             this.setY(null);
40498             this.setElevation(null);
40499             this.basePlanItemEnabled = false;
40500             this.setAngleInDegrees(null);
40501             this.setRoll(null);
40502             this.setPitch(null);
40503             this.setHorizontalAxis(null);
40504             this.rollAndPitchEditable = false;
40505             this.setWidth$java_lang_Float$boolean$boolean$boolean(null, true, false, false);
40506             this.setDepth$java_lang_Float$boolean$boolean$boolean(null, true, false, false);
40507             this.setHeight$java_lang_Float$boolean$boolean(null, true, false);
40508             this.setColor(null);
40509             if (textureController != null) {
40510                 textureController.setTexture(null);
40511             }
40512             if (modelMaterialsController != null) {
40513                 modelMaterialsController.setMaterials(null);
40514                 modelMaterialsController.setModel(null);
40515                 modelMaterialsController.setModelCreator(null);
40516             }
40517             this.setPaint(null);
40518             this.setModelTransformations$com_eteks_sweethome3d_model_Transformation_A(null);
40519             this.modelPresetTransformationsNames = /* emptyList */ [];
40520             this.modelPresetTransformations = /* emptyList */ [];
40521             this.doorOrWindow = false;
40522             this.wallThickness = 1;
40523             this.wallDistance = 0;
40524             this.wallWidth = 1;
40525             this.wallLeft = 0;
40526             this.wallHeight = 1;
40527             this.wallTop = 0;
40528             this.sashes = [];
40529             this.setShininess(null);
40530             this.visibleEditable = false;
40531             this.setVisible(null);
40532             this.setModelMirrored(null);
40533             this.lightPowerEditable = false;
40534             this.setLightPower(null);
40535             this.setResizable(true);
40536             this.setDeformable(true);
40537             this.setTexturable(true);
40538             this.setProportional(false);
40539         }
40540         else {
40541             var firstPiece = selectedFurniture[0];
40542             var icon = firstPiece.getIcon();
40543             if (icon != null) {
40544                 for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
40545                     {
40546                         if (!(function (o1, o2) { if (o1 && o1.equals) {
40547                             return o1.equals(o2);
40548                         }
40549                         else {
40550                             return o1 === o2;
40551                         } })(icon, /* get */ selectedFurniture[i].getIcon())) {
40552                             icon = null;
40553                             break;
40554                         }
40555                     }
40556                     ;
40557                 }
40558             }
40559             this.setIcon(icon);
40560             var name_9 = firstPiece.getName();
40561             if (name_9 != null) {
40562                 for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
40563                     {
40564                         if (!(name_9 === /* get */ selectedFurniture[i].getName())) {
40565                             name_9 = null;
40566                             break;
40567                         }
40568                     }
40569                     ;
40570                 }
40571             }
40572             this.setName(name_9);
40573             var nameVisible = firstPiece.isNameVisible();
40574             for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
40575                 {
40576                     if (nameVisible !== /* get */ selectedFurniture[i].isNameVisible()) {
40577                         nameVisible = null;
40578                         break;
40579                     }
40580                 }
40581                 ;
40582             }
40583             this.setNameVisible(nameVisible);
40584             var description = firstPiece.getDescription();
40585             if (description != null) {
40586                 for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
40587                     {
40588                         if (!(description === /* get */ selectedFurniture[i].getDescription())) {
40589                             description = null;
40590                             break;
40591                         }
40592                     }
40593                     ;
40594                 }
40595             }
40596             this.setDescription(description);
40597             if ( /* size */selectedFurniture.length === 1) {
40598                 var additionalProperties = ({});
40599                 {
40600                     var array = this.home.getFurnitureAdditionalProperties();
40601                     for (var index = 0; index < array.length; index++) {
40602                         var property = array[index];
40603                         {
40604                             var propertyName = property.getName();
40605                             if (property.isModifiable()) {
40606                                 /* put */ (function (m, k, v) { if (m.entries == null)
40607                                     m.entries = []; for (var i = 0; i < m.entries.length; i++)
40608                                     if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
40609                                         m.entries[i].value = v;
40610                                         return;
40611                                     } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(additionalProperties, property, firstPiece.isContentProperty(propertyName) ? firstPiece.getContentProperty(propertyName) : firstPiece.getProperty(propertyName));
40612                             }
40613                         }
40614                     }
40615                 }
40616                 this.setAdditionalProperties(/* size */ (function (m) { if (m.entries == null)
40617                     m.entries = []; return m.entries.length; })(additionalProperties) > 0 ? additionalProperties : null);
40618             }
40619             else {
40620                 this.setAdditionalProperties(null);
40621             }
40622             var priceEditable = this.preferences.getCurrency() != null;
40623             if (priceEditable) {
40624                 for (var i = 0; i < /* size */ selectedFurniture.length; i++) {
40625                     {
40626                         if ( /* get */selectedFurniture[i] != null && /* get */ selectedFurniture[i] instanceof HomeFurnitureGroup) {
40627                             priceEditable = false;
40628                             break;
40629                         }
40630                     }
40631                     ;
40632                 }
40633             }
40634             this.priceEditable = priceEditable;
40635             if (priceEditable) {
40636                 var price = firstPiece.getPrice();
40637                 if (price != null) {
40638                     for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
40639                         {
40640                             if (!(( /* get */selectedFurniture[i].getPrice()) != null ? price.eq(/* get */ selectedFurniture[i].getPrice()) : (price === ( /* get */selectedFurniture[i].getPrice())))) {
40641                                 price = null;
40642                                 break;
40643                             }
40644                         }
40645                         ;
40646                     }
40647                 }
40648                 this.setPrice(price, false);
40649                 this.valueAddedTaxPercentageEditable = this.preferences.isValueAddedTaxEnabled();
40650                 var valueAddedTaxPercentage = firstPiece.getValueAddedTaxPercentage();
40651                 if (valueAddedTaxPercentage != null) {
40652                     for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
40653                         {
40654                             if (!(( /* get */selectedFurniture[i].getValueAddedTaxPercentage()) != null ? valueAddedTaxPercentage.eq(/* get */ selectedFurniture[i].getValueAddedTaxPercentage()) : (valueAddedTaxPercentage === ( /* get */selectedFurniture[i].getValueAddedTaxPercentage())))) {
40655                                 valueAddedTaxPercentage = null;
40656                                 break;
40657                             }
40658                         }
40659                         ;
40660                     }
40661                 }
40662                 this.setValueAddedTaxPercentage(valueAddedTaxPercentage);
40663             }
40664             else {
40665                 this.setPrice(null, false);
40666                 this.setValueAddedTaxPercentage(null);
40667                 this.valueAddedTaxPercentageEditable = false;
40668             }
40669             var x = firstPiece.getX();
40670             for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
40671                 {
40672                     if ( /* floatValue */x !== /* get */ selectedFurniture[i].getX()) {
40673                         x = null;
40674                         break;
40675                     }
40676                 }
40677                 ;
40678             }
40679             this.setX(x);
40680             var y = firstPiece.getY();
40681             for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
40682                 {
40683                     if ( /* floatValue */y !== /* get */ selectedFurniture[i].getY()) {
40684                         y = null;
40685                         break;
40686                     }
40687                 }
40688                 ;
40689             }
40690             this.setY(y);
40691             var elevation = firstPiece.getElevation();
40692             for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
40693                 {
40694                     if ( /* floatValue */elevation !== /* get */ selectedFurniture[i].getElevation()) {
40695                         elevation = null;
40696                         break;
40697                     }
40698                 }
40699                 ;
40700             }
40701             this.setElevation(elevation);
40702             var basePlanItemEnabled = !firstPiece.isDoorOrWindow();
40703             for (var i = 1; !basePlanItemEnabled && i < /* size */ selectedFurniture.length; i++) {
40704                 {
40705                     if (!selectedFurniture[i].isDoorOrWindow()) {
40706                         basePlanItemEnabled = true;
40707                     }
40708                 }
40709                 ;
40710             }
40711             this.basePlanItemEnabled = basePlanItemEnabled;
40712             var basePlanItem = !firstPiece.isMovable();
40713             for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
40714                 {
40715                     if ( /* booleanValue */basePlanItem !== !selectedFurniture[i].isMovable()) {
40716                         basePlanItem = null;
40717                         break;
40718                     }
40719                 }
40720                 ;
40721             }
40722             this.setBasePlanItem(basePlanItem);
40723             var angle = firstPiece.getAngle();
40724             for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
40725                 {
40726                     if ( /* floatValue */angle !== /* get */ selectedFurniture[i].getAngle()) {
40727                         angle = null;
40728                         break;
40729                     }
40730                 }
40731                 ;
40732             }
40733             this.setAngle(angle);
40734             var rollAndPitchEditable = true;
40735             for (var i = 0; rollAndPitchEditable && i < /* size */ selectedFurniture.length; i++) {
40736                 {
40737                     var piece = selectedFurniture[i];
40738                     rollAndPitchEditable = piece.isHorizontallyRotatable() && piece.getStaircaseCutOutShape() == null;
40739                 }
40740                 ;
40741             }
40742             this.rollAndPitchEditable = rollAndPitchEditable;
40743             if (this.rollAndPitchEditable) {
40744                 var roll = firstPiece.getRoll();
40745                 for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
40746                     {
40747                         if ( /* floatValue */roll !== /* get */ selectedFurniture[i].getRoll()) {
40748                             roll = null;
40749                             break;
40750                         }
40751                     }
40752                     ;
40753                 }
40754                 this.setRoll(roll);
40755                 var pitch = firstPiece.getPitch();
40756                 for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
40757                     {
40758                         if ( /* floatValue */pitch !== /* get */ selectedFurniture[i].getPitch()) {
40759                             pitch = null;
40760                             break;
40761                         }
40762                     }
40763                     ;
40764                 }
40765                 this.setPitch(pitch);
40766                 if (roll == null && pitch == null || (roll != null && roll !== 0 && pitch != null && pitch !== 0) || (roll != null && roll === 0 && pitch != null && pitch === 0)) {
40767                     this.setHorizontalAxis(null);
40768                 }
40769                 else if (roll == null && pitch != null && pitch === 0 || roll != null && roll !== 0) {
40770                     this.setHorizontalAxis(HomeFurnitureController.FurnitureHorizontalAxis.ROLL);
40771                 }
40772                 else {
40773                     this.setHorizontalAxis(HomeFurnitureController.FurnitureHorizontalAxis.PITCH);
40774                 }
40775             }
40776             else {
40777                 this.setRoll(null);
40778                 this.setPitch(null);
40779                 this.setHorizontalAxis(null);
40780             }
40781             var width = firstPiece.getWidth();
40782             for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
40783                 {
40784                     if ( /* floatValue */width !== /* get */ selectedFurniture[i].getWidth()) {
40785                         width = null;
40786                         break;
40787                     }
40788                 }
40789                 ;
40790             }
40791             this.setWidth$java_lang_Float$boolean$boolean$boolean(width, true, false, false);
40792             var depth = firstPiece.getDepth();
40793             for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
40794                 {
40795                     if ( /* floatValue */depth !== /* get */ selectedFurniture[i].getDepth()) {
40796                         depth = null;
40797                         break;
40798                     }
40799                 }
40800                 ;
40801             }
40802             this.setDepth$java_lang_Float$boolean$boolean$boolean(depth, true, false, false);
40803             var height = firstPiece.getHeight();
40804             for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
40805                 {
40806                     if ( /* floatValue */height !== /* get */ selectedFurniture[i].getHeight()) {
40807                         height = null;
40808                         break;
40809                     }
40810                 }
40811                 ;
40812             }
40813             this.setHeight$java_lang_Float$boolean$boolean(height, true, false);
40814             var selectedFurnitureWithoutGroups = this.getFurnitureWithoutGroups(selectedFurniture);
40815             var firstPieceExceptGroup = selectedFurnitureWithoutGroups[0];
40816             var color = firstPieceExceptGroup.getColor();
40817             if (color != null) {
40818                 for (var i = 1; i < /* size */ selectedFurnitureWithoutGroups.length; i++) {
40819                     {
40820                         if (!(color === /* get */ selectedFurnitureWithoutGroups[i].getColor())) {
40821                             color = null;
40822                             break;
40823                         }
40824                     }
40825                     ;
40826                 }
40827             }
40828             this.setColor(color);
40829             var texture = firstPieceExceptGroup.getTexture();
40830             if (texture != null) {
40831                 for (var i = 1; i < /* size */ selectedFurnitureWithoutGroups.length; i++) {
40832                     {
40833                         if (!texture.equals(/* get */ selectedFurnitureWithoutGroups[i].getTexture())) {
40834                             texture = null;
40835                             break;
40836                         }
40837                     }
40838                     ;
40839                 }
40840             }
40841             if (textureController != null) {
40842                 textureController.setTexture(texture);
40843             }
40844             var modelMaterials = firstPieceExceptGroup.getModelMaterials();
40845             var model = firstPieceExceptGroup.getModel();
40846             var creator = firstPieceExceptGroup.getCreator();
40847             if (model != null) {
40848                 for (var i = 1; i < /* size */ selectedFurnitureWithoutGroups.length; i++) {
40849                     {
40850                         var piece = selectedFurnitureWithoutGroups[i];
40851                         if (!(function (a1, a2) { if (a1 == null && a2 == null)
40852                             return true; if (a1 == null || a2 == null)
40853                             return false; if (a1.length != a2.length)
40854                             return false; for (var i_5 = 0; i_5 < a1.length; i_5++) {
40855                             if (a1[i_5] != a2[i_5])
40856                                 return false;
40857                         } return true; })(modelMaterials, piece.getModelMaterials()) || model !== piece.getModel()) {
40858                             modelMaterials = null;
40859                             model = null;
40860                             creator = null;
40861                             break;
40862                         }
40863                     }
40864                     ;
40865                 }
40866             }
40867             if (modelMaterialsController != null) {
40868                 modelMaterialsController.setMaterials(modelMaterials);
40869                 modelMaterialsController.setModel(model);
40870                 modelMaterialsController.setModelCreator(creator);
40871                 modelMaterialsController.setModelSize(firstPieceExceptGroup.getWidth(), firstPieceExceptGroup.getDepth(), firstPieceExceptGroup.getHeight());
40872                 modelMaterialsController.setModelRotation(firstPieceExceptGroup.getModelRotation());
40873                 modelMaterialsController.setModelTransformations(firstPieceExceptGroup.getModelTransformations());
40874                 modelMaterialsController.setModelFlags(firstPieceExceptGroup.getModelFlags());
40875             }
40876             var defaultColorsAndTextures = true;
40877             for (var i = 0; i < /* size */ selectedFurnitureWithoutGroups.length; i++) {
40878                 {
40879                     var piece = selectedFurnitureWithoutGroups[i];
40880                     if (piece.getColor() != null || piece.getTexture() != null || piece.getModelMaterials() != null) {
40881                         defaultColorsAndTextures = false;
40882                         break;
40883                     }
40884                 }
40885                 ;
40886             }
40887             if (color != null) {
40888                 this.setPaint(HomeFurnitureController.FurniturePaint.COLORED);
40889             }
40890             else if (texture != null) {
40891                 this.setPaint(HomeFurnitureController.FurniturePaint.TEXTURED);
40892             }
40893             else if (modelMaterials != null) {
40894                 this.setPaint(HomeFurnitureController.FurniturePaint.MODEL_MATERIALS);
40895             }
40896             else if (defaultColorsAndTextures) {
40897                 this.setPaint(HomeFurnitureController.FurniturePaint.DEFAULT);
40898             }
40899             else {
40900                 this.setPaint(null);
40901             }
40902             var modelTransformations = firstPiece.getModelTransformations();
40903             if ( /* size */selectedFurniture.length !== 1 || (firstPiece != null && firstPiece instanceof HomeFurnitureGroup)) {
40904                 modelTransformations = null;
40905             }
40906             else {
40907                 if (modelTransformations == null) {
40908                     modelTransformations = [];
40909                 }
40910                 if (firstPiece != null && firstPiece instanceof HomeDoorOrWindow) {
40911                     var editedDoorOrWindow = firstPiece;
40912                     this.doorOrWindow = true;
40913                     this.wallThickness = editedDoorOrWindow.getWallThickness();
40914                     this.wallDistance = editedDoorOrWindow.getWallDistance();
40915                     this.wallWidth = editedDoorOrWindow.getWallWidth();
40916                     this.wallLeft = editedDoorOrWindow.getWallLeft();
40917                     this.wallHeight = editedDoorOrWindow.getWallHeight();
40918                     this.wallTop = editedDoorOrWindow.getWallTop();
40919                     this.sashes = editedDoorOrWindow.getSashes();
40920                 }
40921             }
40922             this.setModelTransformations$com_eteks_sweethome3d_model_Transformation_A(modelTransformations);
40923             this.modelPresetTransformationsNames = ([]);
40924             this.modelPresetTransformations = ([]);
40925             if ( /* size */selectedFurniture.length === 1 && !(firstPiece != null && firstPiece instanceof HomeFurnitureGroup) && firstPiece.getCatalogId() != null) {
40926                 var catalogPiece = this.preferences.getFurnitureCatalog().getPieceOfFurnitureWithId(firstPiece.getCatalogId());
40927                 if (catalogPiece != null) {
40928                     var i = 1;
40929                     for (var presetTransformationsName = catalogPiece.getProperty("modelPresetTransformationsName_" + i); presetTransformationsName != null; presetTransformationsName = catalogPiece.getProperty("modelPresetTransformationsName_" + ++i)) {
40930                         {
40931                             var presetTransformations = catalogPiece.getProperty("modelPresetTransformations_" + i);
40932                             if (presetTransformations != null) {
40933                                 var strings = presetTransformations.trim().split(/\s+/);
40934                                 if (strings.length % 13 === 0) {
40935                                     var transformations = (function (s) { var a = []; while (s-- > 0)
40936                                         a.push(null); return a; })((strings.length / 13 | 0));
40937                                     try {
40938                                         for (var j = 0; j < strings.length; j += 12) {
40939                                             {
40940                                                 var transformationName = strings[j++];
40941                                                 var matrix = [[/* parseFloat */ parseFloat(strings[j + 0]), /* parseFloat */ parseFloat(strings[j + 1]), /* parseFloat */ parseFloat(strings[j + 2]), /* parseFloat */ parseFloat(strings[j + 3])], [/* parseFloat */ parseFloat(strings[j + 4]), /* parseFloat */ parseFloat(strings[j + 5]), /* parseFloat */ parseFloat(strings[j + 6]), /* parseFloat */ parseFloat(strings[j + 7])], [/* parseFloat */ parseFloat(strings[j + 8]), /* parseFloat */ parseFloat(strings[j + 9]), /* parseFloat */ parseFloat(strings[j + 10]), /* parseFloat */ parseFloat(strings[j + 11])]];
40942                                                 transformations[(j / 13 | 0)] = new Transformation(transformationName, matrix);
40943                                             }
40944                                             ;
40945                                         }
40946                                         /* add */ (this.modelPresetTransformationsNames.push(presetTransformationsName) > 0);
40947                                         /* add */ (this.modelPresetTransformations.push(transformations) > 0);
40948                                     }
40949                                     catch (ex) {
40950                                         console.info("Invalid value in preset transformations matrices for " + firstPiece.getCatalogId() + "\n" + ex);
40951                                     }
40952                                 }
40953                             }
40954                         }
40955                         ;
40956                     }
40957                 }
40958             }
40959             var firstPieceShininess = firstPieceExceptGroup.getShininess();
40960             var shininess = firstPieceShininess == null ? HomeFurnitureController.FurnitureShininess.DEFAULT : ( /* floatValue */firstPieceShininess === 0 ? HomeFurnitureController.FurnitureShininess.MATT : HomeFurnitureController.FurnitureShininess.SHINY);
40961             for (var i = 1; i < /* size */ selectedFurnitureWithoutGroups.length; i++) {
40962                 {
40963                     var piece = selectedFurnitureWithoutGroups[i];
40964                     if (firstPieceShininess !== piece.getShininess() || (firstPieceShininess != null && !(firstPieceShininess === piece.getShininess()))) {
40965                         shininess = null;
40966                         break;
40967                     }
40968                 }
40969                 ;
40970             }
40971             this.setShininess(shininess);
40972             var visibleEditable = true;
40973             var homeFurniture = this.home.getFurniture();
40974             for (var index = 0; index < selectedFurniture.length; index++) {
40975                 var piece = selectedFurniture[index];
40976                 {
40977                     if (!(homeFurniture.indexOf((piece)) >= 0)) {
40978                         visibleEditable = false;
40979                         break;
40980                     }
40981                 }
40982             }
40983             this.visibleEditable = visibleEditable;
40984             if (visibleEditable) {
40985                 var visible = firstPiece.isVisible();
40986                 for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
40987                     {
40988                         if (visible !== /* get */ selectedFurniture[i].isVisible()) {
40989                             visible = null;
40990                             break;
40991                         }
40992                     }
40993                     ;
40994                 }
40995                 this.setVisible(visible);
40996             }
40997             else {
40998                 this.setVisible(null);
40999             }
41000             var modelMirrored = firstPiece.isModelMirrored();
41001             for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
41002                 {
41003                     if (modelMirrored !== /* get */ selectedFurniture[i].isModelMirrored()) {
41004                         modelMirrored = null;
41005                         break;
41006                     }
41007                 }
41008                 ;
41009             }
41010             this.setModelMirrored(modelMirrored);
41011             var lightPowerEditable = (firstPiece != null && firstPiece instanceof HomeLight);
41012             for (var i = 1; lightPowerEditable && i < /* size */ selectedFurniture.length; i++) {
41013                 {
41014                     lightPowerEditable = ( /* get */selectedFurniture[i] != null && /* get */ selectedFurniture[i] instanceof HomeLight);
41015                 }
41016                 ;
41017             }
41018             this.lightPowerEditable = lightPowerEditable;
41019             if (lightPowerEditable) {
41020                 var lightPower = firstPiece.getPower();
41021                 for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
41022                     {
41023                         if ( /* floatValue */lightPower !== selectedFurniture[i].getPower()) {
41024                             lightPower = null;
41025                             break;
41026                         }
41027                     }
41028                     ;
41029                 }
41030                 this.setLightPower(lightPower);
41031             }
41032             else {
41033                 this.setLightPower(null);
41034             }
41035             var resizable = firstPiece.isResizable();
41036             for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
41037                 {
41038                     if ( /* booleanValue */resizable !== /* get */ selectedFurniture[i].isResizable()) {
41039                         resizable = null;
41040                         break;
41041                     }
41042                 }
41043                 ;
41044             }
41045             this.setResizable(resizable != null && /* booleanValue */ resizable);
41046             var deformable = true;
41047             for (var i = 0; deformable && i < /* size */ selectedFurniture.length; i++) {
41048                 {
41049                     var piece = selectedFurniture[i];
41050                     if (piece != null && piece instanceof HomeFurnitureGroup) {
41051                         {
41052                             var array = piece.getAllFurniture();
41053                             for (var index = 0; index < array.length; index++) {
41054                                 var childPiece = array[index];
41055                                 {
41056                                     if (!childPiece.isDeformable() || childPiece.isHorizontallyRotated() || childPiece.getModelTransformations() != null) {
41057                                         deformable = false;
41058                                         break;
41059                                     }
41060                                 }
41061                             }
41062                         }
41063                     }
41064                     else {
41065                         deformable = piece.isDeformable() && piece.getModelTransformations() == null;
41066                     }
41067                 }
41068                 ;
41069             }
41070             this.setDeformable(deformable);
41071             if (!this.isDeformable()) {
41072                 this.setProportional(true);
41073             }
41074             this.widthDepthDeformable = true;
41075             for (var i = 0; this.widthDepthDeformable && i < /* size */ selectedFurniture.length; i++) {
41076                 {
41077                     var piece = selectedFurniture[i];
41078                     this.widthDepthDeformable = piece.isWidthDepthDeformable();
41079                 }
41080                 ;
41081             }
41082             var texturable = firstPiece.isTexturable();
41083             for (var i = 1; i < /* size */ selectedFurniture.length; i++) {
41084                 {
41085                     if ( /* booleanValue */texturable !== /* get */ selectedFurniture[i].isTexturable()) {
41086                         texturable = null;
41087                         break;
41088                     }
41089                 }
41090                 ;
41091             }
41092             this.setTexturable(texturable == null || /* booleanValue */ texturable);
41093         }
41094     };
41095     /**
41096      * Returns all the pieces of the given <code>furniture</code> list except groups.
41097      * @param {HomePieceOfFurniture[]} furniture
41098      * @return {HomePieceOfFurniture[]}
41099      * @private
41100      */
41101     HomeFurnitureController.prototype.getFurnitureWithoutGroups = function (furniture) {
41102         var pieces = ([]);
41103         for (var index = 0; index < furniture.length; index++) {
41104             var piece = furniture[index];
41105             {
41106                 if (piece != null && piece instanceof HomeFurnitureGroup) {
41107                     /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(pieces, this.getFurnitureWithoutGroups(piece.getFurniture()));
41108                 }
41109                 else {
41110                     /* add */ (pieces.push(piece) > 0);
41111                 }
41112             }
41113         }
41114         return pieces;
41115     };
41116     /**
41117      * Returns <code>true</code> if the given <code>property</code> is editable.
41118      * Depending on whether a property is editable or not, the view associated to this controller
41119      * may render it differently.
41120      * @param {string} property
41121      * @return {boolean}
41122      */
41123     HomeFurnitureController.prototype.isPropertyEditable = function (property) {
41124         switch ((property)) {
41125             case "ADDITIONAL_PROPERTIES":
41126                 return this.getAdditionalProperties() != null;
41127             case "PRICE":
41128                 return this.isPriceEditable();
41129             case "VALUE_ADDED_TAX_PERCENTAGE":
41130                 return this.isValueAddedTaxPercentageEditable();
41131             case "ROLL":
41132             case "PITCH":
41133                 return this.isRollAndPitchEditable();
41134             case "MODEL_TRANSFORMATIONS":
41135                 return this.getModelTransformations() != null;
41136             case "LIGHT_POWER":
41137                 return this.isLightPowerEditable();
41138             case "VISIBLE":
41139                 return this.visibleEditable;
41140             default:
41141                 return true;
41142         }
41143     };
41144     /**
41145      * Sets the edited icon.
41146      * @param {Object} icon
41147      * @private
41148      */
41149     HomeFurnitureController.prototype.setIcon = function (icon) {
41150         if (icon !== this.icon) {
41151             var oldIcon = this.icon;
41152             this.icon = icon;
41153             this.propertyChangeSupport.firePropertyChange(/* name */ "ICON", oldIcon, icon);
41154         }
41155     };
41156     /**
41157      * Returns the edited icon.
41158      * @return {Object}
41159      */
41160     HomeFurnitureController.prototype.getIcon = function () {
41161         return this.icon;
41162     };
41163     /**
41164      * Sets the edited name.
41165      * @param {string} name
41166      */
41167     HomeFurnitureController.prototype.setName = function (name) {
41168         if (name !== this.name) {
41169             var oldName = this.name;
41170             this.name = name;
41171             this.propertyChangeSupport.firePropertyChange(/* name */ "NAME", oldName, name);
41172         }
41173     };
41174     /**
41175      * Returns the edited name.
41176      * @return {string}
41177      */
41178     HomeFurnitureController.prototype.getName = function () {
41179         return this.name;
41180     };
41181     /**
41182      * Sets whether furniture name is visible or not.
41183      * @param {boolean} nameVisible
41184      */
41185     HomeFurnitureController.prototype.setNameVisible = function (nameVisible) {
41186         if (nameVisible !== this.nameVisible) {
41187             var oldNameVisible = this.nameVisible;
41188             this.nameVisible = nameVisible;
41189             this.propertyChangeSupport.firePropertyChange(/* name */ "NAME_VISIBLE", oldNameVisible, nameVisible);
41190         }
41191     };
41192     /**
41193      * Returns whether furniture name should be drawn or not.
41194      * @return {boolean}
41195      */
41196     HomeFurnitureController.prototype.getNameVisible = function () {
41197         return this.nameVisible;
41198     };
41199     /**
41200      * Sets the edited description.
41201      * @param {string} description
41202      */
41203     HomeFurnitureController.prototype.setDescription = function (description) {
41204         if (description !== this.description) {
41205             var oldDescription = this.description;
41206             this.description = description;
41207             this.propertyChangeSupport.firePropertyChange(/* name */ "DESCRIPTION", oldDescription, description);
41208         }
41209     };
41210     /**
41211      * Returns the edited description.
41212      * @return {string}
41213      */
41214     HomeFurnitureController.prototype.getDescription = function () {
41215         return this.description;
41216     };
41217     /**
41218      * Sets additional edited properties.
41219      * @param {Object} additionalProperties
41220      */
41221     HomeFurnitureController.prototype.setAdditionalProperties = function (additionalProperties) {
41222         if (additionalProperties !== this.additionalProperties && (additionalProperties == null || !(function (o1, o2) { if (o1 && o1.equals) {
41223             return o1.equals(o2);
41224         }
41225         else {
41226             return o1 === o2;
41227         } })(additionalProperties, this.additionalProperties))) {
41228             var oldAdditionalProperties = this.additionalProperties;
41229             this.additionalProperties = additionalProperties != null ? ((function (o) { var r = {}; r['entries'] = o.entries != null ? o.entries.slice() : null; return r; })(additionalProperties)) : null;
41230             this.propertyChangeSupport.firePropertyChange(/* name */ "ADDITIONAL_PROPERTIES", oldAdditionalProperties, additionalProperties);
41231         }
41232     };
41233     /**
41234      * Returns additional edited properties.
41235      * @return {Object}
41236      */
41237     HomeFurnitureController.prototype.getAdditionalProperties = function () {
41238         return this.additionalProperties;
41239     };
41240     HomeFurnitureController.prototype.setPrice = function (price, updateCurrencyAndValueAddedTaxPercentage) {
41241         if (updateCurrencyAndValueAddedTaxPercentage === void 0) { updateCurrencyAndValueAddedTaxPercentage = true; }
41242         if (price !== this.price && (price == null || !((this.price) != null ? price.eq(this.price) : (price === (this.price))))) {
41243             var oldPrice = this.price;
41244             this.price = price;
41245             this.propertyChangeSupport.firePropertyChange(/* name */ "PRICE", oldPrice, price);
41246             if (updateCurrencyAndValueAddedTaxPercentage) {
41247                 if (price != null && this.isValueAddedTaxPercentageEditable() && this.getValueAddedTaxPercentage() == null && /* size */ Home.getFurnitureSubList(this.home.getSelectedItems()).length === 1) {
41248                     this.setValueAddedTaxPercentage(this.preferences.getDefaultValueAddedTaxPercentage());
41249                 }
41250             }
41251         }
41252     };
41253     /**
41254      * Returns the edited price.
41255      * @return {Big}
41256      */
41257     HomeFurnitureController.prototype.getPrice = function () {
41258         return this.price;
41259     };
41260     /**
41261      * Returns whether the price can be edited or not.
41262      * @return {boolean}
41263      */
41264     HomeFurnitureController.prototype.isPriceEditable = function () {
41265         return this.priceEditable;
41266     };
41267     /**
41268      * Sets the edited Value Added Tax percentage.
41269      * @param {Big} valueAddedTaxPercentage
41270      */
41271     HomeFurnitureController.prototype.setValueAddedTaxPercentage = function (valueAddedTaxPercentage) {
41272         if (valueAddedTaxPercentage !== this.valueAddedTaxPercentage && (valueAddedTaxPercentage == null || !((this.valueAddedTaxPercentage) != null ? valueAddedTaxPercentage.eq(this.valueAddedTaxPercentage) : (valueAddedTaxPercentage === (this.valueAddedTaxPercentage))))) {
41273             var oldValueAddedTaxPercentage = this.valueAddedTaxPercentage;
41274             this.valueAddedTaxPercentage = valueAddedTaxPercentage;
41275             this.propertyChangeSupport.firePropertyChange(/* name */ "VALUE_ADDED_TAX_PERCENTAGE", oldValueAddedTaxPercentage, valueAddedTaxPercentage);
41276         }
41277     };
41278     /**
41279      * Returns edited Value Added Tax percentage.
41280      * @return {Big}
41281      */
41282     HomeFurnitureController.prototype.getValueAddedTaxPercentage = function () {
41283         return this.valueAddedTaxPercentage;
41284     };
41285     /**
41286      * Returns whether the Value Added Tax percentage can be edited or not.
41287      * @return {boolean}
41288      */
41289     HomeFurnitureController.prototype.isValueAddedTaxPercentageEditable = function () {
41290         return this.valueAddedTaxPercentageEditable;
41291     };
41292     /**
41293      * Sets the edited abscissa.
41294      * @param {number} x
41295      */
41296     HomeFurnitureController.prototype.setX = function (x) {
41297         if (x !== this.x) {
41298             var oldX = this.x;
41299             this.x = x;
41300             this.propertyChangeSupport.firePropertyChange(/* name */ "X", oldX, x);
41301         }
41302     };
41303     /**
41304      * Returns the edited abscissa.
41305      * @return {number}
41306      */
41307     HomeFurnitureController.prototype.getX = function () {
41308         return this.x;
41309     };
41310     /**
41311      * Sets the edited ordinate.
41312      * @param {number} y
41313      */
41314     HomeFurnitureController.prototype.setY = function (y) {
41315         if (y !== this.y) {
41316             var oldY = this.y;
41317             this.y = y;
41318             this.propertyChangeSupport.firePropertyChange(/* name */ "Y", oldY, y);
41319         }
41320     };
41321     /**
41322      * Returns the edited ordinate.
41323      * @return {number}
41324      */
41325     HomeFurnitureController.prototype.getY = function () {
41326         return this.y;
41327     };
41328     /**
41329      * Sets the edited elevation.
41330      * @param {number} elevation
41331      */
41332     HomeFurnitureController.prototype.setElevation = function (elevation) {
41333         if (elevation !== this.elevation) {
41334             var oldElevation = this.elevation;
41335             this.elevation = elevation;
41336             this.propertyChangeSupport.firePropertyChange(/* name */ "ELEVATION", oldElevation, elevation);
41337         }
41338     };
41339     /**
41340      * Returns the edited elevation.
41341      * @return {number}
41342      */
41343     HomeFurnitureController.prototype.getElevation = function () {
41344         return this.elevation;
41345     };
41346     HomeFurnitureController.prototype.setAngleInDegrees = function (angleInDegrees, updateAngle) {
41347         if (updateAngle === void 0) { updateAngle = true; }
41348         if (angleInDegrees !== this.angleInDegrees) {
41349             var oldAngleInDegrees = this.angleInDegrees;
41350             this.angleInDegrees = angleInDegrees;
41351             this.propertyChangeSupport.firePropertyChange(/* name */ "ANGLE_IN_DEGREES", oldAngleInDegrees, angleInDegrees);
41352             if (updateAngle) {
41353                 if (this.angleInDegrees == null) {
41354                     this.setAngle(null, false);
41355                 }
41356                 else {
41357                     this.setAngle(new Number(/* toRadians */ (function (x) { return x * Math.PI / 180; })(this.angleInDegrees)).valueOf(), false);
41358                 }
41359             }
41360         }
41361     };
41362     /**
41363      * Returns the edited angle in degrees.
41364      * @return {number}
41365      */
41366     HomeFurnitureController.prototype.getAngleInDegrees = function () {
41367         return this.angleInDegrees;
41368     };
41369     HomeFurnitureController.prototype.setAngle = function (angle, updateAngleInDegrees) {
41370         if (updateAngleInDegrees === void 0) { updateAngleInDegrees = true; }
41371         if (angle !== this.angle) {
41372             var oldAngle = this.angle;
41373             this.angle = angle;
41374             this.propertyChangeSupport.firePropertyChange(/* name */ "ANGLE", oldAngle, angle);
41375             if (updateAngleInDegrees) {
41376                 if (angle == null) {
41377                     this.setAngleInDegrees(null, false);
41378                 }
41379                 else {
41380                     this.setAngleInDegrees(((Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(angle)) + 360) | 0) % 360, false);
41381                 }
41382             }
41383         }
41384     };
41385     /**
41386      * Returns the edited angle in radians.
41387      * @return {number}
41388      */
41389     HomeFurnitureController.prototype.getAngle = function () {
41390         return this.angle;
41391     };
41392     /**
41393      * Returns whether roll and pitch angles can be edited.
41394      * @return {boolean}
41395      */
41396     HomeFurnitureController.prototype.isRollAndPitchEditable = function () {
41397         return this.rollAndPitchEditable;
41398     };
41399     /**
41400      * Sets the edited roll angle in radians.
41401      * @param {number} roll
41402      */
41403     HomeFurnitureController.prototype.setRoll = function (roll) {
41404         if (roll !== this.roll) {
41405             var oldRoll = this.roll;
41406             this.roll = roll;
41407             this.propertyChangeSupport.firePropertyChange(/* name */ "ROLL", oldRoll, roll);
41408         }
41409     };
41410     /**
41411      * Returns the edited roll angle in radians.
41412      * @return {number}
41413      */
41414     HomeFurnitureController.prototype.getRoll = function () {
41415         return this.roll;
41416     };
41417     /**
41418      * Sets the edited pitch in radians.
41419      * @param {number} pitch
41420      */
41421     HomeFurnitureController.prototype.setPitch = function (pitch) {
41422         if (pitch !== this.pitch) {
41423             var oldPitch = this.pitch;
41424             this.pitch = pitch;
41425             this.propertyChangeSupport.firePropertyChange(/* name */ "PITCH", oldPitch, pitch);
41426         }
41427     };
41428     /**
41429      * Returns the edited pitch in radians.
41430      * @return {number}
41431      */
41432     HomeFurnitureController.prototype.getPitch = function () {
41433         return this.pitch;
41434     };
41435     /**
41436      * Sets the edited horizontal axis.
41437      * @param {HomeFurnitureController.FurnitureHorizontalAxis} horizontalAxis
41438      */
41439     HomeFurnitureController.prototype.setHorizontalAxis = function (horizontalAxis) {
41440         if (horizontalAxis !== this.horizontalAxis) {
41441             var oldAxis = this.horizontalAxis;
41442             this.horizontalAxis = horizontalAxis;
41443             this.propertyChangeSupport.firePropertyChange(/* name */ "HORIZONTAL_AXIS", oldAxis, horizontalAxis);
41444         }
41445     };
41446     /**
41447      * Returns the edited horizontal axis.
41448      * @return {HomeFurnitureController.FurnitureHorizontalAxis}
41449      */
41450     HomeFurnitureController.prototype.getHorizontalAxis = function () {
41451         return this.horizontalAxis;
41452     };
41453     /**
41454      * Returns <code>true</code> if base plan item is an enabled property.
41455      * @return {boolean}
41456      */
41457     HomeFurnitureController.prototype.isBasePlanItemEnabled = function () {
41458         return this.basePlanItemEnabled;
41459     };
41460     /**
41461      * Returns <code>true</code> if base plan item is an enabled property.
41462      * @deprecated the method is wrongly named and should be replaced by <code>isBasePlanItemEnabled</code>.
41463      * @return {boolean}
41464      */
41465     HomeFurnitureController.prototype.isBasePlanItemEditable = function () {
41466         return this.basePlanItemEnabled;
41467     };
41468     /**
41469      * Sets whether furniture is a base plan item or not.
41470      * @param {boolean} basePlanItem
41471      */
41472     HomeFurnitureController.prototype.setBasePlanItem = function (basePlanItem) {
41473         if (basePlanItem !== this.basePlanItem) {
41474             var oldMovable = this.basePlanItem;
41475             this.basePlanItem = basePlanItem;
41476             this.propertyChangeSupport.firePropertyChange(/* name */ "BASE_PLAN_ITEM", oldMovable, basePlanItem);
41477         }
41478     };
41479     /**
41480      * Returns whether furniture is a base plan item or not.
41481      * @return {boolean}
41482      */
41483     HomeFurnitureController.prototype.getBasePlanItem = function () {
41484         return this.basePlanItem;
41485     };
41486     HomeFurnitureController.prototype.setWidth$java_lang_Float = function (width) {
41487         this.setWidth$java_lang_Float$boolean$boolean$boolean(width, false, this.isProportional() || !this.widthDepthDeformable, this.isProportional());
41488     };
41489     HomeFurnitureController.prototype.setWidth$java_lang_Float$boolean$boolean$boolean = function (width, keepProportionalWidthUnchanged, updateDepth, updateHeight) {
41490         var adjustedWidth = width != null ? Math.max(width, 0.001) : null;
41491         if (adjustedWidth === width || adjustedWidth != null && (adjustedWidth === width) || !keepProportionalWidthUnchanged) {
41492             this.proportionalWidth = width;
41493         }
41494         if (adjustedWidth == null && this.width != null || adjustedWidth != null && !(adjustedWidth === this.width)) {
41495             var oldWidth = this.width;
41496             this.width = adjustedWidth;
41497             this.propertyChangeSupport.firePropertyChange(/* name */ "WIDTH", oldWidth, adjustedWidth);
41498             if (oldWidth != null && adjustedWidth != null) {
41499                 var ratio = adjustedWidth / oldWidth;
41500                 if (updateDepth && this.proportionalDepth != null) {
41501                     this.setDepth$java_lang_Float$boolean$boolean$boolean(this.proportionalDepth * ratio, true, false, false);
41502                 }
41503                 if (updateHeight && this.proportionalHeight != null) {
41504                     this.setHeight$java_lang_Float$boolean$boolean(this.proportionalHeight * ratio, true, false);
41505                 }
41506             }
41507             else {
41508                 if (updateDepth) {
41509                     this.setDepth$java_lang_Float$boolean$boolean$boolean(null, false, false, false);
41510                 }
41511                 if (updateHeight) {
41512                     this.setHeight$java_lang_Float$boolean$boolean(null, false, false);
41513                 }
41514             }
41515         }
41516     };
41517     HomeFurnitureController.prototype.setWidth = function (width, keepProportionalWidthUnchanged, updateDepth, updateHeight) {
41518         if (((typeof width === 'number') || width === null) && ((typeof keepProportionalWidthUnchanged === 'boolean') || keepProportionalWidthUnchanged === null) && ((typeof updateDepth === 'boolean') || updateDepth === null) && ((typeof updateHeight === 'boolean') || updateHeight === null)) {
41519             return this.setWidth$java_lang_Float$boolean$boolean$boolean(width, keepProportionalWidthUnchanged, updateDepth, updateHeight);
41520         }
41521         else if (((typeof width === 'number') || width === null) && keepProportionalWidthUnchanged === undefined && updateDepth === undefined && updateHeight === undefined) {
41522             return this.setWidth$java_lang_Float(width);
41523         }
41524         else
41525             throw new Error('invalid overload');
41526     };
41527     /**
41528      * Returns the edited width.
41529      * @return {number}
41530      */
41531     HomeFurnitureController.prototype.getWidth = function () {
41532         return this.width;
41533     };
41534     HomeFurnitureController.prototype.setDepth$java_lang_Float = function (depth) {
41535         this.setDepth$java_lang_Float$boolean$boolean$boolean(depth, false, this.isProportional() || !this.widthDepthDeformable, this.isProportional());
41536     };
41537     HomeFurnitureController.prototype.setDepth$java_lang_Float$boolean$boolean$boolean = function (depth, keepProportionalDepthUnchanged, updateWidth, updateHeight) {
41538         var adjustedDepth = depth != null ? Math.max(depth, 0.001) : null;
41539         if (adjustedDepth === depth || adjustedDepth != null && (adjustedDepth === depth) || !keepProportionalDepthUnchanged) {
41540             this.proportionalDepth = depth;
41541         }
41542         if (adjustedDepth == null && this.depth != null || adjustedDepth != null && !(adjustedDepth === this.depth)) {
41543             var oldDepth = this.depth;
41544             this.depth = adjustedDepth;
41545             this.propertyChangeSupport.firePropertyChange(/* name */ "DEPTH", oldDepth, adjustedDepth);
41546             if (oldDepth != null && adjustedDepth != null) {
41547                 var ratio = adjustedDepth / oldDepth;
41548                 if (updateWidth && this.proportionalWidth != null) {
41549                     this.setWidth$java_lang_Float$boolean$boolean$boolean(this.proportionalWidth * ratio, true, false, false);
41550                 }
41551                 if (updateHeight && this.proportionalHeight != null) {
41552                     this.setHeight$java_lang_Float$boolean$boolean(this.proportionalHeight * ratio, true, false);
41553                 }
41554             }
41555             else {
41556                 if (updateWidth) {
41557                     this.setWidth$java_lang_Float$boolean$boolean$boolean(null, false, false, false);
41558                 }
41559                 if (updateHeight) {
41560                     this.setHeight$java_lang_Float$boolean$boolean(null, false, false);
41561                 }
41562             }
41563         }
41564     };
41565     HomeFurnitureController.prototype.setDepth = function (depth, keepProportionalDepthUnchanged, updateWidth, updateHeight) {
41566         if (((typeof depth === 'number') || depth === null) && ((typeof keepProportionalDepthUnchanged === 'boolean') || keepProportionalDepthUnchanged === null) && ((typeof updateWidth === 'boolean') || updateWidth === null) && ((typeof updateHeight === 'boolean') || updateHeight === null)) {
41567             return this.setDepth$java_lang_Float$boolean$boolean$boolean(depth, keepProportionalDepthUnchanged, updateWidth, updateHeight);
41568         }
41569         else if (((typeof depth === 'number') || depth === null) && keepProportionalDepthUnchanged === undefined && updateWidth === undefined && updateHeight === undefined) {
41570             return this.setDepth$java_lang_Float(depth);
41571         }
41572         else
41573             throw new Error('invalid overload');
41574     };
41575     /**
41576      * Returns the edited depth.
41577      * @return {number}
41578      */
41579     HomeFurnitureController.prototype.getDepth = function () {
41580         return this.depth;
41581     };
41582     HomeFurnitureController.prototype.setHeight$java_lang_Float = function (height) {
41583         this.setHeight$java_lang_Float$boolean$boolean(height, false, this.isProportional());
41584     };
41585     HomeFurnitureController.prototype.setHeight$java_lang_Float$boolean$boolean = function (height, keepProportionalHeightUnchanged, updateWidthAndDepth) {
41586         var adjustedHeight = height != null ? Math.max(height, 0.001) : null;
41587         if (adjustedHeight === height || adjustedHeight != null && (adjustedHeight === height) || !keepProportionalHeightUnchanged) {
41588             this.proportionalHeight = height;
41589         }
41590         if (adjustedHeight == null && this.height != null || adjustedHeight != null && !(adjustedHeight === this.height)) {
41591             var oldHeight = this.height;
41592             this.height = adjustedHeight;
41593             this.propertyChangeSupport.firePropertyChange(/* name */ "HEIGHT", oldHeight, adjustedHeight);
41594             if (updateWidthAndDepth) {
41595                 if (oldHeight != null && adjustedHeight != null) {
41596                     var ratio = adjustedHeight / oldHeight;
41597                     if (this.proportionalWidth != null) {
41598                         this.setWidth$java_lang_Float$boolean$boolean$boolean(this.proportionalWidth * ratio, true, false, false);
41599                     }
41600                     if (this.proportionalDepth != null) {
41601                         this.setDepth$java_lang_Float$boolean$boolean$boolean(this.proportionalDepth * ratio, true, false, false);
41602                     }
41603                 }
41604                 else {
41605                     this.setWidth$java_lang_Float$boolean$boolean$boolean(null, false, false, false);
41606                     this.setDepth$java_lang_Float$boolean$boolean$boolean(null, false, false, false);
41607                 }
41608             }
41609         }
41610     };
41611     HomeFurnitureController.prototype.setHeight = function (height, keepProportionalHeightUnchanged, updateWidthAndDepth) {
41612         if (((typeof height === 'number') || height === null) && ((typeof keepProportionalHeightUnchanged === 'boolean') || keepProportionalHeightUnchanged === null) && ((typeof updateWidthAndDepth === 'boolean') || updateWidthAndDepth === null)) {
41613             return this.setHeight$java_lang_Float$boolean$boolean(height, keepProportionalHeightUnchanged, updateWidthAndDepth);
41614         }
41615         else if (((typeof height === 'number') || height === null) && keepProportionalHeightUnchanged === undefined && updateWidthAndDepth === undefined) {
41616             return this.setHeight$java_lang_Float(height);
41617         }
41618         else
41619             throw new Error('invalid overload');
41620     };
41621     /**
41622      * Returns the edited height.
41623      * @return {number}
41624      */
41625     HomeFurnitureController.prototype.getHeight = function () {
41626         return this.height;
41627     };
41628     /**
41629      * Sets whether furniture proportions should be kept.
41630      * @param {boolean} proportional
41631      */
41632     HomeFurnitureController.prototype.setProportional = function (proportional) {
41633         if (proportional !== this.proportional) {
41634             var oldProportional = this.proportional;
41635             this.proportional = proportional;
41636             this.propertyChangeSupport.firePropertyChange(/* name */ "PROPORTIONAL", oldProportional, proportional);
41637         }
41638     };
41639     /**
41640      * Returns whether furniture proportions should be kept or not.
41641      * @return {boolean}
41642      */
41643     HomeFurnitureController.prototype.isProportional = function () {
41644         return this.proportional;
41645     };
41646     /**
41647      * Sets the edited color.
41648      * @param {number} color
41649      */
41650     HomeFurnitureController.prototype.setColor = function (color) {
41651         if (color !== this.color) {
41652             var oldColor = this.color;
41653             this.color = color;
41654             this.propertyChangeSupport.firePropertyChange(/* name */ "COLOR", oldColor, color);
41655         }
41656     };
41657     /**
41658      * Returns the edited color.
41659      * @return {number}
41660      */
41661     HomeFurnitureController.prototype.getColor = function () {
41662         return this.color;
41663     };
41664     /**
41665      * Sets whether the piece is colored, textured, uses customized materials or unknown painted.
41666      * @param {HomeFurnitureController.FurniturePaint} paint
41667      */
41668     HomeFurnitureController.prototype.setPaint = function (paint) {
41669         if (paint !== this.paint) {
41670             var oldPaint = this.paint;
41671             this.paint = paint;
41672             this.propertyChangeSupport.firePropertyChange(/* name */ "PAINT", oldPaint, paint);
41673         }
41674     };
41675     /**
41676      * Returns whether the piece is colored, textured, uses customized materials or unknown painted.
41677      * @return {HomeFurnitureController.FurniturePaint}
41678      */
41679     HomeFurnitureController.prototype.getPaint = function () {
41680         return this.paint;
41681     };
41682     HomeFurnitureController.prototype.setModelTransformations$com_eteks_sweethome3d_model_Transformation_A = function (modelTransformations) {
41683         if (!(function (a1, a2) { if (a1 == null && a2 == null)
41684             return true; if (a1 == null || a2 == null)
41685             return false; if (a1.length != a2.length)
41686             return false; for (var i = 0; i < a1.length; i++) {
41687             if (a1[i] != a2[i])
41688                 return false;
41689         } return true; })(modelTransformations, this.modelTransformations)) {
41690             var oldModelTransformations = this.modelTransformations;
41691             this.modelTransformations = modelTransformations;
41692             this.propertyChangeSupport.firePropertyChange(/* name */ "MODEL_TRANSFORMATIONS", oldModelTransformations, modelTransformations);
41693             this.setDeformable(modelTransformations == null || modelTransformations.length === 0);
41694             this.setProportional(modelTransformations != null && modelTransformations.length > 0);
41695         }
41696     };
41697     HomeFurnitureController.prototype.setModelTransformations$com_eteks_sweethome3d_model_Transformation_A$float$float$float$float$float$float = function (transformations, x, y, elevation, width, depth, height) {
41698         if (this.doorOrWindow) {
41699             var currentX = this.getX();
41700             var currentY = this.getY();
41701             var currentElevation = this.getElevation();
41702             var currentWidth = this.getWidth();
41703             var currentDepth = this.getDepth();
41704             var currentHeight = this.getHeight();
41705             var angle = -this.getAngle();
41706             var currentXAlongWidth = (currentX * Math.cos(angle) - currentY * Math.sin(angle));
41707             var updatedXAlongWidth = (x * Math.cos(angle) - y * Math.sin(angle));
41708             var currentWallLeft = this.wallLeft * currentWidth;
41709             var wallWidth = this.wallWidth * currentWidth;
41710             var newWallLeft = void 0;
41711             if (this.getModelMirrored()) {
41712                 var xWallLeft = currentWallLeft - currentXAlongWidth - currentWidth / 2;
41713                 newWallLeft = xWallLeft + updatedXAlongWidth + width / 2;
41714             }
41715             else {
41716                 var xWallLeft = currentWallLeft + currentXAlongWidth - currentWidth / 2;
41717                 newWallLeft = xWallLeft - updatedXAlongWidth + width / 2;
41718             }
41719             var currentYAlongDepth = (currentX * Math.sin(angle) + currentY * Math.cos(angle));
41720             var updatedYAlongDepth = (x * Math.sin(angle) + y * Math.cos(angle));
41721             var currentWallDistance = this.wallDistance * currentDepth;
41722             var wallThickness = this.wallThickness * currentDepth;
41723             var yWallBack = currentYAlongDepth - currentDepth / 2 + currentWallDistance;
41724             var newWallDistance = yWallBack - updatedYAlongDepth + depth / 2;
41725             var currentWallTop = this.wallTop * currentHeight;
41726             var wallHeight = this.wallHeight * currentHeight;
41727             var newWallTop = currentWallTop + elevation + height - (currentElevation + currentHeight);
41728             var sashes = this.sashes;
41729             for (var i = 0; i < sashes.length; i++) {
41730                 {
41731                     var sash = sashes[i];
41732                     var xAxis = sash.getXAxis() * currentWidth;
41733                     xAxis += newWallLeft - currentWallLeft;
41734                     var yAxis = sash.getYAxis() * currentDepth;
41735                     yAxis += newWallDistance - currentWallDistance;
41736                     sashes[i] = new Sash(xAxis / width, yAxis / depth, sash.getWidth() * currentWidth / width, sash.getStartAngle(), sash.getEndAngle());
41737                 }
41738                 ;
41739             }
41740             this.wallThickness = wallThickness / depth;
41741             this.wallDistance = newWallDistance / depth;
41742             this.wallWidth = wallWidth / width;
41743             this.wallLeft = newWallLeft / width;
41744             this.wallHeight = wallHeight / height;
41745             this.wallTop = newWallTop / height;
41746             this.sashes = sashes;
41747         }
41748         this.setModelTransformations$com_eteks_sweethome3d_model_Transformation_A(transformations);
41749         this.setX(x);
41750         this.setY(y);
41751         this.setWidth$java_lang_Float$boolean$boolean$boolean(width, false, false, false);
41752         this.setDepth$java_lang_Float$boolean$boolean$boolean(depth, false, false, false);
41753         this.setHeight$java_lang_Float$boolean$boolean(height, false, false);
41754     };
41755     /**
41756      * Sets model transformations and updated dimensions of the edited piece.
41757      * @param {com.eteks.sweethome3d.model.Transformation[]} transformations
41758      * @param {number} x
41759      * @param {number} y
41760      * @param {number} elevation
41761      * @param {number} width
41762      * @param {number} depth
41763      * @param {number} height
41764      */
41765     HomeFurnitureController.prototype.setModelTransformations = function (transformations, x, y, elevation, width, depth, height) {
41766         if (((transformations != null && transformations instanceof Array && (transformations.length == 0 || transformations[0] == null || (transformations[0] != null && transformations[0] instanceof Transformation))) || transformations === null) && ((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof elevation === 'number') || elevation === null) && ((typeof width === 'number') || width === null) && ((typeof depth === 'number') || depth === null) && ((typeof height === 'number') || height === null)) {
41767             return this.setModelTransformations$com_eteks_sweethome3d_model_Transformation_A$float$float$float$float$float$float(transformations, x, y, elevation, width, depth, height);
41768         }
41769         else if (((transformations != null && transformations instanceof Array && (transformations.length == 0 || transformations[0] == null || (transformations[0] != null && transformations[0] instanceof Transformation))) || transformations === null) && x === undefined && y === undefined && elevation === undefined && width === undefined && depth === undefined && height === undefined) {
41770             return this.setModelTransformations$com_eteks_sweethome3d_model_Transformation_A(transformations);
41771         }
41772         else
41773             throw new Error('invalid overload');
41774     };
41775     /**
41776      * Returns model transformations.
41777      * @return {com.eteks.sweethome3d.model.Transformation[]}
41778      */
41779     HomeFurnitureController.prototype.getModelTransformations = function () {
41780         return this.modelTransformations;
41781     };
41782     /**
41783      * Returns the names of the available preset model transformations.
41784      * @return {string[]}
41785      */
41786     HomeFurnitureController.prototype.getModelPresetTransformationsNames = function () {
41787         return /* unmodifiableList */ this.modelPresetTransformationsNames.slice(0);
41788     };
41789     /**
41790      * Returns the preset model transformations at the given <code>index</code>.
41791      * @param {number} index
41792      * @return {com.eteks.sweethome3d.model.Transformation[]}
41793      */
41794     HomeFurnitureController.prototype.getModelPresetTransformations = function (index) {
41795         return /* get */ this.modelPresetTransformations[index];
41796     };
41797     /**
41798      * Sets whether the piece shininess is the default one, matt, shiny or unknown.
41799      * @param {HomeFurnitureController.FurnitureShininess} shininess
41800      */
41801     HomeFurnitureController.prototype.setShininess = function (shininess) {
41802         if (shininess !== this.shininess) {
41803             var oldShininess = this.shininess;
41804             this.shininess = shininess;
41805             this.propertyChangeSupport.firePropertyChange(/* name */ "SHININESS", oldShininess, shininess);
41806         }
41807     };
41808     /**
41809      * Returns whether the piece is shininess is the default one, matt, shiny or unknown.
41810      * @return {HomeFurnitureController.FurnitureShininess}
41811      */
41812     HomeFurnitureController.prototype.getShininess = function () {
41813         return this.shininess;
41814     };
41815     /**
41816      * Sets whether furniture is visible or not.
41817      * @param {boolean} visible
41818      */
41819     HomeFurnitureController.prototype.setVisible = function (visible) {
41820         if (visible !== this.visible) {
41821             var oldVisible = this.visible;
41822             this.visible = visible;
41823             this.propertyChangeSupport.firePropertyChange(/* name */ "VISIBLE", oldVisible, visible);
41824         }
41825     };
41826     /**
41827      * Returns whether furniture is visible or not.
41828      * @return {boolean}
41829      */
41830     HomeFurnitureController.prototype.getVisible = function () {
41831         return this.visible;
41832     };
41833     /**
41834      * Sets whether furniture model is mirrored or not.
41835      * @param {boolean} modelMirrored
41836      */
41837     HomeFurnitureController.prototype.setModelMirrored = function (modelMirrored) {
41838         if (modelMirrored !== this.modelMirrored) {
41839             var oldModelMirrored = this.modelMirrored;
41840             this.modelMirrored = modelMirrored;
41841             this.propertyChangeSupport.firePropertyChange(/* name */ "MODEL_MIRRORED", oldModelMirrored, modelMirrored);
41842         }
41843     };
41844     /**
41845      * Returns whether furniture model is mirrored or not.
41846      * @return {boolean}
41847      */
41848     HomeFurnitureController.prototype.getModelMirrored = function () {
41849         return this.modelMirrored;
41850     };
41851     /**
41852      * Returns <code>true</code> if light power is an editable property.
41853      * @return {boolean}
41854      */
41855     HomeFurnitureController.prototype.isLightPowerEditable = function () {
41856         return this.lightPowerEditable;
41857     };
41858     /**
41859      * Returns the edited light power.
41860      * @return {number}
41861      */
41862     HomeFurnitureController.prototype.getLightPower = function () {
41863         return this.lightPower;
41864     };
41865     /**
41866      * Sets the edited light power.
41867      * @param {number} lightPower
41868      */
41869     HomeFurnitureController.prototype.setLightPower = function (lightPower) {
41870         if (lightPower !== this.lightPower) {
41871             var oldLightPower = this.lightPower;
41872             this.lightPower = lightPower;
41873             this.propertyChangeSupport.firePropertyChange(/* name */ "LIGHT_POWER", oldLightPower, lightPower);
41874         }
41875     };
41876     /**
41877      * Sets whether furniture model can be resized or not.
41878      * @param {boolean} resizable
41879      * @private
41880      */
41881     HomeFurnitureController.prototype.setResizable = function (resizable) {
41882         if (resizable !== this.resizable) {
41883             var oldResizable = this.resizable;
41884             this.resizable = resizable;
41885             this.propertyChangeSupport.firePropertyChange(/* name */ "RESIZABLE", oldResizable, resizable);
41886         }
41887     };
41888     /**
41889      * Returns whether furniture model can be resized or not.
41890      * @return {boolean}
41891      */
41892     HomeFurnitureController.prototype.isResizable = function () {
41893         return this.resizable;
41894     };
41895     /**
41896      * Sets whether furniture model can be deformed or not.
41897      * @param {boolean} deformable
41898      * @private
41899      */
41900     HomeFurnitureController.prototype.setDeformable = function (deformable) {
41901         if (deformable !== this.deformable) {
41902             var oldDeformable = this.deformable;
41903             this.deformable = deformable;
41904             this.propertyChangeSupport.firePropertyChange(/* name */ "DEFORMABLE", oldDeformable, deformable);
41905         }
41906     };
41907     /**
41908      * Returns whether furniture model can be deformed or not.
41909      * @return {boolean}
41910      */
41911     HomeFurnitureController.prototype.isDeformable = function () {
41912         return this.deformable;
41913     };
41914     /**
41915      * Sets whether the color or the texture of the furniture model can be changed or not.
41916      * @param {boolean} texturable
41917      * @private
41918      */
41919     HomeFurnitureController.prototype.setTexturable = function (texturable) {
41920         if (texturable !== this.texturable) {
41921             var oldTexturable = this.texturable;
41922             this.texturable = texturable;
41923             this.propertyChangeSupport.firePropertyChange(/* name */ "TEXTURABLE", oldTexturable, texturable);
41924         }
41925     };
41926     /**
41927      * Returns whether the color or the texture of the furniture model can be changed or not.
41928      * @return {boolean}
41929      */
41930     HomeFurnitureController.prototype.isTexturable = function () {
41931         return this.texturable;
41932     };
41933     /**
41934      * Controls the modification of selected furniture in the edited home.
41935      */
41936     HomeFurnitureController.prototype.modifyFurniture = function () {
41937         var oldSelection = this.home.getSelectedItems();
41938         var selectedFurniture = Home.getFurnitureSubList(oldSelection);
41939         if (!(selectedFurniture.length == 0)) {
41940             var name_10 = this.getName();
41941             var nameVisible = this.getNameVisible();
41942             var description = this.getDescription();
41943             var editedProperties = this.getAdditionalProperties();
41944             var additionalProperties = void 0;
41945             if (editedProperties == null) {
41946                 additionalProperties = null;
41947             }
41948             else {
41949                 additionalProperties = ({});
41950                 {
41951                     var array = /* entrySet */ (function (m) { if (m.entries == null)
41952                         m.entries = []; return m.entries; })(editedProperties);
41953                     for (var index = 0; index < array.length; index++) {
41954                         var entry = array[index];
41955                         {
41956                             /* put */ (additionalProperties[entry.getKey().getName()] = entry.getValue());
41957                         }
41958                     }
41959                 }
41960             }
41961             var price = this.getPrice();
41962             var removePrice = selectedFurniture.length === 1 && price == null;
41963             var valueAddedTaxPercentage = this.getValueAddedTaxPercentage();
41964             var removeValueAddedTaxPercentage = selectedFurniture.length === 1 && valueAddedTaxPercentage == null;
41965             var currency = this.preferences.getCurrency();
41966             var x = this.getX();
41967             var y = this.getY();
41968             var elevation = this.getElevation();
41969             var angle = this.getAngle();
41970             var roll = this.getRoll();
41971             var pitch = this.getPitch();
41972             var horizontalAxis = this.getHorizontalAxis();
41973             var basePlanItem = this.getBasePlanItem();
41974             var width = this.getWidth();
41975             var depth = this.getDepth();
41976             var height = this.getHeight();
41977             var proportional = this.isProportional() && (width == null || depth == null || height == null);
41978             var paint = this.getPaint();
41979             var color = paint === HomeFurnitureController.FurniturePaint.COLORED ? this.getColor() : null;
41980             var textureController = this.getTextureController();
41981             var texture = void 0;
41982             if (textureController != null && paint === HomeFurnitureController.FurniturePaint.TEXTURED) {
41983                 texture = textureController.getTexture();
41984             }
41985             else {
41986                 texture = null;
41987             }
41988             var modelMaterialsController = this.getModelMaterialsController();
41989             var modelMaterials = void 0;
41990             if (modelMaterialsController != null && paint === HomeFurnitureController.FurniturePaint.MODEL_MATERIALS) {
41991                 modelMaterials = modelMaterialsController.getMaterials();
41992             }
41993             else {
41994                 modelMaterials = null;
41995             }
41996             var modelTransformations = this.getModelTransformations();
41997             var defaultShininess = this.getShininess() === HomeFurnitureController.FurnitureShininess.DEFAULT;
41998             var shininess = this.getShininess() === HomeFurnitureController.FurnitureShininess.SHINY ? new Number(0.5).valueOf() : (this.getShininess() === HomeFurnitureController.FurnitureShininess.MATT ? new Number(0).valueOf() : null);
41999             var visible = this.getVisible();
42000             var modelMirrored = this.getModelMirrored();
42001             var lightPower = this.getLightPower();
42002             var modifiedFurniture = (function (s) { var a = []; while (s-- > 0)
42003                 a.push(null); return a; })(/* size */ selectedFurniture.length);
42004             for (var i = 0; i < modifiedFurniture.length; i++) {
42005                 {
42006                     var piece = selectedFurniture[i];
42007                     if (piece != null && piece instanceof HomeLight) {
42008                         modifiedFurniture[i] = new HomeFurnitureController.ModifiedLight(piece);
42009                     }
42010                     else if (piece != null && piece instanceof HomeDoorOrWindow) {
42011                         modifiedFurniture[i] = new HomeFurnitureController.ModifiedDoorOrWindow(piece);
42012                     }
42013                     else if (piece != null && piece instanceof HomeFurnitureGroup) {
42014                         modifiedFurniture[i] = new HomeFurnitureController.ModifiedFurnitureGroup(piece);
42015                     }
42016                     else {
42017                         modifiedFurniture[i] = new HomeFurnitureController.ModifiedPieceOfFurniture(piece);
42018                     }
42019                 }
42020                 ;
42021             }
42022             HomeFurnitureController.doModifyFurniture(modifiedFurniture, name_10, nameVisible, description, additionalProperties, price, removePrice, valueAddedTaxPercentage, removeValueAddedTaxPercentage, currency, x, y, elevation, angle, roll, pitch, horizontalAxis, basePlanItem, width, depth, height, proportional, modelTransformations, this.wallThickness, this.wallDistance, this.wallWidth, this.wallLeft, this.wallHeight, this.wallTop, this.sashes, paint, color, texture, modelMaterials, defaultShininess, shininess, visible, modelMirrored, lightPower);
42023             if (this.undoSupport != null) {
42024                 var newSelection = this.home.getSelectedItems();
42025                 this.undoSupport.postEdit(new HomeFurnitureController.FurnitureModificationUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), /* toArray */ newSelection.slice(0), modifiedFurniture, name_10, nameVisible, description, additionalProperties, price, removePrice, valueAddedTaxPercentage, removeValueAddedTaxPercentage, currency, x, y, elevation, angle, roll, pitch, horizontalAxis, basePlanItem, width, depth, height, proportional, modelTransformations, this.wallThickness, this.wallDistance, this.wallWidth, this.wallLeft, this.wallHeight, this.wallTop, this.sashes, paint, color, texture, modelMaterials, defaultShininess, shininess, visible, modelMirrored, lightPower));
42026             }
42027             if (name_10 != null) {
42028                 this.preferences.addAutoCompletionString("HomePieceOfFurnitureName", name_10);
42029             }
42030             if (description != null) {
42031                 this.preferences.addAutoCompletionString("HomePieceOfFurnitureDescription", description);
42032             }
42033             if (valueAddedTaxPercentage != null) {
42034                 this.preferences.setDefaultValueAddedTaxPercentage(valueAddedTaxPercentage);
42035             }
42036         }
42037     };
42038     /**
42039      * Modifies furniture properties with the values in parameter.
42040      * @param {com.eteks.sweethome3d.viewcontroller.HomeFurnitureController.ModifiedPieceOfFurniture[]} modifiedFurniture
42041      * @param {string} name
42042      * @param {boolean} nameVisible
42043      * @param {string} description
42044      * @param {Object} additionalProperties
42045      * @param {Big} price
42046      * @param {boolean} removePrice
42047      * @param {Big} valueAddedTaxPercentage
42048      * @param {boolean} removeValueAddedTaxPercenage
42049      * @param {string} currency
42050      * @param {number} x
42051      * @param {number} y
42052      * @param {number} elevation
42053      * @param {number} angle
42054      * @param {number} roll
42055      * @param {number} pitch
42056      * @param {HomeFurnitureController.FurnitureHorizontalAxis} horizontalAxis
42057      * @param {boolean} basePlanItem
42058      * @param {number} width
42059      * @param {number} depth
42060      * @param {number} height
42061      * @param {boolean} proportional
42062      * @param {com.eteks.sweethome3d.model.Transformation[]} modelTransformations
42063      * @param {number} wallThickness
42064      * @param {number} wallDistance
42065      * @param {number} wallWidth
42066      * @param {number} wallLeft
42067      * @param {number} wallHeight
42068      * @param {number} wallTop
42069      * @param {com.eteks.sweethome3d.model.Sash[]} sashes
42070      * @param {HomeFurnitureController.FurniturePaint} paint
42071      * @param {number} color
42072      * @param {HomeTexture} texture
42073      * @param {com.eteks.sweethome3d.model.HomeMaterial[]} modelMaterials
42074      * @param {boolean} defaultShininess
42075      * @param {number} shininess
42076      * @param {boolean} visible
42077      * @param {boolean} modelMirrored
42078      * @param {number} lightPower
42079      * @private
42080      */
42081     HomeFurnitureController.doModifyFurniture = function (modifiedFurniture, name, nameVisible, description, additionalProperties, price, removePrice, valueAddedTaxPercentage, removeValueAddedTaxPercenage, currency, x, y, elevation, angle, roll, pitch, horizontalAxis, basePlanItem, width, depth, height, proportional, modelTransformations, wallThickness, wallDistance, wallWidth, wallLeft, wallHeight, wallTop, sashes, paint, color, texture, modelMaterials, defaultShininess, shininess, visible, modelMirrored, lightPower) {
42082         for (var index = 0; index < modifiedFurniture.length; index++) {
42083             var modifiedPiece = modifiedFurniture[index];
42084             {
42085                 var piece = modifiedPiece.getPieceOfFurniture();
42086                 if (name != null) {
42087                     piece.setName(name);
42088                 }
42089                 if (nameVisible != null) {
42090                     piece.setNameVisible(nameVisible);
42091                 }
42092                 if (additionalProperties != null) {
42093                     {
42094                         var array = /* entrySet */ (function (o) { var s = []; for (var e in o)
42095                             s.push({ k: e, v: o[e], getKey: function () { return this.k; }, getValue: function () { return this.v; } }); return s; })(additionalProperties);
42096                         for (var index1 = 0; index1 < array.length; index1++) {
42097                             var property = array[index1];
42098                             {
42099                                 piece.setProperty$java_lang_String$java_lang_Object(property.getKey(), property.getValue());
42100                             }
42101                         }
42102                     }
42103                 }
42104                 if (modifiedFurniture.length === 1 || description != null) {
42105                     piece.setDescription(description);
42106                 }
42107                 if (!(piece != null && piece instanceof HomeFurnitureGroup)) {
42108                     if (price != null || removePrice) {
42109                         if (price !== piece.getPrice() && (price == null || !((piece.getPrice()) != null ? price.eq(piece.getPrice()) : (price === (piece.getPrice()))))) {
42110                             piece.setCurrency(price != null ? currency : null);
42111                         }
42112                         if (price != null) {
42113                             try {
42114                                 price = /* setScale */ price.round(/* getDefaultFractionDigits */ (['JPY', 'VND'].indexOf(currency) >= 0 ? 0 : 2));
42115                             }
42116                             catch (ex) {
42117                             }
42118                         }
42119                         piece.setPrice(price);
42120                     }
42121                     if (valueAddedTaxPercentage != null || removeValueAddedTaxPercenage) {
42122                         piece.setValueAddedTaxPercentage(valueAddedTaxPercentage);
42123                     }
42124                 }
42125                 if (x != null) {
42126                     piece.setX(x);
42127                 }
42128                 if (y != null) {
42129                     piece.setY(y);
42130                 }
42131                 if (elevation != null) {
42132                     piece.setElevation(elevation);
42133                 }
42134                 if (angle != null) {
42135                     piece.setAngle(angle);
42136                 }
42137                 if (horizontalAxis != null) {
42138                     switch ((horizontalAxis)) {
42139                         case HomeFurnitureController.FurnitureHorizontalAxis.ROLL:
42140                             if (roll != null) {
42141                                 piece.setRoll(roll);
42142                                 piece.setPitch(0);
42143                             }
42144                             break;
42145                         case HomeFurnitureController.FurnitureHorizontalAxis.PITCH:
42146                             if (pitch != null) {
42147                                 piece.setPitch(pitch);
42148                                 piece.setRoll(0);
42149                             }
42150                             break;
42151                     }
42152                 }
42153                 if (basePlanItem != null && !piece.isDoorOrWindow()) {
42154                     piece.setMovable(!basePlanItem);
42155                 }
42156                 if (piece.isResizable()) {
42157                     var oldWidth = piece.getWidth();
42158                     var oldDepth = piece.getDepth();
42159                     var deformable = !proportional && piece.isDeformable();
42160                     if (deformable) {
42161                         if (width != null) {
42162                             piece.setWidth(width);
42163                         }
42164                         else if (depth != null && !piece.isWidthDepthDeformable()) {
42165                             piece.setWidth(piece.getWidth() * depth / oldDepth);
42166                         }
42167                         if (depth != null) {
42168                             piece.setDepth(depth);
42169                         }
42170                         else if (width != null && !piece.isWidthDepthDeformable()) {
42171                             piece.setDepth(piece.getDepth() * width / oldWidth);
42172                         }
42173                         if (height != null) {
42174                             piece.setHeight(height);
42175                         }
42176                     }
42177                     else {
42178                         if (width != null) {
42179                             piece.scale(width / piece.getWidth());
42180                         }
42181                         else if (depth != null) {
42182                             piece.scale(depth / piece.getDepth());
42183                         }
42184                         else if (height != null) {
42185                             piece.scale(height / piece.getHeight());
42186                         }
42187                     }
42188                     if (modelMirrored != null) {
42189                         piece.setModelMirrored(modelMirrored);
42190                     }
42191                     if ((piece != null && piece instanceof HomeDoorOrWindow) && modifiedFurniture.length === 1 && !(JSON.stringify(piece.getModelTransformations()) === JSON.stringify(modelTransformations != null && modelTransformations.length > 0 ? modelTransformations : null))) {
42192                         var doorOrWindow = piece;
42193                         doorOrWindow.setWallThickness(wallThickness);
42194                         doorOrWindow.setWallDistance(wallDistance);
42195                         doorOrWindow.setWallWidth(wallWidth);
42196                         doorOrWindow.setWallLeft(wallLeft);
42197                         doorOrWindow.setWallHeight(wallHeight);
42198                         doorOrWindow.setWallTop(wallTop);
42199                         doorOrWindow.setSashes(sashes);
42200                     }
42201                 }
42202                 if (piece.isTexturable()) {
42203                     if (paint != null) {
42204                         switch ((paint)) {
42205                             case HomeFurnitureController.FurniturePaint.DEFAULT:
42206                                 piece.setColor(null);
42207                                 piece.setTexture(null);
42208                                 piece.setModelMaterials(null);
42209                                 break;
42210                             case HomeFurnitureController.FurniturePaint.COLORED:
42211                                 piece.setColor(color);
42212                                 piece.setTexture(null);
42213                                 piece.setModelMaterials(null);
42214                                 break;
42215                             case HomeFurnitureController.FurniturePaint.TEXTURED:
42216                                 piece.setColor(null);
42217                                 piece.setTexture(texture);
42218                                 piece.setModelMaterials(null);
42219                                 break;
42220                             case HomeFurnitureController.FurniturePaint.MODEL_MATERIALS:
42221                                 piece.setColor(null);
42222                                 piece.setTexture(null);
42223                                 piece.setModelMaterials(modelMaterials);
42224                                 break;
42225                         }
42226                     }
42227                     if (defaultShininess) {
42228                         piece.setShininess(null);
42229                     }
42230                     else if (shininess != null) {
42231                         piece.setShininess(shininess);
42232                     }
42233                 }
42234                 if (modelTransformations != null) {
42235                     piece.setModelTransformations(modelTransformations.length > 0 ? modelTransformations : null);
42236                 }
42237                 if (visible != null) {
42238                     piece.setVisible(visible);
42239                 }
42240                 if (lightPower != null) {
42241                     piece.setPower(lightPower);
42242                 }
42243             }
42244         }
42245     };
42246     /**
42247      * Restores furniture properties from the values stored in <code>modifiedFurniture</code>.
42248      * @param {com.eteks.sweethome3d.viewcontroller.HomeFurnitureController.ModifiedPieceOfFurniture[]} modifiedFurniture
42249      * @private
42250      */
42251     HomeFurnitureController.undoModifyFurniture = function (modifiedFurniture) {
42252         for (var index = 0; index < modifiedFurniture.length; index++) {
42253             var modifiedPiece = modifiedFurniture[index];
42254             {
42255                 modifiedPiece.reset();
42256             }
42257         }
42258     };
42259     return HomeFurnitureController;
42260 }());
42261 HomeFurnitureController["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeFurnitureController";
42262 HomeFurnitureController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
42263 (function (HomeFurnitureController) {
42264     /**
42265      * The possible values for {@linkplain #getPaint() paint type}.
42266      * @enum
42267      * @property {HomeFurnitureController.FurniturePaint} DEFAULT
42268      * @property {HomeFurnitureController.FurniturePaint} COLORED
42269      * @property {HomeFurnitureController.FurniturePaint} TEXTURED
42270      * @property {HomeFurnitureController.FurniturePaint} MODEL_MATERIALS
42271      * @class
42272      */
42273     var FurniturePaint;
42274     (function (FurniturePaint) {
42275         FurniturePaint[FurniturePaint["DEFAULT"] = 0] = "DEFAULT";
42276         FurniturePaint[FurniturePaint["COLORED"] = 1] = "COLORED";
42277         FurniturePaint[FurniturePaint["TEXTURED"] = 2] = "TEXTURED";
42278         FurniturePaint[FurniturePaint["MODEL_MATERIALS"] = 3] = "MODEL_MATERIALS";
42279     })(FurniturePaint = HomeFurnitureController.FurniturePaint || (HomeFurnitureController.FurniturePaint = {}));
42280     /**
42281      * The possible values for {@linkplain #getShininess() shininess type}.
42282      * @enum
42283      * @property {HomeFurnitureController.FurnitureShininess} DEFAULT
42284      * @property {HomeFurnitureController.FurnitureShininess} MATT
42285      * @property {HomeFurnitureController.FurnitureShininess} SHINY
42286      * @class
42287      */
42288     var FurnitureShininess;
42289     (function (FurnitureShininess) {
42290         FurnitureShininess[FurnitureShininess["DEFAULT"] = 0] = "DEFAULT";
42291         FurnitureShininess[FurnitureShininess["MATT"] = 1] = "MATT";
42292         FurnitureShininess[FurnitureShininess["SHINY"] = 2] = "SHINY";
42293     })(FurnitureShininess = HomeFurnitureController.FurnitureShininess || (HomeFurnitureController.FurnitureShininess = {}));
42294     /**
42295      * The possible values for {@linkplain #getHorizontalAxis() horizontal axis}.
42296      * @enum
42297      * @property {HomeFurnitureController.FurnitureHorizontalAxis} ROLL
42298      * @property {HomeFurnitureController.FurnitureHorizontalAxis} PITCH
42299      * @class
42300      */
42301     var FurnitureHorizontalAxis;
42302     (function (FurnitureHorizontalAxis) {
42303         FurnitureHorizontalAxis[FurnitureHorizontalAxis["ROLL"] = 0] = "ROLL";
42304         FurnitureHorizontalAxis[FurnitureHorizontalAxis["PITCH"] = 1] = "PITCH";
42305     })(FurnitureHorizontalAxis = HomeFurnitureController.FurnitureHorizontalAxis || (HomeFurnitureController.FurnitureHorizontalAxis = {}));
42306     /**
42307      * Undoable edit for furniture modification. This class isn't anonymous to avoid
42308      * being bound to controller and its view.
42309      * @extends LocalizedUndoableEdit
42310      * @class
42311      */
42312     var FurnitureModificationUndoableEdit = /** @class */ (function (_super) {
42313         __extends(FurnitureModificationUndoableEdit, _super);
42314         function FurnitureModificationUndoableEdit(home, preferences, oldSelection, newSelection, modifiedFurniture, name, nameVisible, description, additionalProperties, price, removePrice, valueAddedTaxPercentage, removeValueAddedTaxPercenage, currency, x, y, elevation, angle, roll, pitch, horizontalAxis, basePlanItem, width, depth, height, proportional, modelTransformations, wallThickness, wallDistance, wallWidth, wallLeft, wallHeight, wallTop, sashes, paint, color, texture, modelMaterials, defaultShininess, shininess, visible, modelMirrored, lightPower) {
42315             var _this = _super.call(this, preferences, HomeFurnitureController, "undoModifyFurnitureName") || this;
42316             if (_this.home === undefined) {
42317                 _this.home = null;
42318             }
42319             if (_this.modifiedFurniture === undefined) {
42320                 _this.modifiedFurniture = null;
42321             }
42322             if (_this.oldSelection === undefined) {
42323                 _this.oldSelection = null;
42324             }
42325             if (_this.newSelection === undefined) {
42326                 _this.newSelection = null;
42327             }
42328             if (_this.name === undefined) {
42329                 _this.name = null;
42330             }
42331             if (_this.nameVisible === undefined) {
42332                 _this.nameVisible = null;
42333             }
42334             if (_this.description === undefined) {
42335                 _this.description = null;
42336             }
42337             if (_this.additionalProperties === undefined) {
42338                 _this.additionalProperties = null;
42339             }
42340             if (_this.price === undefined) {
42341                 _this.price = null;
42342             }
42343             if (_this.removePrice === undefined) {
42344                 _this.removePrice = false;
42345             }
42346             if (_this.currency === undefined) {
42347                 _this.currency = null;
42348             }
42349             if (_this.valueAddedTaxPercentage === undefined) {
42350                 _this.valueAddedTaxPercentage = null;
42351             }
42352             if (_this.removeValueAddedTaxPercentage === undefined) {
42353                 _this.removeValueAddedTaxPercentage = false;
42354             }
42355             if (_this.x === undefined) {
42356                 _this.x = null;
42357             }
42358             if (_this.y === undefined) {
42359                 _this.y = null;
42360             }
42361             if (_this.elevation === undefined) {
42362                 _this.elevation = null;
42363             }
42364             if (_this.angle === undefined) {
42365                 _this.angle = null;
42366             }
42367             if (_this.roll === undefined) {
42368                 _this.roll = null;
42369             }
42370             if (_this.pitch === undefined) {
42371                 _this.pitch = null;
42372             }
42373             if (_this.horizontalAxis === undefined) {
42374                 _this.horizontalAxis = null;
42375             }
42376             if (_this.basePlanItem === undefined) {
42377                 _this.basePlanItem = null;
42378             }
42379             if (_this.width === undefined) {
42380                 _this.width = null;
42381             }
42382             if (_this.depth === undefined) {
42383                 _this.depth = null;
42384             }
42385             if (_this.height === undefined) {
42386                 _this.height = null;
42387             }
42388             if (_this.proportional === undefined) {
42389                 _this.proportional = false;
42390             }
42391             if (_this.modelTransformations === undefined) {
42392                 _this.modelTransformations = null;
42393             }
42394             if (_this.paint === undefined) {
42395                 _this.paint = null;
42396             }
42397             if (_this.color === undefined) {
42398                 _this.color = null;
42399             }
42400             if (_this.texture === undefined) {
42401                 _this.texture = null;
42402             }
42403             if (_this.modelMaterials === undefined) {
42404                 _this.modelMaterials = null;
42405             }
42406             if (_this.defaultShininess === undefined) {
42407                 _this.defaultShininess = false;
42408             }
42409             if (_this.shininess === undefined) {
42410                 _this.shininess = null;
42411             }
42412             if (_this.visible === undefined) {
42413                 _this.visible = null;
42414             }
42415             if (_this.modelMirrored === undefined) {
42416                 _this.modelMirrored = null;
42417             }
42418             if (_this.lightPower === undefined) {
42419                 _this.lightPower = null;
42420             }
42421             if (_this.wallThickness === undefined) {
42422                 _this.wallThickness = 0;
42423             }
42424             if (_this.wallDistance === undefined) {
42425                 _this.wallDistance = 0;
42426             }
42427             if (_this.wallWidth === undefined) {
42428                 _this.wallWidth = 0;
42429             }
42430             if (_this.wallLeft === undefined) {
42431                 _this.wallLeft = 0;
42432             }
42433             if (_this.wallHeight === undefined) {
42434                 _this.wallHeight = 0;
42435             }
42436             if (_this.wallTop === undefined) {
42437                 _this.wallTop = 0;
42438             }
42439             if (_this.sashes === undefined) {
42440                 _this.sashes = null;
42441             }
42442             if (_this.widthsInPlan === undefined) {
42443                 _this.widthsInPlan = null;
42444             }
42445             if (_this.depthsInPlan === undefined) {
42446                 _this.depthsInPlan = null;
42447             }
42448             if (_this.heightsInPlan === undefined) {
42449                 _this.heightsInPlan = null;
42450             }
42451             _this.home = home;
42452             _this.oldSelection = oldSelection;
42453             _this.newSelection = newSelection;
42454             _this.modifiedFurniture = modifiedFurniture;
42455             _this.name = name;
42456             _this.nameVisible = nameVisible;
42457             _this.description = description;
42458             _this.additionalProperties = additionalProperties;
42459             _this.price = price;
42460             _this.removePrice = removePrice;
42461             _this.valueAddedTaxPercentage = valueAddedTaxPercentage;
42462             _this.removeValueAddedTaxPercentage = removeValueAddedTaxPercenage;
42463             _this.currency = currency;
42464             _this.x = x;
42465             _this.y = y;
42466             _this.elevation = elevation;
42467             _this.angle = angle;
42468             _this.roll = roll;
42469             _this.pitch = pitch;
42470             _this.horizontalAxis = horizontalAxis;
42471             _this.basePlanItem = basePlanItem;
42472             _this.width = width;
42473             _this.depth = depth;
42474             _this.height = height;
42475             _this.proportional = proportional;
42476             _this.modelTransformations = modelTransformations;
42477             _this.wallThickness = wallThickness;
42478             _this.wallDistance = wallDistance;
42479             _this.wallWidth = wallWidth;
42480             _this.wallLeft = wallLeft;
42481             _this.wallHeight = wallHeight;
42482             _this.wallTop = wallTop;
42483             _this.sashes = sashes;
42484             _this.paint = paint;
42485             _this.color = color;
42486             _this.texture = texture;
42487             _this.modelMaterials = modelMaterials;
42488             _this.defaultShininess = defaultShininess;
42489             _this.shininess = shininess;
42490             _this.visible = visible;
42491             _this.modelMirrored = modelMirrored;
42492             _this.lightPower = lightPower;
42493             _this.widthsInPlan = (function (s) { var a = []; while (s-- > 0)
42494                 a.push(0); return a; })(modifiedFurniture.length);
42495             _this.depthsInPlan = (function (s) { var a = []; while (s-- > 0)
42496                 a.push(0); return a; })(modifiedFurniture.length);
42497             _this.heightsInPlan = (function (s) { var a = []; while (s-- > 0)
42498                 a.push(0); return a; })(modifiedFurniture.length);
42499             for (var i = 0; i < modifiedFurniture.length; i++) {
42500                 {
42501                     var piece = modifiedFurniture[i].getPieceOfFurniture();
42502                     _this.widthsInPlan[i] = piece.getWidthInPlan();
42503                     _this.depthsInPlan[i] = piece.getDepthInPlan();
42504                     _this.heightsInPlan[i] = piece.getHeightInPlan();
42505                 }
42506                 ;
42507             }
42508             return _this;
42509         }
42510         /**
42511          *
42512          */
42513         FurnitureModificationUndoableEdit.prototype.undo = function () {
42514             _super.prototype.undo.call(this);
42515             HomeFurnitureController.undoModifyFurniture(this.modifiedFurniture);
42516             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
42517         };
42518         /**
42519          *
42520          */
42521         FurnitureModificationUndoableEdit.prototype.redo = function () {
42522             _super.prototype.redo.call(this);
42523             HomeFurnitureController.doModifyFurniture(this.modifiedFurniture, this.name, this.nameVisible, this.description, this.additionalProperties, this.price, this.removePrice, this.valueAddedTaxPercentage, this.removeValueAddedTaxPercentage, this.currency, this.x, this.y, this.elevation, this.angle, this.roll, this.pitch, this.horizontalAxis, this.basePlanItem, this.width, this.depth, this.height, this.proportional, this.modelTransformations, this.wallThickness, this.wallDistance, this.wallWidth, this.wallLeft, this.wallHeight, this.wallTop, this.sashes, this.paint, this.color, this.texture, this.modelMaterials, this.defaultShininess, this.shininess, this.visible, this.modelMirrored, this.lightPower);
42524             for (var i = 0; i < this.modifiedFurniture.length; i++) {
42525                 {
42526                     var piece = this.modifiedFurniture[i].getPieceOfFurniture();
42527                     piece.setWidthInPlan(this.widthsInPlan[i]);
42528                     piece.setDepthInPlan(this.depthsInPlan[i]);
42529                     piece.setHeightInPlan(this.heightsInPlan[i]);
42530                 }
42531                 ;
42532             }
42533             this.home.setSelectedItems(/* asList */ this.newSelection.slice(0));
42534         };
42535         return FurnitureModificationUndoableEdit;
42536     }(LocalizedUndoableEdit));
42537     HomeFurnitureController.FurnitureModificationUndoableEdit = FurnitureModificationUndoableEdit;
42538     FurnitureModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeFurnitureController.FurnitureModificationUndoableEdit";
42539     FurnitureModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
42540     /**
42541      * Stores the current properties values of a modified piece of furniture.
42542      * @param {HomePieceOfFurniture} piece
42543      * @class
42544      */
42545     var ModifiedPieceOfFurniture = /** @class */ (function () {
42546         function ModifiedPieceOfFurniture(piece) {
42547             if (this.piece === undefined) {
42548                 this.piece = null;
42549             }
42550             if (this.name === undefined) {
42551                 this.name = null;
42552             }
42553             if (this.nameVisible === undefined) {
42554                 this.nameVisible = false;
42555             }
42556             if (this.description === undefined) {
42557                 this.description = null;
42558             }
42559             if (this.properties === undefined) {
42560                 this.properties = null;
42561             }
42562             if (this.price === undefined) {
42563                 this.price = null;
42564             }
42565             if (this.valueAddedTaxPercentage === undefined) {
42566                 this.valueAddedTaxPercentage = null;
42567             }
42568             if (this.currency === undefined) {
42569                 this.currency = null;
42570             }
42571             if (this.x === undefined) {
42572                 this.x = 0;
42573             }
42574             if (this.y === undefined) {
42575                 this.y = 0;
42576             }
42577             if (this.elevation === undefined) {
42578                 this.elevation = 0;
42579             }
42580             if (this.angle === undefined) {
42581                 this.angle = 0;
42582             }
42583             if (this.roll === undefined) {
42584                 this.roll = 0;
42585             }
42586             if (this.pitch === undefined) {
42587                 this.pitch = 0;
42588             }
42589             if (this.movable === undefined) {
42590                 this.movable = false;
42591             }
42592             if (this.width === undefined) {
42593                 this.width = 0;
42594             }
42595             if (this.depth === undefined) {
42596                 this.depth = 0;
42597             }
42598             if (this.height === undefined) {
42599                 this.height = 0;
42600             }
42601             if (this.widthInPlan === undefined) {
42602                 this.widthInPlan = 0;
42603             }
42604             if (this.depthInPlan === undefined) {
42605                 this.depthInPlan = 0;
42606             }
42607             if (this.heightInPlan === undefined) {
42608                 this.heightInPlan = 0;
42609             }
42610             if (this.modelTransformations === undefined) {
42611                 this.modelTransformations = null;
42612             }
42613             if (this.color === undefined) {
42614                 this.color = null;
42615             }
42616             if (this.texture === undefined) {
42617                 this.texture = null;
42618             }
42619             if (this.modelMaterials === undefined) {
42620                 this.modelMaterials = null;
42621             }
42622             if (this.shininess === undefined) {
42623                 this.shininess = null;
42624             }
42625             if (this.visible === undefined) {
42626                 this.visible = false;
42627             }
42628             if (this.modelMirrored === undefined) {
42629                 this.modelMirrored = false;
42630             }
42631             this.piece = piece;
42632             this.name = piece.getName();
42633             this.nameVisible = piece.isNameVisible();
42634             this.description = piece.getDescription();
42635             var propertyNames = piece.getPropertyNames();
42636             if ( /* size */propertyNames.length === 0) {
42637                 this.properties = /* emptyMap */ {};
42638             }
42639             else if ( /* size */propertyNames.length === 1) {
42640                 var name_11 = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(propertyNames).next();
42641                 this.properties = /* singletonMap */ (function (k) { var o = {}; o[k] = (piece.isContentProperty(name_11) ? piece.getContentProperty(name_11) : piece.getProperty(name_11)); return o; })(name_11);
42642             }
42643             else {
42644                 this.properties = ({});
42645                 for (var index = 0; index < propertyNames.length; index++) {
42646                     var name_12 = propertyNames[index];
42647                     {
42648                         /* put */ (this.properties[name_12] = piece.isContentProperty(name_12) ? piece.getContentProperty(name_12) : piece.getProperty(name_12));
42649                     }
42650                 }
42651             }
42652             this.price = piece.getPrice();
42653             this.valueAddedTaxPercentage = piece.getValueAddedTaxPercentage();
42654             this.currency = piece.getCurrency();
42655             this.x = piece.getX();
42656             this.y = piece.getY();
42657             this.elevation = piece.getElevation();
42658             this.angle = piece.getAngle();
42659             this.roll = piece.getRoll();
42660             this.pitch = piece.getPitch();
42661             this.movable = piece.isMovable();
42662             this.width = piece.getWidth();
42663             this.depth = piece.getDepth();
42664             this.height = piece.getHeight();
42665             this.widthInPlan = piece.getWidthInPlan();
42666             this.depthInPlan = piece.getDepthInPlan();
42667             this.heightInPlan = piece.getHeightInPlan();
42668             this.modelTransformations = piece.getModelTransformations();
42669             this.color = piece.getColor();
42670             this.texture = piece.getTexture();
42671             this.modelMaterials = piece.getModelMaterials();
42672             this.shininess = piece.getShininess();
42673             this.visible = piece.isVisible();
42674             this.modelMirrored = piece.isModelMirrored();
42675         }
42676         ModifiedPieceOfFurniture.prototype.getPieceOfFurniture = function () {
42677             return this.piece;
42678         };
42679         ModifiedPieceOfFurniture.prototype.reset = function () {
42680             this.piece.setName(this.name);
42681             this.piece.setNameVisible(this.nameVisible);
42682             this.piece.setDescription(this.description);
42683             var propertyNames = this.piece.getPropertyNames();
42684             for (var index = 0; index < propertyNames.length; index++) {
42685                 var name_13 = propertyNames[index];
42686                 {
42687                     this.piece.setProperty$java_lang_String$java_lang_Object(name_13, /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, name_13));
42688                 }
42689             }
42690             {
42691                 var array = /* entrySet */ (function (o) { var s = []; for (var e in o)
42692                     s.push({ k: e, v: o[e], getKey: function () { return this.k; }, getValue: function () { return this.v; } }); return s; })(this.properties);
42693                 for (var index = 0; index < array.length; index++) {
42694                     var entry = array[index];
42695                     {
42696                         if (!(propertyNames.indexOf((entry.getKey())) >= 0)) {
42697                             this.piece.setProperty$java_lang_String$java_lang_Object(entry.getKey(), entry.getValue());
42698                         }
42699                     }
42700                 }
42701             }
42702             if (!(this.piece != null && this.piece instanceof HomeFurnitureGroup)) {
42703                 this.piece.setPrice(this.price);
42704                 this.piece.setValueAddedTaxPercentage(this.valueAddedTaxPercentage);
42705                 this.piece.setCurrency(this.currency);
42706             }
42707             this.piece.setX(this.x);
42708             this.piece.setY(this.y);
42709             this.piece.setElevation(this.elevation);
42710             this.piece.setAngle(this.angle);
42711             if (this.piece.isHorizontallyRotatable()) {
42712                 this.piece.setRoll(this.roll);
42713                 this.piece.setPitch(this.pitch);
42714             }
42715             this.piece.setMovable(this.movable);
42716             if (this.piece.isResizable()) {
42717                 this.piece.setWidth(this.width);
42718                 this.piece.setDepth(this.depth);
42719                 this.piece.setHeight(this.height);
42720                 this.piece.setModelMirrored(this.modelMirrored);
42721             }
42722             this.piece.setWidthInPlan(this.widthInPlan);
42723             this.piece.setDepthInPlan(this.depthInPlan);
42724             this.piece.setHeightInPlan(this.heightInPlan);
42725             this.piece.setModelTransformations(this.modelTransformations);
42726             if (this.piece.isTexturable()) {
42727                 this.piece.setColor(this.color);
42728                 this.piece.setTexture(this.texture);
42729                 this.piece.setModelMaterials(this.modelMaterials);
42730                 this.piece.setShininess(this.shininess);
42731             }
42732             this.piece.setVisible(this.visible);
42733         };
42734         return ModifiedPieceOfFurniture;
42735     }());
42736     HomeFurnitureController.ModifiedPieceOfFurniture = ModifiedPieceOfFurniture;
42737     ModifiedPieceOfFurniture["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeFurnitureController.ModifiedPieceOfFurniture";
42738     /**
42739      * Stores the current properties values of a modified door or window.
42740      * @param {HomeDoorOrWindow} doorOrWindow
42741      * @class
42742      * @extends HomeFurnitureController.ModifiedPieceOfFurniture
42743      */
42744     var ModifiedDoorOrWindow = /** @class */ (function (_super) {
42745         __extends(ModifiedDoorOrWindow, _super);
42746         function ModifiedDoorOrWindow(doorOrWindow) {
42747             var _this = _super.call(this, doorOrWindow) || this;
42748             if (_this.boundToWall === undefined) {
42749                 _this.boundToWall = false;
42750             }
42751             if (_this.wallThickness === undefined) {
42752                 _this.wallThickness = 0;
42753             }
42754             if (_this.wallDistance === undefined) {
42755                 _this.wallDistance = 0;
42756             }
42757             if (_this.wallWidth === undefined) {
42758                 _this.wallWidth = 0;
42759             }
42760             if (_this.wallLeft === undefined) {
42761                 _this.wallLeft = 0;
42762             }
42763             if (_this.wallHeight === undefined) {
42764                 _this.wallHeight = 0;
42765             }
42766             if (_this.wallTop === undefined) {
42767                 _this.wallTop = 0;
42768             }
42769             if (_this.sashes === undefined) {
42770                 _this.sashes = null;
42771             }
42772             _this.boundToWall = doorOrWindow.isBoundToWall();
42773             _this.wallThickness = doorOrWindow.getWallThickness();
42774             _this.wallDistance = doorOrWindow.getWallDistance();
42775             _this.wallWidth = doorOrWindow.getWallWidth();
42776             _this.wallLeft = doorOrWindow.getWallLeft();
42777             _this.wallHeight = doorOrWindow.getWallHeight();
42778             _this.wallTop = doorOrWindow.getWallTop();
42779             _this.sashes = doorOrWindow.getSashes();
42780             return _this;
42781         }
42782         ModifiedDoorOrWindow.prototype.reset = function () {
42783             _super.prototype.reset.call(this);
42784             var doorOrWindow = this.getPieceOfFurniture();
42785             doorOrWindow.setBoundToWall(this.boundToWall);
42786             doorOrWindow.setWallThickness(this.wallThickness);
42787             doorOrWindow.setWallDistance(this.wallDistance);
42788             doorOrWindow.setWallWidth(this.wallWidth);
42789             doorOrWindow.setWallLeft(this.wallLeft);
42790             doorOrWindow.setWallHeight(this.wallHeight);
42791             doorOrWindow.setWallTop(this.wallTop);
42792             doorOrWindow.setSashes(this.sashes);
42793         };
42794         return ModifiedDoorOrWindow;
42795     }(HomeFurnitureController.ModifiedPieceOfFurniture));
42796     HomeFurnitureController.ModifiedDoorOrWindow = ModifiedDoorOrWindow;
42797     ModifiedDoorOrWindow["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeFurnitureController.ModifiedDoorOrWindow";
42798     /**
42799      * Stores the current properties values of a modified light.
42800      * @param {HomeLight} light
42801      * @class
42802      * @extends HomeFurnitureController.ModifiedPieceOfFurniture
42803      */
42804     var ModifiedLight = /** @class */ (function (_super) {
42805         __extends(ModifiedLight, _super);
42806         function ModifiedLight(light) {
42807             var _this = _super.call(this, light) || this;
42808             if (_this.power === undefined) {
42809                 _this.power = 0;
42810             }
42811             _this.power = light.getPower();
42812             return _this;
42813         }
42814         ModifiedLight.prototype.reset = function () {
42815             _super.prototype.reset.call(this);
42816             this.getPieceOfFurniture().setPower(this.power);
42817         };
42818         return ModifiedLight;
42819     }(HomeFurnitureController.ModifiedPieceOfFurniture));
42820     HomeFurnitureController.ModifiedLight = ModifiedLight;
42821     ModifiedLight["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeFurnitureController.ModifiedLight";
42822     /**
42823      * Stores the current properties values of a modified group.
42824      * @param {HomeFurnitureGroup} group
42825      * @class
42826      * @extends HomeFurnitureController.ModifiedPieceOfFurniture
42827      */
42828     var ModifiedFurnitureGroup = /** @class */ (function (_super) {
42829         __extends(ModifiedFurnitureGroup, _super);
42830         function ModifiedFurnitureGroup(group) {
42831             var _this = _super.call(this, group) || this;
42832             if (_this.groupFurnitureX === undefined) {
42833                 _this.groupFurnitureX = null;
42834             }
42835             if (_this.groupFurnitureY === undefined) {
42836                 _this.groupFurnitureY = null;
42837             }
42838             if (_this.groupFurnitureWidth === undefined) {
42839                 _this.groupFurnitureWidth = null;
42840             }
42841             if (_this.groupFurnitureDepth === undefined) {
42842                 _this.groupFurnitureDepth = null;
42843             }
42844             if (_this.groupFurnitureColor === undefined) {
42845                 _this.groupFurnitureColor = null;
42846             }
42847             if (_this.groupFurnitureTexture === undefined) {
42848                 _this.groupFurnitureTexture = null;
42849             }
42850             if (_this.groupFurnitureModelMaterials === undefined) {
42851                 _this.groupFurnitureModelMaterials = null;
42852             }
42853             if (_this.groupFurnitureShininess === undefined) {
42854                 _this.groupFurnitureShininess = null;
42855             }
42856             var groupFurniture = _this.getGroupFurniture(group);
42857             _this.groupFurnitureX = (function (s) { var a = []; while (s-- > 0)
42858                 a.push(0); return a; })(/* size */ groupFurniture.length);
42859             _this.groupFurnitureY = (function (s) { var a = []; while (s-- > 0)
42860                 a.push(0); return a; })(/* size */ groupFurniture.length);
42861             _this.groupFurnitureWidth = (function (s) { var a = []; while (s-- > 0)
42862                 a.push(0); return a; })(/* size */ groupFurniture.length);
42863             _this.groupFurnitureDepth = (function (s) { var a = []; while (s-- > 0)
42864                 a.push(0); return a; })(/* size */ groupFurniture.length);
42865             _this.groupFurnitureColor = (function (s) { var a = []; while (s-- > 0)
42866                 a.push(null); return a; })(/* size */ groupFurniture.length);
42867             _this.groupFurnitureTexture = (function (s) { var a = []; while (s-- > 0)
42868                 a.push(null); return a; })(/* size */ groupFurniture.length);
42869             _this.groupFurnitureShininess = (function (s) { var a = []; while (s-- > 0)
42870                 a.push(null); return a; })(/* size */ groupFurniture.length);
42871             _this.groupFurnitureModelMaterials = (function (s) { var a = []; while (s-- > 0)
42872                 a.push(null); return a; })(/* size */ groupFurniture.length);
42873             for (var i = 0; i < /* size */ groupFurniture.length; i++) {
42874                 {
42875                     var groupPiece = groupFurniture[i];
42876                     _this.groupFurnitureX[i] = groupPiece.getX();
42877                     _this.groupFurnitureY[i] = groupPiece.getY();
42878                     _this.groupFurnitureWidth[i] = groupPiece.getWidth();
42879                     _this.groupFurnitureDepth[i] = groupPiece.getDepth();
42880                     _this.groupFurnitureColor[i] = groupPiece.getColor();
42881                     _this.groupFurnitureTexture[i] = groupPiece.getTexture();
42882                     _this.groupFurnitureShininess[i] = groupPiece.getShininess();
42883                     _this.groupFurnitureModelMaterials[i] = groupPiece.getModelMaterials();
42884                 }
42885                 ;
42886             }
42887             return _this;
42888         }
42889         ModifiedFurnitureGroup.prototype.reset = function () {
42890             _super.prototype.reset.call(this);
42891             var group = this.getPieceOfFurniture();
42892             var groupFurniture = this.getGroupFurniture(group);
42893             for (var i = 0; i < /* size */ groupFurniture.length; i++) {
42894                 {
42895                     var groupPiece = groupFurniture[i];
42896                     if (group.isResizable()) {
42897                         groupPiece.setX(this.groupFurnitureX[i]);
42898                         groupPiece.setY(this.groupFurnitureY[i]);
42899                         groupPiece.setWidth(this.groupFurnitureWidth[i]);
42900                         groupPiece.setDepth(this.groupFurnitureDepth[i]);
42901                     }
42902                     if (group.isTexturable() && !(groupPiece != null && groupPiece instanceof HomeFurnitureGroup)) {
42903                         groupPiece.setColor(this.groupFurnitureColor[i]);
42904                         groupPiece.setTexture(this.groupFurnitureTexture[i]);
42905                         groupPiece.setModelMaterials(this.groupFurnitureModelMaterials[i]);
42906                         groupPiece.setShininess(this.groupFurnitureShininess[i]);
42907                     }
42908                 }
42909                 ;
42910             }
42911         };
42912         /**
42913          * Returns all the children of the given <code>furnitureGroup</code>.
42914          * @param {HomeFurnitureGroup} furnitureGroup
42915          * @return {HomePieceOfFurniture[]}
42916          * @private
42917          */
42918         ModifiedFurnitureGroup.prototype.getGroupFurniture = function (furnitureGroup) {
42919             var pieces = ([]);
42920             {
42921                 var array = furnitureGroup.getFurniture();
42922                 for (var index = 0; index < array.length; index++) {
42923                     var piece = array[index];
42924                     {
42925                         /* add */ (pieces.push(piece) > 0);
42926                         if (piece != null && piece instanceof HomeFurnitureGroup) {
42927                             /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(pieces, this.getGroupFurniture(piece));
42928                         }
42929                     }
42930                 }
42931             }
42932             return pieces;
42933         };
42934         return ModifiedFurnitureGroup;
42935     }(HomeFurnitureController.ModifiedPieceOfFurniture));
42936     HomeFurnitureController.ModifiedFurnitureGroup = ModifiedFurnitureGroup;
42937     ModifiedFurnitureGroup["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeFurnitureController.ModifiedFurnitureGroup";
42938     var HomeFurnitureController$0 = /** @class */ (function () {
42939         function HomeFurnitureController$0(__parent) {
42940             this.__parent = __parent;
42941         }
42942         HomeFurnitureController$0.prototype.propertyChange = function (ev) {
42943             this.__parent.setPaint(HomeFurnitureController.FurniturePaint.TEXTURED);
42944         };
42945         return HomeFurnitureController$0;
42946     }());
42947     HomeFurnitureController.HomeFurnitureController$0 = HomeFurnitureController$0;
42948     var HomeFurnitureController$1 = /** @class */ (function () {
42949         function HomeFurnitureController$1(__parent) {
42950             this.__parent = __parent;
42951         }
42952         HomeFurnitureController$1.prototype.propertyChange = function (ev) {
42953             this.__parent.setPaint(HomeFurnitureController.FurniturePaint.MODEL_MATERIALS);
42954         };
42955         return HomeFurnitureController$1;
42956     }());
42957     HomeFurnitureController.HomeFurnitureController$1 = HomeFurnitureController$1;
42958     var HomeFurnitureController$2 = /** @class */ (function () {
42959         function HomeFurnitureController$2(__parent) {
42960             this.__parent = __parent;
42961         }
42962         HomeFurnitureController$2.prototype.propertyChange = function (ev) {
42963             if (this.__parent.getWidth() != null && this.__parent.getDepth() != null && this.__parent.getHeight() != null) {
42964                 this.__parent.modelMaterialsController.setModelSize(this.__parent.getWidth(), this.__parent.getDepth(), this.__parent.getHeight());
42965             }
42966         };
42967         return HomeFurnitureController$2;
42968     }());
42969     HomeFurnitureController.HomeFurnitureController$2 = HomeFurnitureController$2;
42970     var HomeFurnitureController$3 = /** @class */ (function () {
42971         function HomeFurnitureController$3(__parent) {
42972             this.__parent = __parent;
42973         }
42974         HomeFurnitureController$3.prototype.propertyChange = function (ev) {
42975             if (this.__parent.getModelTransformations() != null) {
42976                 this.__parent.modelMaterialsController.setModelTransformations(this.__parent.getModelTransformations());
42977             }
42978         };
42979         return HomeFurnitureController$3;
42980     }());
42981     HomeFurnitureController.HomeFurnitureController$3 = HomeFurnitureController$3;
42982 })(HomeFurnitureController || (HomeFurnitureController = {}));
42983 /**
42984  * Creates the controller of home view.
42985  * @param {Home} home the home edited by this controller and its view.
42986  * @param {HomeApplication} application the instance of current application.
42987  * @param {Object} viewFactory a factory able to create views.
42988  * @param {Object} contentManager the content manager of the application.
42989  * @class
42990  * @author Emmanuel Puybaret
42991  */
42992 var HomeController = /** @class */ (function () {
42993     function HomeController(home, application, preferences, viewFactory, contentManager) {
42994         if (((home != null && home instanceof Home) || home === null) && ((application != null && application instanceof HomeApplication) || application === null) && ((preferences != null && preferences instanceof UserPreferences) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || viewFactory === null) && ((contentManager != null && (contentManager.constructor != null && contentManager.constructor["__interfaces"] != null && contentManager.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || contentManager === null)) {
42995             var __args = arguments;
42996             if (this.home === undefined) {
42997                 this.home = null;
42998             }
42999             if (this.preferences === undefined) {
43000                 this.preferences = null;
43001             }
43002             if (this.application === undefined) {
43003                 this.application = null;
43004             }
43005             if (this.viewFactory === undefined) {
43006                 this.viewFactory = null;
43007             }
43008             if (this.contentManager === undefined) {
43009                 this.contentManager = null;
43010             }
43011             if (this.undoSupport === undefined) {
43012                 this.undoSupport = null;
43013             }
43014             if (this.undoManager === undefined) {
43015                 this.undoManager = null;
43016             }
43017             if (this.homeView === undefined) {
43018                 this.homeView = null;
43019             }
43020             if (this.childControllers === undefined) {
43021                 this.childControllers = null;
43022             }
43023             if (this.furnitureCatalogController === undefined) {
43024                 this.furnitureCatalogController = null;
43025             }
43026             if (this.furnitureController === undefined) {
43027                 this.furnitureController = null;
43028             }
43029             if (this.planController === undefined) {
43030                 this.planController = null;
43031             }
43032             if (this.homeController3D === undefined) {
43033                 this.homeController3D = null;
43034             }
43035             if (this.saveUndoLevel === undefined) {
43036                 this.saveUndoLevel = 0;
43037             }
43038             if (this.notUndoableModifications === undefined) {
43039                 this.notUndoableModifications = false;
43040             }
43041             if (this.focusedView === undefined) {
43042                 this.focusedView = null;
43043             }
43044             this.home = home;
43045             this.preferences = preferences;
43046             this.viewFactory = viewFactory;
43047             this.contentManager = contentManager;
43048             this.application = application;
43049             this.undoSupport = new HomeController.HomeController$0(this);
43050             this.undoManager = new javax.swing.undo.UndoManager();
43051             this.undoSupport.addUndoableEditListener(this.undoManager);
43052             this.notUndoableModifications = home.isModified();
43053             if (home.getName() != null) {
43054                 var recentHomes = (this.preferences.getRecentHomes().slice(0));
43055                 /* remove */ (function (a) { var index = a.indexOf(home.getName()); if (index >= 0) {
43056                     a.splice(index, 1);
43057                     return true;
43058                 }
43059                 else {
43060                     return false;
43061                 } })(recentHomes);
43062                 /* add */ recentHomes.splice(0, 0, home.getName());
43063                 this.updateUserPreferencesRecentHomes(recentHomes);
43064             }
43065         }
43066         else if (((home != null && home instanceof Home) || home === null) && ((application != null && application instanceof HomeApplication) || application === null) && ((preferences != null && (preferences.constructor != null && preferences.constructor["__interfaces"] != null && preferences.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || viewFactory === null) && contentManager === undefined) {
43067             var __args = arguments;
43068             var viewFactory_9 = __args[2];
43069             var contentManager_9 = __args[3];
43070             {
43071                 var __args_119 = arguments;
43072                 var preferences_10 = __args_119[1].getUserPreferences();
43073                 if (this.home === undefined) {
43074                     this.home = null;
43075                 }
43076                 if (this.preferences === undefined) {
43077                     this.preferences = null;
43078                 }
43079                 if (this.application === undefined) {
43080                     this.application = null;
43081                 }
43082                 if (this.viewFactory === undefined) {
43083                     this.viewFactory = null;
43084                 }
43085                 if (this.contentManager === undefined) {
43086                     this.contentManager = null;
43087                 }
43088                 if (this.undoSupport === undefined) {
43089                     this.undoSupport = null;
43090                 }
43091                 if (this.undoManager === undefined) {
43092                     this.undoManager = null;
43093                 }
43094                 if (this.homeView === undefined) {
43095                     this.homeView = null;
43096                 }
43097                 if (this.childControllers === undefined) {
43098                     this.childControllers = null;
43099                 }
43100                 if (this.furnitureCatalogController === undefined) {
43101                     this.furnitureCatalogController = null;
43102                 }
43103                 if (this.furnitureController === undefined) {
43104                     this.furnitureController = null;
43105                 }
43106                 if (this.planController === undefined) {
43107                     this.planController = null;
43108                 }
43109                 if (this.homeController3D === undefined) {
43110                     this.homeController3D = null;
43111                 }
43112                 if (this.saveUndoLevel === undefined) {
43113                     this.saveUndoLevel = 0;
43114                 }
43115                 if (this.notUndoableModifications === undefined) {
43116                     this.notUndoableModifications = false;
43117                 }
43118                 if (this.focusedView === undefined) {
43119                     this.focusedView = null;
43120                 }
43121                 this.home = home;
43122                 this.preferences = preferences_10;
43123                 this.viewFactory = viewFactory_9;
43124                 this.contentManager = contentManager_9;
43125                 this.application = application;
43126                 this.undoSupport = new HomeController.HomeController$0(this);
43127                 this.undoManager = new javax.swing.undo.UndoManager();
43128                 this.undoSupport.addUndoableEditListener(this.undoManager);
43129                 this.notUndoableModifications = home.isModified();
43130                 if (home.getName() != null) {
43131                     var recentHomes = (this.preferences.getRecentHomes().slice(0));
43132                     /* remove */ (function (a) { var index = a.indexOf(home.getName()); if (index >= 0) {
43133                         a.splice(index, 1);
43134                         return true;
43135                     }
43136                     else {
43137                         return false;
43138                     } })(recentHomes);
43139                     /* add */ recentHomes.splice(0, 0, home.getName());
43140                     this.updateUserPreferencesRecentHomes(recentHomes);
43141                 }
43142             }
43143             if (this.home === undefined) {
43144                 this.home = null;
43145             }
43146             if (this.preferences === undefined) {
43147                 this.preferences = null;
43148             }
43149             if (this.application === undefined) {
43150                 this.application = null;
43151             }
43152             if (this.viewFactory === undefined) {
43153                 this.viewFactory = null;
43154             }
43155             if (this.contentManager === undefined) {
43156                 this.contentManager = null;
43157             }
43158             if (this.undoSupport === undefined) {
43159                 this.undoSupport = null;
43160             }
43161             if (this.undoManager === undefined) {
43162                 this.undoManager = null;
43163             }
43164             if (this.homeView === undefined) {
43165                 this.homeView = null;
43166             }
43167             if (this.childControllers === undefined) {
43168                 this.childControllers = null;
43169             }
43170             if (this.furnitureCatalogController === undefined) {
43171                 this.furnitureCatalogController = null;
43172             }
43173             if (this.furnitureController === undefined) {
43174                 this.furnitureController = null;
43175             }
43176             if (this.planController === undefined) {
43177                 this.planController = null;
43178             }
43179             if (this.homeController3D === undefined) {
43180                 this.homeController3D = null;
43181             }
43182             if (this.saveUndoLevel === undefined) {
43183                 this.saveUndoLevel = 0;
43184             }
43185             if (this.notUndoableModifications === undefined) {
43186                 this.notUndoableModifications = false;
43187             }
43188             if (this.focusedView === undefined) {
43189                 this.focusedView = null;
43190             }
43191         }
43192         else if (((home != null && home instanceof Home) || home === null) && ((application != null && application instanceof UserPreferences) || application === null) && ((preferences != null && (preferences.constructor != null && preferences.constructor["__interfaces"] != null && preferences.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || viewFactory === null) && contentManager === undefined) {
43193             var __args = arguments;
43194             var preferences_11 = __args[1];
43195             var viewFactory_10 = __args[2];
43196             var contentManager_10 = __args[3];
43197             {
43198                 var __args_120 = arguments;
43199                 var application_1 = null;
43200                 if (this.home === undefined) {
43201                     this.home = null;
43202                 }
43203                 if (this.preferences === undefined) {
43204                     this.preferences = null;
43205                 }
43206                 if (this.application === undefined) {
43207                     this.application = null;
43208                 }
43209                 if (this.viewFactory === undefined) {
43210                     this.viewFactory = null;
43211                 }
43212                 if (this.contentManager === undefined) {
43213                     this.contentManager = null;
43214                 }
43215                 if (this.undoSupport === undefined) {
43216                     this.undoSupport = null;
43217                 }
43218                 if (this.undoManager === undefined) {
43219                     this.undoManager = null;
43220                 }
43221                 if (this.homeView === undefined) {
43222                     this.homeView = null;
43223                 }
43224                 if (this.childControllers === undefined) {
43225                     this.childControllers = null;
43226                 }
43227                 if (this.furnitureCatalogController === undefined) {
43228                     this.furnitureCatalogController = null;
43229                 }
43230                 if (this.furnitureController === undefined) {
43231                     this.furnitureController = null;
43232                 }
43233                 if (this.planController === undefined) {
43234                     this.planController = null;
43235                 }
43236                 if (this.homeController3D === undefined) {
43237                     this.homeController3D = null;
43238                 }
43239                 if (this.saveUndoLevel === undefined) {
43240                     this.saveUndoLevel = 0;
43241                 }
43242                 if (this.notUndoableModifications === undefined) {
43243                     this.notUndoableModifications = false;
43244                 }
43245                 if (this.focusedView === undefined) {
43246                     this.focusedView = null;
43247                 }
43248                 this.home = home;
43249                 this.preferences = preferences_11;
43250                 this.viewFactory = viewFactory_10;
43251                 this.contentManager = contentManager_10;
43252                 this.application = application_1;
43253                 this.undoSupport = new HomeController.HomeController$0(this);
43254                 this.undoManager = new javax.swing.undo.UndoManager();
43255                 this.undoSupport.addUndoableEditListener(this.undoManager);
43256                 this.notUndoableModifications = home.isModified();
43257                 if (home.getName() != null) {
43258                     var recentHomes = (this.preferences.getRecentHomes().slice(0));
43259                     /* remove */ (function (a) { var index = a.indexOf(home.getName()); if (index >= 0) {
43260                         a.splice(index, 1);
43261                         return true;
43262                     }
43263                     else {
43264                         return false;
43265                     } })(recentHomes);
43266                     /* add */ recentHomes.splice(0, 0, home.getName());
43267                     this.updateUserPreferencesRecentHomes(recentHomes);
43268                 }
43269             }
43270             if (this.home === undefined) {
43271                 this.home = null;
43272             }
43273             if (this.preferences === undefined) {
43274                 this.preferences = null;
43275             }
43276             if (this.application === undefined) {
43277                 this.application = null;
43278             }
43279             if (this.viewFactory === undefined) {
43280                 this.viewFactory = null;
43281             }
43282             if (this.contentManager === undefined) {
43283                 this.contentManager = null;
43284             }
43285             if (this.undoSupport === undefined) {
43286                 this.undoSupport = null;
43287             }
43288             if (this.undoManager === undefined) {
43289                 this.undoManager = null;
43290             }
43291             if (this.homeView === undefined) {
43292                 this.homeView = null;
43293             }
43294             if (this.childControllers === undefined) {
43295                 this.childControllers = null;
43296             }
43297             if (this.furnitureCatalogController === undefined) {
43298                 this.furnitureCatalogController = null;
43299             }
43300             if (this.furnitureController === undefined) {
43301                 this.furnitureController = null;
43302             }
43303             if (this.planController === undefined) {
43304                 this.planController = null;
43305             }
43306             if (this.homeController3D === undefined) {
43307                 this.homeController3D = null;
43308             }
43309             if (this.saveUndoLevel === undefined) {
43310                 this.saveUndoLevel = 0;
43311             }
43312             if (this.notUndoableModifications === undefined) {
43313                 this.notUndoableModifications = false;
43314             }
43315             if (this.focusedView === undefined) {
43316                 this.focusedView = null;
43317             }
43318         }
43319         else if (((home != null && home instanceof Home) || home === null) && ((application != null && application instanceof HomeApplication) || application === null) && ((preferences != null && (preferences.constructor != null && preferences.constructor["__interfaces"] != null && preferences.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || preferences === null) && viewFactory === undefined && contentManager === undefined) {
43320             var __args = arguments;
43321             var viewFactory_11 = __args[2];
43322             {
43323                 var __args_121 = arguments;
43324                 var preferences_12 = __args_121[1].getUserPreferences();
43325                 var contentManager_11 = null;
43326                 if (this.home === undefined) {
43327                     this.home = null;
43328                 }
43329                 if (this.preferences === undefined) {
43330                     this.preferences = null;
43331                 }
43332                 if (this.application === undefined) {
43333                     this.application = null;
43334                 }
43335                 if (this.viewFactory === undefined) {
43336                     this.viewFactory = null;
43337                 }
43338                 if (this.contentManager === undefined) {
43339                     this.contentManager = null;
43340                 }
43341                 if (this.undoSupport === undefined) {
43342                     this.undoSupport = null;
43343                 }
43344                 if (this.undoManager === undefined) {
43345                     this.undoManager = null;
43346                 }
43347                 if (this.homeView === undefined) {
43348                     this.homeView = null;
43349                 }
43350                 if (this.childControllers === undefined) {
43351                     this.childControllers = null;
43352                 }
43353                 if (this.furnitureCatalogController === undefined) {
43354                     this.furnitureCatalogController = null;
43355                 }
43356                 if (this.furnitureController === undefined) {
43357                     this.furnitureController = null;
43358                 }
43359                 if (this.planController === undefined) {
43360                     this.planController = null;
43361                 }
43362                 if (this.homeController3D === undefined) {
43363                     this.homeController3D = null;
43364                 }
43365                 if (this.saveUndoLevel === undefined) {
43366                     this.saveUndoLevel = 0;
43367                 }
43368                 if (this.notUndoableModifications === undefined) {
43369                     this.notUndoableModifications = false;
43370                 }
43371                 if (this.focusedView === undefined) {
43372                     this.focusedView = null;
43373                 }
43374                 this.home = home;
43375                 this.preferences = preferences_12;
43376                 this.viewFactory = viewFactory_11;
43377                 this.contentManager = contentManager_11;
43378                 this.application = application;
43379                 this.undoSupport = new HomeController.HomeController$0(this);
43380                 this.undoManager = new javax.swing.undo.UndoManager();
43381                 this.undoSupport.addUndoableEditListener(this.undoManager);
43382                 this.notUndoableModifications = home.isModified();
43383                 if (home.getName() != null) {
43384                     var recentHomes = (this.preferences.getRecentHomes().slice(0));
43385                     /* remove */ (function (a) { var index = a.indexOf(home.getName()); if (index >= 0) {
43386                         a.splice(index, 1);
43387                         return true;
43388                     }
43389                     else {
43390                         return false;
43391                     } })(recentHomes);
43392                     /* add */ recentHomes.splice(0, 0, home.getName());
43393                     this.updateUserPreferencesRecentHomes(recentHomes);
43394                 }
43395             }
43396             if (this.home === undefined) {
43397                 this.home = null;
43398             }
43399             if (this.preferences === undefined) {
43400                 this.preferences = null;
43401             }
43402             if (this.application === undefined) {
43403                 this.application = null;
43404             }
43405             if (this.viewFactory === undefined) {
43406                 this.viewFactory = null;
43407             }
43408             if (this.contentManager === undefined) {
43409                 this.contentManager = null;
43410             }
43411             if (this.undoSupport === undefined) {
43412                 this.undoSupport = null;
43413             }
43414             if (this.undoManager === undefined) {
43415                 this.undoManager = null;
43416             }
43417             if (this.homeView === undefined) {
43418                 this.homeView = null;
43419             }
43420             if (this.childControllers === undefined) {
43421                 this.childControllers = null;
43422             }
43423             if (this.furnitureCatalogController === undefined) {
43424                 this.furnitureCatalogController = null;
43425             }
43426             if (this.furnitureController === undefined) {
43427                 this.furnitureController = null;
43428             }
43429             if (this.planController === undefined) {
43430                 this.planController = null;
43431             }
43432             if (this.homeController3D === undefined) {
43433                 this.homeController3D = null;
43434             }
43435             if (this.saveUndoLevel === undefined) {
43436                 this.saveUndoLevel = 0;
43437             }
43438             if (this.notUndoableModifications === undefined) {
43439                 this.notUndoableModifications = false;
43440             }
43441             if (this.focusedView === undefined) {
43442                 this.focusedView = null;
43443             }
43444         }
43445         else if (((home != null && home instanceof Home) || home === null) && ((application != null && application instanceof UserPreferences) || application === null) && ((preferences != null && (preferences.constructor != null && preferences.constructor["__interfaces"] != null && preferences.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || preferences === null) && viewFactory === undefined && contentManager === undefined) {
43446             var __args = arguments;
43447             var preferences_13 = __args[1];
43448             var viewFactory_12 = __args[2];
43449             {
43450                 var __args_122 = arguments;
43451                 var application_2 = null;
43452                 var contentManager_12 = null;
43453                 if (this.home === undefined) {
43454                     this.home = null;
43455                 }
43456                 if (this.preferences === undefined) {
43457                     this.preferences = null;
43458                 }
43459                 if (this.application === undefined) {
43460                     this.application = null;
43461                 }
43462                 if (this.viewFactory === undefined) {
43463                     this.viewFactory = null;
43464                 }
43465                 if (this.contentManager === undefined) {
43466                     this.contentManager = null;
43467                 }
43468                 if (this.undoSupport === undefined) {
43469                     this.undoSupport = null;
43470                 }
43471                 if (this.undoManager === undefined) {
43472                     this.undoManager = null;
43473                 }
43474                 if (this.homeView === undefined) {
43475                     this.homeView = null;
43476                 }
43477                 if (this.childControllers === undefined) {
43478                     this.childControllers = null;
43479                 }
43480                 if (this.furnitureCatalogController === undefined) {
43481                     this.furnitureCatalogController = null;
43482                 }
43483                 if (this.furnitureController === undefined) {
43484                     this.furnitureController = null;
43485                 }
43486                 if (this.planController === undefined) {
43487                     this.planController = null;
43488                 }
43489                 if (this.homeController3D === undefined) {
43490                     this.homeController3D = null;
43491                 }
43492                 if (this.saveUndoLevel === undefined) {
43493                     this.saveUndoLevel = 0;
43494                 }
43495                 if (this.notUndoableModifications === undefined) {
43496                     this.notUndoableModifications = false;
43497                 }
43498                 if (this.focusedView === undefined) {
43499                     this.focusedView = null;
43500                 }
43501                 this.home = home;
43502                 this.preferences = preferences_13;
43503                 this.viewFactory = viewFactory_12;
43504                 this.contentManager = contentManager_12;
43505                 this.application = application_2;
43506                 this.undoSupport = new HomeController.HomeController$0(this);
43507                 this.undoManager = new javax.swing.undo.UndoManager();
43508                 this.undoSupport.addUndoableEditListener(this.undoManager);
43509                 this.notUndoableModifications = home.isModified();
43510                 if (home.getName() != null) {
43511                     var recentHomes = (this.preferences.getRecentHomes().slice(0));
43512                     /* remove */ (function (a) { var index = a.indexOf(home.getName()); if (index >= 0) {
43513                         a.splice(index, 1);
43514                         return true;
43515                     }
43516                     else {
43517                         return false;
43518                     } })(recentHomes);
43519                     /* add */ recentHomes.splice(0, 0, home.getName());
43520                     this.updateUserPreferencesRecentHomes(recentHomes);
43521                 }
43522             }
43523             if (this.home === undefined) {
43524                 this.home = null;
43525             }
43526             if (this.preferences === undefined) {
43527                 this.preferences = null;
43528             }
43529             if (this.application === undefined) {
43530                 this.application = null;
43531             }
43532             if (this.viewFactory === undefined) {
43533                 this.viewFactory = null;
43534             }
43535             if (this.contentManager === undefined) {
43536                 this.contentManager = null;
43537             }
43538             if (this.undoSupport === undefined) {
43539                 this.undoSupport = null;
43540             }
43541             if (this.undoManager === undefined) {
43542                 this.undoManager = null;
43543             }
43544             if (this.homeView === undefined) {
43545                 this.homeView = null;
43546             }
43547             if (this.childControllers === undefined) {
43548                 this.childControllers = null;
43549             }
43550             if (this.furnitureCatalogController === undefined) {
43551                 this.furnitureCatalogController = null;
43552             }
43553             if (this.furnitureController === undefined) {
43554                 this.furnitureController = null;
43555             }
43556             if (this.planController === undefined) {
43557                 this.planController = null;
43558             }
43559             if (this.homeController3D === undefined) {
43560                 this.homeController3D = null;
43561             }
43562             if (this.saveUndoLevel === undefined) {
43563                 this.saveUndoLevel = 0;
43564             }
43565             if (this.notUndoableModifications === undefined) {
43566                 this.notUndoableModifications = false;
43567             }
43568             if (this.focusedView === undefined) {
43569                 this.focusedView = null;
43570             }
43571         }
43572         else
43573             throw new Error('invalid overload');
43574     }
43575     /**
43576      * Enables actions at controller instantiation.
43577      * @param {Object} homeView
43578      * @private
43579      */
43580     HomeController.prototype.enableDefaultActions = function (homeView) {
43581         var applicationExists = this.application != null;
43582         homeView.setEnabled(HomeView.ActionType.NEW_HOME, applicationExists);
43583         homeView.setEnabled(HomeView.ActionType.NEW_HOME_FROM_EXAMPLE, applicationExists);
43584         homeView.setEnabled(HomeView.ActionType.OPEN, applicationExists);
43585         homeView.setEnabled(HomeView.ActionType.DELETE_RECENT_HOMES, applicationExists && !(this.preferences.getRecentHomes().length == 0));
43586         homeView.setEnabled(HomeView.ActionType.CLOSE, applicationExists);
43587         homeView.setEnabled(HomeView.ActionType.SAVE, applicationExists);
43588         homeView.setEnabled(HomeView.ActionType.SAVE_AS, applicationExists);
43589         homeView.setEnabled(HomeView.ActionType.SAVE_AND_COMPRESS, applicationExists);
43590         homeView.setEnabled(HomeView.ActionType.PAGE_SETUP, true);
43591         homeView.setEnabled(HomeView.ActionType.PRINT_PREVIEW, true);
43592         homeView.setEnabled(HomeView.ActionType.PRINT, true);
43593         homeView.setEnabled(HomeView.ActionType.PRINT_TO_PDF, true);
43594         homeView.setEnabled(HomeView.ActionType.PREFERENCES, true);
43595         homeView.setEnabled(HomeView.ActionType.EXIT, applicationExists);
43596         homeView.setEnabled(HomeView.ActionType.IMPORT_FURNITURE, true);
43597         homeView.setEnabled(HomeView.ActionType.IMPORT_FURNITURE_LIBRARY, true);
43598         homeView.setEnabled(HomeView.ActionType.IMPORT_TEXTURE, true);
43599         homeView.setEnabled(HomeView.ActionType.IMPORT_TEXTURES_LIBRARY, true);
43600         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_CATALOG_ID, true);
43601         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_NAME, true);
43602         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_DESCRIPTION, true);
43603         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_CREATOR, true);
43604         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_LICENSE, true);
43605         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_WIDTH, true);
43606         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_HEIGHT, true);
43607         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_DEPTH, true);
43608         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_X, true);
43609         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_Y, true);
43610         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_ELEVATION, true);
43611         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_ANGLE, true);
43612         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_LEVEL, true);
43613         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_MODEL_SIZE, true);
43614         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_COLOR, true);
43615         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_TEXTURE, true);
43616         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_MOVABILITY, true);
43617         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_TYPE, true);
43618         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_VISIBILITY, true);
43619         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_PRICE, true);
43620         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_VALUE_ADDED_TAX_PERCENTAGE, true);
43621         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_VALUE_ADDED_TAX, true);
43622         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_PRICE_VALUE_ADDED_TAX_INCLUDED, true);
43623         homeView.setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_DESCENDING_ORDER, this.home.getFurnitureSortedPropertyName() != null);
43624         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_CATALOG_ID, true);
43625         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_NAME, true);
43626         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_DESCRIPTION, true);
43627         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_CREATOR, true);
43628         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_LICENSE, true);
43629         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_WIDTH, true);
43630         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_DEPTH, true);
43631         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_HEIGHT, true);
43632         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_X, true);
43633         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_Y, true);
43634         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_ELEVATION, true);
43635         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_ANGLE, true);
43636         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_LEVEL, true);
43637         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_MODEL_SIZE, true);
43638         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_COLOR, true);
43639         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_TEXTURE, true);
43640         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_MOVABLE, true);
43641         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_DOOR_OR_WINDOW, true);
43642         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_VISIBLE, true);
43643         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_PRICE, true);
43644         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_VALUE_ADDED_TAX_PERCENTAGE, true);
43645         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_VALUE_ADDED_TAX, true);
43646         homeView.setEnabled(HomeView.ActionType.DISPLAY_HOME_FURNITURE_PRICE_VALUE_ADDED_TAX_INCLUDED, true);
43647         {
43648             var array = this.home.getFurnitureAdditionalProperties();
43649             for (var index = 0; index < array.length; index++) {
43650                 var property = array[index];
43651                 {
43652                     homeView.setActionEnabled(HomeView.SORT_HOME_FURNITURE_ADDITIONAL_PROPERTY_ACTION_PREFIX + property.getName(), true);
43653                     homeView.setActionEnabled(HomeView.DISPLAY_HOME_FURNITURE_ADDITIONAL_PROPERTY_ACTION_PREFIX + property.getName(), true);
43654                 }
43655             }
43656         }
43657         homeView.setEnabled(HomeView.ActionType.EXPORT_TO_CSV, true);
43658         homeView.setEnabled(HomeView.ActionType.SELECT, true);
43659         homeView.setEnabled(HomeView.ActionType.PAN, true);
43660         homeView.setEnabled(HomeView.ActionType.LOCK_BASE_PLAN, true);
43661         homeView.setEnabled(HomeView.ActionType.UNLOCK_BASE_PLAN, true);
43662         homeView.setEnabled(HomeView.ActionType.ENABLE_MAGNETISM, true);
43663         homeView.setEnabled(HomeView.ActionType.DISABLE_MAGNETISM, true);
43664         homeView.setEnabled(HomeView.ActionType.MODIFY_COMPASS, true);
43665         var selectedLevel = this.home.getSelectedLevel();
43666         this.enableBackgroungImageActions(homeView, selectedLevel != null ? selectedLevel.getBackgroundImage() : this.home.getBackgroundImage());
43667         this.enableLevelActions(homeView);
43668         homeView.setEnabled(HomeView.ActionType.ZOOM_IN, true);
43669         homeView.setEnabled(HomeView.ActionType.ZOOM_OUT, true);
43670         homeView.setEnabled(HomeView.ActionType.EXPORT_TO_SVG, true);
43671         homeView.setEnabled(HomeView.ActionType.VIEW_FROM_TOP, true);
43672         homeView.setEnabled(HomeView.ActionType.VIEW_FROM_OBSERVER, true);
43673         homeView.setEnabled(HomeView.ActionType.MODIFY_OBSERVER, this.home.getCamera() === this.home.getObserverCamera());
43674         homeView.setEnabled(HomeView.ActionType.STORE_POINT_OF_VIEW, true);
43675         var emptyStoredCameras = (this.home.getStoredCameras().length == 0);
43676         homeView.setEnabled(HomeView.ActionType.DELETE_POINTS_OF_VIEW, !emptyStoredCameras);
43677         homeView.setEnabled(HomeView.ActionType.CREATE_PHOTOS_AT_POINTS_OF_VIEW, !emptyStoredCameras);
43678         homeView.setEnabled(HomeView.ActionType.DETACH_3D_VIEW, true);
43679         homeView.setEnabled(HomeView.ActionType.ATTACH_3D_VIEW, true);
43680         homeView.setEnabled(HomeView.ActionType.VIEW_FROM_OBSERVER, true);
43681         homeView.setEnabled(HomeView.ActionType.MODIFY_3D_ATTRIBUTES, true);
43682         homeView.setEnabled(HomeView.ActionType.CREATE_PHOTO, true);
43683         homeView.setEnabled(HomeView.ActionType.CREATE_VIDEO, true);
43684         homeView.setEnabled(HomeView.ActionType.EXPORT_TO_OBJ, true);
43685         homeView.setEnabled(HomeView.ActionType.HELP, true);
43686         homeView.setEnabled(HomeView.ActionType.ABOUT, true);
43687         this.enableCreationToolsActions(homeView);
43688         homeView.setTransferEnabled(true);
43689     };
43690     /**
43691      * Enables actions handling levels.
43692      * @param {Object} homeView
43693      * @private
43694      */
43695     HomeController.prototype.enableLevelActions = function (homeView) {
43696         var modificationState = this.getPlanController().isModificationState();
43697         homeView.setEnabled(HomeView.ActionType.ADD_LEVEL, !modificationState);
43698         homeView.setEnabled(HomeView.ActionType.ADD_LEVEL_AT_SAME_ELEVATION, !modificationState);
43699         var levels = this.home.getLevels();
43700         var selectedLevel = this.home.getSelectedLevel();
43701         var homeContainsOneSelectedLevel = levels.length > 1 && selectedLevel != null;
43702         homeView.setEnabled(HomeView.ActionType.SELECT_ALL_AT_ALL_LEVELS, !modificationState && /* size */ levels.length > 1);
43703         homeView.setEnabled(HomeView.ActionType.MAKE_LEVEL_VIEWABLE, !modificationState && homeContainsOneSelectedLevel);
43704         homeView.setEnabled(HomeView.ActionType.MAKE_LEVEL_UNVIEWABLE, !modificationState && homeContainsOneSelectedLevel);
43705         homeView.setEnabled(HomeView.ActionType.MAKE_LEVEL_ONLY_VIEWABLE_ONE, homeContainsOneSelectedLevel);
43706         homeView.setEnabled(HomeView.ActionType.MAKE_ALL_LEVELS_VIEWABLE, /* size */ levels.length > 1);
43707         homeView.setEnabled(HomeView.ActionType.MODIFY_LEVEL, homeContainsOneSelectedLevel);
43708         homeView.setEnabled(HomeView.ActionType.DELETE_LEVEL, !modificationState && homeContainsOneSelectedLevel);
43709         homeView.setEnabled(HomeView.ActionType.DISPLAY_ALL_LEVELS, /* size */ levels.length > 1);
43710         homeView.setEnabled(HomeView.ActionType.DISPLAY_SELECTED_LEVEL, /* size */ levels.length > 1);
43711     };
43712     /**
43713      * Enables plan actions depending on the selected level is viewable or not.
43714      * @param {Object} homeView
43715      * @private
43716      */
43717     HomeController.prototype.enableCreationToolsActions = function (homeView) {
43718         var selectedLevel = this.home.getSelectedLevel();
43719         var viewableLevel = selectedLevel == null || selectedLevel.isViewable();
43720         homeView.setEnabled(HomeView.ActionType.CREATE_WALLS, viewableLevel);
43721         homeView.setEnabled(HomeView.ActionType.CREATE_ROOMS, viewableLevel);
43722         homeView.setEnabled(HomeView.ActionType.CREATE_POLYLINES, viewableLevel);
43723         homeView.setEnabled(HomeView.ActionType.CREATE_DIMENSION_LINES, viewableLevel);
43724         homeView.setEnabled(HomeView.ActionType.CREATE_LABELS, viewableLevel);
43725     };
43726     /**
43727      * Returns the view associated with this controller.
43728      * @return {Object}
43729      */
43730     HomeController.prototype.getView = function () {
43731         var _this = this;
43732         if (this.homeView == null) {
43733             this.homeView = this.viewFactory.createHomeView(this.home, this.preferences, this);
43734             this.enableDefaultActions(this.homeView);
43735             this.addListeners();
43736             if (this.home.getName() != null && this.home.getVersion() > Home.CURRENT_VERSION) {
43737                 this.homeView.invokeLater(function () {
43738                     var message = _this.preferences.getLocalizedString(HomeController, "moreRecentVersionHome", _this.home.getName());
43739                     _this.getView().showMessage(message);
43740                 });
43741             }
43742         }
43743         return this.homeView;
43744     };
43745     /**
43746      * Returns the content manager of this controller.
43747      * @return {Object}
43748      */
43749     HomeController.prototype.getContentManager = function () {
43750         return this.contentManager;
43751     };
43752     /**
43753      * Returns the furniture catalog controller managed by this controller.
43754      * @return {FurnitureCatalogController}
43755      */
43756     HomeController.prototype.getFurnitureCatalogController = function () {
43757         if (this.furnitureCatalogController == null) {
43758             this.furnitureCatalogController = new FurnitureCatalogController(this.preferences.getFurnitureCatalog(), this.preferences, this.viewFactory, this.contentManager);
43759         }
43760         return this.furnitureCatalogController;
43761     };
43762     /**
43763      * Returns the furniture controller managed by this controller.
43764      * @return {FurnitureController}
43765      */
43766     HomeController.prototype.getFurnitureController = function () {
43767         if (this.furnitureController == null) {
43768             this.furnitureController = new FurnitureController(this.home, this.preferences, this.viewFactory, this.contentManager, this.getUndoableEditSupport());
43769         }
43770         return this.furnitureController;
43771     };
43772     /**
43773      * Returns the controller of home plan.
43774      * @return {PlanController}
43775      */
43776     HomeController.prototype.getPlanController = function () {
43777         if (this.planController == null) {
43778             this.planController = new PlanController(this.home, this.preferences, this.viewFactory, this.contentManager, this.getUndoableEditSupport());
43779         }
43780         return this.planController;
43781     };
43782     /**
43783      * Returns the controller of home 3D view.
43784      * @return {HomeController3D}
43785      */
43786     HomeController.prototype.getHomeController3D = function () {
43787         if (this.homeController3D == null) {
43788             this.homeController3D = new HomeController3D(this.home, this.getPlanController(), this.preferences, this.viewFactory, this.contentManager, this.getUndoableEditSupport());
43789         }
43790         return this.homeController3D;
43791     };
43792     /**
43793      * Returns the undoable edit support managed by this controller.
43794      * @return {javax.swing.undo.UndoableEditSupport}
43795      */
43796     HomeController.prototype.getUndoableEditSupport = function () {
43797         return this.undoSupport;
43798     };
43799     /**
43800      * Adds listeners that updates the enabled / disabled state of actions.
43801      * @private
43802      */
43803     HomeController.prototype.addListeners = function () {
43804         this.preferences.getFurnitureCatalog().addFurnitureListener((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
43805             return funcInst;
43806         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(new HomeController.FurnitureCatalogChangeListener(this)));
43807         this.preferences.getTexturesCatalog().addTexturesListener((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
43808             return funcInst;
43809         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(new HomeController.TexturesCatalogChangeListener(this)));
43810         this.preferences.addPropertyChangeListener(new HomeController.UserPreferencesPropertiesChangeListener(this));
43811         this.addCatalogSelectionListener();
43812         this.addHomeBackgroundImageListener();
43813         this.addNotUndoableModificationListeners();
43814         this.addHomeSelectionListener();
43815         this.addFurnitureSortListener();
43816         this.addUndoSupportListener();
43817         this.addHomeItemsListener();
43818         this.addLevelListeners();
43819         this.addStoredCamerasListener();
43820         this.addPlanControllerListeners();
43821         this.addLanguageListener();
43822     };
43823     /**
43824      * Adds a selection listener to catalog that enables / disables Add Furniture action.
43825      * @private
43826      */
43827     HomeController.prototype.addCatalogSelectionListener = function () {
43828         this.getFurnitureCatalogController().addSelectionListener(new HomeController.HomeController$1(this));
43829     };
43830     /**
43831      * Adds a property change listener to <code>preferences</code> to update
43832      * undo and redo presentation names when preferred language changes.
43833      * @private
43834      */
43835     HomeController.prototype.addLanguageListener = function () {
43836         this.preferences.addPropertyChangeListener("LANGUAGE", new HomeController.LanguageChangeListener(this));
43837     };
43838     /**
43839      * Adds a selection listener to home that enables / disables actions on selection.
43840      * @private
43841      */
43842     HomeController.prototype.addHomeSelectionListener = function () {
43843         if (this.home != null) {
43844             this.home.addSelectionListener(new HomeController.HomeController$2(this));
43845         }
43846     };
43847     /**
43848      * Adds a property change listener to home that enables / disables sort order action.
43849      * @private
43850      */
43851     HomeController.prototype.addFurnitureSortListener = function () {
43852         if (this.home != null) {
43853             this.home.addPropertyChangeListener("FURNITURE_SORTED_PROPERTY", new HomeController.HomeController$3(this));
43854         }
43855     };
43856     /**
43857      * Adds a property change listener to home that enables / disables background image actions.
43858      * @private
43859      */
43860     HomeController.prototype.addHomeBackgroundImageListener = function () {
43861         if (this.home != null) {
43862             this.home.addPropertyChangeListener("BACKGROUND_IMAGE", new HomeController.HomeController$4(this));
43863         }
43864     };
43865     /**
43866      * Enables background image actions.
43867      * @param {Object} homeView
43868      * @param {BackgroundImage} backgroundImage
43869      * @private
43870      */
43871     HomeController.prototype.enableBackgroungImageActions = function (homeView, backgroundImage) {
43872         var selectedLevel = this.home.getSelectedLevel();
43873         var homeHasBackgroundImage = backgroundImage != null && (selectedLevel == null || selectedLevel.isViewable());
43874         this.getView().setEnabled(HomeView.ActionType.IMPORT_BACKGROUND_IMAGE, !homeHasBackgroundImage);
43875         this.getView().setEnabled(HomeView.ActionType.MODIFY_BACKGROUND_IMAGE, homeHasBackgroundImage);
43876         this.getView().setEnabled(HomeView.ActionType.HIDE_BACKGROUND_IMAGE, homeHasBackgroundImage && backgroundImage.isVisible());
43877         this.getView().setEnabled(HomeView.ActionType.SHOW_BACKGROUND_IMAGE, homeHasBackgroundImage && !backgroundImage.isVisible());
43878         this.getView().setEnabled(HomeView.ActionType.DELETE_BACKGROUND_IMAGE, homeHasBackgroundImage);
43879     };
43880     /**
43881      * Adds listeners to track property changes that are not undoable.
43882      * @private
43883      */
43884     HomeController.prototype.addNotUndoableModificationListeners = function () {
43885         if (this.home != null) {
43886             var notUndoableModificationListener = new HomeController.HomeController$5(this);
43887             this.home.addPropertyChangeListener("STORED_CAMERAS", notUndoableModificationListener);
43888             this.home.getEnvironment().addPropertyChangeListener("OBSERVER_CAMERA_ELEVATION_ADJUSTED", notUndoableModificationListener);
43889             this.home.getEnvironment().addPropertyChangeListener("VIDEO_WIDTH", notUndoableModificationListener);
43890             this.home.getEnvironment().addPropertyChangeListener("VIDEO_ASPECT_RATIO", notUndoableModificationListener);
43891             this.home.getEnvironment().addPropertyChangeListener("VIDEO_FRAME_RATE", notUndoableModificationListener);
43892             this.home.getEnvironment().addPropertyChangeListener("VIDEO_QUALITY", notUndoableModificationListener);
43893             this.home.getEnvironment().addPropertyChangeListener("VIDEO_CAMERA_PATH", notUndoableModificationListener);
43894             this.home.getEnvironment().addPropertyChangeListener("CEILING_LIGHT_COLOR", notUndoableModificationListener);
43895             this.home.getEnvironment().addPropertyChangeListener("PHOTO_QUALITY", notUndoableModificationListener);
43896             this.home.getEnvironment().addPropertyChangeListener("PHOTO_ASPECT_RATIO", notUndoableModificationListener);
43897             var photoSizeModificationListener = new HomeController.HomeController$6(this, notUndoableModificationListener);
43898             this.home.getEnvironment().addPropertyChangeListener("PHOTO_WIDTH", photoSizeModificationListener);
43899             this.home.getEnvironment().addPropertyChangeListener("PHOTO_HEIGHT", photoSizeModificationListener);
43900             var timeOrLensModificationListener = new HomeController.HomeController$7(this, notUndoableModificationListener);
43901             this.home.getObserverCamera().addPropertyChangeListener(timeOrLensModificationListener);
43902             this.home.getTopCamera().addPropertyChangeListener(timeOrLensModificationListener);
43903         }
43904     };
43905     /**
43906      * Enables or disables action bound to selection.
43907      * This method will be called when selection in plan or in catalog changes and when
43908      * focused component or modification state in plan changes.
43909      */
43910     HomeController.prototype.enableActionsBoundToSelection = function () {
43911         var modificationState = this.getPlanController().isModificationState();
43912         var catalogSelectedItems = this.getFurnitureCatalogController().getSelectedFurniture();
43913         var catalogSelectionContainsFurniture = !(catalogSelectedItems.length == 0);
43914         var catalogSelectionContainsOneModifiablePiece = catalogSelectedItems.length === 1 && /* get */ catalogSelectedItems[0].isModifiable();
43915         var selectedItems = this.home.getSelectedItems();
43916         var homeSelectionContainsDeletableItems = false;
43917         var homeSelectionContainsFurniture = false;
43918         var homeSelectionContainsDeletableFurniture = false;
43919         var homeSelectionContainsOneCopiableItemOrMore = false;
43920         var homeSelectionContainsOneMovablePieceOfFurnitureOrMore = false;
43921         var homeSelectionContainsTwoMovablePiecesOfFurnitureOrMore = false;
43922         var homeSelectionContainsTwoMovableGroupablePiecesOfFurnitureOrMore = false;
43923         var homeSelectionContainsThreeMovablePiecesOfFurnitureOrMore = false;
43924         var homeSelectionContainsOnlyOneGroup = selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof HomeFurnitureGroup);
43925         var homeSelectionContainsFurnitureGroup = false;
43926         var homeSelectionContainsWalls = false;
43927         var homeSelectionContainsOneWall = false;
43928         var homeSelectionContainsOneOrTwoWallsWithOneFreeEnd = false;
43929         var homeSelectionContainsRooms = false;
43930         var homeSelectionContainsOnlyOneRoom = false;
43931         var homeSelectionContainsOnlyOneRoomWithFourPointsOrMore = false;
43932         var homeSelectionContainsPolylines = false;
43933         var homeSelectionContainsDimensionLines = false;
43934         var homeSelectionContainsLabels = false;
43935         var homeSelectionContainsItemsWithText = false;
43936         var homeSelectionContainsCompass = false;
43937         var furnitureController = this.getFurnitureController();
43938         if (!modificationState) {
43939             for (var index = 0; index < selectedItems.length; index++) {
43940                 var item = selectedItems[index];
43941                 {
43942                     if (this.getPlanController().isItemDeletable(item)) {
43943                         homeSelectionContainsDeletableItems = true;
43944                         break;
43945                     }
43946                 }
43947             }
43948             var selectedFurniture = Home.getFurnitureSubList(selectedItems);
43949             homeSelectionContainsFurniture = !(selectedFurniture.length == 0);
43950             for (var index = 0; index < selectedFurniture.length; index++) {
43951                 var piece = selectedFurniture[index];
43952                 {
43953                     if (furnitureController.isPieceOfFurnitureDeletable(piece)) {
43954                         homeSelectionContainsDeletableFurniture = true;
43955                         break;
43956                     }
43957                 }
43958             }
43959             for (var index = 0; index < selectedFurniture.length; index++) {
43960                 var piece = selectedFurniture[index];
43961                 {
43962                     if (piece != null && piece instanceof HomeFurnitureGroup) {
43963                         homeSelectionContainsFurnitureGroup = true;
43964                         break;
43965                     }
43966                 }
43967             }
43968             var movablePiecesOfFurnitureCount = 0;
43969             for (var index = 0; index < selectedFurniture.length; index++) {
43970                 var piece = selectedFurniture[index];
43971                 {
43972                     if (furnitureController.isPieceOfFurnitureMovable(piece)) {
43973                         homeSelectionContainsOneMovablePieceOfFurnitureOrMore = true;
43974                         movablePiecesOfFurnitureCount++;
43975                         if (movablePiecesOfFurnitureCount >= 2) {
43976                             homeSelectionContainsTwoMovablePiecesOfFurnitureOrMore = true;
43977                         }
43978                         if (movablePiecesOfFurnitureCount >= 3) {
43979                             homeSelectionContainsThreeMovablePiecesOfFurnitureOrMore = true;
43980                             break;
43981                         }
43982                     }
43983                 }
43984             }
43985             if (homeSelectionContainsTwoMovablePiecesOfFurnitureOrMore) {
43986                 homeSelectionContainsTwoMovableGroupablePiecesOfFurnitureOrMore = true;
43987                 var furniture = this.home.getFurniture();
43988                 for (var index = 0; index < selectedFurniture.length; index++) {
43989                     var piece = selectedFurniture[index];
43990                     {
43991                         if (!furnitureController.isPieceOfFurnitureMovable(piece) || !(furniture.indexOf((piece)) >= 0)) {
43992                             homeSelectionContainsTwoMovableGroupablePiecesOfFurnitureOrMore = false;
43993                             break;
43994                         }
43995                     }
43996                 }
43997             }
43998             var selectedWalls = Home.getWallsSubList(selectedItems);
43999             homeSelectionContainsWalls = !(selectedWalls.length == 0);
44000             homeSelectionContainsOneWall = /* size */ selectedWalls.length === 1;
44001             if ( /* size */selectedWalls.length >= 2) {
44002                 var wallsWithFreeEnd = [null, null, null];
44003                 for (var index = 0; index < selectedWalls.length; index++) {
44004                     var wall = selectedWalls[index];
44005                     {
44006                         if ((wall.getArcExtent() == null || wall.getArcExtent() === 0.0) && (wall.getWallAtStart() == null || wall.getWallAtEnd() == null)) {
44007                             for (var i = 0; i < wallsWithFreeEnd.length; i++) {
44008                                 {
44009                                     if (wallsWithFreeEnd[i] == null) {
44010                                         wallsWithFreeEnd[i] = wall;
44011                                         break;
44012                                     }
44013                                 }
44014                                 ;
44015                             }
44016                             if (wallsWithFreeEnd[2] != null) {
44017                                 break;
44018                             }
44019                         }
44020                     }
44021                 }
44022                 homeSelectionContainsOneOrTwoWallsWithOneFreeEnd = wallsWithFreeEnd[2] == null && wallsWithFreeEnd[0] != null && (wallsWithFreeEnd[1] == null && !(selectedWalls.indexOf((wallsWithFreeEnd[0].getWallAtStart())) >= 0) && !(selectedWalls.indexOf((wallsWithFreeEnd[0].getWallAtEnd())) >= 0) || wallsWithFreeEnd[0].getWallAtEnd() !== wallsWithFreeEnd[1] && wallsWithFreeEnd[0].getWallAtStart() !== wallsWithFreeEnd[1]);
44023             }
44024             var selectedRooms = Home.getRoomsSubList(selectedItems);
44025             homeSelectionContainsRooms = !(selectedRooms.length == 0);
44026             homeSelectionContainsOnlyOneRoom = /* size */ selectedItems.length === 1 && /* size */ selectedRooms.length === 1;
44027             homeSelectionContainsOnlyOneRoomWithFourPointsOrMore = homeSelectionContainsOnlyOneRoom && /* get */ selectedRooms[0].getPointCount() >= 4;
44028             homeSelectionContainsDimensionLines = !(Home.getDimensionLinesSubList(selectedItems).length == 0);
44029             homeSelectionContainsPolylines = !(Home.getPolylinesSubList(selectedItems).length == 0);
44030             homeSelectionContainsLabels = !(Home.getLabelsSubList(selectedItems).length == 0);
44031             homeSelectionContainsCompass = /* contains */ (selectedItems.indexOf((this.home.getCompass())) >= 0);
44032             homeSelectionContainsOneCopiableItemOrMore = homeSelectionContainsFurniture || homeSelectionContainsWalls || homeSelectionContainsRooms || homeSelectionContainsDimensionLines || homeSelectionContainsPolylines || homeSelectionContainsLabels || homeSelectionContainsCompass;
44033             homeSelectionContainsItemsWithText = homeSelectionContainsFurniture || homeSelectionContainsRooms || homeSelectionContainsDimensionLines || homeSelectionContainsLabels;
44034         }
44035         var view = this.getView();
44036         if (this.focusedView === this.getFurnitureCatalogController().getView()) {
44037             view.setEnabled(HomeView.ActionType.COPY, !modificationState && catalogSelectionContainsFurniture);
44038             view.setEnabled(HomeView.ActionType.CUT, false);
44039             view.setEnabled(HomeView.ActionType.DELETE, false);
44040             for (var index = 0; index < catalogSelectedItems.length; index++) {
44041                 var piece = catalogSelectedItems[index];
44042                 {
44043                     if (piece.isModifiable()) {
44044                         view.setEnabled(HomeView.ActionType.DELETE, true);
44045                         break;
44046                     }
44047                 }
44048             }
44049         }
44050         else if (this.focusedView === furnitureController.getView()) {
44051             view.setEnabled(HomeView.ActionType.COPY, homeSelectionContainsFurniture);
44052             view.setEnabled(HomeView.ActionType.CUT, homeSelectionContainsDeletableFurniture);
44053             view.setEnabled(HomeView.ActionType.DELETE, homeSelectionContainsDeletableFurniture);
44054         }
44055         else if (this.focusedView === this.getPlanController().getView() || this.focusedView === this.getHomeController3D().getView() && this.preferences.isEditingIn3DViewEnabled()) {
44056             view.setEnabled(HomeView.ActionType.COPY, homeSelectionContainsOneCopiableItemOrMore);
44057             view.setEnabled(HomeView.ActionType.CUT, homeSelectionContainsDeletableItems);
44058             view.setEnabled(HomeView.ActionType.DELETE, homeSelectionContainsDeletableItems);
44059         }
44060         else {
44061             view.setEnabled(HomeView.ActionType.COPY, false);
44062             view.setEnabled(HomeView.ActionType.CUT, false);
44063             view.setEnabled(HomeView.ActionType.DELETE, false);
44064         }
44065         this.enablePasteToGroupAction();
44066         this.enablePasteStyleAction();
44067         var selectedLevel = this.home.getSelectedLevel();
44068         var viewableLevel = selectedLevel == null || selectedLevel.isViewable();
44069         view.setEnabled(HomeView.ActionType.ADD_HOME_FURNITURE, catalogSelectionContainsFurniture && viewableLevel);
44070         view.setEnabled(HomeView.ActionType.ADD_FURNITURE_TO_GROUP, catalogSelectionContainsFurniture && viewableLevel && homeSelectionContainsOnlyOneGroup);
44071         view.setEnabled(HomeView.ActionType.DELETE_HOME_FURNITURE, homeSelectionContainsDeletableFurniture);
44072         view.setEnabled(HomeView.ActionType.DELETE_SELECTION, (catalogSelectionContainsFurniture && this.focusedView === this.getFurnitureCatalogController().getView()) || (homeSelectionContainsDeletableItems && (this.focusedView === furnitureController.getView() || this.focusedView === this.getPlanController().getView() || this.focusedView === this.getHomeController3D().getView())));
44073         view.setEnabled(HomeView.ActionType.MODIFY_FURNITURE, (catalogSelectionContainsOneModifiablePiece && this.focusedView === this.getFurnitureCatalogController().getView()) || (homeSelectionContainsFurniture && (this.focusedView === furnitureController.getView() || this.focusedView === this.getPlanController().getView() || this.focusedView === this.getHomeController3D().getView())));
44074         view.setEnabled(HomeView.ActionType.MODIFY_WALL, homeSelectionContainsWalls);
44075         view.setEnabled(HomeView.ActionType.FLIP_HORIZONTALLY, homeSelectionContainsOneCopiableItemOrMore);
44076         view.setEnabled(HomeView.ActionType.FLIP_VERTICALLY, homeSelectionContainsOneCopiableItemOrMore);
44077         view.setEnabled(HomeView.ActionType.JOIN_WALLS, homeSelectionContainsOneOrTwoWallsWithOneFreeEnd);
44078         view.setEnabled(HomeView.ActionType.REVERSE_WALL_DIRECTION, homeSelectionContainsWalls);
44079         view.setEnabled(HomeView.ActionType.SPLIT_WALL, homeSelectionContainsOneWall);
44080         view.setEnabled(HomeView.ActionType.MODIFY_ROOM, homeSelectionContainsRooms);
44081         view.setEnabled(HomeView.ActionType.MODIFY_POLYLINE, homeSelectionContainsPolylines);
44082         view.setEnabled(HomeView.ActionType.MODIFY_DIMENSION_LINE, homeSelectionContainsDimensionLines);
44083         view.setEnabled(HomeView.ActionType.MODIFY_LABEL, homeSelectionContainsLabels);
44084         view.setEnabled(HomeView.ActionType.TOGGLE_BOLD_STYLE, homeSelectionContainsItemsWithText);
44085         view.setEnabled(HomeView.ActionType.TOGGLE_ITALIC_STYLE, homeSelectionContainsItemsWithText);
44086         view.setEnabled(HomeView.ActionType.INCREASE_TEXT_SIZE, homeSelectionContainsItemsWithText);
44087         view.setEnabled(HomeView.ActionType.DECREASE_TEXT_SIZE, homeSelectionContainsItemsWithText);
44088         view.setEnabled(HomeView.ActionType.ALIGN_FURNITURE_ON_TOP, homeSelectionContainsTwoMovablePiecesOfFurnitureOrMore);
44089         view.setEnabled(HomeView.ActionType.ALIGN_FURNITURE_ON_BOTTOM, homeSelectionContainsTwoMovablePiecesOfFurnitureOrMore);
44090         view.setEnabled(HomeView.ActionType.ALIGN_FURNITURE_ON_LEFT, homeSelectionContainsTwoMovablePiecesOfFurnitureOrMore);
44091         view.setEnabled(HomeView.ActionType.ALIGN_FURNITURE_ON_RIGHT, homeSelectionContainsTwoMovablePiecesOfFurnitureOrMore);
44092         view.setEnabled(HomeView.ActionType.ALIGN_FURNITURE_ON_FRONT_SIDE, homeSelectionContainsTwoMovablePiecesOfFurnitureOrMore);
44093         view.setEnabled(HomeView.ActionType.ALIGN_FURNITURE_ON_BACK_SIDE, homeSelectionContainsTwoMovablePiecesOfFurnitureOrMore);
44094         view.setEnabled(HomeView.ActionType.ALIGN_FURNITURE_ON_LEFT_SIDE, homeSelectionContainsTwoMovablePiecesOfFurnitureOrMore);
44095         view.setEnabled(HomeView.ActionType.ALIGN_FURNITURE_ON_RIGHT_SIDE, homeSelectionContainsTwoMovablePiecesOfFurnitureOrMore);
44096         view.setEnabled(HomeView.ActionType.ALIGN_FURNITURE_SIDE_BY_SIDE, homeSelectionContainsTwoMovablePiecesOfFurnitureOrMore);
44097         view.setEnabled(HomeView.ActionType.DISTRIBUTE_FURNITURE_HORIZONTALLY, homeSelectionContainsThreeMovablePiecesOfFurnitureOrMore);
44098         view.setEnabled(HomeView.ActionType.DISTRIBUTE_FURNITURE_VERTICALLY, homeSelectionContainsThreeMovablePiecesOfFurnitureOrMore);
44099         view.setEnabled(HomeView.ActionType.RESET_FURNITURE_ELEVATION, homeSelectionContainsOneMovablePieceOfFurnitureOrMore);
44100         view.setEnabled(HomeView.ActionType.GROUP_FURNITURE, homeSelectionContainsTwoMovableGroupablePiecesOfFurnitureOrMore && viewableLevel);
44101         view.setEnabled(HomeView.ActionType.UNGROUP_FURNITURE, homeSelectionContainsFurnitureGroup);
44102         var selectionMode = this.getPlanController() != null && this.getPlanController().getMode() === PlanController.Mode.SELECTION_$LI$();
44103         view.setEnabled(HomeView.ActionType.ADD_ROOM_POINT, homeSelectionContainsOnlyOneRoom && selectionMode);
44104         view.setEnabled(HomeView.ActionType.DELETE_ROOM_POINT, homeSelectionContainsOnlyOneRoomWithFourPointsOrMore && selectionMode);
44105         view.setEnabled(HomeView.ActionType.RECOMPUTE_ROOM_POINTS, homeSelectionContainsOnlyOneRoomWithFourPointsOrMore && selectionMode);
44106     };
44107     /**
44108      * Enables clipboard paste action if clipboard isn't empty.
44109      */
44110     HomeController.prototype.enablePasteAction = function () {
44111         var view = this.getView();
44112         var pasteEnabled = false;
44113         if (this.focusedView === this.getFurnitureController().getView() || this.focusedView === this.getPlanController().getView() || this.focusedView === this.getHomeController3D().getView() && this.preferences.isEditingIn3DViewEnabled()) {
44114             var selectedLevel = this.home.getSelectedLevel();
44115             pasteEnabled = (selectedLevel == null || selectedLevel.isViewable()) && !this.getPlanController().isModificationState() && !view.isClipboardEmpty();
44116         }
44117         view.setEnabled(HomeView.ActionType.PASTE, pasteEnabled);
44118         this.enablePasteToGroupAction();
44119         this.enablePasteStyleAction();
44120     };
44121     /**
44122      * Enables paste to group action if clipboard contains furniture and
44123      * home selected item is a furniture group.
44124      * @private
44125      */
44126     HomeController.prototype.enablePasteToGroupAction = function () {
44127         var view = this.getView();
44128         var pasteToGroupEnabled = false;
44129         if (this.focusedView === this.getFurnitureController().getView() || this.focusedView === this.getPlanController().getView()) {
44130             var selectedLevel = this.home.getSelectedLevel();
44131             if ((selectedLevel == null || selectedLevel.isViewable()) && !this.getPlanController().isModificationState()) {
44132                 var selectedItems = this.home.getSelectedItems();
44133                 if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof HomeFurnitureGroup)) {
44134                     var clipboardItems = view.getClipboardItems();
44135                     if (clipboardItems != null) {
44136                         pasteToGroupEnabled = true;
44137                         for (var index = 0; index < clipboardItems.length; index++) {
44138                             var item = clipboardItems[index];
44139                             {
44140                                 if (!(item != null && item instanceof HomePieceOfFurniture)) {
44141                                     pasteToGroupEnabled = false;
44142                                     break;
44143                                 }
44144                             }
44145                         }
44146                     }
44147                 }
44148             }
44149         }
44150         view.setEnabled(HomeView.ActionType.PASTE_TO_GROUP, pasteToGroupEnabled);
44151     };
44152     /**
44153      * Enables clipboard paste style action if selection contains some items of a class
44154      * compatible with the clipboard item.
44155      * @private
44156      */
44157     HomeController.prototype.enablePasteStyleAction = function () {
44158         var view = this.getView();
44159         var pasteStyleEnabled = false;
44160         if ((this.focusedView === this.getFurnitureController().getView() || this.focusedView === this.getPlanController().getView() || this.focusedView === this.getHomeController3D().getView() && this.preferences.isEditingIn3DViewEnabled()) && !this.getPlanController().isModificationState()) {
44161             var clipboardItems = view.getClipboardItems();
44162             if (clipboardItems != null && /* size */ clipboardItems.length === 1) {
44163                 var clipboardItem = clipboardItems[0];
44164                 {
44165                     var array = this.home.getSelectedItems();
44166                     for (var index = 0; index < array.length; index++) {
44167                         var item = array[index];
44168                         {
44169                             if ((item != null && item instanceof HomePieceOfFurniture) && (clipboardItem != null && clipboardItem instanceof HomePieceOfFurniture) || (item != null && item instanceof Wall) && (clipboardItem != null && clipboardItem instanceof Wall) || (item != null && item instanceof Room) && (clipboardItem != null && clipboardItem instanceof Room) || (item != null && item instanceof Polyline) && (clipboardItem != null && clipboardItem instanceof Polyline) || (item != null && item instanceof Label) && (clipboardItem != null && clipboardItem instanceof Label)) {
44170                                 pasteStyleEnabled = true;
44171                                 break;
44172                             }
44173                         }
44174                     }
44175                 }
44176             }
44177         }
44178         view.setEnabled(HomeView.ActionType.PASTE_STYLE, pasteStyleEnabled);
44179     };
44180     /**
44181      * Enables select all action if home isn't empty.
44182      */
44183     HomeController.prototype.enableSelectAllAction = function () {
44184         var view = this.getView();
44185         var modificationState = this.getPlanController().isModificationState();
44186         if (this.focusedView === this.getFurnitureController().getView()) {
44187             view.setEnabled(HomeView.ActionType.SELECT_ALL, !modificationState && /* size */ this.home.getFurniture().length > 0);
44188         }
44189         else if (this.focusedView === this.getPlanController().getView() || this.focusedView === this.getHomeController3D().getView()) {
44190             var homeContainsOneSelectableItemOrMore = !this.home.isEmpty() || this.home.getCompass().isVisible();
44191             view.setEnabled(HomeView.ActionType.SELECT_ALL, !modificationState && homeContainsOneSelectableItemOrMore);
44192         }
44193         else {
44194             view.setEnabled(HomeView.ActionType.SELECT_ALL, false);
44195         }
44196     };
44197     /**
44198      * Enables zoom actions depending on current scale.
44199      * @private
44200      */
44201     HomeController.prototype.enableZoomActions = function () {
44202         var planController = this.getPlanController();
44203         var scale = planController.getScale();
44204         var view = this.getView();
44205         view.setEnabled(HomeView.ActionType.ZOOM_IN, scale < planController.getMaximumScale());
44206         view.setEnabled(HomeView.ActionType.ZOOM_OUT, scale > planController.getMinimumScale());
44207     };
44208     /**
44209      * Adds undoable edit listener to undo support that enables Undo action.
44210      * @private
44211      */
44212     HomeController.prototype.addUndoSupportListener = function () {
44213         this.getUndoableEditSupport().addUndoableEditListener(new HomeController.HomeController$8(this));
44214         this.home.addPropertyChangeListener("MODIFIED", new HomeController.HomeController$9(this));
44215     };
44216     /**
44217      * Adds a furniture listener to home that enables / disables actions on furniture list change.
44218      * @private
44219      */
44220     HomeController.prototype.addHomeItemsListener = function () {
44221         var _this = this;
44222         var homeItemsListener = function (ev) {
44223             if (ev.getType() === CollectionEvent.Type.ADD || ev.getType() === CollectionEvent.Type.DELETE) {
44224                 _this.enableSelectAllAction();
44225             }
44226         };
44227         this.home.addFurnitureListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
44228             return funcInst;
44229         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
44230             return funcInst;
44231         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(homeItemsListener)))));
44232         this.home.addWallsListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
44233             return funcInst;
44234         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
44235             return funcInst;
44236         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(homeItemsListener)))));
44237         this.home.addRoomsListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
44238             return funcInst;
44239         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
44240             return funcInst;
44241         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(homeItemsListener)))));
44242         this.home.addPolylinesListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
44243             return funcInst;
44244         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
44245             return funcInst;
44246         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(homeItemsListener)))));
44247         this.home.addDimensionLinesListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
44248             return funcInst;
44249         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
44250             return funcInst;
44251         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(homeItemsListener)))));
44252         this.home.addLabelsListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
44253             return funcInst;
44254         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
44255             return funcInst;
44256         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(homeItemsListener)))));
44257         this.home.getCompass().addPropertyChangeListener(new HomeController.HomeController$10(this));
44258         this.home.addPropertyChangeListener("CAMERA", new HomeController.HomeController$11(this));
44259     };
44260     /**
44261      * Adds a property change listener to home to
44262      * enable/disable authorized actions according to selected level.
44263      * @private
44264      */
44265     HomeController.prototype.addLevelListeners = function () {
44266         var _this = this;
44267         var selectedLevelListener = new HomeController.HomeController$12(this);
44268         this.home.addPropertyChangeListener("SELECTED_LEVEL", selectedLevelListener);
44269         var backgroundImageChangeListener = new HomeController.HomeController$13(this);
44270         {
44271             var array = this.home.getLevels();
44272             for (var index = 0; index < array.length; index++) {
44273                 var level = array[index];
44274                 {
44275                     level.addPropertyChangeListener(backgroundImageChangeListener);
44276                 }
44277             }
44278         }
44279         this.home.addLevelsListener(function (ev) {
44280             switch ((ev.getType())) {
44281                 case CollectionEvent.Type.ADD:
44282                     _this.home.setSelectedLevel(ev.getItem());
44283                     ev.getItem().addPropertyChangeListener(backgroundImageChangeListener);
44284                     break;
44285                 case CollectionEvent.Type.DELETE:
44286                     selectedLevelListener.propertyChange(null);
44287                     ev.getItem().removePropertyChangeListener(backgroundImageChangeListener);
44288                     break;
44289             }
44290         });
44291     };
44292     /**
44293      * Adds a property change listener to home to
44294      * enable/disable authorized actions according to stored cameras change.
44295      * @private
44296      */
44297     HomeController.prototype.addStoredCamerasListener = function () {
44298         this.home.addPropertyChangeListener("STORED_CAMERAS", new HomeController.HomeController$14(this));
44299     };
44300     /**
44301      * Adds a property change listener to plan controller to
44302      * enable/disable authorized actions according to its modification state and the plan scale.
44303      * @private
44304      */
44305     HomeController.prototype.addPlanControllerListeners = function () {
44306         this.getPlanController().addPropertyChangeListener("MODIFICATION_STATE", new HomeController.HomeController$15(this));
44307         this.getPlanController().addPropertyChangeListener("MODE", new HomeController.HomeController$16(this));
44308         this.getPlanController().addPropertyChangeListener("SCALE", new HomeController.HomeController$17(this));
44309     };
44310     /**
44311      * Adds the selected furniture in catalog to home and selects it.
44312      */
44313     HomeController.prototype.addHomeFurniture = function () {
44314         this.addFurniture(null);
44315     };
44316     /**
44317      * Adds the selected furniture in catalog to the selected group and selects it.
44318      */
44319     HomeController.prototype.addFurnitureToGroup = function () {
44320         this.addFurniture(this.home.getSelectedItems()[0]);
44321     };
44322     HomeController.prototype.addFurniture = function (group) {
44323         this.getPlanController().setMode(PlanController.Mode.SELECTION_$LI$());
44324         var selectedFurniture = this.getFurnitureCatalogController().getSelectedFurniture();
44325         if (!(selectedFurniture.length == 0)) {
44326             var addedFurniture = ([]);
44327             for (var index = 0; index < selectedFurniture.length; index++) {
44328                 var piece = selectedFurniture[index];
44329                 {
44330                     /* add */ (addedFurniture.push(this.getFurnitureController().createHomePieceOfFurniture(piece)) > 0);
44331                 }
44332             }
44333             if (group != null) {
44334                 this.getFurnitureController().addFurnitureToGroup(addedFurniture, group);
44335             }
44336             else {
44337                 this.getFurnitureController().addFurniture$java_util_List(addedFurniture);
44338             }
44339             this.adjustFurnitureSizeAndElevation(addedFurniture, false);
44340         }
44341     };
44342     /**
44343      * Modifies the selected furniture of the focused view.
44344      */
44345     HomeController.prototype.modifySelectedFurniture = function () {
44346         if (this.focusedView === this.getFurnitureCatalogController().getView()) {
44347             this.getFurnitureCatalogController().modifySelectedFurniture();
44348         }
44349         else if (this.focusedView === this.getFurnitureController().getView() || this.focusedView === this.getPlanController().getView() || this.focusedView === this.getHomeController3D().getView()) {
44350             this.getFurnitureController().modifySelectedFurniture();
44351         }
44352     };
44353     HomeController.prototype.importLanguageLibrary$ = function () {
44354         var _this = this;
44355         this.getView().invokeLater(function () {
44356             var languageLibraryName = _this.getView().showImportLanguageLibraryDialog();
44357             if (languageLibraryName != null) {
44358                 _this.importLanguageLibrary$java_lang_String(languageLibraryName);
44359             }
44360         });
44361     };
44362     HomeController.prototype.importLanguageLibrary$java_lang_String = function (languageLibraryName) {
44363         try {
44364             if (!this.preferences.languageLibraryExists(languageLibraryName) || this.getView().confirmReplaceLanguageLibrary(languageLibraryName)) {
44365                 this.preferences.addLanguageLibrary(languageLibraryName);
44366             }
44367         }
44368         catch (ex) {
44369             var message = this.preferences.getLocalizedString(HomeController, "importLanguageLibraryError", languageLibraryName);
44370             this.getView().showError(message);
44371         }
44372     };
44373     /**
44374      * Imports a given language library.
44375      * @param {string} languageLibraryName
44376      */
44377     HomeController.prototype.importLanguageLibrary = function (languageLibraryName) {
44378         if (((typeof languageLibraryName === 'string') || languageLibraryName === null)) {
44379             return this.importLanguageLibrary$java_lang_String(languageLibraryName);
44380         }
44381         else if (languageLibraryName === undefined) {
44382             return this.importLanguageLibrary$();
44383         }
44384         else
44385             throw new Error('invalid overload');
44386     };
44387     /**
44388      * Imports furniture to the catalog or home depending on the focused view.
44389      */
44390     HomeController.prototype.importFurniture = function () {
44391         this.getPlanController().setMode(PlanController.Mode.SELECTION_$LI$());
44392         if (this.focusedView === this.getFurnitureCatalogController().getView()) {
44393             this.getFurnitureCatalogController().importFurniture$();
44394         }
44395         else {
44396             this.getFurnitureController().importFurniture$();
44397         }
44398     };
44399     HomeController.prototype.importFurnitureLibrary$ = function () {
44400         var _this = this;
44401         this.getView().invokeLater(function () {
44402             var furnitureLibraryName = _this.getView().showImportFurnitureLibraryDialog();
44403             if (furnitureLibraryName != null) {
44404                 _this.importFurnitureLibrary$java_lang_String(furnitureLibraryName);
44405             }
44406         });
44407     };
44408     HomeController.prototype.importFurnitureLibrary$java_lang_String = function (furnitureLibraryName) {
44409         try {
44410             if (!this.preferences.furnitureLibraryExists(furnitureLibraryName) || this.getView().confirmReplaceFurnitureLibrary(furnitureLibraryName)) {
44411                 this.preferences.addFurnitureLibrary(furnitureLibraryName);
44412                 this.getView().showMessage(this.preferences.getLocalizedString(HomeController, "importedFurnitureLibraryMessage", this.contentManager != null ? this.contentManager.getPresentationName(furnitureLibraryName, ContentManager.ContentType.FURNITURE_LIBRARY) : furnitureLibraryName));
44413             }
44414         }
44415         catch (ex) {
44416             var message = this.preferences.getLocalizedString(HomeController, "importFurnitureLibraryError", furnitureLibraryName);
44417             this.getView().showError(message);
44418         }
44419     };
44420     /**
44421      * Imports a given furniture library.
44422      * @param {string} furnitureLibraryName
44423      */
44424     HomeController.prototype.importFurnitureLibrary = function (furnitureLibraryName) {
44425         if (((typeof furnitureLibraryName === 'string') || furnitureLibraryName === null)) {
44426             return this.importFurnitureLibrary$java_lang_String(furnitureLibraryName);
44427         }
44428         else if (furnitureLibraryName === undefined) {
44429             return this.importFurnitureLibrary$();
44430         }
44431         else
44432             throw new Error('invalid overload');
44433     };
44434     /**
44435      * Imports a texture to the texture catalog.
44436      */
44437     HomeController.prototype.importTexture = function () {
44438         new ImportedTextureWizardController(this.preferences, this.viewFactory, this.contentManager).displayView(this.getView());
44439     };
44440     HomeController.prototype.importTexturesLibrary$ = function () {
44441         var _this = this;
44442         this.getView().invokeLater(function () {
44443             var texturesLibraryName = _this.getView().showImportTexturesLibraryDialog();
44444             if (texturesLibraryName != null) {
44445                 _this.importTexturesLibrary$java_lang_String(texturesLibraryName);
44446             }
44447         });
44448     };
44449     HomeController.prototype.importTexturesLibrary$java_lang_String = function (texturesLibraryName) {
44450         try {
44451             if (!this.preferences.texturesLibraryExists(texturesLibraryName) || this.getView().confirmReplaceTexturesLibrary(texturesLibraryName)) {
44452                 this.preferences.addTexturesLibrary(texturesLibraryName);
44453                 this.getView().showMessage(this.preferences.getLocalizedString(HomeController, "importedTexturesLibraryMessage", this.contentManager != null ? this.contentManager.getPresentationName(texturesLibraryName, ContentManager.ContentType.TEXTURES_LIBRARY) : texturesLibraryName));
44454             }
44455         }
44456         catch (ex) {
44457             var message = this.preferences.getLocalizedString(HomeController, "importTexturesLibraryError", texturesLibraryName);
44458             this.getView().showError(message);
44459         }
44460     };
44461     /**
44462      * Imports a given textures library.
44463      * @param {string} texturesLibraryName
44464      */
44465     HomeController.prototype.importTexturesLibrary = function (texturesLibraryName) {
44466         if (((typeof texturesLibraryName === 'string') || texturesLibraryName === null)) {
44467             return this.importTexturesLibrary$java_lang_String(texturesLibraryName);
44468         }
44469         else if (texturesLibraryName === undefined) {
44470             return this.importTexturesLibrary$();
44471         }
44472         else
44473             throw new Error('invalid overload');
44474     };
44475     /**
44476      * Undoes last operation.
44477      */
44478     HomeController.prototype.undo = function () {
44479         this.undoManager.undo();
44480         var view = this.getView();
44481         var moreUndo = this.undoManager.canUndo();
44482         view.setEnabled(HomeView.ActionType.UNDO, moreUndo);
44483         view.setEnabled(HomeView.ActionType.REDO, true);
44484         if (moreUndo) {
44485             view.setUndoRedoName(this.undoManager.getUndoPresentationName(), this.undoManager.getRedoPresentationName());
44486         }
44487         else {
44488             view.setUndoRedoName(null, this.undoManager.getRedoPresentationName());
44489         }
44490         this.saveUndoLevel--;
44491         this.home.setModified(this.saveUndoLevel !== 0 || this.notUndoableModifications);
44492     };
44493     /**
44494      * Redoes last undone operation.
44495      */
44496     HomeController.prototype.redo = function () {
44497         this.undoManager.redo();
44498         var view = this.getView();
44499         var moreRedo = this.undoManager.canRedo();
44500         view.setEnabled(HomeView.ActionType.UNDO, true);
44501         view.setEnabled(HomeView.ActionType.REDO, moreRedo);
44502         if (moreRedo) {
44503             view.setUndoRedoName(this.undoManager.getUndoPresentationName(), this.undoManager.getRedoPresentationName());
44504         }
44505         else {
44506             view.setUndoRedoName(this.undoManager.getUndoPresentationName(), null);
44507         }
44508         this.saveUndoLevel++;
44509         this.home.setModified(this.saveUndoLevel !== 0 || this.notUndoableModifications);
44510     };
44511     /**
44512      * Deletes items and post a cut operation to undo support.
44513      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items
44514      */
44515     HomeController.prototype.cut = function (items) {
44516         var undoSupport = this.getUndoableEditSupport();
44517         undoSupport.beginUpdate();
44518         this.getPlanController().deleteItems(items);
44519         undoSupport.postEdit(new LocalizedUndoableEdit(this.preferences, HomeController, "undoCutName"));
44520         undoSupport.endUpdate();
44521     };
44522     /**
44523      * Adds items to home and posts a paste operation to undo support.
44524      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items
44525      */
44526     HomeController.prototype.paste = function (items) {
44527         var selectedItems = this.home.getSelectedItems();
44528         var pastedItemsDelta = 0;
44529         if ( /* size */items.length === /* size */ selectedItems.length) {
44530             pastedItemsDelta = 20;
44531             for (var index = 0; index < items.length; index++) {
44532                 var pastedItem = items[index];
44533                 {
44534                     var pastedItemPoints = pastedItem.getPoints();
44535                     var pastedItemOverlapSelectedItem = false;
44536                     for (var index1 = 0; index1 < selectedItems.length; index1++) {
44537                         var selectedItem = selectedItems[index1];
44538                         {
44539                             if ( /* deepEquals */(JSON.stringify(pastedItemPoints) === JSON.stringify(selectedItem.getPoints()))) {
44540                                 pastedItemOverlapSelectedItem = true;
44541                                 break;
44542                             }
44543                         }
44544                     }
44545                     if (!pastedItemOverlapSelectedItem) {
44546                         pastedItemsDelta = 0;
44547                         break;
44548                     }
44549                 }
44550             }
44551         }
44552         this.addPastedItems(items, null, pastedItemsDelta, pastedItemsDelta, null, "undoPasteName");
44553     };
44554     HomeController.prototype.drop$java_util_List$float$float = function (items, dx, dy) {
44555         this.drop$java_util_List$com_eteks_sweethome3d_viewcontroller_View$float$float(items, null, dx, dy);
44556     };
44557     HomeController.prototype.drop$java_util_List$com_eteks_sweethome3d_viewcontroller_View$float$float = function (items, destinationView, dx, dy) {
44558         this.addPastedItems(items, destinationView, dx, dy, null, "undoDropName");
44559     };
44560     HomeController.prototype.drop$java_util_List$com_eteks_sweethome3d_viewcontroller_View$com_eteks_sweethome3d_model_Level$float$float$java_lang_Float = function (items, destinationView, level, dx, dy, dz) {
44561         var oldSelectedLevel = this.home.getSelectedLevel();
44562         if (level !== oldSelectedLevel || dz != null && /* size */ items.length === 1 && ( /* get */items[0] != null && /* get */ items[0] instanceof HomePieceOfFurniture) && this.application.getUserPreferences().isMagnetismEnabled()) {
44563             var undoSupport = this.getUndoableEditSupport();
44564             undoSupport.beginUpdate();
44565             var piece = items[0];
44566             piece.setElevation(Math.max(0, dz));
44567             if (level !== oldSelectedLevel) {
44568                 var selection = this.home.getSelectedItems();
44569                 var selectedItems = selection.slice(0);
44570                 var allLevelsSelection = this.home.isAllLevelsSelection();
44571                 this.home.setSelectedLevel(level);
44572                 undoSupport.postEdit(new HomeController.LevelModificationUndoableEdit(this.home, this.preferences, oldSelectedLevel, level, selectedItems, allLevelsSelection));
44573             }
44574             this.drop$java_util_List$com_eteks_sweethome3d_viewcontroller_View$float$float(items, destinationView, dx, dy);
44575             undoSupport.postEdit(new LocalizedUndoableEdit(this.preferences, HomeController, "undoDropName"));
44576             undoSupport.endUpdate();
44577         }
44578         else {
44579             this.drop$java_util_List$com_eteks_sweethome3d_viewcontroller_View$float$float(items, destinationView, dx, dy);
44580         }
44581     };
44582     /**
44583      * Adds items to home, moves them of (dx, dy, dz) delta vector
44584      * and posts a drop operation to undo support.
44585      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items
44586      * @param {Object} destinationView
44587      * @param {Level} level
44588      * @param {number} dx
44589      * @param {number} dy
44590      * @param {number} dz
44591      */
44592     HomeController.prototype.drop = function (items, destinationView, level, dx, dy, dz) {
44593         if (((items != null && (items instanceof Array)) || items === null) && ((destinationView != null && (destinationView.constructor != null && destinationView.constructor["__interfaces"] != null && destinationView.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.View") >= 0)) || destinationView === null) && ((level != null && level instanceof Level) || level === null) && ((typeof dx === 'number') || dx === null) && ((typeof dy === 'number') || dy === null) && ((typeof dz === 'number') || dz === null)) {
44594             return this.drop$java_util_List$com_eteks_sweethome3d_viewcontroller_View$com_eteks_sweethome3d_model_Level$float$float$java_lang_Float(items, destinationView, level, dx, dy, dz);
44595         }
44596         else if (((items != null && (items instanceof Array)) || items === null) && ((destinationView != null && (destinationView.constructor != null && destinationView.constructor["__interfaces"] != null && destinationView.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.View") >= 0)) || destinationView === null) && ((typeof level === 'number') || level === null) && ((typeof dx === 'number') || dx === null) && dy === undefined && dz === undefined) {
44597             return this.drop$java_util_List$com_eteks_sweethome3d_viewcontroller_View$float$float(items, destinationView, level, dx);
44598         }
44599         else if (((items != null && (items instanceof Array)) || items === null) && ((destinationView != null && (destinationView.constructor != null && destinationView.constructor["__interfaces"] != null && destinationView.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.View") >= 0)) || destinationView === null) && ((level != null && (level.constructor != null && level.constructor["__interfaces"] != null && level.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Selectable") >= 0)) || level === null) && dx === undefined && dy === undefined && dz === undefined) {
44600             return this.drop$java_util_List$com_eteks_sweethome3d_viewcontroller_View$com_eteks_sweethome3d_model_Selectable(items, destinationView, level);
44601         }
44602         else if (((items != null && (items instanceof Array)) || items === null) && ((typeof destinationView === 'number') || destinationView === null) && ((typeof level === 'number') || level === null) && dx === undefined && dy === undefined && dz === undefined) {
44603             return this.drop$java_util_List$float$float(items, destinationView, level);
44604         }
44605         else
44606             throw new Error('invalid overload');
44607     };
44608     HomeController.prototype.drop$java_util_List$com_eteks_sweethome3d_viewcontroller_View$com_eteks_sweethome3d_model_Selectable = function (items, destinationView, beforeItem) {
44609         this.addPastedItems(items, destinationView, 0, 0, beforeItem, "undoDropName");
44610     };
44611     /**
44612      * Adds items to home.
44613      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items
44614      * @param {Object} destinationView
44615      * @param {number} dx
44616      * @param {number} dy
44617      * @param {Object} beforeItem
44618      * @param {string} presentationNameKey
44619      * @private
44620      */
44621     HomeController.prototype.addPastedItems = function (items, destinationView, dx, dy, beforeItem, presentationNameKey) {
44622         if ( /* size */items.length > 1 || ( /* size */items.length === 1 && !( /* get */items[0] != null && /* get */ items[0] instanceof Compass))) {
44623             var compassList = Home.getSubList(items, Compass);
44624             if ( /* size */compassList.length !== 0) {
44625                 items = (items.slice(0));
44626                 /* removeAll */ (function (a, r) { var b = false; for (var i = 0; i < r.length; i++) {
44627                     var ndx = a.indexOf(r[i]);
44628                     if (ndx >= 0) {
44629                         a.splice(ndx, 1);
44630                         b = true;
44631                     }
44632                 } return b; })(items, compassList);
44633             }
44634             this.getPlanController().setMode(PlanController.Mode.SELECTION_$LI$());
44635             var undoSupport = this.getUndoableEditSupport();
44636             undoSupport.beginUpdate();
44637             if (destinationView != null && destinationView === this.getFurnitureController().getView()) {
44638                 this.getFurnitureController().addFurniture$java_util_List$com_eteks_sweethome3d_model_HomePieceOfFurniture(Home.getFurnitureSubList(items), beforeItem);
44639             }
44640             else {
44641                 this.getPlanController().addItems(items);
44642             }
44643             var addedFurniture = Home.getFurnitureSubList(items);
44644             this.adjustFurnitureSizeAndElevation(addedFurniture, dx === 0 && dy === 0 && destinationView == null);
44645             this.getPlanController().moveItems(items, dx, dy);
44646             if (destinationView === this.getPlanController().getView() || destinationView === this.getHomeController3D().getView()) {
44647                 if (this.preferences.isMagnetismEnabled() && /* size */ items.length === 1 && /* size */ addedFurniture.length === 1) {
44648                     this.getPlanController().adjustMagnetizedPieceOfFurniture(items[0], dx, dy);
44649                 }
44650             }
44651             undoSupport.postEdit(new LocalizedUndoableEdit(this.preferences, HomeController, presentationNameKey));
44652             undoSupport.endUpdate();
44653         }
44654     };
44655     /**
44656      * Adjusts furniture size and elevation if magnetism is enabled.
44657      * This method should be called after the given furniture is added to the plan,
44658      * to ensure its size in plan is adjusted too.
44659      * @param {HomePieceOfFurniture[]} furniture
44660      * @param {boolean} keepDoorAndWindowDepth
44661      * @private
44662      */
44663     HomeController.prototype.adjustFurnitureSizeAndElevation = function (furniture, keepDoorAndWindowDepth) {
44664         if (this.preferences.isMagnetismEnabled()) {
44665             for (var index = 0; index < furniture.length; index++) {
44666                 var piece = furniture[index];
44667                 {
44668                     if (!(piece != null && piece instanceof HomeFurnitureGroup) && piece.isResizable()) {
44669                         piece.setWidth(this.preferences.getLengthUnit().getMagnetizedLength(piece.getWidth(), 0.1));
44670                         if (!(piece != null && piece instanceof HomeDoorOrWindow) || !keepDoorAndWindowDepth) {
44671                             piece.setDepth(this.preferences.getLengthUnit().getMagnetizedLength(piece.getDepth(), 0.1));
44672                         }
44673                         piece.setHeight(this.preferences.getLengthUnit().getMagnetizedLength(piece.getHeight(), 0.1));
44674                     }
44675                     piece.setElevation(this.preferences.getLengthUnit().getMagnetizedLength(piece.getElevation(), 0.1));
44676                 }
44677             }
44678         }
44679     };
44680     /**
44681      * Adds imported models to home, moves them of (dx, dy)
44682      * and post a drop operation to undo support.
44683      * @param {string[]} importableModels
44684      * @param {number} dx
44685      * @param {number} dy
44686      */
44687     HomeController.prototype.dropFiles = function (importableModels, dx, dy) {
44688         this.getPlanController().setMode(PlanController.Mode.SELECTION_$LI$());
44689         var importedFurniture = ([]);
44690         var addedFurnitureListener = function (ev) {
44691             /* add */ (importedFurniture.push(ev.getItem()) > 0);
44692         };
44693         this.home.addFurnitureListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
44694             return funcInst;
44695         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(addedFurnitureListener)));
44696         var undoSupport = this.getUndoableEditSupport();
44697         undoSupport.beginUpdate();
44698         for (var index = 0; index < importableModels.length; index++) {
44699             var model = importableModels[index];
44700             {
44701                 this.getFurnitureController().importFurniture$java_lang_String(model);
44702             }
44703         }
44704         this.home.removeFurnitureListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
44705             return funcInst;
44706         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(addedFurnitureListener)));
44707         if ( /* size */importedFurniture.length > 0) {
44708             this.getPlanController().moveItems(importedFurniture, dx, dy);
44709             this.home.setSelectedItems(importedFurniture);
44710             undoSupport.postEdit(new HomeController.DroppingEndUndoableEdit(this.home, this.preferences, /* toArray */ importedFurniture.slice(0)));
44711         }
44712         undoSupport.endUpdate();
44713     };
44714     /**
44715      * Paste the furniture in clipboard to the selected group in home.
44716      */
44717     HomeController.prototype.pasteToGroup = function () {
44718         var undoSupport = this.getUndoableEditSupport();
44719         undoSupport.beginUpdate();
44720         var addedFurniture = Home.getFurnitureSubList(this.getView().getClipboardItems());
44721         this.getFurnitureController().addFurnitureToGroup(addedFurniture, this.home.getSelectedItems()[0]);
44722         this.adjustFurnitureSizeAndElevation(addedFurniture, true);
44723         undoSupport.postEdit(new LocalizedUndoableEdit(this.preferences, HomeController, "undoPasteToGroupName"));
44724         undoSupport.endUpdate();
44725     };
44726     /**
44727      * Paste the style of the item in clipboard on selected items compatible with it.
44728      */
44729     HomeController.prototype.pasteStyle = function () {
44730         var undoSupport = this.getUndoableEditSupport();
44731         undoSupport.beginUpdate();
44732         var clipboardItem = this.getView().getClipboardItems()[0];
44733         var selectedItems = this.home.getSelectedItems();
44734         if (clipboardItem != null && clipboardItem instanceof HomePieceOfFurniture) {
44735             var clipboardPiece = clipboardItem;
44736             var furnitureController = new HomeFurnitureController(this.home, this.preferences, this.viewFactory, this.contentManager, undoSupport);
44737             var materials = clipboardPiece.getModelMaterials();
44738             if (materials != null) {
44739                 furnitureController.getModelMaterialsController().setMaterials(clipboardPiece.getModelMaterials());
44740                 furnitureController.setPaint(HomeFurnitureController.FurniturePaint.MODEL_MATERIALS);
44741             }
44742             else if (clipboardPiece.getTexture() != null) {
44743                 furnitureController.getTextureController().setTexture(clipboardPiece.getTexture());
44744                 furnitureController.setPaint(HomeFurnitureController.FurniturePaint.TEXTURED);
44745             }
44746             else if (clipboardPiece.getColor() != null) {
44747                 furnitureController.setColor(clipboardPiece.getColor());
44748                 furnitureController.setPaint(HomeFurnitureController.FurniturePaint.COLORED);
44749             }
44750             else {
44751                 furnitureController.setPaint(HomeFurnitureController.FurniturePaint.DEFAULT);
44752             }
44753             var shininess = clipboardPiece.getShininess();
44754             furnitureController.setShininess(shininess == null ? HomeFurnitureController.FurnitureShininess.DEFAULT : ( /* floatValue */shininess === 0 ? HomeFurnitureController.FurnitureShininess.MATT : HomeFurnitureController.FurnitureShininess.SHINY));
44755             furnitureController.modifyFurniture();
44756         }
44757         else if (clipboardItem != null && clipboardItem instanceof Wall) {
44758             var clipboardWall = clipboardItem;
44759             var wallController = new WallController(this.home, this.preferences, this.viewFactory, this.contentManager, undoSupport);
44760             if (clipboardWall.getLeftSideColor() != null) {
44761                 wallController.setLeftSideColor(clipboardWall.getLeftSideColor());
44762                 wallController.setLeftSidePaint(WallController.WallPaint.COLORED);
44763             }
44764             else if (clipboardWall.getLeftSideTexture() != null) {
44765                 wallController.getLeftSideTextureController().setTexture(clipboardWall.getLeftSideTexture());
44766                 wallController.setLeftSidePaint(WallController.WallPaint.TEXTURED);
44767             }
44768             else {
44769                 wallController.setLeftSidePaint(WallController.WallPaint.DEFAULT);
44770             }
44771             wallController.setLeftSideShininess(clipboardWall.getLeftSideShininess());
44772             wallController.getLeftSideBaseboardController().setBaseboard(clipboardWall.getLeftSideBaseboard());
44773             if (clipboardWall.getRightSideColor() != null) {
44774                 wallController.setRightSideColor(clipboardWall.getRightSideColor());
44775                 wallController.setRightSidePaint(WallController.WallPaint.COLORED);
44776             }
44777             else if (clipboardWall.getRightSideTexture() != null) {
44778                 wallController.getRightSideTextureController().setTexture(clipboardWall.getRightSideTexture());
44779                 wallController.setRightSidePaint(WallController.WallPaint.TEXTURED);
44780             }
44781             else {
44782                 wallController.setRightSidePaint(WallController.WallPaint.DEFAULT);
44783             }
44784             wallController.setRightSideShininess(clipboardWall.getRightSideShininess());
44785             wallController.getRightSideBaseboardController().setBaseboard(clipboardWall.getRightSideBaseboard());
44786             wallController.setPattern(clipboardWall.getPattern());
44787             wallController.setTopColor(clipboardWall.getTopColor());
44788             wallController.setTopPaint(clipboardWall.getTopColor() != null ? WallController.WallPaint.COLORED : WallController.WallPaint.DEFAULT);
44789             wallController.modifyWalls();
44790         }
44791         else if (clipboardItem != null && clipboardItem instanceof Room) {
44792             var clipboardRoom = clipboardItem;
44793             var roomController = new RoomController(this.home, this.preferences, this.viewFactory, this.contentManager, undoSupport);
44794             if (clipboardRoom.getFloorColor() != null) {
44795                 roomController.setFloorColor(clipboardRoom.getFloorColor());
44796                 roomController.setFloorPaint(RoomController.RoomPaint.COLORED);
44797             }
44798             else if (clipboardRoom.getFloorTexture() != null) {
44799                 roomController.getFloorTextureController().setTexture(clipboardRoom.getFloorTexture());
44800                 roomController.setFloorPaint(RoomController.RoomPaint.TEXTURED);
44801             }
44802             else {
44803                 roomController.setFloorPaint(RoomController.RoomPaint.DEFAULT);
44804             }
44805             roomController.setFloorShininess(clipboardRoom.getFloorShininess());
44806             if (clipboardRoom.getCeilingColor() != null) {
44807                 roomController.setCeilingColor(clipboardRoom.getCeilingColor());
44808                 roomController.setCeilingPaint(RoomController.RoomPaint.COLORED);
44809             }
44810             else if (clipboardRoom.getCeilingTexture() != null) {
44811                 roomController.getCeilingTextureController().setTexture(clipboardRoom.getCeilingTexture());
44812                 roomController.setCeilingPaint(RoomController.RoomPaint.TEXTURED);
44813             }
44814             else {
44815                 roomController.setCeilingPaint(RoomController.RoomPaint.DEFAULT);
44816             }
44817             roomController.setCeilingShininess(clipboardRoom.getCeilingShininess());
44818             roomController.modifyRooms();
44819         }
44820         else if (clipboardItem != null && clipboardItem instanceof Polyline) {
44821             var clipboardPolyline = clipboardItem;
44822             var polylineController = new PolylineController(this.home, this.preferences, this.viewFactory, this.contentManager, undoSupport);
44823             polylineController.setThickness(clipboardPolyline.getThickness());
44824             polylineController.setJoinStyle(clipboardPolyline.getJoinStyle());
44825             polylineController.setCapStyle(clipboardPolyline.getCapStyle());
44826             polylineController.setStartArrowStyle(clipboardPolyline.getStartArrowStyle());
44827             polylineController.setEndArrowStyle(clipboardPolyline.getEndArrowStyle());
44828             polylineController.setDashStyle(clipboardPolyline.getDashStyle());
44829             polylineController.setDashPattern(clipboardPolyline.getDashPattern());
44830             polylineController.setDashOffset(clipboardPolyline.getDashOffset());
44831             polylineController.setColor(clipboardPolyline.getColor());
44832             polylineController.modifyPolylines();
44833         }
44834         else if (clipboardItem != null && clipboardItem instanceof Label) {
44835             var clipboardLabel = clipboardItem;
44836             var labelController = new LabelController(this.home, this.preferences, this.viewFactory, undoSupport);
44837             labelController.setColor(clipboardLabel.getColor());
44838             var labelStyle = clipboardLabel.getStyle();
44839             if (labelStyle != null) {
44840                 labelController.setAlignment(labelStyle.getAlignment());
44841                 labelController.setFontName(labelStyle.getFontName());
44842                 labelController.setFontSize(labelStyle.getFontSize());
44843             }
44844             else {
44845                 labelController.setAlignment(null);
44846                 labelController.setFontName(null);
44847                 labelController.setFontSize(this.preferences.getDefaultTextStyle(Label).getFontSize());
44848             }
44849             labelController.modifyLabels();
44850         }
44851         undoSupport.postEdit(new HomeController.PastingStyleEndUndoableEdit(this.home, this.preferences, /* toArray */ selectedItems.slice(0)));
44852         undoSupport.endUpdate();
44853     };
44854     /**
44855      * Returns the transfer data matching the requested types.
44856      * @param {Object} observer
44857      * @param {com.eteks.sweethome3d.viewcontroller.TransferableView.DataType[]} dataTypes
44858      */
44859     HomeController.prototype.createTransferData = function (observer) {
44860         var dataTypes = [];
44861         for (var _i = 1; _i < arguments.length; _i++) {
44862             dataTypes[_i - 1] = arguments[_i];
44863         }
44864         var data = ([]);
44865         for (var i = 0; i < dataTypes.length; i++) {
44866             {
44867                 if (this.childControllers == null) {
44868                     this.childControllers = ([]);
44869                     /* add */ (this.childControllers.push(this.getFurnitureCatalogController()) > 0);
44870                     /* add */ (this.childControllers.push(this.getFurnitureController()) > 0);
44871                     /* add */ (this.childControllers.push(this.getPlanController()) > 0);
44872                     /* add */ (this.childControllers.push(this.getHomeController3D()) > 0);
44873                 }
44874                 for (var index = 0; index < this.childControllers.length; index++) {
44875                     var childController = this.childControllers[index];
44876                     {
44877                         if (childController.getView() != null && (childController.getView().constructor != null && childController.getView().constructor["__interfaces"] != null && childController.getView().constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.TransferableView") >= 0)) {
44878                             /* add */ (data.push(childController.getView().createTransferData(dataTypes[i])) > 0);
44879                         }
44880                     }
44881                 }
44882             }
44883             ;
44884         }
44885         observer.dataReady(/* toArray */ data.slice(0));
44886     };
44887     /**
44888      * Deletes the selection in the focused component.
44889      */
44890     HomeController.prototype["delete"] = function () {
44891         if (this.focusedView === this.getFurnitureCatalogController().getView()) {
44892             if (this.getView().confirmDeleteCatalogSelection()) {
44893                 this.getFurnitureCatalogController().deleteSelection();
44894             }
44895         }
44896         else if (this.focusedView === this.getFurnitureController().getView()) {
44897             this.getFurnitureController().deleteSelection();
44898         }
44899         else if (this.focusedView === this.getPlanController().getView() || this.focusedView === this.getHomeController3D().getView() && this.preferences.isEditingIn3DViewEnabled()) {
44900             this.getPlanController().deleteSelection();
44901         }
44902     };
44903     /**
44904      * Updates actions when focused view changed.
44905      * @param {Object} focusedView
44906      */
44907     HomeController.prototype.focusedViewChanged = function (focusedView) {
44908         this.focusedView = focusedView;
44909         this.enableActionsBoundToSelection();
44910         this.enablePasteAction();
44911         this.enablePasteToGroupAction();
44912         this.enablePasteStyleAction();
44913         this.enableSelectAllAction();
44914     };
44915     /**
44916      * Selects everything in the focused component.
44917      */
44918     HomeController.prototype.selectAll = function () {
44919         if (this.focusedView === this.getFurnitureController().getView()) {
44920             this.getFurnitureController().selectAll();
44921         }
44922         else if (this.focusedView === this.getPlanController().getView() || this.focusedView === this.getHomeController3D().getView()) {
44923             this.getPlanController().selectAll();
44924         }
44925     };
44926     /**
44927      * Creates a new home and adds it to application home list.
44928      */
44929     HomeController.prototype.newHome = function () {
44930         var home;
44931         if (this.application != null) {
44932             home = this.application.createHome();
44933         }
44934         else {
44935             home = new Home(this.preferences.getNewWallHeight());
44936         }
44937         this.application.addHome(home);
44938     };
44939     HomeController.prototype.newHomeFromExample = function () {
44940     };
44941     /**
44942      * Returns a map with entries containing furniture name associated to their id.
44943      * @param {FurnitureCatalog} catalog
44944      * @return {Object}
44945      * @private
44946      */
44947     HomeController.prototype.getCatalogFurnitureNames = function (catalog) {
44948         var furnitureNames = ({});
44949         {
44950             var array = catalog.getCategories();
44951             for (var index = 0; index < array.length; index++) {
44952                 var category = array[index];
44953                 {
44954                     {
44955                         var array1 = category.getFurniture();
44956                         for (var index1 = 0; index1 < array1.length; index1++) {
44957                             var piece = array1[index1];
44958                             {
44959                                 if (piece.getId() != null) {
44960                                     /* put */ (furnitureNames[piece.getId()] = piece.getName());
44961                                 }
44962                             }
44963                         }
44964                     }
44965                 }
44966             }
44967         }
44968         return furnitureNames;
44969     };
44970     /**
44971      * Renames the given <code>piece</code> from the piece name with the same id in <code>furnitureNames</code>.
44972      * @param {HomePieceOfFurniture} piece
44973      * @param {Object} furnitureNames
44974      * @param {string} groupName
44975      * @private
44976      */
44977     HomeController.prototype.renameToCatalogName = function (piece, furnitureNames, groupName) {
44978         if (piece != null && piece instanceof HomeFurnitureGroup) {
44979             piece.setName(groupName);
44980             {
44981                 var array = piece.getFurniture();
44982                 for (var index = 0; index < array.length; index++) {
44983                     var groupPiece = array[index];
44984                     {
44985                         this.renameToCatalogName(groupPiece, furnitureNames, groupName);
44986                     }
44987                 }
44988             }
44989         }
44990         else {
44991             var id = piece.getCatalogId();
44992             if (id != null) {
44993                 piece.setName(/* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(furnitureNames, id));
44994             }
44995         }
44996     };
44997     HomeController.prototype.open = function () {
44998     };
44999     /**
45000      * Adds the given home to application.
45001      * @param {Home} home
45002      * @private
45003      */
45004     HomeController.prototype.addHomeToApplication = function (home) {
45005         var _this = this;
45006         this.getView().invokeLater(function () {
45007             _this.application.addHome(home);
45008         });
45009     };
45010     /**
45011      * Updates user preferences <code>recentHomes</code> and write preferences.
45012      * @param {string[]} recentHomes
45013      * @private
45014      */
45015     HomeController.prototype.updateUserPreferencesRecentHomes = function (recentHomes) {
45016         if (this.application != null) {
45017             for (var i = recentHomes.length - 1; i >= 0; i--) {
45018                 {
45019                     try {
45020                         if (!null /*erased method exists(java.lang.String)*/) {
45021                             /* remove */ recentHomes.splice(i, 1)[0];
45022                         }
45023                     }
45024                     catch (ex) {
45025                     }
45026                 }
45027                 ;
45028             }
45029             this.preferences.setRecentHomes(recentHomes);
45030         }
45031     };
45032     /**
45033      * Returns a list of displayable recent homes.
45034      * @return {string[]}
45035      */
45036     HomeController.prototype.getRecentHomes = function () {
45037         if (this.application != null) {
45038             var recentHomes = ([]);
45039             {
45040                 var array = this.preferences.getRecentHomes();
45041                 for (var index = 0; index < array.length; index++) {
45042                     var homeName = array[index];
45043                     {
45044                         try {
45045                             if (null /*erased method exists(java.lang.String)*/) {
45046                                 /* add */ (recentHomes.push(homeName) > 0);
45047                                 if ( /* size */recentHomes.length === this.preferences.getRecentHomesMaxCount()) {
45048                                     break;
45049                                 }
45050                             }
45051                         }
45052                         catch (ex) {
45053                         }
45054                     }
45055                 }
45056             }
45057             this.getView().setEnabled(HomeView.ActionType.DELETE_RECENT_HOMES, !(recentHomes.length == 0));
45058             return /* unmodifiableList */ recentHomes.slice(0);
45059         }
45060         else {
45061             return ([]);
45062         }
45063     };
45064     /**
45065      * Returns the version of the application for display purpose.
45066      * @return {string}
45067      */
45068     HomeController.prototype.getVersion = function () {
45069         if (this.application != null) {
45070             var applicationVersion = this.application.getVersion();
45071             try {
45072                 var deploymentInformation = 'JS';
45073                 if (deploymentInformation != null) {
45074                     applicationVersion += " " + deploymentInformation;
45075                 }
45076             }
45077             catch (ex) {
45078             }
45079             return applicationVersion;
45080         }
45081         else {
45082             return "";
45083         }
45084     };
45085     /**
45086      * Deletes the list of recent homes in user preferences.
45087      */
45088     HomeController.prototype.deleteRecentHomes = function () {
45089         this.updateUserPreferencesRecentHomes(([]));
45090         this.getView().setEnabled(HomeView.ActionType.DELETE_RECENT_HOMES, false);
45091     };
45092     HomeController.prototype.close = function () {
45093     };
45094     HomeController.prototype.save = function () {
45095     };
45096     HomeController.prototype.saveAs = function () {
45097     };
45098     HomeController.prototype.saveAndCompress = function () {
45099     };
45100     HomeController.prototype.saveAsAndCompress = function () {
45101     };
45102     /**
45103      * Updates the saved home and executes <code>postSaveTask</code>
45104      * if it's not <code>null</code>.
45105      * @param {string} homeName
45106      * @param {number} savedVersion
45107      * @param {() => void} postSaveTask
45108      * @private
45109      */
45110     HomeController.prototype.updateSavedHome = function (homeName, savedVersion, postSaveTask) {
45111         var _this = this;
45112         this.getView().invokeLater(function () {
45113             _this.home.setName(homeName);
45114             _this.home.setModified(false);
45115             _this.home.setRecovered(false);
45116             _this.home.setRepaired(false);
45117             _this.home.setVersion(savedVersion);
45118             var recentHomes = (_this.preferences.getRecentHomes().slice(0));
45119             var homeNameIndex = recentHomes.indexOf(homeName);
45120             if (homeNameIndex >= 0) {
45121                 /* remove */ recentHomes.splice(homeNameIndex, 1)[0];
45122             }
45123             /* add */ recentHomes.splice(0, 0, homeName);
45124             _this.updateUserPreferencesRecentHomes(recentHomes);
45125             if (postSaveTask != null) {
45126                 (function (target) { return (typeof target === 'function') ? target() : target.run(); })(postSaveTask);
45127             }
45128         });
45129     };
45130     HomeController.prototype.exportToCSV = function () {
45131     };
45132     HomeController.prototype.exportToSVG = function () {
45133     };
45134     HomeController.prototype.exportToOBJ = function () {
45135     };
45136     HomeController.prototype.createPhotos = function () {
45137     };
45138     HomeController.prototype.createPhoto = function () {
45139     };
45140     HomeController.prototype.createVideo = function () {
45141     };
45142     HomeController.prototype.setupPage = function () {
45143     };
45144     HomeController.prototype.previewPrint = function () {
45145     };
45146     HomeController.prototype.print = function () {
45147     };
45148     HomeController.prototype.printToPDF = function () {
45149     };
45150     /**
45151      * Controls application exit. If any home in application homes list is modified,
45152      * the user will be {@link HomeView#confirmExit() prompted} in view whether he wants
45153      * to discard his modifications or not.
45154      */
45155     HomeController.prototype.exit = function () {
45156         {
45157             var array = this.application.getHomes();
45158             for (var index = 0; index < array.length; index++) {
45159                 var home = array[index];
45160                 {
45161                     if (home.isModified() || home.isRecovered() || home.isRepaired()) {
45162                         if (this.getView().confirmExit()) {
45163                             break;
45164                         }
45165                         else {
45166                             return;
45167                         }
45168                     }
45169                 }
45170             }
45171         }
45172         {
45173             var array = this.application.getHomes();
45174             for (var index = 0; index < array.length; index++) {
45175                 var home = array[index];
45176                 {
45177                     home.setRecovered(false);
45178                     this.application.deleteHome(home);
45179                 }
45180             }
45181         }
45182     };
45183     /**
45184      * Edits preferences and changes them if user agrees.
45185      */
45186     HomeController.prototype.editPreferences = function () {
45187         new UserPreferencesController(this.preferences, this.viewFactory, this.contentManager, this).displayView(this.getView());
45188     };
45189     /**
45190      * Enables magnetism in preferences.
45191      */
45192     HomeController.prototype.enableMagnetism = function () {
45193         this.preferences.setMagnetismEnabled(true);
45194     };
45195     /**
45196      * Disables magnetism in preferences.
45197      */
45198     HomeController.prototype.disableMagnetism = function () {
45199         this.preferences.setMagnetismEnabled(false);
45200     };
45201     /**
45202      * Displays a tip message dialog depending on the given mode and
45203      * sets the active mode of the plan controller.
45204      * @param {PlanController.Mode} mode
45205      */
45206     HomeController.prototype.setMode = function (mode) {
45207         var _this = this;
45208         if (this.getPlanController().getMode() !== mode) {
45209             var actionKey_1;
45210             if (mode === PlanController.Mode.WALL_CREATION_$LI$()) {
45211                 actionKey_1 = /* Enum.name */ HomeView.ActionType[HomeView.ActionType.CREATE_WALLS];
45212             }
45213             else if (mode === PlanController.Mode.ROOM_CREATION_$LI$()) {
45214                 actionKey_1 = /* Enum.name */ HomeView.ActionType[HomeView.ActionType.CREATE_ROOMS];
45215             }
45216             else if (mode === PlanController.Mode.POLYLINE_CREATION_$LI$()) {
45217                 actionKey_1 = /* Enum.name */ HomeView.ActionType[HomeView.ActionType.CREATE_POLYLINES];
45218             }
45219             else if (mode === PlanController.Mode.DIMENSION_LINE_CREATION_$LI$()) {
45220                 actionKey_1 = /* Enum.name */ HomeView.ActionType[HomeView.ActionType.CREATE_DIMENSION_LINES];
45221             }
45222             else if (mode === PlanController.Mode.LABEL_CREATION_$LI$()) {
45223                 actionKey_1 = /* Enum.name */ HomeView.ActionType[HomeView.ActionType.CREATE_LABELS];
45224             }
45225             else {
45226                 actionKey_1 = null;
45227             }
45228             if (actionKey_1 != null && !this.preferences.isActionTipIgnored(actionKey_1)) {
45229                 this.getView().invokeLater(function () {
45230                     if (_this.getView().showActionTipMessage(actionKey_1)) {
45231                         _this.preferences.setActionTipIgnored(actionKey_1);
45232                     }
45233                 });
45234             }
45235             this.getPlanController().setMode(mode);
45236         }
45237     };
45238     /**
45239      * Displays the wizard that helps to import home background image.
45240      */
45241     HomeController.prototype.importBackgroundImage = function () {
45242         new BackgroundImageWizardController(this.home, this.preferences, this.viewFactory, this.contentManager, this.getUndoableEditSupport()).displayView(this.getView());
45243     };
45244     /**
45245      * Displays the wizard that helps to change home background image.
45246      */
45247     HomeController.prototype.modifyBackgroundImage = function () {
45248         this.importBackgroundImage();
45249     };
45250     /**
45251      * Hides the home background image.
45252      */
45253     HomeController.prototype.hideBackgroundImage = function () {
45254         this.toggleBackgroundImageVisibility("undoHideBackgroundImageName");
45255     };
45256     /**
45257      * Shows the home background image.
45258      */
45259     HomeController.prototype.showBackgroundImage = function () {
45260         this.toggleBackgroundImageVisibility("undoShowBackgroundImageName");
45261     };
45262     /**
45263      * Toggles visibility of the background image and posts an undoable operation.
45264      * @param {string} presentationName
45265      * @private
45266      */
45267     HomeController.prototype.toggleBackgroundImageVisibility = function (presentationName) {
45268         var selectedLevel = this.home.getSelectedLevel();
45269         HomeController.doToggleBackgroundImageVisibility(this.home);
45270         this.getUndoableEditSupport().postEdit(new HomeController.BackgroundImageVisibilityTogglingUndoableEdit(this.home, this.preferences, presentationName, selectedLevel));
45271     };
45272     /**
45273      * Toggles visibility of the background image.
45274      * @param {Home} home
45275      * @private
45276      */
45277     HomeController.doToggleBackgroundImageVisibility = function (home) {
45278         var backgroundImage = home.getSelectedLevel() != null ? home.getSelectedLevel().getBackgroundImage() : home.getBackgroundImage();
45279         backgroundImage = new BackgroundImage(backgroundImage.getImage(), backgroundImage.getScaleDistance(), backgroundImage.getScaleDistanceXStart(), backgroundImage.getScaleDistanceYStart(), backgroundImage.getScaleDistanceXEnd(), backgroundImage.getScaleDistanceYEnd(), backgroundImage.getXOrigin(), backgroundImage.getYOrigin(), !backgroundImage.isVisible());
45280         if (home.getSelectedLevel() != null) {
45281             home.getSelectedLevel().setBackgroundImage(backgroundImage);
45282         }
45283         else {
45284             home.setBackgroundImage(backgroundImage);
45285         }
45286     };
45287     /**
45288      * Deletes home background image and posts and posts an undoable operation.
45289      */
45290     HomeController.prototype.deleteBackgroundImage = function () {
45291         var selectedLevel = this.home.getSelectedLevel();
45292         var oldImage;
45293         if (selectedLevel != null) {
45294             oldImage = selectedLevel.getBackgroundImage();
45295             selectedLevel.setBackgroundImage(null);
45296         }
45297         else {
45298             oldImage = this.home.getBackgroundImage();
45299             this.home.setBackgroundImage(null);
45300         }
45301         this.getUndoableEditSupport().postEdit(new HomeController.BackgroundImageDeletionUndoableEdit(this.home, this.preferences, selectedLevel, oldImage));
45302     };
45303     /**
45304      * Zooms out in plan.
45305      */
45306     HomeController.prototype.zoomOut = function () {
45307         var planController = this.getPlanController();
45308         var newScale = planController.getScale() / 1.5;
45309         planController.setScale(newScale);
45310         planController.getView().makeSelectionVisible();
45311     };
45312     /**
45313      * Zooms in in plan.
45314      */
45315     HomeController.prototype.zoomIn = function () {
45316         var planController = this.getPlanController();
45317         var newScale = planController.getScale() * 1.5;
45318         planController.setScale(newScale);
45319         planController.getView().makeSelectionVisible();
45320     };
45321     /**
45322      * Prompts a name for the current camera and stores it in home.
45323      */
45324     HomeController.prototype.storeCamera = function () {
45325         var now = new Date().toLocaleDateString(this.preferences.getLanguage().replace('_', '-'));
45326         var name = this.getView().showStoreCameraDialog(now);
45327         if (name != null) {
45328             this.getHomeController3D().storeCamera(name);
45329         }
45330     };
45331     /**
45332      * Prompts stored cameras in home to be deleted and deletes the ones selected by the user.
45333      */
45334     HomeController.prototype.deleteCameras = function () {
45335         var deletedCameras = this.getView().showDeletedCamerasDialog();
45336         if (deletedCameras != null) {
45337             this.getHomeController3D().deleteCameras(deletedCameras);
45338         }
45339     };
45340     /**
45341      * Detaches the given <code>view</code> from home view.
45342      * @param {Object} view
45343      */
45344     HomeController.prototype.detachView = function (view) {
45345         if (view != null) {
45346             this.getView().detachView(view);
45347             this.notUndoableModifications = true;
45348             this.home.setModified(true);
45349         }
45350     };
45351     /**
45352      * Attaches the given <code>view</code> to home view.
45353      * @param {Object} view
45354      */
45355     HomeController.prototype.attachView = function (view) {
45356         if (view != null) {
45357             this.getView().attachView(view);
45358             this.notUndoableModifications = true;
45359             this.home.setModified(true);
45360         }
45361     };
45362     HomeController.prototype.help = function () {
45363     };
45364     /**
45365      * Displays about dialog.
45366      */
45367     HomeController.prototype.about = function () {
45368         this.getView().showAboutDialog();
45369     };
45370     /**
45371      * Controls the change of value of a visual property in home.
45372      * @deprecated {@link #setVisualProperty(String, Object) setVisualProperty} should be replaced by a call to
45373      * {@link #setHomeProperty(String, String)} to ensure the property can be easily saved and read.
45374      * @param {string} propertyName
45375      * @param {Object} propertyValue
45376      */
45377     HomeController.prototype.setVisualProperty = function (propertyName, propertyValue) {
45378         this.home.setVisualProperty(propertyName, propertyValue);
45379     };
45380     /**
45381      * Controls the change of value of a property in home.
45382      * @param {string} propertyName
45383      * @param {string} propertyValue
45384      */
45385     HomeController.prototype.setHomeProperty = function (propertyName, propertyValue) {
45386         this.home.setProperty(propertyName, propertyValue);
45387     };
45388     HomeController.helpController = null;
45389     return HomeController;
45390 }());
45391 HomeController["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeController";
45392 HomeController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
45393 (function (HomeController) {
45394     /**
45395      * Super class of catalog listeners that writes preferences each time a piece of furniture or a texture
45396      * is deleted or added in furniture or textures catalog.
45397      * @class
45398      */
45399     var UserPreferencesChangeListener = /** @class */ (function () {
45400         function UserPreferencesChangeListener() {
45401         }
45402         UserPreferencesChangeListener.writingPreferences_$LI$ = function () { if (UserPreferencesChangeListener.writingPreferences == null) {
45403             UserPreferencesChangeListener.writingPreferences = ([]);
45404         } return UserPreferencesChangeListener.writingPreferences; };
45405         UserPreferencesChangeListener.prototype.writePreferences = function (controller) {
45406             if (!(UserPreferencesChangeListener.writingPreferences_$LI$().indexOf((controller.preferences)) >= 0)) {
45407                 /* add */ (function (s, e) { if (s.indexOf(e) == -1) {
45408                     s.push(e);
45409                     return true;
45410                 }
45411                 else {
45412                     return false;
45413                 } })(UserPreferencesChangeListener.writingPreferences_$LI$(), controller.preferences);
45414                 controller.getView().invokeLater(function () {
45415                     try {
45416                         controller.preferences.write();
45417                         /* remove */ (function (a) { var index = a.indexOf(controller.preferences); if (index >= 0) {
45418                             a.splice(index, 1);
45419                             return true;
45420                         }
45421                         else {
45422                             return false;
45423                         } })(UserPreferencesChangeListener.writingPreferences_$LI$());
45424                     }
45425                     catch (ex) {
45426                         controller.getView().showError(controller.preferences.getLocalizedString(HomeController, "savePreferencesError"));
45427                     }
45428                 });
45429             }
45430         };
45431         return UserPreferencesChangeListener;
45432     }());
45433     HomeController.UserPreferencesChangeListener = UserPreferencesChangeListener;
45434     UserPreferencesChangeListener["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeController.UserPreferencesChangeListener";
45435     /**
45436      * Preferences property listener bound to this component with a weak reference to avoid
45437      * strong link between preferences and this component.
45438      * @param {HomeController} homeController
45439      * @class
45440      */
45441     var LanguageChangeListener = /** @class */ (function () {
45442         function LanguageChangeListener(homeController) {
45443             if (this.homeController === undefined) {
45444                 this.homeController = null;
45445             }
45446             this.homeController = (homeController);
45447         }
45448         LanguageChangeListener.prototype.propertyChange = function (ev) {
45449             var homeController = this.homeController;
45450             if (homeController == null) {
45451                 (ev.getSource()).removePropertyChangeListener("LANGUAGE", this);
45452             }
45453             else {
45454                 homeController.getView().setUndoRedoName(homeController.undoManager.canUndo() ? homeController.undoManager.getUndoPresentationName() : null, homeController.undoManager.canRedo() ? homeController.undoManager.getRedoPresentationName() : null);
45455             }
45456         };
45457         return LanguageChangeListener;
45458     }());
45459     HomeController.LanguageChangeListener = LanguageChangeListener;
45460     LanguageChangeListener["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeController.LanguageChangeListener";
45461     /**
45462      * Undoable edit for level modification.
45463      * @extends LocalizedUndoableEdit
45464      * @class
45465      */
45466     var LevelModificationUndoableEdit = /** @class */ (function (_super) {
45467         __extends(LevelModificationUndoableEdit, _super);
45468         function LevelModificationUndoableEdit(home, preferences, oldSelectedLevel, selectedLevel, selectedItems, allLevelsSelection) {
45469             var _this = _super.call(this, preferences, HomeController, "undoDropName") || this;
45470             if (_this.home === undefined) {
45471                 _this.home = null;
45472             }
45473             if (_this.oldSelectedLevel === undefined) {
45474                 _this.oldSelectedLevel = null;
45475             }
45476             if (_this.selectedLevel === undefined) {
45477                 _this.selectedLevel = null;
45478             }
45479             if (_this.selectedItems === undefined) {
45480                 _this.selectedItems = null;
45481             }
45482             if (_this.allLevelsSelection === undefined) {
45483                 _this.allLevelsSelection = false;
45484             }
45485             _this.home = home;
45486             _this.oldSelectedLevel = oldSelectedLevel;
45487             _this.selectedLevel = selectedLevel;
45488             _this.selectedItems = selectedItems;
45489             _this.allLevelsSelection = allLevelsSelection;
45490             return _this;
45491         }
45492         /**
45493          *
45494          */
45495         LevelModificationUndoableEdit.prototype.undo = function () {
45496             _super.prototype.undo.call(this);
45497             if (this.allLevelsSelection) {
45498                 this.home.setAllLevelsSelection(this.allLevelsSelection);
45499             }
45500             else {
45501                 this.home.setSelectedLevel(this.oldSelectedLevel);
45502             }
45503             this.home.setSelectedItems(/* asList */ this.selectedItems.slice(0));
45504         };
45505         /**
45506          *
45507          */
45508         LevelModificationUndoableEdit.prototype.redo = function () {
45509             _super.prototype.redo.call(this);
45510             this.home.setSelectedLevel(this.selectedLevel);
45511         };
45512         return LevelModificationUndoableEdit;
45513     }(LocalizedUndoableEdit));
45514     HomeController.LevelModificationUndoableEdit = LevelModificationUndoableEdit;
45515     LevelModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeController.LevelModificationUndoableEdit";
45516     LevelModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
45517     /**
45518      * Undoable edit for dropping end.
45519      * @param {Home} home
45520      * @param {UserPreferences} preferences
45521      * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} importedFurniture
45522      * @class
45523      * @extends LocalizedUndoableEdit
45524      */
45525     var DroppingEndUndoableEdit = /** @class */ (function (_super) {
45526         __extends(DroppingEndUndoableEdit, _super);
45527         function DroppingEndUndoableEdit(home, preferences, importedFurniture) {
45528             var _this = _super.call(this, preferences, HomeController, "undoDropName") || this;
45529             if (_this.home === undefined) {
45530                 _this.home = null;
45531             }
45532             if (_this.importedFurniture === undefined) {
45533                 _this.importedFurniture = null;
45534             }
45535             _this.home = home;
45536             _this.importedFurniture = importedFurniture;
45537             return _this;
45538         }
45539         /**
45540          *
45541          */
45542         DroppingEndUndoableEdit.prototype.redo = function () {
45543             _super.prototype.redo.call(this);
45544             this.home.setSelectedItems(/* asList */ this.importedFurniture.slice(0));
45545         };
45546         return DroppingEndUndoableEdit;
45547     }(LocalizedUndoableEdit));
45548     HomeController.DroppingEndUndoableEdit = DroppingEndUndoableEdit;
45549     DroppingEndUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeController.DroppingEndUndoableEdit";
45550     DroppingEndUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
45551     /**
45552      * Undoable edit for pasting style end.
45553      * @param {Home} home
45554      * @param {UserPreferences} preferences
45555      * @param {com.eteks.sweethome3d.model.Selectable[]} selectedItems
45556      * @class
45557      * @extends LocalizedUndoableEdit
45558      */
45559     var PastingStyleEndUndoableEdit = /** @class */ (function (_super) {
45560         __extends(PastingStyleEndUndoableEdit, _super);
45561         function PastingStyleEndUndoableEdit(home, preferences, selectedItems) {
45562             var _this = _super.call(this, preferences, HomeController, "undoPasteStyleName") || this;
45563             if (_this.home === undefined) {
45564                 _this.home = null;
45565             }
45566             if (_this.selectedItems === undefined) {
45567                 _this.selectedItems = null;
45568             }
45569             _this.home = home;
45570             _this.selectedItems = selectedItems;
45571             return _this;
45572         }
45573         /**
45574          *
45575          */
45576         PastingStyleEndUndoableEdit.prototype.redo = function () {
45577             _super.prototype.redo.call(this);
45578             this.home.setSelectedItems(/* asList */ this.selectedItems.slice(0));
45579         };
45580         return PastingStyleEndUndoableEdit;
45581     }(LocalizedUndoableEdit));
45582     HomeController.PastingStyleEndUndoableEdit = PastingStyleEndUndoableEdit;
45583     PastingStyleEndUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeController.PastingStyleEndUndoableEdit";
45584     PastingStyleEndUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
45585     /**
45586      * Undoable edit for toggling background image visibility.
45587      * @extends LocalizedUndoableEdit
45588      * @class
45589      */
45590     var BackgroundImageVisibilityTogglingUndoableEdit = /** @class */ (function (_super) {
45591         __extends(BackgroundImageVisibilityTogglingUndoableEdit, _super);
45592         function BackgroundImageVisibilityTogglingUndoableEdit(home, preferences, presentationName, selectedLevel) {
45593             var _this = _super.call(this, preferences, HomeController, presentationName) || this;
45594             if (_this.home === undefined) {
45595                 _this.home = null;
45596             }
45597             if (_this.selectedLevel === undefined) {
45598                 _this.selectedLevel = null;
45599             }
45600             _this.home = home;
45601             _this.selectedLevel = selectedLevel;
45602             return _this;
45603         }
45604         /**
45605          *
45606          */
45607         BackgroundImageVisibilityTogglingUndoableEdit.prototype.undo = function () {
45608             _super.prototype.undo.call(this);
45609             this.home.setSelectedLevel(this.selectedLevel);
45610             HomeController.doToggleBackgroundImageVisibility(this.home);
45611         };
45612         /**
45613          *
45614          */
45615         BackgroundImageVisibilityTogglingUndoableEdit.prototype.redo = function () {
45616             _super.prototype.redo.call(this);
45617             this.home.setSelectedLevel(this.selectedLevel);
45618             HomeController.doToggleBackgroundImageVisibility(this.home);
45619         };
45620         return BackgroundImageVisibilityTogglingUndoableEdit;
45621     }(LocalizedUndoableEdit));
45622     HomeController.BackgroundImageVisibilityTogglingUndoableEdit = BackgroundImageVisibilityTogglingUndoableEdit;
45623     BackgroundImageVisibilityTogglingUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeController.BackgroundImageVisibilityTogglingUndoableEdit";
45624     BackgroundImageVisibilityTogglingUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
45625     /**
45626      * Undoable edit for background image deletion.
45627      * @extends LocalizedUndoableEdit
45628      * @class
45629      */
45630     var BackgroundImageDeletionUndoableEdit = /** @class */ (function (_super) {
45631         __extends(BackgroundImageDeletionUndoableEdit, _super);
45632         function BackgroundImageDeletionUndoableEdit(home, preferences, selectedLevel, oldImage) {
45633             var _this = _super.call(this, preferences, HomeController, "undoDeleteBackgroundImageName") || this;
45634             if (_this.home === undefined) {
45635                 _this.home = null;
45636             }
45637             if (_this.selectedLevel === undefined) {
45638                 _this.selectedLevel = null;
45639             }
45640             if (_this.oldImage === undefined) {
45641                 _this.oldImage = null;
45642             }
45643             _this.home = home;
45644             _this.oldImage = oldImage;
45645             _this.selectedLevel = selectedLevel;
45646             return _this;
45647         }
45648         /**
45649          *
45650          */
45651         BackgroundImageDeletionUndoableEdit.prototype.undo = function () {
45652             _super.prototype.undo.call(this);
45653             this.home.setSelectedLevel(this.selectedLevel);
45654             if (this.selectedLevel != null) {
45655                 this.selectedLevel.setBackgroundImage(this.oldImage);
45656             }
45657             else {
45658                 this.home.setBackgroundImage(this.oldImage);
45659             }
45660         };
45661         /**
45662          *
45663          */
45664         BackgroundImageDeletionUndoableEdit.prototype.redo = function () {
45665             _super.prototype.redo.call(this);
45666             this.home.setSelectedLevel(this.selectedLevel);
45667             if (this.selectedLevel != null) {
45668                 this.selectedLevel.setBackgroundImage(null);
45669             }
45670             else {
45671                 this.home.setBackgroundImage(null);
45672             }
45673         };
45674         return BackgroundImageDeletionUndoableEdit;
45675     }(LocalizedUndoableEdit));
45676     HomeController.BackgroundImageDeletionUndoableEdit = BackgroundImageDeletionUndoableEdit;
45677     BackgroundImageDeletionUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeController.BackgroundImageDeletionUndoableEdit";
45678     BackgroundImageDeletionUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
45679     /**
45680      * Furniture catalog listener that writes preferences each time a piece of furniture
45681      * is deleted or added in furniture catalog. This listener is bound to this controller
45682      * with a weak reference to avoid strong link between catalog and this controller.
45683      * @param {HomeController} homeController
45684      * @class
45685      * @extends HomeController.UserPreferencesChangeListener
45686      */
45687     var FurnitureCatalogChangeListener = /** @class */ (function (_super) {
45688         __extends(FurnitureCatalogChangeListener, _super);
45689         function FurnitureCatalogChangeListener(homeController) {
45690             var _this = _super.call(this) || this;
45691             if (_this.homeController === undefined) {
45692                 _this.homeController = null;
45693             }
45694             _this.homeController = (homeController);
45695             return _this;
45696         }
45697         FurnitureCatalogChangeListener.prototype.collectionChanged = function (ev) {
45698             var controller = this.homeController;
45699             if (controller == null) {
45700                 ev.getSource().removeFurnitureListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
45701                     return funcInst;
45702                 } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this)));
45703             }
45704             else {
45705                 this.writePreferences(controller);
45706             }
45707         };
45708         return FurnitureCatalogChangeListener;
45709     }(HomeController.UserPreferencesChangeListener));
45710     HomeController.FurnitureCatalogChangeListener = FurnitureCatalogChangeListener;
45711     FurnitureCatalogChangeListener["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeController.FurnitureCatalogChangeListener";
45712     FurnitureCatalogChangeListener["__interfaces"] = ["com.eteks.sweethome3d.model.CollectionListener"];
45713     /**
45714      * Textures catalog listener that writes preferences each time a texture
45715      * is deleted or added in textures catalog. This listener is bound to this controller
45716      * with a weak reference to avoid strong link between catalog and this controller.
45717      * @param {HomeController} homeController
45718      * @class
45719      * @extends HomeController.UserPreferencesChangeListener
45720      */
45721     var TexturesCatalogChangeListener = /** @class */ (function (_super) {
45722         __extends(TexturesCatalogChangeListener, _super);
45723         function TexturesCatalogChangeListener(homeController) {
45724             var _this = _super.call(this) || this;
45725             if (_this.homeController === undefined) {
45726                 _this.homeController = null;
45727             }
45728             _this.homeController = (homeController);
45729             return _this;
45730         }
45731         TexturesCatalogChangeListener.prototype.collectionChanged = function (ev) {
45732             var controller = this.homeController;
45733             if (controller == null) {
45734                 ev.getSource().removeTexturesListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
45735                     return funcInst;
45736                 } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(this)));
45737             }
45738             else {
45739                 this.writePreferences(controller);
45740             }
45741         };
45742         return TexturesCatalogChangeListener;
45743     }(HomeController.UserPreferencesChangeListener));
45744     HomeController.TexturesCatalogChangeListener = TexturesCatalogChangeListener;
45745     TexturesCatalogChangeListener["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeController.TexturesCatalogChangeListener";
45746     TexturesCatalogChangeListener["__interfaces"] = ["com.eteks.sweethome3d.model.CollectionListener"];
45747     /**
45748      * Properties listener that writes preferences each time the value of one of its properties changes.
45749      * This listener is bound to this controller with a weak reference to avoid strong link
45750      * between catalog and this controller.
45751      * @param {HomeController} homeController
45752      * @class
45753      * @extends HomeController.UserPreferencesChangeListener
45754      */
45755     var UserPreferencesPropertiesChangeListener = /** @class */ (function (_super) {
45756         __extends(UserPreferencesPropertiesChangeListener, _super);
45757         function UserPreferencesPropertiesChangeListener(homeController) {
45758             var _this = _super.call(this) || this;
45759             if (_this.homeController === undefined) {
45760                 _this.homeController = null;
45761             }
45762             _this.homeController = (homeController);
45763             return _this;
45764         }
45765         UserPreferencesPropertiesChangeListener.prototype.propertyChange = function (ev) {
45766             var controller = this.homeController;
45767             if (controller == null) {
45768                 (ev.getSource()).removePropertyChangeListener(/* valueOf */ ev.getPropertyName(), this);
45769             }
45770             else {
45771                 this.writePreferences(controller);
45772             }
45773         };
45774         return UserPreferencesPropertiesChangeListener;
45775     }(HomeController.UserPreferencesChangeListener));
45776     HomeController.UserPreferencesPropertiesChangeListener = UserPreferencesPropertiesChangeListener;
45777     UserPreferencesPropertiesChangeListener["__class"] = "com.eteks.sweethome3d.viewcontroller.HomeController.UserPreferencesPropertiesChangeListener";
45778     var HomeController$0 = /** @class */ (function (_super) {
45779         __extends(HomeController$0, _super);
45780         function HomeController$0(__parent) {
45781             var _this = _super.call(this) || this;
45782             _this.__parent = __parent;
45783             return _this;
45784         }
45785         /**
45786          *
45787          * @param {Object} edit
45788          */
45789         HomeController$0.prototype._postEdit = function (edit) {
45790             if (!(edit != null && edit instanceof javax.swing.undo.CompoundEdit) || edit.isSignificant()) {
45791                 _super.prototype._postEdit.call(this, edit);
45792             }
45793         };
45794         return HomeController$0;
45795     }(javax.swing.undo.UndoableEditSupport));
45796     HomeController.HomeController$0 = HomeController$0;
45797     var HomeController$1 = /** @class */ (function () {
45798         function HomeController$1(__parent) {
45799             this.__parent = __parent;
45800         }
45801         HomeController$1.prototype.selectionChanged = function (ev) {
45802             this.__parent.enableActionsBoundToSelection();
45803         };
45804         return HomeController$1;
45805     }());
45806     HomeController.HomeController$1 = HomeController$1;
45807     HomeController$1["__interfaces"] = ["com.eteks.sweethome3d.model.SelectionListener"];
45808     var HomeController$2 = /** @class */ (function () {
45809         function HomeController$2(__parent) {
45810             this.__parent = __parent;
45811         }
45812         HomeController$2.prototype.selectionChanged = function (ev) {
45813             this.__parent.enableActionsBoundToSelection();
45814         };
45815         return HomeController$2;
45816     }());
45817     HomeController.HomeController$2 = HomeController$2;
45818     HomeController$2["__interfaces"] = ["com.eteks.sweethome3d.model.SelectionListener"];
45819     var HomeController$3 = /** @class */ (function () {
45820         function HomeController$3(__parent) {
45821             this.__parent = __parent;
45822         }
45823         HomeController$3.prototype.propertyChange = function (ev) {
45824             this.__parent.getView().setEnabled(HomeView.ActionType.SORT_HOME_FURNITURE_BY_DESCENDING_ORDER, ev.getNewValue() != null);
45825         };
45826         return HomeController$3;
45827     }());
45828     HomeController.HomeController$3 = HomeController$3;
45829     var HomeController$4 = /** @class */ (function () {
45830         function HomeController$4(__parent) {
45831             this.__parent = __parent;
45832         }
45833         HomeController$4.prototype.propertyChange = function (ev) {
45834             this.__parent.enableBackgroungImageActions(this.__parent.getView(), ev.getNewValue());
45835         };
45836         return HomeController$4;
45837     }());
45838     HomeController.HomeController$4 = HomeController$4;
45839     var HomeController$5 = /** @class */ (function () {
45840         function HomeController$5(__parent) {
45841             this.__parent = __parent;
45842         }
45843         HomeController$5.prototype.propertyChange = function (ev) {
45844             this.__parent.notUndoableModifications = true;
45845             this.__parent.home.setModified(true);
45846         };
45847         return HomeController$5;
45848     }());
45849     HomeController.HomeController$5 = HomeController$5;
45850     var HomeController$6 = /** @class */ (function () {
45851         function HomeController$6(__parent, notUndoableModificationListener) {
45852             this.notUndoableModificationListener = notUndoableModificationListener;
45853             this.__parent = __parent;
45854         }
45855         HomeController$6.prototype.propertyChange = function (ev) {
45856             if (this.__parent.home.getEnvironment().getPhotoAspectRatio() !== AspectRatio.VIEW_3D_RATIO) {
45857                 this.notUndoableModificationListener.propertyChange(ev);
45858             }
45859         };
45860         return HomeController$6;
45861     }());
45862     HomeController.HomeController$6 = HomeController$6;
45863     var HomeController$7 = /** @class */ (function () {
45864         function HomeController$7(__parent, notUndoableModificationListener) {
45865             this.notUndoableModificationListener = notUndoableModificationListener;
45866             this.__parent = __parent;
45867         }
45868         HomeController$7.prototype.propertyChange = function (ev) {
45869             if ((ev.getPropertyName() === /* name */ "TIME") || (ev.getPropertyName() === /* name */ "LENS")) {
45870                 this.notUndoableModificationListener.propertyChange(ev);
45871             }
45872         };
45873         return HomeController$7;
45874     }());
45875     HomeController.HomeController$7 = HomeController$7;
45876     var HomeController$8 = /** @class */ (function () {
45877         function HomeController$8(__parent) {
45878             this.__parent = __parent;
45879         }
45880         HomeController$8.prototype.undoableEditHappened = function (ev) {
45881             var view = this.__parent.getView();
45882             view.setEnabled(HomeView.ActionType.UNDO, !this.__parent.getPlanController().isModificationState());
45883             view.setEnabled(HomeView.ActionType.REDO, false);
45884             view.setUndoRedoName(ev.getEdit().getUndoPresentationName(), null);
45885             this.__parent.saveUndoLevel++;
45886             this.__parent.home.setModified(true);
45887         };
45888         return HomeController$8;
45889     }());
45890     HomeController.HomeController$8 = HomeController$8;
45891     HomeController$8["__interfaces"] = ["javax.swing.event.UndoableEditListener"];
45892     var HomeController$9 = /** @class */ (function () {
45893         function HomeController$9(__parent) {
45894             this.__parent = __parent;
45895         }
45896         HomeController$9.prototype.propertyChange = function (ev) {
45897             if (!this.__parent.home.isModified()) {
45898                 this.__parent.saveUndoLevel = 0;
45899                 this.__parent.notUndoableModifications = false;
45900             }
45901         };
45902         return HomeController$9;
45903     }());
45904     HomeController.HomeController$9 = HomeController$9;
45905     var HomeController$10 = /** @class */ (function () {
45906         function HomeController$10(__parent) {
45907             this.__parent = __parent;
45908         }
45909         HomeController$10.prototype.propertyChange = function (ev) {
45910             if ( /* name */"VISIBLE" === ev.getPropertyName()) {
45911                 this.__parent.enableSelectAllAction();
45912             }
45913         };
45914         return HomeController$10;
45915     }());
45916     HomeController.HomeController$10 = HomeController$10;
45917     var HomeController$11 = /** @class */ (function () {
45918         function HomeController$11(__parent) {
45919             this.__parent = __parent;
45920         }
45921         HomeController$11.prototype.propertyChange = function (ev) {
45922             this.__parent.getView().setEnabled(HomeView.ActionType.MODIFY_OBSERVER, this.__parent.home.getCamera() === this.__parent.home.getObserverCamera());
45923         };
45924         return HomeController$11;
45925     }());
45926     HomeController.HomeController$11 = HomeController$11;
45927     var HomeController$12 = /** @class */ (function () {
45928         function HomeController$12(__parent) {
45929             this.__parent = __parent;
45930         }
45931         HomeController$12.prototype.propertyChange = function (ev) {
45932             var selectedLevel = this.__parent.home.getSelectedLevel();
45933             if (!this.__parent.home.isAllLevelsSelection()) {
45934                 var selectedItemsAtLevel = ([]);
45935                 {
45936                     var array = this.__parent.home.getSelectedItems();
45937                     for (var index = 0; index < array.length; index++) {
45938                         var item = array[index];
45939                         {
45940                             if (!(item != null && (item.constructor != null && item.constructor["__interfaces"] != null && item.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Elevatable") >= 0)) || item.isAtLevel(selectedLevel)) {
45941                                 /* add */ (selectedItemsAtLevel.push(item) > 0);
45942                             }
45943                         }
45944                     }
45945                 }
45946                 this.__parent.home.setSelectedItems(selectedItemsAtLevel);
45947             }
45948             var view = this.__parent.getView();
45949             this.__parent.enableCreationToolsActions(view);
45950             this.__parent.enableBackgroungImageActions(view, selectedLevel == null ? this.__parent.home.getBackgroundImage() : selectedLevel.getBackgroundImage());
45951             this.__parent.enableLevelActions(view);
45952         };
45953         return HomeController$12;
45954     }());
45955     HomeController.HomeController$12 = HomeController$12;
45956     var HomeController$13 = /** @class */ (function () {
45957         function HomeController$13(__parent) {
45958             this.__parent = __parent;
45959         }
45960         HomeController$13.prototype.propertyChange = function (ev) {
45961             if ( /* name */"BACKGROUND_IMAGE" === ev.getPropertyName()) {
45962                 this.__parent.enableBackgroungImageActions(this.__parent.getView(), ev.getNewValue());
45963             }
45964             else if ( /* name */"VIEWABLE" === ev.getPropertyName()) {
45965                 this.__parent.enableCreationToolsActions(this.__parent.getView());
45966                 this.__parent.enableActionsBoundToSelection();
45967                 if (!ev.getNewValue()) {
45968                     var mode = this.__parent.getPlanController().getMode();
45969                     if (mode !== PlanController.Mode.SELECTION_$LI$() && mode !== PlanController.Mode.PANNING_$LI$()) {
45970                         this.__parent.getPlanController().setMode(PlanController.Mode.SELECTION_$LI$());
45971                     }
45972                 }
45973             }
45974         };
45975         return HomeController$13;
45976     }());
45977     HomeController.HomeController$13 = HomeController$13;
45978     var HomeController$14 = /** @class */ (function () {
45979         function HomeController$14(__parent) {
45980             this.__parent = __parent;
45981         }
45982         HomeController$14.prototype.propertyChange = function (ev) {
45983             var emptyStoredCameras = (this.__parent.home.getStoredCameras().length == 0);
45984             this.__parent.getView().setEnabled(HomeView.ActionType.DELETE_POINTS_OF_VIEW, !emptyStoredCameras);
45985             this.__parent.getView().setEnabled(HomeView.ActionType.CREATE_PHOTOS_AT_POINTS_OF_VIEW, !emptyStoredCameras);
45986         };
45987         return HomeController$14;
45988     }());
45989     HomeController.HomeController$14 = HomeController$14;
45990     var HomeController$15 = /** @class */ (function () {
45991         function HomeController$15(__parent) {
45992             this.__parent = __parent;
45993         }
45994         HomeController$15.prototype.propertyChange = function (ev) {
45995             this.__parent.enableActionsBoundToSelection();
45996             this.__parent.enableSelectAllAction();
45997             var view = this.__parent.getView();
45998             this.__parent.enableLevelActions(view);
45999             var modificationState = this.__parent.getPlanController().isModificationState();
46000             if (modificationState) {
46001                 view.setEnabled(HomeView.ActionType.PASTE, false);
46002                 view.setEnabled(HomeView.ActionType.UNDO, false);
46003                 view.setEnabled(HomeView.ActionType.REDO, false);
46004             }
46005             else {
46006                 this.__parent.enablePasteAction();
46007                 view.setEnabled(HomeView.ActionType.UNDO, this.__parent.undoManager.canUndo());
46008                 view.setEnabled(HomeView.ActionType.REDO, this.__parent.undoManager.canRedo());
46009             }
46010             view.setEnabled(HomeView.ActionType.LOCK_BASE_PLAN, !modificationState);
46011             view.setEnabled(HomeView.ActionType.UNLOCK_BASE_PLAN, !modificationState);
46012         };
46013         return HomeController$15;
46014     }());
46015     HomeController.HomeController$15 = HomeController$15;
46016     var HomeController$16 = /** @class */ (function () {
46017         function HomeController$16(__parent) {
46018             this.__parent = __parent;
46019         }
46020         HomeController$16.prototype.propertyChange = function (ev) {
46021             this.__parent.enableActionsBoundToSelection();
46022         };
46023         return HomeController$16;
46024     }());
46025     HomeController.HomeController$16 = HomeController$16;
46026     var HomeController$17 = /** @class */ (function () {
46027         function HomeController$17(__parent) {
46028             this.__parent = __parent;
46029         }
46030         HomeController$17.prototype.propertyChange = function (ev) {
46031             this.__parent.enableZoomActions();
46032         };
46033         return HomeController$17;
46034     }());
46035     HomeController.HomeController$17 = HomeController$17;
46036 })(HomeController || (HomeController = {}));
46037 /**
46038  * Creates the controller of 3D view with undo support.
46039  * @param {Home} home
46040  * @param {UserPreferences} preferences
46041  * @param {Object} viewFactory
46042  * @param {Object} contentManager
46043  * @param {javax.swing.undo.UndoableEditSupport} undoSupport
46044  * @class
46045  * @author Emmanuel Puybaret
46046  */
46047 var Home3DAttributesController = /** @class */ (function () {
46048     function Home3DAttributesController(home, preferences, viewFactory, contentManager, undoSupport) {
46049         if (this.home === undefined) {
46050             this.home = null;
46051         }
46052         if (this.preferences === undefined) {
46053             this.preferences = null;
46054         }
46055         if (this.viewFactory === undefined) {
46056             this.viewFactory = null;
46057         }
46058         if (this.contentManager === undefined) {
46059             this.contentManager = null;
46060         }
46061         if (this.undoSupport === undefined) {
46062             this.undoSupport = null;
46063         }
46064         if (this.groundTextureController === undefined) {
46065             this.groundTextureController = null;
46066         }
46067         if (this.skyTextureController === undefined) {
46068             this.skyTextureController = null;
46069         }
46070         if (this.propertyChangeSupport === undefined) {
46071             this.propertyChangeSupport = null;
46072         }
46073         if (this.home3DAttributesView === undefined) {
46074             this.home3DAttributesView = null;
46075         }
46076         if (this.groundColor === undefined) {
46077             this.groundColor = 0;
46078         }
46079         if (this.groundPaint === undefined) {
46080             this.groundPaint = null;
46081         }
46082         if (this.backgroundImageVisibleOnGround3D === undefined) {
46083             this.backgroundImageVisibleOnGround3D = false;
46084         }
46085         if (this.skyColor === undefined) {
46086             this.skyColor = 0;
46087         }
46088         if (this.skyPaint === undefined) {
46089             this.skyPaint = null;
46090         }
46091         if (this.lightColor === undefined) {
46092             this.lightColor = 0;
46093         }
46094         if (this.wallsAlpha === undefined) {
46095             this.wallsAlpha = 0;
46096         }
46097         this.home = home;
46098         this.preferences = preferences;
46099         this.viewFactory = viewFactory;
46100         this.contentManager = contentManager;
46101         this.undoSupport = undoSupport;
46102         this.propertyChangeSupport = new PropertyChangeSupport(this);
46103         this.updateProperties();
46104     }
46105     /**
46106      * Returns the texture controller of the ground.
46107      * @return {TextureChoiceController}
46108      */
46109     Home3DAttributesController.prototype.getGroundTextureController = function () {
46110         if (this.groundTextureController == null) {
46111             this.groundTextureController = new TextureChoiceController(this.preferences.getLocalizedString(Home3DAttributesController, "groundTextureTitle"), this.preferences, this.viewFactory, this.contentManager);
46112             this.groundTextureController.addPropertyChangeListener("TEXTURE", new Home3DAttributesController.Home3DAttributesController$0(this));
46113         }
46114         return this.groundTextureController;
46115     };
46116     /**
46117      * Returns the texture controller of the sky.
46118      * @return {TextureChoiceController}
46119      */
46120     Home3DAttributesController.prototype.getSkyTextureController = function () {
46121         if (this.skyTextureController == null) {
46122             this.skyTextureController = new TextureChoiceController(this.preferences.getLocalizedString(Home3DAttributesController, "skyTextureTitle"), false, this.preferences, this.viewFactory, this.contentManager);
46123             this.skyTextureController.addPropertyChangeListener("TEXTURE", new Home3DAttributesController.Home3DAttributesController$1(this));
46124         }
46125         return this.skyTextureController;
46126     };
46127     /**
46128      * Returns the view associated with this controller.
46129      * @return {Object}
46130      */
46131     Home3DAttributesController.prototype.getView = function () {
46132         if (this.home3DAttributesView == null) {
46133             this.home3DAttributesView = this.viewFactory.createHome3DAttributesView(this.preferences, this);
46134         }
46135         return this.home3DAttributesView;
46136     };
46137     /**
46138      * Displays the view controlled by this controller.
46139      * @param {Object} parentView
46140      */
46141     Home3DAttributesController.prototype.displayView = function (parentView) {
46142         this.getView().displayView(parentView);
46143     };
46144     /**
46145      * Adds the property change <code>listener</code> in parameter to this controller.
46146      * @param {string} property
46147      * @param {PropertyChangeListener} listener
46148      */
46149     Home3DAttributesController.prototype.addPropertyChangeListener = function (property, listener) {
46150         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
46151     };
46152     /**
46153      * Removes the property change <code>listener</code> in parameter from this controller.
46154      * @param {string} property
46155      * @param {PropertyChangeListener} listener
46156      */
46157     Home3DAttributesController.prototype.removePropertyChangeListener = function (property, listener) {
46158         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
46159     };
46160     /**
46161      * Updates edited properties from the 3D attributes of the home edited by this controller.
46162      */
46163     Home3DAttributesController.prototype.updateProperties = function () {
46164         var homeEnvironment = this.home.getEnvironment();
46165         this.setGroundColor(homeEnvironment.getGroundColor());
46166         var groundTexture = homeEnvironment.getGroundTexture();
46167         this.getGroundTextureController().setTexture(groundTexture);
46168         if (groundTexture != null) {
46169             this.setGroundPaint(Home3DAttributesController.EnvironmentPaint.TEXTURED);
46170         }
46171         else {
46172             this.setGroundPaint(Home3DAttributesController.EnvironmentPaint.COLORED);
46173         }
46174         this.setBackgroundImageVisibleOnGround3D(homeEnvironment.isBackgroundImageVisibleOnGround3D());
46175         this.setSkyColor(homeEnvironment.getSkyColor());
46176         var skyTexture = homeEnvironment.getSkyTexture();
46177         this.getSkyTextureController().setTexture(skyTexture);
46178         if (skyTexture != null) {
46179             this.setSkyPaint(Home3DAttributesController.EnvironmentPaint.TEXTURED);
46180         }
46181         else {
46182             this.setSkyPaint(Home3DAttributesController.EnvironmentPaint.COLORED);
46183         }
46184         this.setLightColor(homeEnvironment.getLightColor());
46185         this.setWallsAlpha(homeEnvironment.getWallsAlpha());
46186     };
46187     /**
46188      * Sets the edited ground color.
46189      * @param {number} groundColor
46190      */
46191     Home3DAttributesController.prototype.setGroundColor = function (groundColor) {
46192         if (groundColor !== this.groundColor) {
46193             var oldGroundColor = this.groundColor;
46194             this.groundColor = groundColor;
46195             this.propertyChangeSupport.firePropertyChange(/* name */ "GROUND_COLOR", oldGroundColor, groundColor);
46196             this.setGroundPaint(Home3DAttributesController.EnvironmentPaint.COLORED);
46197         }
46198     };
46199     /**
46200      * Returns the edited ground color.
46201      * @return {number}
46202      */
46203     Home3DAttributesController.prototype.getGroundColor = function () {
46204         return this.groundColor;
46205     };
46206     /**
46207      * Sets whether the ground is colored or textured.
46208      * @param {Home3DAttributesController.EnvironmentPaint} groundPaint
46209      */
46210     Home3DAttributesController.prototype.setGroundPaint = function (groundPaint) {
46211         if (groundPaint !== this.groundPaint) {
46212             var oldGroundPaint = this.groundPaint;
46213             this.groundPaint = groundPaint;
46214             this.propertyChangeSupport.firePropertyChange(/* name */ "GROUND_PAINT", oldGroundPaint, groundPaint);
46215         }
46216     };
46217     /**
46218      * Returns whether the ground is colored or textured.
46219      * @return {Home3DAttributesController.EnvironmentPaint}
46220      */
46221     Home3DAttributesController.prototype.getGroundPaint = function () {
46222         return this.groundPaint;
46223     };
46224     /**
46225      * Returns <code>true</code> if the background image should be displayed on the ground in 3D.
46226      * @return {boolean}
46227      */
46228     Home3DAttributesController.prototype.isBackgroundImageVisibleOnGround3D = function () {
46229         return this.backgroundImageVisibleOnGround3D;
46230     };
46231     /**
46232      * Sets whether the background image should be displayed on the ground in 3D.
46233      * @param {boolean} backgroundImageVisibleOnGround3D
46234      */
46235     Home3DAttributesController.prototype.setBackgroundImageVisibleOnGround3D = function (backgroundImageVisibleOnGround3D) {
46236         if (this.backgroundImageVisibleOnGround3D !== backgroundImageVisibleOnGround3D) {
46237             this.backgroundImageVisibleOnGround3D = backgroundImageVisibleOnGround3D;
46238             this.propertyChangeSupport.firePropertyChange(/* name */ "BACKGROUND_IMAGE_VISIBLE_ON_GROUND_3D", !backgroundImageVisibleOnGround3D, backgroundImageVisibleOnGround3D);
46239         }
46240     };
46241     /**
46242      * Sets the edited sky color.
46243      * @param {number} skyColor
46244      */
46245     Home3DAttributesController.prototype.setSkyColor = function (skyColor) {
46246         if (skyColor !== this.skyColor) {
46247             var oldSkyColor = this.skyColor;
46248             this.skyColor = skyColor;
46249             this.propertyChangeSupport.firePropertyChange(/* name */ "SKY_COLOR", oldSkyColor, skyColor);
46250         }
46251     };
46252     /**
46253      * Returns the edited sky color.
46254      * @return {number}
46255      */
46256     Home3DAttributesController.prototype.getSkyColor = function () {
46257         return this.skyColor;
46258     };
46259     /**
46260      * Sets whether the sky is colored or textured.
46261      * @param {Home3DAttributesController.EnvironmentPaint} skyPaint
46262      */
46263     Home3DAttributesController.prototype.setSkyPaint = function (skyPaint) {
46264         if (skyPaint !== this.skyPaint) {
46265             var oldSkyPaint = this.skyPaint;
46266             this.skyPaint = skyPaint;
46267             this.propertyChangeSupport.firePropertyChange(/* name */ "SKY_PAINT", oldSkyPaint, skyPaint);
46268         }
46269     };
46270     /**
46271      * Returns whether the sky is colored or textured.
46272      * @return {Home3DAttributesController.EnvironmentPaint}
46273      */
46274     Home3DAttributesController.prototype.getSkyPaint = function () {
46275         return this.skyPaint;
46276     };
46277     /**
46278      * Sets the edited light color.
46279      * @param {number} lightColor
46280      */
46281     Home3DAttributesController.prototype.setLightColor = function (lightColor) {
46282         if (lightColor !== this.lightColor) {
46283             var oldLightColor = this.lightColor;
46284             this.lightColor = lightColor;
46285             this.propertyChangeSupport.firePropertyChange(/* name */ "LIGHT_COLOR", oldLightColor, lightColor);
46286         }
46287     };
46288     /**
46289      * Returns the edited light color.
46290      * @return {number}
46291      */
46292     Home3DAttributesController.prototype.getLightColor = function () {
46293         return this.lightColor;
46294     };
46295     /**
46296      * Sets the edited walls transparency alpha.
46297      * @param {number} wallsAlpha
46298      */
46299     Home3DAttributesController.prototype.setWallsAlpha = function (wallsAlpha) {
46300         if (wallsAlpha !== this.wallsAlpha) {
46301             var oldWallsAlpha = this.wallsAlpha;
46302             this.wallsAlpha = wallsAlpha;
46303             this.propertyChangeSupport.firePropertyChange(/* name */ "WALLS_ALPHA", oldWallsAlpha, wallsAlpha);
46304         }
46305     };
46306     /**
46307      * Returns the edited walls transparency alpha.
46308      * @return {number}
46309      */
46310     Home3DAttributesController.prototype.getWallsAlpha = function () {
46311         return this.wallsAlpha;
46312     };
46313     /**
46314      * Controls the modification of the 3D attributes of the edited home.
46315      */
46316     Home3DAttributesController.prototype.modify3DAttributes = function () {
46317         var groundColor = this.getGroundColor();
46318         var groundTexture = this.getGroundPaint() === Home3DAttributesController.EnvironmentPaint.TEXTURED ? this.getGroundTextureController().getTexture() : null;
46319         var backgroundImageVisibleOnGround3D = this.isBackgroundImageVisibleOnGround3D();
46320         var skyColor = this.getSkyColor();
46321         var skyTexture = this.getSkyPaint() === Home3DAttributesController.EnvironmentPaint.TEXTURED ? this.getSkyTextureController().getTexture() : null;
46322         var lightColor = this.getLightColor();
46323         var wallsAlpha = this.getWallsAlpha();
46324         var homeEnvironment = this.home.getEnvironment();
46325         var oldGroundColor = homeEnvironment.getGroundColor();
46326         var oldBackgroundImageVisibleOnGround3D = homeEnvironment.isBackgroundImageVisibleOnGround3D();
46327         var oldGroundTexture = homeEnvironment.getGroundTexture();
46328         var oldSkyColor = homeEnvironment.getSkyColor();
46329         var oldSkyTexture = homeEnvironment.getSkyTexture();
46330         var oldLightColor = homeEnvironment.getLightColor();
46331         var oldWallsAlpha = homeEnvironment.getWallsAlpha();
46332         Home3DAttributesController.doModify3DAttributes(this.home, groundColor, groundTexture, backgroundImageVisibleOnGround3D, skyColor, skyTexture, lightColor, wallsAlpha);
46333         if (this.undoSupport != null) {
46334             this.undoSupport.postEdit(new Home3DAttributesController.Home3DAttributesModificationUndoableEdit(this.home, this.preferences, oldGroundColor, oldGroundTexture, oldBackgroundImageVisibleOnGround3D, oldSkyColor, oldSkyTexture, oldLightColor, oldWallsAlpha, groundColor, groundTexture, backgroundImageVisibleOnGround3D, skyColor, skyTexture, lightColor, wallsAlpha));
46335         }
46336     };
46337     /**
46338      * Modifies the 3D attributes of the given <code>home</code>.
46339      * @param {Home} home
46340      * @param {number} groundColor
46341      * @param {HomeTexture} groundTexture
46342      * @param {boolean} backgroundImageVisibleOnGround3D
46343      * @param {number} skyColor
46344      * @param {HomeTexture} skyTexture
46345      * @param {number} lightColor
46346      * @param {number} wallsAlpha
46347      * @private
46348      */
46349     Home3DAttributesController.doModify3DAttributes = function (home, groundColor, groundTexture, backgroundImageVisibleOnGround3D, skyColor, skyTexture, lightColor, wallsAlpha) {
46350         var homeEnvironment = home.getEnvironment();
46351         homeEnvironment.setGroundColor(groundColor);
46352         homeEnvironment.setGroundTexture(groundTexture);
46353         homeEnvironment.setBackgroundImageVisibleOnGround3D(backgroundImageVisibleOnGround3D);
46354         homeEnvironment.setSkyColor(skyColor);
46355         homeEnvironment.setSkyTexture(skyTexture);
46356         homeEnvironment.setLightColor(lightColor);
46357         homeEnvironment.setWallsAlpha(wallsAlpha);
46358     };
46359     return Home3DAttributesController;
46360 }());
46361 Home3DAttributesController["__class"] = "com.eteks.sweethome3d.viewcontroller.Home3DAttributesController";
46362 Home3DAttributesController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
46363 (function (Home3DAttributesController) {
46364     /**
46365      * The possible values for {@linkplain #getGroundPaint() ground paint type}.
46366      * @enum
46367      * @property {Home3DAttributesController.EnvironmentPaint} COLORED
46368      * @property {Home3DAttributesController.EnvironmentPaint} TEXTURED
46369      * @class
46370      */
46371     var EnvironmentPaint;
46372     (function (EnvironmentPaint) {
46373         EnvironmentPaint[EnvironmentPaint["COLORED"] = 0] = "COLORED";
46374         EnvironmentPaint[EnvironmentPaint["TEXTURED"] = 1] = "TEXTURED";
46375     })(EnvironmentPaint = Home3DAttributesController.EnvironmentPaint || (Home3DAttributesController.EnvironmentPaint = {}));
46376     /**
46377      * Undoable edit for 3D attributes modification. This class isn't anonymous to avoid
46378      * being bound to controller and its view.
46379      * @extends LocalizedUndoableEdit
46380      * @class
46381      */
46382     var Home3DAttributesModificationUndoableEdit = /** @class */ (function (_super) {
46383         __extends(Home3DAttributesModificationUndoableEdit, _super);
46384         function Home3DAttributesModificationUndoableEdit(home, preferences, oldGroundColor, oldGroundTexture, oldBackgroundImageVisibleOnGround3D, oldSkyColor, oldSkyTexture, oldLightColor, oldWallsAlpha, groundColor, groundTexture, backgroundImageVisibleOnGround3D, skyColor, skyTexture, lightColor, wallsAlpha) {
46385             var _this = _super.call(this, preferences, Home3DAttributesController, "undoModify3DAttributesName") || this;
46386             if (_this.home === undefined) {
46387                 _this.home = null;
46388             }
46389             if (_this.oldGroundColor === undefined) {
46390                 _this.oldGroundColor = 0;
46391             }
46392             if (_this.oldGroundTexture === undefined) {
46393                 _this.oldGroundTexture = null;
46394             }
46395             if (_this.oldBackgroundImageVisibleOnGround3D === undefined) {
46396                 _this.oldBackgroundImageVisibleOnGround3D = false;
46397             }
46398             if (_this.oldSkyColor === undefined) {
46399                 _this.oldSkyColor = 0;
46400             }
46401             if (_this.oldSkyTexture === undefined) {
46402                 _this.oldSkyTexture = null;
46403             }
46404             if (_this.oldLightColor === undefined) {
46405                 _this.oldLightColor = 0;
46406             }
46407             if (_this.oldWallsAlpha === undefined) {
46408                 _this.oldWallsAlpha = 0;
46409             }
46410             if (_this.groundColor === undefined) {
46411                 _this.groundColor = 0;
46412             }
46413             if (_this.groundTexture === undefined) {
46414                 _this.groundTexture = null;
46415             }
46416             if (_this.backgroundImageVisibleOnGround3D === undefined) {
46417                 _this.backgroundImageVisibleOnGround3D = false;
46418             }
46419             if (_this.skyColor === undefined) {
46420                 _this.skyColor = 0;
46421             }
46422             if (_this.skyTexture === undefined) {
46423                 _this.skyTexture = null;
46424             }
46425             if (_this.lightColor === undefined) {
46426                 _this.lightColor = 0;
46427             }
46428             if (_this.wallsAlpha === undefined) {
46429                 _this.wallsAlpha = 0;
46430             }
46431             _this.home = home;
46432             _this.oldGroundColor = oldGroundColor;
46433             _this.oldGroundTexture = oldGroundTexture;
46434             _this.oldBackgroundImageVisibleOnGround3D = oldBackgroundImageVisibleOnGround3D;
46435             _this.oldSkyColor = oldSkyColor;
46436             _this.oldSkyTexture = oldSkyTexture;
46437             _this.oldLightColor = oldLightColor;
46438             _this.oldWallsAlpha = oldWallsAlpha;
46439             _this.groundColor = groundColor;
46440             _this.groundTexture = groundTexture;
46441             _this.backgroundImageVisibleOnGround3D = backgroundImageVisibleOnGround3D;
46442             _this.skyColor = skyColor;
46443             _this.skyTexture = skyTexture;
46444             _this.lightColor = lightColor;
46445             _this.wallsAlpha = wallsAlpha;
46446             return _this;
46447         }
46448         /**
46449          *
46450          */
46451         Home3DAttributesModificationUndoableEdit.prototype.undo = function () {
46452             _super.prototype.undo.call(this);
46453             Home3DAttributesController.doModify3DAttributes(this.home, this.oldGroundColor, this.oldGroundTexture, this.oldBackgroundImageVisibleOnGround3D, this.oldSkyColor, this.oldSkyTexture, this.oldLightColor, this.oldWallsAlpha);
46454         };
46455         /**
46456          *
46457          */
46458         Home3DAttributesModificationUndoableEdit.prototype.redo = function () {
46459             _super.prototype.redo.call(this);
46460             Home3DAttributesController.doModify3DAttributes(this.home, this.groundColor, this.groundTexture, this.backgroundImageVisibleOnGround3D, this.skyColor, this.skyTexture, this.lightColor, this.wallsAlpha);
46461         };
46462         return Home3DAttributesModificationUndoableEdit;
46463     }(LocalizedUndoableEdit));
46464     Home3DAttributesController.Home3DAttributesModificationUndoableEdit = Home3DAttributesModificationUndoableEdit;
46465     Home3DAttributesModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.Home3DAttributesController.Home3DAttributesModificationUndoableEdit";
46466     Home3DAttributesModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
46467     var Home3DAttributesController$0 = /** @class */ (function () {
46468         function Home3DAttributesController$0(__parent) {
46469             this.__parent = __parent;
46470         }
46471         Home3DAttributesController$0.prototype.propertyChange = function (ev) {
46472             this.__parent.setGroundPaint(Home3DAttributesController.EnvironmentPaint.TEXTURED);
46473         };
46474         return Home3DAttributesController$0;
46475     }());
46476     Home3DAttributesController.Home3DAttributesController$0 = Home3DAttributesController$0;
46477     var Home3DAttributesController$1 = /** @class */ (function () {
46478         function Home3DAttributesController$1(__parent) {
46479             this.__parent = __parent;
46480         }
46481         Home3DAttributesController$1.prototype.propertyChange = function (ev) {
46482             this.__parent.setSkyPaint(Home3DAttributesController.EnvironmentPaint.TEXTURED);
46483         };
46484         return Home3DAttributesController$1;
46485     }());
46486     Home3DAttributesController.Home3DAttributesController$1 = Home3DAttributesController$1;
46487 })(Home3DAttributesController || (Home3DAttributesController = {}));
46488 /**
46489  * Creates a controller that edits a new imported home piece of furniture
46490  * with a given <code>modelName</code>.
46491  * @param {Home} home
46492  * @param {string} modelName
46493  * @param {UserPreferences} preferences
46494  * @param {FurnitureController} furnitureController
46495  * @param {Object} viewFactory
46496  * @param {Object} contentManager
46497  * @param {javax.swing.undo.UndoableEditSupport} undoSupport
46498  * @class
46499  * @extends WizardController
46500  * @author Emmanuel Puybaret
46501  * @ignore
46502  */
46503 var ImportedFurnitureWizardController = /** @class */ (function (_super) {
46504     __extends(ImportedFurnitureWizardController, _super);
46505     function ImportedFurnitureWizardController(home, piece, modelName, preferences, furnitureController, viewFactory, contentManager, undoSupport) {
46506         var _this = this;
46507         if (((home != null && home instanceof Home) || home === null) && ((piece != null && piece instanceof CatalogPieceOfFurniture) || piece === null) && ((typeof modelName === 'string') || modelName === null) && ((preferences != null && preferences instanceof UserPreferences) || preferences === null) && ((furnitureController != null && furnitureController instanceof FurnitureController) || furnitureController === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || viewFactory === null) && ((contentManager != null && (contentManager.constructor != null && contentManager.constructor["__interfaces"] != null && contentManager.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || contentManager === null) && ((undoSupport != null && undoSupport instanceof javax.swing.undo.UndoableEditSupport) || undoSupport === null)) {
46508             var __args = arguments;
46509             _this = _super.call(this, preferences, viewFactory) || this;
46510             if (_this.home === undefined) {
46511                 _this.home = null;
46512             }
46513             if (_this.piece === undefined) {
46514                 _this.piece = null;
46515             }
46516             if (_this.modelName === undefined) {
46517                 _this.modelName = null;
46518             }
46519             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences === undefined) {
46520                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences = null;
46521             }
46522             if (_this.furnitureController === undefined) {
46523                 _this.furnitureController = null;
46524             }
46525             if (_this.contentManager === undefined) {
46526                 _this.contentManager = null;
46527             }
46528             if (_this.undoSupport === undefined) {
46529                 _this.undoSupport = null;
46530             }
46531             if (_this.furnitureModelStepState === undefined) {
46532                 _this.furnitureModelStepState = null;
46533             }
46534             if (_this.furnitureOrientationStepState === undefined) {
46535                 _this.furnitureOrientationStepState = null;
46536             }
46537             if (_this.furnitureAttributesStepState === undefined) {
46538                 _this.furnitureAttributesStepState = null;
46539             }
46540             if (_this.furnitureIconStepState === undefined) {
46541                 _this.furnitureIconStepState = null;
46542             }
46543             if (_this.stepsView === undefined) {
46544                 _this.stepsView = null;
46545             }
46546             if (_this.step === undefined) {
46547                 _this.step = null;
46548             }
46549             if (_this.name === undefined) {
46550                 _this.name = null;
46551             }
46552             if (_this.creator === undefined) {
46553                 _this.creator = null;
46554             }
46555             if (_this.model === undefined) {
46556                 _this.model = null;
46557             }
46558             if (_this.width === undefined) {
46559                 _this.width = 0;
46560             }
46561             if (_this.proportionalWidth === undefined) {
46562                 _this.proportionalWidth = 0;
46563             }
46564             if (_this.depth === undefined) {
46565                 _this.depth = 0;
46566             }
46567             if (_this.proportionalDepth === undefined) {
46568                 _this.proportionalDepth = 0;
46569             }
46570             if (_this.height === undefined) {
46571                 _this.height = 0;
46572             }
46573             if (_this.proportionalHeight === undefined) {
46574                 _this.proportionalHeight = 0;
46575             }
46576             if (_this.elevation === undefined) {
46577                 _this.elevation = 0;
46578             }
46579             if (_this.movable === undefined) {
46580                 _this.movable = false;
46581             }
46582             if (_this.doorOrWindow === undefined) {
46583                 _this.doorOrWindow = false;
46584             }
46585             if (_this.staircaseCutOutShape === undefined) {
46586                 _this.staircaseCutOutShape = null;
46587             }
46588             if (_this.color === undefined) {
46589                 _this.color = null;
46590             }
46591             if (_this.category === undefined) {
46592                 _this.category = null;
46593             }
46594             if (_this.modelSize === undefined) {
46595                 _this.modelSize = 0;
46596             }
46597             if (_this.modelRotation === undefined) {
46598                 _this.modelRotation = null;
46599             }
46600             if (_this.edgeColorMaterialHidden === undefined) {
46601                 _this.edgeColorMaterialHidden = false;
46602             }
46603             if (_this.backFaceShown === undefined) {
46604                 _this.backFaceShown = false;
46605             }
46606             if (_this.iconYaw === undefined) {
46607                 _this.iconYaw = 0;
46608             }
46609             if (_this.iconPitch === undefined) {
46610                 _this.iconPitch = 0;
46611             }
46612             if (_this.iconScale === undefined) {
46613                 _this.iconScale = 0;
46614             }
46615             if (_this.proportional === undefined) {
46616                 _this.proportional = false;
46617             }
46618             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory === undefined) {
46619                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory = null;
46620             }
46621             _this.home = home;
46622             _this.piece = piece;
46623             _this.modelName = modelName;
46624             _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences = preferences;
46625             _this.furnitureController = furnitureController;
46626             _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory = viewFactory;
46627             _this.undoSupport = undoSupport;
46628             _this.contentManager = contentManager;
46629             /* Use propertyChangeSupport defined in super class */ ;
46630             _this.setTitle(_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences.getLocalizedString(ImportedFurnitureWizardController, piece == null ? "importFurnitureWizard.title" : "modifyFurnitureWizard.title"));
46631             _this.furnitureModelStepState = new ImportedFurnitureWizardController.FurnitureModelStepState(_this);
46632             _this.furnitureOrientationStepState = new ImportedFurnitureWizardController.FurnitureOrientationStepState(_this);
46633             _this.furnitureAttributesStepState = new ImportedFurnitureWizardController.FurnitureAttributesStepState(_this);
46634             _this.furnitureIconStepState = new ImportedFurnitureWizardController.FurnitureIconStepState(_this);
46635             _this.setStepState(_this.furnitureModelStepState);
46636         }
46637         else if (((home != null && home instanceof Home) || home === null) && ((typeof piece === 'string') || piece === null) && ((modelName != null && modelName instanceof UserPreferences) || modelName === null) && ((preferences != null && preferences instanceof FurnitureController) || preferences === null) && ((furnitureController != null && (furnitureController.constructor != null && furnitureController.constructor["__interfaces"] != null && furnitureController.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || furnitureController === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || viewFactory === null) && ((contentManager != null && contentManager instanceof javax.swing.undo.UndoableEditSupport) || contentManager === null) && undoSupport === undefined) {
46638             var __args = arguments;
46639             var modelName_1 = __args[1];
46640             var preferences_14 = __args[2];
46641             var furnitureController_1 = __args[3];
46642             var viewFactory_13 = __args[4];
46643             var contentManager_13 = __args[5];
46644             var undoSupport_4 = __args[6];
46645             {
46646                 var __args_123 = arguments;
46647                 var piece_3 = null;
46648                 _this = _super.call(this, preferences_14, viewFactory_13) || this;
46649                 if (_this.home === undefined) {
46650                     _this.home = null;
46651                 }
46652                 if (_this.piece === undefined) {
46653                     _this.piece = null;
46654                 }
46655                 if (_this.modelName === undefined) {
46656                     _this.modelName = null;
46657                 }
46658                 if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences === undefined) {
46659                     _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences = null;
46660                 }
46661                 if (_this.furnitureController === undefined) {
46662                     _this.furnitureController = null;
46663                 }
46664                 if (_this.contentManager === undefined) {
46665                     _this.contentManager = null;
46666                 }
46667                 if (_this.undoSupport === undefined) {
46668                     _this.undoSupport = null;
46669                 }
46670                 if (_this.furnitureModelStepState === undefined) {
46671                     _this.furnitureModelStepState = null;
46672                 }
46673                 if (_this.furnitureOrientationStepState === undefined) {
46674                     _this.furnitureOrientationStepState = null;
46675                 }
46676                 if (_this.furnitureAttributesStepState === undefined) {
46677                     _this.furnitureAttributesStepState = null;
46678                 }
46679                 if (_this.furnitureIconStepState === undefined) {
46680                     _this.furnitureIconStepState = null;
46681                 }
46682                 if (_this.stepsView === undefined) {
46683                     _this.stepsView = null;
46684                 }
46685                 if (_this.step === undefined) {
46686                     _this.step = null;
46687                 }
46688                 if (_this.name === undefined) {
46689                     _this.name = null;
46690                 }
46691                 if (_this.creator === undefined) {
46692                     _this.creator = null;
46693                 }
46694                 if (_this.model === undefined) {
46695                     _this.model = null;
46696                 }
46697                 if (_this.width === undefined) {
46698                     _this.width = 0;
46699                 }
46700                 if (_this.proportionalWidth === undefined) {
46701                     _this.proportionalWidth = 0;
46702                 }
46703                 if (_this.depth === undefined) {
46704                     _this.depth = 0;
46705                 }
46706                 if (_this.proportionalDepth === undefined) {
46707                     _this.proportionalDepth = 0;
46708                 }
46709                 if (_this.height === undefined) {
46710                     _this.height = 0;
46711                 }
46712                 if (_this.proportionalHeight === undefined) {
46713                     _this.proportionalHeight = 0;
46714                 }
46715                 if (_this.elevation === undefined) {
46716                     _this.elevation = 0;
46717                 }
46718                 if (_this.movable === undefined) {
46719                     _this.movable = false;
46720                 }
46721                 if (_this.doorOrWindow === undefined) {
46722                     _this.doorOrWindow = false;
46723                 }
46724                 if (_this.staircaseCutOutShape === undefined) {
46725                     _this.staircaseCutOutShape = null;
46726                 }
46727                 if (_this.color === undefined) {
46728                     _this.color = null;
46729                 }
46730                 if (_this.category === undefined) {
46731                     _this.category = null;
46732                 }
46733                 if (_this.modelSize === undefined) {
46734                     _this.modelSize = 0;
46735                 }
46736                 if (_this.modelRotation === undefined) {
46737                     _this.modelRotation = null;
46738                 }
46739                 if (_this.edgeColorMaterialHidden === undefined) {
46740                     _this.edgeColorMaterialHidden = false;
46741                 }
46742                 if (_this.backFaceShown === undefined) {
46743                     _this.backFaceShown = false;
46744                 }
46745                 if (_this.iconYaw === undefined) {
46746                     _this.iconYaw = 0;
46747                 }
46748                 if (_this.iconPitch === undefined) {
46749                     _this.iconPitch = 0;
46750                 }
46751                 if (_this.iconScale === undefined) {
46752                     _this.iconScale = 0;
46753                 }
46754                 if (_this.proportional === undefined) {
46755                     _this.proportional = false;
46756                 }
46757                 if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory === undefined) {
46758                     _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory = null;
46759                 }
46760                 _this.home = home;
46761                 _this.piece = piece_3;
46762                 _this.modelName = modelName_1;
46763                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences = preferences_14;
46764                 _this.furnitureController = furnitureController_1;
46765                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory = viewFactory_13;
46766                 _this.undoSupport = undoSupport_4;
46767                 _this.contentManager = contentManager_13;
46768                 /* Use propertyChangeSupport defined in super class */ ;
46769                 _this.setTitle(_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences.getLocalizedString(ImportedFurnitureWizardController, piece_3 == null ? "importFurnitureWizard.title" : "modifyFurnitureWizard.title"));
46770                 _this.furnitureModelStepState = new ImportedFurnitureWizardController.FurnitureModelStepState(_this);
46771                 _this.furnitureOrientationStepState = new ImportedFurnitureWizardController.FurnitureOrientationStepState(_this);
46772                 _this.furnitureAttributesStepState = new ImportedFurnitureWizardController.FurnitureAttributesStepState(_this);
46773                 _this.furnitureIconStepState = new ImportedFurnitureWizardController.FurnitureIconStepState(_this);
46774                 _this.setStepState(_this.furnitureModelStepState);
46775             }
46776             if (_this.home === undefined) {
46777                 _this.home = null;
46778             }
46779             if (_this.piece === undefined) {
46780                 _this.piece = null;
46781             }
46782             if (_this.modelName === undefined) {
46783                 _this.modelName = null;
46784             }
46785             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences === undefined) {
46786                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences = null;
46787             }
46788             if (_this.furnitureController === undefined) {
46789                 _this.furnitureController = null;
46790             }
46791             if (_this.contentManager === undefined) {
46792                 _this.contentManager = null;
46793             }
46794             if (_this.undoSupport === undefined) {
46795                 _this.undoSupport = null;
46796             }
46797             if (_this.furnitureModelStepState === undefined) {
46798                 _this.furnitureModelStepState = null;
46799             }
46800             if (_this.furnitureOrientationStepState === undefined) {
46801                 _this.furnitureOrientationStepState = null;
46802             }
46803             if (_this.furnitureAttributesStepState === undefined) {
46804                 _this.furnitureAttributesStepState = null;
46805             }
46806             if (_this.furnitureIconStepState === undefined) {
46807                 _this.furnitureIconStepState = null;
46808             }
46809             if (_this.stepsView === undefined) {
46810                 _this.stepsView = null;
46811             }
46812             if (_this.step === undefined) {
46813                 _this.step = null;
46814             }
46815             if (_this.name === undefined) {
46816                 _this.name = null;
46817             }
46818             if (_this.creator === undefined) {
46819                 _this.creator = null;
46820             }
46821             if (_this.model === undefined) {
46822                 _this.model = null;
46823             }
46824             if (_this.width === undefined) {
46825                 _this.width = 0;
46826             }
46827             if (_this.proportionalWidth === undefined) {
46828                 _this.proportionalWidth = 0;
46829             }
46830             if (_this.depth === undefined) {
46831                 _this.depth = 0;
46832             }
46833             if (_this.proportionalDepth === undefined) {
46834                 _this.proportionalDepth = 0;
46835             }
46836             if (_this.height === undefined) {
46837                 _this.height = 0;
46838             }
46839             if (_this.proportionalHeight === undefined) {
46840                 _this.proportionalHeight = 0;
46841             }
46842             if (_this.elevation === undefined) {
46843                 _this.elevation = 0;
46844             }
46845             if (_this.movable === undefined) {
46846                 _this.movable = false;
46847             }
46848             if (_this.doorOrWindow === undefined) {
46849                 _this.doorOrWindow = false;
46850             }
46851             if (_this.staircaseCutOutShape === undefined) {
46852                 _this.staircaseCutOutShape = null;
46853             }
46854             if (_this.color === undefined) {
46855                 _this.color = null;
46856             }
46857             if (_this.category === undefined) {
46858                 _this.category = null;
46859             }
46860             if (_this.modelSize === undefined) {
46861                 _this.modelSize = 0;
46862             }
46863             if (_this.modelRotation === undefined) {
46864                 _this.modelRotation = null;
46865             }
46866             if (_this.edgeColorMaterialHidden === undefined) {
46867                 _this.edgeColorMaterialHidden = false;
46868             }
46869             if (_this.backFaceShown === undefined) {
46870                 _this.backFaceShown = false;
46871             }
46872             if (_this.iconYaw === undefined) {
46873                 _this.iconYaw = 0;
46874             }
46875             if (_this.iconPitch === undefined) {
46876                 _this.iconPitch = 0;
46877             }
46878             if (_this.iconScale === undefined) {
46879                 _this.iconScale = 0;
46880             }
46881             if (_this.proportional === undefined) {
46882                 _this.proportional = false;
46883             }
46884             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory === undefined) {
46885                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory = null;
46886             }
46887         }
46888         else if (((home != null && home instanceof Home) || home === null) && ((piece != null && piece instanceof UserPreferences) || piece === null) && ((modelName != null && modelName instanceof FurnitureController) || modelName === null) && ((preferences != null && (preferences.constructor != null && preferences.constructor["__interfaces"] != null && preferences.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || preferences === null) && ((furnitureController != null && (furnitureController.constructor != null && furnitureController.constructor["__interfaces"] != null && furnitureController.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || furnitureController === null) && ((viewFactory != null && viewFactory instanceof javax.swing.undo.UndoableEditSupport) || viewFactory === null) && contentManager === undefined && undoSupport === undefined) {
46889             var __args = arguments;
46890             var preferences_15 = __args[1];
46891             var furnitureController_2 = __args[2];
46892             var viewFactory_14 = __args[3];
46893             var contentManager_14 = __args[4];
46894             var undoSupport_5 = __args[5];
46895             {
46896                 var __args_124 = arguments;
46897                 var piece_4 = null;
46898                 var modelName_2 = null;
46899                 _this = _super.call(this, preferences_15, viewFactory_14) || this;
46900                 if (_this.home === undefined) {
46901                     _this.home = null;
46902                 }
46903                 if (_this.piece === undefined) {
46904                     _this.piece = null;
46905                 }
46906                 if (_this.modelName === undefined) {
46907                     _this.modelName = null;
46908                 }
46909                 if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences === undefined) {
46910                     _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences = null;
46911                 }
46912                 if (_this.furnitureController === undefined) {
46913                     _this.furnitureController = null;
46914                 }
46915                 if (_this.contentManager === undefined) {
46916                     _this.contentManager = null;
46917                 }
46918                 if (_this.undoSupport === undefined) {
46919                     _this.undoSupport = null;
46920                 }
46921                 if (_this.furnitureModelStepState === undefined) {
46922                     _this.furnitureModelStepState = null;
46923                 }
46924                 if (_this.furnitureOrientationStepState === undefined) {
46925                     _this.furnitureOrientationStepState = null;
46926                 }
46927                 if (_this.furnitureAttributesStepState === undefined) {
46928                     _this.furnitureAttributesStepState = null;
46929                 }
46930                 if (_this.furnitureIconStepState === undefined) {
46931                     _this.furnitureIconStepState = null;
46932                 }
46933                 if (_this.stepsView === undefined) {
46934                     _this.stepsView = null;
46935                 }
46936                 if (_this.step === undefined) {
46937                     _this.step = null;
46938                 }
46939                 if (_this.name === undefined) {
46940                     _this.name = null;
46941                 }
46942                 if (_this.creator === undefined) {
46943                     _this.creator = null;
46944                 }
46945                 if (_this.model === undefined) {
46946                     _this.model = null;
46947                 }
46948                 if (_this.width === undefined) {
46949                     _this.width = 0;
46950                 }
46951                 if (_this.proportionalWidth === undefined) {
46952                     _this.proportionalWidth = 0;
46953                 }
46954                 if (_this.depth === undefined) {
46955                     _this.depth = 0;
46956                 }
46957                 if (_this.proportionalDepth === undefined) {
46958                     _this.proportionalDepth = 0;
46959                 }
46960                 if (_this.height === undefined) {
46961                     _this.height = 0;
46962                 }
46963                 if (_this.proportionalHeight === undefined) {
46964                     _this.proportionalHeight = 0;
46965                 }
46966                 if (_this.elevation === undefined) {
46967                     _this.elevation = 0;
46968                 }
46969                 if (_this.movable === undefined) {
46970                     _this.movable = false;
46971                 }
46972                 if (_this.doorOrWindow === undefined) {
46973                     _this.doorOrWindow = false;
46974                 }
46975                 if (_this.staircaseCutOutShape === undefined) {
46976                     _this.staircaseCutOutShape = null;
46977                 }
46978                 if (_this.color === undefined) {
46979                     _this.color = null;
46980                 }
46981                 if (_this.category === undefined) {
46982                     _this.category = null;
46983                 }
46984                 if (_this.modelSize === undefined) {
46985                     _this.modelSize = 0;
46986                 }
46987                 if (_this.modelRotation === undefined) {
46988                     _this.modelRotation = null;
46989                 }
46990                 if (_this.edgeColorMaterialHidden === undefined) {
46991                     _this.edgeColorMaterialHidden = false;
46992                 }
46993                 if (_this.backFaceShown === undefined) {
46994                     _this.backFaceShown = false;
46995                 }
46996                 if (_this.iconYaw === undefined) {
46997                     _this.iconYaw = 0;
46998                 }
46999                 if (_this.iconPitch === undefined) {
47000                     _this.iconPitch = 0;
47001                 }
47002                 if (_this.iconScale === undefined) {
47003                     _this.iconScale = 0;
47004                 }
47005                 if (_this.proportional === undefined) {
47006                     _this.proportional = false;
47007                 }
47008                 if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory === undefined) {
47009                     _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory = null;
47010                 }
47011                 _this.home = home;
47012                 _this.piece = piece_4;
47013                 _this.modelName = modelName_2;
47014                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences = preferences_15;
47015                 _this.furnitureController = furnitureController_2;
47016                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory = viewFactory_14;
47017                 _this.undoSupport = undoSupport_5;
47018                 _this.contentManager = contentManager_14;
47019                 /* Use propertyChangeSupport defined in super class */ ;
47020                 _this.setTitle(_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences.getLocalizedString(ImportedFurnitureWizardController, piece_4 == null ? "importFurnitureWizard.title" : "modifyFurnitureWizard.title"));
47021                 _this.furnitureModelStepState = new ImportedFurnitureWizardController.FurnitureModelStepState(_this);
47022                 _this.furnitureOrientationStepState = new ImportedFurnitureWizardController.FurnitureOrientationStepState(_this);
47023                 _this.furnitureAttributesStepState = new ImportedFurnitureWizardController.FurnitureAttributesStepState(_this);
47024                 _this.furnitureIconStepState = new ImportedFurnitureWizardController.FurnitureIconStepState(_this);
47025                 _this.setStepState(_this.furnitureModelStepState);
47026             }
47027             if (_this.home === undefined) {
47028                 _this.home = null;
47029             }
47030             if (_this.piece === undefined) {
47031                 _this.piece = null;
47032             }
47033             if (_this.modelName === undefined) {
47034                 _this.modelName = null;
47035             }
47036             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences === undefined) {
47037                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences = null;
47038             }
47039             if (_this.furnitureController === undefined) {
47040                 _this.furnitureController = null;
47041             }
47042             if (_this.contentManager === undefined) {
47043                 _this.contentManager = null;
47044             }
47045             if (_this.undoSupport === undefined) {
47046                 _this.undoSupport = null;
47047             }
47048             if (_this.furnitureModelStepState === undefined) {
47049                 _this.furnitureModelStepState = null;
47050             }
47051             if (_this.furnitureOrientationStepState === undefined) {
47052                 _this.furnitureOrientationStepState = null;
47053             }
47054             if (_this.furnitureAttributesStepState === undefined) {
47055                 _this.furnitureAttributesStepState = null;
47056             }
47057             if (_this.furnitureIconStepState === undefined) {
47058                 _this.furnitureIconStepState = null;
47059             }
47060             if (_this.stepsView === undefined) {
47061                 _this.stepsView = null;
47062             }
47063             if (_this.step === undefined) {
47064                 _this.step = null;
47065             }
47066             if (_this.name === undefined) {
47067                 _this.name = null;
47068             }
47069             if (_this.creator === undefined) {
47070                 _this.creator = null;
47071             }
47072             if (_this.model === undefined) {
47073                 _this.model = null;
47074             }
47075             if (_this.width === undefined) {
47076                 _this.width = 0;
47077             }
47078             if (_this.proportionalWidth === undefined) {
47079                 _this.proportionalWidth = 0;
47080             }
47081             if (_this.depth === undefined) {
47082                 _this.depth = 0;
47083             }
47084             if (_this.proportionalDepth === undefined) {
47085                 _this.proportionalDepth = 0;
47086             }
47087             if (_this.height === undefined) {
47088                 _this.height = 0;
47089             }
47090             if (_this.proportionalHeight === undefined) {
47091                 _this.proportionalHeight = 0;
47092             }
47093             if (_this.elevation === undefined) {
47094                 _this.elevation = 0;
47095             }
47096             if (_this.movable === undefined) {
47097                 _this.movable = false;
47098             }
47099             if (_this.doorOrWindow === undefined) {
47100                 _this.doorOrWindow = false;
47101             }
47102             if (_this.staircaseCutOutShape === undefined) {
47103                 _this.staircaseCutOutShape = null;
47104             }
47105             if (_this.color === undefined) {
47106                 _this.color = null;
47107             }
47108             if (_this.category === undefined) {
47109                 _this.category = null;
47110             }
47111             if (_this.modelSize === undefined) {
47112                 _this.modelSize = 0;
47113             }
47114             if (_this.modelRotation === undefined) {
47115                 _this.modelRotation = null;
47116             }
47117             if (_this.edgeColorMaterialHidden === undefined) {
47118                 _this.edgeColorMaterialHidden = false;
47119             }
47120             if (_this.backFaceShown === undefined) {
47121                 _this.backFaceShown = false;
47122             }
47123             if (_this.iconYaw === undefined) {
47124                 _this.iconYaw = 0;
47125             }
47126             if (_this.iconPitch === undefined) {
47127                 _this.iconPitch = 0;
47128             }
47129             if (_this.iconScale === undefined) {
47130                 _this.iconScale = 0;
47131             }
47132             if (_this.proportional === undefined) {
47133                 _this.proportional = false;
47134             }
47135             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory === undefined) {
47136                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory = null;
47137             }
47138         }
47139         else if (((typeof home === 'string') || home === null) && ((piece != null && piece instanceof UserPreferences) || piece === null) && ((modelName != null && (modelName.constructor != null && modelName.constructor["__interfaces"] != null && modelName.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || modelName === null) && ((preferences != null && (preferences.constructor != null && preferences.constructor["__interfaces"] != null && preferences.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || preferences === null) && furnitureController === undefined && viewFactory === undefined && contentManager === undefined && undoSupport === undefined) {
47140             var __args = arguments;
47141             var modelName_3 = __args[0];
47142             var preferences_16 = __args[1];
47143             var viewFactory_15 = __args[2];
47144             var contentManager_15 = __args[3];
47145             {
47146                 var __args_125 = arguments;
47147                 var home_1 = null;
47148                 var piece_5 = null;
47149                 var furnitureController_3 = null;
47150                 var undoSupport_6 = null;
47151                 _this = _super.call(this, preferences_16, viewFactory_15) || this;
47152                 if (_this.home === undefined) {
47153                     _this.home = null;
47154                 }
47155                 if (_this.piece === undefined) {
47156                     _this.piece = null;
47157                 }
47158                 if (_this.modelName === undefined) {
47159                     _this.modelName = null;
47160                 }
47161                 if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences === undefined) {
47162                     _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences = null;
47163                 }
47164                 if (_this.furnitureController === undefined) {
47165                     _this.furnitureController = null;
47166                 }
47167                 if (_this.contentManager === undefined) {
47168                     _this.contentManager = null;
47169                 }
47170                 if (_this.undoSupport === undefined) {
47171                     _this.undoSupport = null;
47172                 }
47173                 if (_this.furnitureModelStepState === undefined) {
47174                     _this.furnitureModelStepState = null;
47175                 }
47176                 if (_this.furnitureOrientationStepState === undefined) {
47177                     _this.furnitureOrientationStepState = null;
47178                 }
47179                 if (_this.furnitureAttributesStepState === undefined) {
47180                     _this.furnitureAttributesStepState = null;
47181                 }
47182                 if (_this.furnitureIconStepState === undefined) {
47183                     _this.furnitureIconStepState = null;
47184                 }
47185                 if (_this.stepsView === undefined) {
47186                     _this.stepsView = null;
47187                 }
47188                 if (_this.step === undefined) {
47189                     _this.step = null;
47190                 }
47191                 if (_this.name === undefined) {
47192                     _this.name = null;
47193                 }
47194                 if (_this.creator === undefined) {
47195                     _this.creator = null;
47196                 }
47197                 if (_this.model === undefined) {
47198                     _this.model = null;
47199                 }
47200                 if (_this.width === undefined) {
47201                     _this.width = 0;
47202                 }
47203                 if (_this.proportionalWidth === undefined) {
47204                     _this.proportionalWidth = 0;
47205                 }
47206                 if (_this.depth === undefined) {
47207                     _this.depth = 0;
47208                 }
47209                 if (_this.proportionalDepth === undefined) {
47210                     _this.proportionalDepth = 0;
47211                 }
47212                 if (_this.height === undefined) {
47213                     _this.height = 0;
47214                 }
47215                 if (_this.proportionalHeight === undefined) {
47216                     _this.proportionalHeight = 0;
47217                 }
47218                 if (_this.elevation === undefined) {
47219                     _this.elevation = 0;
47220                 }
47221                 if (_this.movable === undefined) {
47222                     _this.movable = false;
47223                 }
47224                 if (_this.doorOrWindow === undefined) {
47225                     _this.doorOrWindow = false;
47226                 }
47227                 if (_this.staircaseCutOutShape === undefined) {
47228                     _this.staircaseCutOutShape = null;
47229                 }
47230                 if (_this.color === undefined) {
47231                     _this.color = null;
47232                 }
47233                 if (_this.category === undefined) {
47234                     _this.category = null;
47235                 }
47236                 if (_this.modelSize === undefined) {
47237                     _this.modelSize = 0;
47238                 }
47239                 if (_this.modelRotation === undefined) {
47240                     _this.modelRotation = null;
47241                 }
47242                 if (_this.edgeColorMaterialHidden === undefined) {
47243                     _this.edgeColorMaterialHidden = false;
47244                 }
47245                 if (_this.backFaceShown === undefined) {
47246                     _this.backFaceShown = false;
47247                 }
47248                 if (_this.iconYaw === undefined) {
47249                     _this.iconYaw = 0;
47250                 }
47251                 if (_this.iconPitch === undefined) {
47252                     _this.iconPitch = 0;
47253                 }
47254                 if (_this.iconScale === undefined) {
47255                     _this.iconScale = 0;
47256                 }
47257                 if (_this.proportional === undefined) {
47258                     _this.proportional = false;
47259                 }
47260                 if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory === undefined) {
47261                     _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory = null;
47262                 }
47263                 _this.home = home_1;
47264                 _this.piece = piece_5;
47265                 _this.modelName = modelName_3;
47266                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences = preferences_16;
47267                 _this.furnitureController = furnitureController_3;
47268                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory = viewFactory_15;
47269                 _this.undoSupport = undoSupport_6;
47270                 _this.contentManager = contentManager_15;
47271                 /* Use propertyChangeSupport defined in super class */ ;
47272                 _this.setTitle(_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences.getLocalizedString(ImportedFurnitureWizardController, piece_5 == null ? "importFurnitureWizard.title" : "modifyFurnitureWizard.title"));
47273                 _this.furnitureModelStepState = new ImportedFurnitureWizardController.FurnitureModelStepState(_this);
47274                 _this.furnitureOrientationStepState = new ImportedFurnitureWizardController.FurnitureOrientationStepState(_this);
47275                 _this.furnitureAttributesStepState = new ImportedFurnitureWizardController.FurnitureAttributesStepState(_this);
47276                 _this.furnitureIconStepState = new ImportedFurnitureWizardController.FurnitureIconStepState(_this);
47277                 _this.setStepState(_this.furnitureModelStepState);
47278             }
47279             if (_this.home === undefined) {
47280                 _this.home = null;
47281             }
47282             if (_this.piece === undefined) {
47283                 _this.piece = null;
47284             }
47285             if (_this.modelName === undefined) {
47286                 _this.modelName = null;
47287             }
47288             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences === undefined) {
47289                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences = null;
47290             }
47291             if (_this.furnitureController === undefined) {
47292                 _this.furnitureController = null;
47293             }
47294             if (_this.contentManager === undefined) {
47295                 _this.contentManager = null;
47296             }
47297             if (_this.undoSupport === undefined) {
47298                 _this.undoSupport = null;
47299             }
47300             if (_this.furnitureModelStepState === undefined) {
47301                 _this.furnitureModelStepState = null;
47302             }
47303             if (_this.furnitureOrientationStepState === undefined) {
47304                 _this.furnitureOrientationStepState = null;
47305             }
47306             if (_this.furnitureAttributesStepState === undefined) {
47307                 _this.furnitureAttributesStepState = null;
47308             }
47309             if (_this.furnitureIconStepState === undefined) {
47310                 _this.furnitureIconStepState = null;
47311             }
47312             if (_this.stepsView === undefined) {
47313                 _this.stepsView = null;
47314             }
47315             if (_this.step === undefined) {
47316                 _this.step = null;
47317             }
47318             if (_this.name === undefined) {
47319                 _this.name = null;
47320             }
47321             if (_this.creator === undefined) {
47322                 _this.creator = null;
47323             }
47324             if (_this.model === undefined) {
47325                 _this.model = null;
47326             }
47327             if (_this.width === undefined) {
47328                 _this.width = 0;
47329             }
47330             if (_this.proportionalWidth === undefined) {
47331                 _this.proportionalWidth = 0;
47332             }
47333             if (_this.depth === undefined) {
47334                 _this.depth = 0;
47335             }
47336             if (_this.proportionalDepth === undefined) {
47337                 _this.proportionalDepth = 0;
47338             }
47339             if (_this.height === undefined) {
47340                 _this.height = 0;
47341             }
47342             if (_this.proportionalHeight === undefined) {
47343                 _this.proportionalHeight = 0;
47344             }
47345             if (_this.elevation === undefined) {
47346                 _this.elevation = 0;
47347             }
47348             if (_this.movable === undefined) {
47349                 _this.movable = false;
47350             }
47351             if (_this.doorOrWindow === undefined) {
47352                 _this.doorOrWindow = false;
47353             }
47354             if (_this.staircaseCutOutShape === undefined) {
47355                 _this.staircaseCutOutShape = null;
47356             }
47357             if (_this.color === undefined) {
47358                 _this.color = null;
47359             }
47360             if (_this.category === undefined) {
47361                 _this.category = null;
47362             }
47363             if (_this.modelSize === undefined) {
47364                 _this.modelSize = 0;
47365             }
47366             if (_this.modelRotation === undefined) {
47367                 _this.modelRotation = null;
47368             }
47369             if (_this.edgeColorMaterialHidden === undefined) {
47370                 _this.edgeColorMaterialHidden = false;
47371             }
47372             if (_this.backFaceShown === undefined) {
47373                 _this.backFaceShown = false;
47374             }
47375             if (_this.iconYaw === undefined) {
47376                 _this.iconYaw = 0;
47377             }
47378             if (_this.iconPitch === undefined) {
47379                 _this.iconPitch = 0;
47380             }
47381             if (_this.iconScale === undefined) {
47382                 _this.iconScale = 0;
47383             }
47384             if (_this.proportional === undefined) {
47385                 _this.proportional = false;
47386             }
47387             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory === undefined) {
47388                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory = null;
47389             }
47390         }
47391         else if (((home != null && home instanceof CatalogPieceOfFurniture) || home === null) && ((piece != null && piece instanceof UserPreferences) || piece === null) && ((modelName != null && (modelName.constructor != null && modelName.constructor["__interfaces"] != null && modelName.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || modelName === null) && ((preferences != null && (preferences.constructor != null && preferences.constructor["__interfaces"] != null && preferences.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || preferences === null) && furnitureController === undefined && viewFactory === undefined && contentManager === undefined && undoSupport === undefined) {
47392             var __args = arguments;
47393             var piece_6 = __args[0];
47394             var preferences_17 = __args[1];
47395             var viewFactory_16 = __args[2];
47396             var contentManager_16 = __args[3];
47397             {
47398                 var __args_126 = arguments;
47399                 var home_2 = null;
47400                 var modelName_4 = null;
47401                 var furnitureController_4 = null;
47402                 var undoSupport_7 = null;
47403                 _this = _super.call(this, preferences_17, viewFactory_16) || this;
47404                 if (_this.home === undefined) {
47405                     _this.home = null;
47406                 }
47407                 if (_this.piece === undefined) {
47408                     _this.piece = null;
47409                 }
47410                 if (_this.modelName === undefined) {
47411                     _this.modelName = null;
47412                 }
47413                 if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences === undefined) {
47414                     _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences = null;
47415                 }
47416                 if (_this.furnitureController === undefined) {
47417                     _this.furnitureController = null;
47418                 }
47419                 if (_this.contentManager === undefined) {
47420                     _this.contentManager = null;
47421                 }
47422                 if (_this.undoSupport === undefined) {
47423                     _this.undoSupport = null;
47424                 }
47425                 if (_this.furnitureModelStepState === undefined) {
47426                     _this.furnitureModelStepState = null;
47427                 }
47428                 if (_this.furnitureOrientationStepState === undefined) {
47429                     _this.furnitureOrientationStepState = null;
47430                 }
47431                 if (_this.furnitureAttributesStepState === undefined) {
47432                     _this.furnitureAttributesStepState = null;
47433                 }
47434                 if (_this.furnitureIconStepState === undefined) {
47435                     _this.furnitureIconStepState = null;
47436                 }
47437                 if (_this.stepsView === undefined) {
47438                     _this.stepsView = null;
47439                 }
47440                 if (_this.step === undefined) {
47441                     _this.step = null;
47442                 }
47443                 if (_this.name === undefined) {
47444                     _this.name = null;
47445                 }
47446                 if (_this.creator === undefined) {
47447                     _this.creator = null;
47448                 }
47449                 if (_this.model === undefined) {
47450                     _this.model = null;
47451                 }
47452                 if (_this.width === undefined) {
47453                     _this.width = 0;
47454                 }
47455                 if (_this.proportionalWidth === undefined) {
47456                     _this.proportionalWidth = 0;
47457                 }
47458                 if (_this.depth === undefined) {
47459                     _this.depth = 0;
47460                 }
47461                 if (_this.proportionalDepth === undefined) {
47462                     _this.proportionalDepth = 0;
47463                 }
47464                 if (_this.height === undefined) {
47465                     _this.height = 0;
47466                 }
47467                 if (_this.proportionalHeight === undefined) {
47468                     _this.proportionalHeight = 0;
47469                 }
47470                 if (_this.elevation === undefined) {
47471                     _this.elevation = 0;
47472                 }
47473                 if (_this.movable === undefined) {
47474                     _this.movable = false;
47475                 }
47476                 if (_this.doorOrWindow === undefined) {
47477                     _this.doorOrWindow = false;
47478                 }
47479                 if (_this.staircaseCutOutShape === undefined) {
47480                     _this.staircaseCutOutShape = null;
47481                 }
47482                 if (_this.color === undefined) {
47483                     _this.color = null;
47484                 }
47485                 if (_this.category === undefined) {
47486                     _this.category = null;
47487                 }
47488                 if (_this.modelSize === undefined) {
47489                     _this.modelSize = 0;
47490                 }
47491                 if (_this.modelRotation === undefined) {
47492                     _this.modelRotation = null;
47493                 }
47494                 if (_this.edgeColorMaterialHidden === undefined) {
47495                     _this.edgeColorMaterialHidden = false;
47496                 }
47497                 if (_this.backFaceShown === undefined) {
47498                     _this.backFaceShown = false;
47499                 }
47500                 if (_this.iconYaw === undefined) {
47501                     _this.iconYaw = 0;
47502                 }
47503                 if (_this.iconPitch === undefined) {
47504                     _this.iconPitch = 0;
47505                 }
47506                 if (_this.iconScale === undefined) {
47507                     _this.iconScale = 0;
47508                 }
47509                 if (_this.proportional === undefined) {
47510                     _this.proportional = false;
47511                 }
47512                 if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory === undefined) {
47513                     _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory = null;
47514                 }
47515                 _this.home = home_2;
47516                 _this.piece = piece_6;
47517                 _this.modelName = modelName_4;
47518                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences = preferences_17;
47519                 _this.furnitureController = furnitureController_4;
47520                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory = viewFactory_16;
47521                 _this.undoSupport = undoSupport_7;
47522                 _this.contentManager = contentManager_16;
47523                 /* Use propertyChangeSupport defined in super class */ ;
47524                 _this.setTitle(_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences.getLocalizedString(ImportedFurnitureWizardController, piece_6 == null ? "importFurnitureWizard.title" : "modifyFurnitureWizard.title"));
47525                 _this.furnitureModelStepState = new ImportedFurnitureWizardController.FurnitureModelStepState(_this);
47526                 _this.furnitureOrientationStepState = new ImportedFurnitureWizardController.FurnitureOrientationStepState(_this);
47527                 _this.furnitureAttributesStepState = new ImportedFurnitureWizardController.FurnitureAttributesStepState(_this);
47528                 _this.furnitureIconStepState = new ImportedFurnitureWizardController.FurnitureIconStepState(_this);
47529                 _this.setStepState(_this.furnitureModelStepState);
47530             }
47531             if (_this.home === undefined) {
47532                 _this.home = null;
47533             }
47534             if (_this.piece === undefined) {
47535                 _this.piece = null;
47536             }
47537             if (_this.modelName === undefined) {
47538                 _this.modelName = null;
47539             }
47540             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences === undefined) {
47541                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences = null;
47542             }
47543             if (_this.furnitureController === undefined) {
47544                 _this.furnitureController = null;
47545             }
47546             if (_this.contentManager === undefined) {
47547                 _this.contentManager = null;
47548             }
47549             if (_this.undoSupport === undefined) {
47550                 _this.undoSupport = null;
47551             }
47552             if (_this.furnitureModelStepState === undefined) {
47553                 _this.furnitureModelStepState = null;
47554             }
47555             if (_this.furnitureOrientationStepState === undefined) {
47556                 _this.furnitureOrientationStepState = null;
47557             }
47558             if (_this.furnitureAttributesStepState === undefined) {
47559                 _this.furnitureAttributesStepState = null;
47560             }
47561             if (_this.furnitureIconStepState === undefined) {
47562                 _this.furnitureIconStepState = null;
47563             }
47564             if (_this.stepsView === undefined) {
47565                 _this.stepsView = null;
47566             }
47567             if (_this.step === undefined) {
47568                 _this.step = null;
47569             }
47570             if (_this.name === undefined) {
47571                 _this.name = null;
47572             }
47573             if (_this.creator === undefined) {
47574                 _this.creator = null;
47575             }
47576             if (_this.model === undefined) {
47577                 _this.model = null;
47578             }
47579             if (_this.width === undefined) {
47580                 _this.width = 0;
47581             }
47582             if (_this.proportionalWidth === undefined) {
47583                 _this.proportionalWidth = 0;
47584             }
47585             if (_this.depth === undefined) {
47586                 _this.depth = 0;
47587             }
47588             if (_this.proportionalDepth === undefined) {
47589                 _this.proportionalDepth = 0;
47590             }
47591             if (_this.height === undefined) {
47592                 _this.height = 0;
47593             }
47594             if (_this.proportionalHeight === undefined) {
47595                 _this.proportionalHeight = 0;
47596             }
47597             if (_this.elevation === undefined) {
47598                 _this.elevation = 0;
47599             }
47600             if (_this.movable === undefined) {
47601                 _this.movable = false;
47602             }
47603             if (_this.doorOrWindow === undefined) {
47604                 _this.doorOrWindow = false;
47605             }
47606             if (_this.staircaseCutOutShape === undefined) {
47607                 _this.staircaseCutOutShape = null;
47608             }
47609             if (_this.color === undefined) {
47610                 _this.color = null;
47611             }
47612             if (_this.category === undefined) {
47613                 _this.category = null;
47614             }
47615             if (_this.modelSize === undefined) {
47616                 _this.modelSize = 0;
47617             }
47618             if (_this.modelRotation === undefined) {
47619                 _this.modelRotation = null;
47620             }
47621             if (_this.edgeColorMaterialHidden === undefined) {
47622                 _this.edgeColorMaterialHidden = false;
47623             }
47624             if (_this.backFaceShown === undefined) {
47625                 _this.backFaceShown = false;
47626             }
47627             if (_this.iconYaw === undefined) {
47628                 _this.iconYaw = 0;
47629             }
47630             if (_this.iconPitch === undefined) {
47631                 _this.iconPitch = 0;
47632             }
47633             if (_this.iconScale === undefined) {
47634                 _this.iconScale = 0;
47635             }
47636             if (_this.proportional === undefined) {
47637                 _this.proportional = false;
47638             }
47639             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory === undefined) {
47640                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory = null;
47641             }
47642         }
47643         else if (((home != null && home instanceof UserPreferences) || home === null) && ((piece != null && (piece.constructor != null && piece.constructor["__interfaces"] != null && piece.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || piece === null) && ((modelName != null && (modelName.constructor != null && modelName.constructor["__interfaces"] != null && modelName.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || modelName === null) && preferences === undefined && furnitureController === undefined && viewFactory === undefined && contentManager === undefined && undoSupport === undefined) {
47644             var __args = arguments;
47645             var preferences_18 = __args[0];
47646             var viewFactory_17 = __args[1];
47647             var contentManager_17 = __args[2];
47648             {
47649                 var __args_127 = arguments;
47650                 var home_3 = null;
47651                 var piece_7 = null;
47652                 var modelName_5 = null;
47653                 var furnitureController_5 = null;
47654                 var undoSupport_8 = null;
47655                 _this = _super.call(this, preferences_18, viewFactory_17) || this;
47656                 if (_this.home === undefined) {
47657                     _this.home = null;
47658                 }
47659                 if (_this.piece === undefined) {
47660                     _this.piece = null;
47661                 }
47662                 if (_this.modelName === undefined) {
47663                     _this.modelName = null;
47664                 }
47665                 if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences === undefined) {
47666                     _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences = null;
47667                 }
47668                 if (_this.furnitureController === undefined) {
47669                     _this.furnitureController = null;
47670                 }
47671                 if (_this.contentManager === undefined) {
47672                     _this.contentManager = null;
47673                 }
47674                 if (_this.undoSupport === undefined) {
47675                     _this.undoSupport = null;
47676                 }
47677                 if (_this.furnitureModelStepState === undefined) {
47678                     _this.furnitureModelStepState = null;
47679                 }
47680                 if (_this.furnitureOrientationStepState === undefined) {
47681                     _this.furnitureOrientationStepState = null;
47682                 }
47683                 if (_this.furnitureAttributesStepState === undefined) {
47684                     _this.furnitureAttributesStepState = null;
47685                 }
47686                 if (_this.furnitureIconStepState === undefined) {
47687                     _this.furnitureIconStepState = null;
47688                 }
47689                 if (_this.stepsView === undefined) {
47690                     _this.stepsView = null;
47691                 }
47692                 if (_this.step === undefined) {
47693                     _this.step = null;
47694                 }
47695                 if (_this.name === undefined) {
47696                     _this.name = null;
47697                 }
47698                 if (_this.creator === undefined) {
47699                     _this.creator = null;
47700                 }
47701                 if (_this.model === undefined) {
47702                     _this.model = null;
47703                 }
47704                 if (_this.width === undefined) {
47705                     _this.width = 0;
47706                 }
47707                 if (_this.proportionalWidth === undefined) {
47708                     _this.proportionalWidth = 0;
47709                 }
47710                 if (_this.depth === undefined) {
47711                     _this.depth = 0;
47712                 }
47713                 if (_this.proportionalDepth === undefined) {
47714                     _this.proportionalDepth = 0;
47715                 }
47716                 if (_this.height === undefined) {
47717                     _this.height = 0;
47718                 }
47719                 if (_this.proportionalHeight === undefined) {
47720                     _this.proportionalHeight = 0;
47721                 }
47722                 if (_this.elevation === undefined) {
47723                     _this.elevation = 0;
47724                 }
47725                 if (_this.movable === undefined) {
47726                     _this.movable = false;
47727                 }
47728                 if (_this.doorOrWindow === undefined) {
47729                     _this.doorOrWindow = false;
47730                 }
47731                 if (_this.staircaseCutOutShape === undefined) {
47732                     _this.staircaseCutOutShape = null;
47733                 }
47734                 if (_this.color === undefined) {
47735                     _this.color = null;
47736                 }
47737                 if (_this.category === undefined) {
47738                     _this.category = null;
47739                 }
47740                 if (_this.modelSize === undefined) {
47741                     _this.modelSize = 0;
47742                 }
47743                 if (_this.modelRotation === undefined) {
47744                     _this.modelRotation = null;
47745                 }
47746                 if (_this.edgeColorMaterialHidden === undefined) {
47747                     _this.edgeColorMaterialHidden = false;
47748                 }
47749                 if (_this.backFaceShown === undefined) {
47750                     _this.backFaceShown = false;
47751                 }
47752                 if (_this.iconYaw === undefined) {
47753                     _this.iconYaw = 0;
47754                 }
47755                 if (_this.iconPitch === undefined) {
47756                     _this.iconPitch = 0;
47757                 }
47758                 if (_this.iconScale === undefined) {
47759                     _this.iconScale = 0;
47760                 }
47761                 if (_this.proportional === undefined) {
47762                     _this.proportional = false;
47763                 }
47764                 if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory === undefined) {
47765                     _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory = null;
47766                 }
47767                 _this.home = home_3;
47768                 _this.piece = piece_7;
47769                 _this.modelName = modelName_5;
47770                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences = preferences_18;
47771                 _this.furnitureController = furnitureController_5;
47772                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory = viewFactory_17;
47773                 _this.undoSupport = undoSupport_8;
47774                 _this.contentManager = contentManager_17;
47775                 /* Use propertyChangeSupport defined in super class */ ;
47776                 _this.setTitle(_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences.getLocalizedString(ImportedFurnitureWizardController, piece_7 == null ? "importFurnitureWizard.title" : "modifyFurnitureWizard.title"));
47777                 _this.furnitureModelStepState = new ImportedFurnitureWizardController.FurnitureModelStepState(_this);
47778                 _this.furnitureOrientationStepState = new ImportedFurnitureWizardController.FurnitureOrientationStepState(_this);
47779                 _this.furnitureAttributesStepState = new ImportedFurnitureWizardController.FurnitureAttributesStepState(_this);
47780                 _this.furnitureIconStepState = new ImportedFurnitureWizardController.FurnitureIconStepState(_this);
47781                 _this.setStepState(_this.furnitureModelStepState);
47782             }
47783             if (_this.home === undefined) {
47784                 _this.home = null;
47785             }
47786             if (_this.piece === undefined) {
47787                 _this.piece = null;
47788             }
47789             if (_this.modelName === undefined) {
47790                 _this.modelName = null;
47791             }
47792             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences === undefined) {
47793                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences = null;
47794             }
47795             if (_this.furnitureController === undefined) {
47796                 _this.furnitureController = null;
47797             }
47798             if (_this.contentManager === undefined) {
47799                 _this.contentManager = null;
47800             }
47801             if (_this.undoSupport === undefined) {
47802                 _this.undoSupport = null;
47803             }
47804             if (_this.furnitureModelStepState === undefined) {
47805                 _this.furnitureModelStepState = null;
47806             }
47807             if (_this.furnitureOrientationStepState === undefined) {
47808                 _this.furnitureOrientationStepState = null;
47809             }
47810             if (_this.furnitureAttributesStepState === undefined) {
47811                 _this.furnitureAttributesStepState = null;
47812             }
47813             if (_this.furnitureIconStepState === undefined) {
47814                 _this.furnitureIconStepState = null;
47815             }
47816             if (_this.stepsView === undefined) {
47817                 _this.stepsView = null;
47818             }
47819             if (_this.step === undefined) {
47820                 _this.step = null;
47821             }
47822             if (_this.name === undefined) {
47823                 _this.name = null;
47824             }
47825             if (_this.creator === undefined) {
47826                 _this.creator = null;
47827             }
47828             if (_this.model === undefined) {
47829                 _this.model = null;
47830             }
47831             if (_this.width === undefined) {
47832                 _this.width = 0;
47833             }
47834             if (_this.proportionalWidth === undefined) {
47835                 _this.proportionalWidth = 0;
47836             }
47837             if (_this.depth === undefined) {
47838                 _this.depth = 0;
47839             }
47840             if (_this.proportionalDepth === undefined) {
47841                 _this.proportionalDepth = 0;
47842             }
47843             if (_this.height === undefined) {
47844                 _this.height = 0;
47845             }
47846             if (_this.proportionalHeight === undefined) {
47847                 _this.proportionalHeight = 0;
47848             }
47849             if (_this.elevation === undefined) {
47850                 _this.elevation = 0;
47851             }
47852             if (_this.movable === undefined) {
47853                 _this.movable = false;
47854             }
47855             if (_this.doorOrWindow === undefined) {
47856                 _this.doorOrWindow = false;
47857             }
47858             if (_this.staircaseCutOutShape === undefined) {
47859                 _this.staircaseCutOutShape = null;
47860             }
47861             if (_this.color === undefined) {
47862                 _this.color = null;
47863             }
47864             if (_this.category === undefined) {
47865                 _this.category = null;
47866             }
47867             if (_this.modelSize === undefined) {
47868                 _this.modelSize = 0;
47869             }
47870             if (_this.modelRotation === undefined) {
47871                 _this.modelRotation = null;
47872             }
47873             if (_this.edgeColorMaterialHidden === undefined) {
47874                 _this.edgeColorMaterialHidden = false;
47875             }
47876             if (_this.backFaceShown === undefined) {
47877                 _this.backFaceShown = false;
47878             }
47879             if (_this.iconYaw === undefined) {
47880                 _this.iconYaw = 0;
47881             }
47882             if (_this.iconPitch === undefined) {
47883                 _this.iconPitch = 0;
47884             }
47885             if (_this.iconScale === undefined) {
47886                 _this.iconScale = 0;
47887             }
47888             if (_this.proportional === undefined) {
47889                 _this.proportional = false;
47890             }
47891             if (_this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory === undefined) {
47892                 _this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory = null;
47893             }
47894         }
47895         else
47896             throw new Error('invalid overload');
47897         return _this;
47898     }
47899     /**
47900      * Imports piece in catalog and/or home and posts an undoable operation.
47901      */
47902     ImportedFurnitureWizardController.prototype.finish = function () {
47903         var newPiece;
47904         var modelFlags = (this.isBackFaceShown() ? PieceOfFurniture.SHOW_BACK_FACE : 0) | (this.isEdgeColorMaterialHidden() ? PieceOfFurniture.HIDE_EDGE_COLOR_MATERIAL : 0);
47905         if (this.isDoorOrWindow()) {
47906             newPiece = new CatalogDoorOrWindow(this.getName(), this.getIcon(), this.getModel(), this.getWidth(), this.getDepth(), this.getHeight(), this.getElevation(), this.isMovable(), 1, 0, [], this.getColor(), this.getModelRotation(), modelFlags, this.getModelSize(), this.getCreator(), this.getIconYaw(), this.getIconPitch(), this.getIconScale(), this.isProportional());
47907         }
47908         else {
47909             newPiece = new CatalogPieceOfFurniture(this.getName(), this.getIcon(), this.getModel(), this.getWidth(), this.getDepth(), this.getHeight(), this.getElevation(), this.isMovable(), this.getStaircaseCutOutShape(), this.getColor(), this.getModelRotation(), modelFlags, this.getModelSize(), this.getCreator(), this.getIconYaw(), this.getIconPitch(), this.getIconScale(), this.isProportional());
47910         }
47911         if (this.home != null) {
47912             this.addPieceOfFurniture(this.furnitureController.createHomePieceOfFurniture(newPiece));
47913         }
47914         var catalog = this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences.getFurnitureCatalog();
47915         if (this.piece != null) {
47916             catalog["delete"](this.piece);
47917         }
47918         if (this.category != null) {
47919             catalog.add(this.category, newPiece);
47920         }
47921     };
47922     /**
47923      * Controls new piece added to home.
47924      * Once added the furniture will be selected in view
47925      * and undo support will receive a new undoable edit.
47926      * @param {HomePieceOfFurniture} piece the piece of furniture to add.
47927      */
47928     ImportedFurnitureWizardController.prototype.addPieceOfFurniture = function (piece) {
47929         var basePlanLocked = this.home.isBasePlanLocked();
47930         var allLevelsSelection = this.home.isAllLevelsSelection();
47931         var oldSelection = this.home.getSelectedItems();
47932         var pieceIndex = this.home.getFurniture().length;
47933         this.home.addPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$int(piece, pieceIndex);
47934         this.home.setSelectedItems(/* asList */ [piece]);
47935         if (!piece.isMovable() && basePlanLocked) {
47936             this.home.setBasePlanLocked(false);
47937         }
47938         this.home.setAllLevelsSelection(false);
47939         if (this.undoSupport != null) {
47940             var undoableEdit = new ImportedFurnitureWizardController.PieceOfFurnitureImportationUndoableEdit(this.home, this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences, /* toArray */ oldSelection.slice(0), basePlanLocked, allLevelsSelection, piece, pieceIndex);
47941             this.undoSupport.postEdit(undoableEdit);
47942         }
47943     };
47944     /**
47945      * Returns the content manager of this controller.
47946      * @return {Object}
47947      */
47948     ImportedFurnitureWizardController.prototype.getContentManager = function () {
47949         return this.contentManager;
47950     };
47951     /**
47952      * Returns the current step state.
47953      * @return {ImportedFurnitureWizardController.ImportedFurnitureWizardStepState}
47954      */
47955     ImportedFurnitureWizardController.prototype.getStepState = function () {
47956         return _super.prototype.getStepState.call(this);
47957     };
47958     /**
47959      * Returns the furniture choice step state.
47960      * @return {ImportedFurnitureWizardController.ImportedFurnitureWizardStepState}
47961      */
47962     ImportedFurnitureWizardController.prototype.getFurnitureModelStepState = function () {
47963         return this.furnitureModelStepState;
47964     };
47965     /**
47966      * Returns the furniture orientation step state.
47967      * @return {ImportedFurnitureWizardController.ImportedFurnitureWizardStepState}
47968      */
47969     ImportedFurnitureWizardController.prototype.getFurnitureOrientationStepState = function () {
47970         return this.furnitureOrientationStepState;
47971     };
47972     /**
47973      * Returns the furniture attributes step state.
47974      * @return {ImportedFurnitureWizardController.ImportedFurnitureWizardStepState}
47975      */
47976     ImportedFurnitureWizardController.prototype.getFurnitureAttributesStepState = function () {
47977         return this.furnitureAttributesStepState;
47978     };
47979     /**
47980      * Returns the furniture icon step state.
47981      * @return {ImportedFurnitureWizardController.ImportedFurnitureWizardStepState}
47982      */
47983     ImportedFurnitureWizardController.prototype.getFurnitureIconStepState = function () {
47984         return this.furnitureIconStepState;
47985     };
47986     /**
47987      * Returns the unique wizard view used for all steps.
47988      * @return {Object}
47989      */
47990     ImportedFurnitureWizardController.prototype.getStepsView = function () {
47991         if (this.stepsView == null) {
47992             this.stepsView = this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_viewFactory.createImportedFurnitureWizardStepsView(this.piece, this.modelName, this.home != null, this.__com_eteks_sweethome3d_viewcontroller_ImportedFurnitureWizardController_preferences, this);
47993         }
47994         return this.stepsView;
47995     };
47996     /**
47997      * Switch in the wizard view to the given <code>step</code>.
47998      * @param {ImportedFurnitureWizardController.Step} step
47999      */
48000     ImportedFurnitureWizardController.prototype.setStep = function (step) {
48001         if (step !== this.step) {
48002             var oldStep = this.step;
48003             this.step = step;
48004             this.propertyChangeSupport.firePropertyChange(/* name */ "STEP", oldStep, step);
48005         }
48006     };
48007     /**
48008      * Returns the current step in wizard view.
48009      * @return {ImportedFurnitureWizardController.Step}
48010      */
48011     ImportedFurnitureWizardController.prototype.getStep = function () {
48012         return this.step;
48013     };
48014     /**
48015      * Returns the model content of the imported piece.
48016      * @return {Object}
48017      */
48018     ImportedFurnitureWizardController.prototype.getModel = function () {
48019         return this.model;
48020     };
48021     /**
48022      * Sets the model content of the imported piece.
48023      * @param {Object} model
48024      */
48025     ImportedFurnitureWizardController.prototype.setModel = function (model) {
48026         if (model !== this.model) {
48027             var oldModel = this.model;
48028             this.model = model;
48029             this.propertyChangeSupport.firePropertyChange(/* name */ "MODEL", oldModel, model);
48030         }
48031     };
48032     /**
48033      * Returns <code>true</code> if imported piece back face should be shown.
48034      * @return {boolean}
48035      */
48036     ImportedFurnitureWizardController.prototype.isBackFaceShown = function () {
48037         return this.backFaceShown;
48038     };
48039     /**
48040      * Sets whether imported piece back face should be shown.
48041      * @param {boolean} backFaceShown
48042      */
48043     ImportedFurnitureWizardController.prototype.setBackFaceShown = function (backFaceShown) {
48044         if (backFaceShown !== this.backFaceShown) {
48045             this.backFaceShown = backFaceShown;
48046             this.propertyChangeSupport.firePropertyChange(/* name */ "BACK_FACE_SHOWN", !backFaceShown, backFaceShown);
48047         }
48048     };
48049     /**
48050      * Returns the model size of the imported piece.
48051      * @return {number}
48052      */
48053     ImportedFurnitureWizardController.prototype.getModelSize = function () {
48054         return this.modelSize;
48055     };
48056     /**
48057      * Sets the model size of the content of the imported piece.
48058      * @param {number} modelSize
48059      */
48060     ImportedFurnitureWizardController.prototype.setModelSize = function (modelSize) {
48061         if (modelSize !== this.modelSize) {
48062             var oldModelSize = this.modelSize;
48063             this.modelSize = modelSize;
48064             this.propertyChangeSupport.firePropertyChange(/* name */ "MODEL_SIZE", oldModelSize, modelSize);
48065         }
48066     };
48067     /**
48068      * Returns the pitch angle of the imported piece model.
48069      * @return {float[][]}
48070      */
48071     ImportedFurnitureWizardController.prototype.getModelRotation = function () {
48072         return this.modelRotation;
48073     };
48074     /**
48075      * Sets the orientation pitch angle of the imported piece model.
48076      * @param {float[][]} modelRotation
48077      */
48078     ImportedFurnitureWizardController.prototype.setModelRotation = function (modelRotation) {
48079         if (modelRotation !== this.modelRotation) {
48080             var oldModelRotation = this.modelRotation;
48081             this.modelRotation = modelRotation;
48082             this.propertyChangeSupport.firePropertyChange(/* name */ "MODEL_ROTATION", oldModelRotation, modelRotation);
48083         }
48084     };
48085     /**
48086      * Returns <code>true</code> if edge color materials should be hidden.
48087      * @return {boolean}
48088      */
48089     ImportedFurnitureWizardController.prototype.isEdgeColorMaterialHidden = function () {
48090         return this.edgeColorMaterialHidden;
48091     };
48092     /**
48093      * Sets whether edge color materials should be hidden or not.
48094      * @param {boolean} edgeColorMaterialHidden
48095      */
48096     ImportedFurnitureWizardController.prototype.setEdgeColorMaterialHidden = function (edgeColorMaterialHidden) {
48097         if (edgeColorMaterialHidden !== this.edgeColorMaterialHidden) {
48098             this.edgeColorMaterialHidden = edgeColorMaterialHidden;
48099             this.propertyChangeSupport.firePropertyChange(/* name */ "EDGE_COLOR_MATERIAL_HIDDEN", !edgeColorMaterialHidden, edgeColorMaterialHidden);
48100         }
48101     };
48102     /**
48103      * Returns the name of the imported piece.
48104      * @return {string}
48105      */
48106     ImportedFurnitureWizardController.prototype.getName = function () {
48107         return this.name;
48108     };
48109     /**
48110      * Sets the name of the imported piece.
48111      * @param {string} name
48112      */
48113     ImportedFurnitureWizardController.prototype.setName = function (name) {
48114         if (name !== this.name) {
48115             var oldName = this.name;
48116             this.name = name;
48117             if (this.propertyChangeSupport != null) {
48118                 this.propertyChangeSupport.firePropertyChange(/* name */ "NAME", oldName, name);
48119             }
48120         }
48121     };
48122     /**
48123      * Returns the creator of the imported piece.
48124      * @return {string}
48125      */
48126     ImportedFurnitureWizardController.prototype.getCreator = function () {
48127         return this.creator;
48128     };
48129     /**
48130      * Sets the creator of the imported piece.
48131      * @param {string} creator
48132      */
48133     ImportedFurnitureWizardController.prototype.setCreator = function (creator) {
48134         if (creator !== this.creator) {
48135             var oldCreator = this.creator;
48136             this.creator = creator;
48137             if (this.propertyChangeSupport != null) {
48138                 this.propertyChangeSupport.firePropertyChange(/* name */ "CREATOR", oldCreator, creator);
48139             }
48140         }
48141     };
48142     /**
48143      * Returns the width.
48144      * @return {number}
48145      */
48146     ImportedFurnitureWizardController.prototype.getWidth = function () {
48147         return this.width;
48148     };
48149     ImportedFurnitureWizardController.prototype.setWidth$float = function (width) {
48150         this.setWidth$float$boolean(width, false);
48151     };
48152     ImportedFurnitureWizardController.prototype.setWidth$float$boolean = function (width, keepProportionalWidthUnchanged) {
48153         var adjustedWidth = Math.max(width, 0.001);
48154         if (adjustedWidth === width || !keepProportionalWidthUnchanged) {
48155             this.proportionalWidth = width;
48156         }
48157         if (adjustedWidth !== this.width) {
48158             var oldWidth = this.width;
48159             this.width = adjustedWidth;
48160             this.propertyChangeSupport.firePropertyChange(/* name */ "WIDTH", oldWidth, adjustedWidth);
48161         }
48162     };
48163     /**
48164      * Sets the width of the imported piece.
48165      * @param {number} width
48166      * @param {boolean} keepProportionalWidthUnchanged
48167      * @private
48168      */
48169     ImportedFurnitureWizardController.prototype.setWidth = function (width, keepProportionalWidthUnchanged) {
48170         if (((typeof width === 'number') || width === null) && ((typeof keepProportionalWidthUnchanged === 'boolean') || keepProportionalWidthUnchanged === null)) {
48171             return this.setWidth$float$boolean(width, keepProportionalWidthUnchanged);
48172         }
48173         else if (((typeof width === 'number') || width === null) && keepProportionalWidthUnchanged === undefined) {
48174             return this.setWidth$float(width);
48175         }
48176         else
48177             throw new Error('invalid overload');
48178     };
48179     /**
48180      * Returns the depth of the imported piece.
48181      * @return {number}
48182      */
48183     ImportedFurnitureWizardController.prototype.getDepth = function () {
48184         return this.depth;
48185     };
48186     ImportedFurnitureWizardController.prototype.setDepth$float = function (depth) {
48187         this.setDepth$float$boolean(depth, false);
48188     };
48189     ImportedFurnitureWizardController.prototype.setDepth$float$boolean = function (depth, keepProportionalDepthUnchanged) {
48190         var adjustedDepth = Math.max(depth, 0.001);
48191         if (adjustedDepth === depth || !keepProportionalDepthUnchanged) {
48192             this.proportionalDepth = depth;
48193         }
48194         if (adjustedDepth !== this.depth) {
48195             var oldDepth = this.depth;
48196             this.depth = adjustedDepth;
48197             this.propertyChangeSupport.firePropertyChange(/* name */ "DEPTH", oldDepth, adjustedDepth);
48198         }
48199     };
48200     /**
48201      * Sets the depth of the imported piece.
48202      * @param {number} depth
48203      * @param {boolean} keepProportionalDepthUnchanged
48204      * @private
48205      */
48206     ImportedFurnitureWizardController.prototype.setDepth = function (depth, keepProportionalDepthUnchanged) {
48207         if (((typeof depth === 'number') || depth === null) && ((typeof keepProportionalDepthUnchanged === 'boolean') || keepProportionalDepthUnchanged === null)) {
48208             return this.setDepth$float$boolean(depth, keepProportionalDepthUnchanged);
48209         }
48210         else if (((typeof depth === 'number') || depth === null) && keepProportionalDepthUnchanged === undefined) {
48211             return this.setDepth$float(depth);
48212         }
48213         else
48214             throw new Error('invalid overload');
48215     };
48216     /**
48217      * Returns the height.
48218      * @return {number}
48219      */
48220     ImportedFurnitureWizardController.prototype.getHeight = function () {
48221         return this.height;
48222     };
48223     ImportedFurnitureWizardController.prototype.setHeight$float = function (height) {
48224         this.setHeight$float$boolean(height, false);
48225     };
48226     ImportedFurnitureWizardController.prototype.setHeight$float$boolean = function (height, keepProportionalHeightUnchanged) {
48227         var adjustedHeight = Math.max(height, 0.001);
48228         if (adjustedHeight === height || !keepProportionalHeightUnchanged) {
48229             this.proportionalHeight = height;
48230         }
48231         if (adjustedHeight !== this.height) {
48232             var oldHeight = this.height;
48233             this.height = adjustedHeight;
48234             this.propertyChangeSupport.firePropertyChange(/* name */ "HEIGHT", oldHeight, adjustedHeight);
48235         }
48236     };
48237     /**
48238      * Sets the size of the imported piece.
48239      * @param {number} height
48240      * @param {boolean} keepProportionalHeightUnchanged
48241      * @private
48242      */
48243     ImportedFurnitureWizardController.prototype.setHeight = function (height, keepProportionalHeightUnchanged) {
48244         if (((typeof height === 'number') || height === null) && ((typeof keepProportionalHeightUnchanged === 'boolean') || keepProportionalHeightUnchanged === null)) {
48245             return this.setHeight$float$boolean(height, keepProportionalHeightUnchanged);
48246         }
48247         else if (((typeof height === 'number') || height === null) && keepProportionalHeightUnchanged === undefined) {
48248             return this.setHeight$float(height);
48249         }
48250         else
48251             throw new Error('invalid overload');
48252     };
48253     /**
48254      * Returns the elevation of the imported piece.
48255      * @return {number}
48256      */
48257     ImportedFurnitureWizardController.prototype.getElevation = function () {
48258         return this.elevation;
48259     };
48260     /**
48261      * Sets the elevation of the imported piece.
48262      * @param {number} elevation
48263      */
48264     ImportedFurnitureWizardController.prototype.setElevation = function (elevation) {
48265         if (elevation !== this.elevation) {
48266             var oldElevation = this.elevation;
48267             this.elevation = elevation;
48268             this.propertyChangeSupport.firePropertyChange(/* name */ "ELEVATION", oldElevation, elevation);
48269         }
48270     };
48271     /**
48272      * Returns <code>true</code> if imported piece is movable.
48273      * @return {boolean}
48274      */
48275     ImportedFurnitureWizardController.prototype.isMovable = function () {
48276         return this.movable;
48277     };
48278     /**
48279      * Sets whether imported piece is movable.
48280      * @param {boolean} movable
48281      */
48282     ImportedFurnitureWizardController.prototype.setMovable = function (movable) {
48283         if (movable !== this.movable) {
48284             this.movable = movable;
48285             this.propertyChangeSupport.firePropertyChange(/* name */ "MOVABLE", !movable, movable);
48286         }
48287     };
48288     /**
48289      * Returns <code>true</code> if imported piece is a door or a window.
48290      * @return {boolean}
48291      */
48292     ImportedFurnitureWizardController.prototype.isDoorOrWindow = function () {
48293         return this.doorOrWindow;
48294     };
48295     /**
48296      * Sets whether imported piece is a door or a window.
48297      * @param {boolean} doorOrWindow
48298      */
48299     ImportedFurnitureWizardController.prototype.setDoorOrWindow = function (doorOrWindow) {
48300         if (doorOrWindow !== this.doorOrWindow) {
48301             this.doorOrWindow = doorOrWindow;
48302             this.propertyChangeSupport.firePropertyChange(/* name */ "DOOR_OR_WINDOW", !doorOrWindow, doorOrWindow);
48303             if (doorOrWindow) {
48304                 this.setStaircaseCutOutShape(null);
48305                 this.setMovable(false);
48306             }
48307         }
48308     };
48309     /**
48310      * Returns the shape used to cut out upper levels at its intersection with a staircase.
48311      * @return {string}
48312      */
48313     ImportedFurnitureWizardController.prototype.getStaircaseCutOutShape = function () {
48314         return this.staircaseCutOutShape;
48315     };
48316     /**
48317      * Sets the shape used to cut out upper levels at its intersection with a staircase.
48318      * @param {string} staircaseCutOutShape
48319      */
48320     ImportedFurnitureWizardController.prototype.setStaircaseCutOutShape = function (staircaseCutOutShape) {
48321         if (staircaseCutOutShape !== this.staircaseCutOutShape) {
48322             var oldStaircaseCutOutShape = this.staircaseCutOutShape;
48323             this.staircaseCutOutShape = staircaseCutOutShape;
48324             if (this.propertyChangeSupport != null) {
48325                 this.propertyChangeSupport.firePropertyChange(/* name */ "STAIRCASE_CUT_OUT_SHAPE", oldStaircaseCutOutShape, staircaseCutOutShape);
48326             }
48327             if (this.staircaseCutOutShape != null) {
48328                 this.setDoorOrWindow(false);
48329                 this.setMovable(false);
48330             }
48331         }
48332     };
48333     /**
48334      * Returns the color of the imported piece.
48335      * @return {number}
48336      */
48337     ImportedFurnitureWizardController.prototype.getColor = function () {
48338         return this.color;
48339     };
48340     /**
48341      * Sets the color of the imported piece.
48342      * @param {number} color
48343      */
48344     ImportedFurnitureWizardController.prototype.setColor = function (color) {
48345         if (color !== this.color) {
48346             var oldColor = this.color;
48347             this.color = color;
48348             this.propertyChangeSupport.firePropertyChange(/* name */ "COLOR", oldColor, color);
48349         }
48350     };
48351     /**
48352      * Returns the category of the imported piece.
48353      * @return {FurnitureCategory}
48354      */
48355     ImportedFurnitureWizardController.prototype.getCategory = function () {
48356         return this.category;
48357     };
48358     /**
48359      * Sets the category of the imported piece.
48360      * @param {FurnitureCategory} category
48361      */
48362     ImportedFurnitureWizardController.prototype.setCategory = function (category) {
48363         if (category !== this.category) {
48364             var oldCategory = this.category;
48365             this.category = category;
48366             this.propertyChangeSupport.firePropertyChange(/* name */ "CATEGORY", oldCategory, category);
48367         }
48368     };
48369     /**
48370      * Returns the icon of the imported piece.
48371      * @return {Object}
48372      * @private
48373      */
48374     ImportedFurnitureWizardController.prototype.getIcon = function () {
48375         return this.getStepsView().getIcon();
48376     };
48377     /**
48378      * Returns the yaw angle of the piece icon.
48379      * @return {number}
48380      */
48381     ImportedFurnitureWizardController.prototype.getIconYaw = function () {
48382         return this.iconYaw;
48383     };
48384     /**
48385      * Sets the yaw angle of the piece icon.
48386      * @param {number} iconYaw
48387      */
48388     ImportedFurnitureWizardController.prototype.setIconYaw = function (iconYaw) {
48389         if (iconYaw !== this.iconYaw) {
48390             var oldIconYaw = this.iconYaw;
48391             this.iconYaw = iconYaw;
48392             this.propertyChangeSupport.firePropertyChange(/* name */ "ICON_YAW", oldIconYaw, iconYaw);
48393         }
48394     };
48395     /**
48396      * Returns the pitch angle of the piece icon.
48397      * @return {number}
48398      */
48399     ImportedFurnitureWizardController.prototype.getIconPitch = function () {
48400         return this.iconPitch;
48401     };
48402     /**
48403      * Sets the pitch angle of the piece icon.
48404      * @param {number} iconPitch
48405      */
48406     ImportedFurnitureWizardController.prototype.setIconPitch = function (iconPitch) {
48407         if (iconPitch !== this.iconPitch) {
48408             var oldIconPitch = this.iconPitch;
48409             this.iconPitch = iconPitch;
48410             this.propertyChangeSupport.firePropertyChange(/* name */ "ICON_PITCH", oldIconPitch, iconPitch);
48411         }
48412     };
48413     /**
48414      * Returns the scale of the piece icon.
48415      * @return {number}
48416      */
48417     ImportedFurnitureWizardController.prototype.getIconScale = function () {
48418         return this.iconScale;
48419     };
48420     /**
48421      * Sets the scale of the piece icon.
48422      * @param {number} iconScale
48423      */
48424     ImportedFurnitureWizardController.prototype.setIconScale = function (iconScale) {
48425         if (iconScale !== this.iconScale) {
48426             var oldIconScale = this.iconScale;
48427             this.iconScale = iconScale;
48428             this.propertyChangeSupport.firePropertyChange(/* name */ "ICON_SCALE", oldIconScale, iconScale);
48429         }
48430     };
48431     /**
48432      * Returns <code>true</code> if piece proportions should be kept.
48433      * @return {boolean}
48434      */
48435     ImportedFurnitureWizardController.prototype.isProportional = function () {
48436         return this.proportional;
48437     };
48438     /**
48439      * Sets whether piece proportions should be kept or not.
48440      * @param {boolean} proportional
48441      */
48442     ImportedFurnitureWizardController.prototype.setProportional = function (proportional) {
48443         if (proportional !== this.proportional) {
48444             this.proportional = proportional;
48445             this.propertyChangeSupport.firePropertyChange(/* name */ "PROPORTIONAL", !proportional, proportional);
48446         }
48447     };
48448     /**
48449      * Returns <code>true</code> if piece name is valid.
48450      * @return {boolean}
48451      */
48452     ImportedFurnitureWizardController.prototype.isPieceOfFurnitureNameValid = function () {
48453         return this.name != null && this.name.length > 0;
48454     };
48455     return ImportedFurnitureWizardController;
48456 }(WizardController));
48457 ImportedFurnitureWizardController["__class"] = "com.eteks.sweethome3d.viewcontroller.ImportedFurnitureWizardController";
48458 ImportedFurnitureWizardController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
48459 (function (ImportedFurnitureWizardController) {
48460     var Step;
48461     (function (Step) {
48462         Step[Step["MODEL"] = 0] = "MODEL";
48463         Step[Step["ROTATION"] = 1] = "ROTATION";
48464         Step[Step["ATTRIBUTES"] = 2] = "ATTRIBUTES";
48465         Step[Step["ICON"] = 3] = "ICON";
48466     })(Step = ImportedFurnitureWizardController.Step || (ImportedFurnitureWizardController.Step = {}));
48467     /**
48468      * Undoable edit for piece importation. This class isn't anonymous to avoid
48469      * being bound to controller and its view.
48470      * @extends LocalizedUndoableEdit
48471      * @class
48472      */
48473     var PieceOfFurnitureImportationUndoableEdit = /** @class */ (function (_super) {
48474         __extends(PieceOfFurnitureImportationUndoableEdit, _super);
48475         function PieceOfFurnitureImportationUndoableEdit(home, preferences, oldSelection, oldBasePlanLocked, oldAllLevelsSelection, piece, pieceIndex) {
48476             var _this = _super.call(this, preferences, ImportedFurnitureWizardController, "undoImportFurnitureName") || this;
48477             if (_this.home === undefined) {
48478                 _this.home = null;
48479             }
48480             if (_this.oldSelection === undefined) {
48481                 _this.oldSelection = null;
48482             }
48483             if (_this.oldBasePlanLocked === undefined) {
48484                 _this.oldBasePlanLocked = false;
48485             }
48486             if (_this.oldAllLevelsSelection === undefined) {
48487                 _this.oldAllLevelsSelection = false;
48488             }
48489             if (_this.piece === undefined) {
48490                 _this.piece = null;
48491             }
48492             if (_this.pieceIndex === undefined) {
48493                 _this.pieceIndex = 0;
48494             }
48495             _this.home = home;
48496             _this.oldSelection = oldSelection;
48497             _this.oldBasePlanLocked = oldBasePlanLocked;
48498             _this.oldAllLevelsSelection = oldAllLevelsSelection;
48499             _this.piece = piece;
48500             _this.pieceIndex = pieceIndex;
48501             return _this;
48502         }
48503         /**
48504          *
48505          */
48506         PieceOfFurnitureImportationUndoableEdit.prototype.undo = function () {
48507             _super.prototype.undo.call(this);
48508             this.home.deletePieceOfFurniture(this.piece);
48509             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
48510             this.home.setAllLevelsSelection(this.oldAllLevelsSelection);
48511             this.home.setBasePlanLocked(this.oldBasePlanLocked);
48512         };
48513         /**
48514          *
48515          */
48516         PieceOfFurnitureImportationUndoableEdit.prototype.redo = function () {
48517             _super.prototype.redo.call(this);
48518             this.home.addPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$int(this.piece, this.pieceIndex);
48519             this.home.setSelectedItems(/* asList */ [this.piece]);
48520             if (!this.piece.isMovable() && this.oldBasePlanLocked) {
48521                 this.home.setBasePlanLocked(false);
48522             }
48523             this.home.setAllLevelsSelection(false);
48524         };
48525         return PieceOfFurnitureImportationUndoableEdit;
48526     }(LocalizedUndoableEdit));
48527     ImportedFurnitureWizardController.PieceOfFurnitureImportationUndoableEdit = PieceOfFurnitureImportationUndoableEdit;
48528     PieceOfFurnitureImportationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.ImportedFurnitureWizardController.PieceOfFurnitureImportationUndoableEdit";
48529     PieceOfFurnitureImportationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
48530     /**
48531      * Step state superclass. All step state share the same step view,
48532      * that will display a different component depending on their class name.
48533      * @extends WizardController.WizardControllerStepState
48534      * @class
48535      */
48536     var ImportedFurnitureWizardStepState = /** @class */ (function (_super) {
48537         __extends(ImportedFurnitureWizardStepState, _super);
48538         function ImportedFurnitureWizardStepState(__parent) {
48539             var _this = _super.call(this) || this;
48540             _this.__parent = __parent;
48541             _this.icon = /* getResource */ "resources/importedFurnitureWizard.png";
48542             return _this;
48543         }
48544         /**
48545          *
48546          */
48547         ImportedFurnitureWizardStepState.prototype.enter = function () {
48548             this.__parent.setStep(this.getStep());
48549         };
48550         /**
48551          *
48552          * @return {Object}
48553          */
48554         ImportedFurnitureWizardStepState.prototype.getView = function () {
48555             return this.__parent.getStepsView();
48556         };
48557         /**
48558          *
48559          * @return {string}
48560          */
48561         ImportedFurnitureWizardStepState.prototype.getIcon = function () {
48562             return this.icon;
48563         };
48564         return ImportedFurnitureWizardStepState;
48565     }(WizardController.WizardControllerStepState));
48566     ImportedFurnitureWizardController.ImportedFurnitureWizardStepState = ImportedFurnitureWizardStepState;
48567     ImportedFurnitureWizardStepState["__class"] = "com.eteks.sweethome3d.viewcontroller.ImportedFurnitureWizardController.ImportedFurnitureWizardStepState";
48568     /**
48569      * Furniture model step state (first step).
48570      * @extends ImportedFurnitureWizardController.ImportedFurnitureWizardStepState
48571      * @class
48572      */
48573     var FurnitureModelStepState = /** @class */ (function (_super) {
48574         __extends(FurnitureModelStepState, _super);
48575         function FurnitureModelStepState(__parent) {
48576             var _this = _super.call(this, __parent) || this;
48577             _this.__parent = __parent;
48578             _this.modelChangeListener = new FurnitureModelStepState.FurnitureModelStepState$0(_this);
48579             return _this;
48580         }
48581         /**
48582          *
48583          */
48584         FurnitureModelStepState.prototype.enter = function () {
48585             _super.prototype.enter.call(this);
48586             this.setFirstStep(true);
48587             this.setNextStepEnabled(this.__parent.getModel() != null);
48588             this.__parent.addPropertyChangeListener("MODEL", this.modelChangeListener);
48589         };
48590         /**
48591          *
48592          * @return {ImportedFurnitureWizardController.Step}
48593          */
48594         FurnitureModelStepState.prototype.getStep = function () {
48595             return ImportedFurnitureWizardController.Step.MODEL;
48596         };
48597         /**
48598          *
48599          */
48600         FurnitureModelStepState.prototype.goToNextStep = function () {
48601             this.__parent.setStepState(this.__parent.getFurnitureOrientationStepState());
48602         };
48603         /**
48604          *
48605          */
48606         FurnitureModelStepState.prototype.exit = function () {
48607             this.__parent.removePropertyChangeListener("MODEL", this.modelChangeListener);
48608         };
48609         return FurnitureModelStepState;
48610     }(ImportedFurnitureWizardController.ImportedFurnitureWizardStepState));
48611     ImportedFurnitureWizardController.FurnitureModelStepState = FurnitureModelStepState;
48612     FurnitureModelStepState["__class"] = "com.eteks.sweethome3d.viewcontroller.ImportedFurnitureWizardController.FurnitureModelStepState";
48613     (function (FurnitureModelStepState) {
48614         var FurnitureModelStepState$0 = /** @class */ (function () {
48615             function FurnitureModelStepState$0(__parent) {
48616                 this.__parent = __parent;
48617             }
48618             FurnitureModelStepState$0.prototype.propertyChange = function (ev) {
48619                 this.__parent.setNextStepEnabled(this.__parent.__parent.getModel() != null);
48620             };
48621             return FurnitureModelStepState$0;
48622         }());
48623         FurnitureModelStepState.FurnitureModelStepState$0 = FurnitureModelStepState$0;
48624     })(FurnitureModelStepState = ImportedFurnitureWizardController.FurnitureModelStepState || (ImportedFurnitureWizardController.FurnitureModelStepState = {}));
48625     /**
48626      * Furniture orientation step state (second step).
48627      * @extends ImportedFurnitureWizardController.ImportedFurnitureWizardStepState
48628      * @class
48629      */
48630     var FurnitureOrientationStepState = /** @class */ (function (_super) {
48631         __extends(FurnitureOrientationStepState, _super);
48632         function FurnitureOrientationStepState(__parent) {
48633             var _this = _super.call(this, __parent) || this;
48634             _this.__parent = __parent;
48635             return _this;
48636         }
48637         /**
48638          *
48639          */
48640         FurnitureOrientationStepState.prototype.enter = function () {
48641             _super.prototype.enter.call(this);
48642             this.setNextStepEnabled(true);
48643         };
48644         /**
48645          *
48646          * @return {ImportedFurnitureWizardController.Step}
48647          */
48648         FurnitureOrientationStepState.prototype.getStep = function () {
48649             return ImportedFurnitureWizardController.Step.ROTATION;
48650         };
48651         /**
48652          *
48653          */
48654         FurnitureOrientationStepState.prototype.goBackToPreviousStep = function () {
48655             this.__parent.setStepState(this.__parent.getFurnitureModelStepState());
48656         };
48657         /**
48658          *
48659          */
48660         FurnitureOrientationStepState.prototype.goToNextStep = function () {
48661             this.__parent.setStepState(this.__parent.getFurnitureAttributesStepState());
48662         };
48663         return FurnitureOrientationStepState;
48664     }(ImportedFurnitureWizardController.ImportedFurnitureWizardStepState));
48665     ImportedFurnitureWizardController.FurnitureOrientationStepState = FurnitureOrientationStepState;
48666     FurnitureOrientationStepState["__class"] = "com.eteks.sweethome3d.viewcontroller.ImportedFurnitureWizardController.FurnitureOrientationStepState";
48667     /**
48668      * Furniture attributes step state (third step).
48669      * @extends ImportedFurnitureWizardController.ImportedFurnitureWizardStepState
48670      * @class
48671      */
48672     var FurnitureAttributesStepState = /** @class */ (function (_super) {
48673         __extends(FurnitureAttributesStepState, _super);
48674         function FurnitureAttributesStepState(__parent) {
48675             var _this = _super.call(this, __parent) || this;
48676             _this.__parent = __parent;
48677             _this.widthChangeListener = new FurnitureAttributesStepState.FurnitureAttributesStepState$0(_this);
48678             _this.depthChangeListener = new FurnitureAttributesStepState.FurnitureAttributesStepState$1(_this);
48679             _this.heightChangeListener = new FurnitureAttributesStepState.FurnitureAttributesStepState$2(_this);
48680             _this.nameAndCategoryChangeListener = new FurnitureAttributesStepState.FurnitureAttributesStepState$3(_this);
48681             return _this;
48682         }
48683         /**
48684          *
48685          */
48686         FurnitureAttributesStepState.prototype.enter = function () {
48687             _super.prototype.enter.call(this);
48688             this.__parent.addPropertyChangeListener("WIDTH", this.widthChangeListener);
48689             this.__parent.addPropertyChangeListener("DEPTH", this.depthChangeListener);
48690             this.__parent.addPropertyChangeListener("HEIGHT", this.heightChangeListener);
48691             this.__parent.addPropertyChangeListener("NAME", this.nameAndCategoryChangeListener);
48692             this.__parent.addPropertyChangeListener("CATEGORY", this.nameAndCategoryChangeListener);
48693             this.checkPieceOfFurnitureNameInCategory();
48694         };
48695         FurnitureAttributesStepState.prototype.checkPieceOfFurnitureNameInCategory = function () {
48696             this.setNextStepEnabled(this.__parent.isPieceOfFurnitureNameValid());
48697         };
48698         /**
48699          *
48700          * @return {ImportedFurnitureWizardController.Step}
48701          */
48702         FurnitureAttributesStepState.prototype.getStep = function () {
48703             return ImportedFurnitureWizardController.Step.ATTRIBUTES;
48704         };
48705         /**
48706          *
48707          */
48708         FurnitureAttributesStepState.prototype.goBackToPreviousStep = function () {
48709             this.__parent.setStepState(this.__parent.getFurnitureOrientationStepState());
48710         };
48711         /**
48712          *
48713          */
48714         FurnitureAttributesStepState.prototype.goToNextStep = function () {
48715             this.__parent.setStepState(this.__parent.getFurnitureIconStepState());
48716         };
48717         /**
48718          *
48719          */
48720         FurnitureAttributesStepState.prototype.exit = function () {
48721             this.__parent.removePropertyChangeListener("WIDTH", this.widthChangeListener);
48722             this.__parent.removePropertyChangeListener("DEPTH", this.depthChangeListener);
48723             this.__parent.removePropertyChangeListener("HEIGHT", this.heightChangeListener);
48724             this.__parent.removePropertyChangeListener("NAME", this.nameAndCategoryChangeListener);
48725             this.__parent.removePropertyChangeListener("CATEGORY", this.nameAndCategoryChangeListener);
48726         };
48727         return FurnitureAttributesStepState;
48728     }(ImportedFurnitureWizardController.ImportedFurnitureWizardStepState));
48729     ImportedFurnitureWizardController.FurnitureAttributesStepState = FurnitureAttributesStepState;
48730     FurnitureAttributesStepState["__class"] = "com.eteks.sweethome3d.viewcontroller.ImportedFurnitureWizardController.FurnitureAttributesStepState";
48731     (function (FurnitureAttributesStepState) {
48732         var FurnitureAttributesStepState$0 = /** @class */ (function () {
48733             function FurnitureAttributesStepState$0(__parent) {
48734                 this.__parent = __parent;
48735             }
48736             FurnitureAttributesStepState$0.prototype.propertyChange = function (ev) {
48737                 if (this.__parent.__parent.isProportional()) {
48738                     this.__parent.__parent.removePropertyChangeListener("DEPTH", this.__parent.depthChangeListener);
48739                     this.__parent.__parent.removePropertyChangeListener("HEIGHT", this.__parent.heightChangeListener);
48740                     var ratio = ev.getNewValue() / ev.getOldValue();
48741                     this.__parent.__parent.setDepth(this.__parent.__parent.proportionalDepth * ratio, true);
48742                     this.__parent.__parent.setHeight(this.__parent.__parent.proportionalHeight * ratio, true);
48743                     this.__parent.__parent.addPropertyChangeListener("DEPTH", this.__parent.depthChangeListener);
48744                     this.__parent.__parent.addPropertyChangeListener("HEIGHT", this.__parent.heightChangeListener);
48745                 }
48746             };
48747             return FurnitureAttributesStepState$0;
48748         }());
48749         FurnitureAttributesStepState.FurnitureAttributesStepState$0 = FurnitureAttributesStepState$0;
48750         var FurnitureAttributesStepState$1 = /** @class */ (function () {
48751             function FurnitureAttributesStepState$1(__parent) {
48752                 this.__parent = __parent;
48753             }
48754             FurnitureAttributesStepState$1.prototype.propertyChange = function (ev) {
48755                 if (this.__parent.__parent.isProportional()) {
48756                     this.__parent.__parent.removePropertyChangeListener("WIDTH", this.__parent.widthChangeListener);
48757                     this.__parent.__parent.removePropertyChangeListener("HEIGHT", this.__parent.heightChangeListener);
48758                     var ratio = ev.getNewValue() / ev.getOldValue();
48759                     this.__parent.__parent.setWidth(this.__parent.__parent.proportionalWidth * ratio, true);
48760                     this.__parent.__parent.setHeight(this.__parent.__parent.proportionalHeight * ratio, true);
48761                     this.__parent.__parent.addPropertyChangeListener("WIDTH", this.__parent.widthChangeListener);
48762                     this.__parent.__parent.addPropertyChangeListener("HEIGHT", this.__parent.heightChangeListener);
48763                 }
48764             };
48765             return FurnitureAttributesStepState$1;
48766         }());
48767         FurnitureAttributesStepState.FurnitureAttributesStepState$1 = FurnitureAttributesStepState$1;
48768         var FurnitureAttributesStepState$2 = /** @class */ (function () {
48769             function FurnitureAttributesStepState$2(__parent) {
48770                 this.__parent = __parent;
48771             }
48772             FurnitureAttributesStepState$2.prototype.propertyChange = function (ev) {
48773                 if (this.__parent.__parent.isProportional()) {
48774                     this.__parent.__parent.removePropertyChangeListener("WIDTH", this.__parent.widthChangeListener);
48775                     this.__parent.__parent.removePropertyChangeListener("DEPTH", this.__parent.depthChangeListener);
48776                     var ratio = ev.getNewValue() / ev.getOldValue();
48777                     this.__parent.__parent.setWidth(this.__parent.__parent.proportionalWidth * ratio, true);
48778                     this.__parent.__parent.setDepth(this.__parent.__parent.proportionalDepth * ratio, true);
48779                     this.__parent.__parent.addPropertyChangeListener("WIDTH", this.__parent.widthChangeListener);
48780                     this.__parent.__parent.addPropertyChangeListener("DEPTH", this.__parent.depthChangeListener);
48781                 }
48782             };
48783             return FurnitureAttributesStepState$2;
48784         }());
48785         FurnitureAttributesStepState.FurnitureAttributesStepState$2 = FurnitureAttributesStepState$2;
48786         var FurnitureAttributesStepState$3 = /** @class */ (function () {
48787             function FurnitureAttributesStepState$3(__parent) {
48788                 this.__parent = __parent;
48789             }
48790             FurnitureAttributesStepState$3.prototype.propertyChange = function (ev) {
48791                 this.__parent.checkPieceOfFurnitureNameInCategory();
48792             };
48793             return FurnitureAttributesStepState$3;
48794         }());
48795         FurnitureAttributesStepState.FurnitureAttributesStepState$3 = FurnitureAttributesStepState$3;
48796     })(FurnitureAttributesStepState = ImportedFurnitureWizardController.FurnitureAttributesStepState || (ImportedFurnitureWizardController.FurnitureAttributesStepState = {}));
48797     /**
48798      * Furniture icon step state (last step).
48799      * @extends ImportedFurnitureWizardController.ImportedFurnitureWizardStepState
48800      * @class
48801      */
48802     var FurnitureIconStepState = /** @class */ (function (_super) {
48803         __extends(FurnitureIconStepState, _super);
48804         function FurnitureIconStepState(__parent) {
48805             var _this = _super.call(this, __parent) || this;
48806             _this.__parent = __parent;
48807             return _this;
48808         }
48809         /**
48810          *
48811          */
48812         FurnitureIconStepState.prototype.enter = function () {
48813             _super.prototype.enter.call(this);
48814             this.setLastStep(true);
48815             this.setNextStepEnabled(true);
48816         };
48817         /**
48818          *
48819          * @return {ImportedFurnitureWizardController.Step}
48820          */
48821         FurnitureIconStepState.prototype.getStep = function () {
48822             return ImportedFurnitureWizardController.Step.ICON;
48823         };
48824         /**
48825          *
48826          */
48827         FurnitureIconStepState.prototype.goBackToPreviousStep = function () {
48828             this.__parent.setStepState(this.__parent.getFurnitureAttributesStepState());
48829         };
48830         return FurnitureIconStepState;
48831     }(ImportedFurnitureWizardController.ImportedFurnitureWizardStepState));
48832     ImportedFurnitureWizardController.FurnitureIconStepState = FurnitureIconStepState;
48833     FurnitureIconStepState["__class"] = "com.eteks.sweethome3d.viewcontroller.ImportedFurnitureWizardController.FurnitureIconStepState";
48834 })(ImportedFurnitureWizardController || (ImportedFurnitureWizardController = {}));
48835 /**
48836  * Creates the controller of page setup with undo support.
48837  * @param {Home} home
48838  * @param {UserPreferences} preferences
48839  * @param {Object} viewFactory
48840  * @param {javax.swing.undo.UndoableEditSupport} undoSupport
48841  * @class
48842  * @author Emmanuel Puybaret
48843  * @ignore
48844  */
48845 var PageSetupController = /** @class */ (function () {
48846     function PageSetupController(home, preferences, viewFactory, undoSupport) {
48847         if (this.home === undefined) {
48848             this.home = null;
48849         }
48850         if (this.preferences === undefined) {
48851             this.preferences = null;
48852         }
48853         if (this.viewFactory === undefined) {
48854             this.viewFactory = null;
48855         }
48856         if (this.undoSupport === undefined) {
48857             this.undoSupport = null;
48858         }
48859         if (this.propertyChangeSupport === undefined) {
48860             this.propertyChangeSupport = null;
48861         }
48862         if (this.pageSetupView === undefined) {
48863             this.pageSetupView = null;
48864         }
48865         if (this.print === undefined) {
48866             this.print = null;
48867         }
48868         this.home = home;
48869         this.preferences = preferences;
48870         this.viewFactory = viewFactory;
48871         this.undoSupport = undoSupport;
48872         this.propertyChangeSupport = new PropertyChangeSupport(this);
48873         this.setPrint(home.getPrint());
48874     }
48875     /**
48876      * Returns the view associated with this controller.
48877      * @return {Object}
48878      */
48879     PageSetupController.prototype.getView = function () {
48880         if (this.pageSetupView == null) {
48881             this.pageSetupView = this.viewFactory.createPageSetupView(this.preferences, this);
48882         }
48883         return this.pageSetupView;
48884     };
48885     /**
48886      * Displays the view controlled by this controller.
48887      * @param {Object} parentView
48888      */
48889     PageSetupController.prototype.displayView = function (parentView) {
48890         this.getView().displayView(parentView);
48891     };
48892     /**
48893      * Adds the property change <code>listener</code> in parameter to this controller.
48894      * @param {string} property
48895      * @param {PropertyChangeListener} listener
48896      */
48897     PageSetupController.prototype.addPropertyChangeListener = function (property, listener) {
48898         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
48899     };
48900     /**
48901      * Removes the property change <code>listener</code> in parameter from this controller.
48902      * @param {string} property
48903      * @param {PropertyChangeListener} listener
48904      */
48905     PageSetupController.prototype.removePropertyChangeListener = function (property, listener) {
48906         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
48907     };
48908     /**
48909      * Sets the edited print attributes.
48910      * @param {HomePrint} print
48911      */
48912     PageSetupController.prototype.setPrint = function (print) {
48913         if (print !== this.print) {
48914             var oldPrint = this.print;
48915             this.print = print;
48916             this.propertyChangeSupport.firePropertyChange(/* name */ "PRINT", oldPrint, print);
48917         }
48918     };
48919     /**
48920      * Returns the edited print attributes.
48921      * @return {HomePrint}
48922      */
48923     PageSetupController.prototype.getPrint = function () {
48924         return this.print;
48925     };
48926     /**
48927      * Returns home printable levels.
48928      * @return {Level[]}
48929      */
48930     PageSetupController.prototype.getPrintableLevels = function () {
48931         return this.home.getLevels();
48932     };
48933     /**
48934      * Controls the modification of home print attributes.
48935      */
48936     PageSetupController.prototype.modifyPageSetup = function () {
48937         var oldHomePrint = this.home.getPrint();
48938         var homePrint = this.getPrint();
48939         this.home.setPrint(homePrint);
48940         var undoableEdit = new PageSetupController.HomePrintModificationUndoableEdit(this.home, this.preferences, oldHomePrint, homePrint);
48941         this.undoSupport.postEdit(undoableEdit);
48942     };
48943     return PageSetupController;
48944 }());
48945 PageSetupController["__class"] = "com.eteks.sweethome3d.viewcontroller.PageSetupController";
48946 PageSetupController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
48947 (function (PageSetupController) {
48948     /**
48949      * Undoable edit for home print modification. This class isn't anonymous to avoid
48950      * being bound to controller and its view.
48951      * @extends LocalizedUndoableEdit
48952      * @class
48953      */
48954     var HomePrintModificationUndoableEdit = /** @class */ (function (_super) {
48955         __extends(HomePrintModificationUndoableEdit, _super);
48956         function HomePrintModificationUndoableEdit(home, preferences, oldHomePrint, homePrint) {
48957             var _this = _super.call(this, preferences, PageSetupController, "undoPageSetupName") || this;
48958             if (_this.home === undefined) {
48959                 _this.home = null;
48960             }
48961             if (_this.oldHomePrint === undefined) {
48962                 _this.oldHomePrint = null;
48963             }
48964             if (_this.homePrint === undefined) {
48965                 _this.homePrint = null;
48966             }
48967             _this.home = home;
48968             _this.oldHomePrint = oldHomePrint;
48969             _this.homePrint = homePrint;
48970             return _this;
48971         }
48972         /**
48973          *
48974          */
48975         HomePrintModificationUndoableEdit.prototype.undo = function () {
48976             _super.prototype.undo.call(this);
48977             this.home.setPrint(this.oldHomePrint);
48978         };
48979         /**
48980          *
48981          */
48982         HomePrintModificationUndoableEdit.prototype.redo = function () {
48983             _super.prototype.redo.call(this);
48984             this.home.setPrint(this.homePrint);
48985         };
48986         return HomePrintModificationUndoableEdit;
48987     }(LocalizedUndoableEdit));
48988     PageSetupController.HomePrintModificationUndoableEdit = HomePrintModificationUndoableEdit;
48989     HomePrintModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PageSetupController.HomePrintModificationUndoableEdit";
48990     HomePrintModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
48991 })(PageSetupController || (PageSetupController = {}));
48992 /**
48993  * Creates the controller of home levels view with undo support.
48994  * @param {Home} home
48995  * @param {UserPreferences} preferences
48996  * @param {Object} viewFactory
48997  * @param {javax.swing.undo.UndoableEditSupport} undoSupport
48998  * @class
48999  * @author Emmanuel Puybaret
49000  */
49001 var LevelController = /** @class */ (function () {
49002     function LevelController(home, preferences, viewFactory, undoSupport) {
49003         if (this.home === undefined) {
49004             this.home = null;
49005         }
49006         if (this.preferences === undefined) {
49007             this.preferences = null;
49008         }
49009         if (this.viewFactory === undefined) {
49010             this.viewFactory = null;
49011         }
49012         if (this.undoSupport === undefined) {
49013             this.undoSupport = null;
49014         }
49015         if (this.propertyChangeSupport === undefined) {
49016             this.propertyChangeSupport = null;
49017         }
49018         if (this.homeLevelView === undefined) {
49019             this.homeLevelView = null;
49020         }
49021         if (this.name === undefined) {
49022             this.name = null;
49023         }
49024         if (this.viewable === undefined) {
49025             this.viewable = null;
49026         }
49027         if (this.elevation === undefined) {
49028             this.elevation = null;
49029         }
49030         if (this.elevationIndex === undefined) {
49031             this.elevationIndex = null;
49032         }
49033         if (this.floorThickness === undefined) {
49034             this.floorThickness = null;
49035         }
49036         if (this.height === undefined) {
49037             this.height = null;
49038         }
49039         if (this.levels === undefined) {
49040             this.levels = null;
49041         }
49042         if (this.selectedLevelIndex === undefined) {
49043             this.selectedLevelIndex = null;
49044         }
49045         this.home = home;
49046         this.preferences = preferences;
49047         this.viewFactory = viewFactory;
49048         this.undoSupport = undoSupport;
49049         this.propertyChangeSupport = new PropertyChangeSupport(this);
49050         this.updateProperties();
49051     }
49052     /**
49053      * Returns the view associated with this controller.
49054      * @return {Object}
49055      */
49056     LevelController.prototype.getView = function () {
49057         if (this.homeLevelView == null) {
49058             this.homeLevelView = this.viewFactory.createLevelView(this.preferences, this);
49059         }
49060         return this.homeLevelView;
49061     };
49062     /**
49063      * Displays the view controlled by this controller.
49064      * @param {Object} parentView
49065      */
49066     LevelController.prototype.displayView = function (parentView) {
49067         this.getView().displayView(parentView);
49068     };
49069     /**
49070      * Adds the property change <code>listener</code> in parameter to this controller.
49071      * @param {string} property
49072      * @param {PropertyChangeListener} listener
49073      */
49074     LevelController.prototype.addPropertyChangeListener = function (property, listener) {
49075         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
49076     };
49077     /**
49078      * Removes the property change <code>listener</code> in parameter from this controller.
49079      * @param {string} property
49080      * @param {PropertyChangeListener} listener
49081      */
49082     LevelController.prototype.removePropertyChangeListener = function (property, listener) {
49083         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
49084     };
49085     /**
49086      * Updates edited properties from selected level in the home edited by this controller.
49087      */
49088     LevelController.prototype.updateProperties = function () {
49089         var selectedLevel = this.home.getSelectedLevel();
49090         this.setLevels(this.clone(/* toArray */ (function (a1, a2) { if (a1.length >= a2.length) {
49091             a1.length = 0;
49092             a1.push.apply(a1, a2);
49093             return a1;
49094         }
49095         else {
49096             return a2.slice(0);
49097         } })([], this.home.getLevels())));
49098         if (selectedLevel == null) {
49099             this.setSelectedLevelIndex(null);
49100             this.setName(null);
49101             this.setViewable(true);
49102             this.setElevation(null, false);
49103             this.setFloorThickness(null);
49104             this.setHeight(null);
49105             this.setElevationIndex(null, false);
49106         }
49107         else {
49108             this.setSelectedLevelIndex(this.home.getLevels().indexOf(selectedLevel));
49109             this.setName(selectedLevel.getName());
49110             this.setViewable(selectedLevel.isViewable());
49111             this.setElevation(selectedLevel.getElevation(), false);
49112             this.setFloorThickness(selectedLevel.getFloorThickness());
49113             this.setHeight(selectedLevel.getHeight());
49114             this.setElevationIndex(selectedLevel.getElevationIndex(), false);
49115         }
49116     };
49117     LevelController.prototype.clone = function (levels) {
49118         for (var i = 0; i < levels.length; i++) {
49119             {
49120                 levels[i] = /* clone */ /* clone */ (function (o) { if (o.clone != undefined) {
49121                     return o.clone();
49122                 }
49123                 else {
49124                     var clone = Object.create(o);
49125                     for (var p in o) {
49126                         if (o.hasOwnProperty(p))
49127                             clone[p] = o[p];
49128                     }
49129                     return clone;
49130                 } })(levels[i]);
49131             }
49132             ;
49133         }
49134         return levels;
49135     };
49136     /**
49137      * Returns <code>true</code> if the given <code>property</code> is editable.
49138      * Depending on whether a property is editable or not, the view associated to this controller
49139      * may render it differently.
49140      * The implementation of this method always returns <code>true</code>.
49141      * @param {string} property
49142      * @return {boolean}
49143      */
49144     LevelController.prototype.isPropertyEditable = function (property) {
49145         return true;
49146     };
49147     /**
49148      * Sets the edited name.
49149      * @param {string} name
49150      */
49151     LevelController.prototype.setName = function (name) {
49152         if (name !== this.name) {
49153             var oldName = this.name;
49154             this.name = name;
49155             this.propertyChangeSupport.firePropertyChange(/* name */ "NAME", oldName, name);
49156             if (this.selectedLevelIndex != null) {
49157                 this.levels[this.selectedLevelIndex].setName(name);
49158                 this.propertyChangeSupport.firePropertyChange(/* name */ "LEVELS", null, this.levels);
49159             }
49160         }
49161     };
49162     /**
49163      * Returns the edited name.
49164      * @return {string}
49165      */
49166     LevelController.prototype.getName = function () {
49167         return this.name;
49168     };
49169     /**
49170      * Sets the edited viewable attribute.
49171      * @param {boolean} viewable
49172      */
49173     LevelController.prototype.setViewable = function (viewable) {
49174         if (viewable !== this.viewable) {
49175             var oldViewable = viewable;
49176             this.viewable = viewable;
49177             this.propertyChangeSupport.firePropertyChange(/* name */ "VIEWABLE", oldViewable, viewable);
49178             if (viewable != null && this.selectedLevelIndex != null) {
49179                 this.levels[this.selectedLevelIndex].setViewable(viewable);
49180                 this.propertyChangeSupport.firePropertyChange(/* name */ "LEVELS", null, this.levels);
49181             }
49182         }
49183     };
49184     /**
49185      * Returns the edited viewable attribute.
49186      * @return {boolean}
49187      */
49188     LevelController.prototype.getViewable = function () {
49189         return this.viewable;
49190     };
49191     LevelController.prototype.setElevation = function (elevation, updateLevels) {
49192         if (updateLevels === void 0) { updateLevels = true; }
49193         if (elevation !== this.elevation) {
49194             var oldElevation = this.elevation;
49195             this.elevation = elevation;
49196             this.propertyChangeSupport.firePropertyChange(/* name */ "ELEVATION", oldElevation, elevation);
49197             if (updateLevels && elevation != null && this.selectedLevelIndex != null) {
49198                 var elevationIndex = LevelController.updateLevelElevation(this.levels[this.selectedLevelIndex], elevation, /* asList */ this.levels.slice(0));
49199                 this.setElevationIndex(elevationIndex, false);
49200                 this.updateLevels();
49201             }
49202         }
49203     };
49204     /**
49205      * Updates the elevation of the given <code>level</code> and modifies the
49206      * elevation index of other levels if necessary.
49207      * @param {Level} level
49208      * @param {number} elevation
49209      * @param {Level[]} levels
49210      * @return {number}
49211      * @private
49212      */
49213     LevelController.updateLevelElevation = function (level, elevation, levels) {
49214         var levelIndex = levels.length;
49215         var elevationIndex = 0;
49216         for (var i = 0; i < /* size */ levels.length; i++) {
49217             {
49218                 var homeLevel = levels[i];
49219                 if (homeLevel === level) {
49220                     levelIndex = i;
49221                 }
49222                 else {
49223                     if (homeLevel.getElevation() === elevation) {
49224                         elevationIndex = homeLevel.getElevationIndex() + 1;
49225                     }
49226                     else if (i > levelIndex && homeLevel.getElevation() === level.getElevation()) {
49227                         homeLevel.setElevationIndex(homeLevel.getElevationIndex() - 1);
49228                     }
49229                 }
49230             }
49231             ;
49232         }
49233         level.setElevation(elevation);
49234         level.setElevationIndex(elevationIndex);
49235         return elevationIndex;
49236     };
49237     /**
49238      * Returns the edited elevation.
49239      * @return {number}
49240      */
49241     LevelController.prototype.getElevation = function () {
49242         return this.elevation;
49243     };
49244     LevelController.prototype.setElevationIndex = function (elevationIndex, updateLevels) {
49245         if (updateLevels === void 0) { updateLevels = true; }
49246         if (elevationIndex !== this.elevationIndex) {
49247             var oldElevationIndex = this.elevationIndex;
49248             this.elevationIndex = elevationIndex;
49249             this.propertyChangeSupport.firePropertyChange(/* name */ "ELEVATION_INDEX", oldElevationIndex, elevationIndex);
49250             if (updateLevels && elevationIndex != null && this.selectedLevelIndex != null) {
49251                 LevelController.updateLevelElevationIndex(this.levels[this.selectedLevelIndex], elevationIndex, /* asList */ this.levels.slice(0));
49252                 this.updateLevels();
49253             }
49254         }
49255     };
49256     /**
49257      * Updates the elevation index of the given <code>level</code> and modifies the
49258      * elevation index of other levels at same elevation if necessary.
49259      * @param {Level} level
49260      * @param {number} elevationIndex
49261      * @param {Level[]} levels
49262      * @private
49263      */
49264     LevelController.updateLevelElevationIndex = function (level, elevationIndex, levels) {
49265         var elevationIndexSignum = (function (f) { if (f > 0) {
49266             return 1;
49267         }
49268         else if (f < 0) {
49269             return -1;
49270         }
49271         else {
49272             return 0;
49273         } })(elevationIndex - level.getElevationIndex());
49274         for (var index = 0; index < levels.length; index++) {
49275             var homeLevel = levels[index];
49276             {
49277                 if (homeLevel !== level && homeLevel.getElevation() === level.getElevation() && /* signum */ (function (f) { if (f > 0) {
49278                     return 1;
49279                 }
49280                 else if (f < 0) {
49281                     return -1;
49282                 }
49283                 else {
49284                     return 0;
49285                 } })(homeLevel.getElevationIndex() - level.getElevationIndex()) === elevationIndexSignum && /* signum */ (function (f) { if (f > 0) {
49286                     return 1;
49287                 }
49288                 else if (f < 0) {
49289                     return -1;
49290                 }
49291                 else {
49292                     return 0;
49293                 } })(homeLevel.getElevationIndex() - elevationIndex) !== elevationIndexSignum) {
49294                     homeLevel.setElevationIndex(homeLevel.getElevationIndex() - (elevationIndexSignum | 0));
49295                 }
49296                 else if (homeLevel.getElevation() > level.getElevation()) {
49297                     break;
49298                 }
49299             }
49300         }
49301         level.setElevationIndex(elevationIndex);
49302     };
49303     LevelController.prototype.updateLevels = function () {
49304         var tempHome = new Home();
49305         var selectedLevel = this.levels[this.selectedLevelIndex];
49306         for (var index = 0; index < this.levels.length; index++) {
49307             var homeLevel = this.levels[index];
49308             {
49309                 tempHome.addLevel(homeLevel);
49310             }
49311         }
49312         var updatedLevels = tempHome.getLevels();
49313         this.setLevels(/* toArray */ updatedLevels.slice(0));
49314         this.setSelectedLevelIndex(updatedLevels.indexOf(selectedLevel));
49315     };
49316     /**
49317      * Returns the edited elevation index.
49318      * @return {number}
49319      */
49320     LevelController.prototype.getElevationIndex = function () {
49321         return this.elevationIndex;
49322     };
49323     /**
49324      * Sets the edited floor thickness.
49325      * @param {number} floorThickness
49326      */
49327     LevelController.prototype.setFloorThickness = function (floorThickness) {
49328         if (floorThickness !== this.floorThickness) {
49329             var oldFloorThickness = this.floorThickness;
49330             this.floorThickness = floorThickness;
49331             this.propertyChangeSupport.firePropertyChange(/* name */ "FLOOR_THICKNESS", oldFloorThickness, floorThickness);
49332             if (floorThickness != null && this.selectedLevelIndex != null) {
49333                 this.levels[this.selectedLevelIndex].setFloorThickness(floorThickness);
49334                 this.propertyChangeSupport.firePropertyChange(/* name */ "LEVELS", null, this.levels);
49335             }
49336         }
49337     };
49338     /**
49339      * Returns the edited floor thickness.
49340      * @return {number}
49341      */
49342     LevelController.prototype.getFloorThickness = function () {
49343         return this.floorThickness;
49344     };
49345     /**
49346      * Sets the edited height.
49347      * @param {number} height
49348      */
49349     LevelController.prototype.setHeight = function (height) {
49350         if (height !== this.height) {
49351             var oldHeight = this.height;
49352             this.height = height;
49353             this.propertyChangeSupport.firePropertyChange(/* name */ "HEIGHT", oldHeight, height);
49354             if (height != null && this.selectedLevelIndex != null) {
49355                 this.levels[this.selectedLevelIndex].setHeight(height);
49356                 this.propertyChangeSupport.firePropertyChange(/* name */ "LEVELS", null, this.levels);
49357             }
49358         }
49359     };
49360     /**
49361      * Returns the edited height.
49362      * @return {number}
49363      */
49364     LevelController.prototype.getHeight = function () {
49365         return this.height;
49366     };
49367     /**
49368      * Sets home levels.
49369      * @param {com.eteks.sweethome3d.model.Level[]} levels
49370      * @private
49371      */
49372     LevelController.prototype.setLevels = function (levels) {
49373         if (levels !== this.levels) {
49374             var oldLevels = this.levels;
49375             this.levels = levels;
49376             this.propertyChangeSupport.firePropertyChange(/* name */ "LEVELS", oldLevels, levels);
49377         }
49378     };
49379     /**
49380      * Returns a copy of home levels.
49381      * @return {com.eteks.sweethome3d.model.Level[]}
49382      */
49383     LevelController.prototype.getLevels = function () {
49384         return /* clone */ this.levels.slice(0);
49385     };
49386     /**
49387      * Sets the selected level index.
49388      * @param {number} selectedLevelIndex
49389      * @private
49390      */
49391     LevelController.prototype.setSelectedLevelIndex = function (selectedLevelIndex) {
49392         if (selectedLevelIndex !== this.selectedLevelIndex) {
49393             var oldSelectedLevelIndex = this.selectedLevelIndex;
49394             this.selectedLevelIndex = selectedLevelIndex;
49395             this.propertyChangeSupport.firePropertyChange(/* name */ "SELECT_LEVEL_INDEX", oldSelectedLevelIndex, selectedLevelIndex);
49396         }
49397     };
49398     /**
49399      * Returns the selected level index.
49400      * @return {number}
49401      */
49402     LevelController.prototype.getSelectedLevelIndex = function () {
49403         return this.selectedLevelIndex;
49404     };
49405     /**
49406      * Controls the modification of selected level in the edited home.
49407      */
49408     LevelController.prototype.modifyLevels = function () {
49409         var selectedLevel = this.home.getSelectedLevel();
49410         if (selectedLevel != null) {
49411             var oldSelection = this.home.getSelectedItems();
49412             var name_14 = this.getName();
49413             var viewable = this.getViewable();
49414             var elevation = this.getElevation();
49415             var floorThickness = this.getFloorThickness();
49416             var height = this.getHeight();
49417             var elevationIndex = this.getElevationIndex();
49418             var modifiedLevel = new LevelController.ModifiedLevel(selectedLevel);
49419             LevelController.doModifyLevel(this.home, modifiedLevel, name_14, viewable, elevation, floorThickness, height, elevationIndex);
49420             if (this.undoSupport != null) {
49421                 var undoableEdit = new LevelController.LevelModificationUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), modifiedLevel, name_14, viewable, elevation, floorThickness, height, elevationIndex);
49422                 this.undoSupport.postEdit(undoableEdit);
49423             }
49424             if (name_14 != null) {
49425                 this.preferences.addAutoCompletionString("LevelName", name_14);
49426             }
49427         }
49428     };
49429     /**
49430      * Modifies level properties with the values in parameter.
49431      * @param {Home} home
49432      * @param {LevelController.ModifiedLevel} modifiedLevel
49433      * @param {string} name
49434      * @param {boolean} viewable
49435      * @param {number} elevation
49436      * @param {number} floorThickness
49437      * @param {number} height
49438      * @param {number} elevationIndex
49439      * @private
49440      */
49441     LevelController.doModifyLevel = function (home, modifiedLevel, name, viewable, elevation, floorThickness, height, elevationIndex) {
49442         var level = modifiedLevel.getLevel();
49443         if (name != null) {
49444             level.setName(name);
49445         }
49446         if (viewable != null) {
49447             var selectedItems = home.getSelectedItems();
49448             level.setViewable(viewable);
49449             home.setSelectedItems(LevelController.getViewableSublist(selectedItems));
49450         }
49451         if (elevation != null && elevation !== level.getElevation()) {
49452             LevelController.updateLevelElevation(level, elevation, home.getLevels());
49453         }
49454         if (elevationIndex != null) {
49455             LevelController.updateLevelElevationIndex(level, elevationIndex, home.getLevels());
49456         }
49457         if (!home.getEnvironment().isAllLevelsVisible()) {
49458             var selectedLevel = home.getSelectedLevel();
49459             var visible = true;
49460             {
49461                 var array = home.getLevels();
49462                 for (var index = 0; index < array.length; index++) {
49463                     var homeLevel = array[index];
49464                     {
49465                         homeLevel.setVisible(visible);
49466                         if (homeLevel === selectedLevel) {
49467                             visible = false;
49468                         }
49469                     }
49470                 }
49471             }
49472         }
49473         if (floorThickness != null) {
49474             level.setFloorThickness(floorThickness);
49475         }
49476         if (height != null) {
49477             level.setHeight(height);
49478         }
49479     };
49480     /**
49481      * Returns a sub list of <code>items</code> that are at a viewable level.
49482      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items
49483      * @return {*[]}
49484      * @private
49485      */
49486     LevelController.getViewableSublist = function (items) {
49487         var viewableItems = ([]);
49488         for (var index = 0; index < items.length; index++) {
49489             var item = items[index];
49490             {
49491                 if (!(item != null && (item.constructor != null && item.constructor["__interfaces"] != null && item.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Elevatable") >= 0)) || item.getLevel().isViewable()) {
49492                     /* add */ (viewableItems.push(item) > 0);
49493                 }
49494             }
49495         }
49496         return viewableItems;
49497     };
49498     /**
49499      * Restores level properties from the values stored in <code>modifiedLevel</code>.
49500      * @param {Home} home
49501      * @param {LevelController.ModifiedLevel} modifiedLevel
49502      * @private
49503      */
49504     LevelController.undoModifyLevel = function (home, modifiedLevel) {
49505         modifiedLevel.reset();
49506         var level = modifiedLevel.getLevel();
49507         if (modifiedLevel.getElevation() !== level.getElevation()) {
49508             LevelController.updateLevelElevation(level, modifiedLevel.getElevation(), home.getLevels());
49509         }
49510         if (modifiedLevel.getElevationIndex() !== level.getElevationIndex()) {
49511             LevelController.updateLevelElevationIndex(level, modifiedLevel.getElevationIndex(), home.getLevels());
49512         }
49513     };
49514     return LevelController;
49515 }());
49516 LevelController["__class"] = "com.eteks.sweethome3d.viewcontroller.LevelController";
49517 LevelController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
49518 (function (LevelController) {
49519     /**
49520      * Undoable edit for level modification. This class isn't anonymous to avoid
49521      * being bound to controller and its view.
49522      * @extends LocalizedUndoableEdit
49523      * @class
49524      */
49525     var LevelModificationUndoableEdit = /** @class */ (function (_super) {
49526         __extends(LevelModificationUndoableEdit, _super);
49527         function LevelModificationUndoableEdit(home, preferences, oldSelection, modifiedLevel, name, viewable, elevation, floorThickness, height, elevationIndex) {
49528             var _this = _super.call(this, preferences, LevelController, "undoModifyLevelName") || this;
49529             if (_this.home === undefined) {
49530                 _this.home = null;
49531             }
49532             if (_this.oldSelection === undefined) {
49533                 _this.oldSelection = null;
49534             }
49535             if (_this.modifiedLevel === undefined) {
49536                 _this.modifiedLevel = null;
49537             }
49538             if (_this.name === undefined) {
49539                 _this.name = null;
49540             }
49541             if (_this.viewable === undefined) {
49542                 _this.viewable = null;
49543             }
49544             if (_this.elevation === undefined) {
49545                 _this.elevation = null;
49546             }
49547             if (_this.floorThickness === undefined) {
49548                 _this.floorThickness = null;
49549             }
49550             if (_this.height === undefined) {
49551                 _this.height = null;
49552             }
49553             if (_this.elevationIndex === undefined) {
49554                 _this.elevationIndex = null;
49555             }
49556             _this.home = home;
49557             _this.oldSelection = oldSelection;
49558             _this.modifiedLevel = modifiedLevel;
49559             _this.name = name;
49560             _this.viewable = viewable;
49561             _this.elevation = elevation;
49562             _this.floorThickness = floorThickness;
49563             _this.height = height;
49564             _this.elevationIndex = elevationIndex;
49565             return _this;
49566         }
49567         /**
49568          *
49569          */
49570         LevelModificationUndoableEdit.prototype.undo = function () {
49571             _super.prototype.undo.call(this);
49572             LevelController.undoModifyLevel(this.home, this.modifiedLevel);
49573             this.home.setSelectedLevel(this.modifiedLevel.getLevel());
49574             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
49575         };
49576         /**
49577          *
49578          */
49579         LevelModificationUndoableEdit.prototype.redo = function () {
49580             _super.prototype.redo.call(this);
49581             this.home.setSelectedLevel(this.modifiedLevel.getLevel());
49582             LevelController.doModifyLevel(this.home, this.modifiedLevel, this.name, this.viewable, this.elevation, this.floorThickness, this.height, this.elevationIndex);
49583         };
49584         return LevelModificationUndoableEdit;
49585     }(LocalizedUndoableEdit));
49586     LevelController.LevelModificationUndoableEdit = LevelModificationUndoableEdit;
49587     LevelModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.LevelController.LevelModificationUndoableEdit";
49588     LevelModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
49589     /**
49590      * Stores the current properties values of a modified level.
49591      * @param {Level} level
49592      * @class
49593      */
49594     var ModifiedLevel = /** @class */ (function () {
49595         function ModifiedLevel(level) {
49596             if (this.level === undefined) {
49597                 this.level = null;
49598             }
49599             if (this.name === undefined) {
49600                 this.name = null;
49601             }
49602             if (this.viewable === undefined) {
49603                 this.viewable = false;
49604             }
49605             if (this.elevation === undefined) {
49606                 this.elevation = 0;
49607             }
49608             if (this.floorThickness === undefined) {
49609                 this.floorThickness = 0;
49610             }
49611             if (this.height === undefined) {
49612                 this.height = 0;
49613             }
49614             if (this.elevationIndex === undefined) {
49615                 this.elevationIndex = 0;
49616             }
49617             this.level = level;
49618             this.name = level.getName();
49619             this.viewable = level.isViewable();
49620             this.elevation = level.getElevation();
49621             this.floorThickness = level.getFloorThickness();
49622             this.height = level.getHeight();
49623             this.elevationIndex = level.getElevationIndex();
49624         }
49625         ModifiedLevel.prototype.getLevel = function () {
49626             return this.level;
49627         };
49628         ModifiedLevel.prototype.getElevation = function () {
49629             return this.elevation;
49630         };
49631         ModifiedLevel.prototype.getElevationIndex = function () {
49632             return this.elevationIndex;
49633         };
49634         ModifiedLevel.prototype.reset = function () {
49635             this.level.setName(this.name);
49636             this.level.setViewable(this.viewable);
49637             this.level.setFloorThickness(this.floorThickness);
49638             this.level.setHeight(this.height);
49639         };
49640         return ModifiedLevel;
49641     }());
49642     LevelController.ModifiedLevel = ModifiedLevel;
49643     ModifiedLevel["__class"] = "com.eteks.sweethome3d.viewcontroller.LevelController.ModifiedLevel";
49644 })(LevelController || (LevelController = {}));
49645 /**
49646  * Creates the controller of wall view with undo support.
49647  * @param {Home} home
49648  * @param {UserPreferences} preferences
49649  * @param {Object} viewFactory
49650  * @param {Object} contentManager
49651  * @param {javax.swing.undo.UndoableEditSupport} undoSupport
49652  * @class
49653  * @author Emmanuel Puybaret
49654  */
49655 var WallController = /** @class */ (function () {
49656     function WallController(home, preferences, viewFactory, contentManager, undoSupport) {
49657         if (this.home === undefined) {
49658             this.home = null;
49659         }
49660         if (this.preferences === undefined) {
49661             this.preferences = null;
49662         }
49663         if (this.viewFactory === undefined) {
49664             this.viewFactory = null;
49665         }
49666         if (this.contentManager === undefined) {
49667             this.contentManager = null;
49668         }
49669         if (this.undoSupport === undefined) {
49670             this.undoSupport = null;
49671         }
49672         if (this.leftSideTextureController === undefined) {
49673             this.leftSideTextureController = null;
49674         }
49675         if (this.leftSideBaseboardController === undefined) {
49676             this.leftSideBaseboardController = null;
49677         }
49678         if (this.rightSideTextureController === undefined) {
49679             this.rightSideTextureController = null;
49680         }
49681         if (this.rightSideBaseboardController === undefined) {
49682             this.rightSideBaseboardController = null;
49683         }
49684         if (this.propertyChangeSupport === undefined) {
49685             this.propertyChangeSupport = null;
49686         }
49687         if (this.wallView === undefined) {
49688             this.wallView = null;
49689         }
49690         if (this.editablePoints === undefined) {
49691             this.editablePoints = false;
49692         }
49693         if (this.xStart === undefined) {
49694             this.xStart = null;
49695         }
49696         if (this.yStart === undefined) {
49697             this.yStart = null;
49698         }
49699         if (this.xEnd === undefined) {
49700             this.xEnd = null;
49701         }
49702         if (this.yEnd === undefined) {
49703             this.yEnd = null;
49704         }
49705         if (this.length === undefined) {
49706             this.length = null;
49707         }
49708         if (this.distanceToEndPoint === undefined) {
49709             this.distanceToEndPoint = null;
49710         }
49711         if (this.leftSideColor === undefined) {
49712             this.leftSideColor = null;
49713         }
49714         if (this.leftSidePaint === undefined) {
49715             this.leftSidePaint = null;
49716         }
49717         if (this.leftSideShininess === undefined) {
49718             this.leftSideShininess = null;
49719         }
49720         if (this.rightSideColor === undefined) {
49721             this.rightSideColor = null;
49722         }
49723         if (this.rightSidePaint === undefined) {
49724             this.rightSidePaint = null;
49725         }
49726         if (this.rightSideShininess === undefined) {
49727             this.rightSideShininess = null;
49728         }
49729         if (this.pattern === undefined) {
49730             this.pattern = null;
49731         }
49732         if (this.topColor === undefined) {
49733             this.topColor = null;
49734         }
49735         if (this.topPaint === undefined) {
49736             this.topPaint = null;
49737         }
49738         if (this.shape === undefined) {
49739             this.shape = null;
49740         }
49741         if (this.rectangularWallHeight === undefined) {
49742             this.rectangularWallHeight = null;
49743         }
49744         if (this.slopingWallHeightAtStart === undefined) {
49745             this.slopingWallHeightAtStart = null;
49746         }
49747         if (this.sloppingWallHeightAtEnd === undefined) {
49748             this.sloppingWallHeightAtEnd = null;
49749         }
49750         if (this.thickness === undefined) {
49751             this.thickness = null;
49752         }
49753         if (this.arcExtentInDegrees === undefined) {
49754             this.arcExtentInDegrees = null;
49755         }
49756         this.home = home;
49757         this.preferences = preferences;
49758         this.viewFactory = viewFactory;
49759         this.contentManager = contentManager;
49760         this.undoSupport = undoSupport;
49761         this.propertyChangeSupport = new PropertyChangeSupport(this);
49762         this.updateProperties();
49763     }
49764     /**
49765      * Returns the texture controller of the wall left side.
49766      * @return {TextureChoiceController}
49767      */
49768     WallController.prototype.getLeftSideTextureController = function () {
49769         if (this.leftSideTextureController == null) {
49770             this.leftSideTextureController = new TextureChoiceController(this.preferences.getLocalizedString(WallController, "leftSideTextureTitle"), this.preferences, this.viewFactory, this.contentManager);
49771             this.leftSideTextureController.addPropertyChangeListener("TEXTURE", new WallController.WallController$0(this));
49772         }
49773         return this.leftSideTextureController;
49774     };
49775     /**
49776      * Returns the controller of the wall left side baseboard.
49777      * @return {BaseboardChoiceController}
49778      */
49779     WallController.prototype.getLeftSideBaseboardController = function () {
49780         if (this.leftSideBaseboardController == null) {
49781             this.leftSideBaseboardController = new BaseboardChoiceController(this.preferences, this.viewFactory, this.contentManager);
49782         }
49783         return this.leftSideBaseboardController;
49784     };
49785     /**
49786      * Returns the texture controller of the wall right side.
49787      * @return {TextureChoiceController}
49788      */
49789     WallController.prototype.getRightSideTextureController = function () {
49790         if (this.rightSideTextureController == null) {
49791             this.rightSideTextureController = new TextureChoiceController(this.preferences.getLocalizedString(WallController, "rightSideTextureTitle"), this.preferences, this.viewFactory, this.contentManager);
49792             this.rightSideTextureController.addPropertyChangeListener("TEXTURE", new WallController.WallController$1(this));
49793         }
49794         return this.rightSideTextureController;
49795     };
49796     /**
49797      * Returns the controller of the wall right side baseboard.
49798      * @return {BaseboardChoiceController}
49799      */
49800     WallController.prototype.getRightSideBaseboardController = function () {
49801         if (this.rightSideBaseboardController == null) {
49802             this.rightSideBaseboardController = new BaseboardChoiceController(this.preferences, this.viewFactory, this.contentManager);
49803         }
49804         return this.rightSideBaseboardController;
49805     };
49806     /**
49807      * Returns the view associated with this controller.
49808      * @return {Object}
49809      */
49810     WallController.prototype.getView = function () {
49811         if (this.wallView == null) {
49812             this.wallView = this.viewFactory.createWallView(this.preferences, this);
49813         }
49814         return this.wallView;
49815     };
49816     /**
49817      * Displays the view controlled by this controller.
49818      * @param {Object} parentView
49819      */
49820     WallController.prototype.displayView = function (parentView) {
49821         this.getView().displayView(parentView);
49822     };
49823     /**
49824      * Adds the property change <code>listener</code> in parameter to this controller.
49825      * @param {string} property
49826      * @param {PropertyChangeListener} listener
49827      */
49828     WallController.prototype.addPropertyChangeListener = function (property, listener) {
49829         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
49830     };
49831     /**
49832      * Removes the property change <code>listener</code> in parameter from this controller.
49833      * @param {string} property
49834      * @param {PropertyChangeListener} listener
49835      */
49836     WallController.prototype.removePropertyChangeListener = function (property, listener) {
49837         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
49838     };
49839     /**
49840      * Updates edited properties from selected walls in the home edited by this controller.
49841      */
49842     WallController.prototype.updateProperties = function () {
49843         var selectedWalls = Home.getWallsSubList(this.home.getSelectedItems());
49844         if ( /* isEmpty */(selectedWalls.length == 0)) {
49845             this.setXStart(null);
49846             this.setYStart(null);
49847             this.setXEnd(null);
49848             this.setYEnd(null);
49849             this.setEditablePoints(false);
49850             this.setLeftSideColor(null);
49851             this.getLeftSideTextureController().setTexture(null);
49852             this.setLeftSidePaint(null);
49853             this.setLeftSideShininess(null);
49854             this.getLeftSideBaseboardController().setVisible(null);
49855             this.getLeftSideBaseboardController().setThickness(null);
49856             this.getLeftSideBaseboardController().setHeight(null);
49857             this.getLeftSideBaseboardController().setColor(null);
49858             this.getLeftSideBaseboardController().getTextureController().setTexture(null);
49859             this.getLeftSideBaseboardController().setPaint(null);
49860             this.setRightSideColor(null);
49861             this.getRightSideTextureController().setTexture(null);
49862             this.setRightSidePaint(null);
49863             this.setRightSideShininess(null);
49864             this.getRightSideBaseboardController().setVisible(null);
49865             this.getRightSideBaseboardController().setThickness(null);
49866             this.getRightSideBaseboardController().setHeight(null);
49867             this.getRightSideBaseboardController().setColor(null);
49868             this.getRightSideBaseboardController().getTextureController().setTexture(null);
49869             this.getRightSideBaseboardController().setPaint(null);
49870             this.setPattern(null);
49871             this.setTopColor(null);
49872             this.setTopPaint(null);
49873             this.setRectangularWallHeight(null);
49874             this.setSlopingWallHeightAtStart(null);
49875             this.setSlopingWallHeightAtEnd(null);
49876             this.setShape(null);
49877             this.setThickness(null);
49878             this.setArcExtentInDegrees(null);
49879         }
49880         else {
49881             var firstWall = selectedWalls[0];
49882             var multipleSelection = selectedWalls.length > 1;
49883             this.setEditablePoints(!multipleSelection);
49884             var xStart = firstWall.getXStart();
49885             for (var i = 1; i < /* size */ selectedWalls.length; i++) {
49886                 {
49887                     if (!(xStart === /* get */ selectedWalls[i].getXStart())) {
49888                         xStart = null;
49889                         break;
49890                     }
49891                 }
49892                 ;
49893             }
49894             this.setXStart(xStart);
49895             var yStart = firstWall.getYStart();
49896             for (var i = 1; i < /* size */ selectedWalls.length; i++) {
49897                 {
49898                     if (!(yStart === /* get */ selectedWalls[i].getYStart())) {
49899                         yStart = null;
49900                         break;
49901                     }
49902                 }
49903                 ;
49904             }
49905             this.setYStart(yStart);
49906             var xEnd = firstWall.getXEnd();
49907             for (var i = 1; i < /* size */ selectedWalls.length; i++) {
49908                 {
49909                     if (!(xEnd === /* get */ selectedWalls[i].getXEnd())) {
49910                         xEnd = null;
49911                         break;
49912                     }
49913                 }
49914                 ;
49915             }
49916             this.setXEnd(xEnd);
49917             var yEnd = firstWall.getYEnd();
49918             for (var i = 1; i < /* size */ selectedWalls.length; i++) {
49919                 {
49920                     if (!(yEnd === /* get */ selectedWalls[i].getYEnd())) {
49921                         yEnd = null;
49922                         break;
49923                     }
49924                 }
49925                 ;
49926             }
49927             this.setYEnd(yEnd);
49928             var leftSideColor = firstWall.getLeftSideColor();
49929             if (leftSideColor != null) {
49930                 for (var i = 1; i < /* size */ selectedWalls.length; i++) {
49931                     {
49932                         if (!(leftSideColor === /* get */ selectedWalls[i].getLeftSideColor())) {
49933                             leftSideColor = null;
49934                             break;
49935                         }
49936                     }
49937                     ;
49938                 }
49939             }
49940             this.setLeftSideColor(leftSideColor);
49941             var leftSideTexture = firstWall.getLeftSideTexture();
49942             if (leftSideTexture != null) {
49943                 for (var i = 1; i < /* size */ selectedWalls.length; i++) {
49944                     {
49945                         if (!leftSideTexture.equals(/* get */ selectedWalls[i].getLeftSideTexture())) {
49946                             leftSideTexture = null;
49947                             break;
49948                         }
49949                     }
49950                     ;
49951                 }
49952             }
49953             this.getLeftSideTextureController().setTexture(leftSideTexture);
49954             var defaultColorsAndTextures = true;
49955             for (var i = 0; i < /* size */ selectedWalls.length; i++) {
49956                 {
49957                     var wall = selectedWalls[i];
49958                     if (wall.getLeftSideColor() != null || wall.getLeftSideTexture() != null) {
49959                         defaultColorsAndTextures = false;
49960                         break;
49961                     }
49962                 }
49963                 ;
49964             }
49965             if (leftSideColor != null) {
49966                 this.setLeftSidePaint(WallController.WallPaint.COLORED);
49967             }
49968             else if (leftSideTexture != null) {
49969                 this.setLeftSidePaint(WallController.WallPaint.TEXTURED);
49970             }
49971             else if (defaultColorsAndTextures) {
49972                 this.setLeftSidePaint(WallController.WallPaint.DEFAULT);
49973             }
49974             else {
49975                 this.setLeftSidePaint(null);
49976             }
49977             var leftSideShininess = firstWall.getLeftSideShininess();
49978             for (var i = 1; i < /* size */ selectedWalls.length; i++) {
49979                 {
49980                     if (!(leftSideShininess === /* get */ selectedWalls[i].getLeftSideShininess())) {
49981                         leftSideShininess = null;
49982                         break;
49983                     }
49984                 }
49985                 ;
49986             }
49987             this.setLeftSideShininess(leftSideShininess);
49988             var leftSideBaseboardVisible = firstWall.getLeftSideBaseboard() != null;
49989             for (var i = 1; i < /* size */ selectedWalls.length; i++) {
49990                 {
49991                     if (leftSideBaseboardVisible !== ( /* get */selectedWalls[i].getLeftSideBaseboard() != null)) {
49992                         leftSideBaseboardVisible = null;
49993                         break;
49994                     }
49995                 }
49996                 ;
49997             }
49998             this.getLeftSideBaseboardController().setVisible(leftSideBaseboardVisible);
49999             var firstWallLeftSideBaseboard = firstWall.getLeftSideBaseboard();
50000             var leftSideBaseboardThickness = firstWallLeftSideBaseboard != null ? firstWallLeftSideBaseboard.getThickness() : this.preferences.getNewWallBaseboardThickness();
50001             for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50002                 {
50003                     var baseboard = selectedWalls[i].getLeftSideBaseboard();
50004                     if (!(leftSideBaseboardThickness === (baseboard != null ? baseboard.getThickness() : this.preferences.getNewWallBaseboardThickness()))) {
50005                         leftSideBaseboardThickness = null;
50006                         break;
50007                     }
50008                 }
50009                 ;
50010             }
50011             this.getLeftSideBaseboardController().setThickness(leftSideBaseboardThickness);
50012             var leftSideBaseboardHeight = firstWallLeftSideBaseboard != null ? firstWallLeftSideBaseboard.getHeight() : this.preferences.getNewWallBaseboardHeight();
50013             for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50014                 {
50015                     var baseboard = selectedWalls[i].getLeftSideBaseboard();
50016                     if (!(leftSideBaseboardHeight === (baseboard != null ? baseboard.getHeight() : this.preferences.getNewWallBaseboardHeight()))) {
50017                         leftSideBaseboardHeight = null;
50018                         break;
50019                     }
50020                 }
50021                 ;
50022             }
50023             this.getLeftSideBaseboardController().setHeight(leftSideBaseboardHeight);
50024             var leftSideBaseboardColor = firstWallLeftSideBaseboard != null ? firstWallLeftSideBaseboard.getColor() : null;
50025             if (leftSideBaseboardColor != null) {
50026                 for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50027                     {
50028                         var baseboard = selectedWalls[i].getLeftSideBaseboard();
50029                         if (baseboard == null || !(leftSideBaseboardColor === baseboard.getColor())) {
50030                             leftSideBaseboardColor = null;
50031                             break;
50032                         }
50033                     }
50034                     ;
50035                 }
50036             }
50037             this.getLeftSideBaseboardController().setColor(leftSideBaseboardColor);
50038             var leftSideBaseboardTexture = firstWallLeftSideBaseboard != null ? firstWallLeftSideBaseboard.getTexture() : null;
50039             if (leftSideBaseboardTexture != null) {
50040                 for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50041                     {
50042                         var baseboard = selectedWalls[i].getLeftSideBaseboard();
50043                         if (baseboard == null || !leftSideBaseboardTexture.equals(baseboard.getTexture())) {
50044                             leftSideBaseboardTexture = null;
50045                             break;
50046                         }
50047                     }
50048                     ;
50049                 }
50050             }
50051             this.getLeftSideBaseboardController().getTextureController().setTexture(leftSideBaseboardTexture);
50052             defaultColorsAndTextures = true;
50053             for (var i = 0; i < /* size */ selectedWalls.length; i++) {
50054                 {
50055                     var baseboard = selectedWalls[i].getLeftSideBaseboard();
50056                     if (baseboard != null && (baseboard.getColor() != null || baseboard.getTexture() != null)) {
50057                         defaultColorsAndTextures = false;
50058                         break;
50059                     }
50060                 }
50061                 ;
50062             }
50063             if (leftSideBaseboardColor != null) {
50064                 this.getLeftSideBaseboardController().setPaint(BaseboardChoiceController.BaseboardPaint.COLORED);
50065             }
50066             else if (leftSideBaseboardTexture != null) {
50067                 this.getLeftSideBaseboardController().setPaint(BaseboardChoiceController.BaseboardPaint.TEXTURED);
50068             }
50069             else if (defaultColorsAndTextures) {
50070                 this.getLeftSideBaseboardController().setPaint(BaseboardChoiceController.BaseboardPaint.DEFAULT);
50071             }
50072             else {
50073                 this.getLeftSideBaseboardController().setPaint(null);
50074             }
50075             var rightSideColor = firstWall.getRightSideColor();
50076             if (rightSideColor != null) {
50077                 for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50078                     {
50079                         if (!(rightSideColor === /* get */ selectedWalls[i].getRightSideColor())) {
50080                             rightSideColor = null;
50081                             break;
50082                         }
50083                     }
50084                     ;
50085                 }
50086             }
50087             this.setRightSideColor(rightSideColor);
50088             var rightSideTexture = firstWall.getRightSideTexture();
50089             if (rightSideTexture != null) {
50090                 for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50091                     {
50092                         if (!rightSideTexture.equals(/* get */ selectedWalls[i].getRightSideTexture())) {
50093                             rightSideTexture = null;
50094                             break;
50095                         }
50096                     }
50097                     ;
50098                 }
50099             }
50100             this.getRightSideTextureController().setTexture(rightSideTexture);
50101             defaultColorsAndTextures = true;
50102             for (var i = 0; i < /* size */ selectedWalls.length; i++) {
50103                 {
50104                     var wall = selectedWalls[i];
50105                     if (wall.getRightSideColor() != null || wall.getRightSideTexture() != null) {
50106                         defaultColorsAndTextures = false;
50107                         break;
50108                     }
50109                 }
50110                 ;
50111             }
50112             if (rightSideColor != null) {
50113                 this.setRightSidePaint(WallController.WallPaint.COLORED);
50114             }
50115             else if (rightSideTexture != null) {
50116                 this.setRightSidePaint(WallController.WallPaint.TEXTURED);
50117             }
50118             else if (defaultColorsAndTextures) {
50119                 this.setRightSidePaint(WallController.WallPaint.DEFAULT);
50120             }
50121             else {
50122                 this.setRightSidePaint(null);
50123             }
50124             var rightSideShininess = firstWall.getRightSideShininess();
50125             for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50126                 {
50127                     if (!(rightSideShininess === /* get */ selectedWalls[i].getRightSideShininess())) {
50128                         rightSideShininess = null;
50129                         break;
50130                     }
50131                 }
50132                 ;
50133             }
50134             this.setRightSideShininess(rightSideShininess);
50135             var rightSideBaseboardVisible = firstWall.getRightSideBaseboard() != null;
50136             for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50137                 {
50138                     if (rightSideBaseboardVisible !== ( /* get */selectedWalls[i].getRightSideBaseboard() != null)) {
50139                         rightSideBaseboardVisible = null;
50140                         break;
50141                     }
50142                 }
50143                 ;
50144             }
50145             this.getRightSideBaseboardController().setVisible(rightSideBaseboardVisible);
50146             var firstWallRightSideBaseboard = firstWall.getRightSideBaseboard();
50147             var rightSideBaseboardThickness = firstWallRightSideBaseboard != null ? firstWallRightSideBaseboard.getThickness() : this.preferences.getNewWallBaseboardThickness();
50148             for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50149                 {
50150                     var baseboard = selectedWalls[i].getRightSideBaseboard();
50151                     if (!(rightSideBaseboardThickness === (baseboard != null ? baseboard.getThickness() : this.preferences.getNewWallBaseboardThickness()))) {
50152                         rightSideBaseboardThickness = null;
50153                         break;
50154                     }
50155                 }
50156                 ;
50157             }
50158             this.getRightSideBaseboardController().setThickness(rightSideBaseboardThickness);
50159             var rightSideBaseboardHeight = firstWallRightSideBaseboard != null ? firstWallRightSideBaseboard.getHeight() : this.preferences.getNewWallBaseboardHeight();
50160             for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50161                 {
50162                     var baseboard = selectedWalls[i].getRightSideBaseboard();
50163                     if (!(rightSideBaseboardHeight === (baseboard != null ? baseboard.getHeight() : this.preferences.getNewWallBaseboardHeight()))) {
50164                         rightSideBaseboardHeight = null;
50165                         break;
50166                     }
50167                 }
50168                 ;
50169             }
50170             this.getRightSideBaseboardController().setHeight(rightSideBaseboardHeight);
50171             var rightSideBaseboardColor = firstWallRightSideBaseboard != null ? firstWallRightSideBaseboard.getColor() : null;
50172             if (rightSideBaseboardColor != null) {
50173                 for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50174                     {
50175                         var baseboard = selectedWalls[i].getRightSideBaseboard();
50176                         if (baseboard == null || !(rightSideBaseboardColor === baseboard.getColor())) {
50177                             rightSideBaseboardColor = null;
50178                             break;
50179                         }
50180                     }
50181                     ;
50182                 }
50183             }
50184             this.getRightSideBaseboardController().setColor(rightSideBaseboardColor);
50185             var rightSideBaseboardTexture = firstWallRightSideBaseboard != null ? firstWallRightSideBaseboard.getTexture() : null;
50186             if (rightSideBaseboardTexture != null) {
50187                 for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50188                     {
50189                         var baseboard = selectedWalls[i].getRightSideBaseboard();
50190                         if (baseboard == null || !rightSideBaseboardTexture.equals(baseboard.getTexture())) {
50191                             rightSideBaseboardTexture = null;
50192                             break;
50193                         }
50194                     }
50195                     ;
50196                 }
50197             }
50198             this.getRightSideBaseboardController().getTextureController().setTexture(rightSideBaseboardTexture);
50199             defaultColorsAndTextures = true;
50200             for (var i = 0; i < /* size */ selectedWalls.length; i++) {
50201                 {
50202                     var baseboard = selectedWalls[i].getRightSideBaseboard();
50203                     if (baseboard != null && (baseboard.getColor() != null || baseboard.getTexture() != null)) {
50204                         defaultColorsAndTextures = false;
50205                         break;
50206                     }
50207                 }
50208                 ;
50209             }
50210             if (rightSideBaseboardColor != null) {
50211                 this.getRightSideBaseboardController().setPaint(BaseboardChoiceController.BaseboardPaint.COLORED);
50212             }
50213             else if (rightSideBaseboardTexture != null) {
50214                 this.getRightSideBaseboardController().setPaint(BaseboardChoiceController.BaseboardPaint.TEXTURED);
50215             }
50216             else if (defaultColorsAndTextures) {
50217                 this.getRightSideBaseboardController().setPaint(BaseboardChoiceController.BaseboardPaint.DEFAULT);
50218             }
50219             else {
50220                 this.getRightSideBaseboardController().setPaint(null);
50221             }
50222             var pattern = firstWall.getPattern();
50223             if (pattern == null) {
50224                 pattern = this.preferences.getWallPattern();
50225             }
50226             for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50227                 {
50228                     var otherPattern = selectedWalls[i].getPattern();
50229                     if (otherPattern == null) {
50230                         otherPattern = this.preferences.getWallPattern();
50231                     }
50232                     if (!(function (o1, o2) { if (o1 && o1.equals) {
50233                         return o1.equals(o2);
50234                     }
50235                     else {
50236                         return o1 === o2;
50237                     } })(pattern, otherPattern)) {
50238                         pattern = null;
50239                         break;
50240                     }
50241                 }
50242                 ;
50243             }
50244             this.setPattern(pattern);
50245             var topColor = firstWall.getTopColor();
50246             var defaultTopColor = void 0;
50247             if (topColor != null) {
50248                 defaultTopColor = false;
50249                 for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50250                     {
50251                         if (!(topColor === /* get */ selectedWalls[i].getTopColor())) {
50252                             topColor = null;
50253                             break;
50254                         }
50255                     }
50256                     ;
50257                 }
50258             }
50259             else {
50260                 defaultTopColor = true;
50261                 for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50262                     {
50263                         if ( /* get */selectedWalls[i].getTopColor() != null) {
50264                             defaultTopColor = false;
50265                             break;
50266                         }
50267                     }
50268                     ;
50269                 }
50270             }
50271             this.setTopColor(topColor);
50272             if (defaultTopColor) {
50273                 this.setTopPaint(WallController.WallPaint.DEFAULT);
50274             }
50275             else if (topColor != null) {
50276                 this.setTopPaint(WallController.WallPaint.COLORED);
50277             }
50278             else {
50279                 this.setTopPaint(null);
50280             }
50281             var height = firstWall.getHeight();
50282             if (height == null && firstWall.getHeight() == null) {
50283                 height = this.home.getWallHeight();
50284             }
50285             for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50286                 {
50287                     var wall = selectedWalls[i];
50288                     var wallHeight = wall.getHeight() == null ? this.home.getWallHeight() : wall.getHeight();
50289                     if (height !== wallHeight) {
50290                         height = null;
50291                         break;
50292                     }
50293                 }
50294                 ;
50295             }
50296             this.setRectangularWallHeight(height);
50297             this.setSlopingWallHeightAtStart(height);
50298             var heightAtEnd = firstWall.getHeightAtEnd();
50299             if (heightAtEnd != null) {
50300                 for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50301                     {
50302                         if (!(heightAtEnd === /* get */ selectedWalls[i].getHeightAtEnd())) {
50303                             heightAtEnd = null;
50304                             break;
50305                         }
50306                     }
50307                     ;
50308                 }
50309             }
50310             this.setSlopingWallHeightAtEnd(heightAtEnd == null && /* size */ selectedWalls.length === 1 ? height : heightAtEnd);
50311             var allWallsRectangular = !firstWall.isTrapezoidal();
50312             var allWallsTrapezoidal = firstWall.isTrapezoidal();
50313             for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50314                 {
50315                     if (!selectedWalls[i].isTrapezoidal()) {
50316                         allWallsTrapezoidal = false;
50317                     }
50318                     else {
50319                         allWallsRectangular = false;
50320                     }
50321                 }
50322                 ;
50323             }
50324             if (allWallsRectangular) {
50325                 this.setShape(WallController.WallShape.RECTANGULAR_WALL);
50326             }
50327             else if (allWallsTrapezoidal) {
50328                 this.setShape(WallController.WallShape.SLOPING_WALL);
50329             }
50330             else {
50331                 this.setShape(null);
50332             }
50333             var thickness = firstWall.getThickness();
50334             for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50335                 {
50336                     if (thickness !== /* get */ selectedWalls[i].getThickness()) {
50337                         thickness = null;
50338                         break;
50339                     }
50340                 }
50341                 ;
50342             }
50343             this.setThickness(thickness);
50344             var arcExtent = firstWall.getArcExtent();
50345             if (arcExtent != null) {
50346                 for (var i = 1; i < /* size */ selectedWalls.length; i++) {
50347                     {
50348                         if (!(arcExtent === /* get */ selectedWalls[i].getArcExtent())) {
50349                             arcExtent = null;
50350                             break;
50351                         }
50352                     }
50353                     ;
50354                 }
50355             }
50356             if (arcExtent != null) {
50357                 this.setArcExtentInDegrees((function (x) { return x * 180 / Math.PI; })(arcExtent));
50358             }
50359             else {
50360                 this.setArcExtentInDegrees(/* size */ selectedWalls.length === 1 ? new Number(0).valueOf() : null);
50361             }
50362         }
50363     };
50364     /**
50365      * Sets the edited abscissa of the start point.
50366      * @param {number} xStart
50367      */
50368     WallController.prototype.setXStart = function (xStart) {
50369         if (xStart !== this.xStart) {
50370             var oldXStart = this.xStart;
50371             this.xStart = xStart;
50372             this.propertyChangeSupport.firePropertyChange(/* name */ "X_START", oldXStart, xStart);
50373             this.updateLength();
50374             this.updateDistanceToEndPoint();
50375         }
50376     };
50377     /**
50378      * Returns the edited abscissa of the start point.
50379      * @return {number}
50380      */
50381     WallController.prototype.getXStart = function () {
50382         return this.xStart;
50383     };
50384     /**
50385      * Sets the edited ordinate of the start point.
50386      * @param {number} yStart
50387      */
50388     WallController.prototype.setYStart = function (yStart) {
50389         if (yStart !== this.yStart) {
50390             var oldYStart = this.yStart;
50391             this.yStart = yStart;
50392             this.propertyChangeSupport.firePropertyChange(/* name */ "Y_START", oldYStart, yStart);
50393             this.updateLength();
50394             this.updateDistanceToEndPoint();
50395         }
50396     };
50397     /**
50398      * Returns the edited ordinate of the start point.
50399      * @return {number}
50400      */
50401     WallController.prototype.getYStart = function () {
50402         return this.yStart;
50403     };
50404     /**
50405      * Sets the edited abscissa of the end point.
50406      * @param {number} xEnd
50407      */
50408     WallController.prototype.setXEnd = function (xEnd) {
50409         if (xEnd !== this.xEnd) {
50410             var oldXEnd = this.xEnd;
50411             this.xEnd = xEnd;
50412             this.propertyChangeSupport.firePropertyChange(/* name */ "X_END", oldXEnd, xEnd);
50413             this.updateLength();
50414             this.updateDistanceToEndPoint();
50415         }
50416     };
50417     /**
50418      * Returns the edited abscissa of the end point.
50419      * @return {number}
50420      */
50421     WallController.prototype.getXEnd = function () {
50422         return this.xEnd;
50423     };
50424     /**
50425      * Sets the edited ordinate of the end point.
50426      * @param {number} yEnd
50427      */
50428     WallController.prototype.setYEnd = function (yEnd) {
50429         if (yEnd !== this.yEnd) {
50430             var oldYEnd = this.yEnd;
50431             this.yEnd = yEnd;
50432             this.propertyChangeSupport.firePropertyChange(/* name */ "Y_END", oldYEnd, yEnd);
50433             this.updateLength();
50434             this.updateDistanceToEndPoint();
50435         }
50436     };
50437     /**
50438      * Returns the edited ordinate of the end point.
50439      * @return {number}
50440      */
50441     WallController.prototype.getYEnd = function () {
50442         return this.yEnd;
50443     };
50444     /**
50445      * Updates the edited length after its coordinates change.
50446      * @private
50447      */
50448     WallController.prototype.updateLength = function () {
50449         var xStart = this.getXStart();
50450         var yStart = this.getYStart();
50451         var xEnd = this.getXEnd();
50452         var yEnd = this.getYEnd();
50453         if (xStart != null && yStart != null && xEnd != null && yEnd != null) {
50454             var wall = new Wall(xStart, yStart, xEnd, yEnd, 0, 0);
50455             var arcExtent = this.getArcExtentInDegrees();
50456             if (arcExtent != null) {
50457                 wall.setArcExtent((function (x) { return x * Math.PI / 180; })(arcExtent));
50458             }
50459             this.setLength(wall.getLength(), false);
50460         }
50461         else {
50462             this.setLength(null, false);
50463         }
50464     };
50465     /**
50466      * Returns the edited length.
50467      * @return {number}
50468      */
50469     WallController.prototype.getLength = function () {
50470         return this.length;
50471     };
50472     WallController.prototype.setLength = function (length, updateEndPoint) {
50473         if (updateEndPoint === void 0) { updateEndPoint = true; }
50474         if (length !== this.length) {
50475             var oldLength = this.length;
50476             this.length = length;
50477             this.propertyChangeSupport.firePropertyChange(/* name */ "LENGTH", oldLength, length);
50478             if (updateEndPoint) {
50479                 var xStart = this.getXStart();
50480                 var yStart = this.getYStart();
50481                 var xEnd = this.getXEnd();
50482                 var yEnd = this.getYEnd();
50483                 if (xStart != null && yStart != null && xEnd != null && yEnd != null && length != null) {
50484                     if (this.getArcExtentInDegrees() != null && /* floatValue */ this.getArcExtentInDegrees() === 0) {
50485                         var wallAngle = Math.atan2(yStart - yEnd, xEnd - xStart);
50486                         this.setXEnd((xStart + length * Math.cos(wallAngle)));
50487                         this.setYEnd((yStart - length * Math.sin(wallAngle)));
50488                     }
50489                     else {
50490                         throw new UnsupportedOperationException("Computing end point of a round wall from its length not supported");
50491                     }
50492                 }
50493                 else {
50494                     this.setXEnd(null);
50495                     this.setYEnd(null);
50496                 }
50497             }
50498         }
50499     };
50500     /**
50501      * Updates the edited distance to end point after its coordinates change.
50502      * @private
50503      */
50504     WallController.prototype.updateDistanceToEndPoint = function () {
50505         var xStart = this.getXStart();
50506         var yStart = this.getYStart();
50507         var xEnd = this.getXEnd();
50508         var yEnd = this.getYEnd();
50509         if (xStart != null && yStart != null && xEnd != null && yEnd != null) {
50510             this.setDistanceToEndPoint(java.awt.geom.Point2D.distance(xStart, yStart, xEnd, yEnd), false);
50511         }
50512         else {
50513             this.setDistanceToEndPoint(null, false);
50514         }
50515     };
50516     WallController.prototype.setDistanceToEndPoint = function (distanceToEndPoint, updateEndPoint) {
50517         if (updateEndPoint === void 0) { updateEndPoint = true; }
50518         if (distanceToEndPoint !== this.distanceToEndPoint) {
50519             var oldDistance = this.distanceToEndPoint;
50520             this.distanceToEndPoint = distanceToEndPoint;
50521             this.propertyChangeSupport.firePropertyChange(/* name */ "DISTANCE_TO_END_POINT", oldDistance, distanceToEndPoint);
50522             if (updateEndPoint) {
50523                 var xStart = this.getXStart();
50524                 var yStart = this.getYStart();
50525                 var xEnd = this.getXEnd();
50526                 var yEnd = this.getYEnd();
50527                 if (xStart != null && yStart != null && xEnd != null && yEnd != null && distanceToEndPoint != null) {
50528                     var wallAngle = Math.atan2(yStart - yEnd, xEnd - xStart);
50529                     this.setXEnd((xStart + distanceToEndPoint * Math.cos(wallAngle)));
50530                     this.setYEnd((yStart - distanceToEndPoint * Math.sin(wallAngle)));
50531                 }
50532                 else {
50533                     this.setXEnd(null);
50534                     this.setYEnd(null);
50535                 }
50536             }
50537         }
50538     };
50539     /**
50540      * Returns the edited distance to end point.
50541      * @return {number}
50542      */
50543     WallController.prototype.getDistanceToEndPoint = function () {
50544         return this.distanceToEndPoint;
50545     };
50546     /**
50547      * Sets whether the point coordinates can be be edited or not.
50548      * @param {boolean} editablePoints
50549      */
50550     WallController.prototype.setEditablePoints = function (editablePoints) {
50551         if (editablePoints !== this.editablePoints) {
50552             this.editablePoints = editablePoints;
50553             this.propertyChangeSupport.firePropertyChange(/* name */ "EDITABLE_POINTS", !editablePoints, editablePoints);
50554         }
50555     };
50556     /**
50557      * Returns whether the point coordinates can be be edited or not.
50558      * @return {boolean}
50559      */
50560     WallController.prototype.isEditablePoints = function () {
50561         return this.editablePoints;
50562     };
50563     /**
50564      * Sets the edited color of the left side.
50565      * @param {number} leftSideColor
50566      */
50567     WallController.prototype.setLeftSideColor = function (leftSideColor) {
50568         if (leftSideColor !== this.leftSideColor) {
50569             var oldLeftSideColor = this.leftSideColor;
50570             this.leftSideColor = leftSideColor;
50571             this.propertyChangeSupport.firePropertyChange(/* name */ "LEFT_SIDE_COLOR", oldLeftSideColor, leftSideColor);
50572             this.setLeftSidePaint(WallController.WallPaint.COLORED);
50573         }
50574     };
50575     /**
50576      * Returns the edited color of the left side.
50577      * @return {number}
50578      */
50579     WallController.prototype.getLeftSideColor = function () {
50580         return this.leftSideColor;
50581     };
50582     /**
50583      * Sets whether the left side is colored, textured or unknown painted.
50584      * @param {WallController.WallPaint} leftSidePaint
50585      */
50586     WallController.prototype.setLeftSidePaint = function (leftSidePaint) {
50587         if (leftSidePaint !== this.leftSidePaint) {
50588             var oldLeftSidePaint = this.leftSidePaint;
50589             this.leftSidePaint = leftSidePaint;
50590             this.propertyChangeSupport.firePropertyChange(/* name */ "LEFT_SIDE_PAINT", oldLeftSidePaint, leftSidePaint);
50591         }
50592     };
50593     /**
50594      * Returns whether the left side is colored, textured or unknown painted.
50595      * @return {WallController.WallPaint} {@link WallPaint#COLORED}, {@link WallPaint#TEXTURED} or <code>null</code>
50596      */
50597     WallController.prototype.getLeftSidePaint = function () {
50598         return this.leftSidePaint;
50599     };
50600     /**
50601      * Sets the edited left side shininess.
50602      * @param {number} leftSideShininess
50603      */
50604     WallController.prototype.setLeftSideShininess = function (leftSideShininess) {
50605         if (leftSideShininess !== this.leftSideShininess) {
50606             var oldLeftSideShininess = this.leftSideShininess;
50607             this.leftSideShininess = leftSideShininess;
50608             this.propertyChangeSupport.firePropertyChange(/* name */ "LEFT_SIDE_SHININESS", oldLeftSideShininess, leftSideShininess);
50609         }
50610     };
50611     /**
50612      * Returns the edited left side shininess.
50613      * @return {number}
50614      */
50615     WallController.prototype.getLeftSideShininess = function () {
50616         return this.leftSideShininess;
50617     };
50618     /**
50619      * Sets the edited color of the right side.
50620      * @param {number} rightSideColor
50621      */
50622     WallController.prototype.setRightSideColor = function (rightSideColor) {
50623         if (rightSideColor !== this.rightSideColor) {
50624             var oldRightSideColor = this.rightSideColor;
50625             this.rightSideColor = rightSideColor;
50626             this.propertyChangeSupport.firePropertyChange(/* name */ "RIGHT_SIDE_COLOR", oldRightSideColor, rightSideColor);
50627             this.setRightSidePaint(WallController.WallPaint.COLORED);
50628         }
50629     };
50630     /**
50631      * Returns the edited color of the right side.
50632      * @return {number}
50633      */
50634     WallController.prototype.getRightSideColor = function () {
50635         return this.rightSideColor;
50636     };
50637     /**
50638      * Sets whether the right side is colored, textured or unknown painted.
50639      * @param {WallController.WallPaint} rightSidePaint
50640      */
50641     WallController.prototype.setRightSidePaint = function (rightSidePaint) {
50642         if (rightSidePaint !== this.rightSidePaint) {
50643             var oldRightSidePaint = this.rightSidePaint;
50644             this.rightSidePaint = rightSidePaint;
50645             this.propertyChangeSupport.firePropertyChange(/* name */ "RIGHT_SIDE_PAINT", oldRightSidePaint, rightSidePaint);
50646         }
50647     };
50648     /**
50649      * Returns whether the right side is colored, textured or unknown painted.
50650      * @return {WallController.WallPaint} {@link WallPaint#COLORED}, {@link WallPaint#TEXTURED} or <code>null</code>
50651      */
50652     WallController.prototype.getRightSidePaint = function () {
50653         return this.rightSidePaint;
50654     };
50655     /**
50656      * Sets the edited right side shininess.
50657      * @param {number} rightSideShininess
50658      */
50659     WallController.prototype.setRightSideShininess = function (rightSideShininess) {
50660         if (rightSideShininess !== this.rightSideShininess) {
50661             var oldRightSideShininess = this.rightSideShininess;
50662             this.rightSideShininess = rightSideShininess;
50663             this.propertyChangeSupport.firePropertyChange(/* name */ "RIGHT_SIDE_SHININESS", oldRightSideShininess, rightSideShininess);
50664         }
50665     };
50666     /**
50667      * Returns the edited right side shininess.
50668      * @return {number}
50669      */
50670     WallController.prototype.getRightSideShininess = function () {
50671         return this.rightSideShininess;
50672     };
50673     /**
50674      * Sets the pattern of edited wall in plan, and notifies
50675      * listeners of this change.
50676      * @param {Object} pattern
50677      */
50678     WallController.prototype.setPattern = function (pattern) {
50679         if (this.pattern !== pattern) {
50680             var oldPattern = this.pattern;
50681             this.pattern = pattern;
50682             this.propertyChangeSupport.firePropertyChange(/* name */ "PATTERN", oldPattern, pattern);
50683         }
50684     };
50685     /**
50686      * Returns the pattern of edited wall in plan.
50687      * @return {Object}
50688      */
50689     WallController.prototype.getPattern = function () {
50690         return this.pattern;
50691     };
50692     /**
50693      * Sets the edited top color in the 3D view.
50694      * @param {number} topColor
50695      */
50696     WallController.prototype.setTopColor = function (topColor) {
50697         if (topColor !== this.topColor) {
50698             var oldTopColor = this.topColor;
50699             this.topColor = topColor;
50700             this.propertyChangeSupport.firePropertyChange(/* name */ "TOP_COLOR", oldTopColor, topColor);
50701         }
50702     };
50703     /**
50704      * Returns the edited top color in the 3D view.
50705      * @return {number}
50706      */
50707     WallController.prototype.getTopColor = function () {
50708         return this.topColor;
50709     };
50710     /**
50711      * Sets whether the top of the wall in the 3D view uses default rendering, is colored, or unknown painted.
50712      * @param {WallController.WallPaint} topPaint
50713      */
50714     WallController.prototype.setTopPaint = function (topPaint) {
50715         if (topPaint !== this.topPaint) {
50716             var oldTopPaint = this.topPaint;
50717             this.topPaint = topPaint;
50718             this.propertyChangeSupport.firePropertyChange(/* name */ "TOP_PAINT", oldTopPaint, topPaint);
50719         }
50720     };
50721     /**
50722      * Returns whether the top of the wall in the 3D view uses default rendering, is colored, or unknown painted.
50723      * @return {WallController.WallPaint} {@link WallPaint#DEFAULT}, {@link WallPaint#COLORED} or <code>null</code>
50724      */
50725     WallController.prototype.getTopPaint = function () {
50726         return this.topPaint;
50727     };
50728     /**
50729      * Sets whether the edited wall is a rectangular wall, a sloping wall or unknown.
50730      * @param {WallController.WallShape} shape
50731      */
50732     WallController.prototype.setShape = function (shape) {
50733         if (shape !== this.shape) {
50734             var oldShape = this.shape;
50735             this.shape = shape;
50736             this.propertyChangeSupport.firePropertyChange(/* name */ "SHAPE", oldShape, shape);
50737             if (shape === WallController.WallShape.RECTANGULAR_WALL) {
50738                 if (this.rectangularWallHeight != null) {
50739                     this.getLeftSideBaseboardController().setMaxHeight(this.rectangularWallHeight);
50740                     this.getRightSideBaseboardController().setMaxHeight(this.rectangularWallHeight);
50741                 }
50742             }
50743             else if (shape === WallController.WallShape.SLOPING_WALL) {
50744                 if (this.slopingWallHeightAtStart != null && this.sloppingWallHeightAtEnd != null) {
50745                     var baseboardMaxHeight = Math.max(this.sloppingWallHeightAtEnd, this.slopingWallHeightAtStart);
50746                     this.getLeftSideBaseboardController().setMaxHeight(baseboardMaxHeight);
50747                     this.getRightSideBaseboardController().setMaxHeight(baseboardMaxHeight);
50748                 }
50749                 else if (this.slopingWallHeightAtStart != null) {
50750                     this.getLeftSideBaseboardController().setMaxHeight(this.slopingWallHeightAtStart);
50751                     this.getRightSideBaseboardController().setMaxHeight(this.slopingWallHeightAtStart);
50752                 }
50753                 else if (this.sloppingWallHeightAtEnd != null) {
50754                     this.getLeftSideBaseboardController().setMaxHeight(this.sloppingWallHeightAtEnd);
50755                     this.getRightSideBaseboardController().setMaxHeight(this.sloppingWallHeightAtEnd);
50756                 }
50757             }
50758         }
50759     };
50760     /**
50761      * Returns whether the edited wall is a rectangular wall, a sloping wall or unknown.
50762      * @return {WallController.WallShape}
50763      */
50764     WallController.prototype.getShape = function () {
50765         return this.shape;
50766     };
50767     /**
50768      * Sets the edited height of a rectangular wall.
50769      * @param {number} rectangularWallHeight
50770      */
50771     WallController.prototype.setRectangularWallHeight = function (rectangularWallHeight) {
50772         if (rectangularWallHeight !== this.rectangularWallHeight) {
50773             var oldRectangularWallHeight = this.rectangularWallHeight;
50774             this.rectangularWallHeight = rectangularWallHeight;
50775             this.propertyChangeSupport.firePropertyChange(/* name */ "RECTANGULAR_WALL_HEIGHT", oldRectangularWallHeight, rectangularWallHeight);
50776             this.setShape(WallController.WallShape.RECTANGULAR_WALL);
50777             if (rectangularWallHeight != null) {
50778                 this.getLeftSideBaseboardController().setMaxHeight(rectangularWallHeight);
50779                 this.getRightSideBaseboardController().setMaxHeight(rectangularWallHeight);
50780             }
50781         }
50782     };
50783     /**
50784      * Returns the edited height of a rectangular wall.
50785      * @return {number}
50786      */
50787     WallController.prototype.getRectangularWallHeight = function () {
50788         return this.rectangularWallHeight;
50789     };
50790     /**
50791      * Sets the edited height at start of a sloping wall.
50792      * @param {number} slopingWallHeightAtStart
50793      */
50794     WallController.prototype.setSlopingWallHeightAtStart = function (slopingWallHeightAtStart) {
50795         if (slopingWallHeightAtStart !== this.slopingWallHeightAtStart) {
50796             var oldSlopingHeightHeightAtStart = this.slopingWallHeightAtStart;
50797             this.slopingWallHeightAtStart = slopingWallHeightAtStart;
50798             this.propertyChangeSupport.firePropertyChange(/* name */ "SLOPING_WALL_HEIGHT_AT_START", oldSlopingHeightHeightAtStart, slopingWallHeightAtStart);
50799             this.setShape(WallController.WallShape.SLOPING_WALL);
50800             if (slopingWallHeightAtStart != null) {
50801                 var baseboardMaxHeight = this.sloppingWallHeightAtEnd != null ? Math.max(this.sloppingWallHeightAtEnd, slopingWallHeightAtStart) : slopingWallHeightAtStart;
50802                 baseboardMaxHeight = Math.max(baseboardMaxHeight, this.preferences.getLengthUnit().getMinimumLength());
50803                 this.getLeftSideBaseboardController().setMaxHeight(baseboardMaxHeight);
50804                 this.getRightSideBaseboardController().setMaxHeight(baseboardMaxHeight);
50805             }
50806         }
50807     };
50808     /**
50809      * Returns the edited height at start of a sloping wall.
50810      * @return {number}
50811      */
50812     WallController.prototype.getSlopingWallHeightAtStart = function () {
50813         return this.slopingWallHeightAtStart;
50814     };
50815     /**
50816      * Sets the edited height at end of a sloping wall.
50817      * @param {number} sloppingWallHeightAtEnd
50818      */
50819     WallController.prototype.setSlopingWallHeightAtEnd = function (sloppingWallHeightAtEnd) {
50820         if (sloppingWallHeightAtEnd !== this.sloppingWallHeightAtEnd) {
50821             var oldSlopingWallHeightAtEnd = this.sloppingWallHeightAtEnd;
50822             this.sloppingWallHeightAtEnd = sloppingWallHeightAtEnd;
50823             this.propertyChangeSupport.firePropertyChange(/* name */ "SLOPING_WALL_HEIGHT_AT_END", oldSlopingWallHeightAtEnd, sloppingWallHeightAtEnd);
50824             this.setShape(WallController.WallShape.SLOPING_WALL);
50825             if (sloppingWallHeightAtEnd != null) {
50826                 var baseboardMaxHeight = this.slopingWallHeightAtStart != null ? Math.max(this.slopingWallHeightAtStart, sloppingWallHeightAtEnd) : sloppingWallHeightAtEnd;
50827                 baseboardMaxHeight = Math.max(baseboardMaxHeight, this.preferences.getLengthUnit().getMinimumLength());
50828                 this.getLeftSideBaseboardController().setMaxHeight(baseboardMaxHeight);
50829                 this.getRightSideBaseboardController().setMaxHeight(baseboardMaxHeight);
50830             }
50831         }
50832     };
50833     /**
50834      * Returns the edited height at end of a sloping wall.
50835      * @return {number}
50836      */
50837     WallController.prototype.getSlopingWallHeightAtEnd = function () {
50838         return this.sloppingWallHeightAtEnd;
50839     };
50840     /**
50841      * Sets the edited thickness.
50842      * @param {number} thickness
50843      */
50844     WallController.prototype.setThickness = function (thickness) {
50845         if (thickness !== this.thickness) {
50846             var oldThickness = this.thickness;
50847             this.thickness = thickness;
50848             this.propertyChangeSupport.firePropertyChange(/* name */ "THICKNESS", oldThickness, thickness);
50849         }
50850     };
50851     /**
50852      * Returns the edited thickness.
50853      * @return {number}
50854      */
50855     WallController.prototype.getThickness = function () {
50856         return this.thickness;
50857     };
50858     /**
50859      * Sets the edited arc extent.
50860      * @param {number} arcExtentInDegrees
50861      */
50862     WallController.prototype.setArcExtentInDegrees = function (arcExtentInDegrees) {
50863         if (arcExtentInDegrees !== this.arcExtentInDegrees) {
50864             var oldArcExtent = this.arcExtentInDegrees;
50865             this.arcExtentInDegrees = arcExtentInDegrees;
50866             this.propertyChangeSupport.firePropertyChange(/* name */ "ARC_EXTENT_IN_DEGREES", oldArcExtent, arcExtentInDegrees);
50867         }
50868     };
50869     /**
50870      * Returns the edited arc extent.
50871      * @return {number}
50872      */
50873     WallController.prototype.getArcExtentInDegrees = function () {
50874         return this.arcExtentInDegrees;
50875     };
50876     /**
50877      * Returns the length of wall after applying the edited arc extent.
50878      * @return {number} the arc length or null if data is missing to compute it
50879      */
50880     WallController.prototype.getArcLength = function () {
50881         var xStart = this.getXStart();
50882         var yStart = this.getYStart();
50883         var xEnd = this.getXEnd();
50884         var yEnd = this.getYEnd();
50885         var arcExtentInDegrees = this.getArcExtentInDegrees();
50886         if (xStart != null && yStart != null && xEnd != null && yEnd != null && arcExtentInDegrees != null) {
50887             var wall = new Wall(xStart, yStart, xEnd, yEnd, 1.0E-5, 0);
50888             wall.setArcExtent((function (x) { return x * Math.PI / 180; })(arcExtentInDegrees));
50889             return wall.getLength();
50890         }
50891         else {
50892             return null;
50893         }
50894     };
50895     /**
50896      * Controls the modification of selected walls in edited home.
50897      */
50898     WallController.prototype.modifyWalls = function () {
50899         var oldSelection = this.home.getSelectedItems();
50900         var selectedWalls = Home.getWallsSubList(oldSelection);
50901         if (!(selectedWalls.length == 0)) {
50902             var xStart = this.getXStart();
50903             var yStart = this.getYStart();
50904             var xEnd = this.getXEnd();
50905             var yEnd = this.getYEnd();
50906             var leftSidePaint = this.getLeftSidePaint();
50907             var leftSideColor = leftSidePaint === WallController.WallPaint.COLORED ? this.getLeftSideColor() : null;
50908             var leftSideTexture = leftSidePaint === WallController.WallPaint.TEXTURED ? this.getLeftSideTextureController().getTexture() : null;
50909             var leftSideShininess = this.getLeftSideShininess();
50910             var leftSideBaseboardVisible = this.getLeftSideBaseboardController().getVisible();
50911             var leftSideBaseboardThickness = this.getLeftSideBaseboardController().getThickness();
50912             var leftSideBaseboardHeight = this.getLeftSideBaseboardController().getHeight();
50913             var leftSideBaseboardPaint = this.getLeftSideBaseboardController().getPaint();
50914             var leftSideBaseboardColor = leftSideBaseboardPaint === BaseboardChoiceController.BaseboardPaint.COLORED ? this.getLeftSideBaseboardController().getColor() : null;
50915             var leftSideBaseboardTexture = leftSideBaseboardPaint === BaseboardChoiceController.BaseboardPaint.TEXTURED ? this.getLeftSideBaseboardController().getTextureController().getTexture() : null;
50916             var rightSidePaint = this.getRightSidePaint();
50917             var rightSideColor = rightSidePaint === WallController.WallPaint.COLORED ? this.getRightSideColor() : null;
50918             var rightSideTexture = rightSidePaint === WallController.WallPaint.TEXTURED ? this.getRightSideTextureController().getTexture() : null;
50919             var rightSideShininess = this.getRightSideShininess();
50920             var rightSideBaseboardVisible = this.getRightSideBaseboardController().getVisible();
50921             var rightSideBaseboardThickness = this.getRightSideBaseboardController().getThickness();
50922             var rightSideBaseboardHeight = this.getRightSideBaseboardController().getHeight();
50923             var rightSideBaseboardPaint = this.getRightSideBaseboardController().getPaint();
50924             var rightSideBaseboardColor = rightSideBaseboardPaint === BaseboardChoiceController.BaseboardPaint.COLORED ? this.getRightSideBaseboardController().getColor() : null;
50925             var rightSideBaseboardTexture = rightSideBaseboardPaint === BaseboardChoiceController.BaseboardPaint.TEXTURED ? this.getRightSideBaseboardController().getTextureController().getTexture() : null;
50926             var pattern = this.getPattern();
50927             var modifiedTopColor = this.getTopPaint() != null;
50928             var topColor = this.getTopPaint() === WallController.WallPaint.COLORED ? this.getTopColor() : null;
50929             var thickness = this.getThickness();
50930             var arcExtent = this.getArcExtentInDegrees();
50931             if (arcExtent != null) {
50932                 arcExtent = (function (x) { return x * Math.PI / 180; })(arcExtent);
50933             }
50934             var height = void 0;
50935             if (this.getShape() === WallController.WallShape.SLOPING_WALL) {
50936                 height = this.getSlopingWallHeightAtStart();
50937             }
50938             else if (this.getShape() === WallController.WallShape.RECTANGULAR_WALL) {
50939                 height = this.getRectangularWallHeight();
50940             }
50941             else {
50942                 height = null;
50943             }
50944             var heightAtEnd = void 0;
50945             if (this.getShape() === WallController.WallShape.SLOPING_WALL) {
50946                 heightAtEnd = this.getSlopingWallHeightAtEnd();
50947             }
50948             else if (this.getShape() === WallController.WallShape.RECTANGULAR_WALL) {
50949                 heightAtEnd = this.getRectangularWallHeight();
50950             }
50951             else {
50952                 heightAtEnd = null;
50953             }
50954             if (height != null && heightAtEnd != null) {
50955                 var maxHeight = Math.max(height, heightAtEnd);
50956                 if (leftSideBaseboardHeight != null) {
50957                     leftSideBaseboardHeight = Math.min(leftSideBaseboardHeight, maxHeight);
50958                 }
50959                 if (rightSideBaseboardHeight != null) {
50960                     rightSideBaseboardHeight = Math.min(rightSideBaseboardHeight, maxHeight);
50961                 }
50962             }
50963             var modifiedWalls = (function (s) { var a = []; while (s-- > 0)
50964                 a.push(null); return a; })(/* size */ selectedWalls.length);
50965             for (var i = 0; i < modifiedWalls.length; i++) {
50966                 {
50967                     modifiedWalls[i] = new WallController.ModifiedWall(/* get */ selectedWalls[i]);
50968                 }
50969                 ;
50970             }
50971             WallController.doModifyWalls(modifiedWalls, this.preferences.getNewWallBaseboardThickness(), this.preferences.getNewWallBaseboardHeight(), xStart, yStart, xEnd, yEnd, leftSidePaint, leftSideColor, leftSideTexture, leftSideShininess, leftSideBaseboardVisible, leftSideBaseboardThickness, leftSideBaseboardHeight, leftSideBaseboardPaint, leftSideBaseboardColor, leftSideBaseboardTexture, rightSidePaint, rightSideColor, rightSideTexture, rightSideShininess, rightSideBaseboardVisible, rightSideBaseboardThickness, rightSideBaseboardHeight, rightSideBaseboardPaint, rightSideBaseboardColor, rightSideBaseboardTexture, pattern, modifiedTopColor, topColor, height, heightAtEnd, thickness, arcExtent);
50972             if (this.undoSupport != null) {
50973                 var undoableEdit = new WallController.WallsModificationUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), modifiedWalls, this.preferences.getNewWallBaseboardThickness(), this.preferences.getNewWallBaseboardHeight(), xStart, yStart, xEnd, yEnd, leftSidePaint, leftSideColor, leftSideTexture, leftSideShininess, leftSideBaseboardVisible, leftSideBaseboardThickness, leftSideBaseboardHeight, leftSideBaseboardPaint, leftSideBaseboardColor, leftSideBaseboardTexture, rightSidePaint, rightSideColor, rightSideTexture, rightSideShininess, rightSideBaseboardVisible, rightSideBaseboardThickness, rightSideBaseboardHeight, rightSideBaseboardPaint, rightSideBaseboardColor, rightSideBaseboardTexture, pattern, modifiedTopColor, topColor, height, heightAtEnd, thickness, arcExtent);
50974                 this.undoSupport.postEdit(undoableEdit);
50975             }
50976         }
50977     };
50978     /**
50979      * Modifies walls properties with the values in parameter.
50980      * @param {com.eteks.sweethome3d.viewcontroller.WallController.ModifiedWall[]} modifiedWalls
50981      * @param {number} newWallBaseboardThickness
50982      * @param {number} newWallBaseboardHeight
50983      * @param {number} xStart
50984      * @param {number} yStart
50985      * @param {number} xEnd
50986      * @param {number} yEnd
50987      * @param {WallController.WallPaint} leftSidePaint
50988      * @param {number} leftSideColor
50989      * @param {HomeTexture} leftSideTexture
50990      * @param {number} leftSideShininess
50991      * @param {boolean} leftSideBaseboardVisible
50992      * @param {number} leftSideBaseboardThickness
50993      * @param {number} leftSideBaseboardHeight
50994      * @param {BaseboardChoiceController.BaseboardPaint} leftSideBaseboardPaint
50995      * @param {number} leftSideBaseboardColor
50996      * @param {HomeTexture} leftSideBaseboardTexture
50997      * @param {WallController.WallPaint} rightSidePaint
50998      * @param {number} rightSideColor
50999      * @param {HomeTexture} rightSideTexture
51000      * @param {number} rightSideShininess
51001      * @param {boolean} rightSideBaseboardVisible
51002      * @param {number} rightSideBaseboardThickness
51003      * @param {number} rightSideBaseboardHeight
51004      * @param {BaseboardChoiceController.BaseboardPaint} rightSideBaseboardPaint
51005      * @param {number} rightSideBaseboardColor
51006      * @param {HomeTexture} rightSideBaseboardTexture
51007      * @param {Object} pattern
51008      * @param {boolean} modifiedTopColor
51009      * @param {number} topColor
51010      * @param {number} height
51011      * @param {number} heightAtEnd
51012      * @param {number} thickness
51013      * @param {number} arcExtent
51014      * @private
51015      */
51016     WallController.doModifyWalls = function (modifiedWalls, newWallBaseboardThickness, newWallBaseboardHeight, xStart, yStart, xEnd, yEnd, leftSidePaint, leftSideColor, leftSideTexture, leftSideShininess, leftSideBaseboardVisible, leftSideBaseboardThickness, leftSideBaseboardHeight, leftSideBaseboardPaint, leftSideBaseboardColor, leftSideBaseboardTexture, rightSidePaint, rightSideColor, rightSideTexture, rightSideShininess, rightSideBaseboardVisible, rightSideBaseboardThickness, rightSideBaseboardHeight, rightSideBaseboardPaint, rightSideBaseboardColor, rightSideBaseboardTexture, pattern, modifiedTopColor, topColor, height, heightAtEnd, thickness, arcExtent) {
51017         for (var index = 0; index < modifiedWalls.length; index++) {
51018             var modifiedWall = modifiedWalls[index];
51019             {
51020                 var wall = modifiedWall.getWall();
51021                 WallController.moveWallPoints(wall, xStart, yStart, xEnd, yEnd);
51022                 if (leftSidePaint != null) {
51023                     switch ((leftSidePaint)) {
51024                         case WallController.WallPaint.DEFAULT:
51025                             wall.setLeftSideColor(null);
51026                             wall.setLeftSideTexture(null);
51027                             break;
51028                         case WallController.WallPaint.COLORED:
51029                             if (leftSideColor != null) {
51030                                 wall.setLeftSideColor(leftSideColor);
51031                             }
51032                             wall.setLeftSideTexture(null);
51033                             break;
51034                         case WallController.WallPaint.TEXTURED:
51035                             wall.setLeftSideColor(null);
51036                             if (leftSideTexture != null) {
51037                                 wall.setLeftSideTexture(leftSideTexture);
51038                             }
51039                             break;
51040                     }
51041                 }
51042                 if (leftSideShininess != null) {
51043                     wall.setLeftSideShininess(leftSideShininess);
51044                 }
51045                 if (leftSideBaseboardVisible === false) {
51046                     wall.setLeftSideBaseboard(null);
51047                 }
51048                 else {
51049                     var baseboard = wall.getLeftSideBaseboard();
51050                     if (leftSideBaseboardVisible === true || baseboard != null) {
51051                         var baseboardThickness = baseboard != null ? baseboard.getThickness() : newWallBaseboardThickness;
51052                         var baseboardHeight = baseboard != null ? baseboard.getHeight() : newWallBaseboardHeight;
51053                         var baseboardColor = baseboard != null ? baseboard.getColor() : null;
51054                         var baseboardTexture = baseboard != null ? baseboard.getTexture() : null;
51055                         if (leftSideBaseboardPaint != null) {
51056                             switch ((leftSideBaseboardPaint)) {
51057                                 case BaseboardChoiceController.BaseboardPaint.DEFAULT:
51058                                     baseboardColor = null;
51059                                     baseboardTexture = null;
51060                                     break;
51061                                 case BaseboardChoiceController.BaseboardPaint.COLORED:
51062                                     if (leftSideBaseboardColor != null) {
51063                                         baseboardColor = leftSideBaseboardColor;
51064                                     }
51065                                     baseboardTexture = null;
51066                                     break;
51067                                 case BaseboardChoiceController.BaseboardPaint.TEXTURED:
51068                                     baseboardColor = null;
51069                                     if (leftSideBaseboardTexture != null) {
51070                                         baseboardTexture = leftSideBaseboardTexture;
51071                                     }
51072                                     break;
51073                             }
51074                         }
51075                         wall.setLeftSideBaseboard(Baseboard.getInstance(leftSideBaseboardThickness != null ? leftSideBaseboardThickness : baseboardThickness, leftSideBaseboardHeight != null ? leftSideBaseboardHeight : baseboardHeight, baseboardColor, baseboardTexture));
51076                     }
51077                 }
51078                 if (rightSidePaint != null) {
51079                     switch ((rightSidePaint)) {
51080                         case WallController.WallPaint.DEFAULT:
51081                             wall.setRightSideColor(null);
51082                             wall.setRightSideTexture(null);
51083                             break;
51084                         case WallController.WallPaint.COLORED:
51085                             if (rightSideColor != null) {
51086                                 wall.setRightSideColor(rightSideColor);
51087                             }
51088                             wall.setRightSideTexture(null);
51089                             break;
51090                         case WallController.WallPaint.TEXTURED:
51091                             wall.setRightSideColor(null);
51092                             if (rightSideTexture != null) {
51093                                 wall.setRightSideTexture(rightSideTexture);
51094                             }
51095                             break;
51096                     }
51097                 }
51098                 if (rightSideShininess != null) {
51099                     wall.setRightSideShininess(rightSideShininess);
51100                 }
51101                 if (rightSideBaseboardVisible === false) {
51102                     wall.setRightSideBaseboard(null);
51103                 }
51104                 else {
51105                     var baseboard = wall.getRightSideBaseboard();
51106                     if (rightSideBaseboardVisible === true || baseboard != null) {
51107                         var baseboardThickness = baseboard != null ? baseboard.getThickness() : newWallBaseboardThickness;
51108                         var baseboardHeight = baseboard != null ? baseboard.getHeight() : newWallBaseboardHeight;
51109                         var baseboardColor = baseboard != null ? baseboard.getColor() : null;
51110                         var baseboardTexture = baseboard != null ? baseboard.getTexture() : null;
51111                         if (rightSideBaseboardPaint != null) {
51112                             switch ((rightSideBaseboardPaint)) {
51113                                 case BaseboardChoiceController.BaseboardPaint.DEFAULT:
51114                                     baseboardColor = null;
51115                                     baseboardTexture = null;
51116                                     break;
51117                                 case BaseboardChoiceController.BaseboardPaint.COLORED:
51118                                     if (rightSideBaseboardColor != null) {
51119                                         baseboardColor = rightSideBaseboardColor;
51120                                     }
51121                                     baseboardTexture = null;
51122                                     break;
51123                                 case BaseboardChoiceController.BaseboardPaint.TEXTURED:
51124                                     baseboardColor = null;
51125                                     if (rightSideBaseboardTexture != null) {
51126                                         baseboardTexture = rightSideBaseboardTexture;
51127                                     }
51128                                     break;
51129                             }
51130                         }
51131                         wall.setRightSideBaseboard(Baseboard.getInstance(rightSideBaseboardThickness != null ? rightSideBaseboardThickness : baseboardThickness, rightSideBaseboardHeight != null ? rightSideBaseboardHeight : baseboardHeight, baseboardColor, baseboardTexture));
51132                     }
51133                 }
51134                 if (pattern != null) {
51135                     wall.setPattern(pattern);
51136                 }
51137                 if (modifiedTopColor) {
51138                     wall.setTopColor(topColor);
51139                 }
51140                 if (height != null) {
51141                     wall.setHeight(height);
51142                     if (heightAtEnd != null) {
51143                         if (heightAtEnd === height) {
51144                             wall.setHeightAtEnd(null);
51145                         }
51146                         else {
51147                             wall.setHeightAtEnd(heightAtEnd);
51148                         }
51149                     }
51150                 }
51151                 if (thickness != null) {
51152                     wall.setThickness(/* floatValue */ thickness);
51153                 }
51154                 if (arcExtent != null) {
51155                     if ( /* floatValue */arcExtent === 0) {
51156                         wall.setArcExtent(null);
51157                     }
51158                     else {
51159                         wall.setArcExtent(arcExtent);
51160                     }
51161                 }
51162             }
51163         }
51164     };
51165     /**
51166      * Restores wall properties from the values stored in <code>modifiedWalls</code>.
51167      * @param {com.eteks.sweethome3d.viewcontroller.WallController.ModifiedWall[]} modifiedWalls
51168      * @private
51169      */
51170     WallController.undoModifyWalls = function (modifiedWalls) {
51171         for (var index = 0; index < modifiedWalls.length; index++) {
51172             var modifiedWall = modifiedWalls[index];
51173             {
51174                 var wall = modifiedWall.getWall();
51175                 WallController.moveWallPoints(wall, modifiedWall.getXStart(), modifiedWall.getYStart(), modifiedWall.getXEnd(), modifiedWall.getYEnd());
51176                 wall.setLeftSideColor(modifiedWall.getLeftSideColor());
51177                 wall.setLeftSideTexture(modifiedWall.getLeftSideTexture());
51178                 wall.setLeftSideShininess(modifiedWall.getLeftSideShininess());
51179                 wall.setLeftSideBaseboard(modifiedWall.getLeftSideBaseboard());
51180                 wall.setRightSideColor(modifiedWall.getRightSideColor());
51181                 wall.setRightSideTexture(modifiedWall.getRightSideTexture());
51182                 wall.setRightSideShininess(modifiedWall.getRightSideShininess());
51183                 wall.setRightSideBaseboard(modifiedWall.getRightSideBaseboard());
51184                 wall.setPattern(modifiedWall.getPattern());
51185                 wall.setTopColor(modifiedWall.getTopColor());
51186                 wall.setHeight(modifiedWall.getHeight());
51187                 wall.setHeightAtEnd(modifiedWall.getHeightAtEnd());
51188                 wall.setThickness(modifiedWall.getThickness());
51189                 wall.setArcExtent(modifiedWall.getArcExtent());
51190             }
51191         }
51192     };
51193     WallController.moveWallPoints = function (wall, xStart, yStart, xEnd, yEnd) {
51194         var wallAtStart = wall.getWallAtStart();
51195         if (xStart != null) {
51196             wall.setXStart(xStart);
51197             if (wallAtStart != null) {
51198                 if (wallAtStart.getWallAtStart() === wall) {
51199                     wallAtStart.setXStart(xStart);
51200                 }
51201                 else if (wallAtStart.getWallAtEnd() === wall) {
51202                     wallAtStart.setXEnd(xStart);
51203                 }
51204             }
51205         }
51206         if (yStart != null) {
51207             wall.setYStart(yStart);
51208             if (wallAtStart != null) {
51209                 if (wallAtStart.getWallAtStart() === wall) {
51210                     wallAtStart.setYStart(yStart);
51211                 }
51212                 else if (wallAtStart.getWallAtEnd() === wall) {
51213                     wallAtStart.setYEnd(yStart);
51214                 }
51215             }
51216         }
51217         var wallAtEnd = wall.getWallAtEnd();
51218         if (xEnd != null) {
51219             wall.setXEnd(xEnd);
51220             if (wallAtEnd != null) {
51221                 if (wallAtEnd.getWallAtStart() === wall) {
51222                     wallAtEnd.setXStart(xEnd);
51223                 }
51224                 else if (wallAtEnd.getWallAtEnd() === wall) {
51225                     wallAtEnd.setXEnd(xEnd);
51226                 }
51227             }
51228         }
51229         if (yEnd != null) {
51230             wall.setYEnd(yEnd);
51231             if (wallAtEnd != null) {
51232                 if (wallAtEnd.getWallAtStart() === wall) {
51233                     wallAtEnd.setYStart(yEnd);
51234                 }
51235                 else if (wallAtEnd.getWallAtEnd() === wall) {
51236                     wallAtEnd.setYEnd(yEnd);
51237                 }
51238             }
51239         }
51240     };
51241     return WallController;
51242 }());
51243 WallController["__class"] = "com.eteks.sweethome3d.viewcontroller.WallController";
51244 WallController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
51245 (function (WallController) {
51246     /**
51247      * The possible values for {@linkplain #getShape() wall shape}.
51248      * @enum
51249      * @property {WallController.WallShape} RECTANGULAR_WALL
51250      * @property {WallController.WallShape} SLOPING_WALL
51251      * @class
51252      */
51253     var WallShape;
51254     (function (WallShape) {
51255         WallShape[WallShape["RECTANGULAR_WALL"] = 0] = "RECTANGULAR_WALL";
51256         WallShape[WallShape["SLOPING_WALL"] = 1] = "SLOPING_WALL";
51257     })(WallShape = WallController.WallShape || (WallController.WallShape = {}));
51258     /**
51259      * The possible values for {@linkplain #getLeftSidePaint() wall paint type}.
51260      * @enum
51261      * @property {WallController.WallPaint} DEFAULT
51262      * @property {WallController.WallPaint} COLORED
51263      * @property {WallController.WallPaint} TEXTURED
51264      * @class
51265      */
51266     var WallPaint;
51267     (function (WallPaint) {
51268         WallPaint[WallPaint["DEFAULT"] = 0] = "DEFAULT";
51269         WallPaint[WallPaint["COLORED"] = 1] = "COLORED";
51270         WallPaint[WallPaint["TEXTURED"] = 2] = "TEXTURED";
51271     })(WallPaint = WallController.WallPaint || (WallController.WallPaint = {}));
51272     /**
51273      * Undoable edit for walls modification. This class isn't anonymous to avoid
51274      * being bound to controller and its view.
51275      * @extends LocalizedUndoableEdit
51276      * @class
51277      */
51278     var WallsModificationUndoableEdit = /** @class */ (function (_super) {
51279         __extends(WallsModificationUndoableEdit, _super);
51280         function WallsModificationUndoableEdit(home, preferences, oldSelection, modifiedWalls, newWallBaseboardThickness, newWallBaseboardHeight, xStart, yStart, xEnd, yEnd, leftSidePaint, leftSideColor, leftSideTexture, leftSideShininess, leftSideBaseboardVisible, leftSideBaseboardThickness, leftSideBaseboardHeight, leftSideBaseboardPaint, leftSideBaseboardColor, leftSideBaseboardTexture, rightSidePaint, rightSideColor, rightSideTexture, rightSideShininess, rightSideBaseboardVisible, rightSideBaseboardThickness, rightSideBaseboardHeight, rightSideBaseboardPaint, rightSideBaseboardColor, rightSideBaseboardTexture, pattern, modifiedTopColor, topColor, height, heightAtEnd, thickness, arcExtent) {
51281             var _this = _super.call(this, preferences, WallController, "undoModifyWallsName") || this;
51282             if (_this.home === undefined) {
51283                 _this.home = null;
51284             }
51285             if (_this.oldSelection === undefined) {
51286                 _this.oldSelection = null;
51287             }
51288             if (_this.modifiedWalls === undefined) {
51289                 _this.modifiedWalls = null;
51290             }
51291             if (_this.newWallBaseboardThickness === undefined) {
51292                 _this.newWallBaseboardThickness = 0;
51293             }
51294             if (_this.newWallBaseboardHeight === undefined) {
51295                 _this.newWallBaseboardHeight = 0;
51296             }
51297             if (_this.xStart === undefined) {
51298                 _this.xStart = null;
51299             }
51300             if (_this.yStart === undefined) {
51301                 _this.yStart = null;
51302             }
51303             if (_this.xEnd === undefined) {
51304                 _this.xEnd = null;
51305             }
51306             if (_this.yEnd === undefined) {
51307                 _this.yEnd = null;
51308             }
51309             if (_this.leftSidePaint === undefined) {
51310                 _this.leftSidePaint = null;
51311             }
51312             if (_this.leftSideColor === undefined) {
51313                 _this.leftSideColor = null;
51314             }
51315             if (_this.leftSideTexture === undefined) {
51316                 _this.leftSideTexture = null;
51317             }
51318             if (_this.leftSideShininess === undefined) {
51319                 _this.leftSideShininess = null;
51320             }
51321             if (_this.leftSideBaseboardVisible === undefined) {
51322                 _this.leftSideBaseboardVisible = null;
51323             }
51324             if (_this.leftSideBaseboardThickness === undefined) {
51325                 _this.leftSideBaseboardThickness = null;
51326             }
51327             if (_this.leftSideBaseboardHeight === undefined) {
51328                 _this.leftSideBaseboardHeight = null;
51329             }
51330             if (_this.leftSideBaseboardPaint === undefined) {
51331                 _this.leftSideBaseboardPaint = null;
51332             }
51333             if (_this.leftSideBaseboardColor === undefined) {
51334                 _this.leftSideBaseboardColor = null;
51335             }
51336             if (_this.leftSideBaseboardTexture === undefined) {
51337                 _this.leftSideBaseboardTexture = null;
51338             }
51339             if (_this.rightSidePaint === undefined) {
51340                 _this.rightSidePaint = null;
51341             }
51342             if (_this.rightSideColor === undefined) {
51343                 _this.rightSideColor = null;
51344             }
51345             if (_this.rightSideTexture === undefined) {
51346                 _this.rightSideTexture = null;
51347             }
51348             if (_this.rightSideShininess === undefined) {
51349                 _this.rightSideShininess = null;
51350             }
51351             if (_this.rightSideBaseboardVisible === undefined) {
51352                 _this.rightSideBaseboardVisible = null;
51353             }
51354             if (_this.rightSideBaseboardThickness === undefined) {
51355                 _this.rightSideBaseboardThickness = null;
51356             }
51357             if (_this.rightSideBaseboardHeight === undefined) {
51358                 _this.rightSideBaseboardHeight = null;
51359             }
51360             if (_this.rightSideBaseboardPaint === undefined) {
51361                 _this.rightSideBaseboardPaint = null;
51362             }
51363             if (_this.rightSideBaseboardColor === undefined) {
51364                 _this.rightSideBaseboardColor = null;
51365             }
51366             if (_this.rightSideBaseboardTexture === undefined) {
51367                 _this.rightSideBaseboardTexture = null;
51368             }
51369             if (_this.pattern === undefined) {
51370                 _this.pattern = null;
51371             }
51372             if (_this.modifiedTopColor === undefined) {
51373                 _this.modifiedTopColor = false;
51374             }
51375             if (_this.topColor === undefined) {
51376                 _this.topColor = null;
51377             }
51378             if (_this.height === undefined) {
51379                 _this.height = null;
51380             }
51381             if (_this.heightAtEnd === undefined) {
51382                 _this.heightAtEnd = null;
51383             }
51384             if (_this.thickness === undefined) {
51385                 _this.thickness = null;
51386             }
51387             if (_this.arcExtent === undefined) {
51388                 _this.arcExtent = null;
51389             }
51390             _this.home = home;
51391             _this.oldSelection = oldSelection;
51392             _this.modifiedWalls = modifiedWalls;
51393             _this.newWallBaseboardThickness = newWallBaseboardThickness;
51394             _this.newWallBaseboardHeight = newWallBaseboardHeight;
51395             _this.xStart = xStart;
51396             _this.yStart = yStart;
51397             _this.xEnd = xEnd;
51398             _this.yEnd = yEnd;
51399             _this.leftSidePaint = leftSidePaint;
51400             _this.leftSideColor = leftSideColor;
51401             _this.leftSideShininess = leftSideShininess;
51402             _this.leftSideBaseboardVisible = leftSideBaseboardVisible;
51403             _this.leftSideBaseboardThickness = leftSideBaseboardThickness;
51404             _this.leftSideBaseboardHeight = leftSideBaseboardHeight;
51405             _this.leftSideBaseboardPaint = leftSideBaseboardPaint;
51406             _this.leftSideBaseboardColor = leftSideBaseboardColor;
51407             _this.leftSideBaseboardTexture = leftSideBaseboardTexture;
51408             _this.rightSidePaint = rightSidePaint;
51409             _this.rightSideColor = rightSideColor;
51410             _this.rightSideTexture = rightSideTexture;
51411             _this.leftSideTexture = leftSideTexture;
51412             _this.rightSideShininess = rightSideShininess;
51413             _this.rightSideBaseboardVisible = rightSideBaseboardVisible;
51414             _this.rightSideBaseboardThickness = rightSideBaseboardThickness;
51415             _this.rightSideBaseboardHeight = rightSideBaseboardHeight;
51416             _this.rightSideBaseboardPaint = rightSideBaseboardPaint;
51417             _this.rightSideBaseboardColor = rightSideBaseboardColor;
51418             _this.rightSideBaseboardTexture = rightSideBaseboardTexture;
51419             _this.pattern = pattern;
51420             _this.modifiedTopColor = modifiedTopColor;
51421             _this.topColor = topColor;
51422             _this.height = height;
51423             _this.heightAtEnd = heightAtEnd;
51424             _this.thickness = thickness;
51425             _this.arcExtent = arcExtent;
51426             return _this;
51427         }
51428         /**
51429          *
51430          */
51431         WallsModificationUndoableEdit.prototype.undo = function () {
51432             _super.prototype.undo.call(this);
51433             WallController.undoModifyWalls(this.modifiedWalls);
51434             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
51435         };
51436         /**
51437          *
51438          */
51439         WallsModificationUndoableEdit.prototype.redo = function () {
51440             _super.prototype.redo.call(this);
51441             WallController.doModifyWalls(this.modifiedWalls, this.newWallBaseboardThickness, this.newWallBaseboardHeight, this.xStart, this.yStart, this.xEnd, this.yEnd, this.leftSidePaint, this.leftSideColor, this.leftSideTexture, this.leftSideShininess, this.leftSideBaseboardVisible, this.leftSideBaseboardThickness, this.leftSideBaseboardHeight, this.leftSideBaseboardPaint, this.leftSideBaseboardColor, this.leftSideBaseboardTexture, this.rightSidePaint, this.rightSideColor, this.rightSideTexture, this.rightSideShininess, this.rightSideBaseboardVisible, this.rightSideBaseboardThickness, this.rightSideBaseboardHeight, this.rightSideBaseboardPaint, this.rightSideBaseboardColor, this.rightSideBaseboardTexture, this.pattern, this.modifiedTopColor, this.topColor, this.height, this.heightAtEnd, this.thickness, this.arcExtent);
51442             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
51443         };
51444         return WallsModificationUndoableEdit;
51445     }(LocalizedUndoableEdit));
51446     WallController.WallsModificationUndoableEdit = WallsModificationUndoableEdit;
51447     WallsModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.WallController.WallsModificationUndoableEdit";
51448     WallsModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
51449     /**
51450      * Stores the current properties values of a modified wall.
51451      * @param {Wall} wall
51452      * @class
51453      */
51454     var ModifiedWall = /** @class */ (function () {
51455         function ModifiedWall(wall) {
51456             if (this.wall === undefined) {
51457                 this.wall = null;
51458             }
51459             if (this.xStart === undefined) {
51460                 this.xStart = 0;
51461             }
51462             if (this.yStart === undefined) {
51463                 this.yStart = 0;
51464             }
51465             if (this.xEnd === undefined) {
51466                 this.xEnd = 0;
51467             }
51468             if (this.yEnd === undefined) {
51469                 this.yEnd = 0;
51470             }
51471             if (this.leftSideColor === undefined) {
51472                 this.leftSideColor = null;
51473             }
51474             if (this.leftSideTexture === undefined) {
51475                 this.leftSideTexture = null;
51476             }
51477             if (this.leftSideShininess === undefined) {
51478                 this.leftSideShininess = 0;
51479             }
51480             if (this.leftSideBaseboard === undefined) {
51481                 this.leftSideBaseboard = null;
51482             }
51483             if (this.rightSideColor === undefined) {
51484                 this.rightSideColor = null;
51485             }
51486             if (this.rightSideTexture === undefined) {
51487                 this.rightSideTexture = null;
51488             }
51489             if (this.rightSideShininess === undefined) {
51490                 this.rightSideShininess = 0;
51491             }
51492             if (this.rightSideBaseboard === undefined) {
51493                 this.rightSideBaseboard = null;
51494             }
51495             if (this.pattern === undefined) {
51496                 this.pattern = null;
51497             }
51498             if (this.topColor === undefined) {
51499                 this.topColor = null;
51500             }
51501             if (this.height === undefined) {
51502                 this.height = null;
51503             }
51504             if (this.heightAtEnd === undefined) {
51505                 this.heightAtEnd = null;
51506             }
51507             if (this.thickness === undefined) {
51508                 this.thickness = 0;
51509             }
51510             if (this.arcExtent === undefined) {
51511                 this.arcExtent = null;
51512             }
51513             this.wall = wall;
51514             this.xStart = wall.getXStart();
51515             this.yStart = wall.getYStart();
51516             this.xEnd = wall.getXEnd();
51517             this.yEnd = wall.getYEnd();
51518             this.leftSideColor = wall.getLeftSideColor();
51519             this.leftSideTexture = wall.getLeftSideTexture();
51520             this.leftSideShininess = wall.getLeftSideShininess();
51521             this.leftSideBaseboard = wall.getLeftSideBaseboard();
51522             this.rightSideColor = wall.getRightSideColor();
51523             this.rightSideTexture = wall.getRightSideTexture();
51524             this.rightSideShininess = wall.getRightSideShininess();
51525             this.rightSideBaseboard = wall.getRightSideBaseboard();
51526             this.pattern = wall.getPattern();
51527             this.topColor = wall.getTopColor();
51528             this.height = wall.getHeight();
51529             this.heightAtEnd = wall.getHeightAtEnd();
51530             this.thickness = wall.getThickness();
51531             this.arcExtent = wall.getArcExtent();
51532         }
51533         ModifiedWall.prototype.getWall = function () {
51534             return this.wall;
51535         };
51536         ModifiedWall.prototype.getXStart = function () {
51537             return this.xStart;
51538         };
51539         ModifiedWall.prototype.getXEnd = function () {
51540             return this.xEnd;
51541         };
51542         ModifiedWall.prototype.getYStart = function () {
51543             return this.yStart;
51544         };
51545         ModifiedWall.prototype.getYEnd = function () {
51546             return this.yEnd;
51547         };
51548         ModifiedWall.prototype.getHeight = function () {
51549             return this.height;
51550         };
51551         ModifiedWall.prototype.getHeightAtEnd = function () {
51552             return this.heightAtEnd;
51553         };
51554         ModifiedWall.prototype.getLeftSideColor = function () {
51555             return this.leftSideColor;
51556         };
51557         ModifiedWall.prototype.getLeftSideTexture = function () {
51558             return this.leftSideTexture;
51559         };
51560         ModifiedWall.prototype.getLeftSideShininess = function () {
51561             return this.leftSideShininess;
51562         };
51563         ModifiedWall.prototype.getLeftSideBaseboard = function () {
51564             return this.leftSideBaseboard;
51565         };
51566         ModifiedWall.prototype.getRightSideColor = function () {
51567             return this.rightSideColor;
51568         };
51569         ModifiedWall.prototype.getRightSideTexture = function () {
51570             return this.rightSideTexture;
51571         };
51572         ModifiedWall.prototype.getRightSideShininess = function () {
51573             return this.rightSideShininess;
51574         };
51575         ModifiedWall.prototype.getRightSideBaseboard = function () {
51576             return this.rightSideBaseboard;
51577         };
51578         ModifiedWall.prototype.getPattern = function () {
51579             return this.pattern;
51580         };
51581         ModifiedWall.prototype.getTopColor = function () {
51582             return this.topColor;
51583         };
51584         ModifiedWall.prototype.getThickness = function () {
51585             return this.thickness;
51586         };
51587         ModifiedWall.prototype.getArcExtent = function () {
51588             return this.arcExtent;
51589         };
51590         return ModifiedWall;
51591     }());
51592     WallController.ModifiedWall = ModifiedWall;
51593     ModifiedWall["__class"] = "com.eteks.sweethome3d.viewcontroller.WallController.ModifiedWall";
51594     var WallController$0 = /** @class */ (function () {
51595         function WallController$0(__parent) {
51596             this.__parent = __parent;
51597         }
51598         WallController$0.prototype.propertyChange = function (ev) {
51599             this.__parent.setLeftSidePaint(WallController.WallPaint.TEXTURED);
51600         };
51601         return WallController$0;
51602     }());
51603     WallController.WallController$0 = WallController$0;
51604     var WallController$1 = /** @class */ (function () {
51605         function WallController$1(__parent) {
51606             this.__parent = __parent;
51607         }
51608         WallController$1.prototype.propertyChange = function (ev) {
51609             this.__parent.setRightSidePaint(WallController.WallPaint.TEXTURED);
51610         };
51611         return WallController$1;
51612     }());
51613     WallController.WallController$1 = WallController$1;
51614 })(WallController || (WallController = {}));
51615 /**
51616  * Creates the controller of home furniture view with undo support.
51617  * @param {Home} home
51618  * @param {UserPreferences} preferences
51619  * @param {Object} viewFactory
51620  * @param {Object} contentManager
51621  * @param {javax.swing.undo.UndoableEditSupport} undoSupport
51622  * @class
51623  * @author Emmanuel Puybaret
51624  */
51625 var FurnitureController = /** @class */ (function () {
51626     function FurnitureController(home, preferences, viewFactory, contentManager, undoSupport) {
51627         if (((home != null && home instanceof Home) || home === null) && ((preferences != null && preferences instanceof UserPreferences) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || viewFactory === null) && ((contentManager != null && (contentManager.constructor != null && contentManager.constructor["__interfaces"] != null && contentManager.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ContentManager") >= 0)) || contentManager === null) && ((undoSupport != null && undoSupport instanceof javax.swing.undo.UndoableEditSupport) || undoSupport === null)) {
51628             var __args = arguments;
51629             if (this.home === undefined) {
51630                 this.home = null;
51631             }
51632             if (this.preferences === undefined) {
51633                 this.preferences = null;
51634             }
51635             if (this.viewFactory === undefined) {
51636                 this.viewFactory = null;
51637             }
51638             if (this.contentManager === undefined) {
51639                 this.contentManager = null;
51640             }
51641             if (this.undoSupport === undefined) {
51642                 this.undoSupport = null;
51643             }
51644             if (this.furnitureView === undefined) {
51645                 this.furnitureView = null;
51646             }
51647             if (this.leadSelectedPieceOfFurniture === undefined) {
51648                 this.leadSelectedPieceOfFurniture = null;
51649             }
51650             this.home = home;
51651             this.preferences = preferences;
51652             this.viewFactory = viewFactory;
51653             this.undoSupport = undoSupport;
51654             this.contentManager = contentManager;
51655             this.addModelListeners();
51656         }
51657         else if (((home != null && home instanceof Home) || home === null) && ((preferences != null && preferences instanceof UserPreferences) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || viewFactory === null) && contentManager === undefined && undoSupport === undefined) {
51658             var __args = arguments;
51659             {
51660                 var __args_128 = arguments;
51661                 var contentManager_18 = null;
51662                 var undoSupport_9 = null;
51663                 if (this.home === undefined) {
51664                     this.home = null;
51665                 }
51666                 if (this.preferences === undefined) {
51667                     this.preferences = null;
51668                 }
51669                 if (this.viewFactory === undefined) {
51670                     this.viewFactory = null;
51671                 }
51672                 if (this.contentManager === undefined) {
51673                     this.contentManager = null;
51674                 }
51675                 if (this.undoSupport === undefined) {
51676                     this.undoSupport = null;
51677                 }
51678                 if (this.furnitureView === undefined) {
51679                     this.furnitureView = null;
51680                 }
51681                 if (this.leadSelectedPieceOfFurniture === undefined) {
51682                     this.leadSelectedPieceOfFurniture = null;
51683                 }
51684                 this.home = home;
51685                 this.preferences = preferences;
51686                 this.viewFactory = viewFactory;
51687                 this.undoSupport = undoSupport_9;
51688                 this.contentManager = contentManager_18;
51689                 this.addModelListeners();
51690             }
51691             if (this.home === undefined) {
51692                 this.home = null;
51693             }
51694             if (this.preferences === undefined) {
51695                 this.preferences = null;
51696             }
51697             if (this.viewFactory === undefined) {
51698                 this.viewFactory = null;
51699             }
51700             if (this.contentManager === undefined) {
51701                 this.contentManager = null;
51702             }
51703             if (this.undoSupport === undefined) {
51704                 this.undoSupport = null;
51705             }
51706             if (this.furnitureView === undefined) {
51707                 this.furnitureView = null;
51708             }
51709             if (this.leadSelectedPieceOfFurniture === undefined) {
51710                 this.leadSelectedPieceOfFurniture = null;
51711             }
51712         }
51713         else
51714             throw new Error('invalid overload');
51715     }
51716     /**
51717      * Returns the view associated with this controller.
51718      * @return {Object}
51719      */
51720     FurnitureController.prototype.getView = function () {
51721         if (this.furnitureView == null) {
51722             this.furnitureView = this.viewFactory.createFurnitureView(this.home, this.preferences, this);
51723         }
51724         return this.furnitureView;
51725     };
51726     FurnitureController.prototype.addModelListeners = function () {
51727         this.home.addSelectionListener(new FurnitureController.FurnitureController$0(this));
51728         var furnitureChangeListener = new FurnitureController.FurnitureController$1(this);
51729         {
51730             var array = this.home.getFurniture();
51731             for (var index = 0; index < array.length; index++) {
51732                 var piece = array[index];
51733                 {
51734                     piece.addPropertyChangeListener(furnitureChangeListener);
51735                     if (piece != null && piece instanceof HomeFurnitureGroup) {
51736                         {
51737                             var array1 = piece.getAllFurniture();
51738                             for (var index1 = 0; index1 < array1.length; index1++) {
51739                                 var childPiece = array1[index1];
51740                                 {
51741                                     childPiece.addPropertyChangeListener(furnitureChangeListener);
51742                                 }
51743                             }
51744                         }
51745                     }
51746                 }
51747             }
51748         }
51749         this.home.addFurnitureListener(function (ev) {
51750             var piece = ev.getItem();
51751             if (ev.getType() === CollectionEvent.Type.ADD) {
51752                 piece.addPropertyChangeListener(furnitureChangeListener);
51753                 if (piece != null && piece instanceof HomeFurnitureGroup) {
51754                     {
51755                         var array = piece.getAllFurniture();
51756                         for (var index = 0; index < array.length; index++) {
51757                             var childPiece = array[index];
51758                             {
51759                                 childPiece.addPropertyChangeListener(furnitureChangeListener);
51760                             }
51761                         }
51762                     }
51763                 }
51764             }
51765             else if (ev.getType() === CollectionEvent.Type.DELETE) {
51766                 piece.removePropertyChangeListener(furnitureChangeListener);
51767                 if (piece != null && piece instanceof HomeFurnitureGroup) {
51768                     {
51769                         var array = piece.getAllFurniture();
51770                         for (var index = 0; index < array.length; index++) {
51771                             var childPiece = array[index];
51772                             {
51773                                 childPiece.removePropertyChangeListener(furnitureChangeListener);
51774                             }
51775                         }
51776                     }
51777                 }
51778             }
51779         });
51780     };
51781     FurnitureController.prototype.addFurniture$java_util_List = function (furniture) {
51782         this.addFurniture$java_util_List$com_eteks_sweethome3d_model_Level_A$com_eteks_sweethome3d_model_HomeFurnitureGroup$com_eteks_sweethome3d_model_HomePieceOfFurniture(furniture, null, null, null);
51783     };
51784     FurnitureController.prototype.addFurniture$java_util_List$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (furniture, beforePiece) {
51785         this.addFurniture$java_util_List$com_eteks_sweethome3d_model_Level_A$com_eteks_sweethome3d_model_HomeFurnitureGroup$com_eteks_sweethome3d_model_HomePieceOfFurniture(furniture, null, null, beforePiece);
51786     };
51787     /**
51788      * Controls new furniture added to the given group.
51789      * Once added the furniture will be selected in view
51790      * and undo support will receive a new undoable edit.
51791      * @param {HomePieceOfFurniture[]} furniture the furniture to add.
51792      * @param {HomeFurnitureGroup} group     the group to which furniture will be added.
51793      */
51794     FurnitureController.prototype.addFurnitureToGroup = function (furniture, group) {
51795         if (group == null) {
51796             throw new IllegalArgumentException("Group shouldn\'t be null");
51797         }
51798         this.addFurniture$java_util_List$com_eteks_sweethome3d_model_Level_A$com_eteks_sweethome3d_model_HomeFurnitureGroup$com_eteks_sweethome3d_model_HomePieceOfFurniture(furniture, null, group, null);
51799     };
51800     FurnitureController.prototype.addFurniture$java_util_List$com_eteks_sweethome3d_model_Level_A$com_eteks_sweethome3d_model_HomeFurnitureGroup$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (furniture, furnitureLevels, group, beforePiece) {
51801         var oldBasePlanLocked = this.home.isBasePlanLocked();
51802         var allLevelsSelection = this.home.isAllLevelsSelection();
51803         var oldSelection = this.home.getSelectedItems();
51804         var newFurniture = furniture.slice(0);
51805         var newFurnitureIndex = (function (s) { var a = []; while (s-- > 0)
51806             a.push(0); return a; })(/* size */ furniture.length);
51807         var insertIndex = group == null ? /* size */ this.home.getFurniture().length : /* size */ group.getFurniture().length;
51808         if (beforePiece != null) {
51809             var parentFurniture = this.home.getFurniture();
51810             group = FurnitureController.getPieceOfFurnitureGroup(beforePiece, null, parentFurniture);
51811             if (group != null) {
51812                 parentFurniture = group.getFurniture();
51813             }
51814             insertIndex = parentFurniture.indexOf(beforePiece);
51815         }
51816         var newFurnitureGroups = group != null ? (function (s) { var a = []; while (s-- > 0)
51817             a.push(null); return a; })(/* size */ furniture.length) : null;
51818         var basePlanLocked = oldBasePlanLocked;
51819         var levelUpdated = group != null || furnitureLevels == null;
51820         for (var i = 0; i < newFurnitureIndex.length; i++) {
51821             {
51822                 newFurnitureIndex[i] = insertIndex++;
51823                 basePlanLocked = !this.isPieceOfFurniturePartOfBasePlan(newFurniture[i]) && basePlanLocked;
51824                 if (furnitureLevels != null) {
51825                     levelUpdated = furnitureLevels[i] == null || levelUpdated;
51826                 }
51827                 if (newFurnitureGroups != null) {
51828                     newFurnitureGroups[i] = group;
51829                 }
51830             }
51831             ;
51832         }
51833         var newFurnitureLevels = levelUpdated ? null : furnitureLevels;
51834         var newBasePlanLocked = basePlanLocked;
51835         var furnitureLevel = group != null ? group.getLevel() : this.home.getSelectedLevel();
51836         FurnitureController.doAddFurniture(this.home, newFurniture, newFurnitureGroups, newFurnitureIndex, furnitureLevel, newFurnitureLevels, newBasePlanLocked, false);
51837         if (this.undoSupport != null) {
51838             this.undoSupport.postEdit(new FurnitureController.FurnitureAdditionUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), oldBasePlanLocked, allLevelsSelection, newFurniture, newFurnitureIndex, newFurnitureGroups, newFurnitureLevels, furnitureLevel, newBasePlanLocked));
51839         }
51840     };
51841     FurnitureController.prototype.addFurniture = function (furniture, furnitureLevels, group, beforePiece) {
51842         if (((furniture != null && (furniture instanceof Array)) || furniture === null) && ((furnitureLevels != null && furnitureLevels instanceof Array && (furnitureLevels.length == 0 || furnitureLevels[0] == null || (furnitureLevels[0] != null && furnitureLevels[0] instanceof Level))) || furnitureLevels === null) && ((group != null && group instanceof HomeFurnitureGroup) || group === null) && ((beforePiece != null && beforePiece instanceof HomePieceOfFurniture) || beforePiece === null)) {
51843             return this.addFurniture$java_util_List$com_eteks_sweethome3d_model_Level_A$com_eteks_sweethome3d_model_HomeFurnitureGroup$com_eteks_sweethome3d_model_HomePieceOfFurniture(furniture, furnitureLevels, group, beforePiece);
51844         }
51845         else if (((furniture != null && (furniture instanceof Array)) || furniture === null) && ((furnitureLevels != null && furnitureLevels instanceof HomePieceOfFurniture) || furnitureLevels === null) && group === undefined && beforePiece === undefined) {
51846             return this.addFurniture$java_util_List$com_eteks_sweethome3d_model_HomePieceOfFurniture(furniture, furnitureLevels);
51847         }
51848         else if (((furniture != null && (furniture instanceof Array)) || furniture === null) && furnitureLevels === undefined && group === undefined && beforePiece === undefined) {
51849             return this.addFurniture$java_util_List(furniture);
51850         }
51851         else
51852             throw new Error('invalid overload');
51853     };
51854     FurnitureController.doAddFurniture = function (home, furniture, furnitureGroups, furnitureIndex, furnitureLevel, furnitureLevels, basePlanLocked, allLevelsSelection) {
51855         for (var i = 0; i < furnitureIndex.length; i++) {
51856             {
51857                 if (furnitureGroups != null && furnitureGroups[i] != null) {
51858                     home.addPieceOfFurnitureToGroup(furniture[i], furnitureGroups[i], furnitureIndex[i]);
51859                     furniture[i].setVisible(furnitureGroups[i].isVisible());
51860                 }
51861                 else {
51862                     home.addPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$int(furniture[i], furnitureIndex[i]);
51863                 }
51864                 furniture[i].setLevel(furnitureLevels != null ? furnitureLevels[i] : furnitureLevel);
51865             }
51866             ;
51867         }
51868         home.setBasePlanLocked(basePlanLocked);
51869         home.setSelectedItems(/* asList */ furniture.slice(0));
51870         home.setAllLevelsSelection(allLevelsSelection);
51871     };
51872     /**
51873      * Controls the deletion of the current selected furniture in home.
51874      * Once the selected furniture is deleted, undo support will receive a new undoable edit.
51875      */
51876     FurnitureController.prototype.deleteSelection = function () {
51877         this.deleteFurniture(Home.getFurnitureSubList(this.home.getSelectedItems()));
51878     };
51879     /**
51880      * Deletes the furniture of <code>deletedFurniture</code> from home.
51881      * Once the selected furniture is deleted, undo support will receive a new undoable edit.
51882      * @param {HomePieceOfFurniture[]} deletedFurniture
51883      */
51884     FurnitureController.prototype.deleteFurniture = function (deletedFurniture) {
51885         var basePlanLocked = this.home.isBasePlanLocked();
51886         var allLevelsSelection = this.home.isAllLevelsSelection();
51887         var oldSelection = this.home.getSelectedItems();
51888         var homeFurniture = this.home.getFurniture();
51889         deletedFurniture = (deletedFurniture.slice(0));
51890         var homeGroups = ([]);
51891         FurnitureController.searchGroups(homeFurniture, homeGroups);
51892         var updated;
51893         do {
51894             {
51895                 updated = false;
51896                 for (var index = 0; index < homeGroups.length; index++) {
51897                     var group = homeGroups[index];
51898                     {
51899                         var groupFurniture = group.getFurniture();
51900                         if ( /* containsAll */(function (a, r) { for (var i_6 = 0; i_6 < r.length; i_6++) {
51901                             if (a.indexOf(r[i_6]) < 0)
51902                                 return false;
51903                         } return true; })(deletedFurniture, groupFurniture)) {
51904                             /* removeAll */ (function (a, r) { var b = false; for (var i_7 = 0; i_7 < r.length; i_7++) {
51905                                 var ndx = a.indexOf(r[i_7]);
51906                                 if (ndx >= 0) {
51907                                     a.splice(ndx, 1);
51908                                     b = true;
51909                                 }
51910                             } return b; })(deletedFurniture, groupFurniture);
51911                             /* add */ (deletedFurniture.push(group) > 0);
51912                             updated = true;
51913                         }
51914                     }
51915                 }
51916             }
51917         } while ((updated));
51918         var deletedFurnitureMap = ({});
51919         var deletedFurnitureCount = 0;
51920         for (var index = 0; index < deletedFurniture.length; index++) {
51921             var piece = deletedFurniture[index];
51922             {
51923                 if (this.isPieceOfFurnitureDeletable(piece)) {
51924                     var group = FurnitureController.getPieceOfFurnitureGroup(piece, null, homeFurniture);
51925                     var sortedMap = (function (m, k) { if (m.entries == null)
51926                         m.entries = []; for (var i_8 = 0; i_8 < m.entries.length; i_8++)
51927                         if (m.entries[i_8].key == null && k == null || m.entries[i_8].key.equals != null && m.entries[i_8].key.equals(k) || m.entries[i_8].key === k) {
51928                             return m.entries[i_8].value;
51929                         } return null; })(deletedFurnitureMap, group);
51930                     if (sortedMap == null) {
51931                         sortedMap = ({});
51932                         /* put */ (function (m, k, v) { if (m.entries == null)
51933                             m.entries = []; for (var i_9 = 0; i_9 < m.entries.length; i_9++)
51934                             if (m.entries[i_9].key == null && k == null || m.entries[i_9].key.equals != null && m.entries[i_9].key.equals(k) || m.entries[i_9].key === k) {
51935                                 m.entries[i_9].value = v;
51936                                 return;
51937                             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(deletedFurnitureMap, group, sortedMap);
51938                     }
51939                     if (group == null) {
51940                         /* put */ (function (m, k, v) { if (m.entries == null)
51941                             m.entries = []; for (var i = 0; i < m.entries.length; i++)
51942                             if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
51943                                 var pv = m.entries[i].value;
51944                                 m.entries[i].value = v;
51945                                 return pv;
51946                             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); m.entries.sort(function (e1, e2) { return (e1.key.compareTo != null) ? e1.key.compareTo(e2) : (e1.key - e2.key); }); return null; })(sortedMap, homeFurniture.indexOf(piece), piece);
51947                     }
51948                     else {
51949                         /* put */ (function (m, k, v) { if (m.entries == null)
51950                             m.entries = []; for (var i = 0; i < m.entries.length; i++)
51951                             if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
51952                                 var pv = m.entries[i].value;
51953                                 m.entries[i].value = v;
51954                                 return pv;
51955                             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); m.entries.sort(function (e1, e2) { return (e1.key.compareTo != null) ? e1.key.compareTo(e2) : (e1.key - e2.key); }); return null; })(sortedMap, group.getFurniture().indexOf(piece), piece);
51956                     }
51957                     deletedFurnitureCount++;
51958                 }
51959             }
51960         }
51961         var furniture = (function (s) { var a = []; while (s-- > 0)
51962             a.push(null); return a; })(deletedFurnitureCount);
51963         var furnitureIndex = (function (s) { var a = []; while (s-- > 0)
51964             a.push(0); return a; })(furniture.length);
51965         var furnitureLevels = (function (s) { var a = []; while (s-- > 0)
51966             a.push(null); return a; })(furniture.length);
51967         var furnitureGroups = (function (s) { var a = []; while (s-- > 0)
51968             a.push(null); return a; })(furniture.length);
51969         var i = 0;
51970         {
51971             var array = /* entrySet */ (function (m) { if (m.entries == null)
51972                 m.entries = []; return m.entries; })(deletedFurnitureMap);
51973             for (var index = 0; index < array.length; index++) {
51974                 var sortedMapEntry = array[index];
51975                 {
51976                     {
51977                         var array1 = /* entrySet */ (function (m) { if (m.entries == null)
51978                             m.entries = []; return m.entries; })(sortedMapEntry.getValue());
51979                         for (var index1 = 0; index1 < array1.length; index1++) {
51980                             var pieceEntry = array1[index1];
51981                             {
51982                                 furniture[i] = pieceEntry.getValue();
51983                                 furnitureIndex[i] = pieceEntry.getKey();
51984                                 furnitureLevels[i] = furniture[i].getLevel();
51985                                 furnitureGroups[i++] = sortedMapEntry.getKey();
51986                             }
51987                         }
51988                     }
51989                 }
51990             }
51991         }
51992         FurnitureController.doDeleteFurniture(this.home, furniture, basePlanLocked, false);
51993         if (this.undoSupport != null) {
51994             this.undoSupport.postEdit(new FurnitureController.FurnitureDeletionUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), basePlanLocked, allLevelsSelection, furniture, furnitureIndex, furnitureGroups, furnitureLevels));
51995         }
51996     };
51997     FurnitureController.doDeleteFurniture = function (home, furniture, basePlanLocked, allLevelsSelection) {
51998         for (var index = 0; index < furniture.length; index++) {
51999             var piece = furniture[index];
52000             {
52001                 home.deletePieceOfFurniture(piece);
52002             }
52003         }
52004         home.setBasePlanLocked(basePlanLocked);
52005         home.setAllLevelsSelection(allLevelsSelection);
52006     };
52007     /**
52008      * Searches all the groups among furniture and its children.
52009      * @param {HomePieceOfFurniture[]} furniture
52010      * @param {HomeFurnitureGroup[]} groups
52011      * @private
52012      */
52013     FurnitureController.searchGroups = function (furniture, groups) {
52014         for (var index = 0; index < furniture.length; index++) {
52015             var piece = furniture[index];
52016             {
52017                 if (piece != null && piece instanceof HomeFurnitureGroup) {
52018                     /* add */ (groups.push(piece) > 0);
52019                     FurnitureController.searchGroups(piece.getFurniture(), groups);
52020                 }
52021             }
52022         }
52023     };
52024     /**
52025      * Returns the furniture group that contains the given <code>piece</code> or <code>null</code> if it can't be found.
52026      * @param {HomePieceOfFurniture} piece
52027      * @param {HomeFurnitureGroup} furnitureGroup
52028      * @param {HomePieceOfFurniture[]} furniture
52029      * @return {HomeFurnitureGroup}
52030      * @private
52031      */
52032     FurnitureController.getPieceOfFurnitureGroup = function (piece, furnitureGroup, furniture) {
52033         for (var index = 0; index < furniture.length; index++) {
52034             var homePiece = furniture[index];
52035             {
52036                 if ( /* equals */(function (o1, o2) { if (o1 && o1.equals) {
52037                     return o1.equals(o2);
52038                 }
52039                 else {
52040                     return o1 === o2;
52041                 } })(homePiece, piece)) {
52042                     return furnitureGroup;
52043                 }
52044                 else if (homePiece != null && homePiece instanceof HomeFurnitureGroup) {
52045                     var group = FurnitureController.getPieceOfFurnitureGroup(piece, homePiece, homePiece.getFurniture());
52046                     if (group != null) {
52047                         return group;
52048                     }
52049                 }
52050             }
52051         }
52052         return null;
52053     };
52054     /**
52055      * Reorders the selected furniture in home to place it before the given piece.
52056      * @param {HomePieceOfFurniture} beforePiece
52057      */
52058     FurnitureController.prototype.moveSelectedFurnitureBefore = function (beforePiece) {
52059         var movedFurniture = Home.getFurnitureSubList(this.home.getSelectedItems());
52060         if (!(movedFurniture.length == 0)) {
52061             var furnitureLevels = (function (s) { var a = []; while (s-- > 0)
52062                 a.push(null); return a; })(/* size */ movedFurniture.length);
52063             for (var i = 0; i < furnitureLevels.length; i++) {
52064                 {
52065                     furnitureLevels[i] = /* get */ movedFurniture[i].getLevel();
52066                 }
52067                 ;
52068             }
52069             this.undoSupport.beginUpdate();
52070             this.deleteFurniture(movedFurniture);
52071             this.addFurniture$java_util_List$com_eteks_sweethome3d_model_Level_A$com_eteks_sweethome3d_model_HomeFurnitureGroup$com_eteks_sweethome3d_model_HomePieceOfFurniture(movedFurniture, furnitureLevels, null, beforePiece);
52072             this.undoSupport.postEdit(new LocalizedUndoableEdit(this.preferences, FurnitureController, "undoReorderName"));
52073             this.undoSupport.endUpdate();
52074         }
52075     };
52076     FurnitureController.prototype.setSelectedFurniture$java_util_List = function (selectedFurniture) {
52077         this.setSelectedFurniture$java_util_List$boolean(selectedFurniture, true);
52078     };
52079     FurnitureController.prototype.setSelectedFurniture$java_util_List$boolean = function (selectedFurniture, resetSelection) {
52080         if (this.home.isBasePlanLocked()) {
52081             selectedFurniture = this.getFurnitureNotPartOfBasePlan(selectedFurniture);
52082         }
52083         if (resetSelection) {
52084             this.home.setSelectedItems(selectedFurniture);
52085             this.home.setAllLevelsSelection(false);
52086         }
52087         else {
52088             var selectedItems = (this.home.getSelectedItems().slice(0));
52089             selectedFurniture = (selectedFurniture.slice(0));
52090             for (var i = selectedItems.length - 1; i >= 0; i--) {
52091                 {
52092                     var item = selectedItems[i];
52093                     if (item != null && item instanceof HomePieceOfFurniture) {
52094                         var index = selectedFurniture.indexOf(item);
52095                         if (index >= 0) {
52096                             /* remove */ selectedFurniture.splice(index, 1)[0];
52097                         }
52098                         else {
52099                             /* remove */ selectedItems.splice(i, 1)[0];
52100                         }
52101                     }
52102                 }
52103                 ;
52104             }
52105             /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(selectedItems, selectedFurniture);
52106             this.home.setSelectedItems(selectedItems);
52107         }
52108     };
52109     /**
52110      * Updates the selected furniture in home, unselecting all other kinds of selected objects
52111      * when <code>resetSelection</code> is <code>true</code>.
52112      * @param {HomePieceOfFurniture[]} selectedFurniture
52113      * @param {boolean} resetSelection
52114      */
52115     FurnitureController.prototype.setSelectedFurniture = function (selectedFurniture, resetSelection) {
52116         if (((selectedFurniture != null && (selectedFurniture instanceof Array)) || selectedFurniture === null) && ((typeof resetSelection === 'boolean') || resetSelection === null)) {
52117             return this.setSelectedFurniture$java_util_List$boolean(selectedFurniture, resetSelection);
52118         }
52119         else if (((selectedFurniture != null && (selectedFurniture instanceof Array)) || selectedFurniture === null) && resetSelection === undefined) {
52120             return this.setSelectedFurniture$java_util_List(selectedFurniture);
52121         }
52122         else
52123             throw new Error('invalid overload');
52124     };
52125     /**
52126      * Selects all furniture in home.
52127      */
52128     FurnitureController.prototype.selectAll = function () {
52129         this.setSelectedFurniture$java_util_List(this.home.getFurniture());
52130     };
52131     /**
52132      * Returns <code>true</code> if the given <code>piece</code> isn't movable.
52133      * @param {HomePieceOfFurniture} piece
52134      * @return {boolean}
52135      */
52136     FurnitureController.prototype.isPieceOfFurniturePartOfBasePlan = function (piece) {
52137         return !piece.isMovable() || piece.isDoorOrWindow();
52138     };
52139     /**
52140      * Returns <code>true</code> if the given <code>piece</code> may be moved.
52141      * Default implementation always returns <code>true</code>.
52142      * @param {HomePieceOfFurniture} piece
52143      * @return {boolean}
52144      */
52145     FurnitureController.prototype.isPieceOfFurnitureMovable = function (piece) {
52146         return true;
52147     };
52148     /**
52149      * Returns <code>true</code> if the given <code>piece</code> may be deleted.
52150      * Default implementation always returns <code>true</code>.
52151      * @param {HomePieceOfFurniture} piece
52152      * @return {boolean}
52153      */
52154     FurnitureController.prototype.isPieceOfFurnitureDeletable = function (piece) {
52155         return true;
52156     };
52157     /**
52158      * Returns a new home piece of furniture created from an other given <code>piece</code> of furniture.
52159      * @param {Object} piece
52160      * @return {HomePieceOfFurniture}
52161      */
52162     FurnitureController.prototype.createHomePieceOfFurniture = function (piece) {
52163         var properties = (piece.getPropertyNames().slice(0));
52164         for (var i = properties.length - 1; i >= 0; i--) {
52165             {
52166                 var property = properties[i];
52167                 if ( /* startsWith */(function (str, searchString, position) {
52168                     if (position === void 0) { position = 0; }
52169                     return str.substr(position, searchString.length) === searchString;
52170                 })(property, "modelPresetTransformationsName_") || /* startsWith */ (function (str, searchString, position) {
52171                     if (position === void 0) { position = 0; }
52172                     return str.substr(position, searchString.length) === searchString;
52173                 })(property, "modelPresetTransformations_")) {
52174                     /* remove */ properties.splice(i, 1)[0];
52175                 }
52176             }
52177             ;
52178         }
52179         var copiedProperties = properties.slice(0);
52180         if (piece != null && (piece.constructor != null && piece.constructor["__interfaces"] != null && piece.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.DoorOrWindow") >= 0)) {
52181             return new HomeDoorOrWindow(piece, copiedProperties);
52182         }
52183         else if (piece != null && (piece.constructor != null && piece.constructor["__interfaces"] != null && piece.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Light") >= 0)) {
52184             return new HomeLight(piece, copiedProperties);
52185         }
52186         else if (piece != null && (piece.constructor != null && piece.constructor["__interfaces"] != null && piece.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.ShelfUnit") >= 0)) {
52187             return new HomeShelfUnit(piece, copiedProperties);
52188         }
52189         else {
52190             return new HomePieceOfFurniture(piece, copiedProperties);
52191         }
52192     };
52193     /**
52194      * Returns the furniture among the given list that are not part of the base plan.
52195      * @param {HomePieceOfFurniture[]} furniture
52196      * @return {HomePieceOfFurniture[]}
52197      * @private
52198      */
52199     FurnitureController.prototype.getFurnitureNotPartOfBasePlan = function (furniture) {
52200         var furnitureNotPartOfBasePlan = ([]);
52201         for (var index = 0; index < furniture.length; index++) {
52202             var piece = furniture[index];
52203             {
52204                 if (!this.isPieceOfFurniturePartOfBasePlan(piece)) {
52205                     /* add */ (furnitureNotPartOfBasePlan.push(piece) > 0);
52206                 }
52207             }
52208         }
52209         return furnitureNotPartOfBasePlan;
52210     };
52211     FurnitureController.prototype.toggleFurnitureSort$java_lang_String = function (furniturePropertyName) {
52212         if (furniturePropertyName === this.home.getFurnitureSortedPropertyName()) {
52213             this.home.setFurnitureSortedPropertyName(null);
52214         }
52215         else {
52216             this.home.setFurnitureSortedPropertyName(furniturePropertyName);
52217         }
52218     };
52219     /**
52220      * Uses <code>furniturePropertyName</code> to sort home furniture
52221      * or cancels home furniture sort if home is already sorted on <code>furnitureProperty</code>
52222      * @param {string} furniturePropertyName a property of {@link HomePieceOfFurniture} class.
52223      */
52224     FurnitureController.prototype.toggleFurnitureSort = function (furniturePropertyName) {
52225         if (((typeof furniturePropertyName === 'string') || furniturePropertyName === null)) {
52226             return this.toggleFurnitureSort$java_lang_String(furniturePropertyName);
52227         }
52228         else if (((typeof furniturePropertyName === 'number') || furniturePropertyName === null)) {
52229             return this.toggleFurnitureSort$com_eteks_sweethome3d_model_HomePieceOfFurniture_SortableProperty(furniturePropertyName);
52230         }
52231         else
52232             throw new Error('invalid overload');
52233     };
52234     FurnitureController.prototype.toggleFurnitureSort$com_eteks_sweethome3d_model_HomePieceOfFurniture_SortableProperty = function (furnitureProperty) {
52235         if ( /* equals */(furnitureProperty == this.home.getFurnitureSortedProperty())) {
52236             this.home.setFurnitureSortedProperty(null);
52237         }
52238         else {
52239             this.home.setFurnitureSortedProperty(furnitureProperty);
52240         }
52241     };
52242     /**
52243      * Toggles home furniture sort order.
52244      */
52245     FurnitureController.prototype.toggleFurnitureSortOrder = function () {
52246         this.home.setFurnitureDescendingSorted(!this.home.isFurnitureDescendingSorted());
52247     };
52248     FurnitureController.prototype.sortFurniture$java_lang_String = function (furniturePropertyName) {
52249         var oldPropertyName = this.home.getFurnitureSortedPropertyName();
52250         var oldDescending = this.home.isFurnitureDescendingSorted();
52251         var descending = false;
52252         if (furniturePropertyName === oldPropertyName) {
52253             if (oldDescending) {
52254                 furniturePropertyName = null;
52255             }
52256             else {
52257                 descending = true;
52258             }
52259         }
52260         this.home.setFurnitureSortedPropertyName(furniturePropertyName);
52261         this.home.setFurnitureDescendingSorted(descending);
52262     };
52263     /**
52264      * Controls the sort of the furniture in home. If home furniture isn't sorted
52265      * or is sorted on an other property, it will be sorted on the given
52266      * <code>furnitureProperty</code> in ascending order. If home furniture is already
52267      * sorted on the given <code>furnitureProperty</code>, it will be sorted in descending
52268      * order, if the sort is in ascending order, otherwise it won't be sorted at all
52269      * and home furniture will be listed in insertion order.
52270      * @param {string} furniturePropertyName  the furniture property on which the view wants
52271      * to sort the furniture it displays.
52272      */
52273     FurnitureController.prototype.sortFurniture = function (furniturePropertyName) {
52274         if (((typeof furniturePropertyName === 'string') || furniturePropertyName === null)) {
52275             return this.sortFurniture$java_lang_String(furniturePropertyName);
52276         }
52277         else if (((typeof furniturePropertyName === 'number') || furniturePropertyName === null)) {
52278             return this.sortFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_SortableProperty(furniturePropertyName);
52279         }
52280         else
52281             throw new Error('invalid overload');
52282     };
52283     FurnitureController.prototype.sortFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_SortableProperty = function (furnitureProperty) {
52284         var oldProperty = this.home.getFurnitureSortedProperty();
52285         var oldDescending = this.home.isFurnitureDescendingSorted();
52286         var descending = false;
52287         if ( /* equals */(furnitureProperty == oldProperty)) {
52288             if (oldDescending) {
52289                 furnitureProperty = null;
52290             }
52291             else {
52292                 descending = true;
52293             }
52294         }
52295         this.home.setFurnitureSortedProperty(furnitureProperty);
52296         this.home.setFurnitureDescendingSorted(descending);
52297     };
52298     /**
52299      * Updates the furniture visible properties in home.
52300      * @param {string[]} furnitureVisiblePropertyNames
52301      */
52302     FurnitureController.prototype.setFurnitureVisiblePropertyNames = function (furnitureVisiblePropertyNames) {
52303         this.home.setFurnitureVisiblePropertyNames(furnitureVisiblePropertyNames);
52304     };
52305     /**
52306      * Updates the furniture visible properties in home.
52307      * @deprecated {@link #setFurnitureVisibleProperties(List<HomePieceOfFurniture.SortableProperty>)}
52308      * should be replaced by calls to {@link #setFurnitureVisiblePropertyNames(List<String>)}
52309      * to allow displaying additional properties.
52310      * @param {string[]} furnitureVisibleProperties
52311      */
52312     FurnitureController.prototype.setFurnitureVisibleProperties = function (furnitureVisibleProperties) {
52313         this.home.setFurnitureVisibleProperties(furnitureVisibleProperties);
52314     };
52315     FurnitureController.prototype.toggleFurnitureVisibleProperty$java_lang_String = function (furniturePropertyName) {
52316         var furnitureVisiblePropertyNames = (this.home.getFurnitureVisiblePropertyNames().slice(0));
52317         if ( /* contains */(furnitureVisiblePropertyNames.indexOf((furniturePropertyName)) >= 0)) {
52318             /* remove */ (function (a) { var index = a.indexOf(furniturePropertyName); if (index >= 0) {
52319                 a.splice(index, 1);
52320                 return true;
52321             }
52322             else {
52323                 return false;
52324             } })(furnitureVisiblePropertyNames);
52325             if ( /* isEmpty */(furnitureVisiblePropertyNames.length == 0)) {
52326                 /* add */ (furnitureVisiblePropertyNames.push(/* name */ "NAME") > 0);
52327             }
52328         }
52329         else {
52330             var propertiesOrder = ( /* asList */[/* name */ "CATALOG_ID", /* name */ "NAME", /* name */ "DESCRIPTION", /* name */ "CREATOR", /* name */ "LICENSE", /* name */ "WIDTH", /* name */ "DEPTH", /* name */ "HEIGHT", /* name */ "X", /* name */ "Y", /* name */ "ELEVATION", /* name */ "ANGLE", /* name */ "LEVEL", /* name */ "MODEL_SIZE", /* name */ "COLOR", /* name */ "TEXTURE", /* name */ "MOVABLE", /* name */ "DOOR_OR_WINDOW", /* name */ "VISIBLE", /* name */ "PRICE", /* name */ "VALUE_ADDED_TAX_PERCENTAGE", /* name */ "VALUE_ADDED_TAX", /* name */ "PRICE_VALUE_ADDED_TAX_INCLUDED"].slice(0).slice(0));
52331             {
52332                 var array = this.home.getFurnitureAdditionalProperties();
52333                 for (var index = 0; index < array.length; index++) {
52334                     var property = array[index];
52335                     {
52336                         /* add */ (propertiesOrder.push(property.getName()) > 0);
52337                     }
52338                 }
52339             }
52340             var propertyIndex = propertiesOrder.indexOf(furniturePropertyName) - 1;
52341             if (propertyIndex > 0) {
52342                 while ((propertyIndex > 0)) {
52343                     {
52344                         var visiblePropertyIndex = furnitureVisiblePropertyNames.indexOf(/* get */ propertiesOrder[propertyIndex]);
52345                         if (visiblePropertyIndex >= 0) {
52346                             propertyIndex = visiblePropertyIndex + 1;
52347                             break;
52348                         }
52349                         else {
52350                             propertyIndex--;
52351                         }
52352                     }
52353                 }
52354                 ;
52355             }
52356             if (propertyIndex < 0) {
52357                 propertyIndex = 0;
52358             }
52359             /* add */ furnitureVisiblePropertyNames.splice(propertyIndex, 0, furniturePropertyName);
52360         }
52361         this.home.setFurnitureVisiblePropertyNames(furnitureVisiblePropertyNames);
52362     };
52363     /**
52364      * Toggles furniture property visibility in home.
52365      * @param {string} furniturePropertyName
52366      */
52367     FurnitureController.prototype.toggleFurnitureVisibleProperty = function (furniturePropertyName) {
52368         if (((typeof furniturePropertyName === 'string') || furniturePropertyName === null)) {
52369             return this.toggleFurnitureVisibleProperty$java_lang_String(furniturePropertyName);
52370         }
52371         else if (((typeof furniturePropertyName === 'number') || furniturePropertyName === null)) {
52372             return this.toggleFurnitureVisibleProperty$com_eteks_sweethome3d_model_HomePieceOfFurniture_SortableProperty(furniturePropertyName);
52373         }
52374         else
52375             throw new Error('invalid overload');
52376     };
52377     FurnitureController.prototype.toggleFurnitureVisibleProperty$com_eteks_sweethome3d_model_HomePieceOfFurniture_SortableProperty = function (furnitureProperty) {
52378         this.toggleFurnitureVisibleProperty$java_lang_String(/* name */ furnitureProperty);
52379     };
52380     /**
52381      * Controls the modification of selected furniture.
52382      */
52383     FurnitureController.prototype.modifySelectedFurniture = function () {
52384         if (!(Home.getFurnitureSubList(this.home.getSelectedItems()).length == 0)) {
52385             new HomeFurnitureController(this.home, this.preferences, this.viewFactory, this.contentManager, this.undoSupport).displayView(this.getView());
52386         }
52387     };
52388     /**
52389      * Controls the modification of the visibility of the selected piece of furniture.
52390      */
52391     FurnitureController.prototype.toggleSelectedFurnitureVisibility = function () {
52392         if ( /* size */Home.getFurnitureSubList(this.home.getSelectedItems()).length === 1) {
52393             var controller = new HomeFurnitureController(this.home, this.preferences, this.viewFactory, this.contentManager, this.undoSupport);
52394             controller.setVisible(!controller.getVisible());
52395             controller.modifyFurniture();
52396         }
52397     };
52398     /**
52399      * Groups the selected furniture as one piece of furniture.
52400      */
52401     FurnitureController.prototype.groupSelectedFurniture = function () {
52402         var selectedFurniture = this.getMovableSelectedFurniture();
52403         if (selectedFurniture.length > 0) {
52404             var basePlanLocked = this.home.isBasePlanLocked();
52405             var allLevelsSelection = this.home.isAllLevelsSelection();
52406             var oldSelection = this.home.getSelectedItems();
52407             var homeFurniture = this.home.getFurniture();
52408             var groupedFurnitureMap = ({});
52409             var groupedFurnitureCount = 0;
52410             for (var index = 0; index < selectedFurniture.length; index++) {
52411                 var piece = selectedFurniture[index];
52412                 {
52413                     var group = FurnitureController.getPieceOfFurnitureGroup(piece, null, homeFurniture);
52414                     var sortedMap = (function (m, k) { if (m.entries == null)
52415                         m.entries = []; for (var i_10 = 0; i_10 < m.entries.length; i_10++)
52416                         if (m.entries[i_10].key == null && k == null || m.entries[i_10].key.equals != null && m.entries[i_10].key.equals(k) || m.entries[i_10].key === k) {
52417                             return m.entries[i_10].value;
52418                         } return null; })(groupedFurnitureMap, group);
52419                     if (sortedMap == null) {
52420                         sortedMap = ({});
52421                         /* put */ (function (m, k, v) { if (m.entries == null)
52422                             m.entries = []; for (var i_11 = 0; i_11 < m.entries.length; i_11++)
52423                             if (m.entries[i_11].key == null && k == null || m.entries[i_11].key.equals != null && m.entries[i_11].key.equals(k) || m.entries[i_11].key === k) {
52424                                 m.entries[i_11].value = v;
52425                                 return;
52426                             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(groupedFurnitureMap, group, sortedMap);
52427                     }
52428                     if (group == null) {
52429                         /* put */ (function (m, k, v) { if (m.entries == null)
52430                             m.entries = []; for (var i = 0; i < m.entries.length; i++)
52431                             if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
52432                                 var pv = m.entries[i].value;
52433                                 m.entries[i].value = v;
52434                                 return pv;
52435                             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); m.entries.sort(function (e1, e2) { return (e1.key.compareTo != null) ? e1.key.compareTo(e2) : (e1.key - e2.key); }); return null; })(sortedMap, homeFurniture.indexOf(piece), piece);
52436                     }
52437                     else {
52438                         /* put */ (function (m, k, v) { if (m.entries == null)
52439                             m.entries = []; for (var i = 0; i < m.entries.length; i++)
52440                             if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
52441                                 var pv = m.entries[i].value;
52442                                 m.entries[i].value = v;
52443                                 return pv;
52444                             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); m.entries.sort(function (e1, e2) { return (e1.key.compareTo != null) ? e1.key.compareTo(e2) : (e1.key - e2.key); }); return null; })(sortedMap, group.getFurniture().indexOf(piece), piece);
52445                     }
52446                     groupedFurnitureCount++;
52447                 }
52448             }
52449             var groupedPieces = (function (s) { var a = []; while (s-- > 0)
52450                 a.push(null); return a; })(groupedFurnitureCount);
52451             var groupedPiecesIndex = (function (s) { var a = []; while (s-- > 0)
52452                 a.push(0); return a; })(groupedPieces.length);
52453             var groupedPiecesLevel = (function (s) { var a = []; while (s-- > 0)
52454                 a.push(null); return a; })(groupedPieces.length);
52455             var groupedPiecesElevation = (function (s) { var a = []; while (s-- > 0)
52456                 a.push(0); return a; })(groupedPieces.length);
52457             var groupedPiecesVisible = (function (s) { var a = []; while (s-- > 0)
52458                 a.push(false); return a; })(groupedPieces.length);
52459             var groupedPiecesGroups = (function (s) { var a = []; while (s-- > 0)
52460                 a.push(null); return a; })(groupedPieces.length);
52461             var minLevel = this.home.getSelectedLevel();
52462             var i = 0;
52463             {
52464                 var array = /* entrySet */ (function (m) { if (m.entries == null)
52465                     m.entries = []; return m.entries; })(groupedFurnitureMap);
52466                 for (var index = 0; index < array.length; index++) {
52467                     var sortedMapEntry = array[index];
52468                     {
52469                         {
52470                             var array1 = /* entrySet */ (function (m) { if (m.entries == null)
52471                                 m.entries = []; return m.entries; })(sortedMapEntry.getValue());
52472                             for (var index1 = 0; index1 < array1.length; index1++) {
52473                                 var pieceEntry = array1[index1];
52474                                 {
52475                                     var piece = pieceEntry.getValue();
52476                                     groupedPieces[i] = piece;
52477                                     groupedPiecesIndex[i] = pieceEntry.getKey();
52478                                     groupedPiecesLevel[i] = piece.getLevel();
52479                                     groupedPiecesElevation[i] = piece.getElevation();
52480                                     groupedPiecesVisible[i] = piece.isVisible();
52481                                     groupedPiecesGroups[i] = sortedMapEntry.getKey();
52482                                     if (groupedPiecesLevel[i] != null) {
52483                                         if (minLevel == null || groupedPiecesLevel[i].getElevation() < minLevel.getElevation()) {
52484                                             minLevel = groupedPiecesLevel[i];
52485                                         }
52486                                     }
52487                                     i++;
52488                                 }
52489                             }
52490                         }
52491                     }
52492                 }
52493             }
52494             var newGroup = void 0;
52495             var groupedFurniture = groupedPieces.slice(0);
52496             if (groupedFurniture.indexOf(this.leadSelectedPieceOfFurniture) > 0) {
52497                 newGroup = this.createHomeFurnitureGroup$java_util_List$com_eteks_sweethome3d_model_HomePieceOfFurniture(groupedFurniture, this.leadSelectedPieceOfFurniture);
52498             }
52499             else {
52500                 newGroup = this.createHomeFurnitureGroup$java_util_List(groupedFurniture);
52501             }
52502             var groupPiecesNewElevation = (function (s) { var a = []; while (s-- > 0)
52503                 a.push(0); return a; })(groupedPieces.length);
52504             i = 0;
52505             for (var index = 0; index < groupedPieces.length; index++) {
52506                 var piece = groupedPieces[index];
52507                 {
52508                     groupPiecesNewElevation[i++] = piece.getElevation();
52509                 }
52510             }
52511             var homeSortedMap = (function (m, k) { if (m.entries == null)
52512                 m.entries = []; for (var i_12 = 0; i_12 < m.entries.length; i_12++)
52513                 if (m.entries[i_12].key == null && k == null || m.entries[i_12].key.equals != null && m.entries[i_12].key.equals(k) || m.entries[i_12].key === k) {
52514                     return m.entries[i_12].value;
52515                 } return null; })(groupedFurnitureMap, null);
52516             var groupIndex = homeSortedMap != null ? /* lastKey */ (function (map) { return map.entries[map.entries.length - 1].key; })(homeSortedMap) + 1 - groupedPieces.length : /* size */ homeFurniture.length;
52517             var movable = newGroup.isMovable();
52518             var groupLevel = minLevel;
52519             FurnitureController.doGroupFurniture(this.home, groupedPieces, [newGroup], null, [groupIndex], [groupLevel], basePlanLocked, false);
52520             if (this.undoSupport != null) {
52521                 this.undoSupport.postEdit(new FurnitureController.FurnitureGroupingUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), basePlanLocked, allLevelsSelection, groupedPieces, groupedPiecesIndex, groupedPiecesGroups, groupedPiecesLevel, groupedPiecesElevation, groupedPiecesVisible, newGroup, groupIndex, groupLevel, groupPiecesNewElevation, movable));
52522             }
52523         }
52524     };
52525     FurnitureController.prototype.createHomeFurnitureGroup$java_util_List = function (furniture) {
52526         return this.createHomeFurnitureGroup$java_util_List$com_eteks_sweethome3d_model_HomePieceOfFurniture(furniture, /* get */ furniture[0]);
52527     };
52528     FurnitureController.prototype.createHomeFurnitureGroup$java_util_List$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (furniture, leadingPiece) {
52529         var furnitureGroupName = this.preferences.getLocalizedString(FurnitureController, "groupName", FurnitureController.getFurnitureGroupCount(this.home.getFurniture()) + 1);
52530         var furnitureGroup = new HomeFurnitureGroup(furniture, leadingPiece, furnitureGroupName);
52531         return furnitureGroup;
52532     };
52533     /**
52534      * Returns a new furniture group for the given furniture list.
52535      * @param {HomePieceOfFurniture[]} furniture
52536      * @param {HomePieceOfFurniture} leadingPiece
52537      * @return {HomeFurnitureGroup}
52538      */
52539     FurnitureController.prototype.createHomeFurnitureGroup = function (furniture, leadingPiece) {
52540         if (((furniture != null && (furniture instanceof Array)) || furniture === null) && ((leadingPiece != null && leadingPiece instanceof HomePieceOfFurniture) || leadingPiece === null)) {
52541             return this.createHomeFurnitureGroup$java_util_List$com_eteks_sweethome3d_model_HomePieceOfFurniture(furniture, leadingPiece);
52542         }
52543         else if (((furniture != null && (furniture instanceof Array)) || furniture === null) && leadingPiece === undefined) {
52544             return this.createHomeFurnitureGroup$java_util_List(furniture);
52545         }
52546         else
52547             throw new Error('invalid overload');
52548     };
52549     /**
52550      * Returns the count of furniture groups among the given list.
52551      * @param {HomePieceOfFurniture[]} furniture
52552      * @return {number}
52553      * @private
52554      */
52555     FurnitureController.getFurnitureGroupCount = function (furniture) {
52556         var i = 0;
52557         for (var index = 0; index < furniture.length; index++) {
52558             var piece = furniture[index];
52559             {
52560                 if (piece != null && piece instanceof HomeFurnitureGroup) {
52561                     i += 1 + FurnitureController.getFurnitureGroupCount(piece.getFurniture());
52562                 }
52563             }
52564         }
52565         return i;
52566     };
52567     FurnitureController.doGroupFurniture = function (home, groupedPieces, groups, groupsGroups, groupsIndex, groupsLevels, basePlanLocked, allLevelsSelection) {
52568         FurnitureController.doDeleteFurniture(home, groupedPieces, basePlanLocked, allLevelsSelection);
52569         FurnitureController.doAddFurniture(home, groups, groupsGroups, groupsIndex, null, groupsLevels, basePlanLocked, allLevelsSelection);
52570     };
52571     FurnitureController.doUngroupFurniture = function (home, groups, ungroupedPieces, ungroupedPiecesGroups, ungroupedPiecesIndex, ungroupedPiecesLevels, basePlanLocked, allLevelsSelection) {
52572         FurnitureController.doDeleteFurniture(home, groups, basePlanLocked, allLevelsSelection);
52573         FurnitureController.doAddFurniture(home, ungroupedPieces, ungroupedPiecesGroups, ungroupedPiecesIndex, null, ungroupedPiecesLevels, basePlanLocked, allLevelsSelection);
52574     };
52575     /**
52576      * Ungroups the selected groups of furniture.
52577      */
52578     FurnitureController.prototype.ungroupSelectedFurniture = function () {
52579         var movableSelectedFurnitureGroups = ([]);
52580         {
52581             var array = this.home.getSelectedItems();
52582             for (var index = 0; index < array.length; index++) {
52583                 var item = array[index];
52584                 {
52585                     if (item != null && item instanceof HomeFurnitureGroup) {
52586                         var group = item;
52587                         if (this.isPieceOfFurnitureMovable(group)) {
52588                             /* add */ (movableSelectedFurnitureGroups.push(group) > 0);
52589                         }
52590                     }
52591                 }
52592             }
52593         }
52594         if (!(movableSelectedFurnitureGroups.length == 0)) {
52595             var homeFurniture = this.home.getFurniture();
52596             var oldBasePlanLocked = this.home.isBasePlanLocked();
52597             var allLevelsSelection = this.home.isAllLevelsSelection();
52598             var oldSelection = this.home.getSelectedItems();
52599             var groupsMap = ({});
52600             var groupsCount = 0;
52601             for (var index = 0; index < movableSelectedFurnitureGroups.length; index++) {
52602                 var piece = movableSelectedFurnitureGroups[index];
52603                 {
52604                     var groupGroup = FurnitureController.getPieceOfFurnitureGroup(piece, null, homeFurniture);
52605                     var sortedMap = (function (m, k) { if (m.entries == null)
52606                         m.entries = []; for (var i_13 = 0; i_13 < m.entries.length; i_13++)
52607                         if (m.entries[i_13].key == null && k == null || m.entries[i_13].key.equals != null && m.entries[i_13].key.equals(k) || m.entries[i_13].key === k) {
52608                             return m.entries[i_13].value;
52609                         } return null; })(groupsMap, groupGroup);
52610                     if (sortedMap == null) {
52611                         sortedMap = ({});
52612                         /* put */ (function (m, k, v) { if (m.entries == null)
52613                             m.entries = []; for (var i_14 = 0; i_14 < m.entries.length; i_14++)
52614                             if (m.entries[i_14].key == null && k == null || m.entries[i_14].key.equals != null && m.entries[i_14].key.equals(k) || m.entries[i_14].key === k) {
52615                                 m.entries[i_14].value = v;
52616                                 return;
52617                             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(groupsMap, groupGroup, sortedMap);
52618                     }
52619                     if (groupGroup == null) {
52620                         /* put */ (function (m, k, v) { if (m.entries == null)
52621                             m.entries = []; for (var i = 0; i < m.entries.length; i++)
52622                             if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
52623                                 var pv = m.entries[i].value;
52624                                 m.entries[i].value = v;
52625                                 return pv;
52626                             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); m.entries.sort(function (e1, e2) { return (e1.key.compareTo != null) ? e1.key.compareTo(e2) : (e1.key - e2.key); }); return null; })(sortedMap, homeFurniture.indexOf(piece), piece);
52627                     }
52628                     else {
52629                         /* put */ (function (m, k, v) { if (m.entries == null)
52630                             m.entries = []; for (var i = 0; i < m.entries.length; i++)
52631                             if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
52632                                 var pv = m.entries[i].value;
52633                                 m.entries[i].value = v;
52634                                 return pv;
52635                             } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); m.entries.sort(function (e1, e2) { return (e1.key.compareTo != null) ? e1.key.compareTo(e2) : (e1.key - e2.key); }); return null; })(sortedMap, groupGroup.getFurniture().indexOf(piece), piece);
52636                     }
52637                     groupsCount++;
52638                 }
52639             }
52640             var groups = (function (s) { var a = []; while (s-- > 0)
52641                 a.push(null); return a; })(groupsCount);
52642             var groupsGroups = (function (s) { var a = []; while (s-- > 0)
52643                 a.push(null); return a; })(groups.length);
52644             var groupsIndex = (function (s) { var a = []; while (s-- > 0)
52645                 a.push(0); return a; })(groups.length);
52646             var groupsLevels = (function (s) { var a = []; while (s-- > 0)
52647                 a.push(null); return a; })(groups.length);
52648             var i = 0;
52649             var ungroupedPiecesList = ([]);
52650             var ungroupedPiecesIndexList = ([]);
52651             var ungroupedPiecesGroupsList = ([]);
52652             {
52653                 var array = /* entrySet */ (function (m) { if (m.entries == null)
52654                     m.entries = []; return m.entries; })(groupsMap);
52655                 for (var index = 0; index < array.length; index++) {
52656                     var sortedMapEntry = array[index];
52657                     {
52658                         var sortedMap = sortedMapEntry.getValue();
52659                         var endIndex = (function (map) { return map.entries[map.entries.length - 1].key; })(sortedMap) + 1 - /* size */ (function (m) { if (m.entries == null)
52660                             m.entries = []; return m.entries.length; })(sortedMap);
52661                         {
52662                             var array1 = /* entrySet */ (function (m) { if (m.entries == null)
52663                                 m.entries = []; return m.entries; })(sortedMap);
52664                             for (var index1 = 0; index1 < array1.length; index1++) {
52665                                 var groupEntry = array1[index1];
52666                                 {
52667                                     var group = groupEntry.getValue();
52668                                     groups[i] = group;
52669                                     groupsGroups[i] = sortedMapEntry.getKey();
52670                                     groupsIndex[i] = groupEntry.getKey();
52671                                     groupsLevels[i++] = group.getLevel();
52672                                     {
52673                                         var array2 = group.getFurniture();
52674                                         for (var index2 = 0; index2 < array2.length; index2++) {
52675                                             var groupPiece = array2[index2];
52676                                             {
52677                                                 /* add */ (ungroupedPiecesList.push(groupPiece) > 0);
52678                                                 /* add */ (ungroupedPiecesGroupsList.push(sortedMapEntry.getKey()) > 0);
52679                                                 /* add */ (ungroupedPiecesIndexList.push(endIndex++) > 0);
52680                                             }
52681                                         }
52682                                     }
52683                                 }
52684                             }
52685                         }
52686                     }
52687                 }
52688             }
52689             var ungroupedPieces = ungroupedPiecesList.slice(0);
52690             var ungroupedPiecesGroups = ungroupedPiecesGroupsList.slice(0);
52691             var ungroupedPiecesIndex = (function (s) { var a = []; while (s-- > 0)
52692                 a.push(0); return a; })(ungroupedPieces.length);
52693             var ungroupedPiecesLevels = (function (s) { var a = []; while (s-- > 0)
52694                 a.push(null); return a; })(ungroupedPieces.length);
52695             var basePlanLocked = oldBasePlanLocked;
52696             for (i = 0; i < ungroupedPieces.length; i++) {
52697                 {
52698                     ungroupedPiecesIndex[i] = /* get */ ungroupedPiecesIndexList[i];
52699                     ungroupedPiecesLevels[i] = ungroupedPieces[i].getLevel();
52700                     basePlanLocked = !this.isPieceOfFurniturePartOfBasePlan(ungroupedPieces[i]) && basePlanLocked;
52701                 }
52702                 ;
52703             }
52704             var newBasePlanLocked = basePlanLocked;
52705             FurnitureController.doUngroupFurniture(this.home, groups, ungroupedPieces, ungroupedPiecesGroups, ungroupedPiecesIndex, ungroupedPiecesLevels, newBasePlanLocked, false);
52706             if (this.undoSupport != null) {
52707                 this.undoSupport.postEdit(new FurnitureController.FurnitureUngroupingUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), oldBasePlanLocked, allLevelsSelection, groups, groupsIndex, groupsGroups, groupsLevels, ungroupedPieces, ungroupedPiecesIndex, ungroupedPiecesGroups, ungroupedPiecesLevels, newBasePlanLocked));
52708             }
52709         }
52710     };
52711     FurnitureController.prototype.importFurniture$ = function () {
52712         new ImportedFurnitureWizardController(this.home, this.preferences, this, this.viewFactory, this.contentManager, this.undoSupport).displayView(this.getView());
52713     };
52714     FurnitureController.prototype.importFurniture$java_lang_String = function (modelName) {
52715         new ImportedFurnitureWizardController(this.home, modelName, this.preferences, this, this.viewFactory, this.contentManager, this.undoSupport).displayView(this.getView());
52716     };
52717     /**
52718      * Displays the wizard that helps to import furniture to home with a
52719      * given model name.
52720      * @param {string} modelName
52721      */
52722     FurnitureController.prototype.importFurniture = function (modelName) {
52723         if (((typeof modelName === 'string') || modelName === null)) {
52724             return this.importFurniture$java_lang_String(modelName);
52725         }
52726         else if (modelName === undefined) {
52727             return this.importFurniture$();
52728         }
52729         else
52730             throw new Error('invalid overload');
52731     };
52732     /**
52733      * Controls the alignment of selected furniture on top of the first selected piece.
52734      */
52735     FurnitureController.prototype.alignSelectedFurnitureOnTop = function () {
52736         var oldSelection = this.home.getSelectedItems();
52737         this.alignSelectedFurniture(new FurnitureController.FurnitureTopAlignmentUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), this.getMovableSelectedFurniture(), this.leadSelectedPieceOfFurniture));
52738     };
52739     /**
52740      * Controls the alignment of selected furniture on bottom of the first selected piece.
52741      */
52742     FurnitureController.prototype.alignSelectedFurnitureOnBottom = function () {
52743         var oldSelection = this.home.getSelectedItems();
52744         this.alignSelectedFurniture(new FurnitureController.FurnitureBottomAlignmentUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), this.getMovableSelectedFurniture(), this.leadSelectedPieceOfFurniture));
52745     };
52746     /**
52747      * Controls the alignment of selected furniture on left of the first selected piece.
52748      */
52749     FurnitureController.prototype.alignSelectedFurnitureOnLeft = function () {
52750         var oldSelection = this.home.getSelectedItems();
52751         this.alignSelectedFurniture(new FurnitureController.FurnitureLeftAlignmentUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), this.getMovableSelectedFurniture(), this.leadSelectedPieceOfFurniture));
52752     };
52753     /**
52754      * Controls the alignment of selected furniture on right of the first selected piece.
52755      */
52756     FurnitureController.prototype.alignSelectedFurnitureOnRight = function () {
52757         var oldSelection = this.home.getSelectedItems();
52758         this.alignSelectedFurniture(new FurnitureController.FurnitureRightAlignmentUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), this.getMovableSelectedFurniture(), this.leadSelectedPieceOfFurniture));
52759     };
52760     /**
52761      * Controls the alignment of selected furniture on the front side of the first selected piece.
52762      */
52763     FurnitureController.prototype.alignSelectedFurnitureOnFrontSide = function () {
52764         var oldSelection = this.home.getSelectedItems();
52765         this.alignSelectedFurniture(new FurnitureController.FurnitureFrontSideAlignmentUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), this.getMovableSelectedFurniture(), this.leadSelectedPieceOfFurniture));
52766     };
52767     /**
52768      * Controls the alignment of selected furniture on the back side of the first selected piece.
52769      */
52770     FurnitureController.prototype.alignSelectedFurnitureOnBackSide = function () {
52771         var oldSelection = this.home.getSelectedItems();
52772         this.alignSelectedFurniture(new FurnitureController.FurnitureBackSideAlignmentUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), this.getMovableSelectedFurniture(), this.leadSelectedPieceOfFurniture));
52773     };
52774     /**
52775      * Controls the alignment of selected furniture on the left side of the first selected piece.
52776      */
52777     FurnitureController.prototype.alignSelectedFurnitureOnLeftSide = function () {
52778         var oldSelection = this.home.getSelectedItems();
52779         this.alignSelectedFurniture(new FurnitureController.FurnitureLeftSideAlignmentUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), this.getMovableSelectedFurniture(), this.leadSelectedPieceOfFurniture));
52780     };
52781     /**
52782      * Controls the alignment of selected furniture on the right side of the first selected piece.
52783      */
52784     FurnitureController.prototype.alignSelectedFurnitureOnRightSide = function () {
52785         var oldSelection = this.home.getSelectedItems();
52786         this.alignSelectedFurniture(new FurnitureController.FurnitureRightSideAlignmentUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), this.getMovableSelectedFurniture(), this.leadSelectedPieceOfFurniture));
52787     };
52788     /**
52789      * Controls the alignment of selected furniture on the sides of the first selected piece.
52790      */
52791     FurnitureController.prototype.alignSelectedFurnitureSideBySide = function () {
52792         var oldSelection = this.home.getSelectedItems();
52793         this.alignSelectedFurniture(new FurnitureController.FurnitureSideBySideAlignmentUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), this.getMovableSelectedFurniture(), this.leadSelectedPieceOfFurniture));
52794     };
52795     /**
52796      * Returns a list containing aligned furniture and lead piece sorted in the order of their distribution along
52797      * a line orthogonal to the given axis.
52798      * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} furniture
52799      * @param {HomePieceOfFurniture} leadPiece
52800      * @param {java.awt.geom.Line2D} orthogonalAxis
52801      * @return {HomePieceOfFurniture[]}
52802      * @private
52803      */
52804     FurnitureController.sortFurniture = function (furniture, leadPiece, orthogonalAxis) {
52805         var sortedFurniture = ([]);
52806         if (leadPiece != null) {
52807             /* add */ (sortedFurniture.push(leadPiece) > 0);
52808         }
52809         /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(sortedFurniture, /* asList */ furniture.slice(0));
52810         /* sort */ (function (l, c) { if (c.compare)
52811             l.sort(function (e1, e2) { return c.compare(e1, e2); });
52812         else
52813             l.sort(c); })(sortedFurniture, new FurnitureController.FurnitureController$2(orthogonalAxis));
52814         return sortedFurniture;
52815     };
52816     /**
52817      * Aligns the given <code>piece</code> along the front or back side of the lead piece and its left or right side
52818      * at a distance equal to <code>sideDistance</code>, and returns the width of the bounding box of
52819      * the <code>piece</code> along the back side axis.
52820      * @param {HomePieceOfFurniture} piece
52821      * @param {HomePieceOfFurniture} leadPiece
52822      * @param {java.awt.geom.Line2D} frontOrBackLine
52823      * @param {boolean} frontLine
52824      * @param {java.awt.geom.Line2D} centerLine
52825      * @param {number} sideDistance
52826      * @return {number}
52827      * @private
52828      */
52829     FurnitureController.alignPieceOfFurnitureAlongSides = function (piece, leadPiece, frontOrBackLine, frontLine, centerLine, sideDistance) {
52830         var distance = frontOrBackLine.relativeCCW(piece.getX(), piece.getY()) * frontOrBackLine.ptLineDist(piece.getX(), piece.getY()) + FurnitureController.getPieceBoundingRectangleHeight(piece, -leadPiece.getAngle()) / 2;
52831         if (frontLine) {
52832             distance = -distance;
52833         }
52834         var sinLeadPieceAngle = Math.sin(leadPiece.getAngle());
52835         var cosLeadPieceAngle = Math.cos(leadPiece.getAngle());
52836         var deltaX = (-distance * sinLeadPieceAngle);
52837         var deltaY = (distance * cosLeadPieceAngle);
52838         var rotatedBoundingBoxWidth = FurnitureController.getPieceBoundingRectangleWidth(piece, -leadPiece.getAngle());
52839         if (centerLine != null) {
52840             var location_1 = centerLine.relativeCCW(piece.getX(), piece.getY());
52841             if (location_1 === 0) {
52842                 location_1 = frontLine ? 1 : -1;
52843             }
52844             distance = sideDistance + location_1 * (centerLine.ptLineDist(piece.getX(), piece.getY()) - rotatedBoundingBoxWidth / 2);
52845             deltaX += (distance * cosLeadPieceAngle);
52846             deltaY += (distance * sinLeadPieceAngle);
52847         }
52848         piece.move(deltaX, deltaY);
52849         return rotatedBoundingBoxWidth;
52850     };
52851     /**
52852      * Aligns the given <code>piece</code> along the left or right side of the lead piece.
52853      * @param {HomePieceOfFurniture} piece
52854      * @param {HomePieceOfFurniture} leadPiece
52855      * @param {java.awt.geom.Line2D} leftOrRightLine
52856      * @param {boolean} rightLine
52857      * @private
52858      */
52859     FurnitureController.alignPieceOfFurnitureAlongLeftOrRightSides = function (piece, leadPiece, leftOrRightLine, rightLine) {
52860         var distance = leftOrRightLine.relativeCCW(piece.getX(), piece.getY()) * leftOrRightLine.ptLineDist(piece.getX(), piece.getY()) + FurnitureController.getPieceBoundingRectangleWidth(piece, -leadPiece.getAngle()) / 2;
52861         if (rightLine) {
52862             distance = -distance;
52863         }
52864         piece.move((distance * Math.cos(leadPiece.getAngle())), (distance * Math.sin(leadPiece.getAngle())));
52865     };
52866     /**
52867      * Returns the bounding box width of the given piece when it's rotated of an additional angle.
52868      * @param {HomePieceOfFurniture} piece
52869      * @param {number} additionalAngle
52870      * @return {number}
52871      * @private
52872      */
52873     FurnitureController.getPieceBoundingRectangleWidth = function (piece, additionalAngle) {
52874         return Math.abs(piece.getWidthInPlan() * Math.cos(additionalAngle + piece.getAngle())) + Math.abs(piece.getDepthInPlan() * Math.sin(additionalAngle + piece.getAngle()));
52875     };
52876     /**
52877      * Returns the bounding box height of the given piece when it's rotated of an additional angle.
52878      * @param {HomePieceOfFurniture} piece
52879      * @param {number} additionalAngle
52880      * @return {number}
52881      * @private
52882      */
52883     FurnitureController.getPieceBoundingRectangleHeight = function (piece, additionalAngle) {
52884         return Math.abs(piece.getWidthInPlan() * Math.sin(additionalAngle + piece.getAngle())) + Math.abs(piece.getDepthInPlan() * Math.cos(additionalAngle + piece.getAngle()));
52885     };
52886     /**
52887      * Controls the alignment of selected furniture.
52888      * @param {FurnitureController.FurnitureAlignmentUndoableEdit} alignmentEdit
52889      * @private
52890      */
52891     FurnitureController.prototype.alignSelectedFurniture = function (alignmentEdit) {
52892         var selectedFurniture = this.getMovableSelectedFurniture();
52893         if (selectedFurniture.length >= 2) {
52894             this.home.setSelectedItems(/* asList */ selectedFurniture.slice(0));
52895             alignmentEdit.alignFurniture$();
52896             if (this.undoSupport != null) {
52897                 this.undoSupport.postEdit(alignmentEdit);
52898             }
52899         }
52900     };
52901     FurnitureController.prototype.getMovableSelectedFurniture = function () {
52902         var movableSelectedFurniture = ([]);
52903         {
52904             var array = this.home.getSelectedItems();
52905             for (var index = 0; index < array.length; index++) {
52906                 var item = array[index];
52907                 {
52908                     if (item != null && item instanceof HomePieceOfFurniture) {
52909                         var piece = item;
52910                         if (this.isPieceOfFurnitureMovable(piece)) {
52911                             /* add */ (movableSelectedFurniture.push(piece) > 0);
52912                         }
52913                     }
52914                 }
52915             }
52916         }
52917         return /* toArray */ movableSelectedFurniture.slice(0);
52918     };
52919     FurnitureController.undoAlignFurniture = function (alignedFurniture, x, y) {
52920         for (var i = 0; i < alignedFurniture.length; i++) {
52921             {
52922                 var piece = alignedFurniture[i];
52923                 piece.setX(x[i]);
52924                 piece.setY(y[i]);
52925             }
52926             ;
52927         }
52928     };
52929     /**
52930      * Returns the minimum abscissa of the vertices of <code>piece</code>.
52931      * @param {HomePieceOfFurniture} piece
52932      * @return {number}
52933      * @private
52934      */
52935     FurnitureController.getMinX = function (piece) {
52936         var points = piece.getPoints();
52937         var minX = Infinity;
52938         for (var index = 0; index < points.length; index++) {
52939             var point = points[index];
52940             {
52941                 minX = Math.min(minX, point[0]);
52942             }
52943         }
52944         return minX;
52945     };
52946     /**
52947      * Returns the maximum abscissa of the vertices of <code>piece</code>.
52948      * @param {HomePieceOfFurniture} piece
52949      * @return {number}
52950      * @private
52951      */
52952     FurnitureController.getMaxX = function (piece) {
52953         var points = piece.getPoints();
52954         var maxX = -Infinity;
52955         for (var index = 0; index < points.length; index++) {
52956             var point = points[index];
52957             {
52958                 maxX = Math.max(maxX, point[0]);
52959             }
52960         }
52961         return maxX;
52962     };
52963     /**
52964      * Returns the minimum ordinate of the vertices of <code>piece</code>.
52965      * @param {HomePieceOfFurniture} piece
52966      * @return {number}
52967      * @private
52968      */
52969     FurnitureController.getMinY = function (piece) {
52970         var points = piece.getPoints();
52971         var minY = Infinity;
52972         for (var index = 0; index < points.length; index++) {
52973             var point = points[index];
52974             {
52975                 minY = Math.min(minY, point[1]);
52976             }
52977         }
52978         return minY;
52979     };
52980     /**
52981      * Returns the maximum ordinate of the vertices of <code>piece</code>.
52982      * @param {HomePieceOfFurniture} piece
52983      * @return {number}
52984      * @private
52985      */
52986     FurnitureController.getMaxY = function (piece) {
52987         var points = piece.getPoints();
52988         var maxY = -Infinity;
52989         for (var index = 0; index < points.length; index++) {
52990             var point = points[index];
52991             {
52992                 maxY = Math.max(maxY, point[1]);
52993             }
52994         }
52995         return maxY;
52996     };
52997     /**
52998      * Controls the distribution of the selected furniture along horizontal axis.
52999      */
53000     FurnitureController.prototype.distributeSelectedFurnitureHorizontally = function () {
53001         this.distributeSelectedFurniture(true);
53002     };
53003     /**
53004      * Controls the distribution of the selected furniture along vertical axis.
53005      */
53006     FurnitureController.prototype.distributeSelectedFurnitureVertically = function () {
53007         this.distributeSelectedFurniture(false);
53008     };
53009     /**
53010      * Controls the distribution of the selected furniture along the axis orthogonal to the given one.
53011      * @param {boolean} horizontal
53012      */
53013     FurnitureController.prototype.distributeSelectedFurniture = function (horizontal) {
53014         var alignedFurniture = this.getMovableSelectedFurniture();
53015         if (alignedFurniture.length >= 3) {
53016             var oldSelection = this.home.getSelectedItems();
53017             var oldX = (function (s) { var a = []; while (s-- > 0)
53018                 a.push(0); return a; })(alignedFurniture.length);
53019             var oldY = (function (s) { var a = []; while (s-- > 0)
53020                 a.push(0); return a; })(alignedFurniture.length);
53021             for (var i = 0; i < alignedFurniture.length; i++) {
53022                 {
53023                     oldX[i] = alignedFurniture[i].getX();
53024                     oldY[i] = alignedFurniture[i].getY();
53025                 }
53026                 ;
53027             }
53028             this.home.setSelectedItems(/* asList */ alignedFurniture.slice(0));
53029             FurnitureController.doDistributeFurnitureAlongAxis(alignedFurniture, horizontal);
53030             if (this.undoSupport != null) {
53031                 this.undoSupport.postEdit(new FurnitureController.FurnitureDistributionUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), oldX, oldY, alignedFurniture, horizontal));
53032             }
53033         }
53034     };
53035     FurnitureController.doDistributeFurnitureAlongAxis = function (alignedFurniture, horizontal) {
53036         var orthogonalAxis = horizontal ? new java.awt.geom.Line2D.Float(0, 0, 0, -1) : new java.awt.geom.Line2D.Float(0, 0, 1, 0);
53037         var furnitureHorizontallySorted = FurnitureController.sortFurniture(alignedFurniture, null, orthogonalAxis);
53038         var axisAngle = (horizontal ? 0 : Math.PI / 2);
53039         var firstPiece = furnitureHorizontallySorted[0];
53040         var firstPieceBoundingRectangleHalfWidth = FurnitureController.getPieceBoundingRectangleWidth(firstPiece, axisAngle) / 2;
53041         var lastPiece = furnitureHorizontallySorted[ /* size */furnitureHorizontallySorted.length - 1];
53042         var lastPieceBoundingRectangleHalfWidth = FurnitureController.getPieceBoundingRectangleWidth(lastPiece, axisAngle) / 2;
53043         var gap = Math.abs(orthogonalAxis.ptLineDist(lastPiece.getX(), lastPiece.getY()) * orthogonalAxis.relativeCCW(lastPiece.getX(), lastPiece.getY()) - orthogonalAxis.ptLineDist(firstPiece.getX(), firstPiece.getY()) * orthogonalAxis.relativeCCW(firstPiece.getX(), firstPiece.getY())) - lastPieceBoundingRectangleHalfWidth - firstPieceBoundingRectangleHalfWidth;
53044         var furnitureWidthsAlongAxis = (function (s) { var a = []; while (s-- > 0)
53045             a.push(0); return a; })(/* size */ furnitureHorizontallySorted.length - 2);
53046         for (var i = 1; i < /* size */ furnitureHorizontallySorted.length - 1; i++) {
53047             {
53048                 var piece = furnitureHorizontallySorted[i];
53049                 furnitureWidthsAlongAxis[i - 1] = FurnitureController.getPieceBoundingRectangleWidth(piece, axisAngle);
53050                 gap -= furnitureWidthsAlongAxis[i - 1];
53051             }
53052             ;
53053         }
53054         gap /= /* size */ furnitureHorizontallySorted.length - 1;
53055         var xOrY = (horizontal ? firstPiece.getX() : firstPiece.getY()) + (firstPieceBoundingRectangleHalfWidth + gap);
53056         for (var i = 1; i < /* size */ furnitureHorizontallySorted.length - 1; i++) {
53057             {
53058                 var piece = furnitureHorizontallySorted[i];
53059                 if (horizontal) {
53060                     piece.setX((xOrY + furnitureWidthsAlongAxis[i - 1] / 2));
53061                 }
53062                 else {
53063                     piece.setY((xOrY + furnitureWidthsAlongAxis[i - 1] / 2));
53064                 }
53065                 xOrY += gap + furnitureWidthsAlongAxis[i - 1];
53066             }
53067             ;
53068         }
53069     };
53070     /**
53071      * Resets the elevation of the selected furniture to its default elevation.
53072      */
53073     FurnitureController.prototype.resetFurnitureElevation = function () {
53074         var selectedFurniture = this.getMovableSelectedFurniture();
53075         if (selectedFurniture.length >= 1) {
53076             var oldSelection = this.home.getSelectedItems();
53077             var furnitureOldElevation = (function (s) { var a = []; while (s-- > 0)
53078                 a.push(0); return a; })(selectedFurniture.length);
53079             var furnitureNewElevation = (function (s) { var a = []; while (s-- > 0)
53080                 a.push(0); return a; })(selectedFurniture.length);
53081             for (var i = 0; i < selectedFurniture.length; i++) {
53082                 {
53083                     var piece = selectedFurniture[i];
53084                     furnitureOldElevation[i] = piece.getElevation();
53085                     var highestSurroundingPiece = this.getHighestSurroundingPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$java_util_List(piece, /* asList */ selectedFurniture.slice(0));
53086                     if (highestSurroundingPiece != null) {
53087                         var elevation = highestSurroundingPiece.getElevation();
53088                         if (highestSurroundingPiece.isHorizontallyRotated()) {
53089                             elevation += highestSurroundingPiece.getHeightInPlan();
53090                         }
53091                         else {
53092                             elevation += highestSurroundingPiece.getHeight() * highestSurroundingPiece.getDropOnTopElevation();
53093                         }
53094                         if (highestSurroundingPiece.getLevel() != null) {
53095                             elevation += highestSurroundingPiece.getLevel().getElevation() - piece.getLevel().getElevation();
53096                         }
53097                         furnitureNewElevation[i] = Math.max(0, elevation);
53098                     }
53099                     else {
53100                         furnitureNewElevation[i] = 0;
53101                     }
53102                 }
53103                 ;
53104             }
53105             this.home.setSelectedItems(/* asList */ selectedFurniture.slice(0));
53106             FurnitureController.doSetFurnitureElevation(selectedFurniture, furnitureNewElevation);
53107             if (this.undoSupport != null) {
53108                 this.undoSupport.postEdit(new FurnitureController.FurnitureElevationResetUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), furnitureOldElevation, selectedFurniture, furnitureNewElevation));
53109             }
53110         }
53111     };
53112     FurnitureController.doSetFurnitureElevation = function (selectedFurniture, furnitureNewElevation) {
53113         for (var i = 0; i < selectedFurniture.length; i++) {
53114             {
53115                 selectedFurniture[i].setElevation(furnitureNewElevation[i]);
53116             }
53117             ;
53118         }
53119     };
53120     FurnitureController.prototype.getHighestSurroundingPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (piece) {
53121         var ignoredFurniture = [];
53122         return this.getHighestSurroundingPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$java_util_List(piece, ignoredFurniture);
53123     };
53124     FurnitureController.prototype.getHighestSurroundingPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$java_util_List = function (piece, ignoredFurniture) {
53125         var highestSurroundingPiece = null;
53126         var highestElevation = 1.4E-45;
53127         {
53128             var array = this.getSurroundingFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$java_util_List$float$boolean(piece, ignoredFurniture, 0.05, false);
53129             for (var index = 0; index < array.length; index++) {
53130                 var surroundingPiece = array[index];
53131                 {
53132                     var elevation = surroundingPiece.getElevation();
53133                     if (surroundingPiece.isHorizontallyRotated()) {
53134                         elevation += surroundingPiece.getHeightInPlan();
53135                     }
53136                     else {
53137                         elevation += surroundingPiece.getHeight() * surroundingPiece.getDropOnTopElevation();
53138                     }
53139                     if (elevation > highestElevation) {
53140                         highestElevation = elevation;
53141                         highestSurroundingPiece = surroundingPiece;
53142                     }
53143                 }
53144             }
53145         }
53146         return highestSurroundingPiece;
53147     };
53148     FurnitureController.prototype.getHighestSurroundingPieceOfFurniture = function (piece, ignoredFurniture) {
53149         if (((piece != null && piece instanceof HomePieceOfFurniture) || piece === null) && ((ignoredFurniture != null && (ignoredFurniture instanceof Array)) || ignoredFurniture === null)) {
53150             return this.getHighestSurroundingPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$java_util_List(piece, ignoredFurniture);
53151         }
53152         else if (((piece != null && piece instanceof HomePieceOfFurniture) || piece === null) && ignoredFurniture === undefined) {
53153             return this.getHighestSurroundingPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture(piece);
53154         }
53155         else
53156             throw new Error('invalid overload');
53157     };
53158     FurnitureController.prototype.getSurroundingFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (piece) {
53159         var ignoredFurniture = [];
53160         return this.getSurroundingFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$java_util_List$float$boolean(piece, ignoredFurniture, 0.2, true);
53161     };
53162     FurnitureController.prototype.getSurroundingFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$java_util_List$float$boolean = function (piece, ignoredFurniture, marginError, includeShelfUnits) {
53163         var piecePoints = piece.getPoints();
53164         var margin = Math.min(piece.getWidthInPlan(), piece.getDepthInPlan()) * marginError;
53165         var surroundingFurniture = ([]);
53166         {
53167             var array = this.getFurnitureInSameGroup(piece);
53168             for (var index = 0; index < array.length; index++) {
53169                 var homePiece = array[index];
53170                 {
53171                     if (homePiece !== piece && !(ignoredFurniture.indexOf((homePiece)) >= 0) && this.isPieceOfFurnitureVisibleAtSelectedLevel(homePiece) && (homePiece.getDropOnTopElevation() >= 0 || (includeShelfUnits && (homePiece != null && homePiece instanceof HomeShelfUnit)))) {
53172                         var surroundingPieceContainsPiece = true;
53173                         for (var index1 = 0; index1 < piecePoints.length; index1++) {
53174                             var point = piecePoints[index1];
53175                             {
53176                                 if (!homePiece.containsPoint(point[0], point[1], margin)) {
53177                                     surroundingPieceContainsPiece = false;
53178                                     break;
53179                                 }
53180                             }
53181                         }
53182                         if (surroundingPieceContainsPiece) {
53183                             /* add */ (surroundingFurniture.push(homePiece) > 0);
53184                         }
53185                     }
53186                 }
53187             }
53188         }
53189         return surroundingFurniture;
53190     };
53191     FurnitureController.prototype.getSurroundingFurniture = function (piece, ignoredFurniture, marginError, includeShelfUnits) {
53192         if (((piece != null && piece instanceof HomePieceOfFurniture) || piece === null) && ((ignoredFurniture != null && (ignoredFurniture instanceof Array)) || ignoredFurniture === null) && ((typeof marginError === 'number') || marginError === null) && ((typeof includeShelfUnits === 'boolean') || includeShelfUnits === null)) {
53193             return this.getSurroundingFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$java_util_List$float$boolean(piece, ignoredFurniture, marginError, includeShelfUnits);
53194         }
53195         else if (((piece != null && piece instanceof HomePieceOfFurniture) || piece === null) && ignoredFurniture === undefined && marginError === undefined && includeShelfUnits === undefined) {
53196             return this.getSurroundingFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture(piece);
53197         }
53198         else
53199             throw new Error('invalid overload');
53200     };
53201     /**
53202      * Returns the furniture list of the given <code>piece</code> which belongs to same group
53203      * or home furniture if it doesn't belong to home furniture.
53204      * @param {HomePieceOfFurniture} piece
53205      * @return {HomePieceOfFurniture[]}
53206      */
53207     FurnitureController.prototype.getFurnitureInSameGroup = function (piece) {
53208         var homeFurniture = this.home.getFurniture();
53209         var furnitureInSameGroup = FurnitureController.getFurnitureInSameGroup(piece, homeFurniture);
53210         if (furnitureInSameGroup != null) {
53211             return furnitureInSameGroup;
53212         }
53213         else {
53214             return homeFurniture;
53215         }
53216     };
53217     FurnitureController.getFurnitureInSameGroup = function (piece, furniture) {
53218         for (var index = 0; index < furniture.length; index++) {
53219             var piece2 = furniture[index];
53220             {
53221                 if (piece2 === piece) {
53222                     return furniture;
53223                 }
53224                 else if (piece2 != null && piece2 instanceof HomeFurnitureGroup) {
53225                     var siblingFurniture = FurnitureController.getFurnitureInSameGroup(piece, piece2.getFurniture());
53226                     if (siblingFurniture != null) {
53227                         return siblingFurniture;
53228                     }
53229                 }
53230             }
53231         }
53232         return null;
53233     };
53234     /**
53235      * Returns <code>true</code> if the given piece is viewable and
53236      * its height and elevation make it viewable at the selected level in home.
53237      * @param {HomePieceOfFurniture} piece
53238      * @return {boolean}
53239      */
53240     FurnitureController.prototype.isPieceOfFurnitureVisibleAtSelectedLevel = function (piece) {
53241         var selectedLevel = this.home.getSelectedLevel();
53242         return piece.isVisible() && (piece.getLevel() == null || piece.getLevel().isViewable()) && (piece.getLevel() === selectedLevel || piece.isAtLevel(selectedLevel));
53243     };
53244     /**
53245      * Controls the change of value of a visual property in home.
53246      * @deprecated {@link #setVisualProperty(String, Object) setVisualProperty} should be replaced by a call to
53247      * {@link #setHomeProperty(String, String)} to ensure the property can be easily saved and read.
53248      * @param {string} propertyName
53249      * @param {Object} propertyValue
53250      */
53251     FurnitureController.prototype.setVisualProperty = function (propertyName, propertyValue) {
53252         this.home.setVisualProperty(propertyName, propertyValue);
53253     };
53254     /**
53255      * Controls the change of value of a property in home.
53256      * @param {string} propertyName
53257      * @param {string} propertyValue
53258      */
53259     FurnitureController.prototype.setHomeProperty = function (propertyName, propertyValue) {
53260         this.home.setProperty(propertyName, propertyValue);
53261     };
53262     return FurnitureController;
53263 }());
53264 FurnitureController["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureController";
53265 FurnitureController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
53266 (function (FurnitureController) {
53267     /**
53268      * Undoable edit for furniture added to home.
53269      * @param {Home} home
53270      * @param {UserPreferences} preferences
53271      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
53272      * @param {boolean} oldBasePlanLocked
53273      * @param {boolean} allLevelsSelection
53274      * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} newFurniture
53275      * @param {int[]} newFurnitureIndex
53276      * @param {com.eteks.sweethome3d.model.HomeFurnitureGroup[]} newFurnitureGroups
53277      * @param {com.eteks.sweethome3d.model.Level[]} newFurnitureLevels
53278      * @param {Level} furnitureLevel
53279      * @param {boolean} newBasePlanLocked
53280      * @class
53281      * @extends LocalizedUndoableEdit
53282      */
53283     var FurnitureAdditionUndoableEdit = /** @class */ (function (_super) {
53284         __extends(FurnitureAdditionUndoableEdit, _super);
53285         function FurnitureAdditionUndoableEdit(home, preferences, oldSelection, oldBasePlanLocked, allLevelsSelection, newFurniture, newFurnitureIndex, newFurnitureGroups, newFurnitureLevels, furnitureLevel, newBasePlanLocked) {
53286             var _this = _super.call(this, preferences, FurnitureController, "undoAddFurnitureName") || this;
53287             if (_this.home === undefined) {
53288                 _this.home = null;
53289             }
53290             if (_this.allLevelsSelection === undefined) {
53291                 _this.allLevelsSelection = false;
53292             }
53293             if (_this.oldSelection === undefined) {
53294                 _this.oldSelection = null;
53295             }
53296             if (_this.oldBasePlanLocked === undefined) {
53297                 _this.oldBasePlanLocked = false;
53298             }
53299             if (_this.newFurniture === undefined) {
53300                 _this.newFurniture = null;
53301             }
53302             if (_this.newFurnitureIndex === undefined) {
53303                 _this.newFurnitureIndex = null;
53304             }
53305             if (_this.newFurnitureGroups === undefined) {
53306                 _this.newFurnitureGroups = null;
53307             }
53308             if (_this.newFurnitureLevels === undefined) {
53309                 _this.newFurnitureLevels = null;
53310             }
53311             if (_this.furnitureLevel === undefined) {
53312                 _this.furnitureLevel = null;
53313             }
53314             if (_this.newBasePlanLocked === undefined) {
53315                 _this.newBasePlanLocked = false;
53316             }
53317             _this.home = home;
53318             _this.oldSelection = oldSelection;
53319             _this.oldBasePlanLocked = oldBasePlanLocked;
53320             _this.allLevelsSelection = allLevelsSelection;
53321             _this.newFurniture = newFurniture;
53322             _this.newFurnitureIndex = newFurnitureIndex;
53323             _this.newFurnitureGroups = newFurnitureGroups;
53324             _this.newFurnitureLevels = newFurnitureLevels;
53325             _this.furnitureLevel = furnitureLevel;
53326             _this.newBasePlanLocked = newBasePlanLocked;
53327             return _this;
53328         }
53329         /**
53330          *
53331          */
53332         FurnitureAdditionUndoableEdit.prototype.undo = function () {
53333             _super.prototype.undo.call(this);
53334             FurnitureController.doDeleteFurniture(this.home, this.newFurniture, this.oldBasePlanLocked, this.allLevelsSelection);
53335             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
53336         };
53337         /**
53338          *
53339          */
53340         FurnitureAdditionUndoableEdit.prototype.redo = function () {
53341             _super.prototype.redo.call(this);
53342             FurnitureController.doAddFurniture(this.home, this.newFurniture, this.newFurnitureGroups, this.newFurnitureIndex, this.furnitureLevel, this.newFurnitureLevels, this.newBasePlanLocked, false);
53343         };
53344         return FurnitureAdditionUndoableEdit;
53345     }(LocalizedUndoableEdit));
53346     FurnitureController.FurnitureAdditionUndoableEdit = FurnitureAdditionUndoableEdit;
53347     FurnitureAdditionUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureController.FurnitureAdditionUndoableEdit";
53348     FurnitureAdditionUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
53349     /**
53350      * Undoable edit for furniture deleted from home.
53351      * @param {Home} home
53352      * @param {UserPreferences} preferences
53353      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
53354      * @param {boolean} basePlanLocked
53355      * @param {boolean} allLevelsSelection
53356      * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} furniture
53357      * @param {int[]} furnitureIndex
53358      * @param {com.eteks.sweethome3d.model.HomeFurnitureGroup[]} furnitureGroups
53359      * @param {com.eteks.sweethome3d.model.Level[]} furnitureLevels
53360      * @class
53361      * @extends LocalizedUndoableEdit
53362      */
53363     var FurnitureDeletionUndoableEdit = /** @class */ (function (_super) {
53364         __extends(FurnitureDeletionUndoableEdit, _super);
53365         function FurnitureDeletionUndoableEdit(home, preferences, oldSelection, basePlanLocked, allLevelsSelection, furniture, furnitureIndex, furnitureGroups, furnitureLevels) {
53366             var _this = _super.call(this, preferences, FurnitureController, "undoDeleteSelectionName") || this;
53367             if (_this.home === undefined) {
53368                 _this.home = null;
53369             }
53370             if (_this.oldSelection === undefined) {
53371                 _this.oldSelection = null;
53372             }
53373             if (_this.basePlanLocked === undefined) {
53374                 _this.basePlanLocked = false;
53375             }
53376             if (_this.allLevelsSelection === undefined) {
53377                 _this.allLevelsSelection = false;
53378             }
53379             if (_this.furniture === undefined) {
53380                 _this.furniture = null;
53381             }
53382             if (_this.furnitureIndex === undefined) {
53383                 _this.furnitureIndex = null;
53384             }
53385             if (_this.furnitureGroups === undefined) {
53386                 _this.furnitureGroups = null;
53387             }
53388             if (_this.furnitureLevels === undefined) {
53389                 _this.furnitureLevels = null;
53390             }
53391             _this.home = home;
53392             _this.oldSelection = oldSelection;
53393             _this.basePlanLocked = basePlanLocked;
53394             _this.allLevelsSelection = allLevelsSelection;
53395             _this.furniture = furniture;
53396             _this.furnitureIndex = furnitureIndex;
53397             _this.furnitureGroups = furnitureGroups;
53398             _this.furnitureLevels = furnitureLevels;
53399             return _this;
53400         }
53401         /**
53402          *
53403          */
53404         FurnitureDeletionUndoableEdit.prototype.undo = function () {
53405             _super.prototype.undo.call(this);
53406             FurnitureController.doAddFurniture(this.home, this.furniture, this.furnitureGroups, this.furnitureIndex, null, this.furnitureLevels, this.basePlanLocked, this.allLevelsSelection);
53407             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
53408         };
53409         /**
53410          *
53411          */
53412         FurnitureDeletionUndoableEdit.prototype.redo = function () {
53413             _super.prototype.redo.call(this);
53414             this.home.setSelectedItems(/* asList */ this.furniture.slice(0));
53415             FurnitureController.doDeleteFurniture(this.home, this.furniture, this.basePlanLocked, false);
53416         };
53417         return FurnitureDeletionUndoableEdit;
53418     }(LocalizedUndoableEdit));
53419     FurnitureController.FurnitureDeletionUndoableEdit = FurnitureDeletionUndoableEdit;
53420     FurnitureDeletionUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureController.FurnitureDeletionUndoableEdit";
53421     FurnitureDeletionUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
53422     /**
53423      * Undoable edit for furniture grouping.
53424      * @param {Home} home
53425      * @param {UserPreferences} preferences
53426      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
53427      * @param {boolean} basePlanLocked
53428      * @param {boolean} allLevelsSelection
53429      * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} groupedPieces
53430      * @param {int[]} groupedPiecesIndex
53431      * @param {com.eteks.sweethome3d.model.HomeFurnitureGroup[]} groupedPiecesGroups
53432      * @param {com.eteks.sweethome3d.model.Level[]} groupedPiecesLevel
53433      * @param {float[]} groupedPiecesElevation
53434      * @param {boolean[]} groupedPiecesVisible
53435      * @param {HomeFurnitureGroup} newGroup
53436      * @param {number} groupIndex
53437      * @param {Level} groupLevel
53438      * @param {float[]} groupPiecesNewElevation
53439      * @param {boolean} movable
53440      * @class
53441      * @extends LocalizedUndoableEdit
53442      */
53443     var FurnitureGroupingUndoableEdit = /** @class */ (function (_super) {
53444         __extends(FurnitureGroupingUndoableEdit, _super);
53445         function FurnitureGroupingUndoableEdit(home, preferences, oldSelection, basePlanLocked, allLevelsSelection, groupedPieces, groupedPiecesIndex, groupedPiecesGroups, groupedPiecesLevel, groupedPiecesElevation, groupedPiecesVisible, newGroup, groupIndex, groupLevel, groupPiecesNewElevation, movable) {
53446             var _this = _super.call(this, preferences, FurnitureController, "undoGroupName") || this;
53447             if (_this.home === undefined) {
53448                 _this.home = null;
53449             }
53450             if (_this.oldSelection === undefined) {
53451                 _this.oldSelection = null;
53452             }
53453             if (_this.basePlanLocked === undefined) {
53454                 _this.basePlanLocked = false;
53455             }
53456             if (_this.allLevelsSelection === undefined) {
53457                 _this.allLevelsSelection = false;
53458             }
53459             if (_this.groupedPieces === undefined) {
53460                 _this.groupedPieces = null;
53461             }
53462             if (_this.groupedPiecesIndex === undefined) {
53463                 _this.groupedPiecesIndex = null;
53464             }
53465             if (_this.groupedPiecesGroups === undefined) {
53466                 _this.groupedPiecesGroups = null;
53467             }
53468             if (_this.groupedPiecesLevel === undefined) {
53469                 _this.groupedPiecesLevel = null;
53470             }
53471             if (_this.groupedPiecesElevation === undefined) {
53472                 _this.groupedPiecesElevation = null;
53473             }
53474             if (_this.groupedPiecesVisible === undefined) {
53475                 _this.groupedPiecesVisible = null;
53476             }
53477             if (_this.newGroup === undefined) {
53478                 _this.newGroup = null;
53479             }
53480             if (_this.groupIndex === undefined) {
53481                 _this.groupIndex = 0;
53482             }
53483             if (_this.groupLevel === undefined) {
53484                 _this.groupLevel = null;
53485             }
53486             if (_this.groupPiecesNewElevation === undefined) {
53487                 _this.groupPiecesNewElevation = null;
53488             }
53489             if (_this.movable === undefined) {
53490                 _this.movable = false;
53491             }
53492             _this.home = home;
53493             _this.basePlanLocked = basePlanLocked;
53494             _this.oldSelection = oldSelection;
53495             _this.allLevelsSelection = allLevelsSelection;
53496             _this.groupedPieces = groupedPieces;
53497             _this.groupedPiecesIndex = groupedPiecesIndex;
53498             _this.groupedPiecesGroups = groupedPiecesGroups;
53499             _this.groupedPiecesLevel = groupedPiecesLevel;
53500             _this.groupedPiecesElevation = groupedPiecesElevation;
53501             _this.groupedPiecesVisible = groupedPiecesVisible;
53502             _this.newGroup = newGroup;
53503             _this.groupIndex = groupIndex;
53504             _this.groupLevel = groupLevel;
53505             _this.groupPiecesNewElevation = groupPiecesNewElevation;
53506             _this.movable = movable;
53507             return _this;
53508         }
53509         /**
53510          *
53511          */
53512         FurnitureGroupingUndoableEdit.prototype.undo = function () {
53513             _super.prototype.undo.call(this);
53514             FurnitureController.doUngroupFurniture(this.home, [this.newGroup], this.groupedPieces, this.groupedPiecesGroups, this.groupedPiecesIndex, this.groupedPiecesLevel, this.basePlanLocked, this.allLevelsSelection);
53515             for (var i = 0; i < this.groupedPieces.length; i++) {
53516                 {
53517                     this.groupedPieces[i].setElevation(this.groupedPiecesElevation[i]);
53518                     this.groupedPieces[i].setVisible(this.groupedPiecesVisible[i]);
53519                 }
53520                 ;
53521             }
53522             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
53523         };
53524         /**
53525          *
53526          */
53527         FurnitureGroupingUndoableEdit.prototype.redo = function () {
53528             _super.prototype.redo.call(this);
53529             for (var i = 0; i < this.groupedPieces.length; i++) {
53530                 {
53531                     this.groupedPieces[i].setElevation(this.groupPiecesNewElevation[i]);
53532                     this.groupedPieces[i].setLevel(null);
53533                 }
53534                 ;
53535             }
53536             this.newGroup.setMovable(this.movable);
53537             this.newGroup.setVisible(true);
53538             FurnitureController.doGroupFurniture(this.home, this.groupedPieces, [this.newGroup], null, [this.groupIndex], [this.groupLevel], this.basePlanLocked, false);
53539         };
53540         return FurnitureGroupingUndoableEdit;
53541     }(LocalizedUndoableEdit));
53542     FurnitureController.FurnitureGroupingUndoableEdit = FurnitureGroupingUndoableEdit;
53543     FurnitureGroupingUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureController.FurnitureGroupingUndoableEdit";
53544     FurnitureGroupingUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
53545     /**
53546      * Undoable edit for furniture ungrouping.
53547      * @param {Home} home
53548      * @param {UserPreferences} preferences
53549      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
53550      * @param {boolean} oldBasePlanLocked
53551      * @param {boolean} allLevelsSelection
53552      * @param {com.eteks.sweethome3d.model.HomeFurnitureGroup[]} groups
53553      * @param {int[]} groupsIndex
53554      * @param {com.eteks.sweethome3d.model.HomeFurnitureGroup[]} groupsGroups
53555      * @param {com.eteks.sweethome3d.model.Level[]} groupsLevels
53556      * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} ungroupedPieces
53557      * @param {int[]} ungroupedPiecesIndex
53558      * @param {com.eteks.sweethome3d.model.HomeFurnitureGroup[]} ungroupedPiecesGroups
53559      * @param {com.eteks.sweethome3d.model.Level[]} ungroupedPiecesLevels
53560      * @param {boolean} newBasePlanLocked
53561      * @class
53562      * @extends LocalizedUndoableEdit
53563      */
53564     var FurnitureUngroupingUndoableEdit = /** @class */ (function (_super) {
53565         __extends(FurnitureUngroupingUndoableEdit, _super);
53566         function FurnitureUngroupingUndoableEdit(home, preferences, oldSelection, oldBasePlanLocked, allLevelsSelection, groups, groupsIndex, groupsGroups, groupsLevels, ungroupedPieces, ungroupedPiecesIndex, ungroupedPiecesGroups, ungroupedPiecesLevels, newBasePlanLocked) {
53567             var _this = _super.call(this, preferences, FurnitureController, "undoUngroupName") || this;
53568             if (_this.home === undefined) {
53569                 _this.home = null;
53570             }
53571             if (_this.oldBasePlanLocked === undefined) {
53572                 _this.oldBasePlanLocked = false;
53573             }
53574             if (_this.oldSelection === undefined) {
53575                 _this.oldSelection = null;
53576             }
53577             if (_this.allLevelsSelection === undefined) {
53578                 _this.allLevelsSelection = false;
53579             }
53580             if (_this.groups === undefined) {
53581                 _this.groups = null;
53582             }
53583             if (_this.groupsIndex === undefined) {
53584                 _this.groupsIndex = null;
53585             }
53586             if (_this.groupsGroups === undefined) {
53587                 _this.groupsGroups = null;
53588             }
53589             if (_this.groupsLevels === undefined) {
53590                 _this.groupsLevels = null;
53591             }
53592             if (_this.ungroupedPieces === undefined) {
53593                 _this.ungroupedPieces = null;
53594             }
53595             if (_this.ungroupedPiecesIndex === undefined) {
53596                 _this.ungroupedPiecesIndex = null;
53597             }
53598             if (_this.ungroupedPiecesGroups === undefined) {
53599                 _this.ungroupedPiecesGroups = null;
53600             }
53601             if (_this.ungroupedPiecesLevels === undefined) {
53602                 _this.ungroupedPiecesLevels = null;
53603             }
53604             if (_this.newBasePlanLocked === undefined) {
53605                 _this.newBasePlanLocked = false;
53606             }
53607             _this.home = home;
53608             _this.oldSelection = oldSelection;
53609             _this.oldBasePlanLocked = oldBasePlanLocked;
53610             _this.allLevelsSelection = allLevelsSelection;
53611             _this.groups = groups;
53612             _this.groupsIndex = groupsIndex;
53613             _this.groupsGroups = groupsGroups;
53614             _this.groupsLevels = groupsLevels;
53615             _this.ungroupedPieces = ungroupedPieces;
53616             _this.ungroupedPiecesIndex = ungroupedPiecesIndex;
53617             _this.ungroupedPiecesGroups = ungroupedPiecesGroups;
53618             _this.ungroupedPiecesLevels = ungroupedPiecesLevels;
53619             _this.newBasePlanLocked = newBasePlanLocked;
53620             return _this;
53621         }
53622         /**
53623          *
53624          */
53625         FurnitureUngroupingUndoableEdit.prototype.undo = function () {
53626             _super.prototype.undo.call(this);
53627             FurnitureController.doGroupFurniture(this.home, this.ungroupedPieces, this.groups, this.groupsGroups, this.groupsIndex, this.groupsLevels, this.oldBasePlanLocked, this.allLevelsSelection);
53628             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
53629         };
53630         /**
53631          *
53632          */
53633         FurnitureUngroupingUndoableEdit.prototype.redo = function () {
53634             _super.prototype.redo.call(this);
53635             FurnitureController.doUngroupFurniture(this.home, this.groups, this.ungroupedPieces, this.ungroupedPiecesGroups, this.ungroupedPiecesIndex, this.ungroupedPiecesLevels, this.newBasePlanLocked, false);
53636         };
53637         return FurnitureUngroupingUndoableEdit;
53638     }(LocalizedUndoableEdit));
53639     FurnitureController.FurnitureUngroupingUndoableEdit = FurnitureUngroupingUndoableEdit;
53640     FurnitureUngroupingUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureController.FurnitureUngroupingUndoableEdit";
53641     FurnitureUngroupingUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
53642     /**
53643      * Undoable edit for furniture alignment.
53644      * @param {Home} home
53645      * @param {UserPreferences} preferences
53646      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
53647      * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} selectedFurniture
53648      * @param {HomePieceOfFurniture} leadPiece
53649      * @class
53650      * @extends LocalizedUndoableEdit
53651      */
53652     var FurnitureAlignmentUndoableEdit = /** @class */ (function (_super) {
53653         __extends(FurnitureAlignmentUndoableEdit, _super);
53654         function FurnitureAlignmentUndoableEdit(home, preferences, oldSelection, selectedFurniture, leadPiece) {
53655             var _this = _super.call(this, preferences, FurnitureController, "undoAlignName") || this;
53656             if (_this.home === undefined) {
53657                 _this.home = null;
53658             }
53659             if (_this.oldSelection === undefined) {
53660                 _this.oldSelection = null;
53661             }
53662             if (_this.selectedFurniture === undefined) {
53663                 _this.selectedFurniture = null;
53664             }
53665             if (_this.leadPiece === undefined) {
53666                 _this.leadPiece = null;
53667             }
53668             if (_this.alignedFurniture === undefined) {
53669                 _this.alignedFurniture = null;
53670             }
53671             if (_this.oldX === undefined) {
53672                 _this.oldX = null;
53673             }
53674             if (_this.oldY === undefined) {
53675                 _this.oldY = null;
53676             }
53677             _this.home = home;
53678             _this.oldSelection = oldSelection;
53679             _this.selectedFurniture = selectedFurniture;
53680             _this.leadPiece = leadPiece;
53681             _this.alignedFurniture = (function (s) { var a = []; while (s-- > 0)
53682                 a.push(null); return a; })(leadPiece == null ? selectedFurniture.length : selectedFurniture.length - 1);
53683             _this.oldX = (function (s) { var a = []; while (s-- > 0)
53684                 a.push(0); return a; })(_this.alignedFurniture.length);
53685             _this.oldY = (function (s) { var a = []; while (s-- > 0)
53686                 a.push(0); return a; })(_this.alignedFurniture.length);
53687             var i = 0;
53688             for (var index = 0; index < selectedFurniture.length; index++) {
53689                 var piece = selectedFurniture[index];
53690                 {
53691                     if (piece !== leadPiece) {
53692                         _this.alignedFurniture[i] = piece;
53693                         _this.oldX[i] = piece.getX();
53694                         _this.oldY[i] = piece.getY();
53695                         i++;
53696                     }
53697                 }
53698             }
53699             return _this;
53700         }
53701         /**
53702          *
53703          */
53704         FurnitureAlignmentUndoableEdit.prototype.undo = function () {
53705             _super.prototype.undo.call(this);
53706             FurnitureController.undoAlignFurniture(this.alignedFurniture, this.oldX, this.oldY);
53707             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
53708         };
53709         /**
53710          *
53711          */
53712         FurnitureAlignmentUndoableEdit.prototype.redo = function () {
53713             _super.prototype.redo.call(this);
53714             this.home.setSelectedItems(/* asList */ this.selectedFurniture.slice(0));
53715             this.alignFurniture$();
53716         };
53717         FurnitureAlignmentUndoableEdit.prototype.alignFurniture$ = function () {
53718             this.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture(this.alignedFurniture, this.leadPiece);
53719         };
53720         FurnitureAlignmentUndoableEdit.prototype.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (alignedFurniture, leadPiece) { throw new Error('cannot invoke abstract overloaded method... check your argument(s) type(s)'); };
53721         FurnitureAlignmentUndoableEdit.prototype.alignFurniture = function (alignedFurniture, leadPiece) {
53722             if (((alignedFurniture != null && alignedFurniture instanceof Array && (alignedFurniture.length == 0 || alignedFurniture[0] == null || (alignedFurniture[0] != null && alignedFurniture[0] instanceof HomePieceOfFurniture))) || alignedFurniture === null) && ((leadPiece != null && leadPiece instanceof HomePieceOfFurniture) || leadPiece === null)) {
53723                 return this.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture(alignedFurniture, leadPiece);
53724             }
53725             else if (alignedFurniture === undefined && leadPiece === undefined) {
53726                 return this.alignFurniture$();
53727             }
53728             else
53729                 throw new Error('invalid overload');
53730         };
53731         return FurnitureAlignmentUndoableEdit;
53732     }(LocalizedUndoableEdit));
53733     FurnitureController.FurnitureAlignmentUndoableEdit = FurnitureAlignmentUndoableEdit;
53734     FurnitureAlignmentUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureController.FurnitureAlignmentUndoableEdit";
53735     FurnitureAlignmentUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
53736     /**
53737      * Undoable edit for furniture distribution.
53738      * @param {Home} home
53739      * @param {UserPreferences} preferences
53740      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
53741      * @param {float[]} oldX
53742      * @param {float[]} oldY
53743      * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} alignedFurniture
53744      * @param {boolean} horizontal
53745      * @class
53746      * @extends LocalizedUndoableEdit
53747      */
53748     var FurnitureDistributionUndoableEdit = /** @class */ (function (_super) {
53749         __extends(FurnitureDistributionUndoableEdit, _super);
53750         function FurnitureDistributionUndoableEdit(home, preferences, oldSelection, oldX, oldY, alignedFurniture, horizontal) {
53751             var _this = _super.call(this, preferences, FurnitureController, "undoDistributeName") || this;
53752             if (_this.home === undefined) {
53753                 _this.home = null;
53754             }
53755             if (_this.oldSelection === undefined) {
53756                 _this.oldSelection = null;
53757             }
53758             if (_this.oldX === undefined) {
53759                 _this.oldX = null;
53760             }
53761             if (_this.oldY === undefined) {
53762                 _this.oldY = null;
53763             }
53764             if (_this.alignedFurniture === undefined) {
53765                 _this.alignedFurniture = null;
53766             }
53767             if (_this.horizontal === undefined) {
53768                 _this.horizontal = false;
53769             }
53770             _this.home = home;
53771             _this.oldSelection = oldSelection;
53772             _this.oldX = oldX;
53773             _this.oldY = oldY;
53774             _this.alignedFurniture = alignedFurniture;
53775             _this.horizontal = horizontal;
53776             return _this;
53777         }
53778         /**
53779          *
53780          */
53781         FurnitureDistributionUndoableEdit.prototype.undo = function () {
53782             _super.prototype.undo.call(this);
53783             FurnitureController.undoAlignFurniture(this.alignedFurniture, this.oldX, this.oldY);
53784             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
53785         };
53786         /**
53787          *
53788          */
53789         FurnitureDistributionUndoableEdit.prototype.redo = function () {
53790             _super.prototype.redo.call(this);
53791             this.home.setSelectedItems(/* asList */ this.alignedFurniture.slice(0));
53792             FurnitureController.doDistributeFurnitureAlongAxis(this.alignedFurniture, this.horizontal);
53793         };
53794         return FurnitureDistributionUndoableEdit;
53795     }(LocalizedUndoableEdit));
53796     FurnitureController.FurnitureDistributionUndoableEdit = FurnitureDistributionUndoableEdit;
53797     FurnitureDistributionUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureController.FurnitureDistributionUndoableEdit";
53798     FurnitureDistributionUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
53799     /**
53800      * Undoable edit for furniture elevation reset.
53801      * @param {Home} home
53802      * @param {UserPreferences} preferences
53803      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
53804      * @param {float[]} furnitureOldElevation
53805      * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} selectedFurniture
53806      * @param {float[]} furnitureNewElevation
53807      * @class
53808      * @extends LocalizedUndoableEdit
53809      */
53810     var FurnitureElevationResetUndoableEdit = /** @class */ (function (_super) {
53811         __extends(FurnitureElevationResetUndoableEdit, _super);
53812         function FurnitureElevationResetUndoableEdit(home, preferences, oldSelection, furnitureOldElevation, selectedFurniture, furnitureNewElevation) {
53813             var _this = _super.call(this, preferences, FurnitureController, "undoResetElevation") || this;
53814             if (_this.home === undefined) {
53815                 _this.home = null;
53816             }
53817             if (_this.oldSelection === undefined) {
53818                 _this.oldSelection = null;
53819             }
53820             if (_this.furnitureOldElevation === undefined) {
53821                 _this.furnitureOldElevation = null;
53822             }
53823             if (_this.selectedFurniture === undefined) {
53824                 _this.selectedFurniture = null;
53825             }
53826             if (_this.furnitureNewElevation === undefined) {
53827                 _this.furnitureNewElevation = null;
53828             }
53829             _this.home = home;
53830             _this.oldSelection = oldSelection;
53831             _this.furnitureOldElevation = furnitureOldElevation;
53832             _this.selectedFurniture = selectedFurniture;
53833             _this.furnitureNewElevation = furnitureNewElevation;
53834             return _this;
53835         }
53836         /**
53837          *
53838          */
53839         FurnitureElevationResetUndoableEdit.prototype.undo = function () {
53840             _super.prototype.undo.call(this);
53841             FurnitureController.doSetFurnitureElevation(this.selectedFurniture, this.furnitureOldElevation);
53842             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
53843         };
53844         /**
53845          *
53846          */
53847         FurnitureElevationResetUndoableEdit.prototype.redo = function () {
53848             _super.prototype.redo.call(this);
53849             this.home.setSelectedItems(/* asList */ this.selectedFurniture.slice(0));
53850             FurnitureController.doSetFurnitureElevation(this.selectedFurniture, this.furnitureNewElevation);
53851         };
53852         return FurnitureElevationResetUndoableEdit;
53853     }(LocalizedUndoableEdit));
53854     FurnitureController.FurnitureElevationResetUndoableEdit = FurnitureElevationResetUndoableEdit;
53855     FurnitureElevationResetUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureController.FurnitureElevationResetUndoableEdit";
53856     FurnitureElevationResetUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
53857     var FurnitureTopAlignmentUndoableEdit = /** @class */ (function (_super) {
53858         __extends(FurnitureTopAlignmentUndoableEdit, _super);
53859         function FurnitureTopAlignmentUndoableEdit(home, preferences, oldSelection, selectedFurniture, leadPiece) {
53860             return _super.call(this, home, preferences, oldSelection, selectedFurniture, leadPiece) || this;
53861         }
53862         FurnitureTopAlignmentUndoableEdit.prototype.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (alignedFurniture, leadPiece) {
53863             var minYLeadPiece = FurnitureController.getMinY(leadPiece);
53864             for (var index = 0; index < alignedFurniture.length; index++) {
53865                 var piece = alignedFurniture[index];
53866                 {
53867                     var minY = FurnitureController.getMinY(piece);
53868                     piece.setY(piece.getY() + minYLeadPiece - minY);
53869                 }
53870             }
53871         };
53872         /**
53873          *
53874          * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} alignedFurniture
53875          * @param {HomePieceOfFurniture} leadPiece
53876          * @private
53877          */
53878         FurnitureTopAlignmentUndoableEdit.prototype.alignFurniture = function (alignedFurniture, leadPiece) {
53879             if (((alignedFurniture != null && alignedFurniture instanceof Array && (alignedFurniture.length == 0 || alignedFurniture[0] == null || (alignedFurniture[0] != null && alignedFurniture[0] instanceof HomePieceOfFurniture))) || alignedFurniture === null) && ((leadPiece != null && leadPiece instanceof HomePieceOfFurniture) || leadPiece === null)) {
53880                 return this.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture(alignedFurniture, leadPiece);
53881             }
53882             else if (alignedFurniture === undefined && leadPiece === undefined) {
53883                 return this.alignFurniture$();
53884             }
53885             else
53886                 throw new Error('invalid overload');
53887         };
53888         return FurnitureTopAlignmentUndoableEdit;
53889     }(FurnitureController.FurnitureAlignmentUndoableEdit));
53890     FurnitureController.FurnitureTopAlignmentUndoableEdit = FurnitureTopAlignmentUndoableEdit;
53891     FurnitureTopAlignmentUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureController.FurnitureTopAlignmentUndoableEdit";
53892     FurnitureTopAlignmentUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
53893     var FurnitureBottomAlignmentUndoableEdit = /** @class */ (function (_super) {
53894         __extends(FurnitureBottomAlignmentUndoableEdit, _super);
53895         function FurnitureBottomAlignmentUndoableEdit(home, preferences, oldSelection, selectedFurniture, leadPiece) {
53896             return _super.call(this, home, preferences, oldSelection, selectedFurniture, leadPiece) || this;
53897         }
53898         FurnitureBottomAlignmentUndoableEdit.prototype.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (alignedFurniture, leadPiece) {
53899             var maxYLeadPiece = FurnitureController.getMaxY(leadPiece);
53900             for (var index = 0; index < alignedFurniture.length; index++) {
53901                 var piece = alignedFurniture[index];
53902                 {
53903                     var maxY = FurnitureController.getMaxY(piece);
53904                     piece.setY(piece.getY() + maxYLeadPiece - maxY);
53905                 }
53906             }
53907         };
53908         /**
53909          *
53910          * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} alignedFurniture
53911          * @param {HomePieceOfFurniture} leadPiece
53912          * @private
53913          */
53914         FurnitureBottomAlignmentUndoableEdit.prototype.alignFurniture = function (alignedFurniture, leadPiece) {
53915             if (((alignedFurniture != null && alignedFurniture instanceof Array && (alignedFurniture.length == 0 || alignedFurniture[0] == null || (alignedFurniture[0] != null && alignedFurniture[0] instanceof HomePieceOfFurniture))) || alignedFurniture === null) && ((leadPiece != null && leadPiece instanceof HomePieceOfFurniture) || leadPiece === null)) {
53916                 return this.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture(alignedFurniture, leadPiece);
53917             }
53918             else if (alignedFurniture === undefined && leadPiece === undefined) {
53919                 return this.alignFurniture$();
53920             }
53921             else
53922                 throw new Error('invalid overload');
53923         };
53924         return FurnitureBottomAlignmentUndoableEdit;
53925     }(FurnitureController.FurnitureAlignmentUndoableEdit));
53926     FurnitureController.FurnitureBottomAlignmentUndoableEdit = FurnitureBottomAlignmentUndoableEdit;
53927     FurnitureBottomAlignmentUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureController.FurnitureBottomAlignmentUndoableEdit";
53928     FurnitureBottomAlignmentUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
53929     var FurnitureLeftAlignmentUndoableEdit = /** @class */ (function (_super) {
53930         __extends(FurnitureLeftAlignmentUndoableEdit, _super);
53931         function FurnitureLeftAlignmentUndoableEdit(home, preferences, oldSelection, selectedFurniture, leadPiece) {
53932             return _super.call(this, home, preferences, oldSelection, selectedFurniture, leadPiece) || this;
53933         }
53934         FurnitureLeftAlignmentUndoableEdit.prototype.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (alignedFurniture, leadPiece) {
53935             var minXLeadPiece = FurnitureController.getMinX(leadPiece);
53936             for (var index = 0; index < alignedFurniture.length; index++) {
53937                 var piece = alignedFurniture[index];
53938                 {
53939                     var minX = FurnitureController.getMinX(piece);
53940                     piece.setX(piece.getX() + minXLeadPiece - minX);
53941                 }
53942             }
53943         };
53944         /**
53945          *
53946          * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} alignedFurniture
53947          * @param {HomePieceOfFurniture} leadPiece
53948          * @private
53949          */
53950         FurnitureLeftAlignmentUndoableEdit.prototype.alignFurniture = function (alignedFurniture, leadPiece) {
53951             if (((alignedFurniture != null && alignedFurniture instanceof Array && (alignedFurniture.length == 0 || alignedFurniture[0] == null || (alignedFurniture[0] != null && alignedFurniture[0] instanceof HomePieceOfFurniture))) || alignedFurniture === null) && ((leadPiece != null && leadPiece instanceof HomePieceOfFurniture) || leadPiece === null)) {
53952                 return this.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture(alignedFurniture, leadPiece);
53953             }
53954             else if (alignedFurniture === undefined && leadPiece === undefined) {
53955                 return this.alignFurniture$();
53956             }
53957             else
53958                 throw new Error('invalid overload');
53959         };
53960         return FurnitureLeftAlignmentUndoableEdit;
53961     }(FurnitureController.FurnitureAlignmentUndoableEdit));
53962     FurnitureController.FurnitureLeftAlignmentUndoableEdit = FurnitureLeftAlignmentUndoableEdit;
53963     FurnitureLeftAlignmentUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureController.FurnitureLeftAlignmentUndoableEdit";
53964     FurnitureLeftAlignmentUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
53965     var FurnitureRightAlignmentUndoableEdit = /** @class */ (function (_super) {
53966         __extends(FurnitureRightAlignmentUndoableEdit, _super);
53967         function FurnitureRightAlignmentUndoableEdit(home, preferences, oldSelection, selectedFurniture, leadPiece) {
53968             return _super.call(this, home, preferences, oldSelection, selectedFurniture, leadPiece) || this;
53969         }
53970         FurnitureRightAlignmentUndoableEdit.prototype.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (alignedFurniture, leadPiece) {
53971             var maxXLeadPiece = FurnitureController.getMaxX(leadPiece);
53972             for (var index = 0; index < alignedFurniture.length; index++) {
53973                 var piece = alignedFurniture[index];
53974                 {
53975                     var maxX = FurnitureController.getMaxX(piece);
53976                     piece.setX(piece.getX() + maxXLeadPiece - maxX);
53977                 }
53978             }
53979         };
53980         /**
53981          *
53982          * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} alignedFurniture
53983          * @param {HomePieceOfFurniture} leadPiece
53984          * @private
53985          */
53986         FurnitureRightAlignmentUndoableEdit.prototype.alignFurniture = function (alignedFurniture, leadPiece) {
53987             if (((alignedFurniture != null && alignedFurniture instanceof Array && (alignedFurniture.length == 0 || alignedFurniture[0] == null || (alignedFurniture[0] != null && alignedFurniture[0] instanceof HomePieceOfFurniture))) || alignedFurniture === null) && ((leadPiece != null && leadPiece instanceof HomePieceOfFurniture) || leadPiece === null)) {
53988                 return this.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture(alignedFurniture, leadPiece);
53989             }
53990             else if (alignedFurniture === undefined && leadPiece === undefined) {
53991                 return this.alignFurniture$();
53992             }
53993             else
53994                 throw new Error('invalid overload');
53995         };
53996         return FurnitureRightAlignmentUndoableEdit;
53997     }(FurnitureController.FurnitureAlignmentUndoableEdit));
53998     FurnitureController.FurnitureRightAlignmentUndoableEdit = FurnitureRightAlignmentUndoableEdit;
53999     FurnitureRightAlignmentUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureController.FurnitureRightAlignmentUndoableEdit";
54000     FurnitureRightAlignmentUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
54001     var FurnitureFrontSideAlignmentUndoableEdit = /** @class */ (function (_super) {
54002         __extends(FurnitureFrontSideAlignmentUndoableEdit, _super);
54003         function FurnitureFrontSideAlignmentUndoableEdit(home, preferences, oldSelection, selectedFurniture, leadPiece) {
54004             return _super.call(this, home, preferences, oldSelection, selectedFurniture, leadPiece) || this;
54005         }
54006         FurnitureFrontSideAlignmentUndoableEdit.prototype.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (alignedFurniture, leadPiece) {
54007             var points = leadPiece.getPoints();
54008             var frontLine = new java.awt.geom.Line2D.Float(points[2][0], points[2][1], points[3][0], points[3][1]);
54009             for (var index = 0; index < alignedFurniture.length; index++) {
54010                 var piece = alignedFurniture[index];
54011                 {
54012                     FurnitureController.alignPieceOfFurnitureAlongSides(piece, leadPiece, frontLine, true, null, 0);
54013                 }
54014             }
54015         };
54016         /**
54017          *
54018          * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} alignedFurniture
54019          * @param {HomePieceOfFurniture} leadPiece
54020          * @private
54021          */
54022         FurnitureFrontSideAlignmentUndoableEdit.prototype.alignFurniture = function (alignedFurniture, leadPiece) {
54023             if (((alignedFurniture != null && alignedFurniture instanceof Array && (alignedFurniture.length == 0 || alignedFurniture[0] == null || (alignedFurniture[0] != null && alignedFurniture[0] instanceof HomePieceOfFurniture))) || alignedFurniture === null) && ((leadPiece != null && leadPiece instanceof HomePieceOfFurniture) || leadPiece === null)) {
54024                 return this.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture(alignedFurniture, leadPiece);
54025             }
54026             else if (alignedFurniture === undefined && leadPiece === undefined) {
54027                 return this.alignFurniture$();
54028             }
54029             else
54030                 throw new Error('invalid overload');
54031         };
54032         return FurnitureFrontSideAlignmentUndoableEdit;
54033     }(FurnitureController.FurnitureAlignmentUndoableEdit));
54034     FurnitureController.FurnitureFrontSideAlignmentUndoableEdit = FurnitureFrontSideAlignmentUndoableEdit;
54035     FurnitureFrontSideAlignmentUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureController.FurnitureFrontSideAlignmentUndoableEdit";
54036     FurnitureFrontSideAlignmentUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
54037     var FurnitureBackSideAlignmentUndoableEdit = /** @class */ (function (_super) {
54038         __extends(FurnitureBackSideAlignmentUndoableEdit, _super);
54039         function FurnitureBackSideAlignmentUndoableEdit(home, preferences, oldSelection, selectedFurniture, leadPiece) {
54040             return _super.call(this, home, preferences, oldSelection, selectedFurniture, leadPiece) || this;
54041         }
54042         FurnitureBackSideAlignmentUndoableEdit.prototype.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (alignedFurniture, leadPiece) {
54043             var points = leadPiece.getPoints();
54044             var backLine = new java.awt.geom.Line2D.Float(points[0][0], points[0][1], points[1][0], points[1][1]);
54045             for (var index = 0; index < alignedFurniture.length; index++) {
54046                 var piece = alignedFurniture[index];
54047                 {
54048                     FurnitureController.alignPieceOfFurnitureAlongSides(piece, leadPiece, backLine, false, null, 0);
54049                 }
54050             }
54051         };
54052         /**
54053          *
54054          * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} alignedFurniture
54055          * @param {HomePieceOfFurniture} leadPiece
54056          * @private
54057          */
54058         FurnitureBackSideAlignmentUndoableEdit.prototype.alignFurniture = function (alignedFurniture, leadPiece) {
54059             if (((alignedFurniture != null && alignedFurniture instanceof Array && (alignedFurniture.length == 0 || alignedFurniture[0] == null || (alignedFurniture[0] != null && alignedFurniture[0] instanceof HomePieceOfFurniture))) || alignedFurniture === null) && ((leadPiece != null && leadPiece instanceof HomePieceOfFurniture) || leadPiece === null)) {
54060                 return this.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture(alignedFurniture, leadPiece);
54061             }
54062             else if (alignedFurniture === undefined && leadPiece === undefined) {
54063                 return this.alignFurniture$();
54064             }
54065             else
54066                 throw new Error('invalid overload');
54067         };
54068         return FurnitureBackSideAlignmentUndoableEdit;
54069     }(FurnitureController.FurnitureAlignmentUndoableEdit));
54070     FurnitureController.FurnitureBackSideAlignmentUndoableEdit = FurnitureBackSideAlignmentUndoableEdit;
54071     FurnitureBackSideAlignmentUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureController.FurnitureBackSideAlignmentUndoableEdit";
54072     FurnitureBackSideAlignmentUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
54073     var FurnitureLeftSideAlignmentUndoableEdit = /** @class */ (function (_super) {
54074         __extends(FurnitureLeftSideAlignmentUndoableEdit, _super);
54075         function FurnitureLeftSideAlignmentUndoableEdit(home, preferences, oldSelection, selectedFurniture, leadPiece) {
54076             return _super.call(this, home, preferences, oldSelection, selectedFurniture, leadPiece) || this;
54077         }
54078         FurnitureLeftSideAlignmentUndoableEdit.prototype.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (alignedFurniture, leadPiece) {
54079             var points = leadPiece.getPoints();
54080             var leftLine = new java.awt.geom.Line2D.Float(points[3][0], points[3][1], points[0][0], points[0][1]);
54081             for (var index = 0; index < alignedFurniture.length; index++) {
54082                 var piece = alignedFurniture[index];
54083                 {
54084                     FurnitureController.alignPieceOfFurnitureAlongLeftOrRightSides(piece, leadPiece, leftLine, false);
54085                 }
54086             }
54087         };
54088         /**
54089          *
54090          * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} alignedFurniture
54091          * @param {HomePieceOfFurniture} leadPiece
54092          * @private
54093          */
54094         FurnitureLeftSideAlignmentUndoableEdit.prototype.alignFurniture = function (alignedFurniture, leadPiece) {
54095             if (((alignedFurniture != null && alignedFurniture instanceof Array && (alignedFurniture.length == 0 || alignedFurniture[0] == null || (alignedFurniture[0] != null && alignedFurniture[0] instanceof HomePieceOfFurniture))) || alignedFurniture === null) && ((leadPiece != null && leadPiece instanceof HomePieceOfFurniture) || leadPiece === null)) {
54096                 return this.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture(alignedFurniture, leadPiece);
54097             }
54098             else if (alignedFurniture === undefined && leadPiece === undefined) {
54099                 return this.alignFurniture$();
54100             }
54101             else
54102                 throw new Error('invalid overload');
54103         };
54104         return FurnitureLeftSideAlignmentUndoableEdit;
54105     }(FurnitureController.FurnitureAlignmentUndoableEdit));
54106     FurnitureController.FurnitureLeftSideAlignmentUndoableEdit = FurnitureLeftSideAlignmentUndoableEdit;
54107     FurnitureLeftSideAlignmentUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureController.FurnitureLeftSideAlignmentUndoableEdit";
54108     FurnitureLeftSideAlignmentUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
54109     var FurnitureRightSideAlignmentUndoableEdit = /** @class */ (function (_super) {
54110         __extends(FurnitureRightSideAlignmentUndoableEdit, _super);
54111         function FurnitureRightSideAlignmentUndoableEdit(home, preferences, oldSelection, selectedFurniture, leadPiece) {
54112             return _super.call(this, home, preferences, oldSelection, selectedFurniture, leadPiece) || this;
54113         }
54114         FurnitureRightSideAlignmentUndoableEdit.prototype.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (alignedFurniture, leadPiece) {
54115             var points = leadPiece.getPoints();
54116             var rightLine = new java.awt.geom.Line2D.Float(points[1][0], points[1][1], points[2][0], points[2][1]);
54117             for (var index = 0; index < alignedFurniture.length; index++) {
54118                 var alignedPiece = alignedFurniture[index];
54119                 {
54120                     FurnitureController.alignPieceOfFurnitureAlongLeftOrRightSides(alignedPiece, leadPiece, rightLine, true);
54121                 }
54122             }
54123         };
54124         /**
54125          *
54126          * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} alignedFurniture
54127          * @param {HomePieceOfFurniture} leadPiece
54128          * @private
54129          */
54130         FurnitureRightSideAlignmentUndoableEdit.prototype.alignFurniture = function (alignedFurniture, leadPiece) {
54131             if (((alignedFurniture != null && alignedFurniture instanceof Array && (alignedFurniture.length == 0 || alignedFurniture[0] == null || (alignedFurniture[0] != null && alignedFurniture[0] instanceof HomePieceOfFurniture))) || alignedFurniture === null) && ((leadPiece != null && leadPiece instanceof HomePieceOfFurniture) || leadPiece === null)) {
54132                 return this.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture(alignedFurniture, leadPiece);
54133             }
54134             else if (alignedFurniture === undefined && leadPiece === undefined) {
54135                 return this.alignFurniture$();
54136             }
54137             else
54138                 throw new Error('invalid overload');
54139         };
54140         return FurnitureRightSideAlignmentUndoableEdit;
54141     }(FurnitureController.FurnitureAlignmentUndoableEdit));
54142     FurnitureController.FurnitureRightSideAlignmentUndoableEdit = FurnitureRightSideAlignmentUndoableEdit;
54143     FurnitureRightSideAlignmentUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureController.FurnitureRightSideAlignmentUndoableEdit";
54144     FurnitureRightSideAlignmentUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
54145     var FurnitureSideBySideAlignmentUndoableEdit = /** @class */ (function (_super) {
54146         __extends(FurnitureSideBySideAlignmentUndoableEdit, _super);
54147         function FurnitureSideBySideAlignmentUndoableEdit(home, preferences, oldSelection, selectedFurniture, leadPiece) {
54148             return _super.call(this, home, preferences, oldSelection, selectedFurniture, leadPiece) || this;
54149         }
54150         FurnitureSideBySideAlignmentUndoableEdit.prototype.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (alignedFurniture, leadPiece) {
54151             var points = leadPiece.getPoints();
54152             var centerLine = new java.awt.geom.Line2D.Float(leadPiece.getX(), leadPiece.getY(), (points[0][0] + points[1][0]) / 2, (points[0][1] + points[1][1]) / 2);
54153             var furnitureSortedAlongBackLine = FurnitureController.sortFurniture(alignedFurniture, leadPiece, centerLine);
54154             var leadPieceIndex = furnitureSortedAlongBackLine.indexOf(leadPiece);
54155             var backLine = new java.awt.geom.Line2D.Float(points[0][0], points[0][1], points[1][0], points[1][1]);
54156             var sideDistance = leadPiece.getWidthInPlan() / 2;
54157             for (var i = leadPieceIndex + 1; i < /* size */ furnitureSortedAlongBackLine.length; i++) {
54158                 {
54159                     sideDistance += FurnitureController.alignPieceOfFurnitureAlongSides(/* get */ furnitureSortedAlongBackLine[i], leadPiece, backLine, false, centerLine, sideDistance);
54160                 }
54161                 ;
54162             }
54163             sideDistance = -leadPiece.getWidthInPlan() / 2;
54164             for (var i = leadPieceIndex - 1; i >= 0; i--) {
54165                 {
54166                     sideDistance -= FurnitureController.alignPieceOfFurnitureAlongSides(/* get */ furnitureSortedAlongBackLine[i], leadPiece, backLine, false, centerLine, sideDistance);
54167                 }
54168                 ;
54169             }
54170         };
54171         /**
54172          *
54173          * @param {com.eteks.sweethome3d.model.HomePieceOfFurniture[]} alignedFurniture
54174          * @param {HomePieceOfFurniture} leadPiece
54175          * @private
54176          */
54177         FurnitureSideBySideAlignmentUndoableEdit.prototype.alignFurniture = function (alignedFurniture, leadPiece) {
54178             if (((alignedFurniture != null && alignedFurniture instanceof Array && (alignedFurniture.length == 0 || alignedFurniture[0] == null || (alignedFurniture[0] != null && alignedFurniture[0] instanceof HomePieceOfFurniture))) || alignedFurniture === null) && ((leadPiece != null && leadPiece instanceof HomePieceOfFurniture) || leadPiece === null)) {
54179                 return this.alignFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture_A$com_eteks_sweethome3d_model_HomePieceOfFurniture(alignedFurniture, leadPiece);
54180             }
54181             else if (alignedFurniture === undefined && leadPiece === undefined) {
54182                 return this.alignFurniture$();
54183             }
54184             else
54185                 throw new Error('invalid overload');
54186         };
54187         return FurnitureSideBySideAlignmentUndoableEdit;
54188     }(FurnitureController.FurnitureAlignmentUndoableEdit));
54189     FurnitureController.FurnitureSideBySideAlignmentUndoableEdit = FurnitureSideBySideAlignmentUndoableEdit;
54190     FurnitureSideBySideAlignmentUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.FurnitureController.FurnitureSideBySideAlignmentUndoableEdit";
54191     FurnitureSideBySideAlignmentUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
54192     var FurnitureController$0 = /** @class */ (function () {
54193         function FurnitureController$0(__parent) {
54194             this.__parent = __parent;
54195         }
54196         FurnitureController$0.prototype.selectionChanged = function (ev) {
54197             var selectedFurniture = Home.getFurnitureSubList(this.__parent.home.getSelectedItems());
54198             if ( /* isEmpty */(selectedFurniture.length == 0)) {
54199                 this.__parent.leadSelectedPieceOfFurniture = null;
54200             }
54201             else if (this.__parent.leadSelectedPieceOfFurniture == null || /* size */ selectedFurniture.length === 1 || selectedFurniture.indexOf(this.__parent.leadSelectedPieceOfFurniture) === -1) {
54202                 this.__parent.leadSelectedPieceOfFurniture = /* get */ selectedFurniture[0];
54203             }
54204         };
54205         return FurnitureController$0;
54206     }());
54207     FurnitureController.FurnitureController$0 = FurnitureController$0;
54208     FurnitureController$0["__interfaces"] = ["com.eteks.sweethome3d.model.SelectionListener"];
54209     var FurnitureController$1 = /** @class */ (function () {
54210         function FurnitureController$1(__parent) {
54211             this.__parent = __parent;
54212         }
54213         FurnitureController$1.prototype.propertyChange = function (ev) {
54214             if ( /* name */"MOVABLE" === ev.getPropertyName()) {
54215                 var piece_8 = ev.getSource();
54216                 if (this.__parent.home.isBasePlanLocked() && this.__parent.isPieceOfFurniturePartOfBasePlan(piece_8)) {
54217                     var selectedItems = this.__parent.home.getSelectedItems();
54218                     if ( /* contains */(selectedItems.indexOf((piece_8)) >= 0)) {
54219                         selectedItems = (selectedItems.slice(0));
54220                         /* remove */ (function (a) { var index = a.indexOf(piece_8); if (index >= 0) {
54221                             a.splice(index, 1);
54222                             return true;
54223                         }
54224                         else {
54225                             return false;
54226                         } })(selectedItems);
54227                         this.__parent.home.setSelectedItems(selectedItems);
54228                     }
54229                 }
54230             }
54231         };
54232         return FurnitureController$1;
54233     }());
54234     FurnitureController.FurnitureController$1 = FurnitureController$1;
54235     var FurnitureController$2 = /** @class */ (function () {
54236         function FurnitureController$2(orthogonalAxis) {
54237             this.orthogonalAxis = orthogonalAxis;
54238         }
54239         FurnitureController$2.prototype.compare = function (p1, p2) {
54240             return /* compare */ (this.orthogonalAxis.ptLineDistSq(p2.getX(), p2.getY()) * this.orthogonalAxis.relativeCCW(p2.getX(), p2.getY()) - this.orthogonalAxis.ptLineDistSq(p1.getX(), p1.getY()) * this.orthogonalAxis.relativeCCW(p1.getX(), p1.getY()));
54241         };
54242         return FurnitureController$2;
54243     }());
54244     FurnitureController.FurnitureController$2 = FurnitureController$2;
54245 })(FurnitureController || (FurnitureController = {}));
54246 /**
54247  * Creates the controller of label creation with undo support.
54248  * @param {Home} home
54249  * @param {number} x
54250  * @param {number} y
54251  * @param {UserPreferences} preferences
54252  * @param {Object} viewFactory
54253  * @param {javax.swing.undo.UndoableEditSupport} undoSupport
54254  * @class
54255  * @author Emmanuel Puybaret
54256  */
54257 var LabelController = /** @class */ (function () {
54258     function LabelController(home, x, y, preferences, viewFactory, undoSupport) {
54259         if (((home != null && home instanceof Home) || home === null) && ((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((preferences != null && preferences instanceof UserPreferences) || preferences === null) && ((viewFactory != null && (viewFactory.constructor != null && viewFactory.constructor["__interfaces"] != null && viewFactory.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || viewFactory === null) && ((undoSupport != null && undoSupport instanceof javax.swing.undo.UndoableEditSupport) || undoSupport === null)) {
54260             var __args = arguments;
54261             if (this.home === undefined) {
54262                 this.home = null;
54263             }
54264             if (this.x === undefined) {
54265                 this.x = null;
54266             }
54267             if (this.y === undefined) {
54268                 this.y = null;
54269             }
54270             if (this.preferences === undefined) {
54271                 this.preferences = null;
54272             }
54273             if (this.viewFactory === undefined) {
54274                 this.viewFactory = null;
54275             }
54276             if (this.undoSupport === undefined) {
54277                 this.undoSupport = null;
54278             }
54279             if (this.propertyChangeSupport === undefined) {
54280                 this.propertyChangeSupport = null;
54281             }
54282             if (this.labelView === undefined) {
54283                 this.labelView = null;
54284             }
54285             if (this.text === undefined) {
54286                 this.text = null;
54287             }
54288             if (this.alignment === undefined) {
54289                 this.alignment = null;
54290             }
54291             if (this.fontName === undefined) {
54292                 this.fontName = null;
54293             }
54294             if (this.fontNameSet === undefined) {
54295                 this.fontNameSet = false;
54296             }
54297             if (this.fontSize === undefined) {
54298                 this.fontSize = null;
54299             }
54300             if (this.color === undefined) {
54301                 this.color = null;
54302             }
54303             if (this.pitch === undefined) {
54304                 this.pitch = null;
54305             }
54306             if (this.pitchEnabled === undefined) {
54307                 this.pitchEnabled = null;
54308             }
54309             if (this.elevation === undefined) {
54310                 this.elevation = null;
54311             }
54312             this.home = home;
54313             this.x = x;
54314             this.y = y;
54315             this.preferences = preferences;
54316             this.viewFactory = viewFactory;
54317             this.undoSupport = undoSupport;
54318             this.propertyChangeSupport = new PropertyChangeSupport(this);
54319             this.alignment = TextStyle.Alignment.CENTER;
54320             this.fontName = preferences.getDefaultFontName();
54321             this.fontNameSet = true;
54322             this.fontSize = preferences.getDefaultTextStyle(Label).getFontSize();
54323             this.pitchEnabled = false;
54324             this.elevation = 0.0;
54325         }
54326         else if (((home != null && home instanceof Home) || home === null) && ((x != null && x instanceof UserPreferences) || x === null) && ((y != null && (y.constructor != null && y.constructor["__interfaces"] != null && y.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.viewcontroller.ViewFactory") >= 0)) || y === null) && ((preferences != null && preferences instanceof javax.swing.undo.UndoableEditSupport) || preferences === null) && viewFactory === undefined && undoSupport === undefined) {
54327             var __args = arguments;
54328             var preferences_19 = __args[1];
54329             var viewFactory_18 = __args[2];
54330             var undoSupport_10 = __args[3];
54331             if (this.home === undefined) {
54332                 this.home = null;
54333             }
54334             if (this.x === undefined) {
54335                 this.x = null;
54336             }
54337             if (this.y === undefined) {
54338                 this.y = null;
54339             }
54340             if (this.preferences === undefined) {
54341                 this.preferences = null;
54342             }
54343             if (this.viewFactory === undefined) {
54344                 this.viewFactory = null;
54345             }
54346             if (this.undoSupport === undefined) {
54347                 this.undoSupport = null;
54348             }
54349             if (this.propertyChangeSupport === undefined) {
54350                 this.propertyChangeSupport = null;
54351             }
54352             if (this.labelView === undefined) {
54353                 this.labelView = null;
54354             }
54355             if (this.text === undefined) {
54356                 this.text = null;
54357             }
54358             if (this.alignment === undefined) {
54359                 this.alignment = null;
54360             }
54361             if (this.fontName === undefined) {
54362                 this.fontName = null;
54363             }
54364             if (this.fontNameSet === undefined) {
54365                 this.fontNameSet = false;
54366             }
54367             if (this.fontSize === undefined) {
54368                 this.fontSize = null;
54369             }
54370             if (this.color === undefined) {
54371                 this.color = null;
54372             }
54373             if (this.pitch === undefined) {
54374                 this.pitch = null;
54375             }
54376             if (this.pitchEnabled === undefined) {
54377                 this.pitchEnabled = null;
54378             }
54379             if (this.elevation === undefined) {
54380                 this.elevation = null;
54381             }
54382             this.home = home;
54383             this.x = null;
54384             this.y = null;
54385             this.preferences = preferences_19;
54386             this.viewFactory = viewFactory_18;
54387             this.undoSupport = undoSupport_10;
54388             this.propertyChangeSupport = new PropertyChangeSupport(this);
54389             this.updateProperties();
54390         }
54391         else
54392             throw new Error('invalid overload');
54393     }
54394     /**
54395      * Updates edited properties from selected labels in the home edited by this controller.
54396      */
54397     LabelController.prototype.updateProperties = function () {
54398         var selectedLabels = Home.getLabelsSubList(this.home.getSelectedItems());
54399         if ( /* isEmpty */(selectedLabels.length == 0)) {
54400             this.setText(null);
54401             this.setFontName(null);
54402             this.fontNameSet = false;
54403             this.setFontSize(null);
54404             this.setAlignment(null);
54405             this.setColor(null);
54406             this.setPitch(null);
54407             this.pitchEnabled = false;
54408             this.setElevation(null);
54409         }
54410         else {
54411             var firstLabel = selectedLabels[0];
54412             var text = firstLabel.getText();
54413             if (text != null) {
54414                 for (var i = 1; i < /* size */ selectedLabels.length; i++) {
54415                     {
54416                         if (!(text === /* get */ selectedLabels[i].getText())) {
54417                             text = null;
54418                             break;
54419                         }
54420                     }
54421                     ;
54422                 }
54423             }
54424             this.setText(text);
54425             var alignment = firstLabel.getStyle() != null ? firstLabel.getStyle().getAlignment() : TextStyle.Alignment.CENTER;
54426             for (var i = 1; i < /* size */ selectedLabels.length; i++) {
54427                 {
54428                     var label = selectedLabels[i];
54429                     if (!((alignment) === (label.getStyle() != null ? label.getStyle().getAlignment() : TextStyle.Alignment.CENTER))) {
54430                         alignment = null;
54431                         break;
54432                     }
54433                 }
54434                 ;
54435             }
54436             this.setAlignment(alignment);
54437             var fontName = firstLabel.getStyle() != null ? firstLabel.getStyle().getFontName() : null;
54438             var fontNameSet = true;
54439             for (var i = 1; i < /* size */ selectedLabels.length; i++) {
54440                 {
54441                     var label = selectedLabels[i];
54442                     if (!(fontName == null && (label.getStyle() == null || label.getStyle().getFontName() == null) || fontName != null && label.getStyle() != null && (fontName === label.getStyle().getFontName()))) {
54443                         fontNameSet = false;
54444                         break;
54445                     }
54446                 }
54447                 ;
54448             }
54449             this.setFontName(fontName);
54450             this.fontNameSet = fontNameSet;
54451             var labelDefaultFontSize = this.preferences.getDefaultTextStyle(Label).getFontSize();
54452             var fontSize = firstLabel.getStyle() != null ? firstLabel.getStyle().getFontSize() : labelDefaultFontSize;
54453             for (var i = 1; i < /* size */ selectedLabels.length; i++) {
54454                 {
54455                     var label = selectedLabels[i];
54456                     if (!(fontSize === (label.getStyle() != null ? label.getStyle().getFontSize() : labelDefaultFontSize))) {
54457                         fontSize = null;
54458                         break;
54459                     }
54460                 }
54461                 ;
54462             }
54463             this.setFontSize(fontSize);
54464             var color = firstLabel.getColor();
54465             if (color != null) {
54466                 for (var i = 1; i < /* size */ selectedLabels.length; i++) {
54467                     {
54468                         if (!(color === /* get */ selectedLabels[i].getColor())) {
54469                             color = null;
54470                             break;
54471                         }
54472                     }
54473                     ;
54474                 }
54475             }
54476             this.setColor(color);
54477             var pitch = firstLabel.getPitch();
54478             for (var i = 1; i < /* size */ selectedLabels.length; i++) {
54479                 {
54480                     var label = selectedLabels[i];
54481                     if (!(pitch == null && label.getPitch() == null || pitch != null && (pitch === label.getPitch()))) {
54482                         pitch = null;
54483                         break;
54484                     }
54485                 }
54486                 ;
54487             }
54488             this.setPitch(pitch);
54489             var pitchEnabled = firstLabel.getPitch() != null;
54490             for (var i = 1; i < /* size */ selectedLabels.length; i++) {
54491                 {
54492                     if (!(pitchEnabled === ( /* get */selectedLabels[i].getPitch() != null))) {
54493                         pitchEnabled = null;
54494                         break;
54495                     }
54496                 }
54497                 ;
54498             }
54499             this.pitchEnabled = pitchEnabled;
54500             var elevation = firstLabel.getElevation();
54501             for (var i = 1; i < /* size */ selectedLabels.length; i++) {
54502                 {
54503                     if ( /* floatValue */elevation !== /* get */ selectedLabels[i].getElevation()) {
54504                         elevation = null;
54505                         break;
54506                     }
54507                 }
54508                 ;
54509             }
54510             this.setElevation(elevation);
54511         }
54512     };
54513     /**
54514      * Returns the view associated with this controller.
54515      * @return {Object}
54516      */
54517     LabelController.prototype.getView = function () {
54518         if (this.labelView == null) {
54519             this.labelView = this.viewFactory.createLabelView(this.x == null, this.preferences, this);
54520         }
54521         return this.labelView;
54522     };
54523     /**
54524      * Displays the view controlled by this controller.
54525      * @param {Object} parentView
54526      */
54527     LabelController.prototype.displayView = function (parentView) {
54528         this.getView().displayView(parentView);
54529     };
54530     /**
54531      * Adds the property change <code>listener</code> in parameter to this controller.
54532      * @param {string} property
54533      * @param {PropertyChangeListener} listener
54534      */
54535     LabelController.prototype.addPropertyChangeListener = function (property, listener) {
54536         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
54537     };
54538     /**
54539      * Removes the property change <code>listener</code> in parameter from this controller.
54540      * @param {string} property
54541      * @param {PropertyChangeListener} listener
54542      */
54543     LabelController.prototype.removePropertyChangeListener = function (property, listener) {
54544         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
54545     };
54546     /**
54547      * Sets the edited text.
54548      * @param {string} text
54549      */
54550     LabelController.prototype.setText = function (text) {
54551         if (text !== this.text) {
54552             var oldText = this.text;
54553             this.text = text;
54554             this.propertyChangeSupport.firePropertyChange(/* name */ "TEXT", oldText, text);
54555         }
54556     };
54557     /**
54558      * Returns the edited text.
54559      * @return {string}
54560      */
54561     LabelController.prototype.getText = function () {
54562         return this.text;
54563     };
54564     /**
54565      * Sets the edited text alignment.
54566      * @param {TextStyle.Alignment} alignment
54567      */
54568     LabelController.prototype.setAlignment = function (alignment) {
54569         if (alignment !== this.alignment) {
54570             var oldAlignment = this.alignment;
54571             this.alignment = alignment;
54572             this.propertyChangeSupport.firePropertyChange(/* name */ "ALIGNMENT", oldAlignment, alignment);
54573         }
54574     };
54575     /**
54576      * Returns the edited text alignment.
54577      * @return {TextStyle.Alignment}
54578      */
54579     LabelController.prototype.getAlignment = function () {
54580         return this.alignment;
54581     };
54582     /**
54583      * Sets the edited font name.
54584      * @param {string} fontName
54585      */
54586     LabelController.prototype.setFontName = function (fontName) {
54587         if (fontName !== this.fontName) {
54588             var oldFontName = this.fontName;
54589             this.fontName = fontName;
54590             this.propertyChangeSupport.firePropertyChange(/* name */ "FONT_NAME", oldFontName, fontName);
54591             this.fontNameSet = true;
54592         }
54593     };
54594     /**
54595      * Returns the edited font name or <code>null</code> for default system font.
54596      * @return {string}
54597      */
54598     LabelController.prototype.getFontName = function () {
54599         return this.fontName;
54600     };
54601     /**
54602      * Sets the edited font size.
54603      * @param {number} fontSize
54604      */
54605     LabelController.prototype.setFontSize = function (fontSize) {
54606         if (fontSize !== this.fontSize) {
54607             var oldFontSize = this.fontSize;
54608             this.fontSize = fontSize;
54609             this.propertyChangeSupport.firePropertyChange(/* name */ "FONT_SIZE", oldFontSize, fontSize);
54610         }
54611     };
54612     /**
54613      * Returns the edited font size.
54614      * @return {number}
54615      */
54616     LabelController.prototype.getFontSize = function () {
54617         return this.fontSize;
54618     };
54619     /**
54620      * Returns <code>true</code> if all edited labels use the same font name.
54621      * @return {boolean}
54622      */
54623     LabelController.prototype.isFontNameSet = function () {
54624         return this.fontNameSet;
54625     };
54626     /**
54627      * Sets the edited color.
54628      * @param {number} color
54629      */
54630     LabelController.prototype.setColor = function (color) {
54631         if (color !== this.color) {
54632             var oldColor = this.color;
54633             this.color = color;
54634             this.propertyChangeSupport.firePropertyChange(/* name */ "COLOR", oldColor, color);
54635         }
54636     };
54637     /**
54638      * Returns the edited color.
54639      * @return {number}
54640      */
54641     LabelController.prototype.getColor = function () {
54642         return this.color;
54643     };
54644     /**
54645      * Sets the edited pitch.
54646      * @param {number} pitch
54647      */
54648     LabelController.prototype.setPitch = function (pitch) {
54649         if (pitch !== this.pitch) {
54650             var oldPitch = this.pitch;
54651             this.pitch = pitch;
54652             this.propertyChangeSupport.firePropertyChange(/* name */ "PITCH", oldPitch, pitch);
54653         }
54654         this.pitchEnabled = pitch != null;
54655     };
54656     /**
54657      * Returns the edited pitch.
54658      * @return {number}
54659      */
54660     LabelController.prototype.getPitch = function () {
54661         return this.pitch;
54662     };
54663     /**
54664      * Returns <code>Boolean.TRUE</code> if all edited labels are viewed in 3D,
54665      * or <code>Boolean.FALSE</code> if no label is viewed in 3D.
54666      * @return {boolean}
54667      */
54668     LabelController.prototype.isPitchEnabled = function () {
54669         return this.pitchEnabled;
54670     };
54671     /**
54672      * Sets the edited elevation.
54673      * @param {number} elevation
54674      */
54675     LabelController.prototype.setElevation = function (elevation) {
54676         if (elevation !== this.elevation) {
54677             var oldElevation = this.elevation;
54678             this.elevation = elevation;
54679             this.propertyChangeSupport.firePropertyChange(/* name */ "ELEVATION", oldElevation, elevation);
54680         }
54681     };
54682     /**
54683      * Returns the edited elevation.
54684      * @return {number}
54685      */
54686     LabelController.prototype.getElevation = function () {
54687         return this.elevation;
54688     };
54689     LabelController.prototype.createLabel$java_lang_String$float$float = function (text, x, y) {
54690         var label = new Label(text, x, y);
54691         this.home.addLabel(label);
54692         return label;
54693     };
54694     /**
54695      * Returns a new label instance placed at the given coordinates and added to home.
54696      * @param {string} text
54697      * @param {number} x
54698      * @param {number} y
54699      * @return {Label}
54700      */
54701     LabelController.prototype.createLabel = function (text, x, y) {
54702         if (((typeof text === 'string') || text === null) && ((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null)) {
54703             return this.createLabel$java_lang_String$float$float(text, x, y);
54704         }
54705         else if (text === undefined && x === undefined && y === undefined) {
54706             return this.createLabel$();
54707         }
54708         else
54709             throw new Error('invalid overload');
54710     };
54711     LabelController.prototype.createLabel$ = function () {
54712         var text = this.getText();
54713         if (text != null && text.trim().length > 0) {
54714             var oldSelection = this.home.getSelectedItems();
54715             var basePlanLocked = this.home.isBasePlanLocked();
54716             var allLevelsSelection = this.home.isAllLevelsSelection();
54717             var label = this.createLabel$java_lang_String$float$float(text, this.x, this.y);
54718             var alignment = this.getAlignment();
54719             var fontName = this.getFontName();
54720             var fontSize = this.getFontSize();
54721             if (fontName != null || fontSize != null || this.getPitch() != null) {
54722                 var style = this.preferences.getDefaultTextStyle(Label);
54723                 if (fontName != null) {
54724                     style = style.deriveStyle$java_lang_String(fontName);
54725                 }
54726                 if (fontSize != null) {
54727                     style = style.deriveStyle$float(fontSize);
54728                 }
54729                 if (alignment != null) {
54730                     style = style.deriveStyle$com_eteks_sweethome3d_model_TextStyle_Alignment(alignment);
54731                 }
54732                 label.setStyle(style);
54733             }
54734             if (this.color != null) {
54735                 label.setColor(this.color);
54736             }
54737             label.setColor(this.getColor());
54738             label.setPitch(this.getPitch());
54739             label.setElevation(this.getElevation());
54740             var newBasePlanLocked = basePlanLocked && !this.isLabelPartOfBasePlan(label);
54741             LabelController.doAddAndSelectLabel(this.home, label, false, newBasePlanLocked);
54742             if (this.undoSupport != null) {
54743                 var undoableEdit = new LabelController.LabelCreationUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), basePlanLocked, allLevelsSelection, label, newBasePlanLocked);
54744                 this.undoSupport.postEdit(undoableEdit);
54745             }
54746             if (text.indexOf('\n') < 0) {
54747                 this.preferences.addAutoCompletionString("LabelText", text);
54748             }
54749         }
54750     };
54751     /**
54752      * Adds label to home and selects it.
54753      * @param {Home} home
54754      * @param {Label} label
54755      * @param {boolean} addToHome
54756      * @param {boolean} basePlanLocked
54757      * @private
54758      */
54759     LabelController.doAddAndSelectLabel = function (home, label, addToHome, basePlanLocked) {
54760         if (addToHome) {
54761             home.addLabel(label);
54762         }
54763         home.setBasePlanLocked(basePlanLocked);
54764         home.setSelectedItems(/* asList */ [label].slice(0));
54765         home.setAllLevelsSelection(false);
54766     };
54767     /**
54768      * Deletes label from home.
54769      * @param {Home} home
54770      * @param {Label} label
54771      * @param {boolean} basePlanLocked
54772      * @private
54773      */
54774     LabelController.doDeleteLabel = function (home, label, basePlanLocked) {
54775         home.deleteLabel(label);
54776         home.setBasePlanLocked(basePlanLocked);
54777     };
54778     /**
54779      * Returns <code>true</code>.
54780      * @param {Label} label
54781      * @return {boolean}
54782      */
54783     LabelController.prototype.isLabelPartOfBasePlan = function (label) {
54784         return true;
54785     };
54786     /**
54787      * Controls the modification of selected labels.
54788      */
54789     LabelController.prototype.modifyLabels = function () {
54790         var oldSelection = this.home.getSelectedItems();
54791         var selectedLabels = Home.getLabelsSubList(oldSelection);
54792         if (!(selectedLabels.length == 0)) {
54793             var text = this.getText();
54794             if (text != null && text.trim().length === 0) {
54795                 text = null;
54796             }
54797             var alignment = this.getAlignment();
54798             var fontName = this.getFontName();
54799             var fontNameSet = this.isFontNameSet();
54800             var fontSize = this.getFontSize();
54801             var color = this.getColor();
54802             var pitch = this.getPitch();
54803             var pitchEnabled = this.isPitchEnabled();
54804             var elevation = this.getElevation();
54805             var modifiedLabels = (function (s) { var a = []; while (s-- > 0)
54806                 a.push(null); return a; })(/* size */ selectedLabels.length);
54807             for (var i = 0; i < modifiedLabels.length; i++) {
54808                 {
54809                     modifiedLabels[i] = new LabelController.ModifiedLabel(/* get */ selectedLabels[i]);
54810                 }
54811                 ;
54812             }
54813             var defaultStyle = this.preferences.getDefaultTextStyle(Label);
54814             LabelController.doModifyLabels(modifiedLabels, text, alignment, fontName, fontNameSet, fontSize, defaultStyle, color, pitch, pitchEnabled, elevation);
54815             if (this.undoSupport != null) {
54816                 var undoableEdit = new LabelController.LabelModificationUndoableEdit(this.home, this.preferences, /* toArray */ oldSelection.slice(0), modifiedLabels, text, alignment, fontName, fontNameSet, fontSize, defaultStyle, color, pitch, pitchEnabled, elevation);
54817                 this.undoSupport.postEdit(undoableEdit);
54818             }
54819             if (text != null && text.indexOf('\n') < 0) {
54820                 this.preferences.addAutoCompletionString("LabelText", text);
54821             }
54822         }
54823     };
54824     /**
54825      * Modifies labels properties with the values in parameter.
54826      * @param {com.eteks.sweethome3d.viewcontroller.LabelController.ModifiedLabel[]} modifiedLabels
54827      * @param {string} text
54828      * @param {TextStyle.Alignment} alignment
54829      * @param {string} fontName
54830      * @param {boolean} fontNameSet
54831      * @param {number} fontSize
54832      * @param {TextStyle} defaultStyle
54833      * @param {number} color
54834      * @param {number} pitch
54835      * @param {boolean} pitchEnabled
54836      * @param {number} elevation
54837      * @private
54838      */
54839     LabelController.doModifyLabels = function (modifiedLabels, text, alignment, fontName, fontNameSet, fontSize, defaultStyle, color, pitch, pitchEnabled, elevation) {
54840         for (var index = 0; index < modifiedLabels.length; index++) {
54841             var modifiedLabel = modifiedLabels[index];
54842             {
54843                 var label = modifiedLabel.getLabel();
54844                 if (text != null) {
54845                     label.setText(text);
54846                 }
54847                 if (alignment != null) {
54848                     label.setStyle(label.getStyle() != null ? label.getStyle().deriveStyle$com_eteks_sweethome3d_model_TextStyle_Alignment(alignment) : defaultStyle.deriveStyle$com_eteks_sweethome3d_model_TextStyle_Alignment(alignment));
54849                 }
54850                 if (fontNameSet) {
54851                     label.setStyle(label.getStyle() != null ? label.getStyle().deriveStyle$java_lang_String(fontName) : defaultStyle.deriveStyle$java_lang_String(fontName));
54852                 }
54853                 if (fontSize != null) {
54854                     label.setStyle(label.getStyle() != null ? label.getStyle().deriveStyle$float(fontSize) : defaultStyle.deriveStyle$float(fontSize));
54855                 }
54856                 if (color != null) {
54857                     label.setColor(color);
54858                 }
54859                 if (pitchEnabled != null) {
54860                     if (false === pitchEnabled) {
54861                         label.setPitch(null);
54862                     }
54863                     else if (pitch != null) {
54864                         label.setPitch(pitch);
54865                         if (label.getStyle() == null) {
54866                             label.setStyle(defaultStyle);
54867                         }
54868                     }
54869                 }
54870                 if (elevation != null) {
54871                     label.setElevation(elevation);
54872                 }
54873             }
54874         }
54875     };
54876     /**
54877      * Restores label properties from the values stored in <code>modifiedLabels</code>.
54878      * @param {com.eteks.sweethome3d.viewcontroller.LabelController.ModifiedLabel[]} modifiedLabels
54879      * @private
54880      */
54881     LabelController.undoModifyLabels = function (modifiedLabels) {
54882         for (var index = 0; index < modifiedLabels.length; index++) {
54883             var modifiedPiece = modifiedLabels[index];
54884             {
54885                 modifiedPiece.reset();
54886             }
54887         }
54888     };
54889     return LabelController;
54890 }());
54891 LabelController["__class"] = "com.eteks.sweethome3d.viewcontroller.LabelController";
54892 LabelController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
54893 (function (LabelController) {
54894     /**
54895      * Undoable edit for label creation. This class isn't anonymous to avoid
54896      * being bound to controller and its view.
54897      * @extends LocalizedUndoableEdit
54898      * @class
54899      */
54900     var LabelCreationUndoableEdit = /** @class */ (function (_super) {
54901         __extends(LabelCreationUndoableEdit, _super);
54902         function LabelCreationUndoableEdit(home, preferences, oldSelection, oldBasePlanLocked, oldAllLevelsSelection, label, newBasePlanLocked) {
54903             var _this = _super.call(this, preferences, LabelController, "undoCreateLabelName") || this;
54904             if (_this.home === undefined) {
54905                 _this.home = null;
54906             }
54907             if (_this.oldSelection === undefined) {
54908                 _this.oldSelection = null;
54909             }
54910             if (_this.oldBasePlanLocked === undefined) {
54911                 _this.oldBasePlanLocked = false;
54912             }
54913             if (_this.oldAllLevelsSelection === undefined) {
54914                 _this.oldAllLevelsSelection = false;
54915             }
54916             if (_this.label === undefined) {
54917                 _this.label = null;
54918             }
54919             if (_this.newBasePlanLocked === undefined) {
54920                 _this.newBasePlanLocked = false;
54921             }
54922             _this.home = home;
54923             _this.oldSelection = oldSelection;
54924             _this.oldBasePlanLocked = oldBasePlanLocked;
54925             _this.oldAllLevelsSelection = oldAllLevelsSelection;
54926             _this.label = label;
54927             _this.newBasePlanLocked = newBasePlanLocked;
54928             return _this;
54929         }
54930         /**
54931          *
54932          */
54933         LabelCreationUndoableEdit.prototype.undo = function () {
54934             _super.prototype.undo.call(this);
54935             LabelController.doDeleteLabel(this.home, this.label, this.oldBasePlanLocked);
54936             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
54937             this.home.setAllLevelsSelection(this.oldAllLevelsSelection);
54938         };
54939         /**
54940          *
54941          */
54942         LabelCreationUndoableEdit.prototype.redo = function () {
54943             _super.prototype.redo.call(this);
54944             LabelController.doAddAndSelectLabel(this.home, this.label, true, this.newBasePlanLocked);
54945         };
54946         return LabelCreationUndoableEdit;
54947     }(LocalizedUndoableEdit));
54948     LabelController.LabelCreationUndoableEdit = LabelCreationUndoableEdit;
54949     LabelCreationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.LabelController.LabelCreationUndoableEdit";
54950     LabelCreationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
54951     /**
54952      * Undoable edit for label modification. This class isn't anonymous to avoid
54953      * being bound to controller and its view.
54954      * @extends LocalizedUndoableEdit
54955      * @class
54956      */
54957     var LabelModificationUndoableEdit = /** @class */ (function (_super) {
54958         __extends(LabelModificationUndoableEdit, _super);
54959         function LabelModificationUndoableEdit(home, preferences, oldSelection, modifiedLabels, text, alignment, fontName, fontNameSet, fontSize, defaultStyle, color, pitch, pitchEnabled, elevation) {
54960             var _this = _super.call(this, preferences, LabelController, "undoModifyLabelsName") || this;
54961             if (_this.home === undefined) {
54962                 _this.home = null;
54963             }
54964             if (_this.oldSelection === undefined) {
54965                 _this.oldSelection = null;
54966             }
54967             if (_this.modifiedLabels === undefined) {
54968                 _this.modifiedLabels = null;
54969             }
54970             if (_this.text === undefined) {
54971                 _this.text = null;
54972             }
54973             if (_this.alignment === undefined) {
54974                 _this.alignment = null;
54975             }
54976             if (_this.fontName === undefined) {
54977                 _this.fontName = null;
54978             }
54979             if (_this.fontNameSet === undefined) {
54980                 _this.fontNameSet = false;
54981             }
54982             if (_this.fontSize === undefined) {
54983                 _this.fontSize = null;
54984             }
54985             if (_this.defaultStyle === undefined) {
54986                 _this.defaultStyle = null;
54987             }
54988             if (_this.color === undefined) {
54989                 _this.color = null;
54990             }
54991             if (_this.pitch === undefined) {
54992                 _this.pitch = null;
54993             }
54994             if (_this.pitchEnabled === undefined) {
54995                 _this.pitchEnabled = null;
54996             }
54997             if (_this.elevation === undefined) {
54998                 _this.elevation = null;
54999             }
55000             _this.home = home;
55001             _this.oldSelection = oldSelection;
55002             _this.modifiedLabels = modifiedLabels;
55003             _this.text = text;
55004             _this.alignment = alignment;
55005             _this.fontName = fontName;
55006             _this.fontNameSet = fontNameSet;
55007             _this.fontSize = fontSize;
55008             _this.defaultStyle = defaultStyle;
55009             _this.color = color;
55010             _this.pitch = pitch;
55011             _this.pitchEnabled = pitchEnabled;
55012             _this.elevation = elevation;
55013             return _this;
55014         }
55015         /**
55016          *
55017          */
55018         LabelModificationUndoableEdit.prototype.undo = function () {
55019             _super.prototype.undo.call(this);
55020             LabelController.undoModifyLabels(this.modifiedLabels);
55021             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
55022         };
55023         /**
55024          *
55025          */
55026         LabelModificationUndoableEdit.prototype.redo = function () {
55027             _super.prototype.redo.call(this);
55028             LabelController.doModifyLabels(this.modifiedLabels, this.text, this.alignment, this.fontName, this.fontNameSet, this.fontSize, this.defaultStyle, this.color, this.pitch, this.pitchEnabled, this.elevation);
55029             this.home.setSelectedItems(/* asList */ this.oldSelection.slice(0));
55030         };
55031         return LabelModificationUndoableEdit;
55032     }(LocalizedUndoableEdit));
55033     LabelController.LabelModificationUndoableEdit = LabelModificationUndoableEdit;
55034     LabelModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.LabelController.LabelModificationUndoableEdit";
55035     LabelModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
55036     /**
55037      * Stores the current properties values of a modified label.
55038      * @param {Label} label
55039      * @class
55040      */
55041     var ModifiedLabel = /** @class */ (function () {
55042         function ModifiedLabel(label) {
55043             if (this.label === undefined) {
55044                 this.label = null;
55045             }
55046             if (this.text === undefined) {
55047                 this.text = null;
55048             }
55049             if (this.style === undefined) {
55050                 this.style = null;
55051             }
55052             if (this.color === undefined) {
55053                 this.color = null;
55054             }
55055             if (this.pitch === undefined) {
55056                 this.pitch = null;
55057             }
55058             if (this.elevation === undefined) {
55059                 this.elevation = 0;
55060             }
55061             this.label = label;
55062             this.text = label.getText();
55063             this.style = label.getStyle();
55064             this.color = label.getColor();
55065             this.pitch = label.getPitch();
55066             this.elevation = label.getElevation();
55067         }
55068         ModifiedLabel.prototype.getLabel = function () {
55069             return this.label;
55070         };
55071         ModifiedLabel.prototype.reset = function () {
55072             this.label.setText(this.text);
55073             this.label.setStyle(this.style);
55074             this.label.setColor(this.color);
55075             this.label.setPitch(this.pitch);
55076             this.label.setElevation(this.elevation);
55077         };
55078         return ModifiedLabel;
55079     }());
55080     LabelController.ModifiedLabel = ModifiedLabel;
55081     ModifiedLabel["__class"] = "com.eteks.sweethome3d.viewcontroller.LabelController.ModifiedLabel";
55082 })(LabelController || (LabelController = {}));
55083 /**
55084  * The controller of the photo creation view.
55085  * @author Emmanuel Puybaret
55086  * @param {Home} home
55087  * @param {UserPreferences} preferences
55088  * @param {Object} view3D
55089  * @param {Object} viewFactory
55090  * @param {Object} contentManager
55091  * @class
55092  * @extends AbstractPhotoController
55093  * @ignore
55094  */
55095 var PhotoController = /** @class */ (function (_super) {
55096     __extends(PhotoController, _super);
55097     function PhotoController(home, preferences, view3D, viewFactory, contentManager) {
55098         var _this = _super.call(this, home, preferences, view3D, contentManager) || this;
55099         if (_this.__com_eteks_sweethome3d_viewcontroller_PhotoController_home === undefined) {
55100             _this.__com_eteks_sweethome3d_viewcontroller_PhotoController_home = null;
55101         }
55102         if (_this.preferences === undefined) {
55103             _this.preferences = null;
55104         }
55105         if (_this.viewFactory === undefined) {
55106             _this.viewFactory = null;
55107         }
55108         if (_this.cameraChangeListener === undefined) {
55109             _this.cameraChangeListener = null;
55110         }
55111         if (_this.photoView === undefined) {
55112             _this.photoView = null;
55113         }
55114         if (_this.time === undefined) {
55115             _this.time = 0;
55116         }
55117         if (_this.lens === undefined) {
55118             _this.lens = null;
55119         }
55120         if (_this.renderer === undefined) {
55121             _this.renderer = null;
55122         }
55123         _this.__com_eteks_sweethome3d_viewcontroller_PhotoController_home = home;
55124         _this.preferences = preferences;
55125         _this.viewFactory = viewFactory;
55126         /* Use propertyChangeSupport defined in super class */ ;
55127         _this.cameraChangeListener = new PhotoController.CameraChangeListener(_this);
55128         home.getCamera().addPropertyChangeListener(_this.cameraChangeListener);
55129         home.addPropertyChangeListener("CAMERA", new PhotoController.HomeCameraChangeListener(_this));
55130         _this.updateProperties();
55131         return _this;
55132     }
55133     /**
55134      * Returns the view associated with this controller.
55135      * @return {Object}
55136      */
55137     PhotoController.prototype.getView = function () {
55138         if (this.photoView == null) {
55139             this.photoView = this.viewFactory.createPhotoView(this.__com_eteks_sweethome3d_viewcontroller_PhotoController_home, this.preferences, this);
55140         }
55141         return this.photoView;
55142     };
55143     /**
55144      * Displays the view controlled by this controller.
55145      * @param {Object} parentView
55146      */
55147     PhotoController.prototype.displayView = function (parentView) {
55148         this.getView().displayView(parentView);
55149     };
55150     /**
55151      * Updates edited properties from the photo creation preferences.
55152      */
55153     PhotoController.prototype.updateProperties = function () {
55154         if (this.__com_eteks_sweethome3d_viewcontroller_PhotoController_home != null) {
55155             _super.prototype.updateProperties.call(this);
55156             this.setTime(this.__com_eteks_sweethome3d_viewcontroller_PhotoController_home.getCamera().getTime());
55157             this.setLens(this.__com_eteks_sweethome3d_viewcontroller_PhotoController_home.getCamera().getLens());
55158             var renderer = this.__com_eteks_sweethome3d_viewcontroller_PhotoController_home.getCamera().getRenderer();
55159             if (renderer == null) {
55160                 renderer = this.preferences.getPhotoRenderer();
55161             }
55162             this.setRenderer(renderer, false);
55163         }
55164     };
55165     /**
55166      * Sets the edited time in UTC time zone.
55167      * @param {number} time
55168      */
55169     PhotoController.prototype.setTime = function (time) {
55170         if (this.time !== time) {
55171             var oldTime = this.time;
55172             this.time = time;
55173             this.propertyChangeSupport.firePropertyChange(/* name */ "TIME", oldTime, time);
55174             var homeCamera = this.__com_eteks_sweethome3d_viewcontroller_PhotoController_home.getCamera();
55175             homeCamera.removePropertyChangeListener(this.cameraChangeListener);
55176             homeCamera.setTime(time);
55177             homeCamera.addPropertyChangeListener(this.cameraChangeListener);
55178         }
55179     };
55180     /**
55181      * Returns the edited time in UTC time zone.
55182      * @return {number}
55183      */
55184     PhotoController.prototype.getTime = function () {
55185         return this.time;
55186     };
55187     /**
55188      * Sets the edited camera lens.
55189      * @param {Camera.Lens} lens
55190      */
55191     PhotoController.prototype.setLens = function (lens) {
55192         if (this.lens !== lens) {
55193             var oldLens = this.lens;
55194             this.lens = lens;
55195             this.propertyChangeSupport.firePropertyChange(/* name */ "LENS", oldLens, lens);
55196             if (lens === Camera.Lens.SPHERICAL) {
55197                 this.setAspectRatio(AspectRatio.RATIO_2_1);
55198             }
55199             else if (lens === Camera.Lens.FISHEYE) {
55200                 this.setAspectRatio(AspectRatio.SQUARE_RATIO);
55201             }
55202             this.__com_eteks_sweethome3d_viewcontroller_PhotoController_home.getCamera().setLens(this.lens);
55203         }
55204     };
55205     /**
55206      * Returns the edited camera lens.
55207      * @return {Camera.Lens}
55208      */
55209     PhotoController.prototype.getLens = function () {
55210         return this.lens;
55211     };
55212     PhotoController.prototype.setRenderer = function (renderer, updatePreferences) {
55213         if (updatePreferences === void 0) { updatePreferences = true; }
55214         if (this.renderer !== renderer) {
55215             var oldRenderer = this.renderer;
55216             this.renderer = renderer;
55217             this.propertyChangeSupport.firePropertyChange(/* name */ "RENDERER", oldRenderer, renderer);
55218             this.__com_eteks_sweethome3d_viewcontroller_PhotoController_home.getTopCamera().setRenderer(this.renderer);
55219             this.__com_eteks_sweethome3d_viewcontroller_PhotoController_home.getObserverCamera().setRenderer(this.renderer);
55220             if (updatePreferences) {
55221                 this.preferences.setPhotoRenderer(renderer);
55222             }
55223         }
55224     };
55225     /**
55226      * Returns the edited camera rendering engine.
55227      * @return {string}
55228      */
55229     PhotoController.prototype.getRenderer = function () {
55230         return this.renderer;
55231     };
55232     return PhotoController;
55233 }(AbstractPhotoController));
55234 PhotoController["__class"] = "com.eteks.sweethome3d.viewcontroller.PhotoController";
55235 PhotoController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
55236 (function (PhotoController) {
55237     /**
55238      * Home camera listener that updates properties when home camera changes. This listener is bound to this controller
55239      * with a weak reference to avoid strong link between home and this controller.
55240      * @param {PhotoController} photoController
55241      * @class
55242      */
55243     var HomeCameraChangeListener = /** @class */ (function () {
55244         function HomeCameraChangeListener(photoController) {
55245             if (this.photoController === undefined) {
55246                 this.photoController = null;
55247             }
55248             this.photoController = (photoController);
55249         }
55250         HomeCameraChangeListener.prototype.propertyChange = function (ev) {
55251             var controller = this.photoController;
55252             if (controller == null) {
55253                 ev.getSource().removePropertyChangeListener("CAMERA", this);
55254             }
55255             else {
55256                 ev.getOldValue().removePropertyChangeListener(controller.cameraChangeListener);
55257                 controller.updateProperties();
55258                 ev.getNewValue().addPropertyChangeListener(controller.cameraChangeListener);
55259             }
55260         };
55261         return HomeCameraChangeListener;
55262     }());
55263     PhotoController.HomeCameraChangeListener = HomeCameraChangeListener;
55264     HomeCameraChangeListener["__class"] = "com.eteks.sweethome3d.viewcontroller.PhotoController.HomeCameraChangeListener";
55265     /**
55266      * Camera listener that updates properties when camera changes. This listener is bound to this controller
55267      * with a weak reference to avoid strong link between home and this controller.
55268      * @param {AbstractPhotoController} photoController
55269      * @class
55270      */
55271     var CameraChangeListener = /** @class */ (function () {
55272         function CameraChangeListener(photoController) {
55273             if (this.photoController === undefined) {
55274                 this.photoController = null;
55275             }
55276             this.photoController = (photoController);
55277         }
55278         CameraChangeListener.prototype.propertyChange = function (ev) {
55279             var controller = this.photoController;
55280             if (controller == null) {
55281                 ev.getSource().removePropertyChangeListener(this);
55282             }
55283             else {
55284                 controller.updateProperties();
55285             }
55286         };
55287         return CameraChangeListener;
55288     }());
55289     PhotoController.CameraChangeListener = CameraChangeListener;
55290     CameraChangeListener["__class"] = "com.eteks.sweethome3d.viewcontroller.PhotoController.CameraChangeListener";
55291 })(PhotoController || (PhotoController = {}));
55292 /**
55293  * The controller of multiple photos creation view.
55294  * @author Emmanuel Puybaret
55295  * @param {Home} home
55296  * @param {UserPreferences} preferences
55297  * @param {Object} view3D
55298  * @param {Object} viewFactory
55299  * @param {Object} contentManager
55300  * @class
55301  * @extends AbstractPhotoController
55302  * @ignore
55303  */
55304 var PhotosController = /** @class */ (function (_super) {
55305     __extends(PhotosController, _super);
55306     function PhotosController(home, preferences, view3D, viewFactory, contentManager) {
55307         var _this = _super.call(this, home, preferences, view3D, contentManager) || this;
55308         if (_this.__com_eteks_sweethome3d_viewcontroller_PhotosController_home === undefined) {
55309             _this.__com_eteks_sweethome3d_viewcontroller_PhotosController_home = null;
55310         }
55311         if (_this.preferences === undefined) {
55312             _this.preferences = null;
55313         }
55314         if (_this.viewFactory === undefined) {
55315             _this.viewFactory = null;
55316         }
55317         if (_this.photoView === undefined) {
55318             _this.photoView = null;
55319         }
55320         if (_this.cameras === undefined) {
55321             _this.cameras = null;
55322         }
55323         if (_this.selectedCameras === undefined) {
55324             _this.selectedCameras = null;
55325         }
55326         if (_this.fileFormat === undefined) {
55327             _this.fileFormat = null;
55328         }
55329         if (_this.fileCompressionQuality === undefined) {
55330             _this.fileCompressionQuality = null;
55331         }
55332         _this.__com_eteks_sweethome3d_viewcontroller_PhotosController_home = home;
55333         _this.preferences = preferences;
55334         _this.viewFactory = viewFactory;
55335         /* Use propertyChangeSupport defined in super class */ ;
55336         _this.cameras = /* emptyList */ [];
55337         _this.selectedCameras = /* emptyList */ [];
55338         home.addPropertyChangeListener("STORED_CAMERAS", new PhotosController.HomeStoredCamerasChangeListener(_this));
55339         _this.updateProperties();
55340         return _this;
55341     }
55342     /**
55343      * Returns the view associated with this controller.
55344      * @return {Object}
55345      */
55346     PhotosController.prototype.getView = function () {
55347         if (this.photoView == null) {
55348             this.photoView = this.viewFactory.createPhotosView(this.__com_eteks_sweethome3d_viewcontroller_PhotosController_home, this.preferences, this);
55349         }
55350         return this.photoView;
55351     };
55352     /**
55353      * Displays the view controlled by this controller.
55354      * @param {Object} parentView
55355      */
55356     PhotosController.prototype.displayView = function (parentView) {
55357         this.getView().displayView(parentView);
55358     };
55359     /**
55360      * Updates edited properties from the photo creation preferences.
55361      */
55362     PhotosController.prototype.updateProperties = function () {
55363         if (this.__com_eteks_sweethome3d_viewcontroller_PhotosController_home != null) {
55364             _super.prototype.updateProperties.call(this);
55365             this.setCameras(this.__com_eteks_sweethome3d_viewcontroller_PhotosController_home.getStoredCameras());
55366             this.setSelectedCameras(this.__com_eteks_sweethome3d_viewcontroller_PhotosController_home.getStoredCameras());
55367         }
55368     };
55369     /**
55370      * Returns the cameras available to create photos.
55371      * @return {Camera[]}
55372      */
55373     PhotosController.prototype.getCameras = function () {
55374         return this.cameras;
55375     };
55376     /**
55377      * Sets the cameras available to create photos.
55378      * @param {Camera[]} cameras
55379      * @private
55380      */
55381     PhotosController.prototype.setCameras = function (cameras) {
55382         if (!(function (a1, a2) { if (a1 == null && a2 == null)
55383             return true; if (a1 == null || a2 == null)
55384             return false; if (a1.length != a2.length)
55385             return false; for (var i = 0; i < a1.length; i++) {
55386             if (a1[i] != a2[i])
55387                 return false;
55388         } return true; })(cameras, this.cameras)) {
55389             var oldCameras = this.cameras;
55390             this.cameras = (cameras.slice(0));
55391             this.propertyChangeSupport.firePropertyChange(/* name */ "CAMERAS", /* unmodifiableList */ oldCameras.slice(0), /* unmodifiableList */ cameras.slice(0));
55392         }
55393     };
55394     /**
55395      * Returns the selected cameras to create photos.
55396      * @return {Camera[]}
55397      */
55398     PhotosController.prototype.getSelectedCameras = function () {
55399         return this.selectedCameras;
55400     };
55401     /**
55402      * Sets the selected cameras to create photos.
55403      * @param {Camera[]} selectedCameras
55404      */
55405     PhotosController.prototype.setSelectedCameras = function (selectedCameras) {
55406         if (!(function (a1, a2) { if (a1 == null && a2 == null)
55407             return true; if (a1 == null || a2 == null)
55408             return false; if (a1.length != a2.length)
55409             return false; for (var i = 0; i < a1.length; i++) {
55410             if (a1[i] != a2[i])
55411                 return false;
55412         } return true; })(selectedCameras, this.selectedCameras)) {
55413             var oldSelectedCameras = this.selectedCameras;
55414             this.selectedCameras = (selectedCameras.slice(0));
55415             this.propertyChangeSupport.firePropertyChange(/* name */ "SELECTED_CAMERAS", /* unmodifiableList */ oldSelectedCameras.slice(0), /* unmodifiableList */ selectedCameras.slice(0));
55416         }
55417     };
55418     /**
55419      * Returns the format used to save image files.
55420      * @return {string}
55421      */
55422     PhotosController.prototype.getFileFormat = function () {
55423         return this.fileFormat;
55424     };
55425     /**
55426      * Sets the format used to save image files.
55427      * @param {string} fileFormat
55428      */
55429     PhotosController.prototype.setFileFormat = function (fileFormat) {
55430         if (fileFormat !== this.fileFormat) {
55431             var oldFileFormat = this.fileFormat;
55432             this.fileFormat = fileFormat;
55433             this.propertyChangeSupport.firePropertyChange(/* name */ "FILE_FORMAT", oldFileFormat, fileFormat);
55434         }
55435     };
55436     /**
55437      * Returns the compression quality used to save image files.
55438      * @return {number}
55439      */
55440     PhotosController.prototype.getFileCompressionQuality = function () {
55441         return this.fileCompressionQuality;
55442     };
55443     /**
55444      * Sets the compression quality used to save image files.
55445      * @param {number} fileCompressionQuality
55446      */
55447     PhotosController.prototype.setFileCompressionQuality = function (fileCompressionQuality) {
55448         if (fileCompressionQuality !== this.fileCompressionQuality) {
55449             var oldFileCompressionQuality = this.fileCompressionQuality;
55450             this.fileCompressionQuality = fileCompressionQuality;
55451             this.propertyChangeSupport.firePropertyChange(/* name */ "FILE_COMPRESSION_QUALITY", oldFileCompressionQuality, fileCompressionQuality);
55452         }
55453     };
55454     return PhotosController;
55455 }(AbstractPhotoController));
55456 PhotosController["__class"] = "com.eteks.sweethome3d.viewcontroller.PhotosController";
55457 PhotosController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
55458 (function (PhotosController) {
55459     /**
55460      * Home cameras listener that updates properties when home cameras change. This listener is bound to this controller
55461      * with a weak reference to avoid strong link between home and this controller.
55462      * @param {PhotosController} photoController
55463      * @class
55464      */
55465     var HomeStoredCamerasChangeListener = /** @class */ (function () {
55466         function HomeStoredCamerasChangeListener(photoController) {
55467             if (this.photosController === undefined) {
55468                 this.photosController = null;
55469             }
55470             this.photosController = (photoController);
55471         }
55472         HomeStoredCamerasChangeListener.prototype.propertyChange = function (ev) {
55473             var controller = this.photosController;
55474             if (controller == null) {
55475                 ev.getSource().removePropertyChangeListener("STORED_CAMERAS", this);
55476             }
55477             else {
55478                 controller.updateProperties();
55479             }
55480         };
55481         return HomeStoredCamerasChangeListener;
55482     }());
55483     PhotosController.HomeStoredCamerasChangeListener = HomeStoredCamerasChangeListener;
55484     HomeStoredCamerasChangeListener["__class"] = "com.eteks.sweethome3d.viewcontroller.PhotosController.HomeStoredCamerasChangeListener";
55485 })(PhotosController || (PhotosController = {}));
55486 /**
55487  * Creates a shelf unit from an existing one.
55488  * No additional properties will be copied.
55489  * @param {string} id    the ID of the shelfUnit
55490  * @param {Object} shelfUnit the shelfUnit from which data are copied
55491  * @param {java.lang.String[]} copiedProperties the names of the additional properties which should be copied from the existing piece
55492  * or <code>null</code> if all properties should be copied.
55493  * @class
55494  * @extends HomePieceOfFurniture
55495  * @author Emmanuel Puybaret
55496  */
55497 var HomeShelfUnit = /** @class */ (function (_super) {
55498     __extends(HomeShelfUnit, _super);
55499     function HomeShelfUnit(id, shelfUnit, copiedProperties) {
55500         var _this = this;
55501         if (((typeof id === 'string') || id === null) && ((shelfUnit != null && (shelfUnit.constructor != null && shelfUnit.constructor["__interfaces"] != null && shelfUnit.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.ShelfUnit") >= 0)) || shelfUnit === null) && ((copiedProperties != null && copiedProperties instanceof Array && (copiedProperties.length == 0 || copiedProperties[0] == null || (typeof copiedProperties[0] === 'string'))) || copiedProperties === null)) {
55502             var __args = arguments;
55503             _this = _super.call(this, id, shelfUnit, copiedProperties) || this;
55504             if (_this.shelfElevations === undefined) {
55505                 _this.shelfElevations = null;
55506             }
55507             if (_this.shelfBoxes === undefined) {
55508                 _this.shelfBoxes = null;
55509             }
55510             _this.shelfElevations = shelfUnit.getShelfElevations();
55511             _this.shelfBoxes = shelfUnit.getShelfBoxes();
55512         }
55513         else if (((id != null && (id.constructor != null && id.constructor["__interfaces"] != null && id.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.ShelfUnit") >= 0)) || id === null) && ((shelfUnit != null && shelfUnit instanceof Array && (shelfUnit.length == 0 || shelfUnit[0] == null || (typeof shelfUnit[0] === 'string'))) || shelfUnit === null) && copiedProperties === undefined) {
55514             var __args = arguments;
55515             var shelfUnit_1 = __args[0];
55516             var copiedProperties_4 = __args[1];
55517             {
55518                 var __args_129 = arguments;
55519                 var id_25 = HomeObject.createId("shelfUnit");
55520                 _this = _super.call(this, id_25, shelfUnit_1, copiedProperties_4) || this;
55521                 if (_this.shelfElevations === undefined) {
55522                     _this.shelfElevations = null;
55523                 }
55524                 if (_this.shelfBoxes === undefined) {
55525                     _this.shelfBoxes = null;
55526                 }
55527                 _this.shelfElevations = shelfUnit_1.getShelfElevations();
55528                 _this.shelfBoxes = shelfUnit_1.getShelfBoxes();
55529             }
55530             if (_this.shelfElevations === undefined) {
55531                 _this.shelfElevations = null;
55532             }
55533             if (_this.shelfBoxes === undefined) {
55534                 _this.shelfBoxes = null;
55535             }
55536         }
55537         else if (((typeof id === 'string') || id === null) && ((shelfUnit != null && (shelfUnit.constructor != null && shelfUnit.constructor["__interfaces"] != null && shelfUnit.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.ShelfUnit") >= 0)) || shelfUnit === null) && copiedProperties === undefined) {
55538             var __args = arguments;
55539             {
55540                 var __args_130 = arguments;
55541                 var copiedProperties_5 = HomePieceOfFurniture.EMPTY_PROPERTY_ARRAY_$LI$();
55542                 _this = _super.call(this, id, shelfUnit, copiedProperties_5) || this;
55543                 if (_this.shelfElevations === undefined) {
55544                     _this.shelfElevations = null;
55545                 }
55546                 if (_this.shelfBoxes === undefined) {
55547                     _this.shelfBoxes = null;
55548                 }
55549                 _this.shelfElevations = shelfUnit.getShelfElevations();
55550                 _this.shelfBoxes = shelfUnit.getShelfBoxes();
55551             }
55552             if (_this.shelfElevations === undefined) {
55553                 _this.shelfElevations = null;
55554             }
55555             if (_this.shelfBoxes === undefined) {
55556                 _this.shelfBoxes = null;
55557             }
55558         }
55559         else if (((id != null && (id.constructor != null && id.constructor["__interfaces"] != null && id.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.ShelfUnit") >= 0)) || id === null) && shelfUnit === undefined && copiedProperties === undefined) {
55560             var __args = arguments;
55561             var shelfUnit_2 = __args[0];
55562             {
55563                 var __args_131 = arguments;
55564                 var copiedProperties_6 = HomePieceOfFurniture.EMPTY_PROPERTY_ARRAY_$LI$();
55565                 {
55566                     var __args_132 = arguments;
55567                     var id_26 = HomeObject.createId("shelfUnit");
55568                     _this = _super.call(this, id_26, shelfUnit_2, copiedProperties_6) || this;
55569                     if (_this.shelfElevations === undefined) {
55570                         _this.shelfElevations = null;
55571                     }
55572                     if (_this.shelfBoxes === undefined) {
55573                         _this.shelfBoxes = null;
55574                     }
55575                     _this.shelfElevations = shelfUnit_2.getShelfElevations();
55576                     _this.shelfBoxes = shelfUnit_2.getShelfBoxes();
55577                 }
55578                 if (_this.shelfElevations === undefined) {
55579                     _this.shelfElevations = null;
55580                 }
55581                 if (_this.shelfBoxes === undefined) {
55582                     _this.shelfBoxes = null;
55583                 }
55584             }
55585             if (_this.shelfElevations === undefined) {
55586                 _this.shelfElevations = null;
55587             }
55588             if (_this.shelfBoxes === undefined) {
55589                 _this.shelfBoxes = null;
55590             }
55591         }
55592         else
55593             throw new Error('invalid overload');
55594         return _this;
55595     }
55596     /**
55597      * Returns the elevation(s) at which other objects can be placed on this shelf unit.
55598      * @return {float[]}
55599      */
55600     HomeShelfUnit.prototype.getShelfElevations = function () {
55601         return this.shelfElevations != null ? /* clone */ this.shelfElevations.slice(0) : null;
55602     };
55603     /**
55604      * Sets the elevation(s) at which other objects can be placed on this shelf unit.
55605      * Once this light is updated, listeners added to this light will receive a change notification.
55606      * @param {float[]} shelfElevations elevation of the shelves
55607      */
55608     HomeShelfUnit.prototype.setShelfElevations = function (shelfElevations) {
55609         if (!(function (a1, a2) { if (a1 == null && a2 == null)
55610             return true; if (a1 == null || a2 == null)
55611             return false; if (a1.length != a2.length)
55612             return false; for (var i = 0; i < a1.length; i++) {
55613             if (a1[i] != a2[i])
55614                 return false;
55615         } return true; })(shelfElevations, this.shelfElevations)) {
55616             var oldShelfElevations = this.shelfElevations.length === 0 ? this.shelfElevations : /* clone */ this.shelfElevations.slice(0);
55617             this.shelfElevations = shelfElevations.length === 0 ? shelfElevations : /* clone */ shelfElevations.slice(0);
55618             this.firePropertyChange(/* name */ "SHELF_ELEVATIONS", oldShelfElevations, shelfElevations);
55619         }
55620     };
55621     /**
55622      * Returns the coordinates of the shelf box(es) in which other objects can be placed in this shelf unit.
55623      * @return {com.eteks.sweethome3d.model.BoxBounds[]}
55624      */
55625     HomeShelfUnit.prototype.getShelfBoxes = function () {
55626         return /* clone */ this.shelfBoxes.slice(0);
55627     };
55628     /**
55629      * Sets the coordinates of the shelf box(es) in which other objects can be placed in this shelf.
55630      * Once this light is updated, listeners added to this light will receive a change notification.
55631      * @param shelfElevations elevation of the shelves
55632      * @param {com.eteks.sweethome3d.model.BoxBounds[]} shelfBoxes
55633      */
55634     HomeShelfUnit.prototype.setShelfBoxes = function (shelfBoxes) {
55635         if (!(function (a1, a2) { if (a1 == null && a2 == null)
55636             return true; if (a1 == null || a2 == null)
55637             return false; if (a1.length != a2.length)
55638             return false; for (var i = 0; i < a1.length; i++) {
55639             if (a1[i] != a2[i])
55640                 return false;
55641         } return true; })(shelfBoxes, this.shelfBoxes)) {
55642             var oldShelfBoxes = this.shelfBoxes.length === 0 ? this.shelfBoxes : /* clone */ this.shelfBoxes.slice(0);
55643             this.shelfBoxes = shelfBoxes.length === 0 ? shelfBoxes : /* clone */ shelfBoxes.slice(0);
55644             this.firePropertyChange(/* name */ "SHELF_BOXES", oldShelfBoxes, shelfBoxes);
55645         }
55646     };
55647     /**
55648      * Returns a clone of this shelf unit.
55649      * @return {HomeShelfUnit}
55650      */
55651     HomeShelfUnit.prototype.clone = function () {
55652         var _this = this;
55653         return (function (o) { if (_super.prototype.clone != undefined) {
55654             return _super.prototype.clone.call(_this);
55655         }
55656         else {
55657             var clone = Object.create(o);
55658             for (var p in o) {
55659                 if (o.hasOwnProperty(p))
55660                     clone[p] = o[p];
55661             }
55662             return clone;
55663         } })(this);
55664     };
55665     return HomeShelfUnit;
55666 }(HomePieceOfFurniture));
55667 HomeShelfUnit["__class"] = "com.eteks.sweethome3d.model.HomeShelfUnit";
55668 HomeShelfUnit["__interfaces"] = ["com.eteks.sweethome3d.model.Selectable", "com.eteks.sweethome3d.model.PieceOfFurniture", "com.eteks.sweethome3d.model.ShelfUnit", "com.eteks.sweethome3d.model.Elevatable"];
55669 HomeShelfUnit['__transients'] = ['shapeCache', 'propertyChangeSupport'];
55670 /**
55671  * Creates a home light from an existing one.
55672  * No additional properties will be copied.
55673  * @param {string} id    the ID of the light
55674  * @param {Object} light the light from which data are copied
55675  * @param {java.lang.String[]} copiedProperties the names of the additional properties which should be copied from the existing piece
55676  * or <code>null</code> if all properties should be copied.
55677  * @class
55678  * @extends HomePieceOfFurniture
55679  * @author Emmanuel Puybaret
55680  */
55681 var HomeLight = /** @class */ (function (_super) {
55682     __extends(HomeLight, _super);
55683     function HomeLight(id, light, copiedProperties) {
55684         var _this = this;
55685         if (((typeof id === 'string') || id === null) && ((light != null && (light.constructor != null && light.constructor["__interfaces"] != null && light.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Light") >= 0)) || light === null) && ((copiedProperties != null && copiedProperties instanceof Array && (copiedProperties.length == 0 || copiedProperties[0] == null || (typeof copiedProperties[0] === 'string'))) || copiedProperties === null)) {
55686             var __args = arguments;
55687             _this = _super.call(this, id, light, copiedProperties) || this;
55688             if (_this.lightSources === undefined) {
55689                 _this.lightSources = null;
55690             }
55691             if (_this.lightSourceMaterialNames === undefined) {
55692                 _this.lightSourceMaterialNames = null;
55693             }
55694             if (_this.power === undefined) {
55695                 _this.power = 0;
55696             }
55697             _this.lightSources = light.getLightSources();
55698             _this.lightSourceMaterialNames = light.getLightSourceMaterialNames();
55699             _this.power = 0.5;
55700         }
55701         else if (((id != null && (id.constructor != null && id.constructor["__interfaces"] != null && id.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Light") >= 0)) || id === null) && ((light != null && light instanceof Array && (light.length == 0 || light[0] == null || (typeof light[0] === 'string'))) || light === null) && copiedProperties === undefined) {
55702             var __args = arguments;
55703             var light_1 = __args[0];
55704             var copiedProperties_7 = __args[1];
55705             {
55706                 var __args_133 = arguments;
55707                 var id_27 = HomeObject.createId("light");
55708                 _this = _super.call(this, id_27, light_1, copiedProperties_7) || this;
55709                 if (_this.lightSources === undefined) {
55710                     _this.lightSources = null;
55711                 }
55712                 if (_this.lightSourceMaterialNames === undefined) {
55713                     _this.lightSourceMaterialNames = null;
55714                 }
55715                 if (_this.power === undefined) {
55716                     _this.power = 0;
55717                 }
55718                 _this.lightSources = light_1.getLightSources();
55719                 _this.lightSourceMaterialNames = light_1.getLightSourceMaterialNames();
55720                 _this.power = 0.5;
55721             }
55722             if (_this.lightSources === undefined) {
55723                 _this.lightSources = null;
55724             }
55725             if (_this.lightSourceMaterialNames === undefined) {
55726                 _this.lightSourceMaterialNames = null;
55727             }
55728             if (_this.power === undefined) {
55729                 _this.power = 0;
55730             }
55731         }
55732         else if (((typeof id === 'string') || id === null) && ((light != null && (light.constructor != null && light.constructor["__interfaces"] != null && light.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Light") >= 0)) || light === null) && copiedProperties === undefined) {
55733             var __args = arguments;
55734             {
55735                 var __args_134 = arguments;
55736                 var copiedProperties_8 = HomePieceOfFurniture.EMPTY_PROPERTY_ARRAY_$LI$();
55737                 _this = _super.call(this, id, light, copiedProperties_8) || this;
55738                 if (_this.lightSources === undefined) {
55739                     _this.lightSources = null;
55740                 }
55741                 if (_this.lightSourceMaterialNames === undefined) {
55742                     _this.lightSourceMaterialNames = null;
55743                 }
55744                 if (_this.power === undefined) {
55745                     _this.power = 0;
55746                 }
55747                 _this.lightSources = light.getLightSources();
55748                 _this.lightSourceMaterialNames = light.getLightSourceMaterialNames();
55749                 _this.power = 0.5;
55750             }
55751             if (_this.lightSources === undefined) {
55752                 _this.lightSources = null;
55753             }
55754             if (_this.lightSourceMaterialNames === undefined) {
55755                 _this.lightSourceMaterialNames = null;
55756             }
55757             if (_this.power === undefined) {
55758                 _this.power = 0;
55759             }
55760         }
55761         else if (((id != null && (id.constructor != null && id.constructor["__interfaces"] != null && id.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Light") >= 0)) || id === null) && light === undefined && copiedProperties === undefined) {
55762             var __args = arguments;
55763             var light_2 = __args[0];
55764             {
55765                 var __args_135 = arguments;
55766                 var copiedProperties_9 = HomePieceOfFurniture.EMPTY_PROPERTY_ARRAY_$LI$();
55767                 {
55768                     var __args_136 = arguments;
55769                     var id_28 = HomeObject.createId("light");
55770                     _this = _super.call(this, id_28, light_2, copiedProperties_9) || this;
55771                     if (_this.lightSources === undefined) {
55772                         _this.lightSources = null;
55773                     }
55774                     if (_this.lightSourceMaterialNames === undefined) {
55775                         _this.lightSourceMaterialNames = null;
55776                     }
55777                     if (_this.power === undefined) {
55778                         _this.power = 0;
55779                     }
55780                     _this.lightSources = light_2.getLightSources();
55781                     _this.lightSourceMaterialNames = light_2.getLightSourceMaterialNames();
55782                     _this.power = 0.5;
55783                 }
55784                 if (_this.lightSources === undefined) {
55785                     _this.lightSources = null;
55786                 }
55787                 if (_this.lightSourceMaterialNames === undefined) {
55788                     _this.lightSourceMaterialNames = null;
55789                 }
55790                 if (_this.power === undefined) {
55791                     _this.power = 0;
55792                 }
55793             }
55794             if (_this.lightSources === undefined) {
55795                 _this.lightSources = null;
55796             }
55797             if (_this.lightSourceMaterialNames === undefined) {
55798                 _this.lightSourceMaterialNames = null;
55799             }
55800             if (_this.power === undefined) {
55801                 _this.power = 0;
55802             }
55803         }
55804         else
55805             throw new Error('invalid overload');
55806         return _this;
55807     }
55808     /**
55809      * Returns the sources managed by this light. Each light source point
55810      * is a percentage of the width, the depth and the height of this light.
55811      * with the abscissa origin at the left side of the piece,
55812      * the ordinate origin at the front side of the piece
55813      * and the elevation origin at the bottom side of the piece.
55814      * @return {com.eteks.sweethome3d.model.LightSource[]} a copy of light sources array.
55815      */
55816     HomeLight.prototype.getLightSources = function () {
55817         if (this.lightSources.length === 0) {
55818             return this.lightSources;
55819         }
55820         else {
55821             return /* clone */ this.lightSources.slice(0);
55822         }
55823     };
55824     /**
55825      * Sets the sources managed by this light. Once this light is updated,
55826      * listeners added to this light will receive a change notification.
55827      * @param {com.eteks.sweethome3d.model.LightSource[]} lightSources sources of the light
55828      */
55829     HomeLight.prototype.setLightSources = function (lightSources) {
55830         if (!(function (a1, a2) { if (a1 == null && a2 == null)
55831             return true; if (a1 == null || a2 == null)
55832             return false; if (a1.length != a2.length)
55833             return false; for (var i = 0; i < a1.length; i++) {
55834             if (a1[i] != a2[i])
55835                 return false;
55836         } return true; })(lightSources, this.lightSources)) {
55837             var oldLightSources = this.lightSources.length === 0 ? this.lightSources : /* clone */ this.lightSources.slice(0);
55838             this.lightSources = lightSources.length === 0 ? lightSources : /* clone */ lightSources.slice(0);
55839             this.firePropertyChange(/* name */ "LIGHT_SOURCES", oldLightSources, lightSources);
55840         }
55841     };
55842     /**
55843      * Returns the material names of the light sources in the 3D model managed by this light.
55844      * @return {java.lang.String[]} a copy of light source material names array.
55845      */
55846     HomeLight.prototype.getLightSourceMaterialNames = function () {
55847         if (this.lightSourceMaterialNames.length === 0) {
55848             return this.lightSourceMaterialNames;
55849         }
55850         else {
55851             return /* clone */ this.lightSourceMaterialNames.slice(0);
55852         }
55853     };
55854     /**
55855      * Sets the material names of the light sources in the 3D model managed by this light.
55856      * Once this light is updated, listeners added to this light will receive a change notification.
55857      * @param {java.lang.String[]} lightSourceMaterialNames material names of the light sources
55858      */
55859     HomeLight.prototype.setLightSourceMaterialNames = function (lightSourceMaterialNames) {
55860         if (!(function (a1, a2) { if (a1 == null && a2 == null)
55861             return true; if (a1 == null || a2 == null)
55862             return false; if (a1.length != a2.length)
55863             return false; for (var i = 0; i < a1.length; i++) {
55864             if (a1[i] != a2[i])
55865                 return false;
55866         } return true; })(lightSourceMaterialNames, this.lightSourceMaterialNames)) {
55867             var oldLightSourceMaterialNames = this.lightSourceMaterialNames.length === 0 ? this.lightSourceMaterialNames : /* clone */ this.lightSourceMaterialNames.slice(0);
55868             this.lightSourceMaterialNames = lightSourceMaterialNames.length === 0 ? lightSourceMaterialNames : /* clone */ lightSourceMaterialNames.slice(0);
55869             this.firePropertyChange(/* name */ "LIGHT_SOURCE_MATERIAL_NAMES", oldLightSourceMaterialNames, lightSourceMaterialNames);
55870         }
55871     };
55872     /**
55873      * Returns the power of this light.
55874      * @return {number}
55875      */
55876     HomeLight.prototype.getPower = function () {
55877         return this.power;
55878     };
55879     /**
55880      * Sets the power of this light. Once this light is updated,
55881      * listeners added to this light will receive a change notification.
55882      * @param {number} power power of the light
55883      */
55884     HomeLight.prototype.setPower = function (power) {
55885         if (power !== this.power) {
55886             var oldPower = this.power;
55887             this.power = power;
55888             this.firePropertyChange(/* name */ "POWER", oldPower, power);
55889         }
55890     };
55891     /**
55892      * Returns a clone of this light.
55893      * @return {HomeLight}
55894      */
55895     HomeLight.prototype.clone = function () {
55896         var _this = this;
55897         return (function (o) { if (_super.prototype.clone != undefined) {
55898             return _super.prototype.clone.call(_this);
55899         }
55900         else {
55901             var clone = Object.create(o);
55902             for (var p in o) {
55903                 if (o.hasOwnProperty(p))
55904                     clone[p] = o[p];
55905             }
55906             return clone;
55907         } })(this);
55908     };
55909     return HomeLight;
55910 }(HomePieceOfFurniture));
55911 HomeLight["__class"] = "com.eteks.sweethome3d.model.HomeLight";
55912 HomeLight["__interfaces"] = ["com.eteks.sweethome3d.model.Selectable", "com.eteks.sweethome3d.model.PieceOfFurniture", "com.eteks.sweethome3d.model.Elevatable", "com.eteks.sweethome3d.model.Light"];
55913 HomeLight['__transients'] = ['shapeCache', 'propertyChangeSupport'];
55914 /**
55915  * Creates a home door or window from an existing one.
55916  * @param {string} id           the ID of the object
55917  * @param {Object} doorOrWindow the door or window from which data are copied
55918  * @param {java.lang.String[]} copiedProperties the names of the additional properties which should be copied from the existing piece
55919  * or <code>null</code> if all properties should be copied.
55920  * @class
55921  * @extends HomePieceOfFurniture
55922  * @author Emmanuel Puybaret
55923  */
55924 var HomeDoorOrWindow = /** @class */ (function (_super) {
55925     __extends(HomeDoorOrWindow, _super);
55926     function HomeDoorOrWindow(id, doorOrWindow, copiedProperties) {
55927         var _this = this;
55928         if (((typeof id === 'string') || id === null) && ((doorOrWindow != null && (doorOrWindow.constructor != null && doorOrWindow.constructor["__interfaces"] != null && doorOrWindow.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.DoorOrWindow") >= 0)) || doorOrWindow === null) && ((copiedProperties != null && copiedProperties instanceof Array && (copiedProperties.length == 0 || copiedProperties[0] == null || (typeof copiedProperties[0] === 'string'))) || copiedProperties === null)) {
55929             var __args = arguments;
55930             _this = _super.call(this, id, doorOrWindow, copiedProperties) || this;
55931             if (_this.wallThickness === undefined) {
55932                 _this.wallThickness = 0;
55933             }
55934             if (_this.wallDistance === undefined) {
55935                 _this.wallDistance = 0;
55936             }
55937             if (_this.wallWidth === undefined) {
55938                 _this.wallWidth = 0;
55939             }
55940             if (_this.wallLeft === undefined) {
55941                 _this.wallLeft = 0;
55942             }
55943             if (_this.wallHeight === undefined) {
55944                 _this.wallHeight = 0;
55945             }
55946             if (_this.wallTop === undefined) {
55947                 _this.wallTop = 0;
55948             }
55949             if (_this.wallCutOutOnBothSides === undefined) {
55950                 _this.wallCutOutOnBothSides = false;
55951             }
55952             if (_this.widthDepthDeformable === undefined) {
55953                 _this.widthDepthDeformable = false;
55954             }
55955             if (_this.sashes === undefined) {
55956                 _this.sashes = null;
55957             }
55958             if (_this.cutOutShape === undefined) {
55959                 _this.cutOutShape = null;
55960             }
55961             if (_this.boundToWall === undefined) {
55962                 _this.boundToWall = false;
55963             }
55964             _this.wallThickness = doorOrWindow.getWallThickness();
55965             _this.wallDistance = doorOrWindow.getWallDistance();
55966             _this.wallWidth = 1;
55967             _this.wallLeft = 0;
55968             _this.wallHeight = 1;
55969             _this.wallTop = 0;
55970             _this.wallCutOutOnBothSides = doorOrWindow.isWallCutOutOnBothSides();
55971             _this.widthDepthDeformable = doorOrWindow.isWidthDepthDeformable();
55972             _this.sashes = doorOrWindow.getSashes();
55973             _this.cutOutShape = doorOrWindow.getCutOutShape();
55974         }
55975         else if (((id != null && (id.constructor != null && id.constructor["__interfaces"] != null && id.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.DoorOrWindow") >= 0)) || id === null) && ((doorOrWindow != null && doorOrWindow instanceof Array && (doorOrWindow.length == 0 || doorOrWindow[0] == null || (typeof doorOrWindow[0] === 'string'))) || doorOrWindow === null) && copiedProperties === undefined) {
55976             var __args = arguments;
55977             var doorOrWindow_9 = __args[0];
55978             var copiedProperties_10 = __args[1];
55979             {
55980                 var __args_137 = arguments;
55981                 var id_29 = HomeObject.createId("doorOrWindow");
55982                 _this = _super.call(this, id_29, doorOrWindow_9, copiedProperties_10) || this;
55983                 if (_this.wallThickness === undefined) {
55984                     _this.wallThickness = 0;
55985                 }
55986                 if (_this.wallDistance === undefined) {
55987                     _this.wallDistance = 0;
55988                 }
55989                 if (_this.wallWidth === undefined) {
55990                     _this.wallWidth = 0;
55991                 }
55992                 if (_this.wallLeft === undefined) {
55993                     _this.wallLeft = 0;
55994                 }
55995                 if (_this.wallHeight === undefined) {
55996                     _this.wallHeight = 0;
55997                 }
55998                 if (_this.wallTop === undefined) {
55999                     _this.wallTop = 0;
56000                 }
56001                 if (_this.wallCutOutOnBothSides === undefined) {
56002                     _this.wallCutOutOnBothSides = false;
56003                 }
56004                 if (_this.widthDepthDeformable === undefined) {
56005                     _this.widthDepthDeformable = false;
56006                 }
56007                 if (_this.sashes === undefined) {
56008                     _this.sashes = null;
56009                 }
56010                 if (_this.cutOutShape === undefined) {
56011                     _this.cutOutShape = null;
56012                 }
56013                 if (_this.boundToWall === undefined) {
56014                     _this.boundToWall = false;
56015                 }
56016                 _this.wallThickness = doorOrWindow_9.getWallThickness();
56017                 _this.wallDistance = doorOrWindow_9.getWallDistance();
56018                 _this.wallWidth = 1;
56019                 _this.wallLeft = 0;
56020                 _this.wallHeight = 1;
56021                 _this.wallTop = 0;
56022                 _this.wallCutOutOnBothSides = doorOrWindow_9.isWallCutOutOnBothSides();
56023                 _this.widthDepthDeformable = doorOrWindow_9.isWidthDepthDeformable();
56024                 _this.sashes = doorOrWindow_9.getSashes();
56025                 _this.cutOutShape = doorOrWindow_9.getCutOutShape();
56026             }
56027             if (_this.wallThickness === undefined) {
56028                 _this.wallThickness = 0;
56029             }
56030             if (_this.wallDistance === undefined) {
56031                 _this.wallDistance = 0;
56032             }
56033             if (_this.wallWidth === undefined) {
56034                 _this.wallWidth = 0;
56035             }
56036             if (_this.wallLeft === undefined) {
56037                 _this.wallLeft = 0;
56038             }
56039             if (_this.wallHeight === undefined) {
56040                 _this.wallHeight = 0;
56041             }
56042             if (_this.wallTop === undefined) {
56043                 _this.wallTop = 0;
56044             }
56045             if (_this.wallCutOutOnBothSides === undefined) {
56046                 _this.wallCutOutOnBothSides = false;
56047             }
56048             if (_this.widthDepthDeformable === undefined) {
56049                 _this.widthDepthDeformable = false;
56050             }
56051             if (_this.sashes === undefined) {
56052                 _this.sashes = null;
56053             }
56054             if (_this.cutOutShape === undefined) {
56055                 _this.cutOutShape = null;
56056             }
56057             if (_this.boundToWall === undefined) {
56058                 _this.boundToWall = false;
56059             }
56060         }
56061         else if (((typeof id === 'string') || id === null) && ((doorOrWindow != null && (doorOrWindow.constructor != null && doorOrWindow.constructor["__interfaces"] != null && doorOrWindow.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.DoorOrWindow") >= 0)) || doorOrWindow === null) && copiedProperties === undefined) {
56062             var __args = arguments;
56063             {
56064                 var __args_138 = arguments;
56065                 var copiedProperties_11 = HomePieceOfFurniture.EMPTY_PROPERTY_ARRAY_$LI$();
56066                 _this = _super.call(this, id, doorOrWindow, copiedProperties_11) || this;
56067                 if (_this.wallThickness === undefined) {
56068                     _this.wallThickness = 0;
56069                 }
56070                 if (_this.wallDistance === undefined) {
56071                     _this.wallDistance = 0;
56072                 }
56073                 if (_this.wallWidth === undefined) {
56074                     _this.wallWidth = 0;
56075                 }
56076                 if (_this.wallLeft === undefined) {
56077                     _this.wallLeft = 0;
56078                 }
56079                 if (_this.wallHeight === undefined) {
56080                     _this.wallHeight = 0;
56081                 }
56082                 if (_this.wallTop === undefined) {
56083                     _this.wallTop = 0;
56084                 }
56085                 if (_this.wallCutOutOnBothSides === undefined) {
56086                     _this.wallCutOutOnBothSides = false;
56087                 }
56088                 if (_this.widthDepthDeformable === undefined) {
56089                     _this.widthDepthDeformable = false;
56090                 }
56091                 if (_this.sashes === undefined) {
56092                     _this.sashes = null;
56093                 }
56094                 if (_this.cutOutShape === undefined) {
56095                     _this.cutOutShape = null;
56096                 }
56097                 if (_this.boundToWall === undefined) {
56098                     _this.boundToWall = false;
56099                 }
56100                 _this.wallThickness = doorOrWindow.getWallThickness();
56101                 _this.wallDistance = doorOrWindow.getWallDistance();
56102                 _this.wallWidth = 1;
56103                 _this.wallLeft = 0;
56104                 _this.wallHeight = 1;
56105                 _this.wallTop = 0;
56106                 _this.wallCutOutOnBothSides = doorOrWindow.isWallCutOutOnBothSides();
56107                 _this.widthDepthDeformable = doorOrWindow.isWidthDepthDeformable();
56108                 _this.sashes = doorOrWindow.getSashes();
56109                 _this.cutOutShape = doorOrWindow.getCutOutShape();
56110             }
56111             if (_this.wallThickness === undefined) {
56112                 _this.wallThickness = 0;
56113             }
56114             if (_this.wallDistance === undefined) {
56115                 _this.wallDistance = 0;
56116             }
56117             if (_this.wallWidth === undefined) {
56118                 _this.wallWidth = 0;
56119             }
56120             if (_this.wallLeft === undefined) {
56121                 _this.wallLeft = 0;
56122             }
56123             if (_this.wallHeight === undefined) {
56124                 _this.wallHeight = 0;
56125             }
56126             if (_this.wallTop === undefined) {
56127                 _this.wallTop = 0;
56128             }
56129             if (_this.wallCutOutOnBothSides === undefined) {
56130                 _this.wallCutOutOnBothSides = false;
56131             }
56132             if (_this.widthDepthDeformable === undefined) {
56133                 _this.widthDepthDeformable = false;
56134             }
56135             if (_this.sashes === undefined) {
56136                 _this.sashes = null;
56137             }
56138             if (_this.cutOutShape === undefined) {
56139                 _this.cutOutShape = null;
56140             }
56141             if (_this.boundToWall === undefined) {
56142                 _this.boundToWall = false;
56143             }
56144         }
56145         else if (((id != null && (id.constructor != null && id.constructor["__interfaces"] != null && id.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.DoorOrWindow") >= 0)) || id === null) && doorOrWindow === undefined && copiedProperties === undefined) {
56146             var __args = arguments;
56147             var doorOrWindow_10 = __args[0];
56148             {
56149                 var __args_139 = arguments;
56150                 var copiedProperties_12 = HomePieceOfFurniture.EMPTY_PROPERTY_ARRAY_$LI$();
56151                 {
56152                     var __args_140 = arguments;
56153                     var id_30 = HomeObject.createId("doorOrWindow");
56154                     _this = _super.call(this, id_30, doorOrWindow_10, copiedProperties_12) || this;
56155                     if (_this.wallThickness === undefined) {
56156                         _this.wallThickness = 0;
56157                     }
56158                     if (_this.wallDistance === undefined) {
56159                         _this.wallDistance = 0;
56160                     }
56161                     if (_this.wallWidth === undefined) {
56162                         _this.wallWidth = 0;
56163                     }
56164                     if (_this.wallLeft === undefined) {
56165                         _this.wallLeft = 0;
56166                     }
56167                     if (_this.wallHeight === undefined) {
56168                         _this.wallHeight = 0;
56169                     }
56170                     if (_this.wallTop === undefined) {
56171                         _this.wallTop = 0;
56172                     }
56173                     if (_this.wallCutOutOnBothSides === undefined) {
56174                         _this.wallCutOutOnBothSides = false;
56175                     }
56176                     if (_this.widthDepthDeformable === undefined) {
56177                         _this.widthDepthDeformable = false;
56178                     }
56179                     if (_this.sashes === undefined) {
56180                         _this.sashes = null;
56181                     }
56182                     if (_this.cutOutShape === undefined) {
56183                         _this.cutOutShape = null;
56184                     }
56185                     if (_this.boundToWall === undefined) {
56186                         _this.boundToWall = false;
56187                     }
56188                     _this.wallThickness = doorOrWindow_10.getWallThickness();
56189                     _this.wallDistance = doorOrWindow_10.getWallDistance();
56190                     _this.wallWidth = 1;
56191                     _this.wallLeft = 0;
56192                     _this.wallHeight = 1;
56193                     _this.wallTop = 0;
56194                     _this.wallCutOutOnBothSides = doorOrWindow_10.isWallCutOutOnBothSides();
56195                     _this.widthDepthDeformable = doorOrWindow_10.isWidthDepthDeformable();
56196                     _this.sashes = doorOrWindow_10.getSashes();
56197                     _this.cutOutShape = doorOrWindow_10.getCutOutShape();
56198                 }
56199                 if (_this.wallThickness === undefined) {
56200                     _this.wallThickness = 0;
56201                 }
56202                 if (_this.wallDistance === undefined) {
56203                     _this.wallDistance = 0;
56204                 }
56205                 if (_this.wallWidth === undefined) {
56206                     _this.wallWidth = 0;
56207                 }
56208                 if (_this.wallLeft === undefined) {
56209                     _this.wallLeft = 0;
56210                 }
56211                 if (_this.wallHeight === undefined) {
56212                     _this.wallHeight = 0;
56213                 }
56214                 if (_this.wallTop === undefined) {
56215                     _this.wallTop = 0;
56216                 }
56217                 if (_this.wallCutOutOnBothSides === undefined) {
56218                     _this.wallCutOutOnBothSides = false;
56219                 }
56220                 if (_this.widthDepthDeformable === undefined) {
56221                     _this.widthDepthDeformable = false;
56222                 }
56223                 if (_this.sashes === undefined) {
56224                     _this.sashes = null;
56225                 }
56226                 if (_this.cutOutShape === undefined) {
56227                     _this.cutOutShape = null;
56228                 }
56229                 if (_this.boundToWall === undefined) {
56230                     _this.boundToWall = false;
56231                 }
56232             }
56233             if (_this.wallThickness === undefined) {
56234                 _this.wallThickness = 0;
56235             }
56236             if (_this.wallDistance === undefined) {
56237                 _this.wallDistance = 0;
56238             }
56239             if (_this.wallWidth === undefined) {
56240                 _this.wallWidth = 0;
56241             }
56242             if (_this.wallLeft === undefined) {
56243                 _this.wallLeft = 0;
56244             }
56245             if (_this.wallHeight === undefined) {
56246                 _this.wallHeight = 0;
56247             }
56248             if (_this.wallTop === undefined) {
56249                 _this.wallTop = 0;
56250             }
56251             if (_this.wallCutOutOnBothSides === undefined) {
56252                 _this.wallCutOutOnBothSides = false;
56253             }
56254             if (_this.widthDepthDeformable === undefined) {
56255                 _this.widthDepthDeformable = false;
56256             }
56257             if (_this.sashes === undefined) {
56258                 _this.sashes = null;
56259             }
56260             if (_this.cutOutShape === undefined) {
56261                 _this.cutOutShape = null;
56262             }
56263             if (_this.boundToWall === undefined) {
56264                 _this.boundToWall = false;
56265             }
56266         }
56267         else
56268             throw new Error('invalid overload');
56269         return _this;
56270     }
56271     /**
56272      * Returns the thickness of the wall in which this door or window should be placed.
56273      * @return {number} a value in percentage of the depth of the door or the window.
56274      */
56275     HomeDoorOrWindow.prototype.getWallThickness = function () {
56276         return this.wallThickness;
56277     };
56278     /**
56279      * Sets the thickness of the wall in which this door or window should be placed.
56280      * Once this piece is updated, listeners added to this piece will receive a change notification.
56281      * @param {number} wallThickness a value in percentage of the depth of the door or the window.
56282      */
56283     HomeDoorOrWindow.prototype.setWallThickness = function (wallThickness) {
56284         if (wallThickness !== this.wallThickness) {
56285             var oldWallThickness = this.wallThickness;
56286             this.wallThickness = wallThickness;
56287             this.firePropertyChange(/* name */ "WALL_THICKNESS", oldWallThickness, wallThickness);
56288         }
56289     };
56290     /**
56291      * Returns the distance between the back side of this door or window and the wall where it's located.
56292      * @return {number} a distance in percentage of the depth of the door or the window.
56293      */
56294     HomeDoorOrWindow.prototype.getWallDistance = function () {
56295         return this.wallDistance;
56296     };
56297     /**
56298      * Sets the distance between the back side of this door or window and the wall where it's located.
56299      * Once this piece is updated, listeners added to this piece will receive a change notification.
56300      * @param {number} wallDistance a distance in percentage of the depth of the door or the window.
56301      */
56302     HomeDoorOrWindow.prototype.setWallDistance = function (wallDistance) {
56303         if (wallDistance !== this.wallDistance) {
56304             var oldWallDistance = this.wallDistance;
56305             this.wallDistance = wallDistance;
56306             this.firePropertyChange(/* name */ "WALL_DISTANCE", oldWallDistance, wallDistance);
56307         }
56308     };
56309     /**
56310      * Returns the width of the wall part in which this door or window should be placed.
56311      * @return {number} a value in percentage of the width of the door or the window.
56312      */
56313     HomeDoorOrWindow.prototype.getWallWidth = function () {
56314         return this.wallWidth;
56315     };
56316     /**
56317      * Sets the width of the wall part in which this door or window should be placed.
56318      * Once this piece is updated, listeners added to this piece will receive a change notification.
56319      * @param {number} wallWidth a value in percentage of the width of the door or the window.
56320      */
56321     HomeDoorOrWindow.prototype.setWallWidth = function (wallWidth) {
56322         if (wallWidth !== this.wallWidth) {
56323             var oldWallWidth = this.wallWidth;
56324             this.wallWidth = wallWidth;
56325             this.firePropertyChange(/* name */ "WALL_WIDTH", oldWallWidth, wallWidth);
56326         }
56327     };
56328     /**
56329      * Returns the distance between the left side of this door or window and the wall part where it should be placed.
56330      * @return {number} a distance in percentage of the width of the door or the window.
56331      */
56332     HomeDoorOrWindow.prototype.getWallLeft = function () {
56333         return this.wallLeft;
56334     };
56335     /**
56336      * Sets the distance between the left side of this door or window and the wall part where it should be placed.
56337      * Once this piece is updated, listeners added to this piece will receive a change notification.
56338      * @param {number} wallLeft a distance in percentage of the width of the door or the window.
56339      */
56340     HomeDoorOrWindow.prototype.setWallLeft = function (wallLeft) {
56341         if (wallLeft !== this.wallLeft) {
56342             var oldWallLeft = this.wallLeft;
56343             this.wallLeft = wallLeft;
56344             this.firePropertyChange(/* name */ "WALL_LEFT", oldWallLeft, wallLeft);
56345         }
56346     };
56347     /**
56348      * Returns the height of the wall part in which this door or window should be placed.
56349      * Once this piece is updated, listeners added to this piece will receive a change notification.
56350      * @return {number} a value in percentage of the height of the door or the window.
56351      */
56352     HomeDoorOrWindow.prototype.getWallHeight = function () {
56353         return this.wallHeight;
56354     };
56355     /**
56356      * Sets the height of the wall part in which this door or window should be placed.
56357      * Once this piece is updated, listeners added to this piece will receive a change notification.
56358      * @param {number} wallHeight a value in percentage of the height of the door or the window.
56359      */
56360     HomeDoorOrWindow.prototype.setWallHeight = function (wallHeight) {
56361         if (wallHeight !== this.wallHeight) {
56362             var oldWallHeight = this.wallHeight;
56363             this.wallHeight = wallHeight;
56364             this.firePropertyChange(/* name */ "WALL_HEIGHT", oldWallHeight, wallHeight);
56365         }
56366     };
56367     /**
56368      * Returns the distance between the left side of this door or window and the wall part where it should be placed.
56369      * @return {number} a distance in percentage of the height of the door or the window.
56370      */
56371     HomeDoorOrWindow.prototype.getWallTop = function () {
56372         return this.wallTop;
56373     };
56374     /**
56375      * Sets the distance between the top side of this door or window and the wall part where it should be placed.
56376      * Once this piece is updated, listeners added to this piece will receive a change notification.
56377      * @param {number} wallTop a distance in percentage of the height of the door or the window.
56378      */
56379     HomeDoorOrWindow.prototype.setWallTop = function (wallTop) {
56380         if (wallTop !== this.wallTop) {
56381             var oldWallTop = this.wallTop;
56382             this.wallTop = wallTop;
56383             this.firePropertyChange(/* name */ "WALL_TOP", oldWallTop, wallTop);
56384         }
56385     };
56386     /**
56387      * Returns a copy of the sashes attached to this door or window.
56388      * If no sash is defined an empty array is returned.
56389      * @return {com.eteks.sweethome3d.model.Sash[]}
56390      */
56391     HomeDoorOrWindow.prototype.getSashes = function () {
56392         if (this.sashes.length === 0) {
56393             return this.sashes;
56394         }
56395         else {
56396             return /* clone */ this.sashes.slice(0);
56397         }
56398     };
56399     /**
56400      * Sets the sashes attached to this door or window. Once this piece is updated,
56401      * listeners added to this piece will receive a change notification.
56402      * @param {com.eteks.sweethome3d.model.Sash[]} sashes sashes of this window.
56403      */
56404     HomeDoorOrWindow.prototype.setSashes = function (sashes) {
56405         if (!(function (a1, a2) { if (a1 == null && a2 == null)
56406             return true; if (a1 == null || a2 == null)
56407             return false; if (a1.length != a2.length)
56408             return false; for (var i = 0; i < a1.length; i++) {
56409             if (a1[i] != a2[i])
56410                 return false;
56411         } return true; })(sashes, this.sashes)) {
56412             var oldSashes = this.sashes.length === 0 ? this.sashes : /* clone */ this.sashes.slice(0);
56413             this.sashes = sashes.length === 0 ? sashes : /* clone */ sashes.slice(0);
56414             this.firePropertyChange(/* name */ "SASHES", oldSashes, sashes);
56415         }
56416     };
56417     /**
56418      * Returns the shape used to cut out walls that intersect this door or window.
56419      * @return {string}
56420      */
56421     HomeDoorOrWindow.prototype.getCutOutShape = function () {
56422         return this.cutOutShape;
56423     };
56424     /**
56425      * Sets the shape used to cut out walls that intersect this door or window.
56426      * Once this piece is updated, listeners added to this piece will receive a change notification.
56427      * @param {string} cutOutShape a SVG path element.
56428      */
56429     HomeDoorOrWindow.prototype.setCutOutShape = function (cutOutShape) {
56430         if (cutOutShape !== this.cutOutShape && (cutOutShape == null || !(cutOutShape === this.cutOutShape))) {
56431             var oldCutOutShape = this.cutOutShape;
56432             this.cutOutShape = cutOutShape;
56433             this.firePropertyChange(/* name */ "CUT_OUT_SHAPE", oldCutOutShape, cutOutShape);
56434         }
56435     };
56436     /**
56437      * Returns <code>true</code> if this door or window should cut out the both sides
56438      * of the walls it intersects, even if its front or back side are within the wall thickness.
56439      * @return {boolean}
56440      */
56441     HomeDoorOrWindow.prototype.isWallCutOutOnBothSides = function () {
56442         return this.wallCutOutOnBothSides;
56443     };
56444     /**
56445      * Sets whether the width and depth of the new door or window may
56446      * be changed independently from each other.
56447      * Once this piece is updated, listeners added to this piece will receive a change notification.
56448      * @param {boolean} wallCutOutOnBothSides
56449      */
56450     HomeDoorOrWindow.prototype.setWallCutOutOnBothSides = function (wallCutOutOnBothSides) {
56451         if (wallCutOutOnBothSides !== this.wallCutOutOnBothSides) {
56452             this.wallCutOutOnBothSides = wallCutOutOnBothSides;
56453             this.firePropertyChange(/* name */ "WALL_CUT_OUT_ON_BOTH_SIDES", !wallCutOutOnBothSides, wallCutOutOnBothSides);
56454         }
56455     };
56456     /**
56457      * Returns <code>false</code> if the width and depth of this door or window may
56458      * not be changed independently from each other. When <code>false</code>, this door or window
56459      * will also make a hole in the wall when it's placed whatever its depth if its
56460      * {@link #isBoundToWall() bouldToWall} flag is <code>true</code>.
56461      * @return {boolean}
56462      */
56463     HomeDoorOrWindow.prototype.isWidthDepthDeformable = function () {
56464         return this.widthDepthDeformable;
56465     };
56466     /**
56467      * Sets whether the width and depth of the new door or window may
56468      * be changed independently from each other.
56469      * Once this piece is updated, listeners added to this piece will receive a change notification.
56470      * @param {boolean} widthDepthDeformable
56471      */
56472     HomeDoorOrWindow.prototype.setWidthDepthDeformable = function (widthDepthDeformable) {
56473         if (widthDepthDeformable !== this.widthDepthDeformable) {
56474             this.widthDepthDeformable = widthDepthDeformable;
56475             this.firePropertyChange(/* name */ "WIDTH_DEPTH_DEFORMABLE", !widthDepthDeformable, widthDepthDeformable);
56476         }
56477     };
56478     /**
56479      * Returns <code>true</code> if the location and the size of this door or window
56480      * were bound to a wall, last time they were updated.
56481      * @return {boolean}
56482      */
56483     HomeDoorOrWindow.prototype.isBoundToWall = function () {
56484         return this.boundToWall;
56485     };
56486     /**
56487      * Sets whether the location and the size of this door or window
56488      * were bound to a wall, last time they were updated.
56489      * Once this piece is updated, listeners added to this piece will receive a change notification.
56490      * @param {boolean} boundToWall
56491      */
56492     HomeDoorOrWindow.prototype.setBoundToWall = function (boundToWall) {
56493         if (boundToWall !== this.boundToWall) {
56494             this.boundToWall = boundToWall;
56495             this.firePropertyChange(/* name */ "BOUND_TO_WALL", !boundToWall, boundToWall);
56496         }
56497     };
56498     /**
56499      * Sets the abscissa of this door or window and
56500      * resets its {@link #isBoundToWall() boundToWall} flag if the abscissa changed.
56501      * @param {number} x
56502      */
56503     HomeDoorOrWindow.prototype.setX = function (x) {
56504         if (this.getX() !== x) {
56505             this.boundToWall = false;
56506         }
56507         _super.prototype.setX.call(this, x);
56508     };
56509     /**
56510      * Sets the ordinate of this door or window and
56511      * resets its {@link #isBoundToWall() boundToWall} flag if the ordinate changed.
56512      * @param {number} y
56513      */
56514     HomeDoorOrWindow.prototype.setY = function (y) {
56515         if (this.getY() !== y) {
56516             this.boundToWall = false;
56517         }
56518         _super.prototype.setY.call(this, y);
56519     };
56520     /**
56521      * Sets the angle of this door or window and
56522      * resets its {@link #isBoundToWall() boundToWall} flag if the angle changed.
56523      * @param {number} angle
56524      */
56525     HomeDoorOrWindow.prototype.setAngle = function (angle) {
56526         if (this.getAngle() !== angle) {
56527             this.boundToWall = false;
56528         }
56529         _super.prototype.setAngle.call(this, angle);
56530     };
56531     /**
56532      * Sets the depth of this door or window and
56533      * resets its {@link #isBoundToWall() boundToWall} flag if the depth changed.
56534      * @param {number} depth
56535      */
56536     HomeDoorOrWindow.prototype.setDepth = function (depth) {
56537         if (this.getDepth() !== depth) {
56538             this.boundToWall = false;
56539         }
56540         _super.prototype.setDepth.call(this, depth);
56541     };
56542     /**
56543      * Returns always <code>true</code>.
56544      * @return {boolean}
56545      */
56546     HomeDoorOrWindow.prototype.isDoorOrWindow = function () {
56547         return true;
56548     };
56549     /**
56550      * Returns a copy of this door or window.
56551      * @return {HomeObject}
56552      */
56553     HomeDoorOrWindow.prototype.duplicate = function () {
56554         var copy = _super.prototype.duplicate.call(this);
56555         copy.boundToWall = false;
56556         return copy;
56557     };
56558     return HomeDoorOrWindow;
56559 }(HomePieceOfFurniture));
56560 HomeDoorOrWindow["__class"] = "com.eteks.sweethome3d.model.HomeDoorOrWindow";
56561 HomeDoorOrWindow["__interfaces"] = ["com.eteks.sweethome3d.model.Selectable", "com.eteks.sweethome3d.model.DoorOrWindow", "com.eteks.sweethome3d.model.PieceOfFurniture", "com.eteks.sweethome3d.model.Elevatable"];
56562 HomeDoorOrWindow['__transients'] = ['shapeCache', 'propertyChangeSupport'];
56563 /**
56564  * Creates a group from the given <code>furniture</code> list.
56565  * The level of each piece of furniture of the group will be reset to <code>null</code> and if they belong to levels
56566  * with different elevations, their elevation will be updated to be relative to the elevation of the lowest level.
56567  * @param {string} id
56568  * @param {HomePieceOfFurniture[]} furniture
56569  * @param {number} angle
56570  * @param {boolean} modelMirrored
56571  * @param {string} name
56572  * @class
56573  * @extends HomePieceOfFurniture
56574  * @author Emmanuel Puybaret
56575  */
56576 var HomeFurnitureGroup = /** @class */ (function (_super) {
56577     __extends(HomeFurnitureGroup, _super);
56578     function HomeFurnitureGroup(id, furniture, angle, modelMirrored, name) {
56579         var _this = this;
56580         if (((typeof id === 'string') || id === null) && ((furniture != null && (furniture instanceof Array)) || furniture === null) && ((typeof angle === 'number') || angle === null) && ((typeof modelMirrored === 'boolean') || modelMirrored === null) && ((typeof name === 'string') || name === null)) {
56581             var __args = arguments;
56582             _this = _super.call(this, id, /* get */ furniture[0]) || this;
56583             if (_this.furniture === undefined) {
56584                 _this.furniture = null;
56585             }
56586             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable === undefined) {
56587                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable = false;
56588             }
56589             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable === undefined) {
56590                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable = false;
56591             }
56592             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable === undefined) {
56593                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable = false;
56594             }
56595             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow === undefined) {
56596                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow = false;
56597             }
56598             if (_this.fixedWidth === undefined) {
56599                 _this.fixedWidth = 0;
56600             }
56601             if (_this.fixedDepth === undefined) {
56602                 _this.fixedDepth = 0;
56603             }
56604             if (_this.fixedHeight === undefined) {
56605                 _this.fixedHeight = 0;
56606             }
56607             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation === undefined) {
56608                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation = 0;
56609             }
56610             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency === undefined) {
56611                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency = null;
56612             }
56613             if (_this.furnitureListener === undefined) {
56614                 _this.furnitureListener = null;
56615             }
56616             _this.furniture = /* unmodifiableList */ furniture.slice(0);
56617             _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable = true;
56618             _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable = true;
56619             _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable = true;
56620             var movable = true;
56621             var visible = false;
56622             for (var index = 0; index < furniture.length; index++) {
56623                 var piece = furniture[index];
56624                 {
56625                     movable = piece.isMovable() && movable;
56626                     visible = piece.isVisible() || visible;
56627                 }
56628             }
56629             _this.setName(name);
56630             _this.setCatalogId(null);
56631             _this.setDescription(null);
56632             _this.setInformation(null);
56633             _this.setCreator(null);
56634             _this.setNameVisible(false);
56635             _this.setNameXOffset(0);
56636             _this.setNameYOffset(0);
56637             _this.setNameAngle(0);
56638             _this.setNameStyle(null);
56639             _super.prototype.setIcon.call(_this, null);
56640             _super.prototype.setPlanIcon.call(_this, null);
56641             _super.prototype.setModel.call(_this, null);
56642             _super.prototype.setMovable.call(_this, movable);
56643             _super.prototype.setAngle.call(_this, angle);
56644             _super.prototype.setModelMirrored.call(_this, modelMirrored);
56645             _this.setVisible(visible);
56646             _this.updateLocationAndSize(furniture, angle, true);
56647             _this.addFurnitureListener();
56648         }
56649         else if (((id != null && (id instanceof Array)) || id === null) && ((typeof furniture === 'number') || furniture === null) && ((typeof angle === 'boolean') || angle === null) && ((typeof modelMirrored === 'string') || modelMirrored === null) && name === undefined) {
56650             var __args = arguments;
56651             var furniture_1 = __args[0];
56652             var angle_5 = __args[1];
56653             var modelMirrored_1 = __args[2];
56654             var name_15 = __args[3];
56655             {
56656                 var __args_141 = arguments;
56657                 var id_31 = HomeObject.createId("furnitureGroup");
56658                 _this = _super.call(this, id_31, /* get */ furniture_1[0]) || this;
56659                 if (_this.furniture === undefined) {
56660                     _this.furniture = null;
56661                 }
56662                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable === undefined) {
56663                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable = false;
56664                 }
56665                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable === undefined) {
56666                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable = false;
56667                 }
56668                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable === undefined) {
56669                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable = false;
56670                 }
56671                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow === undefined) {
56672                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow = false;
56673                 }
56674                 if (_this.fixedWidth === undefined) {
56675                     _this.fixedWidth = 0;
56676                 }
56677                 if (_this.fixedDepth === undefined) {
56678                     _this.fixedDepth = 0;
56679                 }
56680                 if (_this.fixedHeight === undefined) {
56681                     _this.fixedHeight = 0;
56682                 }
56683                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation === undefined) {
56684                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation = 0;
56685                 }
56686                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency === undefined) {
56687                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency = null;
56688                 }
56689                 if (_this.furnitureListener === undefined) {
56690                     _this.furnitureListener = null;
56691                 }
56692                 _this.furniture = /* unmodifiableList */ furniture_1.slice(0);
56693                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable = true;
56694                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable = true;
56695                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable = true;
56696                 var movable = true;
56697                 var visible = false;
56698                 for (var index = 0; index < furniture_1.length; index++) {
56699                     var piece = furniture_1[index];
56700                     {
56701                         movable = piece.isMovable() && movable;
56702                         visible = piece.isVisible() || visible;
56703                     }
56704                 }
56705                 _this.setName(name_15);
56706                 _this.setCatalogId(null);
56707                 _this.setDescription(null);
56708                 _this.setInformation(null);
56709                 _this.setCreator(null);
56710                 _this.setNameVisible(false);
56711                 _this.setNameXOffset(0);
56712                 _this.setNameYOffset(0);
56713                 _this.setNameAngle(0);
56714                 _this.setNameStyle(null);
56715                 _super.prototype.setIcon.call(_this, null);
56716                 _super.prototype.setPlanIcon.call(_this, null);
56717                 _super.prototype.setModel.call(_this, null);
56718                 _super.prototype.setMovable.call(_this, movable);
56719                 _super.prototype.setAngle.call(_this, angle_5);
56720                 _super.prototype.setModelMirrored.call(_this, modelMirrored_1);
56721                 _this.setVisible(visible);
56722                 _this.updateLocationAndSize(furniture_1, angle_5, true);
56723                 _this.addFurnitureListener();
56724             }
56725             if (_this.furniture === undefined) {
56726                 _this.furniture = null;
56727             }
56728             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable === undefined) {
56729                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable = false;
56730             }
56731             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable === undefined) {
56732                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable = false;
56733             }
56734             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable === undefined) {
56735                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable = false;
56736             }
56737             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow === undefined) {
56738                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow = false;
56739             }
56740             if (_this.fixedWidth === undefined) {
56741                 _this.fixedWidth = 0;
56742             }
56743             if (_this.fixedDepth === undefined) {
56744                 _this.fixedDepth = 0;
56745             }
56746             if (_this.fixedHeight === undefined) {
56747                 _this.fixedHeight = 0;
56748             }
56749             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation === undefined) {
56750                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation = 0;
56751             }
56752             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency === undefined) {
56753                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency = null;
56754             }
56755             if (_this.furnitureListener === undefined) {
56756                 _this.furnitureListener = null;
56757             }
56758         }
56759         else if (((id != null && (id instanceof Array)) || id === null) && ((furniture != null && furniture instanceof HomePieceOfFurniture) || furniture === null) && ((typeof angle === 'string') || angle === null) && modelMirrored === undefined && name === undefined) {
56760             var __args = arguments;
56761             var furniture_2 = __args[0];
56762             var leadingPiece = __args[1];
56763             var name_16 = __args[2];
56764             {
56765                 var __args_142 = arguments;
56766                 var angle_6 = leadingPiece.getAngle();
56767                 var modelMirrored_2 = false;
56768                 {
56769                     var __args_143 = arguments;
56770                     var id_32 = HomeObject.createId("furnitureGroup");
56771                     _this = _super.call(this, id_32, /* get */ furniture_2[0]) || this;
56772                     if (_this.furniture === undefined) {
56773                         _this.furniture = null;
56774                     }
56775                     if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable === undefined) {
56776                         _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable = false;
56777                     }
56778                     if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable === undefined) {
56779                         _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable = false;
56780                     }
56781                     if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable === undefined) {
56782                         _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable = false;
56783                     }
56784                     if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow === undefined) {
56785                         _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow = false;
56786                     }
56787                     if (_this.fixedWidth === undefined) {
56788                         _this.fixedWidth = 0;
56789                     }
56790                     if (_this.fixedDepth === undefined) {
56791                         _this.fixedDepth = 0;
56792                     }
56793                     if (_this.fixedHeight === undefined) {
56794                         _this.fixedHeight = 0;
56795                     }
56796                     if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation === undefined) {
56797                         _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation = 0;
56798                     }
56799                     if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency === undefined) {
56800                         _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency = null;
56801                     }
56802                     if (_this.furnitureListener === undefined) {
56803                         _this.furnitureListener = null;
56804                     }
56805                     _this.furniture = /* unmodifiableList */ furniture_2.slice(0);
56806                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable = true;
56807                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable = true;
56808                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable = true;
56809                     var movable = true;
56810                     var visible = false;
56811                     for (var index = 0; index < furniture_2.length; index++) {
56812                         var piece = furniture_2[index];
56813                         {
56814                             movable = piece.isMovable() && movable;
56815                             visible = piece.isVisible() || visible;
56816                         }
56817                     }
56818                     _this.setName(name_16);
56819                     _this.setCatalogId(null);
56820                     _this.setDescription(null);
56821                     _this.setInformation(null);
56822                     _this.setCreator(null);
56823                     _this.setNameVisible(false);
56824                     _this.setNameXOffset(0);
56825                     _this.setNameYOffset(0);
56826                     _this.setNameAngle(0);
56827                     _this.setNameStyle(null);
56828                     _super.prototype.setIcon.call(_this, null);
56829                     _super.prototype.setPlanIcon.call(_this, null);
56830                     _super.prototype.setModel.call(_this, null);
56831                     _super.prototype.setMovable.call(_this, movable);
56832                     _super.prototype.setAngle.call(_this, angle_6);
56833                     _super.prototype.setModelMirrored.call(_this, modelMirrored_2);
56834                     _this.setVisible(visible);
56835                     _this.updateLocationAndSize(furniture_2, angle_6, true);
56836                     _this.addFurnitureListener();
56837                 }
56838                 if (_this.furniture === undefined) {
56839                     _this.furniture = null;
56840                 }
56841                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable === undefined) {
56842                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable = false;
56843                 }
56844                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable === undefined) {
56845                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable = false;
56846                 }
56847                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable === undefined) {
56848                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable = false;
56849                 }
56850                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow === undefined) {
56851                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow = false;
56852                 }
56853                 if (_this.fixedWidth === undefined) {
56854                     _this.fixedWidth = 0;
56855                 }
56856                 if (_this.fixedDepth === undefined) {
56857                     _this.fixedDepth = 0;
56858                 }
56859                 if (_this.fixedHeight === undefined) {
56860                     _this.fixedHeight = 0;
56861                 }
56862                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation === undefined) {
56863                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation = 0;
56864                 }
56865                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency === undefined) {
56866                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency = null;
56867                 }
56868                 if (_this.furnitureListener === undefined) {
56869                     _this.furnitureListener = null;
56870                 }
56871             }
56872             if (_this.furniture === undefined) {
56873                 _this.furniture = null;
56874             }
56875             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable === undefined) {
56876                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable = false;
56877             }
56878             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable === undefined) {
56879                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable = false;
56880             }
56881             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable === undefined) {
56882                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable = false;
56883             }
56884             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow === undefined) {
56885                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow = false;
56886             }
56887             if (_this.fixedWidth === undefined) {
56888                 _this.fixedWidth = 0;
56889             }
56890             if (_this.fixedDepth === undefined) {
56891                 _this.fixedDepth = 0;
56892             }
56893             if (_this.fixedHeight === undefined) {
56894                 _this.fixedHeight = 0;
56895             }
56896             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation === undefined) {
56897                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation = 0;
56898             }
56899             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency === undefined) {
56900                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency = null;
56901             }
56902             if (_this.furnitureListener === undefined) {
56903                 _this.furnitureListener = null;
56904             }
56905         }
56906         else if (((id != null && (id instanceof Array)) || id === null) && ((typeof furniture === 'string') || furniture === null) && angle === undefined && modelMirrored === undefined && name === undefined) {
56907             var __args = arguments;
56908             var furniture_3 = __args[0];
56909             var name_17 = __args[1];
56910             {
56911                 var __args_144 = arguments;
56912                 var leadingPiece = __args_144[0][0];
56913                 {
56914                     var __args_145 = arguments;
56915                     var angle_7 = leadingPiece.getAngle();
56916                     var modelMirrored_3 = false;
56917                     {
56918                         var __args_146 = arguments;
56919                         var id_33 = HomeObject.createId("furnitureGroup");
56920                         _this = _super.call(this, id_33, /* get */ furniture_3[0]) || this;
56921                         if (_this.furniture === undefined) {
56922                             _this.furniture = null;
56923                         }
56924                         if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable === undefined) {
56925                             _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable = false;
56926                         }
56927                         if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable === undefined) {
56928                             _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable = false;
56929                         }
56930                         if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable === undefined) {
56931                             _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable = false;
56932                         }
56933                         if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow === undefined) {
56934                             _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow = false;
56935                         }
56936                         if (_this.fixedWidth === undefined) {
56937                             _this.fixedWidth = 0;
56938                         }
56939                         if (_this.fixedDepth === undefined) {
56940                             _this.fixedDepth = 0;
56941                         }
56942                         if (_this.fixedHeight === undefined) {
56943                             _this.fixedHeight = 0;
56944                         }
56945                         if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation === undefined) {
56946                             _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation = 0;
56947                         }
56948                         if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency === undefined) {
56949                             _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency = null;
56950                         }
56951                         if (_this.furnitureListener === undefined) {
56952                             _this.furnitureListener = null;
56953                         }
56954                         _this.furniture = /* unmodifiableList */ furniture_3.slice(0);
56955                         _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable = true;
56956                         _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable = true;
56957                         _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable = true;
56958                         var movable = true;
56959                         var visible = false;
56960                         for (var index = 0; index < furniture_3.length; index++) {
56961                             var piece = furniture_3[index];
56962                             {
56963                                 movable = piece.isMovable() && movable;
56964                                 visible = piece.isVisible() || visible;
56965                             }
56966                         }
56967                         _this.setName(name_17);
56968                         _this.setCatalogId(null);
56969                         _this.setDescription(null);
56970                         _this.setInformation(null);
56971                         _this.setCreator(null);
56972                         _this.setNameVisible(false);
56973                         _this.setNameXOffset(0);
56974                         _this.setNameYOffset(0);
56975                         _this.setNameAngle(0);
56976                         _this.setNameStyle(null);
56977                         _super.prototype.setIcon.call(_this, null);
56978                         _super.prototype.setPlanIcon.call(_this, null);
56979                         _super.prototype.setModel.call(_this, null);
56980                         _super.prototype.setMovable.call(_this, movable);
56981                         _super.prototype.setAngle.call(_this, angle_7);
56982                         _super.prototype.setModelMirrored.call(_this, modelMirrored_3);
56983                         _this.setVisible(visible);
56984                         _this.updateLocationAndSize(furniture_3, angle_7, true);
56985                         _this.addFurnitureListener();
56986                     }
56987                     if (_this.furniture === undefined) {
56988                         _this.furniture = null;
56989                     }
56990                     if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable === undefined) {
56991                         _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable = false;
56992                     }
56993                     if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable === undefined) {
56994                         _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable = false;
56995                     }
56996                     if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable === undefined) {
56997                         _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable = false;
56998                     }
56999                     if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow === undefined) {
57000                         _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow = false;
57001                     }
57002                     if (_this.fixedWidth === undefined) {
57003                         _this.fixedWidth = 0;
57004                     }
57005                     if (_this.fixedDepth === undefined) {
57006                         _this.fixedDepth = 0;
57007                     }
57008                     if (_this.fixedHeight === undefined) {
57009                         _this.fixedHeight = 0;
57010                     }
57011                     if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation === undefined) {
57012                         _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation = 0;
57013                     }
57014                     if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency === undefined) {
57015                         _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency = null;
57016                     }
57017                     if (_this.furnitureListener === undefined) {
57018                         _this.furnitureListener = null;
57019                     }
57020                 }
57021                 if (_this.furniture === undefined) {
57022                     _this.furniture = null;
57023                 }
57024                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable === undefined) {
57025                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable = false;
57026                 }
57027                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable === undefined) {
57028                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable = false;
57029                 }
57030                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable === undefined) {
57031                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable = false;
57032                 }
57033                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow === undefined) {
57034                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow = false;
57035                 }
57036                 if (_this.fixedWidth === undefined) {
57037                     _this.fixedWidth = 0;
57038                 }
57039                 if (_this.fixedDepth === undefined) {
57040                     _this.fixedDepth = 0;
57041                 }
57042                 if (_this.fixedHeight === undefined) {
57043                     _this.fixedHeight = 0;
57044                 }
57045                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation === undefined) {
57046                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation = 0;
57047                 }
57048                 if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency === undefined) {
57049                     _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency = null;
57050                 }
57051                 if (_this.furnitureListener === undefined) {
57052                     _this.furnitureListener = null;
57053                 }
57054             }
57055             if (_this.furniture === undefined) {
57056                 _this.furniture = null;
57057             }
57058             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable === undefined) {
57059                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable = false;
57060             }
57061             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable === undefined) {
57062                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable = false;
57063             }
57064             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable === undefined) {
57065                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable = false;
57066             }
57067             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow === undefined) {
57068                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow = false;
57069             }
57070             if (_this.fixedWidth === undefined) {
57071                 _this.fixedWidth = 0;
57072             }
57073             if (_this.fixedDepth === undefined) {
57074                 _this.fixedDepth = 0;
57075             }
57076             if (_this.fixedHeight === undefined) {
57077                 _this.fixedHeight = 0;
57078             }
57079             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation === undefined) {
57080                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation = 0;
57081             }
57082             if (_this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency === undefined) {
57083                 _this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency = null;
57084             }
57085             if (_this.furnitureListener === undefined) {
57086                 _this.furnitureListener = null;
57087             }
57088         }
57089         else
57090             throw new Error('invalid overload');
57091         return _this;
57092     }
57093     /**
57094      * Updates the location and size of this group from the furniture it contains.
57095      * @param {HomePieceOfFurniture[]} furniture
57096      * @param {number} angle
57097      * @param {boolean} init
57098      * @private
57099      */
57100     HomeFurnitureGroup.prototype.updateLocationAndSize = function (furniture, angle, init) {
57101         this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable = true;
57102         this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable = true;
57103         this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable = true;
57104         this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow = true;
57105         this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency = /* get */ furniture[0].getCurrency();
57106         for (var index = 0; index < furniture.length; index++) {
57107             var piece = furniture[index];
57108             {
57109                 this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable = piece.isResizable() && this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable;
57110                 this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable = piece.isDeformable() && this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable;
57111                 this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable = piece.isTexturable() && this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable;
57112                 this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow = piece.isDoorOrWindow() && this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow;
57113                 if (this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency != null) {
57114                     if (piece.getCurrency() == null || !(piece.getCurrency() === this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency)) {
57115                         this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency = null;
57116                     }
57117                 }
57118             }
57119         }
57120         var elevation = 3.4028235E38;
57121         if (init) {
57122             var minLevel = null;
57123             for (var index = 0; index < furniture.length; index++) {
57124                 var piece = furniture[index];
57125                 {
57126                     var level = piece.getLevel();
57127                     if (level != null && (minLevel == null || level.getElevation() < minLevel.getElevation())) {
57128                         minLevel = level;
57129                     }
57130                 }
57131             }
57132             for (var index = 0; index < furniture.length; index++) {
57133                 var piece = furniture[index];
57134                 {
57135                     if (piece.getLevel() != null) {
57136                         elevation = Math.min(elevation, piece.getGroundElevation() - minLevel.getElevation());
57137                         piece.setElevation(piece.getGroundElevation() - minLevel.getElevation());
57138                         piece.setLevel(null);
57139                     }
57140                     else {
57141                         elevation = Math.min(elevation, piece.getElevation());
57142                     }
57143                 }
57144             }
57145         }
57146         else {
57147             for (var index = 0; index < furniture.length; index++) {
57148                 var piece = furniture[index];
57149                 {
57150                     elevation = Math.min(elevation, piece.getElevation());
57151                 }
57152             }
57153         }
57154         var height = 0;
57155         var dropOnTopElevation = -1;
57156         for (var index = 0; index < furniture.length; index++) {
57157             var piece = furniture[index];
57158             {
57159                 height = Math.max(height, piece.getElevation() + piece.getHeightInPlan());
57160                 if (piece.getDropOnTopElevation() >= 0) {
57161                     dropOnTopElevation = Math.max(dropOnTopElevation, piece.getElevation() + piece.getHeightInPlan() * piece.getDropOnTopElevation());
57162                 }
57163             }
57164         }
57165         height -= elevation;
57166         dropOnTopElevation -= elevation;
57167         var rotation = java.awt.geom.AffineTransform.getRotateInstance(-angle);
57168         var unrotatedBoundingRectangle = null;
57169         {
57170             var array = this.getFurnitureWithoutGroups(furniture);
57171             for (var index = 0; index < array.length; index++) {
57172                 var piece = array[index];
57173                 {
57174                     var pieceShape = new java.awt.geom.GeneralPath();
57175                     var points = piece.getPoints();
57176                     pieceShape.moveTo(points[0][0], points[0][1]);
57177                     for (var i = 1; i < points.length; i++) {
57178                         {
57179                             pieceShape.lineTo(points[i][0], points[i][1]);
57180                         }
57181                         ;
57182                     }
57183                     pieceShape.closePath();
57184                     if (unrotatedBoundingRectangle == null) {
57185                         unrotatedBoundingRectangle = pieceShape.createTransformedShape(rotation).getBounds2D();
57186                     }
57187                     else {
57188                         unrotatedBoundingRectangle.add(pieceShape.createTransformedShape(rotation).getBounds2D());
57189                     }
57190                 }
57191             }
57192         }
57193         var center = new java.awt.geom.Point2D.Float(unrotatedBoundingRectangle.getCenterX(), unrotatedBoundingRectangle.getCenterY());
57194         rotation.setToRotation(angle);
57195         rotation.transform(center, center);
57196         if (this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable) {
57197             var width = unrotatedBoundingRectangle.getWidth();
57198             _super.prototype.setWidth.call(this, width);
57199             _super.prototype.setWidthInPlan.call(this, width);
57200             var depth = unrotatedBoundingRectangle.getHeight();
57201             _super.prototype.setDepth.call(this, depth);
57202             _super.prototype.setDepthInPlan.call(this, depth);
57203             _super.prototype.setHeight.call(this, height);
57204             _super.prototype.setHeightInPlan.call(this, height);
57205         }
57206         else {
57207             this.fixedWidth = unrotatedBoundingRectangle.getWidth();
57208             this.fixedDepth = unrotatedBoundingRectangle.getHeight();
57209             this.fixedHeight = height;
57210         }
57211         this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation = dropOnTopElevation / height;
57212         _super.prototype.setX.call(this, center.getX());
57213         _super.prototype.setY.call(this, center.getY());
57214         _super.prototype.setElevation.call(this, elevation);
57215     };
57216     /**
57217      * Adds a listener to the furniture of this group that will update the size and location
57218      * of the group when its furniture is moved or resized.
57219      * @private
57220      */
57221     HomeFurnitureGroup.prototype.addFurnitureListener = function () {
57222         this.furnitureListener = new HomeFurnitureGroup.LocationAndSizeChangeListener(this);
57223         for (var index = 0; index < this.furniture.length; index++) {
57224             var piece = this.furniture[index];
57225             {
57226                 piece.addPropertyChangeListener(this.furnitureListener);
57227             }
57228         }
57229     };
57230     /**
57231      * Returns all the pieces of the given <code>furniture</code> list.
57232      * @param {HomePieceOfFurniture[]} furniture
57233      * @return {HomePieceOfFurniture[]}
57234      * @private
57235      */
57236     HomeFurnitureGroup.prototype.getFurnitureWithoutGroups = function (furniture) {
57237         var pieces = ([]);
57238         for (var index = 0; index < furniture.length; index++) {
57239             var piece = furniture[index];
57240             {
57241                 if (piece != null && piece instanceof HomeFurnitureGroup) {
57242                     /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(pieces, this.getFurnitureWithoutGroups(piece.getFurniture()));
57243                 }
57244                 else {
57245                     /* add */ (pieces.push(piece) > 0);
57246                 }
57247             }
57248         }
57249         return pieces;
57250     };
57251     /**
57252      * Returns the furniture of this group and of all its subgroups, including the possible child furniture groups.
57253      * @return {HomePieceOfFurniture[]}
57254      */
57255     HomeFurnitureGroup.prototype.getAllFurniture = function () {
57256         var pieces = (this.furniture.slice(0));
57257         {
57258             var array = this.getFurniture();
57259             for (var index = 0; index < array.length; index++) {
57260                 var piece = array[index];
57261                 {
57262                     if (piece != null && piece instanceof HomeFurnitureGroup) {
57263                         /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(pieces, piece.getAllFurniture());
57264                     }
57265                 }
57266             }
57267         }
57268         return pieces;
57269     };
57270     /**
57271      * Returns a list of the furniture of this group.
57272      * @return {HomePieceOfFurniture[]}
57273      */
57274     HomeFurnitureGroup.prototype.getFurniture = function () {
57275         return /* unmodifiableList */ this.furniture.slice(0);
57276     };
57277     /**
57278      * Adds the <code>piece</code> in parameter at the given <code>index</code>.
57279      * @param {HomePieceOfFurniture} piece
57280      * @param {number} index
57281      * @private
57282      */
57283     HomeFurnitureGroup.prototype.addPieceOfFurniture = function (piece, index) {
57284         this.furniture = (this.furniture.slice(0));
57285         piece.setLevel(this.getLevel());
57286         /* add */ this.furniture.splice(index, 0, piece);
57287         piece.addPropertyChangeListener(this.furnitureListener);
57288         this.updateLocationAndSize(this.furniture, this.getAngle(), false);
57289     };
57290     /**
57291      * Deletes the <code>piece</code> in parameter from this group.
57292      * @throws IllegalStateException if the last piece in this group is the one in parameter
57293      * @param {HomePieceOfFurniture} piece
57294      * @private
57295      */
57296     HomeFurnitureGroup.prototype.deletePieceOfFurniture = function (piece) {
57297         var index = this.furniture.indexOf(piece);
57298         if (index !== -1) {
57299             if ( /* size */this.furniture.length > 1) {
57300                 piece.setLevel(null);
57301                 piece.removePropertyChangeListener(this.furnitureListener);
57302                 this.furniture = (this.furniture.slice(0));
57303                 /* remove */ this.furniture.splice(index, 1)[0];
57304                 this.updateLocationAndSize(this.furniture, this.getAngle(), false);
57305             }
57306             else {
57307                 throw new IllegalStateException("Group can\'t be empty");
57308             }
57309         }
57310     };
57311     /**
57312      * Returns the catalog ID of this group.
57313      * @return {string}
57314      */
57315     HomeFurnitureGroup.prototype.getCatalogId = function () {
57316         return _super.prototype.getCatalogId.call(this);
57317     };
57318     /**
57319      * Returns the information associated with this group.
57320      * @return {string}
57321      */
57322     HomeFurnitureGroup.prototype.getInformation = function () {
57323         return _super.prototype.getInformation.call(this);
57324     };
57325     /**
57326      * Returns <code>true</code> if this group is movable.
57327      * @return {boolean}
57328      */
57329     HomeFurnitureGroup.prototype.isMovable = function () {
57330         return _super.prototype.isMovable.call(this);
57331     };
57332     /**
57333      * Sets whether this group is movable or not.
57334      * @param {boolean} movable
57335      */
57336     HomeFurnitureGroup.prototype.setMovable = function (movable) {
57337         _super.prototype.setMovable.call(this, movable);
57338     };
57339     /**
57340      * Returns <code>true</code> if all furniture of this group are doors or windows.
57341      * @return {boolean}
57342      */
57343     HomeFurnitureGroup.prototype.isDoorOrWindow = function () {
57344         return this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_doorOrWindow;
57345     };
57346     /**
57347      * Returns <code>true</code> if all furniture of this group are resizable.
57348      * @return {boolean}
57349      */
57350     HomeFurnitureGroup.prototype.isResizable = function () {
57351         return this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable;
57352     };
57353     /**
57354      * Returns <code>true</code> if all furniture of this group are deformable.
57355      * @return {boolean}
57356      */
57357     HomeFurnitureGroup.prototype.isDeformable = function () {
57358         return this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_deformable;
57359     };
57360     /**
57361      * Returns <code>true</code> if all furniture of this group are texturable.
57362      * @return {boolean}
57363      */
57364     HomeFurnitureGroup.prototype.isTexturable = function () {
57365         return this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_texturable;
57366     };
57367     /**
57368      * Returns <code>false</code>.
57369      * @return {boolean}
57370      */
57371     HomeFurnitureGroup.prototype.isHorizontallyRotatable = function () {
57372         return false;
57373     };
57374     /**
57375      * Returns the width of this group.
57376      * @return {number}
57377      */
57378     HomeFurnitureGroup.prototype.getWidth = function () {
57379         if (!this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable) {
57380             return this.fixedWidth;
57381         }
57382         else {
57383             return _super.prototype.getWidth.call(this);
57384         }
57385     };
57386     /**
57387      * Returns the width of this group. As a group can't be rotated around an horizontal axis,
57388      * its width in the horizontal plan is equal to its width.
57389      * @return {number}
57390      */
57391     HomeFurnitureGroup.prototype.getWidthInPlan = function () {
57392         return this.getWidth();
57393     };
57394     /**
57395      * Returns the depth of this group.
57396      * @return {number}
57397      */
57398     HomeFurnitureGroup.prototype.getDepth = function () {
57399         if (!this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable) {
57400             return this.fixedDepth;
57401         }
57402         else {
57403             return _super.prototype.getDepth.call(this);
57404         }
57405     };
57406     /**
57407      * Returns the depth of this group. As a group can't be rotated around an horizontal axis,
57408      * its depth in the horizontal plan is equal to its depth.
57409      * @return {number}
57410      */
57411     HomeFurnitureGroup.prototype.getDepthInPlan = function () {
57412         return this.getDepth();
57413     };
57414     /**
57415      * Returns the height of this group.
57416      * @return {number}
57417      */
57418     HomeFurnitureGroup.prototype.getHeight = function () {
57419         if (!this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_resizable) {
57420             return this.fixedHeight;
57421         }
57422         else {
57423             return _super.prototype.getHeight.call(this);
57424         }
57425     };
57426     /**
57427      * Returns the height of this group. As a group can't be rotated around an horizontal axis,
57428      * its height in the horizontal plan is equal to its height.
57429      * @return {number}
57430      */
57431     HomeFurnitureGroup.prototype.getHeightInPlan = function () {
57432         return this.getHeight();
57433     };
57434     /**
57435      * Returns <code>true</code> if this piece or a child of this group is rotated around an horizontal axis.
57436      * @return {boolean}
57437      */
57438     HomeFurnitureGroup.prototype.isHorizontallyRotated = function () {
57439         if (_super.prototype.isHorizontallyRotated.call(this)) {
57440             return true;
57441         }
57442         else {
57443             {
57444                 var array = this.getFurniture();
57445                 for (var index = 0; index < array.length; index++) {
57446                     var childPiece = array[index];
57447                     {
57448                         if (childPiece.isHorizontallyRotated()) {
57449                             return true;
57450                         }
57451                     }
57452                 }
57453             }
57454             return false;
57455         }
57456     };
57457     /**
57458      * Returns the elevation at which should be placed an object dropped on this group.
57459      * @return {number}
57460      */
57461     HomeFurnitureGroup.prototype.getDropOnTopElevation = function () {
57462         return this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_dropOnTopElevation;
57463     };
57464     /**
57465      * Returns <code>null</code>.
57466      * @return {Object}
57467      */
57468     HomeFurnitureGroup.prototype.getIcon = function () {
57469         return null;
57470     };
57471     /**
57472      * @throws IllegalStateException
57473      * @param {Object} icon
57474      */
57475     HomeFurnitureGroup.prototype.setIcon = function (icon) {
57476         throw new IllegalStateException("Can\'t set icon of a group");
57477     };
57478     /**
57479      * Returns <code>null</code>.
57480      * @return {Object}
57481      */
57482     HomeFurnitureGroup.prototype.getPlanIcon = function () {
57483         return null;
57484     };
57485     /**
57486      * @throws IllegalStateException
57487      * @param {Object} planIcon
57488      */
57489     HomeFurnitureGroup.prototype.setPlanIcon = function (planIcon) {
57490         throw new IllegalStateException("Can\'t set plan icon of a group");
57491     };
57492     /**
57493      * Returns <code>null</code>.
57494      * @return {Object}
57495      */
57496     HomeFurnitureGroup.prototype.getModel = function () {
57497         return null;
57498     };
57499     /**
57500      * @throws IllegalStateException
57501      * @param {Object} model
57502      */
57503     HomeFurnitureGroup.prototype.setModel = function (model) {
57504         throw new IllegalStateException("Can\'t set model of a group");
57505     };
57506     /**
57507      * Returns <code>null</code>.
57508      * @return {number}
57509      */
57510     HomeFurnitureGroup.prototype.getModelSize = function () {
57511         return null;
57512     };
57513     /**
57514      * @throws IllegalStateException
57515      * @param {number} modelSize
57516      */
57517     HomeFurnitureGroup.prototype.setModelSize = function (modelSize) {
57518         throw new IllegalStateException("Can\'t set model size of a group");
57519     };
57520     /**
57521      * Returns an identity matrix.
57522      * @return {float[][]}
57523      */
57524     HomeFurnitureGroup.prototype.getModelRotation = function () {
57525         return PieceOfFurniture.IDENTITY_ROTATION_$LI$();
57526     };
57527     /**
57528      * @throws IllegalStateException
57529      * @param {float[][]} modelRotation
57530      */
57531     HomeFurnitureGroup.prototype.setModelRotation = function (modelRotation) {
57532         throw new IllegalStateException("Can\'t set model rotation of a group");
57533     };
57534     /**
57535      * Returns <code>true</code>.
57536      * @return {boolean}
57537      */
57538     HomeFurnitureGroup.prototype.isModelCenteredAtOrigin = function () {
57539         return true;
57540     };
57541     /**
57542      * Returns 0.
57543      * @return {number}
57544      */
57545     HomeFurnitureGroup.prototype.getModelFlags = function () {
57546         return 0;
57547     };
57548     /**
57549      * @throws IllegalStateException
57550      * @param {number} modelFlags
57551      */
57552     HomeFurnitureGroup.prototype.setModelFlags = function (modelFlags) {
57553         throw new IllegalStateException("Can\'t set model flags attribute of a group");
57554     };
57555     /**
57556      * Returns <code>false</code>.
57557      * @return {boolean}
57558      */
57559     HomeFurnitureGroup.prototype.isBackFaceShown = function () {
57560         return false;
57561     };
57562     /**
57563      * @throws IllegalStateException
57564      * @deprecated
57565      * @param {boolean} backFaceShown
57566      */
57567     HomeFurnitureGroup.prototype.setBackFaceShown = function (backFaceShown) {
57568         throw new IllegalStateException("Can\'t set back face shown attribute of a group");
57569     };
57570     /**
57571      * Returns <code>null</code>.
57572      * @return {com.eteks.sweethome3d.model.Transformation[]}
57573      */
57574     HomeFurnitureGroup.prototype.getModelTransformations = function () {
57575         return null;
57576     };
57577     /**
57578      * Sets the transformations of this group.
57579      * @param {com.eteks.sweethome3d.model.Transformation[]} modelTransformations
57580      */
57581     HomeFurnitureGroup.prototype.setModelTransformations = function (modelTransformations) {
57582         if (this.isDeformable()) {
57583             for (var index = 0; index < this.furniture.length; index++) {
57584                 var piece = this.furniture[index];
57585                 {
57586                     piece.setModelTransformations(modelTransformations);
57587                 }
57588             }
57589         }
57590     };
57591     /**
57592      * Returns 0.
57593      * @return {number}
57594      */
57595     HomeFurnitureGroup.prototype.getPitch = function () {
57596         return 0;
57597     };
57598     /**
57599      * Returns 0.
57600      * @return {number}
57601      */
57602     HomeFurnitureGroup.prototype.getRoll = function () {
57603         return 0;
57604     };
57605     /**
57606      * Returns <code>null</code>.
57607      * @return {string}
57608      */
57609     HomeFurnitureGroup.prototype.getStaircaseCutOutShape = function () {
57610         return null;
57611     };
57612     /**
57613      * @throws IllegalStateException
57614      * @param {string} staircaseCutOutShape
57615      */
57616     HomeFurnitureGroup.prototype.setStaircaseCutOutShape = function (staircaseCutOutShape) {
57617         throw new IllegalStateException("Can\'t set staircase cut out shape of a group");
57618     };
57619     /**
57620      * Returns the creator set for this group.
57621      * @return {string}
57622      */
57623     HomeFurnitureGroup.prototype.getCreator = function () {
57624         return _super.prototype.getCreator.call(this);
57625     };
57626     /**
57627      * Returns the price of the furniture of this group with a price.
57628      * @return {Big}
57629      */
57630     HomeFurnitureGroup.prototype.getPrice = function () {
57631         var price = null;
57632         for (var index = 0; index < this.furniture.length; index++) {
57633             var piece = this.furniture[index];
57634             {
57635                 if (piece.getPrice() != null) {
57636                     if (price == null) {
57637                         price = piece.getPrice();
57638                     }
57639                     else {
57640                         price = /* add */ price.plus(piece.getPrice());
57641                     }
57642                 }
57643             }
57644         }
57645         if (price == null) {
57646             return _super.prototype.getPrice.call(this);
57647         }
57648         else {
57649             return price;
57650         }
57651     };
57652     /**
57653      * Sets the price of this group.
57654      * @throws UnsupportedOperationException if the price of one of the pieces is set
57655      * @param {Big} price
57656      */
57657     HomeFurnitureGroup.prototype.setPrice = function (price) {
57658         for (var index = 0; index < this.furniture.length; index++) {
57659             var piece = this.furniture[index];
57660             {
57661                 if (piece.getPrice() != null) {
57662                     throw new UnsupportedOperationException("Can\'t change the price of a group containing pieces with a price");
57663                 }
57664             }
57665         }
57666         _super.prototype.setPrice.call(this, price);
57667     };
57668     /**
57669      * Returns the VAT percentage of the furniture of this group
57670      * or <code>null</code> if one piece has no VAT percentage
57671      * or has a VAT percentage different from the other furniture.
57672      * @return {Big}
57673      */
57674     HomeFurnitureGroup.prototype.getValueAddedTaxPercentage = function () {
57675         var valueAddedTaxPercentage = this.furniture[0].getValueAddedTaxPercentage();
57676         if (valueAddedTaxPercentage != null) {
57677             for (var index = 0; index < this.furniture.length; index++) {
57678                 var piece = this.furniture[index];
57679                 {
57680                     var pieceValueAddedTaxPercentage = piece.getValueAddedTaxPercentage();
57681                     if (pieceValueAddedTaxPercentage == null || !((valueAddedTaxPercentage) != null ? pieceValueAddedTaxPercentage.eq(valueAddedTaxPercentage) : (pieceValueAddedTaxPercentage === (valueAddedTaxPercentage)))) {
57682                         return null;
57683                     }
57684                 }
57685             }
57686         }
57687         return valueAddedTaxPercentage;
57688     };
57689     /**
57690      * Returns the currency of the furniture of this group
57691      * or <code>null</code> if one piece has no currency
57692      * or has a currency different from the other furniture.
57693      * @return {string}
57694      */
57695     HomeFurnitureGroup.prototype.getCurrency = function () {
57696         return this.__com_eteks_sweethome3d_model_HomeFurnitureGroup_currency;
57697     };
57698     /**
57699      * Returns the VAT of the furniture of this group.
57700      * @return {Big}
57701      */
57702     HomeFurnitureGroup.prototype.getValueAddedTax = function () {
57703         var valueAddedTax = null;
57704         for (var index = 0; index < this.furniture.length; index++) {
57705             var piece = this.furniture[index];
57706             {
57707                 var pieceValueAddedTax = piece.getValueAddedTax();
57708                 if (pieceValueAddedTax != null) {
57709                     if (valueAddedTax == null) {
57710                         valueAddedTax = pieceValueAddedTax;
57711                     }
57712                     else {
57713                         valueAddedTax = /* add */ valueAddedTax.plus(pieceValueAddedTax);
57714                     }
57715                 }
57716             }
57717         }
57718         return valueAddedTax;
57719     };
57720     /**
57721      * Returns the total price of the furniture of this group.
57722      * @return {Big}
57723      */
57724     HomeFurnitureGroup.prototype.getPriceValueAddedTaxIncluded = function () {
57725         var priceValueAddedTaxIncluded = null;
57726         for (var index = 0; index < this.furniture.length; index++) {
57727             var piece = this.furniture[index];
57728             {
57729                 if (piece.getPrice() != null) {
57730                     if (priceValueAddedTaxIncluded == null) {
57731                         priceValueAddedTaxIncluded = piece.getPriceValueAddedTaxIncluded();
57732                     }
57733                     else {
57734                         priceValueAddedTaxIncluded = /* add */ priceValueAddedTaxIncluded.plus(piece.getPriceValueAddedTaxIncluded());
57735                     }
57736                 }
57737             }
57738         }
57739         return priceValueAddedTaxIncluded;
57740     };
57741     /**
57742      * Returns <code>null</code>.
57743      * @return {number}
57744      */
57745     HomeFurnitureGroup.prototype.getColor = function () {
57746         return null;
57747     };
57748     /**
57749      * Sets the <code>color</code> of the furniture of this group.
57750      * @param {number} color
57751      */
57752     HomeFurnitureGroup.prototype.setColor = function (color) {
57753         if (this.isTexturable()) {
57754             for (var index = 0; index < this.furniture.length; index++) {
57755                 var piece = this.furniture[index];
57756                 {
57757                     piece.setColor(color);
57758                 }
57759             }
57760         }
57761     };
57762     /**
57763      * Returns <code>null</code>.
57764      * @return {HomeTexture}
57765      */
57766     HomeFurnitureGroup.prototype.getTexture = function () {
57767         return null;
57768     };
57769     /**
57770      * Sets the <code>texture</code> of the furniture of this group.
57771      * @param {HomeTexture} texture
57772      */
57773     HomeFurnitureGroup.prototype.setTexture = function (texture) {
57774         if (this.isTexturable()) {
57775             for (var index = 0; index < this.furniture.length; index++) {
57776                 var piece = this.furniture[index];
57777                 {
57778                     piece.setTexture(texture);
57779                 }
57780             }
57781         }
57782     };
57783     /**
57784      * Returns <code>null</code>.
57785      * @return {com.eteks.sweethome3d.model.HomeMaterial[]}
57786      */
57787     HomeFurnitureGroup.prototype.getModelMaterials = function () {
57788         return null;
57789     };
57790     /**
57791      * Sets the materials of the furniture of this group.
57792      * @param {com.eteks.sweethome3d.model.HomeMaterial[]} modelMaterials
57793      */
57794     HomeFurnitureGroup.prototype.setModelMaterials = function (modelMaterials) {
57795         if (this.isTexturable()) {
57796             for (var index = 0; index < this.furniture.length; index++) {
57797                 var piece = this.furniture[index];
57798                 {
57799                     piece.setModelMaterials(modelMaterials);
57800                 }
57801             }
57802         }
57803     };
57804     /**
57805      * Returns <code>null</code>.
57806      * @return {number}
57807      */
57808     HomeFurnitureGroup.prototype.getShininess = function () {
57809         return null;
57810     };
57811     /**
57812      * Sets the shininess of the furniture of this group.
57813      * @param {number} shininess
57814      */
57815     HomeFurnitureGroup.prototype.setShininess = function (shininess) {
57816         if (this.isTexturable()) {
57817             for (var index = 0; index < this.furniture.length; index++) {
57818                 var piece = this.furniture[index];
57819                 {
57820                     piece.setShininess(shininess);
57821                 }
57822             }
57823         }
57824     };
57825     /**
57826      * Sets the <code>angle</code> of the furniture of this group.
57827      * @param {number} angle
57828      */
57829     HomeFurnitureGroup.prototype.setAngle = function (angle) {
57830         if (angle !== this.getAngle()) {
57831             var angleDelta = angle - this.getAngle();
57832             var cosAngleDelta = Math.cos(angleDelta);
57833             var sinAngleDelta = Math.sin(angleDelta);
57834             for (var index = 0; index < this.furniture.length; index++) {
57835                 var piece = this.furniture[index];
57836                 {
57837                     piece.removePropertyChangeListener(this.furnitureListener);
57838                     piece.setAngle(piece.getAngle() + angleDelta);
57839                     var newX = this.getX() + ((piece.getX() - this.getX()) * cosAngleDelta - (piece.getY() - this.getY()) * sinAngleDelta);
57840                     var newY = this.getY() + ((piece.getX() - this.getX()) * sinAngleDelta + (piece.getY() - this.getY()) * cosAngleDelta);
57841                     piece.setX(newX);
57842                     piece.setY(newY);
57843                     piece.addPropertyChangeListener(this.furnitureListener);
57844                 }
57845             }
57846             _super.prototype.setAngle.call(this, angle);
57847         }
57848     };
57849     /**
57850      * Sets the <code>abscissa</code> of this group and moves its furniture accordingly.
57851      * @param {number} x
57852      */
57853     HomeFurnitureGroup.prototype.setX = function (x) {
57854         if (x !== this.getX()) {
57855             var dx = x - this.getX();
57856             for (var index = 0; index < this.furniture.length; index++) {
57857                 var piece = this.furniture[index];
57858                 {
57859                     piece.removePropertyChangeListener(this.furnitureListener);
57860                     piece.setX(piece.getX() + dx);
57861                     piece.addPropertyChangeListener(this.furnitureListener);
57862                 }
57863             }
57864             _super.prototype.setX.call(this, x);
57865         }
57866     };
57867     /**
57868      * Sets the <code>ordinate</code> of this group and moves its furniture accordingly.
57869      * @param {number} y
57870      */
57871     HomeFurnitureGroup.prototype.setY = function (y) {
57872         if (y !== this.getY()) {
57873             var dy = y - this.getY();
57874             for (var index = 0; index < this.furniture.length; index++) {
57875                 var piece = this.furniture[index];
57876                 {
57877                     piece.removePropertyChangeListener(this.furnitureListener);
57878                     piece.setY(piece.getY() + dy);
57879                     piece.addPropertyChangeListener(this.furnitureListener);
57880                 }
57881             }
57882             _super.prototype.setY.call(this, y);
57883         }
57884     };
57885     /**
57886      * Sets the <code>width</code> of this group, then moves and resizes its furniture accordingly.
57887      * This method shouldn't be called on a group that contain furniture rotated around an horizontal axis.
57888      * @param {number} width
57889      */
57890     HomeFurnitureGroup.prototype.setWidth = function (width) {
57891         if (width !== this.getWidth()) {
57892             var widthFactor = width / this.getWidth();
57893             var angle = this.getAngle();
57894             for (var index = 0; index < this.furniture.length; index++) {
57895                 var piece = this.furniture[index];
57896                 {
57897                     piece.removePropertyChangeListener(this.furnitureListener);
57898                     var angleDelta = piece.getAngle() - angle;
57899                     var pieceWidth = piece.getWidth();
57900                     var pieceDepth = piece.getDepth();
57901                     piece.setWidth(pieceWidth + pieceWidth * (widthFactor - 1) * Math.abs(Math.cos(angleDelta)));
57902                     piece.setDepth(pieceDepth + pieceDepth * (widthFactor - 1) * Math.abs(Math.sin(angleDelta)));
57903                     var cosAngle = Math.cos(angle);
57904                     var sinAngle = Math.sin(angle);
57905                     var newX = this.getX() + ((piece.getX() - this.getX()) * cosAngle + (piece.getY() - this.getY()) * sinAngle);
57906                     var newY = this.getY() + ((piece.getX() - this.getX()) * -sinAngle + (piece.getY() - this.getY()) * cosAngle);
57907                     newX = this.getX() + (newX - this.getX()) * widthFactor;
57908                     piece.setX(this.getX() + ((newX - this.getX()) * cosAngle - (newY - this.getY()) * sinAngle));
57909                     piece.setY(this.getY() + ((newX - this.getX()) * sinAngle + (newY - this.getY()) * cosAngle));
57910                     piece.addPropertyChangeListener(this.furnitureListener);
57911                 }
57912             }
57913             _super.prototype.setWidth.call(this, width);
57914         }
57915     };
57916     /**
57917      * Sets the <code>depth</code> of this group, then moves and resizes its furniture accordingly.
57918      * This method shouldn't be called on a group that contain furniture rotated around an horizontal axis.
57919      * @param {number} depth
57920      */
57921     HomeFurnitureGroup.prototype.setDepth = function (depth) {
57922         if (depth !== this.getDepth()) {
57923             var depthFactor = depth / this.getDepth();
57924             var angle = this.getAngle();
57925             for (var index = 0; index < this.furniture.length; index++) {
57926                 var piece = this.furniture[index];
57927                 {
57928                     piece.removePropertyChangeListener(this.furnitureListener);
57929                     var angleDelta = piece.getAngle() - angle;
57930                     var pieceWidth = piece.getWidth();
57931                     var pieceDepth = piece.getDepth();
57932                     piece.setWidth(pieceWidth + pieceWidth * (depthFactor - 1) * Math.abs(Math.sin(angleDelta)));
57933                     piece.setDepth(pieceDepth + pieceDepth * (depthFactor - 1) * Math.abs(Math.cos(angleDelta)));
57934                     var cosAngle = Math.cos(angle);
57935                     var sinAngle = Math.sin(angle);
57936                     var newX = this.getX() + ((piece.getX() - this.getX()) * cosAngle + (piece.getY() - this.getY()) * sinAngle);
57937                     var newY = this.getY() + ((piece.getX() - this.getX()) * -sinAngle + (piece.getY() - this.getY()) * cosAngle);
57938                     newY = this.getY() + (newY - this.getY()) * depthFactor;
57939                     piece.setX(this.getX() + ((newX - this.getX()) * cosAngle - (newY - this.getY()) * sinAngle));
57940                     piece.setY(this.getY() + ((newX - this.getX()) * sinAngle + (newY - this.getY()) * cosAngle));
57941                     piece.addPropertyChangeListener(this.furnitureListener);
57942                 }
57943             }
57944             _super.prototype.setDepth.call(this, depth);
57945         }
57946     };
57947     /**
57948      * Sets the <code>height</code> of this group, then moves and resizes its furniture accordingly.
57949      * This method shouldn't be called on a group that contain furniture rotated around an horizontal axis.
57950      * @param {number} height
57951      */
57952     HomeFurnitureGroup.prototype.setHeight = function (height) {
57953         if (height !== this.getHeight()) {
57954             var heightFactor = height / this.getHeight();
57955             for (var index = 0; index < this.furniture.length; index++) {
57956                 var piece = this.furniture[index];
57957                 {
57958                     piece.removePropertyChangeListener(this.furnitureListener);
57959                     piece.setHeight(piece.getHeight() * heightFactor);
57960                     piece.setElevation(this.getElevation() + (piece.getElevation() - this.getElevation()) * heightFactor);
57961                     piece.addPropertyChangeListener(this.furnitureListener);
57962                 }
57963             }
57964             _super.prototype.setHeight.call(this, height);
57965         }
57966     };
57967     /**
57968      * Scales this group and its children with the given <code>ratio</code>.
57969      * @param {number} scale
57970      */
57971     HomeFurnitureGroup.prototype.scale = function (scale) {
57972         var angle = this.getAngle();
57973         for (var index = 0; index < this.furniture.length; index++) {
57974             var piece = this.furniture[index];
57975             {
57976                 piece.removePropertyChangeListener(this.furnitureListener);
57977                 piece.setWidth(piece.getWidth() * scale);
57978                 piece.setDepth(piece.getDepth() * scale);
57979                 piece.setHeight(piece.getHeight() * scale);
57980                 var cosAngle = Math.cos(angle);
57981                 var sinAngle = Math.sin(angle);
57982                 var newX = this.getX() + ((piece.getX() - this.getX()) * cosAngle + (piece.getY() - this.getY()) * sinAngle);
57983                 var newY = this.getY() + ((piece.getX() - this.getX()) * -sinAngle + (piece.getY() - this.getY()) * cosAngle);
57984                 newX = this.getX() + (newX - this.getX()) * scale;
57985                 newY = this.getY() + (newY - this.getY()) * scale;
57986                 piece.setX(this.getX() + ((newX - this.getX()) * cosAngle - (newY - this.getY()) * sinAngle));
57987                 piece.setY(this.getY() + ((newX - this.getX()) * sinAngle + (newY - this.getY()) * cosAngle));
57988                 piece.setElevation(this.getElevation() + (piece.getElevation() - this.getElevation()) * scale);
57989                 piece.addPropertyChangeListener(this.furnitureListener);
57990             }
57991         }
57992         _super.prototype.setWidth.call(this, this.getWidth() * scale);
57993         _super.prototype.setDepth.call(this, this.getDepth() * scale);
57994         _super.prototype.setHeight.call(this, this.getHeight() * scale);
57995     };
57996     /**
57997      * Sets the <code>elevation</code> of this group, then moves its furniture accordingly.
57998      * @param {number} elevation
57999      */
58000     HomeFurnitureGroup.prototype.setElevation = function (elevation) {
58001         if (elevation !== this.getElevation()) {
58002             var elevationDelta = elevation - this.getElevation();
58003             for (var index = 0; index < this.furniture.length; index++) {
58004                 var piece = this.furniture[index];
58005                 {
58006                     piece.removePropertyChangeListener(this.furnitureListener);
58007                     piece.setElevation(piece.getElevation() + elevationDelta);
58008                     piece.addPropertyChangeListener(this.furnitureListener);
58009                 }
58010             }
58011             _super.prototype.setElevation.call(this, elevation);
58012         }
58013     };
58014     /**
58015      * Sets whether the furniture of this group should be mirrored or not.
58016      * @param {boolean} modelMirrored
58017      */
58018     HomeFurnitureGroup.prototype.setModelMirrored = function (modelMirrored) {
58019         if (modelMirrored !== this.isModelMirrored()) {
58020             var angle = this.getAngle();
58021             for (var index = 0; index < this.furniture.length; index++) {
58022                 var piece = this.furniture[index];
58023                 {
58024                     piece.removePropertyChangeListener(this.furnitureListener);
58025                     piece.setModelMirrored(!piece.isModelMirrored());
58026                     piece.setAngle(2 * angle - piece.getAngle());
58027                     var cosAngle = Math.cos(angle);
58028                     var sinAngle = Math.sin(angle);
58029                     var newX = this.getX() + ((piece.getX() - this.getX()) * cosAngle + (piece.getY() - this.getY()) * sinAngle);
58030                     var newY = this.getY() + ((piece.getX() - this.getX()) * -sinAngle + (piece.getY() - this.getY()) * cosAngle);
58031                     newX = this.getX() - (newX - this.getX());
58032                     piece.setX(this.getX() + ((newX - this.getX()) * cosAngle - (newY - this.getY()) * sinAngle));
58033                     piece.setY(this.getY() + ((newX - this.getX()) * sinAngle + (newY - this.getY()) * cosAngle));
58034                     piece.addPropertyChangeListener(this.furnitureListener);
58035                 }
58036             }
58037             _super.prototype.setModelMirrored.call(this, modelMirrored);
58038         }
58039     };
58040     /**
58041      * Sets whether the furniture of this group should be visible or not.
58042      * @param {boolean} visible
58043      */
58044     HomeFurnitureGroup.prototype.setVisible = function (visible) {
58045         for (var index = 0; index < this.furniture.length; index++) {
58046             var piece = this.furniture[index];
58047             {
58048                 piece.setVisible(visible);
58049             }
58050         }
58051         _super.prototype.setVisible.call(this, visible);
58052     };
58053     /**
58054      * Set the level of this group and the furniture it contains.
58055      * @param {Level} level
58056      */
58057     HomeFurnitureGroup.prototype.setLevel = function (level) {
58058         for (var index = 0; index < this.furniture.length; index++) {
58059             var piece = this.furniture[index];
58060             {
58061                 piece.setLevel(level);
58062             }
58063         }
58064         _super.prototype.setLevel.call(this, level);
58065     };
58066     /**
58067      * Returns <code>true</code> if one of the pieces of this group intersects
58068      * with the horizontal rectangle which opposite corners are at points
58069      * (<code>x0</code>, <code>y0</code>) and (<code>x1</code>, <code>y1</code>).
58070      * @param {number} x0
58071      * @param {number} y0
58072      * @param {number} x1
58073      * @param {number} y1
58074      * @return {boolean}
58075      */
58076     HomeFurnitureGroup.prototype.intersectsRectangle = function (x0, y0, x1, y1) {
58077         for (var index = 0; index < this.furniture.length; index++) {
58078             var piece = this.furniture[index];
58079             {
58080                 if (piece.intersectsRectangle(x0, y0, x1, y1)) {
58081                     return true;
58082                 }
58083             }
58084         }
58085         return false;
58086     };
58087     /**
58088      * Returns <code>true</code> if one of the pieces of this group contains
58089      * the point at (<code>x</code>, <code>y</code>)
58090      * with a given <code>margin</code>.
58091      * @param {number} x
58092      * @param {number} y
58093      * @param {number} margin
58094      * @return {boolean}
58095      */
58096     HomeFurnitureGroup.prototype.containsPoint = function (x, y, margin) {
58097         for (var index = 0; index < this.furniture.length; index++) {
58098             var piece = this.furniture[index];
58099             {
58100                 if (piece.containsPoint(x, y, margin)) {
58101                     return true;
58102                 }
58103             }
58104         }
58105         return false;
58106     };
58107     /**
58108      * Returns a copy of this object and its children with new ids.
58109      * @return {HomeObject}
58110      */
58111     HomeFurnitureGroup.prototype.duplicate = function () {
58112         var copy = _super.prototype.duplicate.call(this);
58113         var duplicatedFurniture = ([]);
58114         for (var index = 0; index < copy.furniture.length; index++) {
58115             var piece = copy.furniture[index];
58116             {
58117                 piece.removePropertyChangeListener(copy.furnitureListener);
58118                 var duplicatedPiece = piece.duplicate();
58119                 /* add */ (duplicatedFurniture.push(duplicatedPiece) > 0);
58120                 duplicatedPiece.addPropertyChangeListener(copy.furnitureListener);
58121             }
58122         }
58123         copy.furniture = /* unmodifiableList */ duplicatedFurniture.slice(0);
58124         return copy;
58125     };
58126     /**
58127      * Returns a clone of this group with cloned furniture.
58128      * @return {HomeFurnitureGroup}
58129      */
58130     HomeFurnitureGroup.prototype.clone = function () {
58131         var _this = this;
58132         var clone = (function (o) { if (_super.prototype.clone != undefined) {
58133             return _super.prototype.clone.call(_this);
58134         }
58135         else {
58136             var clone_9 = Object.create(o);
58137             for (var p in o) {
58138                 if (o.hasOwnProperty(p))
58139                     clone_9[p] = o[p];
58140             }
58141             return clone_9;
58142         } })(this);
58143         clone.furniture = ([]);
58144         for (var index = 0; index < this.furniture.length; index++) {
58145             var piece = this.furniture[index];
58146             {
58147                 /* add */ (clone.furniture.push(/* clone */ /* clone */ (function (o) { if (o.clone != undefined) {
58148                     return o.clone();
58149                 }
58150                 else {
58151                     var clone_10 = Object.create(o);
58152                     for (var p in o) {
58153                         if (o.hasOwnProperty(p))
58154                             clone_10[p] = o[p];
58155                     }
58156                     return clone_10;
58157                 } })(piece)) > 0);
58158             }
58159         }
58160         clone.furniture = /* unmodifiableList */ clone.furniture.slice(0);
58161         clone.addFurnitureListener();
58162         return clone;
58163     };
58164     return HomeFurnitureGroup;
58165 }(HomePieceOfFurniture));
58166 HomeFurnitureGroup["__class"] = "com.eteks.sweethome3d.model.HomeFurnitureGroup";
58167 HomeFurnitureGroup["__interfaces"] = ["com.eteks.sweethome3d.model.Selectable", "com.eteks.sweethome3d.model.PieceOfFurniture", "com.eteks.sweethome3d.model.Elevatable"];
58168 (function (HomeFurnitureGroup) {
58169     /**
58170      * Properties listener that updates the size and location of this group.
58171      * This listener is bound to this group with a weak reference to avoid a strong link
58172      * of this group towards the furniture it contains.
58173      * @param {HomeFurnitureGroup} group
58174      * @class
58175      */
58176     var LocationAndSizeChangeListener = /** @class */ (function () {
58177         function LocationAndSizeChangeListener(group) {
58178             if (this.group === undefined) {
58179                 this.group = null;
58180             }
58181             this.group = (group);
58182         }
58183         LocationAndSizeChangeListener.prototype.propertyChange = function (ev) {
58184             var group = this.group;
58185             if (group == null) {
58186                 ev.getSource().removePropertyChangeListener(this);
58187             }
58188             else if (( /* name */"X" === ev.getPropertyName()) || ( /* name */"Y" === ev.getPropertyName()) || ( /* name */"ELEVATION" === ev.getPropertyName()) || ( /* name */"ANGLE" === ev.getPropertyName()) || ( /* name */"WIDTH_IN_PLAN" === ev.getPropertyName()) || ( /* name */"DEPTH_IN_PLAN" === ev.getPropertyName()) || ( /* name */"HEIGHT_IN_PLAN" === ev.getPropertyName())) {
58189                 group.updateLocationAndSize(group.getFurniture(), group.getAngle(), false);
58190             }
58191         };
58192         return LocationAndSizeChangeListener;
58193     }());
58194     HomeFurnitureGroup.LocationAndSizeChangeListener = LocationAndSizeChangeListener;
58195     LocationAndSizeChangeListener["__class"] = "com.eteks.sweethome3d.model.HomeFurnitureGroup.LocationAndSizeChangeListener";
58196 })(HomeFurnitureGroup || (HomeFurnitureGroup = {}));
58197 HomeFurnitureGroup['__transients'] = ['furnitureListener', 'shapeCache', 'propertyChangeSupport'];
58198 /**
58199  * Creates a camera at given location and angle.
58200  * @param {string} id
58201  * @param {number} x
58202  * @param {number} y
58203  * @param {number} z
58204  * @param {number} yaw
58205  * @param {number} pitch
58206  * @param {number} fieldOfView
58207  * @class
58208  * @extends Camera
58209  * @author Emmanuel Puybaret
58210  */
58211 var ObserverCamera = /** @class */ (function (_super) {
58212     __extends(ObserverCamera, _super);
58213     function ObserverCamera(id, x, y, z, yaw, pitch, fieldOfView) {
58214         var _this = this;
58215         if (((typeof id === 'string') || id === null) && ((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof z === 'number') || z === null) && ((typeof yaw === 'number') || yaw === null) && ((typeof pitch === 'number') || pitch === null) && ((typeof fieldOfView === 'number') || fieldOfView === null)) {
58216             var __args = arguments;
58217             _this = _super.call(this, id, x, y, z, yaw, pitch, fieldOfView) || this;
58218             if (_this.fixedSize === undefined) {
58219                 _this.fixedSize = false;
58220             }
58221             if (_this.shapeCache === undefined) {
58222                 _this.shapeCache = null;
58223             }
58224             if (_this.rectangleShapeCache === undefined) {
58225                 _this.rectangleShapeCache = null;
58226             }
58227             _this.planScale = 1;
58228         }
58229         else if (((typeof id === 'number') || id === null) && ((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof z === 'number') || z === null) && ((typeof yaw === 'number') || yaw === null) && ((typeof pitch === 'number') || pitch === null) && fieldOfView === undefined) {
58230             var __args = arguments;
58231             var x_5 = __args[0];
58232             var y_5 = __args[1];
58233             var z_3 = __args[2];
58234             var yaw_3 = __args[3];
58235             var pitch_3 = __args[4];
58236             var fieldOfView_3 = __args[5];
58237             {
58238                 var __args_147 = arguments;
58239                 var id_34 = HomeObject.createId("observerCamera");
58240                 _this = _super.call(this, id_34, x_5, y_5, z_3, yaw_3, pitch_3, fieldOfView_3) || this;
58241                 if (_this.fixedSize === undefined) {
58242                     _this.fixedSize = false;
58243                 }
58244                 if (_this.shapeCache === undefined) {
58245                     _this.shapeCache = null;
58246                 }
58247                 if (_this.rectangleShapeCache === undefined) {
58248                     _this.rectangleShapeCache = null;
58249                 }
58250                 _this.planScale = 1;
58251             }
58252             if (_this.fixedSize === undefined) {
58253                 _this.fixedSize = false;
58254             }
58255             if (_this.shapeCache === undefined) {
58256                 _this.shapeCache = null;
58257             }
58258             if (_this.rectangleShapeCache === undefined) {
58259                 _this.rectangleShapeCache = null;
58260             }
58261             _this.planScale = 1;
58262         }
58263         else
58264             throw new Error('invalid overload');
58265         return _this;
58266     }
58267     /**
58268      * Sets whether camera size should depends on its elevation and will notify listeners
58269      * bound to size properties of the size change.
58270      * @param {boolean} fixedSize
58271      */
58272     ObserverCamera.prototype.setFixedSize = function (fixedSize) {
58273         if (this.fixedSize !== fixedSize) {
58274             var oldWidth = this.getWidth();
58275             var oldDepth = this.getDepth();
58276             var oldHeight = this.getHeight();
58277             this.fixedSize = fixedSize;
58278             this.shapeCache = null;
58279             this.rectangleShapeCache = null;
58280             this.firePropertyChange(/* name */ "WIDTH", oldWidth, this.getWidth());
58281             this.firePropertyChange(/* name */ "DEPTH", oldDepth, this.getDepth());
58282             this.firePropertyChange(/* name */ "HEIGHT", oldHeight, this.getHeight());
58283         }
58284     };
58285     /**
58286      * Returns <code>true</code> if the camera size doesn't change according to its elevation.
58287      * @return {boolean}
58288      */
58289     ObserverCamera.prototype.isFixedSize = function () {
58290         return this.fixedSize;
58291     };
58292     /**
58293      * Sets the scale used to paint this camera and will notify listeners
58294      * bound to size properties of the size change.
58295      * @param {number} scale
58296      */
58297     ObserverCamera.prototype.setPlanScale = function (scale) {
58298         if (this.planScale !== scale) {
58299             var oldWidth = this.getWidth();
58300             var oldDepth = this.getDepth();
58301             var oldHeight = this.getHeight();
58302             this.planScale = scale;
58303             this.shapeCache = null;
58304             this.rectangleShapeCache = null;
58305             this.firePropertyChange(/* name */ "WIDTH", oldWidth, this.getWidth());
58306             this.firePropertyChange(/* name */ "DEPTH", oldDepth, this.getDepth());
58307             this.firePropertyChange(/* name */ "HEIGHT", oldHeight, this.getHeight());
58308         }
58309     };
58310     /**
58311      * Returns the scale used to paint this camera in the plan.
58312      * @return {number}
58313      */
58314     ObserverCamera.prototype.getPlanScale = function () {
58315         return this.planScale;
58316     };
58317     /**
58318      * Sets the yaw angle in radians of this camera.
58319      * @param {number} yaw
58320      */
58321     ObserverCamera.prototype.setYaw = function (yaw) {
58322         _super.prototype.setYaw.call(this, yaw);
58323         this.shapeCache = null;
58324         this.rectangleShapeCache = null;
58325     };
58326     /**
58327      * Sets the abscissa of this camera.
58328      * @param {number} x
58329      */
58330     ObserverCamera.prototype.setX = function (x) {
58331         _super.prototype.setX.call(this, x);
58332         this.shapeCache = null;
58333         this.rectangleShapeCache = null;
58334     };
58335     /**
58336      * Sets the ordinate of this camera.
58337      * @param {number} y
58338      */
58339     ObserverCamera.prototype.setY = function (y) {
58340         _super.prototype.setY.call(this, y);
58341         this.shapeCache = null;
58342         this.rectangleShapeCache = null;
58343     };
58344     /**
58345      * Sets the elevation of this camera.
58346      * @param {number} z
58347      */
58348     ObserverCamera.prototype.setZ = function (z) {
58349         var oldWidth = this.getWidth();
58350         var oldDepth = this.getDepth();
58351         var oldHeight = this.getHeight();
58352         _super.prototype.setZ.call(this, z);
58353         this.shapeCache = null;
58354         this.rectangleShapeCache = null;
58355         this.firePropertyChange(/* name */ "WIDTH", oldWidth, this.getWidth());
58356         this.firePropertyChange(/* name */ "DEPTH", oldDepth, this.getDepth());
58357         this.firePropertyChange(/* name */ "HEIGHT", oldHeight, this.getHeight());
58358     };
58359     /**
58360      * Returns the width of this observer camera according to
58361      * human proportions with an eyes elevation at z.
58362      * @return {number}
58363      */
58364     ObserverCamera.prototype.getWidth = function () {
58365         if (this.fixedSize || this.planScale > 1) {
58366             return 46.6 * this.planScale;
58367         }
58368         else {
58369             var width = this.getZ() * 4 / 14;
58370             return Math.min(Math.max(width, 20), 62.5) * this.planScale;
58371         }
58372     };
58373     /**
58374      * Returns the depth of this observer camera according to
58375      * human proportions with an eyes elevation at z.
58376      * @return {number}
58377      */
58378     ObserverCamera.prototype.getDepth = function () {
58379         if (this.fixedSize || this.planScale > 1) {
58380             return 18.6 * this.planScale;
58381         }
58382         else {
58383             var depth = this.getZ() * 8 / 70;
58384             return Math.min(Math.max(depth, 8), 25) * this.planScale;
58385         }
58386     };
58387     /**
58388      * Returns the height of this observer camera according to
58389      * human proportions with an eyes elevation at z.
58390      * @return {number}
58391      */
58392     ObserverCamera.prototype.getHeight = function () {
58393         if (this.fixedSize || this.planScale > 1) {
58394             return 175.0 * this.planScale;
58395         }
58396         else {
58397             return this.getZ() * 15 / 14 * this.planScale;
58398         }
58399     };
58400     /**
58401      * Returns the points of each corner of the rectangle surrounding this camera.
58402      * @return {float[][]} an array of the 4 (x,y) coordinates of the camera corners.
58403      */
58404     ObserverCamera.prototype.getPoints = function () {
58405         var cameraPoints = (function (dims) { var allocate = function (dims) { if (dims.length === 0) {
58406             return 0;
58407         }
58408         else {
58409             var array = [];
58410             for (var i = 0; i < dims[0]; i++) {
58411                 array.push(allocate(dims.slice(1)));
58412             }
58413             return array;
58414         } }; return allocate(dims); })([4, 2]);
58415         var it = this.getRectangleShape().getPathIterator(null);
58416         for (var i = 0; i < cameraPoints.length; i++) {
58417             {
58418                 it.currentSegment(cameraPoints[i]);
58419                 it.next();
58420             }
58421             ;
58422         }
58423         return cameraPoints;
58424     };
58425     /**
58426      * Returns <code>true</code> if this camera intersects
58427      * with the horizontal rectangle which opposite corners are at points
58428      * (<code>x0</code>, <code>y0</code>) and (<code>x1</code>, <code>y1</code>).
58429      * @param {number} x0
58430      * @param {number} y0
58431      * @param {number} x1
58432      * @param {number} y1
58433      * @return {boolean}
58434      */
58435     ObserverCamera.prototype.intersectsRectangle = function (x0, y0, x1, y1) {
58436         var rectangle = new java.awt.geom.Rectangle2D.Float(x0, y0, 0, 0);
58437         rectangle.add(x1, y1);
58438         return this.getShape().intersects(rectangle);
58439     };
58440     /**
58441      * Returns <code>true</code> if this camera contains
58442      * the point at (<code>x</code>, <code>y</code>)
58443      * with a given <code>margin</code>.
58444      * @param {number} x
58445      * @param {number} y
58446      * @param {number} margin
58447      * @return {boolean}
58448      */
58449     ObserverCamera.prototype.containsPoint = function (x, y, margin) {
58450         if (margin === 0) {
58451             return this.getShape().contains(x, y);
58452         }
58453         else {
58454             return this.getShape().intersects(x - margin, y - margin, 2 * margin, 2 * margin);
58455         }
58456     };
58457     /**
58458      * Returns the ellipse shape matching this camera.
58459      * @return {Object}
58460      * @private
58461      */
58462     ObserverCamera.prototype.getShape = function () {
58463         if (this.shapeCache == null) {
58464             if (this.planScale <= 1) {
58465                 var cameraEllipse = new java.awt.geom.Ellipse2D.Float(this.getX() - this.getWidth() / 2, this.getY() - this.getDepth() / 2, this.getWidth(), this.getDepth());
58466                 var rotation = java.awt.geom.AffineTransform.getRotateInstance(this.getYaw(), this.getX(), this.getY());
58467                 var it = cameraEllipse.getPathIterator(rotation);
58468                 var pieceShape = new java.awt.geom.GeneralPath();
58469                 pieceShape.append(it, false);
58470                 this.shapeCache = pieceShape;
58471             }
58472             else {
58473                 this.shapeCache = this.getRectangleShape();
58474             }
58475         }
58476         return this.shapeCache;
58477     };
58478     /**
58479      * Returns the rectangle shape matching this camera.
58480      * @return {Object}
58481      * @private
58482      */
58483     ObserverCamera.prototype.getRectangleShape = function () {
58484         if (this.rectangleShapeCache == null) {
58485             var cameraRectangle = new java.awt.geom.Rectangle2D.Float(this.getX() - this.getWidth() / 2, this.getY() - this.getDepth() / 2, this.getWidth(), this.getDepth());
58486             var rotation = java.awt.geom.AffineTransform.getRotateInstance(this.getYaw(), this.getX(), this.getY());
58487             var it = cameraRectangle.getPathIterator(rotation);
58488             var cameraRectangleShape = new java.awt.geom.GeneralPath();
58489             cameraRectangleShape.append(it, false);
58490             this.rectangleShapeCache = cameraRectangleShape;
58491         }
58492         return this.rectangleShapeCache;
58493     };
58494     /**
58495      * Moves this camera of (<code>dx</code>, <code>dy</code>) units.
58496      * @param {number} dx
58497      * @param {number} dy
58498      */
58499     ObserverCamera.prototype.move = function (dx, dy) {
58500         this.setX(this.getX() + dx);
58501         this.setY(this.getY() + dy);
58502     };
58503     /**
58504      * Returns a clone of this camera.
58505      * @return {ObserverCamera}
58506      */
58507     ObserverCamera.prototype.clone = function () {
58508         var _this = this;
58509         return (function (o) { if (_super.prototype.clone != undefined) {
58510             return _super.prototype.clone.call(_this);
58511         }
58512         else {
58513             var clone = Object.create(o);
58514             for (var p in o) {
58515                 if (o.hasOwnProperty(p))
58516                     clone[p] = o[p];
58517             }
58518             return clone;
58519         } })(this);
58520     };
58521     return ObserverCamera;
58522 }(Camera));
58523 ObserverCamera["__class"] = "com.eteks.sweethome3d.model.ObserverCamera";
58524 ObserverCamera["__interfaces"] = ["com.eteks.sweethome3d.model.Selectable"];
58525 ObserverCamera['__transients'] = ['planScale', 'shapeCache', 'rectangleShapeCache', 'lens', 'propertyChangeSupport'];
58526 /**
58527  * Creates a home with no furniture and no walls.
58528  * @param {number} wallHeight default height for home walls
58529  * @class
58530  * @author Emmanuel Puybaret
58531  */
58532 var Home = /** @class */ (function () {
58533     function Home(furniture, wallHeight) {
58534         if (((furniture != null && (furniture instanceof Array)) || furniture === null) && ((typeof wallHeight === 'number') || wallHeight === null)) {
58535             var __args = arguments;
58536             if (this.furniture === undefined) {
58537                 this.furniture = null;
58538             }
58539             if (this.furnitureChangeSupport === undefined) {
58540                 this.furnitureChangeSupport = null;
58541             }
58542             if (this.selectedItems === undefined) {
58543                 this.selectedItems = null;
58544             }
58545             if (this.selectionListeners === undefined) {
58546                 this.selectionListeners = null;
58547             }
58548             if (this.allLevelsSelection === undefined) {
58549                 this.allLevelsSelection = false;
58550             }
58551             if (this.levels === undefined) {
58552                 this.levels = null;
58553             }
58554             if (this.selectedLevel === undefined) {
58555                 this.selectedLevel = null;
58556             }
58557             if (this.levelsChangeSupport === undefined) {
58558                 this.levelsChangeSupport = null;
58559             }
58560             if (this.walls === undefined) {
58561                 this.walls = null;
58562             }
58563             if (this.wallsChangeSupport === undefined) {
58564                 this.wallsChangeSupport = null;
58565             }
58566             if (this.rooms === undefined) {
58567                 this.rooms = null;
58568             }
58569             if (this.roomsChangeSupport === undefined) {
58570                 this.roomsChangeSupport = null;
58571             }
58572             if (this.polylines === undefined) {
58573                 this.polylines = null;
58574             }
58575             if (this.polylinesChangeSupport === undefined) {
58576                 this.polylinesChangeSupport = null;
58577             }
58578             if (this.dimensionLines === undefined) {
58579                 this.dimensionLines = null;
58580             }
58581             if (this.dimensionLinesChangeSupport === undefined) {
58582                 this.dimensionLinesChangeSupport = null;
58583             }
58584             if (this.labels === undefined) {
58585                 this.labels = null;
58586             }
58587             if (this.labelsChangeSupport === undefined) {
58588                 this.labelsChangeSupport = null;
58589             }
58590             if (this.camera === undefined) {
58591                 this.camera = null;
58592             }
58593             if (this.name === undefined) {
58594                 this.name = null;
58595             }
58596             if (this.wallHeight === undefined) {
58597                 this.wallHeight = 0;
58598             }
58599             if (this.modified === undefined) {
58600                 this.modified = false;
58601             }
58602             if (this.recovered === undefined) {
58603                 this.recovered = false;
58604             }
58605             if (this.repaired === undefined) {
58606                 this.repaired = false;
58607             }
58608             if (this.backgroundImage === undefined) {
58609                 this.backgroundImage = null;
58610             }
58611             if (this.observerCamera === undefined) {
58612                 this.observerCamera = null;
58613             }
58614             if (this.topCamera === undefined) {
58615                 this.topCamera = null;
58616             }
58617             if (this.storedCameras === undefined) {
58618                 this.storedCameras = null;
58619             }
58620             if (this.environment === undefined) {
58621                 this.environment = null;
58622             }
58623             if (this.print === undefined) {
58624                 this.print = null;
58625             }
58626             if (this.furnitureSortedPropertyName === undefined) {
58627                 this.furnitureSortedPropertyName = null;
58628             }
58629             if (this.furnitureVisiblePropertyNames === undefined) {
58630                 this.furnitureVisiblePropertyNames = null;
58631             }
58632             if (this.furnitureDescendingSorted === undefined) {
58633                 this.furnitureDescendingSorted = false;
58634             }
58635             if (this.visualProperties === undefined) {
58636                 this.visualProperties = null;
58637             }
58638             if (this.properties === undefined) {
58639                 this.properties = null;
58640             }
58641             if (this.propertyChangeSupport === undefined) {
58642                 this.propertyChangeSupport = null;
58643             }
58644             if (this.version === undefined) {
58645                 this.version = 0;
58646             }
58647             if (this.basePlanLocked === undefined) {
58648                 this.basePlanLocked = false;
58649             }
58650             if (this.compass === undefined) {
58651                 this.compass = null;
58652             }
58653             if (this.furnitureAdditionalProperties === undefined) {
58654                 this.furnitureAdditionalProperties = null;
58655             }
58656             if (this.skyColor === undefined) {
58657                 this.skyColor = 0;
58658             }
58659             if (this.groundColor === undefined) {
58660                 this.groundColor = 0;
58661             }
58662             if (this.groundTexture === undefined) {
58663                 this.groundTexture = null;
58664             }
58665             if (this.lightColor === undefined) {
58666                 this.lightColor = 0;
58667             }
58668             if (this.wallsAlpha === undefined) {
58669                 this.wallsAlpha = 0;
58670             }
58671             if (this.furnitureSortedProperty === undefined) {
58672                 this.furnitureSortedProperty = null;
58673             }
58674             if (this.furnitureVisibleProperties === undefined) {
58675                 this.furnitureVisibleProperties = null;
58676             }
58677             if (this.furnitureWithDoorsAndWindows === undefined) {
58678                 this.furnitureWithDoorsAndWindows = null;
58679             }
58680             if (this.furnitureWithGroups === undefined) {
58681                 this.furnitureWithGroups = null;
58682             }
58683             this.furniture = (furniture.slice(0));
58684             this.walls = ([]);
58685             this.wallHeight = wallHeight;
58686             this.furnitureVisibleProperties = /* asList */ ["NAME", "WIDTH", "DEPTH", "HEIGHT", "VISIBLE"].slice(0);
58687             this.furnitureVisiblePropertyNames = ([]);
58688             for (var index = 0; index < this.furnitureVisibleProperties.length; index++) {
58689                 var property = this.furnitureVisibleProperties[index];
58690                 {
58691                     /* add */ (this.furnitureVisiblePropertyNames.push(/* name */ property) > 0);
58692                 }
58693             }
58694             this.init(true);
58695             this.addModelListeners();
58696         }
58697         else if (((furniture != null && (furniture instanceof Array)) || furniture === null) && wallHeight === undefined) {
58698             var __args = arguments;
58699             {
58700                 var __args_148 = arguments;
58701                 var wallHeight_1 = 250;
58702                 if (this.furniture === undefined) {
58703                     this.furniture = null;
58704                 }
58705                 if (this.furnitureChangeSupport === undefined) {
58706                     this.furnitureChangeSupport = null;
58707                 }
58708                 if (this.selectedItems === undefined) {
58709                     this.selectedItems = null;
58710                 }
58711                 if (this.selectionListeners === undefined) {
58712                     this.selectionListeners = null;
58713                 }
58714                 if (this.allLevelsSelection === undefined) {
58715                     this.allLevelsSelection = false;
58716                 }
58717                 if (this.levels === undefined) {
58718                     this.levels = null;
58719                 }
58720                 if (this.selectedLevel === undefined) {
58721                     this.selectedLevel = null;
58722                 }
58723                 if (this.levelsChangeSupport === undefined) {
58724                     this.levelsChangeSupport = null;
58725                 }
58726                 if (this.walls === undefined) {
58727                     this.walls = null;
58728                 }
58729                 if (this.wallsChangeSupport === undefined) {
58730                     this.wallsChangeSupport = null;
58731                 }
58732                 if (this.rooms === undefined) {
58733                     this.rooms = null;
58734                 }
58735                 if (this.roomsChangeSupport === undefined) {
58736                     this.roomsChangeSupport = null;
58737                 }
58738                 if (this.polylines === undefined) {
58739                     this.polylines = null;
58740                 }
58741                 if (this.polylinesChangeSupport === undefined) {
58742                     this.polylinesChangeSupport = null;
58743                 }
58744                 if (this.dimensionLines === undefined) {
58745                     this.dimensionLines = null;
58746                 }
58747                 if (this.dimensionLinesChangeSupport === undefined) {
58748                     this.dimensionLinesChangeSupport = null;
58749                 }
58750                 if (this.labels === undefined) {
58751                     this.labels = null;
58752                 }
58753                 if (this.labelsChangeSupport === undefined) {
58754                     this.labelsChangeSupport = null;
58755                 }
58756                 if (this.camera === undefined) {
58757                     this.camera = null;
58758                 }
58759                 if (this.name === undefined) {
58760                     this.name = null;
58761                 }
58762                 if (this.wallHeight === undefined) {
58763                     this.wallHeight = 0;
58764                 }
58765                 if (this.modified === undefined) {
58766                     this.modified = false;
58767                 }
58768                 if (this.recovered === undefined) {
58769                     this.recovered = false;
58770                 }
58771                 if (this.repaired === undefined) {
58772                     this.repaired = false;
58773                 }
58774                 if (this.backgroundImage === undefined) {
58775                     this.backgroundImage = null;
58776                 }
58777                 if (this.observerCamera === undefined) {
58778                     this.observerCamera = null;
58779                 }
58780                 if (this.topCamera === undefined) {
58781                     this.topCamera = null;
58782                 }
58783                 if (this.storedCameras === undefined) {
58784                     this.storedCameras = null;
58785                 }
58786                 if (this.environment === undefined) {
58787                     this.environment = null;
58788                 }
58789                 if (this.print === undefined) {
58790                     this.print = null;
58791                 }
58792                 if (this.furnitureSortedPropertyName === undefined) {
58793                     this.furnitureSortedPropertyName = null;
58794                 }
58795                 if (this.furnitureVisiblePropertyNames === undefined) {
58796                     this.furnitureVisiblePropertyNames = null;
58797                 }
58798                 if (this.furnitureDescendingSorted === undefined) {
58799                     this.furnitureDescendingSorted = false;
58800                 }
58801                 if (this.visualProperties === undefined) {
58802                     this.visualProperties = null;
58803                 }
58804                 if (this.properties === undefined) {
58805                     this.properties = null;
58806                 }
58807                 if (this.propertyChangeSupport === undefined) {
58808                     this.propertyChangeSupport = null;
58809                 }
58810                 if (this.version === undefined) {
58811                     this.version = 0;
58812                 }
58813                 if (this.basePlanLocked === undefined) {
58814                     this.basePlanLocked = false;
58815                 }
58816                 if (this.compass === undefined) {
58817                     this.compass = null;
58818                 }
58819                 if (this.furnitureAdditionalProperties === undefined) {
58820                     this.furnitureAdditionalProperties = null;
58821                 }
58822                 if (this.skyColor === undefined) {
58823                     this.skyColor = 0;
58824                 }
58825                 if (this.groundColor === undefined) {
58826                     this.groundColor = 0;
58827                 }
58828                 if (this.groundTexture === undefined) {
58829                     this.groundTexture = null;
58830                 }
58831                 if (this.lightColor === undefined) {
58832                     this.lightColor = 0;
58833                 }
58834                 if (this.wallsAlpha === undefined) {
58835                     this.wallsAlpha = 0;
58836                 }
58837                 if (this.furnitureSortedProperty === undefined) {
58838                     this.furnitureSortedProperty = null;
58839                 }
58840                 if (this.furnitureVisibleProperties === undefined) {
58841                     this.furnitureVisibleProperties = null;
58842                 }
58843                 if (this.furnitureWithDoorsAndWindows === undefined) {
58844                     this.furnitureWithDoorsAndWindows = null;
58845                 }
58846                 if (this.furnitureWithGroups === undefined) {
58847                     this.furnitureWithGroups = null;
58848                 }
58849                 this.furniture = (furniture.slice(0));
58850                 this.walls = ([]);
58851                 this.wallHeight = wallHeight_1;
58852                 this.furnitureVisibleProperties = /* asList */ ["NAME", "WIDTH", "DEPTH", "HEIGHT", "VISIBLE"].slice(0);
58853                 this.furnitureVisiblePropertyNames = ([]);
58854                 for (var index = 0; index < this.furnitureVisibleProperties.length; index++) {
58855                     var property = this.furnitureVisibleProperties[index];
58856                     {
58857                         /* add */ (this.furnitureVisiblePropertyNames.push(/* name */ property) > 0);
58858                     }
58859                 }
58860                 this.init(true);
58861                 this.addModelListeners();
58862             }
58863             if (this.furniture === undefined) {
58864                 this.furniture = null;
58865             }
58866             if (this.furnitureChangeSupport === undefined) {
58867                 this.furnitureChangeSupport = null;
58868             }
58869             if (this.selectedItems === undefined) {
58870                 this.selectedItems = null;
58871             }
58872             if (this.selectionListeners === undefined) {
58873                 this.selectionListeners = null;
58874             }
58875             if (this.allLevelsSelection === undefined) {
58876                 this.allLevelsSelection = false;
58877             }
58878             if (this.levels === undefined) {
58879                 this.levels = null;
58880             }
58881             if (this.selectedLevel === undefined) {
58882                 this.selectedLevel = null;
58883             }
58884             if (this.levelsChangeSupport === undefined) {
58885                 this.levelsChangeSupport = null;
58886             }
58887             if (this.walls === undefined) {
58888                 this.walls = null;
58889             }
58890             if (this.wallsChangeSupport === undefined) {
58891                 this.wallsChangeSupport = null;
58892             }
58893             if (this.rooms === undefined) {
58894                 this.rooms = null;
58895             }
58896             if (this.roomsChangeSupport === undefined) {
58897                 this.roomsChangeSupport = null;
58898             }
58899             if (this.polylines === undefined) {
58900                 this.polylines = null;
58901             }
58902             if (this.polylinesChangeSupport === undefined) {
58903                 this.polylinesChangeSupport = null;
58904             }
58905             if (this.dimensionLines === undefined) {
58906                 this.dimensionLines = null;
58907             }
58908             if (this.dimensionLinesChangeSupport === undefined) {
58909                 this.dimensionLinesChangeSupport = null;
58910             }
58911             if (this.labels === undefined) {
58912                 this.labels = null;
58913             }
58914             if (this.labelsChangeSupport === undefined) {
58915                 this.labelsChangeSupport = null;
58916             }
58917             if (this.camera === undefined) {
58918                 this.camera = null;
58919             }
58920             if (this.name === undefined) {
58921                 this.name = null;
58922             }
58923             if (this.wallHeight === undefined) {
58924                 this.wallHeight = 0;
58925             }
58926             if (this.modified === undefined) {
58927                 this.modified = false;
58928             }
58929             if (this.recovered === undefined) {
58930                 this.recovered = false;
58931             }
58932             if (this.repaired === undefined) {
58933                 this.repaired = false;
58934             }
58935             if (this.backgroundImage === undefined) {
58936                 this.backgroundImage = null;
58937             }
58938             if (this.observerCamera === undefined) {
58939                 this.observerCamera = null;
58940             }
58941             if (this.topCamera === undefined) {
58942                 this.topCamera = null;
58943             }
58944             if (this.storedCameras === undefined) {
58945                 this.storedCameras = null;
58946             }
58947             if (this.environment === undefined) {
58948                 this.environment = null;
58949             }
58950             if (this.print === undefined) {
58951                 this.print = null;
58952             }
58953             if (this.furnitureSortedPropertyName === undefined) {
58954                 this.furnitureSortedPropertyName = null;
58955             }
58956             if (this.furnitureVisiblePropertyNames === undefined) {
58957                 this.furnitureVisiblePropertyNames = null;
58958             }
58959             if (this.furnitureDescendingSorted === undefined) {
58960                 this.furnitureDescendingSorted = false;
58961             }
58962             if (this.visualProperties === undefined) {
58963                 this.visualProperties = null;
58964             }
58965             if (this.properties === undefined) {
58966                 this.properties = null;
58967             }
58968             if (this.propertyChangeSupport === undefined) {
58969                 this.propertyChangeSupport = null;
58970             }
58971             if (this.version === undefined) {
58972                 this.version = 0;
58973             }
58974             if (this.basePlanLocked === undefined) {
58975                 this.basePlanLocked = false;
58976             }
58977             if (this.compass === undefined) {
58978                 this.compass = null;
58979             }
58980             if (this.furnitureAdditionalProperties === undefined) {
58981                 this.furnitureAdditionalProperties = null;
58982             }
58983             if (this.skyColor === undefined) {
58984                 this.skyColor = 0;
58985             }
58986             if (this.groundColor === undefined) {
58987                 this.groundColor = 0;
58988             }
58989             if (this.groundTexture === undefined) {
58990                 this.groundTexture = null;
58991             }
58992             if (this.lightColor === undefined) {
58993                 this.lightColor = 0;
58994             }
58995             if (this.wallsAlpha === undefined) {
58996                 this.wallsAlpha = 0;
58997             }
58998             if (this.furnitureSortedProperty === undefined) {
58999                 this.furnitureSortedProperty = null;
59000             }
59001             if (this.furnitureVisibleProperties === undefined) {
59002                 this.furnitureVisibleProperties = null;
59003             }
59004             if (this.furnitureWithDoorsAndWindows === undefined) {
59005                 this.furnitureWithDoorsAndWindows = null;
59006             }
59007             if (this.furnitureWithGroups === undefined) {
59008                 this.furnitureWithGroups = null;
59009             }
59010         }
59011         else if (((furniture != null && furniture instanceof Home) || furniture === null) && wallHeight === undefined) {
59012             var __args = arguments;
59013             var home = __args[0];
59014             if (this.furniture === undefined) {
59015                 this.furniture = null;
59016             }
59017             if (this.furnitureChangeSupport === undefined) {
59018                 this.furnitureChangeSupport = null;
59019             }
59020             if (this.selectedItems === undefined) {
59021                 this.selectedItems = null;
59022             }
59023             if (this.selectionListeners === undefined) {
59024                 this.selectionListeners = null;
59025             }
59026             if (this.allLevelsSelection === undefined) {
59027                 this.allLevelsSelection = false;
59028             }
59029             if (this.levels === undefined) {
59030                 this.levels = null;
59031             }
59032             if (this.selectedLevel === undefined) {
59033                 this.selectedLevel = null;
59034             }
59035             if (this.levelsChangeSupport === undefined) {
59036                 this.levelsChangeSupport = null;
59037             }
59038             if (this.walls === undefined) {
59039                 this.walls = null;
59040             }
59041             if (this.wallsChangeSupport === undefined) {
59042                 this.wallsChangeSupport = null;
59043             }
59044             if (this.rooms === undefined) {
59045                 this.rooms = null;
59046             }
59047             if (this.roomsChangeSupport === undefined) {
59048                 this.roomsChangeSupport = null;
59049             }
59050             if (this.polylines === undefined) {
59051                 this.polylines = null;
59052             }
59053             if (this.polylinesChangeSupport === undefined) {
59054                 this.polylinesChangeSupport = null;
59055             }
59056             if (this.dimensionLines === undefined) {
59057                 this.dimensionLines = null;
59058             }
59059             if (this.dimensionLinesChangeSupport === undefined) {
59060                 this.dimensionLinesChangeSupport = null;
59061             }
59062             if (this.labels === undefined) {
59063                 this.labels = null;
59064             }
59065             if (this.labelsChangeSupport === undefined) {
59066                 this.labelsChangeSupport = null;
59067             }
59068             if (this.camera === undefined) {
59069                 this.camera = null;
59070             }
59071             if (this.name === undefined) {
59072                 this.name = null;
59073             }
59074             if (this.wallHeight === undefined) {
59075                 this.wallHeight = 0;
59076             }
59077             if (this.modified === undefined) {
59078                 this.modified = false;
59079             }
59080             if (this.recovered === undefined) {
59081                 this.recovered = false;
59082             }
59083             if (this.repaired === undefined) {
59084                 this.repaired = false;
59085             }
59086             if (this.backgroundImage === undefined) {
59087                 this.backgroundImage = null;
59088             }
59089             if (this.observerCamera === undefined) {
59090                 this.observerCamera = null;
59091             }
59092             if (this.topCamera === undefined) {
59093                 this.topCamera = null;
59094             }
59095             if (this.storedCameras === undefined) {
59096                 this.storedCameras = null;
59097             }
59098             if (this.environment === undefined) {
59099                 this.environment = null;
59100             }
59101             if (this.print === undefined) {
59102                 this.print = null;
59103             }
59104             if (this.furnitureSortedPropertyName === undefined) {
59105                 this.furnitureSortedPropertyName = null;
59106             }
59107             if (this.furnitureVisiblePropertyNames === undefined) {
59108                 this.furnitureVisiblePropertyNames = null;
59109             }
59110             if (this.furnitureDescendingSorted === undefined) {
59111                 this.furnitureDescendingSorted = false;
59112             }
59113             if (this.visualProperties === undefined) {
59114                 this.visualProperties = null;
59115             }
59116             if (this.properties === undefined) {
59117                 this.properties = null;
59118             }
59119             if (this.propertyChangeSupport === undefined) {
59120                 this.propertyChangeSupport = null;
59121             }
59122             if (this.version === undefined) {
59123                 this.version = 0;
59124             }
59125             if (this.basePlanLocked === undefined) {
59126                 this.basePlanLocked = false;
59127             }
59128             if (this.compass === undefined) {
59129                 this.compass = null;
59130             }
59131             if (this.furnitureAdditionalProperties === undefined) {
59132                 this.furnitureAdditionalProperties = null;
59133             }
59134             if (this.skyColor === undefined) {
59135                 this.skyColor = 0;
59136             }
59137             if (this.groundColor === undefined) {
59138                 this.groundColor = 0;
59139             }
59140             if (this.groundTexture === undefined) {
59141                 this.groundTexture = null;
59142             }
59143             if (this.lightColor === undefined) {
59144                 this.lightColor = 0;
59145             }
59146             if (this.wallsAlpha === undefined) {
59147                 this.wallsAlpha = 0;
59148             }
59149             if (this.furnitureSortedProperty === undefined) {
59150                 this.furnitureSortedProperty = null;
59151             }
59152             if (this.furnitureVisibleProperties === undefined) {
59153                 this.furnitureVisibleProperties = null;
59154             }
59155             if (this.furnitureWithDoorsAndWindows === undefined) {
59156                 this.furnitureWithDoorsAndWindows = null;
59157             }
59158             if (this.furnitureWithGroups === undefined) {
59159                 this.furnitureWithGroups = null;
59160             }
59161             this.wallHeight = home.getWallHeight();
59162             Home.copyHomeData(home, this);
59163             Home.initListenersSupport(this);
59164             this.addModelListeners();
59165         }
59166         else if (((typeof furniture === 'number') || furniture === null) && wallHeight === undefined) {
59167             var __args = arguments;
59168             var wallHeight_2 = __args[0];
59169             {
59170                 var __args_149 = arguments;
59171                 var furniture_4 = [];
59172                 if (this.furniture === undefined) {
59173                     this.furniture = null;
59174                 }
59175                 if (this.furnitureChangeSupport === undefined) {
59176                     this.furnitureChangeSupport = null;
59177                 }
59178                 if (this.selectedItems === undefined) {
59179                     this.selectedItems = null;
59180                 }
59181                 if (this.selectionListeners === undefined) {
59182                     this.selectionListeners = null;
59183                 }
59184                 if (this.allLevelsSelection === undefined) {
59185                     this.allLevelsSelection = false;
59186                 }
59187                 if (this.levels === undefined) {
59188                     this.levels = null;
59189                 }
59190                 if (this.selectedLevel === undefined) {
59191                     this.selectedLevel = null;
59192                 }
59193                 if (this.levelsChangeSupport === undefined) {
59194                     this.levelsChangeSupport = null;
59195                 }
59196                 if (this.walls === undefined) {
59197                     this.walls = null;
59198                 }
59199                 if (this.wallsChangeSupport === undefined) {
59200                     this.wallsChangeSupport = null;
59201                 }
59202                 if (this.rooms === undefined) {
59203                     this.rooms = null;
59204                 }
59205                 if (this.roomsChangeSupport === undefined) {
59206                     this.roomsChangeSupport = null;
59207                 }
59208                 if (this.polylines === undefined) {
59209                     this.polylines = null;
59210                 }
59211                 if (this.polylinesChangeSupport === undefined) {
59212                     this.polylinesChangeSupport = null;
59213                 }
59214                 if (this.dimensionLines === undefined) {
59215                     this.dimensionLines = null;
59216                 }
59217                 if (this.dimensionLinesChangeSupport === undefined) {
59218                     this.dimensionLinesChangeSupport = null;
59219                 }
59220                 if (this.labels === undefined) {
59221                     this.labels = null;
59222                 }
59223                 if (this.labelsChangeSupport === undefined) {
59224                     this.labelsChangeSupport = null;
59225                 }
59226                 if (this.camera === undefined) {
59227                     this.camera = null;
59228                 }
59229                 if (this.name === undefined) {
59230                     this.name = null;
59231                 }
59232                 if (this.wallHeight === undefined) {
59233                     this.wallHeight = 0;
59234                 }
59235                 if (this.modified === undefined) {
59236                     this.modified = false;
59237                 }
59238                 if (this.recovered === undefined) {
59239                     this.recovered = false;
59240                 }
59241                 if (this.repaired === undefined) {
59242                     this.repaired = false;
59243                 }
59244                 if (this.backgroundImage === undefined) {
59245                     this.backgroundImage = null;
59246                 }
59247                 if (this.observerCamera === undefined) {
59248                     this.observerCamera = null;
59249                 }
59250                 if (this.topCamera === undefined) {
59251                     this.topCamera = null;
59252                 }
59253                 if (this.storedCameras === undefined) {
59254                     this.storedCameras = null;
59255                 }
59256                 if (this.environment === undefined) {
59257                     this.environment = null;
59258                 }
59259                 if (this.print === undefined) {
59260                     this.print = null;
59261                 }
59262                 if (this.furnitureSortedPropertyName === undefined) {
59263                     this.furnitureSortedPropertyName = null;
59264                 }
59265                 if (this.furnitureVisiblePropertyNames === undefined) {
59266                     this.furnitureVisiblePropertyNames = null;
59267                 }
59268                 if (this.furnitureDescendingSorted === undefined) {
59269                     this.furnitureDescendingSorted = false;
59270                 }
59271                 if (this.visualProperties === undefined) {
59272                     this.visualProperties = null;
59273                 }
59274                 if (this.properties === undefined) {
59275                     this.properties = null;
59276                 }
59277                 if (this.propertyChangeSupport === undefined) {
59278                     this.propertyChangeSupport = null;
59279                 }
59280                 if (this.version === undefined) {
59281                     this.version = 0;
59282                 }
59283                 if (this.basePlanLocked === undefined) {
59284                     this.basePlanLocked = false;
59285                 }
59286                 if (this.compass === undefined) {
59287                     this.compass = null;
59288                 }
59289                 if (this.furnitureAdditionalProperties === undefined) {
59290                     this.furnitureAdditionalProperties = null;
59291                 }
59292                 if (this.skyColor === undefined) {
59293                     this.skyColor = 0;
59294                 }
59295                 if (this.groundColor === undefined) {
59296                     this.groundColor = 0;
59297                 }
59298                 if (this.groundTexture === undefined) {
59299                     this.groundTexture = null;
59300                 }
59301                 if (this.lightColor === undefined) {
59302                     this.lightColor = 0;
59303                 }
59304                 if (this.wallsAlpha === undefined) {
59305                     this.wallsAlpha = 0;
59306                 }
59307                 if (this.furnitureSortedProperty === undefined) {
59308                     this.furnitureSortedProperty = null;
59309                 }
59310                 if (this.furnitureVisibleProperties === undefined) {
59311                     this.furnitureVisibleProperties = null;
59312                 }
59313                 if (this.furnitureWithDoorsAndWindows === undefined) {
59314                     this.furnitureWithDoorsAndWindows = null;
59315                 }
59316                 if (this.furnitureWithGroups === undefined) {
59317                     this.furnitureWithGroups = null;
59318                 }
59319                 this.furniture = (furniture_4.slice(0));
59320                 this.walls = ([]);
59321                 this.wallHeight = wallHeight_2;
59322                 this.furnitureVisibleProperties = /* asList */ ["NAME", "WIDTH", "DEPTH", "HEIGHT", "VISIBLE"].slice(0);
59323                 this.furnitureVisiblePropertyNames = ([]);
59324                 for (var index = 0; index < this.furnitureVisibleProperties.length; index++) {
59325                     var property = this.furnitureVisibleProperties[index];
59326                     {
59327                         /* add */ (this.furnitureVisiblePropertyNames.push(/* name */ property) > 0);
59328                     }
59329                 }
59330                 this.init(true);
59331                 this.addModelListeners();
59332             }
59333             if (this.furniture === undefined) {
59334                 this.furniture = null;
59335             }
59336             if (this.furnitureChangeSupport === undefined) {
59337                 this.furnitureChangeSupport = null;
59338             }
59339             if (this.selectedItems === undefined) {
59340                 this.selectedItems = null;
59341             }
59342             if (this.selectionListeners === undefined) {
59343                 this.selectionListeners = null;
59344             }
59345             if (this.allLevelsSelection === undefined) {
59346                 this.allLevelsSelection = false;
59347             }
59348             if (this.levels === undefined) {
59349                 this.levels = null;
59350             }
59351             if (this.selectedLevel === undefined) {
59352                 this.selectedLevel = null;
59353             }
59354             if (this.levelsChangeSupport === undefined) {
59355                 this.levelsChangeSupport = null;
59356             }
59357             if (this.walls === undefined) {
59358                 this.walls = null;
59359             }
59360             if (this.wallsChangeSupport === undefined) {
59361                 this.wallsChangeSupport = null;
59362             }
59363             if (this.rooms === undefined) {
59364                 this.rooms = null;
59365             }
59366             if (this.roomsChangeSupport === undefined) {
59367                 this.roomsChangeSupport = null;
59368             }
59369             if (this.polylines === undefined) {
59370                 this.polylines = null;
59371             }
59372             if (this.polylinesChangeSupport === undefined) {
59373                 this.polylinesChangeSupport = null;
59374             }
59375             if (this.dimensionLines === undefined) {
59376                 this.dimensionLines = null;
59377             }
59378             if (this.dimensionLinesChangeSupport === undefined) {
59379                 this.dimensionLinesChangeSupport = null;
59380             }
59381             if (this.labels === undefined) {
59382                 this.labels = null;
59383             }
59384             if (this.labelsChangeSupport === undefined) {
59385                 this.labelsChangeSupport = null;
59386             }
59387             if (this.camera === undefined) {
59388                 this.camera = null;
59389             }
59390             if (this.name === undefined) {
59391                 this.name = null;
59392             }
59393             if (this.wallHeight === undefined) {
59394                 this.wallHeight = 0;
59395             }
59396             if (this.modified === undefined) {
59397                 this.modified = false;
59398             }
59399             if (this.recovered === undefined) {
59400                 this.recovered = false;
59401             }
59402             if (this.repaired === undefined) {
59403                 this.repaired = false;
59404             }
59405             if (this.backgroundImage === undefined) {
59406                 this.backgroundImage = null;
59407             }
59408             if (this.observerCamera === undefined) {
59409                 this.observerCamera = null;
59410             }
59411             if (this.topCamera === undefined) {
59412                 this.topCamera = null;
59413             }
59414             if (this.storedCameras === undefined) {
59415                 this.storedCameras = null;
59416             }
59417             if (this.environment === undefined) {
59418                 this.environment = null;
59419             }
59420             if (this.print === undefined) {
59421                 this.print = null;
59422             }
59423             if (this.furnitureSortedPropertyName === undefined) {
59424                 this.furnitureSortedPropertyName = null;
59425             }
59426             if (this.furnitureVisiblePropertyNames === undefined) {
59427                 this.furnitureVisiblePropertyNames = null;
59428             }
59429             if (this.furnitureDescendingSorted === undefined) {
59430                 this.furnitureDescendingSorted = false;
59431             }
59432             if (this.visualProperties === undefined) {
59433                 this.visualProperties = null;
59434             }
59435             if (this.properties === undefined) {
59436                 this.properties = null;
59437             }
59438             if (this.propertyChangeSupport === undefined) {
59439                 this.propertyChangeSupport = null;
59440             }
59441             if (this.version === undefined) {
59442                 this.version = 0;
59443             }
59444             if (this.basePlanLocked === undefined) {
59445                 this.basePlanLocked = false;
59446             }
59447             if (this.compass === undefined) {
59448                 this.compass = null;
59449             }
59450             if (this.furnitureAdditionalProperties === undefined) {
59451                 this.furnitureAdditionalProperties = null;
59452             }
59453             if (this.skyColor === undefined) {
59454                 this.skyColor = 0;
59455             }
59456             if (this.groundColor === undefined) {
59457                 this.groundColor = 0;
59458             }
59459             if (this.groundTexture === undefined) {
59460                 this.groundTexture = null;
59461             }
59462             if (this.lightColor === undefined) {
59463                 this.lightColor = 0;
59464             }
59465             if (this.wallsAlpha === undefined) {
59466                 this.wallsAlpha = 0;
59467             }
59468             if (this.furnitureSortedProperty === undefined) {
59469                 this.furnitureSortedProperty = null;
59470             }
59471             if (this.furnitureVisibleProperties === undefined) {
59472                 this.furnitureVisibleProperties = null;
59473             }
59474             if (this.furnitureWithDoorsAndWindows === undefined) {
59475                 this.furnitureWithDoorsAndWindows = null;
59476             }
59477             if (this.furnitureWithGroups === undefined) {
59478                 this.furnitureWithGroups = null;
59479             }
59480         }
59481         else if (furniture === undefined && wallHeight === undefined) {
59482             var __args = arguments;
59483             {
59484                 var __args_150 = arguments;
59485                 var wallHeight_3 = 250;
59486                 {
59487                     var __args_151 = arguments;
59488                     var furniture_5 = [];
59489                     if (this.furniture === undefined) {
59490                         this.furniture = null;
59491                     }
59492                     if (this.furnitureChangeSupport === undefined) {
59493                         this.furnitureChangeSupport = null;
59494                     }
59495                     if (this.selectedItems === undefined) {
59496                         this.selectedItems = null;
59497                     }
59498                     if (this.selectionListeners === undefined) {
59499                         this.selectionListeners = null;
59500                     }
59501                     if (this.allLevelsSelection === undefined) {
59502                         this.allLevelsSelection = false;
59503                     }
59504                     if (this.levels === undefined) {
59505                         this.levels = null;
59506                     }
59507                     if (this.selectedLevel === undefined) {
59508                         this.selectedLevel = null;
59509                     }
59510                     if (this.levelsChangeSupport === undefined) {
59511                         this.levelsChangeSupport = null;
59512                     }
59513                     if (this.walls === undefined) {
59514                         this.walls = null;
59515                     }
59516                     if (this.wallsChangeSupport === undefined) {
59517                         this.wallsChangeSupport = null;
59518                     }
59519                     if (this.rooms === undefined) {
59520                         this.rooms = null;
59521                     }
59522                     if (this.roomsChangeSupport === undefined) {
59523                         this.roomsChangeSupport = null;
59524                     }
59525                     if (this.polylines === undefined) {
59526                         this.polylines = null;
59527                     }
59528                     if (this.polylinesChangeSupport === undefined) {
59529                         this.polylinesChangeSupport = null;
59530                     }
59531                     if (this.dimensionLines === undefined) {
59532                         this.dimensionLines = null;
59533                     }
59534                     if (this.dimensionLinesChangeSupport === undefined) {
59535                         this.dimensionLinesChangeSupport = null;
59536                     }
59537                     if (this.labels === undefined) {
59538                         this.labels = null;
59539                     }
59540                     if (this.labelsChangeSupport === undefined) {
59541                         this.labelsChangeSupport = null;
59542                     }
59543                     if (this.camera === undefined) {
59544                         this.camera = null;
59545                     }
59546                     if (this.name === undefined) {
59547                         this.name = null;
59548                     }
59549                     if (this.wallHeight === undefined) {
59550                         this.wallHeight = 0;
59551                     }
59552                     if (this.modified === undefined) {
59553                         this.modified = false;
59554                     }
59555                     if (this.recovered === undefined) {
59556                         this.recovered = false;
59557                     }
59558                     if (this.repaired === undefined) {
59559                         this.repaired = false;
59560                     }
59561                     if (this.backgroundImage === undefined) {
59562                         this.backgroundImage = null;
59563                     }
59564                     if (this.observerCamera === undefined) {
59565                         this.observerCamera = null;
59566                     }
59567                     if (this.topCamera === undefined) {
59568                         this.topCamera = null;
59569                     }
59570                     if (this.storedCameras === undefined) {
59571                         this.storedCameras = null;
59572                     }
59573                     if (this.environment === undefined) {
59574                         this.environment = null;
59575                     }
59576                     if (this.print === undefined) {
59577                         this.print = null;
59578                     }
59579                     if (this.furnitureSortedPropertyName === undefined) {
59580                         this.furnitureSortedPropertyName = null;
59581                     }
59582                     if (this.furnitureVisiblePropertyNames === undefined) {
59583                         this.furnitureVisiblePropertyNames = null;
59584                     }
59585                     if (this.furnitureDescendingSorted === undefined) {
59586                         this.furnitureDescendingSorted = false;
59587                     }
59588                     if (this.visualProperties === undefined) {
59589                         this.visualProperties = null;
59590                     }
59591                     if (this.properties === undefined) {
59592                         this.properties = null;
59593                     }
59594                     if (this.propertyChangeSupport === undefined) {
59595                         this.propertyChangeSupport = null;
59596                     }
59597                     if (this.version === undefined) {
59598                         this.version = 0;
59599                     }
59600                     if (this.basePlanLocked === undefined) {
59601                         this.basePlanLocked = false;
59602                     }
59603                     if (this.compass === undefined) {
59604                         this.compass = null;
59605                     }
59606                     if (this.furnitureAdditionalProperties === undefined) {
59607                         this.furnitureAdditionalProperties = null;
59608                     }
59609                     if (this.skyColor === undefined) {
59610                         this.skyColor = 0;
59611                     }
59612                     if (this.groundColor === undefined) {
59613                         this.groundColor = 0;
59614                     }
59615                     if (this.groundTexture === undefined) {
59616                         this.groundTexture = null;
59617                     }
59618                     if (this.lightColor === undefined) {
59619                         this.lightColor = 0;
59620                     }
59621                     if (this.wallsAlpha === undefined) {
59622                         this.wallsAlpha = 0;
59623                     }
59624                     if (this.furnitureSortedProperty === undefined) {
59625                         this.furnitureSortedProperty = null;
59626                     }
59627                     if (this.furnitureVisibleProperties === undefined) {
59628                         this.furnitureVisibleProperties = null;
59629                     }
59630                     if (this.furnitureWithDoorsAndWindows === undefined) {
59631                         this.furnitureWithDoorsAndWindows = null;
59632                     }
59633                     if (this.furnitureWithGroups === undefined) {
59634                         this.furnitureWithGroups = null;
59635                     }
59636                     this.furniture = (furniture_5.slice(0));
59637                     this.walls = ([]);
59638                     this.wallHeight = wallHeight_3;
59639                     this.furnitureVisibleProperties = /* asList */ ["NAME", "WIDTH", "DEPTH", "HEIGHT", "VISIBLE"].slice(0);
59640                     this.furnitureVisiblePropertyNames = ([]);
59641                     for (var index = 0; index < this.furnitureVisibleProperties.length; index++) {
59642                         var property = this.furnitureVisibleProperties[index];
59643                         {
59644                             /* add */ (this.furnitureVisiblePropertyNames.push(/* name */ property) > 0);
59645                         }
59646                     }
59647                     this.init(true);
59648                     this.addModelListeners();
59649                 }
59650                 if (this.furniture === undefined) {
59651                     this.furniture = null;
59652                 }
59653                 if (this.furnitureChangeSupport === undefined) {
59654                     this.furnitureChangeSupport = null;
59655                 }
59656                 if (this.selectedItems === undefined) {
59657                     this.selectedItems = null;
59658                 }
59659                 if (this.selectionListeners === undefined) {
59660                     this.selectionListeners = null;
59661                 }
59662                 if (this.allLevelsSelection === undefined) {
59663                     this.allLevelsSelection = false;
59664                 }
59665                 if (this.levels === undefined) {
59666                     this.levels = null;
59667                 }
59668                 if (this.selectedLevel === undefined) {
59669                     this.selectedLevel = null;
59670                 }
59671                 if (this.levelsChangeSupport === undefined) {
59672                     this.levelsChangeSupport = null;
59673                 }
59674                 if (this.walls === undefined) {
59675                     this.walls = null;
59676                 }
59677                 if (this.wallsChangeSupport === undefined) {
59678                     this.wallsChangeSupport = null;
59679                 }
59680                 if (this.rooms === undefined) {
59681                     this.rooms = null;
59682                 }
59683                 if (this.roomsChangeSupport === undefined) {
59684                     this.roomsChangeSupport = null;
59685                 }
59686                 if (this.polylines === undefined) {
59687                     this.polylines = null;
59688                 }
59689                 if (this.polylinesChangeSupport === undefined) {
59690                     this.polylinesChangeSupport = null;
59691                 }
59692                 if (this.dimensionLines === undefined) {
59693                     this.dimensionLines = null;
59694                 }
59695                 if (this.dimensionLinesChangeSupport === undefined) {
59696                     this.dimensionLinesChangeSupport = null;
59697                 }
59698                 if (this.labels === undefined) {
59699                     this.labels = null;
59700                 }
59701                 if (this.labelsChangeSupport === undefined) {
59702                     this.labelsChangeSupport = null;
59703                 }
59704                 if (this.camera === undefined) {
59705                     this.camera = null;
59706                 }
59707                 if (this.name === undefined) {
59708                     this.name = null;
59709                 }
59710                 if (this.wallHeight === undefined) {
59711                     this.wallHeight = 0;
59712                 }
59713                 if (this.modified === undefined) {
59714                     this.modified = false;
59715                 }
59716                 if (this.recovered === undefined) {
59717                     this.recovered = false;
59718                 }
59719                 if (this.repaired === undefined) {
59720                     this.repaired = false;
59721                 }
59722                 if (this.backgroundImage === undefined) {
59723                     this.backgroundImage = null;
59724                 }
59725                 if (this.observerCamera === undefined) {
59726                     this.observerCamera = null;
59727                 }
59728                 if (this.topCamera === undefined) {
59729                     this.topCamera = null;
59730                 }
59731                 if (this.storedCameras === undefined) {
59732                     this.storedCameras = null;
59733                 }
59734                 if (this.environment === undefined) {
59735                     this.environment = null;
59736                 }
59737                 if (this.print === undefined) {
59738                     this.print = null;
59739                 }
59740                 if (this.furnitureSortedPropertyName === undefined) {
59741                     this.furnitureSortedPropertyName = null;
59742                 }
59743                 if (this.furnitureVisiblePropertyNames === undefined) {
59744                     this.furnitureVisiblePropertyNames = null;
59745                 }
59746                 if (this.furnitureDescendingSorted === undefined) {
59747                     this.furnitureDescendingSorted = false;
59748                 }
59749                 if (this.visualProperties === undefined) {
59750                     this.visualProperties = null;
59751                 }
59752                 if (this.properties === undefined) {
59753                     this.properties = null;
59754                 }
59755                 if (this.propertyChangeSupport === undefined) {
59756                     this.propertyChangeSupport = null;
59757                 }
59758                 if (this.version === undefined) {
59759                     this.version = 0;
59760                 }
59761                 if (this.basePlanLocked === undefined) {
59762                     this.basePlanLocked = false;
59763                 }
59764                 if (this.compass === undefined) {
59765                     this.compass = null;
59766                 }
59767                 if (this.furnitureAdditionalProperties === undefined) {
59768                     this.furnitureAdditionalProperties = null;
59769                 }
59770                 if (this.skyColor === undefined) {
59771                     this.skyColor = 0;
59772                 }
59773                 if (this.groundColor === undefined) {
59774                     this.groundColor = 0;
59775                 }
59776                 if (this.groundTexture === undefined) {
59777                     this.groundTexture = null;
59778                 }
59779                 if (this.lightColor === undefined) {
59780                     this.lightColor = 0;
59781                 }
59782                 if (this.wallsAlpha === undefined) {
59783                     this.wallsAlpha = 0;
59784                 }
59785                 if (this.furnitureSortedProperty === undefined) {
59786                     this.furnitureSortedProperty = null;
59787                 }
59788                 if (this.furnitureVisibleProperties === undefined) {
59789                     this.furnitureVisibleProperties = null;
59790                 }
59791                 if (this.furnitureWithDoorsAndWindows === undefined) {
59792                     this.furnitureWithDoorsAndWindows = null;
59793                 }
59794                 if (this.furnitureWithGroups === undefined) {
59795                     this.furnitureWithGroups = null;
59796                 }
59797             }
59798             if (this.furniture === undefined) {
59799                 this.furniture = null;
59800             }
59801             if (this.furnitureChangeSupport === undefined) {
59802                 this.furnitureChangeSupport = null;
59803             }
59804             if (this.selectedItems === undefined) {
59805                 this.selectedItems = null;
59806             }
59807             if (this.selectionListeners === undefined) {
59808                 this.selectionListeners = null;
59809             }
59810             if (this.allLevelsSelection === undefined) {
59811                 this.allLevelsSelection = false;
59812             }
59813             if (this.levels === undefined) {
59814                 this.levels = null;
59815             }
59816             if (this.selectedLevel === undefined) {
59817                 this.selectedLevel = null;
59818             }
59819             if (this.levelsChangeSupport === undefined) {
59820                 this.levelsChangeSupport = null;
59821             }
59822             if (this.walls === undefined) {
59823                 this.walls = null;
59824             }
59825             if (this.wallsChangeSupport === undefined) {
59826                 this.wallsChangeSupport = null;
59827             }
59828             if (this.rooms === undefined) {
59829                 this.rooms = null;
59830             }
59831             if (this.roomsChangeSupport === undefined) {
59832                 this.roomsChangeSupport = null;
59833             }
59834             if (this.polylines === undefined) {
59835                 this.polylines = null;
59836             }
59837             if (this.polylinesChangeSupport === undefined) {
59838                 this.polylinesChangeSupport = null;
59839             }
59840             if (this.dimensionLines === undefined) {
59841                 this.dimensionLines = null;
59842             }
59843             if (this.dimensionLinesChangeSupport === undefined) {
59844                 this.dimensionLinesChangeSupport = null;
59845             }
59846             if (this.labels === undefined) {
59847                 this.labels = null;
59848             }
59849             if (this.labelsChangeSupport === undefined) {
59850                 this.labelsChangeSupport = null;
59851             }
59852             if (this.camera === undefined) {
59853                 this.camera = null;
59854             }
59855             if (this.name === undefined) {
59856                 this.name = null;
59857             }
59858             if (this.wallHeight === undefined) {
59859                 this.wallHeight = 0;
59860             }
59861             if (this.modified === undefined) {
59862                 this.modified = false;
59863             }
59864             if (this.recovered === undefined) {
59865                 this.recovered = false;
59866             }
59867             if (this.repaired === undefined) {
59868                 this.repaired = false;
59869             }
59870             if (this.backgroundImage === undefined) {
59871                 this.backgroundImage = null;
59872             }
59873             if (this.observerCamera === undefined) {
59874                 this.observerCamera = null;
59875             }
59876             if (this.topCamera === undefined) {
59877                 this.topCamera = null;
59878             }
59879             if (this.storedCameras === undefined) {
59880                 this.storedCameras = null;
59881             }
59882             if (this.environment === undefined) {
59883                 this.environment = null;
59884             }
59885             if (this.print === undefined) {
59886                 this.print = null;
59887             }
59888             if (this.furnitureSortedPropertyName === undefined) {
59889                 this.furnitureSortedPropertyName = null;
59890             }
59891             if (this.furnitureVisiblePropertyNames === undefined) {
59892                 this.furnitureVisiblePropertyNames = null;
59893             }
59894             if (this.furnitureDescendingSorted === undefined) {
59895                 this.furnitureDescendingSorted = false;
59896             }
59897             if (this.visualProperties === undefined) {
59898                 this.visualProperties = null;
59899             }
59900             if (this.properties === undefined) {
59901                 this.properties = null;
59902             }
59903             if (this.propertyChangeSupport === undefined) {
59904                 this.propertyChangeSupport = null;
59905             }
59906             if (this.version === undefined) {
59907                 this.version = 0;
59908             }
59909             if (this.basePlanLocked === undefined) {
59910                 this.basePlanLocked = false;
59911             }
59912             if (this.compass === undefined) {
59913                 this.compass = null;
59914             }
59915             if (this.furnitureAdditionalProperties === undefined) {
59916                 this.furnitureAdditionalProperties = null;
59917             }
59918             if (this.skyColor === undefined) {
59919                 this.skyColor = 0;
59920             }
59921             if (this.groundColor === undefined) {
59922                 this.groundColor = 0;
59923             }
59924             if (this.groundTexture === undefined) {
59925                 this.groundTexture = null;
59926             }
59927             if (this.lightColor === undefined) {
59928                 this.lightColor = 0;
59929             }
59930             if (this.wallsAlpha === undefined) {
59931                 this.wallsAlpha = 0;
59932             }
59933             if (this.furnitureSortedProperty === undefined) {
59934                 this.furnitureSortedProperty = null;
59935             }
59936             if (this.furnitureVisibleProperties === undefined) {
59937                 this.furnitureVisibleProperties = null;
59938             }
59939             if (this.furnitureWithDoorsAndWindows === undefined) {
59940                 this.furnitureWithDoorsAndWindows = null;
59941             }
59942             if (this.furnitureWithGroups === undefined) {
59943                 this.furnitureWithGroups = null;
59944             }
59945         }
59946         else
59947             throw new Error('invalid overload');
59948     }
59949     Home.LEVEL_ELEVATION_COMPARATOR_$LI$ = function () {
59950         if (Home.LEVEL_ELEVATION_COMPARATOR == null) {
59951             Home.LEVEL_ELEVATION_COMPARATOR = function (level1, level2) {
59952                 var elevationComparison = (level1.getElevation() - level2.getElevation());
59953                 if (elevationComparison !== 0) {
59954                     return elevationComparison;
59955                 }
59956                 else {
59957                     return level1.getElevationIndex() - level2.getElevationIndex();
59958                 }
59959             };
59960         }
59961         return Home.LEVEL_ELEVATION_COMPARATOR;
59962     };
59963     Home.prototype.moveVisualProperty = function (visualPropertyName) {
59964         var _this = this;
59965         if ( /* containsKey */this.visualProperties.hasOwnProperty(visualPropertyName)) {
59966             var value = (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.visualProperties, visualPropertyName);
59967             /* put */ (this.properties[visualPropertyName] = value != null ? /* valueOf */ String(value).toString() : null);
59968             /* remove */ (function (map) { var deleted = _this.visualProperties[visualPropertyName]; delete _this.visualProperties[visualPropertyName]; return deleted; })(this.visualProperties);
59969         }
59970     };
59971     Home.prototype.init = function (newHome) {
59972         this.selectedItems = ([]);
59973         Home.initListenersSupport(this);
59974         if (this.furnitureVisibleProperties == null) {
59975             this.furnitureVisibleProperties = /* asList */ ["NAME", "WIDTH", "DEPTH", "HEIGHT", "COLOR", "MOVABLE", "DOOR_OR_WINDOW", "VISIBLE"].slice(0);
59976         }
59977         this.topCamera = new Camera(Home.HOME_TOP_CAMERA_ID, 50, 1050, 1010, Math.PI, Math.PI / 4, Math.PI * 63 / 180);
59978         this.observerCamera = new ObserverCamera(Home.HOME_OBSERVER_CAMERA_ID, 50, 50, 170, 7 * Math.PI / 4, Math.PI / 16, Math.PI * 63 / 180);
59979         this.storedCameras = /* emptyList */ [];
59980         this.environment = new HomeEnvironment(Home.HOME_ENVIRONMENT_ID);
59981         this.rooms = ([]);
59982         this.polylines = ([]);
59983         this.dimensionLines = ([]);
59984         this.labels = ([]);
59985         this.compass = new Compass(Home.HOME_COMPASS_ID, -100, 50, 100);
59986         this.levels = ([]);
59987         this.compass.setVisible(newHome);
59988         this.visualProperties = ({});
59989         this.properties = ({});
59990         this.furnitureAdditionalProperties = ([]);
59991         this.version = Home.CURRENT_VERSION;
59992     };
59993     Home.initListenersSupport = function (home) {
59994         home.furnitureChangeSupport = (new CollectionChangeSupport(home));
59995         home.selectionListeners = ([]);
59996         home.levelsChangeSupport = (new CollectionChangeSupport(home));
59997         home.wallsChangeSupport = (new CollectionChangeSupport(home));
59998         home.roomsChangeSupport = (new CollectionChangeSupport(home));
59999         home.polylinesChangeSupport = (new CollectionChangeSupport(home));
60000         home.dimensionLinesChangeSupport = (new CollectionChangeSupport(home));
60001         home.labelsChangeSupport = (new CollectionChangeSupport(home));
60002         home.propertyChangeSupport = new PropertyChangeSupport(home);
60003     };
60004     /**
60005      * Adds listeners to model.
60006      * @private
60007      */
60008     Home.prototype.addModelListeners = function () {
60009         var levelElevationChangeListener = new Home.Home$0(this);
60010         for (var index = 0; index < this.levels.length; index++) {
60011             var level = this.levels[index];
60012             {
60013                 level.addPropertyChangeListener(levelElevationChangeListener);
60014             }
60015         }
60016         this.addLevelsListener(function (ev) {
60017             switch ((ev.getType())) {
60018                 case CollectionEvent.Type.ADD:
60019                     ev.getItem().addPropertyChangeListener(levelElevationChangeListener);
60020                     break;
60021                 case CollectionEvent.Type.DELETE:
60022                     ev.getItem().removePropertyChangeListener(levelElevationChangeListener);
60023                     break;
60024             }
60025         });
60026     };
60027     /**
60028      * Returns <code>true</code> if the given <code>property</code> is compatible
60029      * with the first set of sortable properties that existed in <code>HomePieceOfFurniture</code> class.
60030      * @param {string} property
60031      * @return {boolean}
60032      * @private
60033      */
60034     Home.prototype.isFurnitureSortedPropertyBackwardCompatible = function (property) {
60035         if (property != null) {
60036             switch ((property)) {
60037                 case "NAME":
60038                 case "WIDTH":
60039                 case "DEPTH":
60040                 case "HEIGHT":
60041                 case "MOVABLE":
60042                 case "DOOR_OR_WINDOW":
60043                 case "COLOR":
60044                 case "VISIBLE":
60045                 case "X":
60046                 case "Y":
60047                 case "ELEVATION":
60048                 case "ANGLE":
60049                     return true;
60050                 default:
60051                     return false;
60052             }
60053         }
60054         else {
60055             return false;
60056         }
60057     };
60058     /**
60059      * Returns all the pieces of the given <code>furnitureGroup</code>.
60060      * @param {HomeFurnitureGroup} furnitureGroup
60061      * @return {HomePieceOfFurniture[]}
60062      * @private
60063      */
60064     Home.prototype.getGroupFurniture = function (furnitureGroup) {
60065         var groupFurniture = ([]);
60066         {
60067             var array = furnitureGroup.getFurniture();
60068             for (var index = 0; index < array.length; index++) {
60069                 var piece = array[index];
60070                 {
60071                     if (piece != null && piece instanceof HomeFurnitureGroup) {
60072                         /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(groupFurniture, this.getGroupFurniture(piece));
60073                     }
60074                     else {
60075                         /* add */ (groupFurniture.push(piece) > 0);
60076                     }
60077                 }
60078             }
60079         }
60080         return groupFurniture;
60081     };
60082     /**
60083      * Adds the level <code>listener</code> in parameter to this home.
60084      * @param {Object} listener the listener to add
60085      */
60086     Home.prototype.addLevelsListener = function (listener) {
60087         this.levelsChangeSupport.addCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
60088             return funcInst;
60089         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
60090     };
60091     /**
60092      * Removes the level <code>listener</code> in parameter from this home.
60093      * @param {Object} listener the listener to remove
60094      */
60095     Home.prototype.removeLevelsListener = function (listener) {
60096         this.levelsChangeSupport.removeCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
60097             return funcInst;
60098         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
60099     };
60100     /**
60101      * Returns a collection of the levels of this home.
60102      * @return {Level[]}
60103      */
60104     Home.prototype.getLevels = function () {
60105         return /* unmodifiableList */ this.levels.slice(0);
60106     };
60107     /**
60108      * Adds the given <code>level</code> to the list of levels of this home.
60109      * Once the <code>level</code> is added, level listeners added to this home will receive a
60110      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
60111      * notification, with an {@link CollectionEvent#getType() event type}
60112      * equal to {@link CollectionEvent.Type#ADD}.
60113      * @param {Level} level  the level to add
60114      */
60115     Home.prototype.addLevel = function (level) {
60116         if (level.getElevationIndex() < 0) {
60117             var elevationIndex = 0;
60118             for (var index_2 = 0; index_2 < this.levels.length; index_2++) {
60119                 var homeLevel = this.levels[index_2];
60120                 {
60121                     if (homeLevel.getElevation() === level.getElevation()) {
60122                         elevationIndex = homeLevel.getElevationIndex() + 1;
60123                     }
60124                     else if (homeLevel.getElevation() > level.getElevation()) {
60125                         break;
60126                     }
60127                 }
60128             }
60129             level.setElevationIndex(elevationIndex);
60130         }
60131         this.levels = (this.levels.slice(0));
60132         var index = (function (l, key, c) { var comp = c; if (typeof c != 'function') {
60133             comp = function (a, b) { return c.compare(a, b); };
60134         } var low = 0; var high = l.length - 1; while (low <= high) {
60135             var mid = (low + high) >>> 1;
60136             var midVal = l[mid];
60137             var cmp = comp(midVal, key);
60138             if (cmp < 0)
60139                 low = mid + 1;
60140             else if (cmp > 0)
60141                 high = mid - 1;
60142             else
60143                 return mid;
60144         } return -(low + 1); })(this.levels, level, Home.LEVEL_ELEVATION_COMPARATOR_$LI$());
60145         var levelIndex;
60146         if (index >= 0) {
60147             levelIndex = index;
60148         }
60149         else {
60150             levelIndex = -(index + 1);
60151         }
60152         /* add */ this.levels.splice(levelIndex, 0, level);
60153         this.levelsChangeSupport.fireCollectionChanged(level, levelIndex, CollectionEvent.Type.ADD);
60154     };
60155     /**
60156      * Removes the given <code>level</code> from the set of levels of this home
60157      * and all the furniture, walls, rooms, dimension lines and labels that belong to this level.
60158      * Once the <code>level</code> is removed, level listeners added to this home will receive a
60159      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
60160      * notification, with an {@link CollectionEvent#getType() event type}
60161      * equal to {@link CollectionEvent.Type#DELETE}.
60162      * @param {Level} level  the level to remove
60163      */
60164     Home.prototype.deleteLevel = function (level) {
60165         var index = this.levels.indexOf(level);
60166         if (index !== -1) {
60167             for (var index1 = 0; index1 < this.furniture.length; index1++) {
60168                 var piece = this.furniture[index1];
60169                 {
60170                     if (piece.getLevel() === level) {
60171                         this.deletePieceOfFurniture(piece);
60172                     }
60173                 }
60174             }
60175             for (var index1 = 0; index1 < this.rooms.length; index1++) {
60176                 var room = this.rooms[index1];
60177                 {
60178                     if (room.getLevel() === level) {
60179                         this.deleteRoom(room);
60180                     }
60181                 }
60182             }
60183             for (var index1 = 0; index1 < this.walls.length; index1++) {
60184                 var wall = this.walls[index1];
60185                 {
60186                     if (wall.getLevel() === level) {
60187                         this.deleteWall(wall);
60188                     }
60189                 }
60190             }
60191             for (var index1 = 0; index1 < this.polylines.length; index1++) {
60192                 var polyline = this.polylines[index1];
60193                 {
60194                     if (polyline.getLevel() === level) {
60195                         this.deletePolyline(polyline);
60196                     }
60197                 }
60198             }
60199             for (var index1 = 0; index1 < this.dimensionLines.length; index1++) {
60200                 var dimensionLine = this.dimensionLines[index1];
60201                 {
60202                     if (dimensionLine.getLevel() === level) {
60203                         this.deleteDimensionLine(dimensionLine);
60204                     }
60205                 }
60206             }
60207             for (var index1 = 0; index1 < this.labels.length; index1++) {
60208                 var label = this.labels[index1];
60209                 {
60210                     if (label.getLevel() === level) {
60211                         this.deleteLabel(label);
60212                     }
60213                 }
60214             }
60215             if (this.selectedLevel === level) {
60216                 if ( /* size */this.levels.length === 1) {
60217                     this.setSelectedLevel(null);
60218                     this.setAllLevelsSelection(false);
60219                 }
60220                 else {
60221                     this.setSelectedLevel(/* get */ this.levels[index >= 1 ? index - 1 : index + 1]);
60222                 }
60223             }
60224             if (this.print != null && this.print.getPrintedLevels() != null) {
60225                 var printedLevels = (this.print.getPrintedLevels().slice(0));
60226                 if ( /* remove */(function (a) { var index = a.indexOf(level); if (index >= 0) {
60227                     a.splice(index, 1);
60228                     return true;
60229                 }
60230                 else {
60231                     return false;
60232                 } })(printedLevels)) {
60233                     this.print = new HomePrint(this.print.getPaperOrientation(), this.print.getPaperWidth(), this.print.getPaperHeight(), this.print.getPaperTopMargin(), this.print.getPaperLeftMargin(), this.print.getPaperBottomMargin(), this.print.getPaperRightMargin(), this.print.isFurniturePrinted(), this.print.isPlanPrinted(), printedLevels, this.print.isView3DPrinted(), this.print.getPlanScale(), this.print.getHeaderFormat(), this.print.getFooterFormat());
60234                 }
60235             }
60236             this.levels = (this.levels.slice(0));
60237             /* remove */ this.levels.splice(index, 1)[0];
60238             this.levelsChangeSupport.fireCollectionChanged(level, index, CollectionEvent.Type.DELETE);
60239         }
60240     };
60241     /**
60242      * Returns the selected level in home or <code>null</code> if home has no level.
60243      * @return {Level}
60244      */
60245     Home.prototype.getSelectedLevel = function () {
60246         return this.selectedLevel;
60247     };
60248     /**
60249      * Sets the selected level in home and notifies listeners of the change.
60250      * @param {Level} selectedLevel  the level to select
60251      */
60252     Home.prototype.setSelectedLevel = function (selectedLevel) {
60253         if (selectedLevel !== this.selectedLevel) {
60254             var oldSelectedLevel = this.selectedLevel;
60255             this.selectedLevel = selectedLevel;
60256             this.propertyChangeSupport.firePropertyChange(/* name */ "SELECTED_LEVEL", oldSelectedLevel, selectedLevel);
60257         }
60258     };
60259     /**
60260      * Returns <code>true</code> if the selected items in this home are from all levels.
60261      * @return {boolean}
60262      */
60263     Home.prototype.isAllLevelsSelection = function () {
60264         return this.allLevelsSelection;
60265     };
60266     /**
60267      * Sets whether the selected items in this home are from all levels, and notifies listeners of the change.
60268      * @param {boolean} selectionAtAllLevels
60269      */
60270     Home.prototype.setAllLevelsSelection = function (selectionAtAllLevels) {
60271         if (selectionAtAllLevels !== this.allLevelsSelection) {
60272             this.allLevelsSelection = selectionAtAllLevels;
60273             this.propertyChangeSupport.firePropertyChange(/* name */ "ALL_LEVELS_SELECTION", !selectionAtAllLevels, selectionAtAllLevels);
60274         }
60275     };
60276     /**
60277      * Adds the furniture <code>listener</code> in parameter to this home.
60278      * @param {Object} listener the listener to add
60279      */
60280     Home.prototype.addFurnitureListener = function (listener) {
60281         this.furnitureChangeSupport.addCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
60282             return funcInst;
60283         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
60284     };
60285     /**
60286      * Removes the furniture <code>listener</code> in parameter from this home.
60287      * @param {Object} listener the listener to remove
60288      */
60289     Home.prototype.removeFurnitureListener = function (listener) {
60290         this.furnitureChangeSupport.removeCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
60291             return funcInst;
60292         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
60293     };
60294     /**
60295      * Returns a list of the furniture managed by this home.
60296      * This furniture in this list is always sorted in the index order they were added to home.
60297      * @return {HomePieceOfFurniture[]}
60298      */
60299     Home.prototype.getFurniture = function () {
60300         return /* unmodifiableList */ this.furniture.slice(0);
60301     };
60302     Home.prototype.addPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture = function (piece) {
60303         this.addPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$int(piece, /* size */ this.furniture.length);
60304     };
60305     Home.prototype.addPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$int = function (piece, index) {
60306         this.furniture = (this.furniture.slice(0));
60307         piece.setLevel(this.selectedLevel);
60308         /* add */ this.furniture.splice(index, 0, piece);
60309         this.furnitureChangeSupport.fireCollectionChanged(piece, index, CollectionEvent.Type.ADD);
60310     };
60311     /**
60312      * Adds the <code>piece</code> in parameter at a given <code>index</code>.
60313      * Once the <code>piece</code> is added, furniture listeners added to this home will receive a
60314      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
60315      * notification.
60316      * @param {HomePieceOfFurniture} piece  the piece to add
60317      * @param {number} index  the index at which the piece will be added
60318      */
60319     Home.prototype.addPieceOfFurniture = function (piece, index) {
60320         if (((piece != null && piece instanceof HomePieceOfFurniture) || piece === null) && ((typeof index === 'number') || index === null)) {
60321             return this.addPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$int(piece, index);
60322         }
60323         else if (((piece != null && piece instanceof HomePieceOfFurniture) || piece === null) && index === undefined) {
60324             return this.addPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture(piece);
60325         }
60326         else
60327             throw new Error('invalid overload');
60328     };
60329     /**
60330      * Adds the <code>piece</code> in parameter at the <code>index</code> in the given <code>group</code>.
60331      * Once the <code>piece</code> is added, furniture listeners added to this home will receive a
60332      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
60333      * notification with an event {@link CollectionEvent#getIndex() index} equal to -1.
60334      * @param {HomePieceOfFurniture} piece  the piece to add
60335      * @param {HomeFurnitureGroup} group  the group to which the piece will be added
60336      * @param {number} index  the index at which the piece will be added
60337      */
60338     Home.prototype.addPieceOfFurnitureToGroup = function (piece, group, index) {
60339         piece.setLevel(this.selectedLevel);
60340         group.addPieceOfFurniture(piece, index);
60341         this.furnitureChangeSupport.fireCollectionChanged(piece, CollectionEvent.Type.ADD);
60342     };
60343     /**
60344      * Deletes the <code>piece</code> in parameter from this home.
60345      * Once the <code>piece</code> is deleted, furniture listeners added to this home will receive a
60346      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
60347      * notification. If the removed <code>piece</code> belongs to a group, the
60348      * {@link CollectionEvent#getIndex() index} of the event will be -1.
60349      * @param {HomePieceOfFurniture} piece  the piece to remove
60350      */
60351     Home.prototype.deletePieceOfFurniture = function (piece) {
60352         this.deselectItem(piece);
60353         if (piece != null && piece instanceof HomeFurnitureGroup) {
60354             {
60355                 var array = piece.getAllFurniture();
60356                 for (var index_3 = 0; index_3 < array.length; index_3++) {
60357                     var groupPiece = array[index_3];
60358                     {
60359                         this.deselectItem(groupPiece);
60360                     }
60361                 }
60362             }
60363         }
60364         var index = this.furniture.indexOf(piece);
60365         var group = index === -1 ? this.getPieceOfFurnitureGroup(piece, null, this.furniture) : null;
60366         if (index !== -1 || group != null) {
60367             piece.setLevel(null);
60368             this.furniture = (this.furniture.slice(0));
60369             if (group != null) {
60370                 group.deletePieceOfFurniture(piece);
60371                 this.furnitureChangeSupport.fireCollectionChanged(piece, CollectionEvent.Type.DELETE);
60372             }
60373             else {
60374                 /* remove */ this.furniture.splice(index, 1)[0];
60375                 this.furnitureChangeSupport.fireCollectionChanged(piece, index, CollectionEvent.Type.DELETE);
60376             }
60377         }
60378     };
60379     /**
60380      * Returns the furniture group that contains the given <code>piece</code> or <code>null</code>
60381      * if it can't be found.
60382      * @param {HomePieceOfFurniture} piece
60383      * @param {HomeFurnitureGroup} furnitureGroup
60384      * @param {HomePieceOfFurniture[]} furniture
60385      * @return {HomeFurnitureGroup}
60386      * @private
60387      */
60388     Home.prototype.getPieceOfFurnitureGroup = function (piece, furnitureGroup, furniture) {
60389         for (var index = 0; index < furniture.length; index++) {
60390             var homePiece = furniture[index];
60391             {
60392                 if ( /* equals */(function (o1, o2) { if (o1 && o1.equals) {
60393                     return o1.equals(o2);
60394                 }
60395                 else {
60396                     return o1 === o2;
60397                 } })(homePiece, piece)) {
60398                     return furnitureGroup;
60399                 }
60400                 else if (homePiece != null && homePiece instanceof HomeFurnitureGroup) {
60401                     var group = this.getPieceOfFurnitureGroup(piece, homePiece, homePiece.getFurniture());
60402                     if (group != null) {
60403                         return group;
60404                     }
60405                 }
60406             }
60407         }
60408         return null;
60409     };
60410     /**
60411      * Adds the selection <code>listener</code> in parameter to this home.
60412      * @param {Object} listener the listener to add
60413      */
60414     Home.prototype.addSelectionListener = function (listener) {
60415         /* add */ (this.selectionListeners.push(listener) > 0);
60416     };
60417     /**
60418      * Removes the selection <code>listener</code> in parameter from this home.
60419      * @param {Object} listener the listener to remove
60420      */
60421     Home.prototype.removeSelectionListener = function (listener) {
60422         /* remove */ (function (a) { var index = a.indexOf(listener); if (index >= 0) {
60423             a.splice(index, 1);
60424             return true;
60425         }
60426         else {
60427             return false;
60428         } })(this.selectionListeners);
60429     };
60430     /**
60431      * Returns a list of the selected items in home.
60432      * @return {*[]}
60433      */
60434     Home.prototype.getSelectedItems = function () {
60435         return /* unmodifiableList */ this.selectedItems.slice(0);
60436     };
60437     /**
60438      * Returns <code>true</code> if the given <code>item</code> is selected in this home
60439      * @param {Object} item a selectable item.
60440      * @return {boolean}
60441      */
60442     Home.prototype.isItemSelected = function (item) {
60443         return /* contains */ (this.selectedItems.indexOf((item)) >= 0);
60444     };
60445     /**
60446      * Sets the selected items in home and notifies listeners selection change.
60447      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} selectedItems the list of selected items
60448      */
60449     Home.prototype.setSelectedItems = function (selectedItems) {
60450         var oldSelectedItems = this.selectedItems.slice(0);
60451         this.selectedItems = (selectedItems.slice(0));
60452         if (!(this.selectionListeners.length == 0)) {
60453             var selectionEvent = new SelectionEvent(this, oldSelectedItems, this.getSelectedItems());
60454             var listeners = this.selectionListeners.slice(0);
60455             for (var index = 0; index < listeners.length; index++) {
60456                 var listener = listeners[index];
60457                 {
60458                     listener.selectionChanged(selectionEvent);
60459                 }
60460             }
60461         }
60462     };
60463     /**
60464      * Deselects <code>item</code> if it's selected and notifies listeners selection change.
60465      * @param {Object} item  the item to remove from selected items
60466      */
60467     Home.prototype.deselectItem = function (item) {
60468         var pieceSelectionIndex = this.selectedItems.indexOf(item);
60469         if (pieceSelectionIndex !== -1) {
60470             var selectedItems = (this.getSelectedItems().slice(0));
60471             /* remove */ selectedItems.splice(pieceSelectionIndex, 1)[0];
60472             this.setSelectedItems(selectedItems);
60473         }
60474     };
60475     /**
60476      * Adds the room <code>listener</code> in parameter to this home.
60477      * @param {Object} listener the listener to add
60478      */
60479     Home.prototype.addRoomsListener = function (listener) {
60480         this.roomsChangeSupport.addCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
60481             return funcInst;
60482         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
60483     };
60484     /**
60485      * Removes the room <code>listener</code> in parameter from this home.
60486      * @param {Object} listener the listener to remove
60487      */
60488     Home.prototype.removeRoomsListener = function (listener) {
60489         this.roomsChangeSupport.removeCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
60490             return funcInst;
60491         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
60492     };
60493     /**
60494      * Returns a collection of the rooms of this home.
60495      * @return {Room[]}
60496      */
60497     Home.prototype.getRooms = function () {
60498         return /* unmodifiableList */ this.rooms.slice(0);
60499     };
60500     Home.prototype.addRoom$com_eteks_sweethome3d_model_Room = function (room) {
60501         this.addRoom$com_eteks_sweethome3d_model_Room$int(room, /* size */ this.rooms.length);
60502     };
60503     Home.prototype.addRoom$com_eteks_sweethome3d_model_Room$int = function (room, index) {
60504         this.rooms = (this.rooms.slice(0));
60505         /* add */ this.rooms.splice(index, 0, room);
60506         room.setLevel(this.selectedLevel);
60507         this.roomsChangeSupport.fireCollectionChanged(room, index, CollectionEvent.Type.ADD);
60508     };
60509     /**
60510      * Adds the <code>room</code> in parameter at a given <code>index</code>.
60511      * Once the <code>room</code> is added, room listeners added to this home will receive a
60512      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
60513      * notification, with an {@link CollectionEvent#getType() event type}
60514      * equal to {@link CollectionEvent.Type#ADD}.
60515      * @param {Room} room   the room to add
60516      * @param {number} index  the index at which the room will be added
60517      */
60518     Home.prototype.addRoom = function (room, index) {
60519         if (((room != null && room instanceof Room) || room === null) && ((typeof index === 'number') || index === null)) {
60520             return this.addRoom$com_eteks_sweethome3d_model_Room$int(room, index);
60521         }
60522         else if (((room != null && room instanceof Room) || room === null) && index === undefined) {
60523             return this.addRoom$com_eteks_sweethome3d_model_Room(room);
60524         }
60525         else
60526             throw new Error('invalid overload');
60527     };
60528     /**
60529      * Removes the given <code>room</code> from the set of rooms of this home.
60530      * Once the <code>room</code> is removed, room listeners added to this home will receive a
60531      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
60532      * notification, with an {@link CollectionEvent#getType() event type}
60533      * equal to {@link CollectionEvent.Type#DELETE}.
60534      * @param {Room} room  the room to remove
60535      */
60536     Home.prototype.deleteRoom = function (room) {
60537         this.deselectItem(room);
60538         var index = this.rooms.indexOf(room);
60539         if (index !== -1) {
60540             room.setLevel(null);
60541             this.rooms = (this.rooms.slice(0));
60542             /* remove */ this.rooms.splice(index, 1)[0];
60543             this.roomsChangeSupport.fireCollectionChanged(room, index, CollectionEvent.Type.DELETE);
60544         }
60545     };
60546     /**
60547      * Adds the wall <code>listener</code> in parameter to this home.
60548      * @param {Object} listener the listener to add
60549      */
60550     Home.prototype.addWallsListener = function (listener) {
60551         this.wallsChangeSupport.addCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
60552             return funcInst;
60553         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
60554     };
60555     /**
60556      * Removes the wall <code>listener</code> in parameter from this home.
60557      * @param {Object} listener the listener to remove
60558      */
60559     Home.prototype.removeWallsListener = function (listener) {
60560         this.wallsChangeSupport.removeCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
60561             return funcInst;
60562         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
60563     };
60564     /**
60565      * Returns a collection of the walls of this home.
60566      * @return {Wall[]}
60567      */
60568     Home.prototype.getWalls = function () {
60569         return /* unmodifiableCollection */ this.walls.slice(0);
60570     };
60571     /**
60572      * Adds the given <code>wall</code> to the set of walls of this home.
60573      * Once the <code>wall</code> is added, wall listeners added to this home will receive a
60574      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
60575      * notification, with an {@link CollectionEvent#getType() event type}
60576      * equal to {@link CollectionEvent.Type#ADD}.
60577      * @param {Wall} wall  the wall to add
60578      */
60579     Home.prototype.addWall = function (wall) {
60580         this.walls = (this.walls.slice(0));
60581         /* add */ (this.walls.push(wall) > 0);
60582         wall.setLevel(this.selectedLevel);
60583         this.wallsChangeSupport.fireCollectionChanged(wall, CollectionEvent.Type.ADD);
60584     };
60585     /**
60586      * Removes the given <code>wall</code> from the set of walls of this home.
60587      * Once the <code>wall</code> is removed, wall listeners added to this home will receive a
60588      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
60589      * notification, with an {@link CollectionEvent#getType() event type}
60590      * equal to {@link CollectionEvent.Type#DELETE}.
60591      * If any wall is attached to <code>wall</code> they will be detached from it.
60592      * @param {Wall} wall  the wall to remove
60593      */
60594     Home.prototype.deleteWall = function (wall) {
60595         this.deselectItem(wall);
60596         {
60597             var array = this.getWalls();
60598             for (var index_4 = 0; index_4 < array.length; index_4++) {
60599                 var otherWall = array[index_4];
60600                 {
60601                     if ( /* equals */(function (o1, o2) { if (o1 && o1.equals) {
60602                         return o1.equals(o2);
60603                     }
60604                     else {
60605                         return o1 === o2;
60606                     } })(wall, otherWall.getWallAtStart())) {
60607                         otherWall.setWallAtStart(null);
60608                     }
60609                     else if ( /* equals */(function (o1, o2) { if (o1 && o1.equals) {
60610                         return o1.equals(o2);
60611                     }
60612                     else {
60613                         return o1 === o2;
60614                     } })(wall, otherWall.getWallAtEnd())) {
60615                         otherWall.setWallAtEnd(null);
60616                     }
60617                 }
60618             }
60619         }
60620         var index = this.walls.indexOf(wall);
60621         if (index !== -1) {
60622             wall.setLevel(null);
60623             this.walls = (this.walls.slice(0));
60624             /* remove */ this.walls.splice(index, 1)[0];
60625             this.wallsChangeSupport.fireCollectionChanged(wall, CollectionEvent.Type.DELETE);
60626         }
60627     };
60628     /**
60629      * Adds the polyline <code>listener</code> in parameter to this home.
60630      * @param {Object} listener the listener to add
60631      */
60632     Home.prototype.addPolylinesListener = function (listener) {
60633         this.polylinesChangeSupport.addCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
60634             return funcInst;
60635         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
60636     };
60637     /**
60638      * Removes the polyline <code>listener</code> in parameter from this home.
60639      * @param {Object} listener the listener to remove
60640      */
60641     Home.prototype.removePolylinesListener = function (listener) {
60642         this.polylinesChangeSupport.removeCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
60643             return funcInst;
60644         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
60645     };
60646     /**
60647      * Returns a collection of the polylines of this home.
60648      * @return {Polyline[]}
60649      */
60650     Home.prototype.getPolylines = function () {
60651         return /* unmodifiableList */ this.polylines.slice(0);
60652     };
60653     Home.prototype.addPolyline$com_eteks_sweethome3d_model_Polyline = function (polyline) {
60654         this.addPolyline$com_eteks_sweethome3d_model_Polyline$int(polyline, /* size */ this.polylines.length);
60655     };
60656     Home.prototype.addPolyline$com_eteks_sweethome3d_model_Polyline$int = function (polyline, index) {
60657         this.polylines = (this.polylines.slice(0));
60658         /* add */ this.polylines.splice(index, 0, polyline);
60659         polyline.setLevel(this.selectedLevel);
60660         this.polylinesChangeSupport.fireCollectionChanged(polyline, CollectionEvent.Type.ADD);
60661     };
60662     /**
60663      * Adds a <code>polyline</code> at a given <code>index</code> of the set of polylines of this home.
60664      * Once the <code>polyline</code> is added, polyline listeners added to this home will receive a
60665      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
60666      * notification, with an {@link CollectionEvent#getType() event type}
60667      * equal to {@link CollectionEvent.Type#ADD}.
60668      * @param {Polyline} polyline  the polyline to add
60669      * @param {number} index  the index at which the polyline will be added
60670      */
60671     Home.prototype.addPolyline = function (polyline, index) {
60672         if (((polyline != null && polyline instanceof Polyline) || polyline === null) && ((typeof index === 'number') || index === null)) {
60673             return this.addPolyline$com_eteks_sweethome3d_model_Polyline$int(polyline, index);
60674         }
60675         else if (((polyline != null && polyline instanceof Polyline) || polyline === null) && index === undefined) {
60676             return this.addPolyline$com_eteks_sweethome3d_model_Polyline(polyline);
60677         }
60678         else
60679             throw new Error('invalid overload');
60680     };
60681     /**
60682      * Removes a given <code>polyline</code> from the set of polylines of this home.
60683      * Once the <code>polyline</code> is removed, polyline listeners added to this home will receive a
60684      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
60685      * notification, with an {@link CollectionEvent#getType() event type}
60686      * equal to {@link CollectionEvent.Type#DELETE}.
60687      * @param {Polyline} polyline  the polyline to remove
60688      */
60689     Home.prototype.deletePolyline = function (polyline) {
60690         this.deselectItem(polyline);
60691         var index = this.polylines.indexOf(polyline);
60692         if (index !== -1) {
60693             polyline.setLevel(null);
60694             this.polylines = (this.polylines.slice(0));
60695             /* remove */ this.polylines.splice(index, 1)[0];
60696             this.polylinesChangeSupport.fireCollectionChanged(polyline, CollectionEvent.Type.DELETE);
60697         }
60698     };
60699     /**
60700      * Adds the dimension line <code>listener</code> in parameter to this home.
60701      * @param {Object} listener the listener to add
60702      */
60703     Home.prototype.addDimensionLinesListener = function (listener) {
60704         this.dimensionLinesChangeSupport.addCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
60705             return funcInst;
60706         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
60707     };
60708     /**
60709      * Removes the dimension line <code>listener</code> in parameter from this home.
60710      * @param {Object} listener the listener to remove
60711      */
60712     Home.prototype.removeDimensionLinesListener = function (listener) {
60713         this.dimensionLinesChangeSupport.removeCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
60714             return funcInst;
60715         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
60716     };
60717     /**
60718      * Returns a collection of the dimension lines of this home.
60719      * @return {DimensionLine[]}
60720      */
60721     Home.prototype.getDimensionLines = function () {
60722         return /* unmodifiableCollection */ this.dimensionLines.slice(0);
60723     };
60724     /**
60725      * Adds the given dimension line to the set of dimension lines of this home.
60726      * Once <code>dimensionLine</code> is added, dimension line listeners added
60727      * to this home will receive a
60728      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
60729      * notification, with an {@link CollectionEvent#getType() event type}
60730      * equal to {@link CollectionEvent.Type#ADD}.
60731      * @param {DimensionLine} dimensionLine  the dimension line to add
60732      */
60733     Home.prototype.addDimensionLine = function (dimensionLine) {
60734         this.dimensionLines = (this.dimensionLines.slice(0));
60735         /* add */ (this.dimensionLines.push(dimensionLine) > 0);
60736         dimensionLine.setLevel(this.selectedLevel);
60737         this.dimensionLinesChangeSupport.fireCollectionChanged(dimensionLine, CollectionEvent.Type.ADD);
60738     };
60739     /**
60740      * Removes the given dimension line from the set of dimension lines of this home.
60741      * Once <code>dimensionLine</code> is removed, dimension line listeners added
60742      * to this home will receive a
60743      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
60744      * notification, with an {@link CollectionEvent#getType() event type}
60745      * equal to {@link CollectionEvent.Type#DELETE}.
60746      * @param {DimensionLine} dimensionLine  the dimension line to remove
60747      */
60748     Home.prototype.deleteDimensionLine = function (dimensionLine) {
60749         this.deselectItem(dimensionLine);
60750         var index = this.dimensionLines.indexOf(dimensionLine);
60751         if (index !== -1) {
60752             dimensionLine.setLevel(null);
60753             this.dimensionLines = (this.dimensionLines.slice(0));
60754             /* remove */ this.dimensionLines.splice(index, 1)[0];
60755             this.dimensionLinesChangeSupport.fireCollectionChanged(dimensionLine, CollectionEvent.Type.DELETE);
60756         }
60757     };
60758     /**
60759      * Adds the label <code>listener</code> in parameter to this home.
60760      * @param {Object} listener the listener to add
60761      */
60762     Home.prototype.addLabelsListener = function (listener) {
60763         this.labelsChangeSupport.addCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
60764             return funcInst;
60765         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
60766     };
60767     /**
60768      * Removes the label <code>listener</code> in parameter from this home.
60769      * @param {Object} listener the listener to remove
60770      */
60771     Home.prototype.removeLabelsListener = function (listener) {
60772         this.labelsChangeSupport.removeCollectionListener(((function (funcInst) { if (funcInst == null || typeof funcInst == 'function') {
60773             return funcInst;
60774         } return function (ev) { return (funcInst['collectionChanged'] ? funcInst['collectionChanged'] : funcInst).call(funcInst, ev); }; })(listener)));
60775     };
60776     /**
60777      * Returns a collection of the labels of this home.
60778      * @return {Label[]}
60779      */
60780     Home.prototype.getLabels = function () {
60781         return /* unmodifiableCollection */ this.labels.slice(0);
60782     };
60783     /**
60784      * Adds the given label to the set of labels of this home.
60785      * Once <code>label</code> is added, label listeners added
60786      * to this home will receive a
60787      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
60788      * notification, with an {@link CollectionEvent#getType() event type}
60789      * equal to {@link CollectionEvent.Type#ADD}.
60790      * @param {Label} label  the label to add
60791      */
60792     Home.prototype.addLabel = function (label) {
60793         this.labels = (this.labels.slice(0));
60794         /* add */ (this.labels.push(label) > 0);
60795         label.setLevel(this.selectedLevel);
60796         this.labelsChangeSupport.fireCollectionChanged(label, CollectionEvent.Type.ADD);
60797     };
60798     /**
60799      * Removes the given label from the set of labels of this home.
60800      * Once <code>label</code> is removed, label listeners added to this home will receive a
60801      * {@link CollectionListener#collectionChanged(CollectionEvent) collectionChanged}
60802      * notification, with an {@link CollectionEvent#getType() event type}
60803      * equal to {@link CollectionEvent.Type#DELETE}.
60804      * @param {Label} label  the label to remove
60805      */
60806     Home.prototype.deleteLabel = function (label) {
60807         this.deselectItem(label);
60808         var index = this.labels.indexOf(label);
60809         if (index !== -1) {
60810             label.setLevel(null);
60811             this.labels = (this.labels.slice(0));
60812             /* remove */ this.labels.splice(index, 1)[0];
60813             this.labelsChangeSupport.fireCollectionChanged(label, CollectionEvent.Type.DELETE);
60814         }
60815     };
60816     /**
60817      * Returns all the selectable and viewable items in this home, except the observer camera.
60818      * @return {*[]} a list containing viewable walls, rooms, furniture, dimension lines, polylines, labels and compass.
60819      */
60820     Home.prototype.getSelectableViewableItems = function () {
60821         var items = ([]);
60822         this.addViewableItems(this.walls, items);
60823         this.addViewableItems(this.rooms, items);
60824         this.addViewableItems(this.dimensionLines, items);
60825         this.addViewableItems(this.polylines, items);
60826         this.addViewableItems(this.labels, items);
60827         {
60828             var array = this.getFurniture();
60829             for (var index = 0; index < array.length; index++) {
60830                 var piece = array[index];
60831                 {
60832                     if (piece.isVisible() && (piece.getLevel() == null || piece.getLevel().isViewable())) {
60833                         /* add */ (items.push(piece) > 0);
60834                     }
60835                 }
60836             }
60837         }
60838         if (this.compass.isVisible()) {
60839             /* add */ (items.push(this.compass) > 0);
60840         }
60841         return items;
60842     };
60843     /**
60844      * Adds the viewable items to the set of selectable viewable items.
60845      * @param {*[]} items
60846      * @param {*[]} selectableViewableItems
60847      * @private
60848      */
60849     Home.prototype.addViewableItems = function (items, selectableViewableItems) {
60850         for (var index = 0; index < items.length; index++) {
60851             var item = items[index];
60852             {
60853                 if (item != null && (item.constructor != null && item.constructor["__interfaces"] != null && item.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Elevatable") >= 0)) {
60854                     var elevatableItem = item;
60855                     if (elevatableItem.getLevel() == null || elevatableItem.getLevel().isViewable()) {
60856                         /* add */ (selectableViewableItems.push(item) > 0);
60857                     }
60858                 }
60859             }
60860         }
60861     };
60862     /**
60863      * Returns all the mutable objects handled by this home.
60864      * @return {HomeObject[]} a list containing environment, compass, levels, walls, rooms, furniture and their possible children,
60865      * polylines, dimension lines, labels and cameras.
60866      */
60867     Home.prototype.getHomeObjects = function () {
60868         var homeItems = ([]);
60869         /* add */ (homeItems.push(this.environment) > 0);
60870         /* add */ (homeItems.push(this.compass) > 0);
60871         /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(homeItems, this.levels);
60872         /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(homeItems, this.walls);
60873         /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(homeItems, this.rooms);
60874         /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(homeItems, this.dimensionLines);
60875         /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(homeItems, this.polylines);
60876         /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(homeItems, this.labels);
60877         {
60878             var array = this.getFurniture();
60879             for (var index = 0; index < array.length; index++) {
60880                 var piece = array[index];
60881                 {
60882                     /* add */ (homeItems.push(piece) > 0);
60883                     if (piece != null && piece instanceof HomeFurnitureGroup) {
60884                         /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(homeItems, piece.getAllFurniture());
60885                     }
60886                 }
60887             }
60888         }
60889         /* add */ (homeItems.push(this.topCamera) > 0);
60890         /* add */ (homeItems.push(this.observerCamera) > 0);
60891         /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(homeItems, this.storedCameras);
60892         /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(homeItems, this.environment.getVideoCameraPath());
60893         return homeItems;
60894     };
60895     /**
60896      * Returns <code>true</code> if this home doesn't contain any item i.e.
60897      * no piece of furniture, no wall, no room, no dimension line and no label.
60898      * @return {boolean}
60899      */
60900     Home.prototype.isEmpty = function () {
60901         return /* isEmpty */ (this.furniture.length == 0) && /* isEmpty */ (this.walls.length == 0) && /* isEmpty */ (this.rooms.length == 0) && /* isEmpty */ (this.dimensionLines.length == 0) && /* isEmpty */ (this.polylines.length == 0) && /* isEmpty */ (this.labels.length == 0);
60902     };
60903     /**
60904      * Returns the wall height of this home.
60905      * @return {number}
60906      */
60907     Home.prototype.getWallHeight = function () {
60908         return this.wallHeight;
60909     };
60910     /**
60911      * Returns the name of this home.
60912      * @return {string}
60913      */
60914     Home.prototype.getName = function () {
60915         return this.name;
60916     };
60917     /**
60918      * Sets the name of this home and fires a <code>PropertyChangeEvent</code>.
60919      * @param {string} name  the new name of this home
60920      */
60921     Home.prototype.setName = function (name) {
60922         if (name !== this.name && (name == null || !(name === this.name))) {
60923             var oldName = this.name;
60924             this.name = name;
60925             this.propertyChangeSupport.firePropertyChange(/* name */ "NAME", oldName, name);
60926         }
60927     };
60928     /**
60929      * Returns whether the state of this home is modified or not.
60930      * @return {boolean}
60931      */
60932     Home.prototype.isModified = function () {
60933         return this.modified;
60934     };
60935     /**
60936      * Sets the modified state of this home and fires a <code>PropertyChangeEvent</code>.
60937      * @param {boolean} modified
60938      */
60939     Home.prototype.setModified = function (modified) {
60940         if (modified !== this.modified) {
60941             this.modified = modified;
60942             this.propertyChangeSupport.firePropertyChange(/* name */ "MODIFIED", !modified, modified);
60943         }
60944     };
60945     /**
60946      * Returns whether this home was recovered or not.
60947      * @return {boolean}
60948      */
60949     Home.prototype.isRecovered = function () {
60950         return this.recovered;
60951     };
60952     /**
60953      * Sets whether this home was recovered or not and fires a <code>PropertyChangeEvent</code>.
60954      * @param {boolean} recovered
60955      */
60956     Home.prototype.setRecovered = function (recovered) {
60957         if (recovered !== this.recovered) {
60958             this.recovered = recovered;
60959             this.propertyChangeSupport.firePropertyChange(/* name */ "RECOVERED", !recovered, recovered);
60960         }
60961     };
60962     /**
60963      * Returns whether this home was repaired or not.
60964      * @return {boolean}
60965      */
60966     Home.prototype.isRepaired = function () {
60967         return this.repaired;
60968     };
60969     /**
60970      * Sets whether this home is repaired or not and fires a <code>PropertyChangeEvent</code>.
60971      * @param {boolean} repaired
60972      */
60973     Home.prototype.setRepaired = function (repaired) {
60974         if (repaired !== this.repaired) {
60975             this.repaired = repaired;
60976             this.propertyChangeSupport.firePropertyChange(/* name */ "REPAIRED", !repaired, repaired);
60977         }
60978     };
60979     /**
60980      * Returns the furniture property name on which home is sorted or <code>null</code> if
60981      * home furniture isn't sorted.
60982      * @return {string}
60983      */
60984     Home.prototype.getFurnitureSortedPropertyName = function () {
60985         return this.furnitureSortedPropertyName;
60986     };
60987     /**
60988      * Sets the furniture property name on which this home should be sorted
60989      * and fires a <code>PropertyChangeEvent</code>.
60990      * @param {string} furnitureSortedPropertyName the name of the property
60991      */
60992     Home.prototype.setFurnitureSortedPropertyName = function (furnitureSortedPropertyName) {
60993         if (furnitureSortedPropertyName !== this.furnitureSortedPropertyName && (furnitureSortedPropertyName == null || !(furnitureSortedPropertyName === this.furnitureSortedPropertyName))) {
60994             var oldFurnitureSortedPropertyName = this.furnitureSortedPropertyName;
60995             this.furnitureSortedPropertyName = furnitureSortedPropertyName;
60996             try {
60997                 this.furnitureSortedProperty = furnitureSortedPropertyName != null ? /* valueOf */ furnitureSortedPropertyName : null;
60998             }
60999             catch (ex) {
61000                 this.furnitureSortedProperty = null;
61001             }
61002             this.propertyChangeSupport.firePropertyChange(/* name */ "FURNITURE_SORTED_PROPERTY", oldFurnitureSortedPropertyName, furnitureSortedPropertyName);
61003         }
61004     };
61005     /**
61006      * Returns the furniture property on which home is sorted or <code>null</code> if
61007      * home furniture isn't sorted.
61008      * @deprecated {@link #getFurnitureSortedProperty()} and {@link #setFurnitureSortedProperty(HomePieceOfFurniture.SortableProperty)}
61009      * should be replaced by calls to {@link #getFurnitureSortedPropertyName()} and {@link #setFurnitureSortedPropertyName(String)}
61010      * to allow sorting on additional properties.
61011      * @return {string}
61012      */
61013     Home.prototype.getFurnitureSortedProperty = function () {
61014         return this.furnitureSortedProperty;
61015     };
61016     /**
61017      * Sets the furniture property on which this home should be sorted
61018      * and fires a <code>PropertyChangeEvent</code>.
61019      * @param {string} furnitureSortedProperty the new property
61020      * @deprecated {@link #getFurnitureSortedProperty()} and {@link #setFurnitureSortedProperty(HomePieceOfFurniture.SortableProperty)}
61021      * should be replaced by calls to {@link #getFurnitureSortedPropertyName()} and {@link #setFurnitureSortedPropertyName(String)}
61022      * to allow sorting on additional properties.
61023      */
61024     Home.prototype.setFurnitureSortedProperty = function (furnitureSortedProperty) {
61025         if (furnitureSortedProperty !== this.furnitureSortedProperty && (furnitureSortedProperty == null || !(furnitureSortedProperty == this.furnitureSortedProperty))) {
61026             var oldFurnitureSortedProperty = this.furnitureSortedProperty;
61027             this.furnitureSortedProperty = furnitureSortedProperty;
61028             this.furnitureSortedPropertyName = furnitureSortedProperty != null ? /* name */ furnitureSortedProperty : null;
61029             this.propertyChangeSupport.firePropertyChange(/* name */ "FURNITURE_SORTED_PROPERTY", oldFurnitureSortedProperty, furnitureSortedProperty);
61030         }
61031     };
61032     /**
61033      * Returns whether furniture is sorted in ascending or descending order.
61034      * @return {boolean}
61035      */
61036     Home.prototype.isFurnitureDescendingSorted = function () {
61037         return this.furnitureDescendingSorted;
61038     };
61039     /**
61040      * Sets the furniture sort order on which home should be sorted
61041      * and fires a <code>PropertyChangeEvent</code>.
61042      * @param {boolean} furnitureDescendingSorted
61043      */
61044     Home.prototype.setFurnitureDescendingSorted = function (furnitureDescendingSorted) {
61045         if (furnitureDescendingSorted !== this.furnitureDescendingSorted) {
61046             this.furnitureDescendingSorted = furnitureDescendingSorted;
61047             this.propertyChangeSupport.firePropertyChange(/* name */ "FURNITURE_DESCENDING_SORTED", !furnitureDescendingSorted, furnitureDescendingSorted);
61048         }
61049     };
61050     /**
61051      * Returns a list of the furniture property names that are visible.
61052      * @return {string[]}
61053      */
61054     Home.prototype.getFurnitureVisiblePropertyNames = function () {
61055         if (this.furnitureVisiblePropertyNames == null) {
61056             return /* emptyList */ [];
61057         }
61058         else {
61059             return /* unmodifiableList */ this.furnitureVisiblePropertyNames.slice(0);
61060         }
61061     };
61062     /**
61063      * Sets the furniture property names that are visible and the order in which they are visible,
61064      * then fires a <code>PropertyChangeEvent</code>.
61065      * @param {string[]} furnitureVisiblePropertyNames  the property names to display
61066      */
61067     Home.prototype.setFurnitureVisiblePropertyNames = function (furnitureVisiblePropertyNames) {
61068         if (furnitureVisiblePropertyNames !== this.furnitureVisiblePropertyNames && (furnitureVisiblePropertyNames == null || !(function (a1, a2) { if (a1 == null && a2 == null)
61069             return true; if (a1 == null || a2 == null)
61070             return false; if (a1.length != a2.length)
61071             return false; for (var i = 0; i < a1.length; i++) {
61072             if (a1[i] != a2[i])
61073                 return false;
61074         } return true; })(furnitureVisiblePropertyNames, this.furnitureVisiblePropertyNames))) {
61075             var oldFurnitureVisiblePropertyNames = this.furnitureVisiblePropertyNames;
61076             this.furnitureVisiblePropertyNames = (furnitureVisiblePropertyNames.slice(0));
61077             this.furnitureVisibleProperties = ([]);
61078             for (var index = 0; index < furnitureVisiblePropertyNames.length; index++) {
61079                 var propertyName = furnitureVisiblePropertyNames[index];
61080                 {
61081                     try {
61082                         /* add */ (this.furnitureVisibleProperties.push(/* valueOf */ propertyName) > 0);
61083                     }
61084                     catch (ex) {
61085                     }
61086                 }
61087             }
61088             this.propertyChangeSupport.firePropertyChange(/* name */ "FURNITURE_VISIBLE_PROPERTIES", /* unmodifiableList */ oldFurnitureVisiblePropertyNames.slice(0), /* unmodifiableList */ furnitureVisiblePropertyNames.slice(0));
61089         }
61090     };
61091     /**
61092      * Returns a list of the furniture properties that are visible.
61093      * @deprecated {@link #getFurnitureVisibleProperties()} and {@link #setFurnitureVisibleProperties(List<HomePieceOfFurniture.SortableProperty>)}
61094      * should be replaced by calls to {@link #getFurnitureVisiblePropertyNames()} and {@link #setFurnitureSortedPropertyName(List<String>)}
61095      * to allow displaying additional properties.
61096      * @return {string[]}
61097      */
61098     Home.prototype.getFurnitureVisibleProperties = function () {
61099         if (this.furnitureVisibleProperties == null) {
61100             return /* emptyList */ [];
61101         }
61102         else {
61103             return /* unmodifiableList */ this.furnitureVisibleProperties.slice(0);
61104         }
61105     };
61106     /**
61107      * Sets the furniture properties that are visible and the order in which they are visible,
61108      * then fires a <code>PropertyChangeEvent</code>.
61109      * @param {string[]} furnitureVisibleProperties  the properties to display
61110      * @deprecated {@link #getFurnitureVisibleProperties()} and {@link #setFurnitureVisibleProperties(List<HomePieceOfFurniture.SortableProperty>)}
61111      * should be replaced by calls to {@link #getFurnitureVisiblePropertyNames()} and {@link #setFurnitureSortedPropertyName(List<String>)}
61112      * to allow displaying additional properties.
61113      */
61114     Home.prototype.setFurnitureVisibleProperties = function (furnitureVisibleProperties) {
61115         if (furnitureVisibleProperties !== this.furnitureVisibleProperties && (furnitureVisibleProperties == null || !(function (a1, a2) { if (a1 == null && a2 == null)
61116             return true; if (a1 == null || a2 == null)
61117             return false; if (a1.length != a2.length)
61118             return false; for (var i = 0; i < a1.length; i++) {
61119             if (a1[i] != a2[i])
61120                 return false;
61121         } return true; })(furnitureVisibleProperties, this.furnitureVisibleProperties))) {
61122             var oldFurnitureVisibleProperties = this.furnitureVisibleProperties;
61123             this.furnitureVisibleProperties = (furnitureVisibleProperties.slice(0));
61124             this.furnitureVisiblePropertyNames = ([]);
61125             for (var index = 0; index < furnitureVisibleProperties.length; index++) {
61126                 var property = furnitureVisibleProperties[index];
61127                 {
61128                     /* add */ (this.furnitureVisiblePropertyNames.push(/* name */ property) > 0);
61129                 }
61130             }
61131             this.propertyChangeSupport.firePropertyChange(/* name */ "FURNITURE_VISIBLE_PROPERTIES", /* unmodifiableList */ oldFurnitureVisibleProperties.slice(0), /* unmodifiableList */ furnitureVisibleProperties.slice(0));
61132         }
61133     };
61134     /**
61135      * Returns the list of furniture additional properties which should be handled in the user interface.
61136      * @return {ObjectProperty[]}
61137      */
61138     Home.prototype.getFurnitureAdditionalProperties = function () {
61139         return /* unmodifiableList */ this.furnitureAdditionalProperties.slice(0);
61140     };
61141     /**
61142      * Sets the list of furniture additional properties which should be handled in the user interface.
61143      * @param {ObjectProperty[]} furnitureAdditionalProperties
61144      */
61145     Home.prototype.setFurnitureAdditionalProperties = function (furnitureAdditionalProperties) {
61146         if (furnitureAdditionalProperties !== this.furnitureAdditionalProperties && (furnitureAdditionalProperties == null || !(function (a1, a2) { if (a1 == null && a2 == null)
61147             return true; if (a1 == null || a2 == null)
61148             return false; if (a1.length != a2.length)
61149             return false; for (var i = 0; i < a1.length; i++) {
61150             if (a1[i] != a2[i])
61151                 return false;
61152         } return true; })(furnitureAdditionalProperties, this.furnitureAdditionalProperties))) {
61153             var oldFurnitureAdditionalProperties = this.furnitureAdditionalProperties;
61154             this.furnitureAdditionalProperties = (furnitureAdditionalProperties.slice(0));
61155             var furnitureVisiblePropertyNames = (this.getFurnitureVisiblePropertyNames().slice(0));
61156             for (var i = furnitureVisiblePropertyNames.length - 1; i >= 0; i--) {
61157                 {
61158                     try {
61159                         /* valueOf */ /* get */ furnitureVisiblePropertyNames[i];
61160                     }
61161                     catch (ex) {
61162                         if (!(furnitureAdditionalProperties.indexOf((new ObjectProperty(/* get */ furnitureVisiblePropertyNames[i]))) >= 0)) {
61163                             /* remove */ furnitureVisiblePropertyNames.splice(i, 1)[0];
61164                         }
61165                     }
61166                 }
61167                 ;
61168             }
61169             this.setFurnitureVisiblePropertyNames(furnitureVisiblePropertyNames);
61170             if (this.getFurnitureSortedPropertyName() != null && !(furnitureAdditionalProperties.indexOf((new ObjectProperty(this.getFurnitureSortedPropertyName()))) >= 0)) {
61171                 this.setFurnitureSortedPropertyName(null);
61172             }
61173             this.propertyChangeSupport.firePropertyChange(/* name */ "FURNITURE_ADDITIONAL_PROPERTIES", /* unmodifiableList */ oldFurnitureAdditionalProperties.slice(0), /* unmodifiableList */ furnitureAdditionalProperties.slice(0));
61174         }
61175     };
61176     /**
61177      * Returns the plan background image of this home.
61178      * @return {BackgroundImage}
61179      */
61180     Home.prototype.getBackgroundImage = function () {
61181         return this.backgroundImage;
61182     };
61183     /**
61184      * Sets the plan background image of this home and fires a <code>PropertyChangeEvent</code>.
61185      * @param {BackgroundImage} backgroundImage  the new background image
61186      */
61187     Home.prototype.setBackgroundImage = function (backgroundImage) {
61188         if (backgroundImage !== this.backgroundImage) {
61189             var oldBackgroundImage = this.backgroundImage;
61190             this.backgroundImage = backgroundImage;
61191             this.propertyChangeSupport.firePropertyChange(/* name */ "BACKGROUND_IMAGE", oldBackgroundImage, backgroundImage);
61192         }
61193     };
61194     /**
61195      * Returns the camera used to display this home from a top point of view.
61196      * @return {Camera}
61197      */
61198     Home.prototype.getTopCamera = function () {
61199         return this.topCamera;
61200     };
61201     /**
61202      * Returns the camera used to display this home from an observer point of view.
61203      * @return {ObserverCamera}
61204      */
61205     Home.prototype.getObserverCamera = function () {
61206         return this.observerCamera;
61207     };
61208     /**
61209      * Sets the camera used to display this home and fires a <code>PropertyChangeEvent</code>.
61210      * @param {Camera} camera  the camera to use
61211      */
61212     Home.prototype.setCamera = function (camera) {
61213         if (camera !== this.camera) {
61214             var oldCamera = this.camera;
61215             this.camera = camera;
61216             this.propertyChangeSupport.firePropertyChange(/* name */ "CAMERA", oldCamera, camera);
61217         }
61218     };
61219     /**
61220      * Returns the camera used to display this home.
61221      * @return {Camera}
61222      */
61223     Home.prototype.getCamera = function () {
61224         if (this.camera == null) {
61225             this.camera = this.getTopCamera();
61226         }
61227         return this.camera;
61228     };
61229     /**
61230      * Sets the cameras stored by this home and fires a <code>PropertyChangeEvent</code>.
61231      * The list given as parameter is cloned but not the camera instances it contains.
61232      * @param {Camera[]} storedCameras  the new list of cameras
61233      */
61234     Home.prototype.setStoredCameras = function (storedCameras) {
61235         if (!(function (a1, a2) { if (a1 == null && a2 == null)
61236             return true; if (a1 == null || a2 == null)
61237             return false; if (a1.length != a2.length)
61238             return false; for (var i = 0; i < a1.length; i++) {
61239             if (a1[i] != a2[i])
61240                 return false;
61241         } return true; })(this.storedCameras, storedCameras)) {
61242             var oldStoredCameras = this.storedCameras;
61243             if (storedCameras == null) {
61244                 this.storedCameras = /* emptyList */ [];
61245             }
61246             else {
61247                 this.storedCameras = (storedCameras.slice(0));
61248             }
61249             this.propertyChangeSupport.firePropertyChange(/* name */ "STORED_CAMERAS", /* unmodifiableList */ oldStoredCameras.slice(0), /* unmodifiableList */ storedCameras.slice(0));
61250         }
61251     };
61252     /**
61253      * Returns a list of the cameras stored by this home.
61254      * @return {Camera[]}
61255      */
61256     Home.prototype.getStoredCameras = function () {
61257         return /* unmodifiableList */ this.storedCameras.slice(0);
61258     };
61259     /**
61260      * Returns the environment attributes of this home.
61261      * @return {HomeEnvironment}
61262      */
61263     Home.prototype.getEnvironment = function () {
61264         return this.environment;
61265     };
61266     /**
61267      * Returns the compass associated to this home.
61268      * @return {Compass}
61269      */
61270     Home.prototype.getCompass = function () {
61271         return this.compass;
61272     };
61273     /**
61274      * Returns the print attributes of this home.
61275      * @return {HomePrint}
61276      */
61277     Home.prototype.getPrint = function () {
61278         return this.print;
61279     };
61280     /**
61281      * Sets the print attributes of this home and fires a <code>PropertyChangeEvent</code>.
61282      * @param {HomePrint} print  the new print attributes
61283      */
61284     Home.prototype.setPrint = function (print) {
61285         if (print !== this.print) {
61286             var oldPrint = this.print;
61287             this.print = print;
61288             this.propertyChangeSupport.firePropertyChange(/* name */ "PRINT", oldPrint, print);
61289         }
61290         this.print = print;
61291     };
61292     /**
61293      * Returns the value of the visual property <code>name</code> associated with this home.
61294      * @deprecated {@link #getVisualProperty(String)} and {@link #setVisualProperty(String, Object)}
61295      * should be replaced by calls to {@link #getProperty(String)} and {@link #setProperty(String, String)}
61296      * to ensure they can be easily saved and read. Future file format might not save visual properties anymore.
61297      * @param {string} name
61298      * @return {Object}
61299      */
61300     Home.prototype.getVisualProperty = function (name) {
61301         return /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.visualProperties, name);
61302     };
61303     /**
61304      * Sets a visual property associated with this home.
61305      * @deprecated {@link #getVisualProperty(String)} and {@link #setVisualProperty(String, Object)}
61306      * should be replaced by calls to {@link #getProperty(String)} and {@link #setProperty(String, String)}
61307      * to ensure they can be easily saved and read. Future file format might not save visual properties anymore.
61308      * @param {string} name
61309      * @param {Object} value
61310      */
61311     Home.prototype.setVisualProperty = function (name, value) {
61312         /* put */ (this.visualProperties[name] = value);
61313     };
61314     /**
61315      * Returns the value of the property <code>name</code> associated with this home.
61316      * @return {string} the value of the property or <code>null</code> if it doesn't exist.
61317      * @param {string} name
61318      */
61319     Home.prototype.getProperty = function (name) {
61320         return /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, name);
61321     };
61322     /**
61323      * Returns the numeric value of the property <code>name</code> associated with this home.
61324      * @return {number} an instance of {@link Long}, {@link Double} or <code>null</code> if the property
61325      * doesn't exist or can't be parsed.
61326      * @param {string} name
61327      */
61328     Home.prototype.getNumericProperty = function (name) {
61329         var value = (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, name);
61330         if (value != null) {
61331             try {
61332                 return new Number(value).valueOf();
61333             }
61334             catch (ex) {
61335                 try {
61336                     return new Number(value).valueOf();
61337                 }
61338                 catch (ex1) {
61339                 }
61340             }
61341         }
61342         return null;
61343     };
61344     /**
61345      * Sets a property associated with this home. Once the property is updated,
61346      * listeners added to this home will receive a change event of
61347      * {@link PropertyChangeEvent} class.<br>
61348      * To avoid any issue with existing or future properties of Sweet Home 3D classes,
61349      * do not use property names written with only upper case letters.
61350      * @param {string} name   the name of the property to set
61351      * @param {string} value  the new value of the property
61352      */
61353     Home.prototype.setProperty = function (name, value) {
61354         var _this = this;
61355         var oldValue = (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, name);
61356         if (value == null) {
61357             if (oldValue != null) {
61358                 /* remove */ (function (map) { var deleted = _this.properties[name]; delete _this.properties[name]; return deleted; })(this.properties);
61359                 this.propertyChangeSupport.firePropertyChange(name, oldValue, null);
61360             }
61361         }
61362         else {
61363             /* put */ (this.properties[name] = value);
61364             this.propertyChangeSupport.firePropertyChange(name, oldValue, value);
61365         }
61366     };
61367     /**
61368      * Returns the property names.
61369      * @return {string[]} a collection of all the names of the properties set with {@link #setProperty(String, String) setProperty}
61370      */
61371     Home.prototype.getPropertyNames = function () {
61372         return /* keySet */ Object.keys(this.properties);
61373     };
61374     /**
61375      * Adds the property change <code>listener</code> in parameter to this home for a specific property name.
61376      * Properties set with {@link #setProperty(String, String) setProperty} will be notified with
61377      * an event of {@link PropertyChangeEvent} class which property name will be equal to the property,
61378      * whereas changes on properties of {@link Property} enum will be notified with an event where
61379      * the property name will be equal to the value returned by {@link Property#name()} call.
61380      * @param {string} propertyName
61381      * @param {PropertyChangeListener} listener
61382      */
61383     Home.prototype.addPropertyChangeListener = function (propertyName, listener) {
61384         this.propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
61385     };
61386     /**
61387      * Removes the property change <code>listener</code> in parameter from this object.
61388      * @param {string} propertyName
61389      * @param {PropertyChangeListener} listener
61390      */
61391     Home.prototype.removePropertyChangeListener = function (propertyName, listener) {
61392         this.propertyChangeSupport.removePropertyChangeListener(propertyName, listener);
61393     };
61394     /**
61395      * Returns <code>true</code> if the home objects belonging to the base plan
61396      * (generally walls, rooms, dimension lines and texts) are locked.
61397      * @return {boolean}
61398      */
61399     Home.prototype.isBasePlanLocked = function () {
61400         return this.basePlanLocked;
61401     };
61402     /**
61403      * Sets whether home objects belonging to the base plan (generally walls, rooms,
61404      * dimension lines and texts) are locked and fires a <code>PropertyChangeEvent</code>.
61405      * @param {boolean} basePlanLocked
61406      */
61407     Home.prototype.setBasePlanLocked = function (basePlanLocked) {
61408         if (basePlanLocked !== this.basePlanLocked) {
61409             this.basePlanLocked = basePlanLocked;
61410             this.propertyChangeSupport.firePropertyChange(/* name */ "BASE_PLAN_LOCKED", !basePlanLocked, basePlanLocked);
61411         }
61412     };
61413     /**
61414      * Returns the version of this home, the last time it was serialized or
61415      * or {@link #CURRENT_VERSION} if it is not serialized yet or
61416      * was serialized with Sweet Home 3D 0.x.
61417      * Version is useful to know with which Sweet Home 3D version this home was saved
61418      * and warn user that he may lose information if he saves with
61419      * current application a home created by a more recent version.
61420      * @return {number}
61421      */
61422     Home.prototype.getVersion = function () {
61423         return this.version;
61424     };
61425     /**
61426      * Sets the version of this home.
61427      * @return {void} version  the new version
61428      * @param {number} version
61429      */
61430     Home.prototype.setVersion = function (version) {
61431         this.version = version;
61432     };
61433     /**
61434      * Returns a clone of this home and the objects it contains.
61435      * Listeners bound to this home aren't added to the returned home.
61436      * @return {Home}
61437      */
61438     Home.prototype.clone = function () {
61439         try {
61440             var clone = (function (o) { var clone = Object.create(o); for (var p in o) {
61441                 if (o.hasOwnProperty(p))
61442                     clone[p] = o[p];
61443             } return clone; })(this);
61444             Home.copyHomeData(this, clone);
61445             Home.initListenersSupport(clone);
61446             clone.addModelListeners();
61447             return clone;
61448         }
61449         catch (ex) {
61450             throw new IllegalStateException("Super class isn\'t cloneable");
61451         }
61452     };
61453     /**
61454      * Copies all data of a <code>source</code> home to a <code>destination</code> home.
61455      * @param {Home} source
61456      * @param {Home} destination
61457      * @private
61458      */
61459     Home.copyHomeData = function (source, destination) {
61460         destination.allLevelsSelection = source.allLevelsSelection;
61461         destination.name = source.name;
61462         destination.modified = source.modified;
61463         destination.recovered = source.recovered;
61464         destination.repaired = source.repaired;
61465         destination.backgroundImage = source.backgroundImage;
61466         destination.furnitureDescendingSorted = source.furnitureDescendingSorted;
61467         destination.version = source.version;
61468         destination.basePlanLocked = source.basePlanLocked;
61469         destination.skyColor = source.skyColor;
61470         destination.groundColor = source.groundColor;
61471         destination.lightColor = source.lightColor;
61472         destination.wallsAlpha = source.wallsAlpha;
61473         destination.furnitureSortedProperty = source.furnitureSortedProperty;
61474         destination.selectedItems = ([]);
61475         destination.furniture = Home.cloneSelectableItems(source.furniture, source.selectedItems, destination.selectedItems);
61476         destination.rooms = Home.cloneSelectableItems(source.rooms, source.selectedItems, destination.selectedItems);
61477         destination.dimensionLines = Home.cloneSelectableItems(source.dimensionLines, source.selectedItems, destination.selectedItems);
61478         destination.polylines = Home.cloneSelectableItems(source.polylines, source.selectedItems, destination.selectedItems);
61479         destination.labels = Home.cloneSelectableItems(source.labels, source.selectedItems, destination.selectedItems);
61480         destination.walls = /* clone */ Wall.clone(source.walls);
61481         for (var i = 0; i < /* size */ source.walls.length; i++) {
61482             {
61483                 var wall = source.walls[i];
61484                 if ( /* contains */(source.selectedItems.indexOf((wall)) >= 0)) {
61485                     /* add */ (destination.selectedItems.push(/* get */ destination.walls[i]) > 0);
61486                 }
61487             }
61488             ;
61489         }
61490         destination.levels = ([]);
61491         if ( /* size */source.levels.length > 0) {
61492             for (var index = 0; index < source.levels.length; index++) {
61493                 var level = source.levels[index];
61494                 {
61495                     /* add */ (destination.levels.push(/* clone */ /* clone */ (function (o) { if (o.clone != undefined) {
61496                         return o.clone();
61497                     }
61498                     else {
61499                         var clone = Object.create(o);
61500                         for (var p in o) {
61501                             if (o.hasOwnProperty(p))
61502                                 clone[p] = o[p];
61503                         }
61504                         return clone;
61505                     } })(level)) > 0);
61506                 }
61507             }
61508             for (var i = 0; i < /* size */ source.furniture.length; i++) {
61509                 {
61510                     var pieceLevel = source.furniture[i].getLevel();
61511                     if (pieceLevel != null) {
61512                         /* get */ destination.furniture[i].setLevel(/* get */ destination.levels[source.levels.indexOf(pieceLevel)]);
61513                     }
61514                 }
61515                 ;
61516             }
61517             for (var i = 0; i < /* size */ source.rooms.length; i++) {
61518                 {
61519                     var roomLevel = source.rooms[i].getLevel();
61520                     if (roomLevel != null) {
61521                         /* get */ destination.rooms[i].setLevel(/* get */ destination.levels[source.levels.indexOf(roomLevel)]);
61522                     }
61523                 }
61524                 ;
61525             }
61526             for (var i = 0; i < /* size */ source.dimensionLines.length; i++) {
61527                 {
61528                     var dimensionLineLevel = source.dimensionLines[i].getLevel();
61529                     if (dimensionLineLevel != null) {
61530                         /* get */ destination.dimensionLines[i].setLevel(/* get */ destination.levels[source.levels.indexOf(dimensionLineLevel)]);
61531                     }
61532                 }
61533                 ;
61534             }
61535             for (var i = 0; i < /* size */ source.polylines.length; i++) {
61536                 {
61537                     var polylineLevel = source.polylines[i].getLevel();
61538                     if (polylineLevel != null) {
61539                         /* get */ destination.polylines[i].setLevel(/* get */ destination.levels[source.levels.indexOf(polylineLevel)]);
61540                     }
61541                 }
61542                 ;
61543             }
61544             for (var i = 0; i < /* size */ source.labels.length; i++) {
61545                 {
61546                     var labelLevel = source.labels[i].getLevel();
61547                     if (labelLevel != null) {
61548                         /* get */ destination.labels[i].setLevel(/* get */ destination.levels[source.levels.indexOf(labelLevel)]);
61549                     }
61550                 }
61551                 ;
61552             }
61553             for (var i = 0; i < /* size */ source.walls.length; i++) {
61554                 {
61555                     var wallLevel = source.walls[i].getLevel();
61556                     if (wallLevel != null) {
61557                         /* get */ destination.walls[i].setLevel(/* get */ destination.levels[source.levels.indexOf(wallLevel)]);
61558                     }
61559                 }
61560                 ;
61561             }
61562             if (source.selectedLevel != null) {
61563                 destination.selectedLevel = /* get */ destination.levels[source.levels.indexOf(source.selectedLevel)];
61564             }
61565         }
61566         if (source.print != null && source.print.getPrintedLevels() != null) {
61567             var printedLevels = (source.print.getPrintedLevels().slice(0));
61568             for (var i = 0; i < /* size */ printedLevels.length; i++) {
61569                 {
61570                     /* set */ (printedLevels[i] = /* get */ destination.levels[source.levels.indexOf(/* get */ printedLevels[i])]);
61571                 }
61572                 ;
61573             }
61574             destination.print = new HomePrint(source.print.getPaperOrientation(), source.print.getPaperWidth(), source.print.getPaperHeight(), source.print.getPaperTopMargin(), source.print.getPaperLeftMargin(), source.print.getPaperBottomMargin(), source.print.getPaperRightMargin(), source.print.isFurniturePrinted(), source.print.isPlanPrinted(), printedLevels, source.print.isView3DPrinted(), source.print.getPlanScale(), source.print.getHeaderFormat(), source.print.getFooterFormat());
61575         }
61576         else {
61577             destination.print = source.print;
61578         }
61579         destination.observerCamera = /* clone */ /* clone */ (function (o) { if (o.clone != undefined) {
61580             return o.clone();
61581         }
61582         else {
61583             var clone = Object.create(o);
61584             for (var p in o) {
61585                 if (o.hasOwnProperty(p))
61586                     clone[p] = o[p];
61587             }
61588             return clone;
61589         } })(source.observerCamera);
61590         destination.topCamera = /* clone */ /* clone */ (function (o) { if (o.clone != undefined) {
61591             return o.clone();
61592         }
61593         else {
61594             var clone = Object.create(o);
61595             for (var p in o) {
61596                 if (o.hasOwnProperty(p))
61597                     clone[p] = o[p];
61598             }
61599             return clone;
61600         } })(source.topCamera);
61601         if (source.camera === source.observerCamera) {
61602             destination.camera = destination.observerCamera;
61603             if ( /* contains */(source.selectedItems.indexOf((source.observerCamera)) >= 0)) {
61604                 /* add */ (destination.selectedItems.push(destination.observerCamera) > 0);
61605             }
61606         }
61607         else {
61608             destination.camera = destination.topCamera;
61609         }
61610         destination.storedCameras = ([]);
61611         for (var index = 0; index < source.storedCameras.length; index++) {
61612             var camera = source.storedCameras[index];
61613             {
61614                 /* add */ (destination.storedCameras.push(/* clone */ /* clone */ (function (o) { if (o.clone != undefined) {
61615                     return o.clone();
61616                 }
61617                 else {
61618                     var clone = Object.create(o);
61619                     for (var p in o) {
61620                         if (o.hasOwnProperty(p))
61621                             clone[p] = o[p];
61622                     }
61623                     return clone;
61624                 } })(camera)) > 0);
61625             }
61626         }
61627         destination.environment = /* clone */ /* clone */ (function (o) { if (o.clone != undefined) {
61628             return o.clone();
61629         }
61630         else {
61631             var clone = Object.create(o);
61632             for (var p in o) {
61633                 if (o.hasOwnProperty(p))
61634                     clone[p] = o[p];
61635             }
61636             return clone;
61637         } })(source.environment);
61638         destination.compass = /* clone */ /* clone */ (function (o) { if (o.clone != undefined) {
61639             return o.clone();
61640         }
61641         else {
61642             var clone = Object.create(o);
61643             for (var p in o) {
61644                 if (o.hasOwnProperty(p))
61645                     clone[p] = o[p];
61646             }
61647             return clone;
61648         } })(source.compass);
61649         destination.furnitureVisibleProperties = (source.furnitureVisibleProperties.slice(0));
61650         destination.furnitureVisiblePropertyNames = (source.furnitureVisiblePropertyNames.slice(0));
61651         destination.visualProperties = ((function (o) { var r = {}; for (var p in o)
61652             r[p] = o[p]; return r; })(source.visualProperties));
61653         destination.properties = ((function (o) { var r = {}; for (var p in o)
61654             r[p] = o[p]; return r; })(source.properties));
61655     };
61656     /**
61657      * Returns the list of cloned items in <code>source</code>.
61658      * If a cloned item is selected its clone will be selected too (ie added to
61659      * <code>destinationSelectedItems</code>).
61660      * @param {*[]} source
61661      * @param {*[]} sourceSelectedItems
61662      * @param {*[]} destinationSelectedItems
61663      * @return {*[]}
61664      * @private
61665      */
61666     Home.cloneSelectableItems = function (source, sourceSelectedItems, destinationSelectedItems) {
61667         var destination = ([]);
61668         for (var index = 0; index < source.length; index++) {
61669             var item = source[index];
61670             {
61671                 var clone = (function (o) { if (o.clone != undefined) {
61672                     return o.clone();
61673                 }
61674                 else {
61675                     var clone_11 = Object.create(o);
61676                     for (var p in o) {
61677                         if (o.hasOwnProperty(p))
61678                             clone_11[p] = o[p];
61679                     }
61680                     return clone_11;
61681                 } })(item);
61682                 /* add */ (destination.push(clone) > 0);
61683                 if ( /* contains */(sourceSelectedItems.indexOf((item)) >= 0)) {
61684                     /* add */ (destinationSelectedItems.push(clone) > 0);
61685                 }
61686                 else if (item != null && item instanceof HomeFurnitureGroup) {
61687                     var sourceFurnitureGroup = item.getAllFurniture();
61688                     var destinationFurnitureGroup = null;
61689                     for (var i = 0, n = sourceFurnitureGroup.length; i < n; i++) {
61690                         {
61691                             var piece = sourceFurnitureGroup[i];
61692                             if ( /* contains */(sourceSelectedItems.indexOf((piece)) >= 0)) {
61693                                 if (destinationFurnitureGroup == null) {
61694                                     destinationFurnitureGroup = clone.getAllFurniture();
61695                                 }
61696                                 /* add */ (destinationSelectedItems.push(/* get */ destinationFurnitureGroup[i]) > 0);
61697                             }
61698                         }
61699                         ;
61700                     }
61701                 }
61702             }
61703         }
61704         return destination;
61705     };
61706     /**
61707      * Returns a deep copy of home selectable <code>items</code>.
61708      * Duplicated items are at the same index as their original and use different ids.
61709      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items  the items to duplicate
61710      * @return {*[]}
61711      */
61712     Home.duplicate = function (items) {
61713         var list = ([]);
61714         var duplicatedWalls = Wall.duplicate(Home.getWallsSubList(items));
61715         var wallIndex = 0;
61716         for (var index = 0; index < items.length; index++) {
61717             var item = items[index];
61718             {
61719                 if (item != null && item instanceof Wall) {
61720                     /* add */ (list.push(/* get */ duplicatedWalls[wallIndex++]) > 0);
61721                 }
61722                 else if (item != null && item instanceof HomeObject) {
61723                     /* add */ (list.push(item.duplicate()) > 0);
61724                 }
61725                 else {
61726                     /* add */ (list.push(/* clone */ /* clone */ (function (o) { if (o.clone != undefined) {
61727                         return o.clone();
61728                     }
61729                     else {
61730                         var clone = Object.create(o);
61731                         for (var p in o) {
61732                             if (o.hasOwnProperty(p))
61733                                 clone[p] = o[p];
61734                         }
61735                         return clone;
61736                     } })(item)) > 0);
61737                 }
61738             }
61739         }
61740         return list;
61741     };
61742     /**
61743      * Returns a sub list of <code>items</code> that contains only home furniture.
61744      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items  the items among which the search is done
61745      * @return {HomePieceOfFurniture[]}
61746      */
61747     Home.getFurnitureSubList = function (items) {
61748         return Home.getSubList(items, HomePieceOfFurniture);
61749     };
61750     /**
61751      * Returns a sub list of <code>items</code> that contains only walls.
61752      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items  the items among which the search is done
61753      * @return {Wall[]}
61754      */
61755     Home.getWallsSubList = function (items) {
61756         return Home.getSubList(items, Wall);
61757     };
61758     /**
61759      * Returns a sub list of <code>items</code> that contains only rooms.
61760      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items  the items among which the search is done
61761      * @return {Room[]}
61762      */
61763     Home.getRoomsSubList = function (items) {
61764         return Home.getSubList(items, Room);
61765     };
61766     /**
61767      * Returns a sub list of <code>items</code> that contains only labels.
61768      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items  the items among which the search is done
61769      * @return {Polyline[]}
61770      */
61771     Home.getPolylinesSubList = function (items) {
61772         return Home.getSubList(items, Polyline);
61773     };
61774     /**
61775      * Returns a sub list of <code>items</code> that contains only dimension lines.
61776      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items  the items among which the search is done
61777      * @return {DimensionLine[]}
61778      */
61779     Home.getDimensionLinesSubList = function (items) {
61780         return Home.getSubList(items, DimensionLine);
61781     };
61782     /**
61783      * Returns a sub list of <code>items</code> that contains only labels.
61784      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items  the items among which the search is done
61785      * @return {Label[]}
61786      */
61787     Home.getLabelsSubList = function (items) {
61788         return Home.getSubList(items, Label);
61789     };
61790     /**
61791      * Returns a sub list of <code>items</code> that contains only instances of <code>subListClass</code>.
61792      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items         the items among which the search is done
61793      * @param {Object} subListClass  the class of the searched items
61794      * @return {*[]}
61795      */
61796     Home.getSubList = function (items, subListClass) {
61797         var subList = ([]);
61798         for (var index = 0; index < items.length; index++) {
61799             var item = items[index];
61800             {
61801                 if ( /* isInstance */(function (c, o) { if (typeof c === 'string')
61802                     return (o.constructor && o.constructor["__interfaces"] && o.constructor["__interfaces"].indexOf(c) >= 0) || (o["__interfaces"] && o["__interfaces"].indexOf(c) >= 0);
61803                 else if (typeof c === 'function')
61804                     return (o instanceof c) || (o.constructor && o.constructor === c); })(subListClass, item)) {
61805                     /* add */ (subList.push(item) > 0);
61806                 }
61807             }
61808         }
61809         return subList;
61810     };
61811     /**
61812      * The current version of this home. Each time the field list is changed
61813      * in <code>Home</code> class or in one of the classes that it uses,
61814      * this number is increased.
61815      */
61816     Home.CURRENT_VERSION = 7400;
61817     Home.HOME_TOP_CAMERA_ID = "camera-homeTopCamera";
61818     Home.HOME_OBSERVER_CAMERA_ID = "observerCamera-homeObserverCamera";
61819     Home.HOME_ENVIRONMENT_ID = "environment-homeEnvironment";
61820     Home.HOME_COMPASS_ID = "compass-homeCompass";
61821     Home.KEEP_BACKWARD_COMPATIBLITY = true;
61822     return Home;
61823 }());
61824 Home["__class"] = "com.eteks.sweethome3d.model.Home";
61825 (function (Home) {
61826     var Home$0 = /** @class */ (function () {
61827         function Home$0(__parent) {
61828             this.__parent = __parent;
61829         }
61830         Home$0.prototype.propertyChange = function (ev) {
61831             if (( /* name */"ELEVATION" === ev.getPropertyName()) || ( /* name */"ELEVATION_INDEX" === ev.getPropertyName())) {
61832                 this.__parent.levels = (this.__parent.levels.slice(0));
61833                 /* sort */ (function (l, c) { if (c.compare)
61834                     l.sort(function (e1, e2) { return c.compare(e1, e2); });
61835                 else
61836                     l.sort(c); })(this.__parent.levels, Home.LEVEL_ELEVATION_COMPARATOR_$LI$());
61837             }
61838         };
61839         return Home$0;
61840     }());
61841     Home.Home$0 = Home$0;
61842 })(Home || (Home = {}));
61843 Home['__transients'] = ['furnitureChangeSupport', 'selectedItems', 'selectionListeners', 'allLevelsSelection', 'levelsChangeSupport', 'wallsChangeSupport', 'roomsChangeSupport', 'polylinesChangeSupport', 'dimensionLinesChangeSupport', 'labelsChangeSupport', 'modified', 'recovered', 'repaired', 'propertyChangeSupport', 'furnitureAdditionalProperties'];
61844 /**
61845  * Creates the controller of plan view.
61846  * @param {Home} home        the home plan edited by this controller and its view
61847  * @param {UserPreferences} preferences the preferences of the application
61848  * @param {Object} viewFactory a factory able to create the plan view managed by this controller
61849  * @param {Object} contentManager a content manager used to import furniture
61850  * @param {javax.swing.undo.UndoableEditSupport} undoSupport undo support to post changes on plan by this controller
61851  * @class
61852  * @extends FurnitureController
61853  * @author Emmanuel Puybaret
61854  */
61855 var PlanController = /** @class */ (function (_super) {
61856     __extends(PlanController, _super);
61857     function PlanController(home, preferences, viewFactory, contentManager, undoSupport) {
61858         var _this = _super.call(this, home, preferences, viewFactory, contentManager, undoSupport) || this;
61859         if (_this.__com_eteks_sweethome3d_viewcontroller_PlanController_home === undefined) {
61860             _this.__com_eteks_sweethome3d_viewcontroller_PlanController_home = null;
61861         }
61862         if (_this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences === undefined) {
61863             _this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences = null;
61864         }
61865         if (_this.__com_eteks_sweethome3d_viewcontroller_PlanController_viewFactory === undefined) {
61866             _this.__com_eteks_sweethome3d_viewcontroller_PlanController_viewFactory = null;
61867         }
61868         if (_this.__com_eteks_sweethome3d_viewcontroller_PlanController_contentManager === undefined) {
61869             _this.__com_eteks_sweethome3d_viewcontroller_PlanController_contentManager = null;
61870         }
61871         if (_this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport === undefined) {
61872             _this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport = null;
61873         }
61874         if (_this.propertyChangeSupport === undefined) {
61875             _this.propertyChangeSupport = null;
61876         }
61877         if (_this.planView === undefined) {
61878             _this.planView = null;
61879         }
61880         if (_this.selectionListener === undefined) {
61881             _this.selectionListener = null;
61882         }
61883         if (_this.wallChangeListener === undefined) {
61884             _this.wallChangeListener = null;
61885         }
61886         if (_this.furnitureSizeChangeListener === undefined) {
61887             _this.furnitureSizeChangeListener = null;
61888         }
61889         if (_this.selectionState === undefined) {
61890             _this.selectionState = null;
61891         }
61892         if (_this.rectangleSelectionState === undefined) {
61893             _this.rectangleSelectionState = null;
61894         }
61895         if (_this.selectionMoveState === undefined) {
61896             _this.selectionMoveState = null;
61897         }
61898         if (_this.panningState === undefined) {
61899             _this.panningState = null;
61900         }
61901         if (_this.dragAndDropState === undefined) {
61902             _this.dragAndDropState = null;
61903         }
61904         if (_this.wallCreationState === undefined) {
61905             _this.wallCreationState = null;
61906         }
61907         if (_this.wallDrawingState === undefined) {
61908             _this.wallDrawingState = null;
61909         }
61910         if (_this.wallResizeState === undefined) {
61911             _this.wallResizeState = null;
61912         }
61913         if (_this.wallArcExtentState === undefined) {
61914             _this.wallArcExtentState = null;
61915         }
61916         if (_this.pieceOfFurnitureRotationState === undefined) {
61917             _this.pieceOfFurnitureRotationState = null;
61918         }
61919         if (_this.pieceOfFurniturePitchRotationState === undefined) {
61920             _this.pieceOfFurniturePitchRotationState = null;
61921         }
61922         if (_this.pieceOfFurnitureRollRotationState === undefined) {
61923             _this.pieceOfFurnitureRollRotationState = null;
61924         }
61925         if (_this.pieceOfFurnitureElevationState === undefined) {
61926             _this.pieceOfFurnitureElevationState = null;
61927         }
61928         if (_this.pieceOfFurnitureHeightState === undefined) {
61929             _this.pieceOfFurnitureHeightState = null;
61930         }
61931         if (_this.pieceOfFurnitureResizeState === undefined) {
61932             _this.pieceOfFurnitureResizeState = null;
61933         }
61934         if (_this.lightPowerModificationState === undefined) {
61935             _this.lightPowerModificationState = null;
61936         }
61937         if (_this.pieceOfFurnitureNameOffsetState === undefined) {
61938             _this.pieceOfFurnitureNameOffsetState = null;
61939         }
61940         if (_this.pieceOfFurnitureNameRotationState === undefined) {
61941             _this.pieceOfFurnitureNameRotationState = null;
61942         }
61943         if (_this.cameraYawRotationState === undefined) {
61944             _this.cameraYawRotationState = null;
61945         }
61946         if (_this.cameraPitchRotationState === undefined) {
61947             _this.cameraPitchRotationState = null;
61948         }
61949         if (_this.cameraElevationState === undefined) {
61950             _this.cameraElevationState = null;
61951         }
61952         if (_this.dimensionLineCreationState === undefined) {
61953             _this.dimensionLineCreationState = null;
61954         }
61955         if (_this.dimensionLineDrawingState === undefined) {
61956             _this.dimensionLineDrawingState = null;
61957         }
61958         if (_this.dimensionLineResizeState === undefined) {
61959             _this.dimensionLineResizeState = null;
61960         }
61961         if (_this.dimensionLineOffsetState === undefined) {
61962             _this.dimensionLineOffsetState = null;
61963         }
61964         if (_this.dimensionLinePitchRotationState === undefined) {
61965             _this.dimensionLinePitchRotationState = null;
61966         }
61967         if (_this.dimensionLineHeightState === undefined) {
61968             _this.dimensionLineHeightState = null;
61969         }
61970         if (_this.dimensionLineElevationState === undefined) {
61971             _this.dimensionLineElevationState = null;
61972         }
61973         if (_this.roomCreationState === undefined) {
61974             _this.roomCreationState = null;
61975         }
61976         if (_this.roomDrawingState === undefined) {
61977             _this.roomDrawingState = null;
61978         }
61979         if (_this.roomResizeState === undefined) {
61980             _this.roomResizeState = null;
61981         }
61982         if (_this.roomAreaOffsetState === undefined) {
61983             _this.roomAreaOffsetState = null;
61984         }
61985         if (_this.roomAreaRotationState === undefined) {
61986             _this.roomAreaRotationState = null;
61987         }
61988         if (_this.roomNameOffsetState === undefined) {
61989             _this.roomNameOffsetState = null;
61990         }
61991         if (_this.roomNameRotationState === undefined) {
61992             _this.roomNameRotationState = null;
61993         }
61994         if (_this.polylineCreationState === undefined) {
61995             _this.polylineCreationState = null;
61996         }
61997         if (_this.polylineDrawingState === undefined) {
61998             _this.polylineDrawingState = null;
61999         }
62000         if (_this.polylineResizeState === undefined) {
62001             _this.polylineResizeState = null;
62002         }
62003         if (_this.labelCreationState === undefined) {
62004             _this.labelCreationState = null;
62005         }
62006         if (_this.labelRotationState === undefined) {
62007             _this.labelRotationState = null;
62008         }
62009         if (_this.labelElevationState === undefined) {
62010             _this.labelElevationState = null;
62011         }
62012         if (_this.compassRotationState === undefined) {
62013             _this.compassRotationState = null;
62014         }
62015         if (_this.compassResizeState === undefined) {
62016             _this.compassResizeState = null;
62017         }
62018         if (_this.state === undefined) {
62019             _this.state = null;
62020         }
62021         if (_this.previousState === undefined) {
62022             _this.previousState = null;
62023         }
62024         if (_this.xLastMousePress === undefined) {
62025             _this.xLastMousePress = 0;
62026         }
62027         if (_this.yLastMousePress === undefined) {
62028             _this.yLastMousePress = 0;
62029         }
62030         if (_this.shiftDownLastMousePress === undefined) {
62031             _this.shiftDownLastMousePress = false;
62032         }
62033         if (_this.alignmentActivatedLastMousePress === undefined) {
62034             _this.alignmentActivatedLastMousePress = false;
62035         }
62036         if (_this.duplicationActivatedLastMousePress === undefined) {
62037             _this.duplicationActivatedLastMousePress = false;
62038         }
62039         if (_this.magnetismToggledLastMousePress === undefined) {
62040             _this.magnetismToggledLastMousePress = false;
62041         }
62042         if (_this.pointerTypeLastMousePress === undefined) {
62043             _this.pointerTypeLastMousePress = null;
62044         }
62045         if (_this.xLastMouseMove === undefined) {
62046             _this.xLastMouseMove = 0;
62047         }
62048         if (_this.yLastMouseMove === undefined) {
62049             _this.yLastMouseMove = 0;
62050         }
62051         if (_this.wallsAreaCache === undefined) {
62052             _this.wallsAreaCache = null;
62053         }
62054         if (_this.wallsIncludingBaseboardsAreaCache === undefined) {
62055             _this.wallsIncludingBaseboardsAreaCache = null;
62056         }
62057         if (_this.insideWallsAreaCache === undefined) {
62058             _this.insideWallsAreaCache = null;
62059         }
62060         if (_this.roomPathsCache === undefined) {
62061             _this.roomPathsCache = null;
62062         }
62063         if (_this.furnitureSidesCache === undefined) {
62064             _this.furnitureSidesCache = null;
62065         }
62066         if (_this.draggedItems === undefined) {
62067             _this.draggedItems = null;
62068         }
62069         _this.feedbackDisplayed = true;
62070         _this.__com_eteks_sweethome3d_viewcontroller_PlanController_home = home;
62071         _this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences = preferences;
62072         _this.__com_eteks_sweethome3d_viewcontroller_PlanController_viewFactory = viewFactory;
62073         _this.__com_eteks_sweethome3d_viewcontroller_PlanController_contentManager = contentManager;
62074         _this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport = undoSupport;
62075         _this.propertyChangeSupport = new PropertyChangeSupport(_this);
62076         _this.furnitureSidesCache = ({});
62077         _this.selectionState = new PlanController.SelectionState(_this);
62078         _this.selectionMoveState = new PlanController.SelectionMoveState(_this);
62079         _this.rectangleSelectionState = new PlanController.RectangleSelectionState(_this);
62080         _this.panningState = new PlanController.PanningState(_this);
62081         _this.dragAndDropState = new PlanController.DragAndDropState(_this);
62082         _this.wallCreationState = new PlanController.WallCreationState(_this);
62083         _this.wallDrawingState = new PlanController.WallDrawingState(_this);
62084         _this.wallResizeState = new PlanController.WallResizeState(_this);
62085         _this.wallArcExtentState = new PlanController.WallArcExtentState(_this);
62086         _this.pieceOfFurnitureRotationState = new PlanController.PieceOfFurnitureRotationState(_this);
62087         _this.pieceOfFurniturePitchRotationState = new PlanController.PieceOfFurniturePitchRotationState(_this);
62088         _this.pieceOfFurnitureRollRotationState = new PlanController.PieceOfFurnitureRollRotationState(_this);
62089         _this.pieceOfFurnitureElevationState = new PlanController.PieceOfFurnitureElevationState(_this);
62090         _this.pieceOfFurnitureHeightState = new PlanController.PieceOfFurnitureHeightState(_this);
62091         _this.pieceOfFurnitureResizeState = new PlanController.PieceOfFurnitureResizeState(_this);
62092         _this.lightPowerModificationState = new PlanController.LightPowerModificationState(_this);
62093         _this.pieceOfFurnitureNameOffsetState = new PlanController.PieceOfFurnitureNameOffsetState(_this);
62094         _this.pieceOfFurnitureNameRotationState = new PlanController.PieceOfFurnitureNameRotationState(_this);
62095         _this.cameraYawRotationState = new PlanController.CameraYawRotationState(_this);
62096         _this.cameraPitchRotationState = new PlanController.CameraPitchRotationState(_this);
62097         _this.cameraElevationState = new PlanController.CameraElevationState(_this);
62098         _this.dimensionLineCreationState = new PlanController.DimensionLineCreationState(_this);
62099         _this.dimensionLineDrawingState = new PlanController.DimensionLineDrawingState(_this);
62100         _this.dimensionLineResizeState = new PlanController.DimensionLineResizeState(_this);
62101         _this.dimensionLineOffsetState = new PlanController.DimensionLineOffsetState(_this);
62102         _this.dimensionLinePitchRotationState = new PlanController.DimensionLinePitchRotationState(_this);
62103         _this.dimensionLineHeightState = new PlanController.DimensionLineHeightState(_this);
62104         _this.dimensionLineElevationState = new PlanController.DimensionLineElevationState(_this);
62105         _this.roomCreationState = new PlanController.RoomCreationState(_this);
62106         _this.roomDrawingState = new PlanController.RoomDrawingState(_this);
62107         _this.roomResizeState = new PlanController.RoomResizeState(_this);
62108         _this.roomAreaOffsetState = new PlanController.RoomAreaOffsetState(_this);
62109         _this.roomAreaRotationState = new PlanController.RoomAreaRotationState(_this);
62110         _this.roomNameOffsetState = new PlanController.RoomNameOffsetState(_this);
62111         _this.roomNameRotationState = new PlanController.RoomNameRotationState(_this);
62112         _this.polylineCreationState = new PlanController.PolylineCreationState(_this);
62113         _this.polylineDrawingState = new PlanController.PolylineDrawingState(_this);
62114         _this.polylineResizeState = new PlanController.PolylineResizeState(_this);
62115         _this.labelCreationState = new PlanController.LabelCreationState(_this);
62116         _this.labelRotationState = new PlanController.LabelRotationState(_this);
62117         _this.labelElevationState = new PlanController.LabelElevationState(_this);
62118         _this.compassRotationState = new PlanController.CompassRotationState(_this);
62119         _this.compassResizeState = new PlanController.CompassResizeState(_this);
62120         _this.setState(_this.selectionState);
62121         _this.__com_eteks_sweethome3d_viewcontroller_PlanController_addModelListeners();
62122         var scale = home.getNumericProperty(PlanController.SCALE_VISUAL_PROPERTY);
62123         if (scale != null) {
62124             _this.setScale(/* floatValue */ scale);
62125         }
62126         return _this;
62127     }
62128     /**
62129      * Returns the view associated with this controller.
62130      * @return {Object}
62131      */
62132     PlanController.prototype.getView = function () {
62133         if (this.planView == null) {
62134             this.planView = this.__com_eteks_sweethome3d_viewcontroller_PlanController_viewFactory.createPlanView(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, this);
62135         }
62136         return this.planView;
62137     };
62138     /**
62139      * Changes current state of controller.
62140      * @param {PlanController.ControllerState} state
62141      */
62142     PlanController.prototype.setState = function (state) {
62143         var oldMode = null;
62144         var oldModificationState = false;
62145         var oldBasePlanModificationState = false;
62146         if (this.state != null) {
62147             oldMode = this.state.getMode();
62148             oldModificationState = this.state.isModificationState();
62149             oldBasePlanModificationState = this.state.isBasePlanModificationState();
62150             this.state.exit();
62151         }
62152         this.previousState = this.state;
62153         this.state = state;
62154         this.state.enter();
62155         if (oldMode !== state.getMode()) {
62156             this.propertyChangeSupport.firePropertyChange(/* name */ "MODE", oldMode, state.getMode());
62157         }
62158         if (oldModificationState !== state.isModificationState()) {
62159             this.propertyChangeSupport.firePropertyChange(/* name */ "MODIFICATION_STATE", oldModificationState, !oldModificationState);
62160         }
62161         if (oldBasePlanModificationState !== state.isBasePlanModificationState()) {
62162             this.propertyChangeSupport.firePropertyChange(/* name */ "BASE_PLAN_MODIFICATION_STATE", oldBasePlanModificationState, !oldBasePlanModificationState);
62163         }
62164     };
62165     /**
62166      * Adds the property change <code>listener</code> in parameter to this controller.
62167      * @param {string} property
62168      * @param {PropertyChangeListener} listener
62169      */
62170     PlanController.prototype.addPropertyChangeListener = function (property, listener) {
62171         this.propertyChangeSupport.addPropertyChangeListener(/* name */ property, listener);
62172     };
62173     /**
62174      * Removes the property change <code>listener</code> in parameter from this controller.
62175      * @param {string} property
62176      * @param {PropertyChangeListener} listener
62177      */
62178     PlanController.prototype.removePropertyChangeListener = function (property, listener) {
62179         this.propertyChangeSupport.removePropertyChangeListener(/* name */ property, listener);
62180     };
62181     /**
62182      * Returns the active mode of this controller.
62183      * @return {PlanController.Mode}
62184      */
62185     PlanController.prototype.getMode = function () {
62186         return this.state.getMode();
62187     };
62188     /**
62189      * Sets the active mode of this controller and fires a <code>PropertyChangeEvent</code>.
62190      * @param {PlanController.Mode} mode
62191      */
62192     PlanController.prototype.setMode = function (mode) {
62193         var oldMode = this.state.getMode();
62194         if (mode !== oldMode) {
62195             this.state.setMode(mode);
62196             this.propertyChangeSupport.firePropertyChange(/* name */ "MODE", oldMode, mode);
62197         }
62198     };
62199     /**
62200      * Returns <code>true</code> if the interactions in the current mode may modify
62201      * the state of a home.
62202      * @return {boolean}
62203      */
62204     PlanController.prototype.isModificationState = function () {
62205         return this.state.isModificationState();
62206     };
62207     /**
62208      * Returns <code>true</code> if the interactions in the current mode may modify
62209      * the base plan of a home.
62210      * @return {boolean}
62211      */
62212     PlanController.prototype.isBasePlanModificationState = function () {
62213         return this.state.isBasePlanModificationState();
62214     };
62215     /**
62216      * Deletes the selection in home.
62217      */
62218     PlanController.prototype.deleteSelection = function () {
62219         this.state.deleteSelection();
62220     };
62221     /**
62222      * Escapes of current action.
62223      */
62224     PlanController.prototype.escape = function () {
62225         this.state.escape();
62226     };
62227     /**
62228      * Moves the selection of (<code>dx</code>,<code>dy</code>) in home.
62229      * @param {number} dx
62230      * @param {number} dy
62231      */
62232     PlanController.prototype.moveSelection = function (dx, dy) {
62233         this.state.moveSelection(dx, dy);
62234     };
62235     /**
62236      * Toggles temporary magnetism feature of user preferences.
62237      * @param {boolean} magnetismToggled if <code>true</code> then magnetism feature is toggled.
62238      */
62239     PlanController.prototype.toggleMagnetism = function (magnetismToggled) {
62240         this.state.toggleMagnetism(magnetismToggled);
62241     };
62242     /**
62243      * Activates or deactivates alignment feature.
62244      * @param {boolean} alignmentActivated if <code>true</code> then alignment is active.
62245      */
62246     PlanController.prototype.setAlignmentActivated = function (alignmentActivated) {
62247         this.state.setAlignmentActivated(alignmentActivated);
62248     };
62249     /**
62250      * Activates or deactivates duplication feature.
62251      * @param {boolean} duplicationActivated if <code>true</code> then duplication is active.
62252      */
62253     PlanController.prototype.setDuplicationActivated = function (duplicationActivated) {
62254         this.state.setDuplicationActivated(duplicationActivated);
62255     };
62256     /**
62257      * Activates or deactivates edition.
62258      * @param {boolean} editionActivated if <code>true</code> then edition is active
62259      */
62260     PlanController.prototype.setEditionActivated = function (editionActivated) {
62261         this.state.setEditionActivated(editionActivated);
62262     };
62263     /**
62264      * Updates an editable property with the entered <code>value</code>.
62265      * @param {string} editableProperty
62266      * @param {Object} value
62267      */
62268     PlanController.prototype.updateEditableProperty = function (editableProperty, value) {
62269         this.state.updateEditableProperty(editableProperty, value);
62270     };
62271     PlanController.prototype.pressMouse$float$float$int$boolean$boolean = function (x, y, clickCount, shiftDown, duplicationActivated) {
62272         this.pressMouse$float$float$int$boolean$boolean$boolean$boolean(x, y, clickCount, shiftDown, shiftDown, duplicationActivated, shiftDown);
62273     };
62274     PlanController.prototype.pressMouse$float$float$int$boolean$boolean$boolean$boolean = function (x, y, clickCount, shiftDown, alignmentActivated, duplicationActivated, magnetismToggled) {
62275         this.pressMouse$float$float$int$boolean$boolean$boolean$boolean$com_eteks_sweethome3d_viewcontroller_View_PointerType(x, y, clickCount, shiftDown, alignmentActivated, duplicationActivated, magnetismToggled, null);
62276     };
62277     PlanController.prototype.pressMouse$float$float$int$boolean$boolean$boolean$boolean$com_eteks_sweethome3d_viewcontroller_View_PointerType = function (x, y, clickCount, shiftDown, alignmentActivated, duplicationActivated, magnetismToggled, pointerType) {
62278         this.xLastMousePress = x;
62279         this.yLastMousePress = y;
62280         this.xLastMouseMove = x;
62281         this.yLastMouseMove = y;
62282         this.shiftDownLastMousePress = shiftDown;
62283         this.alignmentActivatedLastMousePress = alignmentActivated;
62284         this.duplicationActivatedLastMousePress = duplicationActivated;
62285         this.magnetismToggledLastMousePress = magnetismToggled;
62286         this.pointerTypeLastMousePress = pointerType;
62287         this.state.pressMouse(x, y, clickCount, shiftDown, duplicationActivated);
62288     };
62289     /**
62290      * Processes a mouse button pressed event.
62291      * @param {number} x
62292      * @param {number} y
62293      * @param {number} clickCount
62294      * @param {boolean} shiftDown
62295      * @param {boolean} alignmentActivated
62296      * @param {boolean} duplicationActivated
62297      * @param {boolean} magnetismToggled
62298      * @param {View.PointerType} pointerType
62299      */
62300     PlanController.prototype.pressMouse = function (x, y, clickCount, shiftDown, alignmentActivated, duplicationActivated, magnetismToggled, pointerType) {
62301         if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof clickCount === 'number') || clickCount === null) && ((typeof shiftDown === 'boolean') || shiftDown === null) && ((typeof alignmentActivated === 'boolean') || alignmentActivated === null) && ((typeof duplicationActivated === 'boolean') || duplicationActivated === null) && ((typeof magnetismToggled === 'boolean') || magnetismToggled === null) && ((typeof pointerType === 'number') || pointerType === null)) {
62302             return this.pressMouse$float$float$int$boolean$boolean$boolean$boolean$com_eteks_sweethome3d_viewcontroller_View_PointerType(x, y, clickCount, shiftDown, alignmentActivated, duplicationActivated, magnetismToggled, pointerType);
62303         }
62304         else if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof clickCount === 'number') || clickCount === null) && ((typeof shiftDown === 'boolean') || shiftDown === null) && ((typeof alignmentActivated === 'boolean') || alignmentActivated === null) && ((typeof duplicationActivated === 'boolean') || duplicationActivated === null) && ((typeof magnetismToggled === 'boolean') || magnetismToggled === null) && pointerType === undefined) {
62305             return this.pressMouse$float$float$int$boolean$boolean$boolean$boolean(x, y, clickCount, shiftDown, alignmentActivated, duplicationActivated, magnetismToggled);
62306         }
62307         else if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof clickCount === 'number') || clickCount === null) && ((typeof shiftDown === 'boolean') || shiftDown === null) && ((typeof alignmentActivated === 'boolean') || alignmentActivated === null) && duplicationActivated === undefined && magnetismToggled === undefined && pointerType === undefined) {
62308             return this.pressMouse$float$float$int$boolean$boolean(x, y, clickCount, shiftDown, alignmentActivated);
62309         }
62310         else
62311             throw new Error('invalid overload');
62312     };
62313     /**
62314      * Processes a mouse button released event.
62315      * @param {number} x
62316      * @param {number} y
62317      */
62318     PlanController.prototype.releaseMouse = function (x, y) {
62319         this.state.releaseMouse(x, y);
62320     };
62321     /**
62322      * Processes a mouse button moved event.
62323      * @param {number} x
62324      * @param {number} y
62325      */
62326     PlanController.prototype.moveMouse = function (x, y) {
62327         this.xLastMouseMove = x;
62328         this.yLastMouseMove = y;
62329         this.state.moveMouse(x, y);
62330     };
62331     /**
62332      * Processes a zoom event.
62333      * @param {number} factor
62334      */
62335     PlanController.prototype.zoom = function (factor) {
62336         this.state.zoom(factor);
62337     };
62338     /**
62339      * Sets whether requested feedback should be displayed in the view or not.
62340      * @param {boolean} displayed
62341      */
62342     PlanController.prototype.setFeedbackDisplayed = function (displayed) {
62343         this.feedbackDisplayed = displayed;
62344         this.getView().deleteFeedback();
62345     };
62346     /**
62347      * Returns <code>true</code> if this view accepts to display requested feedback.
62348      * @return {boolean}
62349      */
62350     PlanController.prototype.isFeedbackDisplayed = function () {
62351         return this.feedbackDisplayed;
62352     };
62353     /**
62354      * Returns the selection state.
62355      * @return {PlanController.ControllerState}
62356      */
62357     PlanController.prototype.getSelectionState = function () {
62358         return this.selectionState;
62359     };
62360     /**
62361      * Returns the selection move state.
62362      * @return {PlanController.ControllerState}
62363      */
62364     PlanController.prototype.getSelectionMoveState = function () {
62365         return this.selectionMoveState;
62366     };
62367     /**
62368      * Returns the rectangle selection state.
62369      * @return {PlanController.ControllerState}
62370      */
62371     PlanController.prototype.getRectangleSelectionState = function () {
62372         return this.rectangleSelectionState;
62373     };
62374     /**
62375      * Returns the panning state.
62376      * @return {PlanController.ControllerState}
62377      */
62378     PlanController.prototype.getPanningState = function () {
62379         return this.panningState;
62380     };
62381     /**
62382      * Returns the drag and drop state.
62383      * @return {PlanController.ControllerState}
62384      */
62385     PlanController.prototype.getDragAndDropState = function () {
62386         return this.dragAndDropState;
62387     };
62388     /**
62389      * Returns the wall creation state.
62390      * @return {PlanController.ControllerState}
62391      */
62392     PlanController.prototype.getWallCreationState = function () {
62393         return this.wallCreationState;
62394     };
62395     /**
62396      * Returns the wall drawing state.
62397      * @return {PlanController.ControllerState}
62398      */
62399     PlanController.prototype.getWallDrawingState = function () {
62400         return this.wallDrawingState;
62401     };
62402     /**
62403      * Returns the wall resize state.
62404      * @return {PlanController.ControllerState}
62405      */
62406     PlanController.prototype.getWallResizeState = function () {
62407         return this.wallResizeState;
62408     };
62409     /**
62410      * Returns the wall arc extent state.
62411      * @return {PlanController.ControllerState}
62412      */
62413     PlanController.prototype.getWallArcExtentState = function () {
62414         return this.wallArcExtentState;
62415     };
62416     /**
62417      * Returns the piece rotation state.
62418      * @return {PlanController.ControllerState}
62419      */
62420     PlanController.prototype.getPieceOfFurnitureRotationState = function () {
62421         return this.pieceOfFurnitureRotationState;
62422     };
62423     /**
62424      * Returns the piece pitch rotation state.
62425      * @return {PlanController.ControllerState}
62426      */
62427     PlanController.prototype.getPieceOfFurniturePitchRotationState = function () {
62428         return this.pieceOfFurniturePitchRotationState;
62429     };
62430     /**
62431      * Returns the piece roll rotation state.
62432      * @return {PlanController.ControllerState}
62433      */
62434     PlanController.prototype.getPieceOfFurnitureRollRotationState = function () {
62435         return this.pieceOfFurnitureRollRotationState;
62436     };
62437     /**
62438      * Returns the piece elevation state.
62439      * @return {PlanController.ControllerState}
62440      */
62441     PlanController.prototype.getPieceOfFurnitureElevationState = function () {
62442         return this.pieceOfFurnitureElevationState;
62443     };
62444     /**
62445      * Returns the piece height state.
62446      * @return {PlanController.ControllerState}
62447      */
62448     PlanController.prototype.getPieceOfFurnitureHeightState = function () {
62449         return this.pieceOfFurnitureHeightState;
62450     };
62451     /**
62452      * Returns the piece resize state.
62453      * @return {PlanController.ControllerState}
62454      */
62455     PlanController.prototype.getPieceOfFurnitureResizeState = function () {
62456         return this.pieceOfFurnitureResizeState;
62457     };
62458     /**
62459      * Returns the light power modification state.
62460      * @return {PlanController.ControllerState}
62461      */
62462     PlanController.prototype.getLightPowerModificationState = function () {
62463         return this.lightPowerModificationState;
62464     };
62465     /**
62466      * Returns the piece name offset state.
62467      * @return {PlanController.ControllerState}
62468      */
62469     PlanController.prototype.getPieceOfFurnitureNameOffsetState = function () {
62470         return this.pieceOfFurnitureNameOffsetState;
62471     };
62472     /**
62473      * Returns the piece name rotation state.
62474      * @return {PlanController.ControllerState}
62475      */
62476     PlanController.prototype.getPieceOfFurnitureNameRotationState = function () {
62477         return this.pieceOfFurnitureNameRotationState;
62478     };
62479     /**
62480      * Returns the camera yaw rotation state.
62481      * @return {PlanController.ControllerState}
62482      */
62483     PlanController.prototype.getCameraYawRotationState = function () {
62484         return this.cameraYawRotationState;
62485     };
62486     /**
62487      * Returns the camera pitch rotation state.
62488      * @return {PlanController.ControllerState}
62489      */
62490     PlanController.prototype.getCameraPitchRotationState = function () {
62491         return this.cameraPitchRotationState;
62492     };
62493     /**
62494      * Returns the camera elevation state.
62495      * @return {PlanController.ControllerState}
62496      */
62497     PlanController.prototype.getCameraElevationState = function () {
62498         return this.cameraElevationState;
62499     };
62500     /**
62501      * Returns the dimension line creation state.
62502      * @return {PlanController.ControllerState}
62503      */
62504     PlanController.prototype.getDimensionLineCreationState = function () {
62505         return this.dimensionLineCreationState;
62506     };
62507     /**
62508      * Returns the dimension line drawing state.
62509      * @return {PlanController.ControllerState}
62510      */
62511     PlanController.prototype.getDimensionLineDrawingState = function () {
62512         return this.dimensionLineDrawingState;
62513     };
62514     /**
62515      * Returns the dimension line resize state.
62516      * @return {PlanController.ControllerState}
62517      */
62518     PlanController.prototype.getDimensionLineResizeState = function () {
62519         return this.dimensionLineResizeState;
62520     };
62521     /**
62522      * Returns the dimension line offset state.
62523      * @return {PlanController.ControllerState}
62524      */
62525     PlanController.prototype.getDimensionLineOffsetState = function () {
62526         return this.dimensionLineOffsetState;
62527     };
62528     /**
62529      * Returns the dimension line rotation state.
62530      * @return {PlanController.ControllerState}
62531      */
62532     PlanController.prototype.getDimensionLinePitchRotationState = function () {
62533         return this.dimensionLinePitchRotationState;
62534     };
62535     /**
62536      * Returns the dimension line height state.
62537      * @return {PlanController.ControllerState}
62538      * @private
62539      */
62540     PlanController.prototype.getDimensionLineHeightState = function () {
62541         return this.dimensionLineHeightState;
62542     };
62543     /**
62544      * Returns the dimension line elevation state.
62545      * @return {PlanController.ControllerState}
62546      */
62547     PlanController.prototype.getDimensionLineElevationState = function () {
62548         return this.dimensionLineElevationState;
62549     };
62550     /**
62551      * Returns the room creation state.
62552      * @return {PlanController.ControllerState}
62553      */
62554     PlanController.prototype.getRoomCreationState = function () {
62555         return this.roomCreationState;
62556     };
62557     /**
62558      * Returns the room drawing state.
62559      * @return {PlanController.ControllerState}
62560      */
62561     PlanController.prototype.getRoomDrawingState = function () {
62562         return this.roomDrawingState;
62563     };
62564     /**
62565      * Returns the room resize state.
62566      * @return {PlanController.ControllerState}
62567      */
62568     PlanController.prototype.getRoomResizeState = function () {
62569         return this.roomResizeState;
62570     };
62571     /**
62572      * Returns the room area offset state.
62573      * @return {PlanController.ControllerState}
62574      */
62575     PlanController.prototype.getRoomAreaOffsetState = function () {
62576         return this.roomAreaOffsetState;
62577     };
62578     /**
62579      * Returns the room area rotation state.
62580      * @return {PlanController.ControllerState}
62581      */
62582     PlanController.prototype.getRoomAreaRotationState = function () {
62583         return this.roomAreaRotationState;
62584     };
62585     /**
62586      * Returns the room name offset state.
62587      * @return {PlanController.ControllerState}
62588      */
62589     PlanController.prototype.getRoomNameOffsetState = function () {
62590         return this.roomNameOffsetState;
62591     };
62592     /**
62593      * Returns the room name rotation state.
62594      * @return {PlanController.ControllerState}
62595      */
62596     PlanController.prototype.getRoomNameRotationState = function () {
62597         return this.roomNameRotationState;
62598     };
62599     /**
62600      * Returns the polyline creation state.
62601      * @return {PlanController.ControllerState}
62602      */
62603     PlanController.prototype.getPolylineCreationState = function () {
62604         return this.polylineCreationState;
62605     };
62606     /**
62607      * Returns the polyline drawing state.
62608      * @return {PlanController.ControllerState}
62609      */
62610     PlanController.prototype.getPolylineDrawingState = function () {
62611         return this.polylineDrawingState;
62612     };
62613     /**
62614      * Returns the polyline resize state.
62615      * @return {PlanController.ControllerState}
62616      */
62617     PlanController.prototype.getPolylineResizeState = function () {
62618         return this.polylineResizeState;
62619     };
62620     /**
62621      * Returns the label creation state.
62622      * @return {PlanController.ControllerState}
62623      */
62624     PlanController.prototype.getLabelCreationState = function () {
62625         return this.labelCreationState;
62626     };
62627     /**
62628      * Returns the label rotation state.
62629      * @return {PlanController.ControllerState}
62630      */
62631     PlanController.prototype.getLabelRotationState = function () {
62632         return this.labelRotationState;
62633     };
62634     /**
62635      * Returns the label elevation state.
62636      * @return {PlanController.ControllerState}
62637      */
62638     PlanController.prototype.getLabelElevationState = function () {
62639         return this.labelElevationState;
62640     };
62641     /**
62642      * Returns the compass rotation state.
62643      * @return {PlanController.ControllerState}
62644      */
62645     PlanController.prototype.getCompassRotationState = function () {
62646         return this.compassRotationState;
62647     };
62648     /**
62649      * Returns the compass resize state.
62650      * @return {PlanController.ControllerState}
62651      */
62652     PlanController.prototype.getCompassResizeState = function () {
62653         return this.compassResizeState;
62654     };
62655     /**
62656      * Returns the abscissa of mouse position at last mouse press.
62657      * @return {number}
62658      */
62659     PlanController.prototype.getXLastMousePress = function () {
62660         return this.xLastMousePress;
62661     };
62662     /**
62663      * Returns the ordinate of mouse position at last mouse press.
62664      * @return {number}
62665      */
62666     PlanController.prototype.getYLastMousePress = function () {
62667         return this.yLastMousePress;
62668     };
62669     /**
62670      * Returns <code>true</code> if shift key was down at last mouse press.
62671      * @return {boolean}
62672      */
62673     PlanController.prototype.wasShiftDownLastMousePress = function () {
62674         return this.shiftDownLastMousePress;
62675     };
62676     /**
62677      * Returns <code>true</code> if magnetism was toggled at last mouse press.
62678      * @return {boolean}
62679      */
62680     PlanController.prototype.wasMagnetismToggledLastMousePress = function () {
62681         return this.magnetismToggledLastMousePress;
62682     };
62683     /**
62684      * Returns <code>true</code> if alignment was activated at last mouse press.
62685      * @return {boolean}
62686      */
62687     PlanController.prototype.wasAlignmentActivatedLastMousePress = function () {
62688         return this.alignmentActivatedLastMousePress;
62689     };
62690     /**
62691      * Returns <code>true</code> if duplication was activated at last mouse press.
62692      * @return {boolean}
62693      */
62694     PlanController.prototype.wasDuplicationActivatedLastMousePress = function () {
62695         return this.duplicationActivatedLastMousePress;
62696     };
62697     /**
62698      * Returns the pointer type used at the last mouse press.
62699      * @return {View.PointerType}
62700      */
62701     PlanController.prototype.getPointerTypeLastMousePress = function () {
62702         return this.pointerTypeLastMousePress;
62703     };
62704     /**
62705      * Returns the abscissa of mouse position at last mouse move.
62706      * @return {number}
62707      */
62708     PlanController.prototype.getXLastMouseMove = function () {
62709         return this.xLastMouseMove;
62710     };
62711     /**
62712      * Returns the ordinate of mouse position at last mouse move.
62713      * @return {number}
62714      */
62715     PlanController.prototype.getYLastMouseMove = function () {
62716         return this.yLastMouseMove;
62717     };
62718     /**
62719      * Controls the modification of the item selected in plan.
62720      */
62721     PlanController.prototype.modifySelectedItem = function () {
62722         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
62723         if ( /* size */selectedItems.length === 1) {
62724             var item = selectedItems[0];
62725             if (item != null && item instanceof HomePieceOfFurniture) {
62726                 this.modifySelectedFurniture();
62727             }
62728             else if (item != null && item instanceof Wall) {
62729                 this.modifySelectedWalls();
62730             }
62731             else if (item != null && item instanceof Room) {
62732                 this.modifySelectedRooms();
62733             }
62734             else if (item != null && item instanceof Polyline) {
62735                 this.modifySelectedPolylines();
62736             }
62737             else if (item != null && item instanceof DimensionLine) {
62738                 this.modifySelectedDimensionLines();
62739             }
62740             else if (item != null && item instanceof Label) {
62741                 this.modifySelectedLabels();
62742             }
62743             else if (item != null && item instanceof Compass) {
62744                 this.modifyCompass();
62745             }
62746             else if (item != null && item instanceof ObserverCamera) {
62747                 this.modifyObserverCamera();
62748             }
62749         }
62750     };
62751     /**
62752      * Controls the modification of selected walls.
62753      */
62754     PlanController.prototype.modifySelectedWalls = function () {
62755         if (!(Home.getWallsSubList(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()).length == 0)) {
62756             new WallController(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, this.__com_eteks_sweethome3d_viewcontroller_PlanController_viewFactory, this.__com_eteks_sweethome3d_viewcontroller_PlanController_contentManager, this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport).displayView(this.getView());
62757         }
62758     };
62759     /**
62760      * Locks home base plan.
62761      */
62762     PlanController.prototype.lockBasePlan = function () {
62763         if (!this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked()) {
62764             var allLevelsSelection = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection();
62765             var selection = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
62766             var oldSelection = selection.slice(0);
62767             var newSelection = this.getItemsNotPartOfBasePlan(selection);
62768             var newSelectedItems = newSelection.slice(0);
62769             this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(true);
62770             this.selectItems$java_util_List$boolean(newSelection, allLevelsSelection);
62771             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.LockingUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_home, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldSelection, allLevelsSelection, newSelectedItems));
62772         }
62773     };
62774     /**
62775      * Returns <code>true</code> it the given <code>item</code> belongs
62776      * to the base plan.
62777      * @param {Object} item
62778      * @return {boolean}
62779      */
62780     PlanController.prototype.isItemPartOfBasePlan = function (item) {
62781         if (item != null && item instanceof HomePieceOfFurniture) {
62782             return this.isPieceOfFurniturePartOfBasePlan(item);
62783         }
62784         else {
62785             return !(item != null && item instanceof ObserverCamera);
62786         }
62787     };
62788     /**
62789      * Returns the items among the given list that are not part of the base plan.
62790      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items
62791      * @return {*[]}
62792      * @private
62793      */
62794     PlanController.prototype.getItemsNotPartOfBasePlan = function (items) {
62795         var itemsNotPartOfBasePlan = ([]);
62796         for (var index = 0; index < items.length; index++) {
62797             var item = items[index];
62798             {
62799                 if (!this.isItemPartOfBasePlan(item)) {
62800                     /* add */ (itemsNotPartOfBasePlan.push(item) > 0);
62801                 }
62802             }
62803         }
62804         return itemsNotPartOfBasePlan;
62805     };
62806     /**
62807      * Unlocks home base plan.
62808      */
62809     PlanController.prototype.unlockBasePlan = function () {
62810         if (this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked()) {
62811             var allLevelsSelection = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection();
62812             var selection = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
62813             var selectedItems = selection.slice(0);
62814             this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(false);
62815             this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setAllLevelsSelection(false);
62816             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.UnlockingUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_home, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, selectedItems, allLevelsSelection));
62817         }
62818     };
62819     /**
62820      * Returns <code>true</code> if the given <code>item</code> may be moved
62821      * in the plan. Default implementation returns <code>true</code>.
62822      * @param {Object} item
62823      * @return {boolean}
62824      */
62825     PlanController.prototype.isItemMovable = function (item) {
62826         if (item != null && item instanceof HomePieceOfFurniture) {
62827             return this.isPieceOfFurnitureMovable(item);
62828         }
62829         else {
62830             return true;
62831         }
62832     };
62833     /**
62834      * Returns <code>true</code> if the given <code>item</code> may be resized.
62835      * Default implementation returns <code>false</code> if the given <code>item</code>
62836      * is a non resizable piece of furniture.
62837      * @param {Object} item
62838      * @return {boolean}
62839      */
62840     PlanController.prototype.isItemResizable = function (item) {
62841         if (item != null && item instanceof HomePieceOfFurniture) {
62842             return item.isResizable();
62843         }
62844         else {
62845             return true;
62846         }
62847     };
62848     /**
62849      * Returns <code>true</code> if the given <code>item</code> may be deleted.
62850      * Default implementation returns <code>true</code> except if the given <code>item</code>
62851      * is a camera or a compass or if the given <code>item</code> isn't a
62852      * {@linkplain #isPieceOfFurnitureDeletable(HomePieceOfFurniture) deletable piece of furniture}.
62853      * @param {Object} item
62854      * @return {boolean}
62855      */
62856     PlanController.prototype.isItemDeletable = function (item) {
62857         if (item != null && item instanceof HomePieceOfFurniture) {
62858             return this.isPieceOfFurnitureDeletable(item);
62859         }
62860         else {
62861             return !((item != null && item instanceof Compass) || (item != null && item instanceof Camera));
62862         }
62863     };
62864     /**
62865      * Flips horizontally selected objects.
62866      */
62867     PlanController.prototype.flipHorizontally = function () {
62868         this.flipSelectedItems(true);
62869     };
62870     /**
62871      * Flips vertically selected objects.
62872      */
62873     PlanController.prototype.flipVertically = function () {
62874         this.flipSelectedItems(false);
62875     };
62876     PlanController.prototype.flipSelectedItems = function (horizontally) {
62877         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
62878         if (!(selectedItems.length == 0)) {
62879             var flippedItems = selectedItems.slice(0);
62880             var itemTextBaseOffsets = (function (s) { var a = []; while (s-- > 0)
62881                 a.push(null); return a; })(flippedItems.length);
62882             for (var i = 0; i < itemTextBaseOffsets.length; i++) {
62883                 {
62884                     if (flippedItems[i] != null && flippedItems[i] instanceof HomeFurnitureGroup) {
62885                         var group = flippedItems[i];
62886                         var furniture = group.getAllFurniture();
62887                         itemTextBaseOffsets[i] = (function (s) { var a = []; while (s-- > 0)
62888                             a.push(0); return a; })(/* size */ furniture.length + 1);
62889                         itemTextBaseOffsets[i][0] = this.getTextBaseOffset(group.getName(), group.getNameStyle(), group.constructor);
62890                         for (var j = 0; j < /* size */ furniture.length; j++) {
62891                             {
62892                                 var piece = furniture[j];
62893                                 itemTextBaseOffsets[i][j + 1] = this.getTextBaseOffset(piece.getName(), piece.getNameStyle(), piece.constructor);
62894                             }
62895                             ;
62896                         }
62897                     }
62898                     else if (flippedItems[i] != null && flippedItems[i] instanceof HomePieceOfFurniture) {
62899                         var piece = flippedItems[i];
62900                         itemTextBaseOffsets[i] = [this.getTextBaseOffset(piece.getName(), piece.getNameStyle(), piece.constructor)];
62901                     }
62902                     else if (flippedItems[i] != null && flippedItems[i] instanceof Room) {
62903                         var room = flippedItems[i];
62904                         itemTextBaseOffsets[i] = [this.getTextBaseOffset(room.getName(), room.getNameStyle(), room.constructor), this.getTextBaseOffset(this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getAreaFormatWithUnit().format(room.getArea()), room.getAreaStyle(), room.constructor)];
62905                     }
62906                 }
62907                 ;
62908             }
62909             this.doFlipItems(flippedItems, itemTextBaseOffsets, horizontally);
62910             this.selectAndShowItems$java_util_List$boolean(selectedItems, this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection());
62911             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.FlippingUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection(), /* toArray */ selectedItems.slice(0), itemTextBaseOffsets, horizontally));
62912         }
62913     };
62914     /**
62915      * Flips the <code>items</code>.
62916      * @param {com.eteks.sweethome3d.model.Selectable[]} items
62917      * @param {float[][]} itemTextBaseOffsets
62918      * @param {boolean} horizontalFlip
62919      * @private
62920      */
62921     PlanController.prototype.doFlipItems = function (items, itemTextBaseOffsets, horizontalFlip) {
62922         var minX = 3.4028235E38;
62923         var minY = 3.4028235E38;
62924         var maxX = -3.4028235E38;
62925         var maxY = -3.4028235E38;
62926         for (var index = 0; index < items.length; index++) {
62927             var item = items[index];
62928             {
62929                 if (!(item != null && item instanceof ObserverCamera)) {
62930                     {
62931                         var array = item.getPoints();
62932                         for (var index1 = 0; index1 < array.length; index1++) {
62933                             var point = array[index1];
62934                             {
62935                                 minX = Math.min(minX, point[0]);
62936                                 minY = Math.min(minY, point[1]);
62937                                 maxX = Math.max(maxX, point[0]);
62938                                 maxY = Math.max(maxY, point[1]);
62939                             }
62940                         }
62941                     }
62942                 }
62943             }
62944         }
62945         var symmetryX = (minX + maxX) / 2;
62946         var symmetryY = (minY + maxY) / 2;
62947         var flippedItems = items.slice(0);
62948         for (var i = 0; i < items.length; i++) {
62949             {
62950                 this.flipItem(items[i], itemTextBaseOffsets[i], 0, horizontalFlip ? symmetryX : symmetryY, horizontalFlip, flippedItems);
62951             }
62952             ;
62953         }
62954     };
62955     /**
62956      * Flips the given <code>item</code> with the given axis coordinate.
62957      * @param {Object} item the item to flip
62958      * @param {float[]} itemTextBaseOffsets base offset for the texts of the item
62959      * @param {number} offsetIndex  index to get the first text base offset of item
62960      * @param {number} axisCoordinate the coordinate of the symmetry axis
62961      * @param {boolean} horizontalFlip if <code>true</code> the item should be flipped horizontally otherwise vertically
62962      * @param {*[]} flippedItems list of all the items that must be flipped
62963      */
62964     PlanController.prototype.flipItem = function (item, itemTextBaseOffsets, offsetIndex, axisCoordinate, horizontalFlip, flippedItems) {
62965         if (item != null && item instanceof HomePieceOfFurniture) {
62966             var piece = item;
62967             if (horizontalFlip) {
62968                 piece.setX(axisCoordinate * 2 - piece.getX());
62969                 piece.setAngle(-piece.getAngle());
62970                 PlanController.flipPieceOfFurnitureName(piece, itemTextBaseOffsets[0], horizontalFlip);
62971             }
62972             else {
62973                 piece.setY(axisCoordinate * 2 - piece.getY());
62974                 piece.setAngle(Math.PI - piece.getAngle());
62975                 PlanController.flipPieceOfFurnitureName(piece, itemTextBaseOffsets[0], horizontalFlip);
62976             }
62977             if (piece.isHorizontallyRotatable()) {
62978                 piece.setRoll(-piece.getRoll());
62979             }
62980             if (piece.isResizable()) {
62981                 piece.setModelMirrored(!piece.isModelMirrored());
62982             }
62983             if (item != null && item instanceof HomeFurnitureGroup) {
62984                 var furniture = item.getAllFurniture();
62985                 for (var i = 0; i < /* size */ furniture.length; i++) {
62986                     {
62987                         PlanController.flipPieceOfFurnitureName(/* get */ furniture[i], itemTextBaseOffsets[i + 1], horizontalFlip);
62988                     }
62989                     ;
62990                 }
62991             }
62992         }
62993         else if (item != null && item instanceof Wall) {
62994             var wall = item;
62995             if (horizontalFlip) {
62996                 wall.setXStart(axisCoordinate * 2 - wall.getXStart());
62997                 var wallAtStart = wall.getWallAtStart();
62998                 if (wallAtStart != null && !(flippedItems.indexOf((wallAtStart)) >= 0)) {
62999                     if (wallAtStart.getWallAtStart() === wall) {
63000                         wallAtStart.setXStart(axisCoordinate * 2 - wallAtStart.getXStart());
63001                     }
63002                     else {
63003                         wallAtStart.setXEnd(axisCoordinate * 2 - wallAtStart.getXEnd());
63004                     }
63005                 }
63006                 wall.setXEnd(axisCoordinate * 2 - wall.getXEnd());
63007                 var wallAtEnd = wall.getWallAtEnd();
63008                 if (wallAtEnd != null && !(flippedItems.indexOf((wallAtEnd)) >= 0)) {
63009                     if (wallAtEnd.getWallAtStart() === wall) {
63010                         wallAtEnd.setXStart(axisCoordinate * 2 - wallAtEnd.getXStart());
63011                     }
63012                     else {
63013                         wallAtEnd.setXEnd(axisCoordinate * 2 - wallAtEnd.getXEnd());
63014                     }
63015                 }
63016             }
63017             else {
63018                 wall.setYStart(axisCoordinate * 2 - wall.getYStart());
63019                 var wallAtStart = wall.getWallAtStart();
63020                 if (wallAtStart != null && !(flippedItems.indexOf((wallAtStart)) >= 0)) {
63021                     if (wallAtStart.getWallAtStart() === wall) {
63022                         wallAtStart.setYStart(axisCoordinate * 2 - wallAtStart.getYStart());
63023                     }
63024                     else {
63025                         wallAtStart.setYEnd(axisCoordinate * 2 - wallAtStart.getYEnd());
63026                     }
63027                 }
63028                 wall.setYEnd(axisCoordinate * 2 - wall.getYEnd());
63029                 var wallAtEnd = wall.getWallAtEnd();
63030                 if (wallAtEnd != null && !(flippedItems.indexOf((wallAtEnd)) >= 0)) {
63031                     if (wallAtEnd.getWallAtStart() === wall) {
63032                         wallAtEnd.setYStart(axisCoordinate * 2 - wallAtEnd.getYStart());
63033                     }
63034                     else {
63035                         wallAtEnd.setYEnd(axisCoordinate * 2 - wallAtEnd.getYEnd());
63036                     }
63037                 }
63038             }
63039             var arcExtent = wall.getArcExtent();
63040             if (arcExtent != null) {
63041                 wall.setArcExtent(-arcExtent);
63042             }
63043             PlanController.reverseWallSidesStyle(wall);
63044         }
63045         else if (item != null && item instanceof Room) {
63046             var room = item;
63047             var points = room.getPoints();
63048             for (var index = 0; index < points.length; index++) {
63049                 var point = points[index];
63050                 {
63051                     if (horizontalFlip) {
63052                         point[0] = axisCoordinate * 2 - point[0];
63053                     }
63054                     else {
63055                         point[1] = axisCoordinate * 2 - point[1];
63056                     }
63057                 }
63058             }
63059             room.setPoints(points);
63060             var nameStyle = room.getNameStyle();
63061             var areaStyle = room.getAreaStyle();
63062             if (horizontalFlip) {
63063                 room.setNameXOffset(-room.getNameXOffset());
63064                 room.setAreaXOffset(-room.getAreaXOffset());
63065                 if (nameStyle != null) {
63066                     if (nameStyle.getAlignment() === TextStyle.Alignment.LEFT) {
63067                         room.setNameStyle(nameStyle.deriveStyle$com_eteks_sweethome3d_model_TextStyle_Alignment(TextStyle.Alignment.RIGHT));
63068                     }
63069                     else if (nameStyle.getAlignment() === TextStyle.Alignment.RIGHT) {
63070                         room.setNameStyle(nameStyle.deriveStyle$com_eteks_sweethome3d_model_TextStyle_Alignment(TextStyle.Alignment.LEFT));
63071                     }
63072                 }
63073                 if (areaStyle != null) {
63074                     if (areaStyle.getAlignment() === TextStyle.Alignment.LEFT) {
63075                         room.setAreaStyle(areaStyle.deriveStyle$com_eteks_sweethome3d_model_TextStyle_Alignment(TextStyle.Alignment.RIGHT));
63076                     }
63077                     else if (areaStyle.getAlignment() === TextStyle.Alignment.RIGHT) {
63078                         room.setAreaStyle(areaStyle.deriveStyle$com_eteks_sweethome3d_model_TextStyle_Alignment(TextStyle.Alignment.LEFT));
63079                     }
63080                 }
63081             }
63082             else {
63083                 room.setNameYOffset(-room.getNameYOffset());
63084                 var baseOffset = itemTextBaseOffsets[0];
63085                 room.setNameXOffset(room.getNameXOffset() - baseOffset * Math.sin(room.getNameAngle()));
63086                 room.setNameYOffset(room.getNameYOffset() - baseOffset * Math.cos(room.getNameAngle()));
63087                 room.setAreaYOffset(-room.getAreaYOffset());
63088                 baseOffset = itemTextBaseOffsets[1];
63089                 room.setAreaXOffset(room.getAreaXOffset() - baseOffset * Math.sin(room.getAreaAngle()));
63090                 room.setAreaYOffset(room.getAreaYOffset() - baseOffset * Math.cos(room.getAreaAngle()));
63091             }
63092             room.setNameAngle(-room.getNameAngle());
63093             room.setAreaAngle(-room.getAreaAngle());
63094         }
63095         else if (item != null && item instanceof Polyline) {
63096             var polyline = item;
63097             var points = polyline.getPoints();
63098             for (var index = 0; index < points.length; index++) {
63099                 var point = points[index];
63100                 {
63101                     if (horizontalFlip) {
63102                         point[0] = axisCoordinate * 2 - point[0];
63103                     }
63104                     else {
63105                         point[1] = axisCoordinate * 2 - point[1];
63106                     }
63107                 }
63108             }
63109             polyline.setPoints(points);
63110         }
63111         else if (item != null && item instanceof DimensionLine) {
63112             var dimensionLine = item;
63113             if (dimensionLine.isElevationDimensionLine()) {
63114                 if (horizontalFlip) {
63115                     dimensionLine.setXStart(axisCoordinate * 2 - dimensionLine.getXStart());
63116                     dimensionLine.setXEnd(dimensionLine.getXStart());
63117                     dimensionLine.setPitch(Math.PI - dimensionLine.getPitch());
63118                 }
63119                 else {
63120                     dimensionLine.setYStart(axisCoordinate * 2 - dimensionLine.getYStart());
63121                     dimensionLine.setYEnd(dimensionLine.getYStart());
63122                     dimensionLine.setPitch(-dimensionLine.getPitch());
63123                 }
63124                 dimensionLine.setOffset(-dimensionLine.getOffset());
63125             }
63126             else {
63127                 if (horizontalFlip) {
63128                     var xStart = dimensionLine.getXStart();
63129                     dimensionLine.setXStart(axisCoordinate * 2 - dimensionLine.getXEnd());
63130                     dimensionLine.setXEnd(axisCoordinate * 2 - xStart);
63131                     var yStart = dimensionLine.getYStart();
63132                     dimensionLine.setYStart(dimensionLine.getYEnd());
63133                     dimensionLine.setYEnd(yStart);
63134                 }
63135                 else {
63136                     dimensionLine.setYStart(axisCoordinate * 2 - dimensionLine.getYStart());
63137                     dimensionLine.setYEnd(axisCoordinate * 2 - dimensionLine.getYEnd());
63138                     dimensionLine.setOffset(-dimensionLine.getOffset());
63139                 }
63140             }
63141         }
63142         else if (item != null && item instanceof Label) {
63143             var label = item;
63144             if (horizontalFlip) {
63145                 label.setX(axisCoordinate * 2 - label.getX());
63146                 label.setAngle(-label.getAngle());
63147             }
63148             else {
63149                 label.setY(axisCoordinate * 2 - label.getY());
63150                 if (label.getPitch() != null) {
63151                     label.setAngle(Math.PI - label.getAngle());
63152                 }
63153                 else {
63154                     label.setAngle(-label.getAngle());
63155                 }
63156             }
63157             var style = label.getStyle();
63158             if (style != null) {
63159                 if (style.getAlignment() === TextStyle.Alignment.LEFT) {
63160                     label.setStyle(style.deriveStyle$com_eteks_sweethome3d_model_TextStyle_Alignment(TextStyle.Alignment.RIGHT));
63161                 }
63162                 else if (style.getAlignment() === TextStyle.Alignment.RIGHT) {
63163                     label.setStyle(style.deriveStyle$com_eteks_sweethome3d_model_TextStyle_Alignment(TextStyle.Alignment.LEFT));
63164                 }
63165             }
63166         }
63167         else if (item != null && item instanceof Compass) {
63168             var compass = item;
63169             if (horizontalFlip) {
63170                 compass.setX(axisCoordinate * 2 - compass.getX());
63171                 compass.setNorthDirection(-compass.getNorthDirection());
63172             }
63173             else {
63174                 compass.setY(axisCoordinate * 2 - compass.getY());
63175                 compass.setNorthDirection(Math.PI - compass.getNorthDirection());
63176             }
63177         }
63178     };
63179     /**
63180      * Flips the name of the given <code>piece</code>.
63181      * @param {HomePieceOfFurniture} piece
63182      * @param {number} nameBaseOffset
63183      * @param {boolean} horizontalFlip
63184      * @private
63185      */
63186     PlanController.flipPieceOfFurnitureName = function (piece, nameBaseOffset, horizontalFlip) {
63187         if (horizontalFlip) {
63188             piece.setNameXOffset(-piece.getNameXOffset());
63189             var nameStyle = piece.getNameStyle();
63190             if (nameStyle != null) {
63191                 if (nameStyle.getAlignment() === TextStyle.Alignment.LEFT) {
63192                     piece.setNameStyle(nameStyle.deriveStyle$com_eteks_sweethome3d_model_TextStyle_Alignment(TextStyle.Alignment.RIGHT));
63193                 }
63194                 else if (nameStyle.getAlignment() === TextStyle.Alignment.RIGHT) {
63195                     piece.setNameStyle(nameStyle.deriveStyle$com_eteks_sweethome3d_model_TextStyle_Alignment(TextStyle.Alignment.LEFT));
63196                 }
63197             }
63198         }
63199         else {
63200             piece.setNameYOffset(-piece.getNameYOffset());
63201             if (piece.getNameXOffset() !== 0 || piece.getNameYOffset() !== 0) {
63202                 piece.setNameXOffset(piece.getNameXOffset() - nameBaseOffset * Math.sin(piece.getNameAngle()));
63203                 piece.setNameYOffset(piece.getNameYOffset() - nameBaseOffset * Math.cos(piece.getNameAngle()));
63204             }
63205             piece.setNameAngle(-piece.getNameAngle());
63206         }
63207     };
63208     /**
63209      * Returns the offset between the vertical middle of the text and its base.
63210      * @param {string} text
63211      * @param {TextStyle} textStyle
63212      * @param {Object} itemClass
63213      * @return {number}
63214      * @private
63215      */
63216     PlanController.prototype.getTextBaseOffset = function (text, textStyle, itemClass) {
63217         if (textStyle == null) {
63218             textStyle = this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getDefaultTextStyle(itemClass);
63219         }
63220         var textBounds = this.getView().getTextBounds(text != null ? text : "Ag", textStyle, 0, 0, 0);
63221         return (textBounds[textBounds.length - 1][1] + textBounds[0][1]) / 2;
63222     };
63223     /**
63224      * Controls how selected walls are joined.
63225      */
63226     PlanController.prototype.joinSelectedWalls = function () {
63227         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
63228         var selectedWalls = Home.getWallsSubList(selectedItems);
63229         var walls = [null, null];
63230         for (var index = 0; index < selectedWalls.length; index++) {
63231             var wall = selectedWalls[index];
63232             {
63233                 if ((wall.getArcExtent() == null || wall.getArcExtent() === 0.0) && (wall.getWallAtStart() == null || wall.getWallAtEnd() == null)) {
63234                     if (walls[0] == null) {
63235                         walls[0] = wall;
63236                     }
63237                     else {
63238                         walls[1] = wall;
63239                         break;
63240                     }
63241                 }
63242             }
63243         }
63244         if (walls[1] == null) {
63245             /* sort */ (function (l, c) { if (c.compare)
63246                 l.sort(function (e1, e2) { return c.compare(e1, e2); });
63247             else
63248                 l.sort(c); })(selectedWalls, new PlanController.PlanController$0(this, walls));
63249             if (walls[0] !== /* get */ selectedWalls[1]) {
63250                 walls[1] = /* get */ selectedWalls[1];
63251             }
63252         }
63253         if (walls[1] != null) {
63254             var firstWallAngle = Math.atan2(walls[0].getYEnd() - walls[0].getYStart(), walls[0].getXEnd() - walls[0].getXStart());
63255             var secondWallAngle = Math.atan2(walls[1].getYEnd() - walls[1].getYStart(), walls[1].getXEnd() - walls[1].getXStart());
63256             var wallsAngle = Math.abs(firstWallAngle - secondWallAngle) % Math.PI;
63257             var parallel = wallsAngle <= Math.PI / 360 || (Math.PI - wallsAngle) <= Math.PI / 360;
63258             var joinPoint = null;
63259             if (!parallel) {
63260                 joinPoint = PlanController.computeIntersection$float$float$float$float$float$float$float$float(walls[0].getXStart(), walls[0].getYStart(), walls[0].getXEnd(), walls[0].getYEnd(), walls[1].getXStart(), walls[1].getYStart(), walls[1].getXEnd(), walls[1].getYEnd());
63261             }
63262             else if (java.awt.geom.Line2D.ptLineDistSq(walls[1].getXStart(), walls[1].getYStart(), walls[1].getXEnd(), walls[1].getYEnd(), walls[0].getXStart(), walls[0].getYStart()) < 0.01 && java.awt.geom.Line2D.ptLineDistSq(walls[1].getXStart(), walls[1].getYStart(), walls[1].getXEnd(), walls[1].getYEnd(), walls[0].getXEnd(), walls[0].getYEnd()) < 0.01) {
63263                 if ((walls[1].getWallAtStart() == null) !== (walls[1].getWallAtEnd() == null)) {
63264                     if (walls[1].getWallAtStart() == null) {
63265                         joinPoint = [walls[1].getXStart(), walls[1].getYStart()];
63266                     }
63267                     else {
63268                         joinPoint = [walls[1].getXEnd(), walls[1].getYEnd()];
63269                     }
63270                 }
63271                 else if (walls[1].getWallAtStart() == null && walls[1].getWallAtEnd() == null) {
63272                     var wallStartDistanceToSegment = java.awt.geom.Line2D.ptSegDistSq(walls[1].getXStart(), walls[1].getYStart(), walls[1].getXEnd(), walls[1].getYEnd(), walls[0].getXStart(), walls[0].getYStart());
63273                     var wallEndDistanceToSegment = java.awt.geom.Line2D.ptSegDistSq(walls[1].getXStart(), walls[1].getYStart(), walls[1].getXEnd(), walls[1].getYEnd(), walls[0].getXEnd(), walls[0].getYEnd());
63274                     if (wallStartDistanceToSegment > 0.01 && wallEndDistanceToSegment > 0.01) {
63275                         if (walls[0].getWallAtEnd() != null || walls[0].getWallAtStart() == null && wallStartDistanceToSegment <= wallEndDistanceToSegment) {
63276                             if (java.awt.geom.Point2D.distanceSq(walls[1].getXStart(), walls[1].getYStart(), walls[0].getXStart(), walls[0].getYStart()) < java.awt.geom.Point2D.distanceSq(walls[1].getXEnd(), walls[1].getYEnd(), walls[0].getXStart(), walls[0].getYStart())) {
63277                                 joinPoint = [walls[1].getXStart(), walls[1].getYStart()];
63278                             }
63279                             else {
63280                                 joinPoint = [walls[1].getXEnd(), walls[1].getYEnd()];
63281                             }
63282                         }
63283                         else {
63284                             if (java.awt.geom.Point2D.distanceSq(walls[1].getXStart(), walls[1].getYStart(), walls[0].getXEnd(), walls[0].getYEnd()) < java.awt.geom.Point2D.distanceSq(walls[1].getXEnd(), walls[1].getYEnd(), walls[0].getXEnd(), walls[0].getYEnd())) {
63285                                 joinPoint = [walls[1].getXStart(), walls[1].getYStart()];
63286                             }
63287                             else {
63288                                 joinPoint = [walls[1].getXEnd(), walls[1].getYEnd()];
63289                             }
63290                         }
63291                     }
63292                 }
63293             }
63294             if (joinPoint != null) {
63295                 var joinedWalls = PlanController.JoinedWall.getJoinedWalls(/* asList */ [walls[0], walls[1]]);
63296                 this.doJoinWalls(joinedWalls, joinPoint);
63297                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.WallsJoiningUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, /* toArray */ selectedItems.slice(0), this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection(), joinedWalls, joinPoint));
63298             }
63299         }
63300     };
63301     /**
63302      * Joins two walls at the given point.
63303      * @param {com.eteks.sweethome3d.viewcontroller.PlanController.JoinedWall[]} joinedWalls
63304      * @param {float[]} joinPoint
63305      * @private
63306      */
63307     PlanController.prototype.doJoinWalls = function (joinedWalls, joinPoint) {
63308         var walls = [joinedWalls[0].getWall(), joinedWalls[1].getWall()];
63309         var connected = false;
63310         for (var i = 0; i < 2; i++) {
63311             {
63312                 var joinAtEnd = walls[i].getWallAtEnd() == null;
63313                 var joinAtStart = walls[i].getWallAtStart() == null;
63314                 if (joinAtStart && joinAtEnd) {
63315                     if (java.awt.geom.Point2D.distanceSq(walls[i].getXStart(), walls[i].getYStart(), joinPoint[0], joinPoint[1]) < java.awt.geom.Point2D.distanceSq(walls[i].getXEnd(), walls[i].getYEnd(), joinPoint[0], joinPoint[1])) {
63316                         joinAtEnd = false;
63317                     }
63318                     else {
63319                         joinAtStart = false;
63320                     }
63321                 }
63322                 if (joinAtEnd) {
63323                     walls[i].setXEnd(joinPoint[0]);
63324                     walls[i].setYEnd(joinPoint[1]);
63325                 }
63326                 else if (joinAtStart) {
63327                     walls[i].setXStart(joinPoint[0]);
63328                     walls[i].setYStart(joinPoint[1]);
63329                 }
63330                 if (connected || walls[(i + 1) % 2].getWallAtStart() == null || walls[(i + 1) % 2].getWallAtEnd() == null) {
63331                     if (joinAtEnd) {
63332                         walls[i].setWallAtEnd(walls[(i + 1) % 2]);
63333                         connected = true;
63334                     }
63335                     else if (joinAtStart) {
63336                         walls[i].setWallAtStart(walls[(i + 1) % 2]);
63337                         connected = true;
63338                     }
63339                 }
63340             }
63341             ;
63342         }
63343         if (connected) {
63344             this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setSelectedItems(/* asList */ [walls[0], walls[1]]);
63345         }
63346         else {
63347             this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setSelectedItems(/* asList */ [walls[0]]);
63348         }
63349     };
63350     /**
63351      * Controls the direction reverse of selected walls.
63352      */
63353     PlanController.prototype.reverseSelectedWallsDirection = function () {
63354         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
63355         var selectedWalls = Home.getWallsSubList(selectedItems);
63356         if (!(selectedWalls.length == 0)) {
63357             var reversedWalls = selectedWalls.slice(0);
63358             this.doReverseWallsDirection(reversedWalls);
63359             this.selectAndShowItems$java_util_List$boolean(/* asList */ reversedWalls.slice(0), false);
63360             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.WallsDirectionReversingUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, /* toArray */ selectedItems.slice(0), this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection(), reversedWalls));
63361         }
63362     };
63363     /**
63364      * Reverses the <code>walls</code> direction.
63365      * @param {com.eteks.sweethome3d.model.Wall[]} walls
63366      * @private
63367      */
63368     PlanController.prototype.doReverseWallsDirection = function (walls) {
63369         for (var index = 0; index < walls.length; index++) {
63370             var wall = walls[index];
63371             {
63372                 var xStart = wall.getXStart();
63373                 var yStart = wall.getYStart();
63374                 var xEnd = wall.getXEnd();
63375                 var yEnd = wall.getYEnd();
63376                 wall.setXStart(xEnd);
63377                 wall.setYStart(yEnd);
63378                 wall.setXEnd(xStart);
63379                 wall.setYEnd(yStart);
63380                 if (wall.getArcExtent() != null) {
63381                     wall.setArcExtent(-wall.getArcExtent());
63382                 }
63383                 var wallAtStart = wall.getWallAtStart();
63384                 var joinedAtEndOfWallAtStart = wallAtStart != null && wallAtStart.getWallAtEnd() === wall;
63385                 var joinedAtStartOfWallAtStart = wallAtStart != null && wallAtStart.getWallAtStart() === wall;
63386                 var wallAtEnd = wall.getWallAtEnd();
63387                 var joinedAtEndOfWallAtEnd = wallAtEnd != null && wallAtEnd.getWallAtEnd() === wall;
63388                 var joinedAtStartOfWallAtEnd = wallAtEnd != null && wallAtEnd.getWallAtStart() === wall;
63389                 wall.setWallAtStart(wallAtEnd);
63390                 wall.setWallAtEnd(wallAtStart);
63391                 if (joinedAtEndOfWallAtStart) {
63392                     wallAtStart.setWallAtEnd(wall);
63393                 }
63394                 else if (joinedAtStartOfWallAtStart) {
63395                     wallAtStart.setWallAtStart(wall);
63396                 }
63397                 if (joinedAtEndOfWallAtEnd) {
63398                     wallAtEnd.setWallAtEnd(wall);
63399                 }
63400                 else if (joinedAtStartOfWallAtEnd) {
63401                     wallAtEnd.setWallAtStart(wall);
63402                 }
63403                 var heightAtEnd = wall.getHeightAtEnd();
63404                 if (heightAtEnd != null) {
63405                     var height = wall.getHeight();
63406                     wall.setHeight(heightAtEnd);
63407                     wall.setHeightAtEnd(height);
63408                 }
63409                 PlanController.reverseWallSidesStyle(wall);
63410             }
63411         }
63412     };
63413     /**
63414      * Exchanges the style of wall sides.
63415      * @param {Wall} wall
63416      * @private
63417      */
63418     PlanController.reverseWallSidesStyle = function (wall) {
63419         var rightSideColor = wall.getRightSideColor();
63420         var rightSideTexture = wall.getRightSideTexture();
63421         var leftSideShininess = wall.getLeftSideShininess();
63422         var leftSideBaseboard = wall.getLeftSideBaseboard();
63423         var leftSideColor = wall.getLeftSideColor();
63424         var leftSideTexture = wall.getLeftSideTexture();
63425         var rightSideShininess = wall.getRightSideShininess();
63426         var rightSideBaseboard = wall.getRightSideBaseboard();
63427         wall.setLeftSideColor(rightSideColor);
63428         wall.setLeftSideTexture(rightSideTexture);
63429         wall.setLeftSideShininess(rightSideShininess);
63430         wall.setLeftSideBaseboard(rightSideBaseboard);
63431         wall.setRightSideColor(leftSideColor);
63432         wall.setRightSideTexture(leftSideTexture);
63433         wall.setRightSideShininess(leftSideShininess);
63434         wall.setRightSideBaseboard(leftSideBaseboard);
63435     };
63436     /**
63437      * Controls the split of the selected wall in two joined walls of equal length.
63438      */
63439     PlanController.prototype.splitSelectedWall = function () {
63440         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
63441         var selectedWalls = Home.getWallsSubList(selectedItems);
63442         if ( /* size */selectedWalls.length === 1) {
63443             var allLevelsSelection = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection();
63444             var basePlanLocked = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked();
63445             var splitWall = selectedWalls[0];
63446             var splitJoinedWall = new PlanController.JoinedWall(splitWall);
63447             var xStart = splitWall.getXStart();
63448             var yStart = splitWall.getYStart();
63449             var xEnd = splitWall.getXEnd();
63450             var yEnd = splitWall.getYEnd();
63451             var xMiddle = (xStart + xEnd) / 2;
63452             var yMiddle = (yStart + yEnd) / 2;
63453             var wallAtStart = splitWall.getWallAtStart();
63454             var joinedAtEndOfWallAtStart = wallAtStart != null && wallAtStart.getWallAtEnd() === splitWall;
63455             var joinedAtStartOfWallAtStart = wallAtStart != null && wallAtStart.getWallAtStart() === splitWall;
63456             var wallAtEnd = splitWall.getWallAtEnd();
63457             var joinedAtEndOfWallAtEnd = wallAtEnd != null && wallAtEnd.getWallAtEnd() === splitWall;
63458             var joinedAtStartOfWallAtEnd = wallAtEnd != null && wallAtEnd.getWallAtStart() === splitWall;
63459             var firstWall = splitWall.duplicate();
63460             this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addWall(firstWall);
63461             firstWall.setLevel(splitWall.getLevel());
63462             var secondWall = splitWall.duplicate();
63463             this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addWall(secondWall);
63464             secondWall.setLevel(splitWall.getLevel());
63465             firstWall.setXEnd(xMiddle);
63466             firstWall.setYEnd(yMiddle);
63467             secondWall.setXStart(xMiddle);
63468             secondWall.setYStart(yMiddle);
63469             if (splitWall.getHeightAtEnd() != null) {
63470                 var heightAtMiddle = (splitWall.getHeight() + splitWall.getHeightAtEnd()) / 2;
63471                 firstWall.setHeightAtEnd(heightAtMiddle);
63472                 secondWall.setHeight(heightAtMiddle);
63473             }
63474             firstWall.setWallAtEnd(secondWall);
63475             secondWall.setWallAtStart(firstWall);
63476             firstWall.setWallAtStart(wallAtStart);
63477             if (joinedAtEndOfWallAtStart) {
63478                 wallAtStart.setWallAtEnd(firstWall);
63479             }
63480             else if (joinedAtStartOfWallAtStart) {
63481                 wallAtStart.setWallAtStart(firstWall);
63482             }
63483             secondWall.setWallAtEnd(wallAtEnd);
63484             if (joinedAtStartOfWallAtEnd) {
63485                 wallAtEnd.setWallAtStart(secondWall);
63486             }
63487             else if (joinedAtEndOfWallAtEnd) {
63488                 wallAtEnd.setWallAtEnd(secondWall);
63489             }
63490             this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deleteWall(splitWall);
63491             this.selectAndShowItems$java_util_List$boolean(/* asList */ [firstWall].slice(0), false);
63492             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.WallSplittingUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, /* toArray */ selectedItems.slice(0), basePlanLocked, allLevelsSelection, splitJoinedWall, new PlanController.JoinedWall(firstWall), new PlanController.JoinedWall(secondWall), this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked()));
63493         }
63494     };
63495     /**
63496      * Controls the modification of the selected rooms.
63497      */
63498     PlanController.prototype.modifySelectedRooms = function () {
63499         if (!(Home.getRoomsSubList(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()).length == 0)) {
63500             new RoomController(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, this.__com_eteks_sweethome3d_viewcontroller_PlanController_viewFactory, this.__com_eteks_sweethome3d_viewcontroller_PlanController_contentManager, this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport).displayView(this.getView());
63501         }
63502     };
63503     PlanController.prototype.createDimensionLine$float$float = function (x, y) {
63504         new DimensionLineController(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home, x, y, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, this.__com_eteks_sweethome3d_viewcontroller_PlanController_viewFactory, this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport).displayView(this.getView());
63505     };
63506     /**
63507      * Creates a new label using its controller.
63508      * @param {number} x
63509      * @param {number} y
63510      */
63511     PlanController.prototype.createLabel = function (x, y) {
63512         new LabelController(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home, x, y, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, this.__com_eteks_sweethome3d_viewcontroller_PlanController_viewFactory, this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport).displayView(this.getView());
63513     };
63514     /**
63515      * Controls the modification of the selected labels.
63516      */
63517     PlanController.prototype.modifySelectedLabels = function () {
63518         if (!(Home.getLabelsSubList(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()).length == 0)) {
63519             new LabelController(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, this.__com_eteks_sweethome3d_viewcontroller_PlanController_viewFactory, this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport).displayView(this.getView());
63520         }
63521     };
63522     /**
63523      * Controls the modification of the selected polylines.
63524      */
63525     PlanController.prototype.modifySelectedPolylines = function () {
63526         if (!(Home.getPolylinesSubList(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()).length == 0)) {
63527             new PolylineController(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, this.__com_eteks_sweethome3d_viewcontroller_PlanController_viewFactory, this.__com_eteks_sweethome3d_viewcontroller_PlanController_contentManager, this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport).displayView(this.getView());
63528         }
63529     };
63530     /**
63531      * Controls the modification of the selected labels.
63532      */
63533     PlanController.prototype.modifySelectedDimensionLines = function () {
63534         if (!(Home.getDimensionLinesSubList(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()).length == 0)) {
63535             new DimensionLineController(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, this.__com_eteks_sweethome3d_viewcontroller_PlanController_viewFactory, this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport).displayView(this.getView());
63536         }
63537     };
63538     /**
63539      * Controls the modification of the compass.
63540      */
63541     PlanController.prototype.modifyCompass = function () {
63542         new CompassController(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, this.__com_eteks_sweethome3d_viewcontroller_PlanController_viewFactory, this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport).displayView(this.getView());
63543     };
63544     /**
63545      * Controls the modification of the observer camera.
63546      */
63547     PlanController.prototype.modifyObserverCamera = function () {
63548         new ObserverCameraController(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, this.__com_eteks_sweethome3d_viewcontroller_PlanController_viewFactory).displayView(this.getView());
63549     };
63550     /**
63551      * Toggles bold style of texts in selected items.
63552      */
63553     PlanController.prototype.toggleBoldStyle = function () {
63554         var selectionBoldStyle = null;
63555         {
63556             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
63557             for (var index = 0; index < array.length; index++) {
63558                 var item = array[index];
63559                 {
63560                     var bold = void 0;
63561                     if (item != null && item instanceof Label) {
63562                         bold = this.getItemTextStyle(item, item.getStyle()).isBold();
63563                     }
63564                     else if ((item != null && item instanceof HomePieceOfFurniture) && item.isVisible()) {
63565                         bold = this.getItemTextStyle(item, item.getNameStyle()).isBold();
63566                     }
63567                     else if (item != null && item instanceof Room) {
63568                         var room = item;
63569                         bold = this.getItemTextStyle(room, room.getNameStyle()).isBold();
63570                         if (bold !== this.getItemTextStyle(room, room.getAreaStyle()).isBold()) {
63571                             bold = null;
63572                         }
63573                     }
63574                     else if (item != null && item instanceof DimensionLine) {
63575                         bold = this.getItemTextStyle(item, item.getLengthStyle()).isBold();
63576                     }
63577                     else {
63578                         continue;
63579                     }
63580                     if (selectionBoldStyle == null) {
63581                         selectionBoldStyle = bold;
63582                     }
63583                     else if (bold == null || !(selectionBoldStyle === bold)) {
63584                         selectionBoldStyle = null;
63585                         break;
63586                     }
63587                 }
63588             }
63589         }
63590         if (selectionBoldStyle == null) {
63591             selectionBoldStyle = true;
63592         }
63593         else {
63594             selectionBoldStyle = !selectionBoldStyle;
63595         }
63596         var itemsWithText = ([]);
63597         var oldTextStyles = ([]);
63598         var textStyles = ([]);
63599         {
63600             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
63601             for (var index = 0; index < array.length; index++) {
63602                 var item = array[index];
63603                 {
63604                     if (item != null && item instanceof Label) {
63605                         var label = item;
63606                         /* add */ (itemsWithText.push(label) > 0);
63607                         var oldTextStyle = this.getItemTextStyle(label, label.getStyle());
63608                         /* add */ (oldTextStyles.push(oldTextStyle) > 0);
63609                         /* add */ (textStyles.push(oldTextStyle.deriveBoldStyle(selectionBoldStyle)) > 0);
63610                     }
63611                     else if (item != null && item instanceof HomePieceOfFurniture) {
63612                         var piece = item;
63613                         if (piece.isVisible()) {
63614                             /* add */ (itemsWithText.push(piece) > 0);
63615                             var oldNameStyle = this.getItemTextStyle(piece, piece.getNameStyle());
63616                             /* add */ (oldTextStyles.push(oldNameStyle) > 0);
63617                             /* add */ (textStyles.push(oldNameStyle.deriveBoldStyle(selectionBoldStyle)) > 0);
63618                         }
63619                     }
63620                     else if (item != null && item instanceof Room) {
63621                         var room = item;
63622                         /* add */ (itemsWithText.push(room) > 0);
63623                         var oldNameStyle = this.getItemTextStyle(room, room.getNameStyle());
63624                         /* add */ (oldTextStyles.push(oldNameStyle) > 0);
63625                         /* add */ (textStyles.push(oldNameStyle.deriveBoldStyle(selectionBoldStyle)) > 0);
63626                         var oldAreaStyle = this.getItemTextStyle(room, room.getAreaStyle());
63627                         /* add */ (oldTextStyles.push(oldAreaStyle) > 0);
63628                         /* add */ (textStyles.push(oldAreaStyle.deriveBoldStyle(selectionBoldStyle)) > 0);
63629                     }
63630                     else if (item != null && item instanceof DimensionLine) {
63631                         var dimensionLine = item;
63632                         /* add */ (itemsWithText.push(dimensionLine) > 0);
63633                         var oldLengthStyle = this.getItemTextStyle(dimensionLine, dimensionLine.getLengthStyle());
63634                         /* add */ (oldTextStyles.push(oldLengthStyle) > 0);
63635                         /* add */ (textStyles.push(oldLengthStyle.deriveBoldStyle(selectionBoldStyle)) > 0);
63636                     }
63637                 }
63638             }
63639         }
63640         this.modifyTextStyle(/* toArray */ itemsWithText.slice(0), /* toArray */ oldTextStyles.slice(0), /* toArray */ textStyles.slice(0));
63641     };
63642     /**
63643      * Returns <code>textStyle</code> if not null or the default text style.
63644      * @param {Object} item
63645      * @param {TextStyle} textStyle
63646      * @return {TextStyle}
63647      * @private
63648      */
63649     PlanController.prototype.getItemTextStyle = function (item, textStyle) {
63650         if (textStyle == null) {
63651             textStyle = this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getDefaultTextStyle(item.constructor);
63652         }
63653         return textStyle;
63654     };
63655     /**
63656      * Toggles italic style of texts in selected items.
63657      */
63658     PlanController.prototype.toggleItalicStyle = function () {
63659         var selectionItalicStyle = null;
63660         {
63661             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
63662             for (var index = 0; index < array.length; index++) {
63663                 var item = array[index];
63664                 {
63665                     var italic = void 0;
63666                     if (item != null && item instanceof Label) {
63667                         italic = this.getItemTextStyle(item, item.getStyle()).isItalic();
63668                     }
63669                     else if ((item != null && item instanceof HomePieceOfFurniture) && item.isVisible()) {
63670                         italic = this.getItemTextStyle(item, item.getNameStyle()).isItalic();
63671                     }
63672                     else if (item != null && item instanceof Room) {
63673                         var room = item;
63674                         italic = this.getItemTextStyle(room, room.getNameStyle()).isItalic();
63675                         if (italic !== this.getItemTextStyle(room, room.getAreaStyle()).isItalic()) {
63676                             italic = null;
63677                         }
63678                     }
63679                     else if (item != null && item instanceof DimensionLine) {
63680                         italic = this.getItemTextStyle(item, item.getLengthStyle()).isItalic();
63681                     }
63682                     else {
63683                         continue;
63684                     }
63685                     if (selectionItalicStyle == null) {
63686                         selectionItalicStyle = italic;
63687                     }
63688                     else if (italic == null || !(selectionItalicStyle === italic)) {
63689                         selectionItalicStyle = null;
63690                         break;
63691                     }
63692                 }
63693             }
63694         }
63695         if (selectionItalicStyle == null) {
63696             selectionItalicStyle = true;
63697         }
63698         else {
63699             selectionItalicStyle = !selectionItalicStyle;
63700         }
63701         var itemsWithText = ([]);
63702         var oldTextStyles = ([]);
63703         var textStyles = ([]);
63704         {
63705             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
63706             for (var index = 0; index < array.length; index++) {
63707                 var item = array[index];
63708                 {
63709                     if (item != null && item instanceof Label) {
63710                         var label = item;
63711                         /* add */ (itemsWithText.push(label) > 0);
63712                         var oldTextStyle = this.getItemTextStyle(label, label.getStyle());
63713                         /* add */ (oldTextStyles.push(oldTextStyle) > 0);
63714                         /* add */ (textStyles.push(oldTextStyle.deriveItalicStyle(selectionItalicStyle)) > 0);
63715                     }
63716                     else if (item != null && item instanceof HomePieceOfFurniture) {
63717                         var piece = item;
63718                         if (piece.isVisible()) {
63719                             /* add */ (itemsWithText.push(piece) > 0);
63720                             var oldNameStyle = this.getItemTextStyle(piece, piece.getNameStyle());
63721                             /* add */ (oldTextStyles.push(oldNameStyle) > 0);
63722                             /* add */ (textStyles.push(oldNameStyle.deriveItalicStyle(selectionItalicStyle)) > 0);
63723                         }
63724                     }
63725                     else if (item != null && item instanceof Room) {
63726                         var room = item;
63727                         /* add */ (itemsWithText.push(room) > 0);
63728                         var oldNameStyle = this.getItemTextStyle(room, room.getNameStyle());
63729                         /* add */ (oldTextStyles.push(oldNameStyle) > 0);
63730                         /* add */ (textStyles.push(oldNameStyle.deriveItalicStyle(selectionItalicStyle)) > 0);
63731                         var oldAreaStyle = this.getItemTextStyle(room, room.getAreaStyle());
63732                         /* add */ (oldTextStyles.push(oldAreaStyle) > 0);
63733                         /* add */ (textStyles.push(oldAreaStyle.deriveItalicStyle(selectionItalicStyle)) > 0);
63734                     }
63735                     else if (item != null && item instanceof DimensionLine) {
63736                         var dimensionLine = item;
63737                         /* add */ (itemsWithText.push(dimensionLine) > 0);
63738                         var oldLengthStyle = this.getItemTextStyle(dimensionLine, dimensionLine.getLengthStyle());
63739                         /* add */ (oldTextStyles.push(oldLengthStyle) > 0);
63740                         /* add */ (textStyles.push(oldLengthStyle.deriveItalicStyle(selectionItalicStyle)) > 0);
63741                     }
63742                 }
63743             }
63744         }
63745         this.modifyTextStyle(/* toArray */ itemsWithText.slice(0), /* toArray */ oldTextStyles.slice(0), /* toArray */ textStyles.slice(0));
63746     };
63747     /**
63748      * Increase the size of texts in selected items.
63749      */
63750     PlanController.prototype.increaseTextSize = function () {
63751         this.applyFactorToTextSize(1.1);
63752     };
63753     /**
63754      * Decrease the size of texts in selected items.
63755      */
63756     PlanController.prototype.decreaseTextSize = function () {
63757         this.applyFactorToTextSize(1 / 1.1);
63758     };
63759     /**
63760      * Applies a factor to the font size of the texts of the selected items in home.
63761      * @param {number} factor
63762      * @private
63763      */
63764     PlanController.prototype.applyFactorToTextSize = function (factor) {
63765         var itemsWithText = ([]);
63766         var oldTextStyles = ([]);
63767         var textStyles = ([]);
63768         {
63769             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
63770             for (var index = 0; index < array.length; index++) {
63771                 var item = array[index];
63772                 {
63773                     if (item != null && item instanceof Label) {
63774                         var label = item;
63775                         /* add */ (itemsWithText.push(label) > 0);
63776                         var oldLabelStyle = this.getItemTextStyle(item, label.getStyle());
63777                         /* add */ (oldTextStyles.push(oldLabelStyle) > 0);
63778                         /* add */ (textStyles.push(oldLabelStyle.deriveStyle$float(Math.round(oldLabelStyle.getFontSize() * factor))) > 0);
63779                     }
63780                     else if (item != null && item instanceof HomePieceOfFurniture) {
63781                         var piece = item;
63782                         if (piece.isVisible()) {
63783                             /* add */ (itemsWithText.push(piece) > 0);
63784                             var oldNameStyle = this.getItemTextStyle(piece, piece.getNameStyle());
63785                             /* add */ (oldTextStyles.push(oldNameStyle) > 0);
63786                             /* add */ (textStyles.push(oldNameStyle.deriveStyle$float(Math.round(oldNameStyle.getFontSize() * factor))) > 0);
63787                         }
63788                     }
63789                     else if (item != null && item instanceof Room) {
63790                         var room = item;
63791                         /* add */ (itemsWithText.push(room) > 0);
63792                         var oldNameStyle = this.getItemTextStyle(room, room.getNameStyle());
63793                         /* add */ (oldTextStyles.push(oldNameStyle) > 0);
63794                         /* add */ (textStyles.push(oldNameStyle.deriveStyle$float(Math.round(oldNameStyle.getFontSize() * factor))) > 0);
63795                         var oldAreaStyle = this.getItemTextStyle(room, room.getAreaStyle());
63796                         /* add */ (oldTextStyles.push(oldAreaStyle) > 0);
63797                         /* add */ (textStyles.push(oldAreaStyle.deriveStyle$float(Math.round(oldAreaStyle.getFontSize() * factor))) > 0);
63798                     }
63799                     else if (item != null && item instanceof DimensionLine) {
63800                         var dimensionLine = item;
63801                         /* add */ (itemsWithText.push(dimensionLine) > 0);
63802                         var oldLengthStyle = this.getItemTextStyle(dimensionLine, dimensionLine.getLengthStyle());
63803                         /* add */ (oldTextStyles.push(oldLengthStyle) > 0);
63804                         /* add */ (textStyles.push(oldLengthStyle.deriveStyle$float(Math.round(oldLengthStyle.getFontSize() * factor))) > 0);
63805                     }
63806                 }
63807             }
63808         }
63809         this.modifyTextStyle(/* toArray */ itemsWithText.slice(0), /* toArray */ oldTextStyles.slice(0), /* toArray */ textStyles.slice(0));
63810     };
63811     /**
63812      * Changes the style of items and posts an undoable change style operation.
63813      * @param {com.eteks.sweethome3d.model.Selectable[]} items
63814      * @param {com.eteks.sweethome3d.model.TextStyle[]} oldStyles
63815      * @param {com.eteks.sweethome3d.model.TextStyle[]} styles
63816      * @private
63817      */
63818     PlanController.prototype.modifyTextStyle = function (items, oldStyles, styles) {
63819         var allLevelsSelection = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection();
63820         var oldSelectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
63821         var oldSelection = oldSelectedItems.slice(0);
63822         PlanController.doModifyTextStyle(items, styles);
63823         this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.TextStyleModificationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldSelection, allLevelsSelection, oldStyles, items, styles));
63824     };
63825     /**
63826      * Changes the style of items.
63827      * @param {com.eteks.sweethome3d.model.Selectable[]} items
63828      * @param {com.eteks.sweethome3d.model.TextStyle[]} styles
63829      * @private
63830      */
63831     PlanController.doModifyTextStyle = function (items, styles) {
63832         var styleIndex = 0;
63833         for (var index = 0; index < items.length; index++) {
63834             var item = items[index];
63835             {
63836                 if (item != null && item instanceof Label) {
63837                     item.setStyle(styles[styleIndex++]);
63838                 }
63839                 else if (item != null && item instanceof HomePieceOfFurniture) {
63840                     var piece = item;
63841                     if (piece.isVisible()) {
63842                         piece.setNameStyle(styles[styleIndex++]);
63843                     }
63844                 }
63845                 else if (item != null && item instanceof Room) {
63846                     var room = item;
63847                     room.setNameStyle(styles[styleIndex++]);
63848                     room.setAreaStyle(styles[styleIndex++]);
63849                 }
63850                 else if (item != null && item instanceof DimensionLine) {
63851                     item.setLengthStyle(styles[styleIndex++]);
63852                 }
63853             }
63854         }
63855     };
63856     /**
63857      * Returns the minimum scale of the plan view.
63858      * @return {number}
63859      */
63860     PlanController.prototype.getMinimumScale = function () {
63861         return 0.01;
63862     };
63863     /**
63864      * Returns the maximum scale of the plan view.
63865      * @return {number}
63866      */
63867     PlanController.prototype.getMaximumScale = function () {
63868         return 10.0;
63869     };
63870     /**
63871      * Returns the scale in plan view.
63872      * @return {number}
63873      */
63874     PlanController.prototype.getScale = function () {
63875         return this.getView().getScale();
63876     };
63877     /**
63878      * Controls the scale in plan view and and fires a <code>PropertyChangeEvent</code>.
63879      * @param {number} scale
63880      */
63881     PlanController.prototype.setScale = function (scale) {
63882         scale = Math.max(this.getMinimumScale(), Math.min(scale, this.getMaximumScale()));
63883         if (scale !== this.getView().getScale()) {
63884             var oldScale = this.getView().getScale();
63885             /* clear */ this.furnitureSidesCache.entries = [];
63886             if (this.getView() != null) {
63887                 var x = this.getView().convertXModelToScreen(this.getXLastMouseMove());
63888                 var y = this.getView().convertXModelToScreen(this.getYLastMouseMove());
63889                 this.getView().setScale(scale);
63890                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getObserverCamera().setPlanScale(scale < 0.4 ? 0.4 / scale : 1.0);
63891                 this.moveMouse(this.getView().convertXPixelToModel(x), this.getView().convertYPixelToModel(y));
63892             }
63893             this.propertyChangeSupport.firePropertyChange(/* name */ "SCALE", oldScale, scale);
63894             this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setProperty(PlanController.SCALE_VISUAL_PROPERTY, /* valueOf */ String(scale).toString());
63895         }
63896     };
63897     /**
63898      * Sets the selected level in home.
63899      * @param {Level} level
63900      */
63901     PlanController.prototype.setSelectedLevel = function (level) {
63902         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setSelectedLevel(level);
63903     };
63904     /**
63905      * Selects all visible items in the selected level of home.
63906      */
63907     PlanController.prototype.selectAll = function () {
63908         var all = this.getVisibleItemsAtSelectedLevel();
63909         if (this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked()) {
63910             this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setSelectedItems(this.getItemsNotPartOfBasePlan(all));
63911         }
63912         else {
63913             this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setSelectedItems(all);
63914         }
63915         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setAllLevelsSelection(false);
63916     };
63917     /**
63918      * Returns the viewable and selectable home items at the selected level, except camera.
63919      * @return {*[]}
63920      * @private
63921      */
63922     PlanController.prototype.getVisibleItemsAtSelectedLevel = function () {
63923         var selectableItems = ([]);
63924         var selectedLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
63925         {
63926             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectableViewableItems();
63927             for (var index = 0; index < array.length; index++) {
63928                 var item = array[index];
63929                 {
63930                     if (item != null && item instanceof HomePieceOfFurniture) {
63931                         if (this.isPieceOfFurnitureVisibleAtSelectedLevel(item)) {
63932                             /* add */ (selectableItems.push(item) > 0);
63933                         }
63934                     }
63935                     else if (!(item != null && (item.constructor != null && item.constructor["__interfaces"] != null && item.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Elevatable") >= 0)) || item.isAtLevel(selectedLevel)) {
63936                         /* add */ (selectableItems.push(item) > 0);
63937                     }
63938                 }
63939             }
63940         }
63941         return selectableItems;
63942     };
63943     /**
63944      * Selects all visible items in all levels of home.
63945      */
63946     PlanController.prototype.selectAllAtAllLevels = function () {
63947         var allItems = (this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectableViewableItems().slice(0));
63948         if (this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked()) {
63949             allItems = this.getItemsNotPartOfBasePlan(allItems);
63950         }
63951         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setSelectedItems(allItems);
63952         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setAllLevelsSelection(true);
63953     };
63954     /**
63955      * Returns the visible (fully or partially) rooms at the selected level in home.
63956      * @return {Room[]}
63957      * @private
63958      */
63959     PlanController.prototype.getDetectableRoomsAtSelectedLevel = function () {
63960         var rooms = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getRooms();
63961         var selectedLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
63962         var levels = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getLevels();
63963         if (selectedLevel == null || /* size */ levels.length <= 1) {
63964             return rooms;
63965         }
63966         else {
63967             var visibleRooms = ([]);
63968             var selectedLevelIndex = levels.indexOf(selectedLevel);
63969             var level0 = levels[0] === selectedLevel || /* get */ levels[selectedLevelIndex - 1].getElevation() === selectedLevel.getElevation();
63970             var otherLevel = levels[level0 && selectedLevelIndex < /* size */ levels.length - 1 ? selectedLevelIndex + 1 : selectedLevelIndex - 1];
63971             for (var index = 0; index < rooms.length; index++) {
63972                 var room = rooms[index];
63973                 {
63974                     if (room.isAtLevel(selectedLevel) || otherLevel != null && room.isAtLevel(otherLevel) && (level0 && room.isFloorVisible() || !level0 && room.isCeilingVisible())) {
63975                         /* add */ (visibleRooms.push(room) > 0);
63976                     }
63977                 }
63978             }
63979             return visibleRooms;
63980         }
63981     };
63982     /**
63983      * Returns the visible (fully or partially) walls at the selected level in home.
63984      * @return {Wall[]}
63985      * @private
63986      */
63987     PlanController.prototype.getDetectableWallsAtSelectedLevel = function () {
63988         var walls = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getWalls();
63989         var selectedLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
63990         var levels = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getLevels();
63991         if (selectedLevel == null || /* size */ levels.length <= 1) {
63992             return walls;
63993         }
63994         else {
63995             var visibleWalls = ([]);
63996             var selectedLevelIndex = levels.indexOf(selectedLevel);
63997             var level0 = levels[0] === selectedLevel || /* get */ levels[selectedLevelIndex - 1].getElevation() === selectedLevel.getElevation();
63998             var otherLevel = levels[level0 && selectedLevelIndex < /* size */ levels.length - 1 ? selectedLevelIndex + 1 : selectedLevelIndex - 1];
63999             for (var index = 0; index < walls.length; index++) {
64000                 var wall = walls[index];
64001                 {
64002                     if (wall.isAtLevel(selectedLevel) || otherLevel != null && wall.isAtLevel(otherLevel)) {
64003                         /* add */ (visibleWalls.push(wall) > 0);
64004                     }
64005                 }
64006             }
64007             return visibleWalls;
64008         }
64009     };
64010     /**
64011      * Returns the horizontal ruler of the plan view.
64012      * @return {Object}
64013      */
64014     PlanController.prototype.getHorizontalRulerView = function () {
64015         return this.getView().getHorizontalRuler();
64016     };
64017     /**
64018      * Returns the vertical ruler of the plan view.
64019      * @return {Object}
64020      */
64021     PlanController.prototype.getVerticalRulerView = function () {
64022         return this.getView().getVerticalRuler();
64023     };
64024     PlanController.prototype.__com_eteks_sweethome3d_viewcontroller_PlanController_addModelListeners = function () {
64025         var _this = this;
64026         this.selectionListener = new PlanController.PlanController$1(this);
64027         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addSelectionListener(this.selectionListener);
64028         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getObserverCamera().addPropertyChangeListener(new PlanController.PlanController$2(this));
64029         this.wallChangeListener = new PlanController.PlanController$3(this);
64030         {
64031             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getWalls();
64032             for (var index = 0; index < array.length; index++) {
64033                 var wall = array[index];
64034                 {
64035                     wall.addPropertyChangeListener(this.wallChangeListener);
64036                 }
64037             }
64038         }
64039         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addWallsListener(function (ev) {
64040             if (ev.getType() === CollectionEvent.Type.ADD) {
64041                 ev.getItem().addPropertyChangeListener(_this.wallChangeListener);
64042             }
64043             else if (ev.getType() === CollectionEvent.Type.DELETE) {
64044                 ev.getItem().removePropertyChangeListener(_this.wallChangeListener);
64045             }
64046             _this.resetAreaCache();
64047         });
64048         var furnitureChangeListener = new PlanController.PlanController$4(this);
64049         this.furnitureSizeChangeListener = new PlanController.PlanController$5(this);
64050         {
64051             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getFurniture();
64052             for (var index = 0; index < array.length; index++) {
64053                 var piece = array[index];
64054                 {
64055                     piece.addPropertyChangeListener(furnitureChangeListener);
64056                     piece.addPropertyChangeListener(this.furnitureSizeChangeListener);
64057                     if (piece != null && piece instanceof HomeFurnitureGroup) {
64058                         {
64059                             var array1 = piece.getAllFurniture();
64060                             for (var index1 = 0; index1 < array1.length; index1++) {
64061                                 var childPiece = array1[index1];
64062                                 {
64063                                     childPiece.addPropertyChangeListener(this.furnitureSizeChangeListener);
64064                                 }
64065                             }
64066                         }
64067                     }
64068                 }
64069             }
64070         }
64071         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addFurnitureListener(function (ev) {
64072             var piece = ev.getItem();
64073             if (ev.getType() === CollectionEvent.Type.ADD) {
64074                 piece.addPropertyChangeListener(furnitureChangeListener);
64075                 piece.addPropertyChangeListener(_this.furnitureSizeChangeListener);
64076                 if (piece != null && piece instanceof HomeFurnitureGroup) {
64077                     {
64078                         var array = piece.getAllFurniture();
64079                         for (var index = 0; index < array.length; index++) {
64080                             var childPiece = array[index];
64081                             {
64082                                 childPiece.addPropertyChangeListener(_this.furnitureSizeChangeListener);
64083                             }
64084                         }
64085                     }
64086                 }
64087             }
64088             else if (ev.getType() === CollectionEvent.Type.DELETE) {
64089                 piece.removePropertyChangeListener(furnitureChangeListener);
64090                 /* remove */ (function (m, k) { if (m.entries == null)
64091                     m.entries = []; for (var i = 0; i < m.entries.length; i++)
64092                     if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
64093                         return m.entries.splice(i, 1)[0];
64094                     } })(_this.furnitureSidesCache, piece);
64095                 piece.removePropertyChangeListener(_this.furnitureSizeChangeListener);
64096                 if (piece != null && piece instanceof HomeFurnitureGroup) {
64097                     {
64098                         var array = piece.getAllFurniture();
64099                         for (var index = 0; index < array.length; index++) {
64100                             var childPiece = array[index];
64101                             {
64102                                 childPiece.removePropertyChangeListener(_this.furnitureSizeChangeListener);
64103                             }
64104                         }
64105                     }
64106                 }
64107             }
64108         });
64109         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addPropertyChangeListener("SELECTED_LEVEL", new PlanController.PlanController$6(this));
64110         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getObserverCamera().setFixedSize(/* size */ this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getLevels().length >= 2);
64111         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addLevelsListener(function (ev) {
64112             _this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getObserverCamera().setFixedSize(/* size */ _this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getLevels().length >= 2);
64113         });
64114     };
64115     /**
64116      * Returns the selection listener add to the controlled home.
64117      * @return {Object}
64118      * @private
64119      */
64120     PlanController.prototype.getSelectionListener = function () {
64121         return this.selectionListener;
64122     };
64123     PlanController.prototype.resetAreaCache = function () {
64124         this.wallsAreaCache = null;
64125         this.wallsIncludingBaseboardsAreaCache = null;
64126         this.insideWallsAreaCache = null;
64127         this.roomPathsCache = null;
64128     };
64129     /**
64130      * Displays in plan view the feedback of <code>draggedItems</code>,
64131      * during a drag and drop operation initiated from outside of plan view.
64132      * @param {*[]} draggedItems
64133      * @param {number} x
64134      * @param {number} y
64135      */
64136     PlanController.prototype.startDraggedItems = function (draggedItems, x, y) {
64137         this.draggedItems = draggedItems;
64138         if (this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) {
64139             {
64140                 var array = Home.getFurnitureSubList(draggedItems);
64141                 for (var index = 0; index < array.length; index++) {
64142                     var piece = array[index];
64143                     {
64144                         if (piece.isResizable()) {
64145                             piece.setWidth(this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMagnetizedLength(piece.getWidth(), 0.1));
64146                             piece.setWidthInPlan(piece.getWidth());
64147                             piece.setDepth(this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMagnetizedLength(piece.getDepth(), 0.1));
64148                             piece.setDepthInPlan(piece.getDepth());
64149                             piece.setHeight(this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMagnetizedLength(piece.getHeight(), 0.1));
64150                             piece.setHeightInPlan(piece.getHeight());
64151                         }
64152                         piece.setElevation(this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMagnetizedLength(piece.getElevation(), 0.1));
64153                     }
64154                 }
64155             }
64156         }
64157         if (this.isModificationState()) {
64158             this.escape();
64159         }
64160         this.setState(this.getDragAndDropState());
64161         this.moveMouse(x, y);
64162     };
64163     /**
64164      * Deletes in plan view the feedback of the dragged items.
64165      */
64166     PlanController.prototype.stopDraggedItems = function () {
64167         if (this.state !== this.getDragAndDropState()) {
64168             throw new IllegalStateException("Controller isn\'t in a drag and drop state");
64169         }
64170         this.draggedItems = null;
64171         this.setState(this.previousState);
64172     };
64173     /**
64174      * Attempts to modify <code>piece</code> location depending of its context.
64175      * If the <code>piece</code> is a door or a window and the point (<code>x</code>, <code>y</code>)
64176      * belongs to a wall, the piece will be resized, rotated and moved so
64177      * its opening depth is equal to wall thickness and its angle matches wall direction.
64178      * If the <code>piece</code> isn't a door or a window and the point (<code>x</code>, <code>y</code>)
64179      * belongs to a wall, the piece will be rotated and moved so
64180      * its back face lies along the closest wall side and its angle matches wall direction.
64181      * If the <code>piece</code> isn't a door or a window, its bounding box is included in
64182      * the one of an other object and its elevation is equal to zero, it will be elevated
64183      * to appear on the top of the latter.
64184      * @param {HomePieceOfFurniture} piece
64185      * @param {number} x
64186      * @param {number} y
64187      */
64188     PlanController.prototype.adjustMagnetizedPieceOfFurniture = function (piece, x, y) {
64189         var pieceElevationAdjusted = this.adjustPieceOfFurnitureElevation(piece, false, 3.4028235E38) != null;
64190         var magnetWall = this.adjustPieceOfFurnitureOnWallAt(piece, x, y, true);
64191         var referencePiece = null;
64192         if (!pieceElevationAdjusted) {
64193             referencePiece = this.adjustPieceOfFurnitureSideBySideAt(piece, magnetWall == null, magnetWall);
64194         }
64195         if (referencePiece == null) {
64196             this.adjustPieceOfFurnitureInShelfBox(piece, magnetWall == null);
64197         }
64198     };
64199     /**
64200      * Attempts to move and resize <code>piece</code> depending on the wall under the
64201      * point (<code>x</code>, <code>y</code>) and returns that wall it it exists.
64202      * @see #adjustMagnetizedPieceOfFurniture(HomePieceOfFurniture, float, float)
64203      * @param {HomePieceOfFurniture} piece
64204      * @param {number} x
64205      * @param {number} y
64206      * @param {boolean} forceOrientation
64207      * @return {Wall}
64208      * @private
64209      */
64210     PlanController.prototype.adjustPieceOfFurnitureOnWallAt = function (piece, x, y, forceOrientation) {
64211         var margin = PlanController.PIXEL_MARGIN / this.getScale();
64212         var selectedLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
64213         var piecePoints = piece.getPoints();
64214         var includeBaseboards = !piece.isDoorOrWindow() && piece.getElevation() === 0;
64215         var wallsArea = this.getWallsArea(includeBaseboards);
64216         var walls = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getWalls();
64217         var referenceWall = null;
64218         var referenceWallArcExtent = null;
64219         if (forceOrientation || !piece.isDoorOrWindow()) {
64220             for (var index = 0; index < walls.length; index++) {
64221                 var wall = walls[index];
64222                 {
64223                     if (wall.isAtLevel(selectedLevel) && this.isLevelNullOrViewable(wall.getLevel()) && wall.containsPoint$float$float$boolean$float(x, y, includeBaseboards, 0) && wall.getStartPointToEndPointDistance() > 0) {
64224                         referenceWall = this.getReferenceWall(wall, x, y);
64225                         referenceWallArcExtent = wall.getArcExtent();
64226                         break;
64227                     }
64228                 }
64229             }
64230             if (referenceWall == null) {
64231                 for (var index = 0; index < walls.length; index++) {
64232                     var wall = walls[index];
64233                     {
64234                         if (wall.isAtLevel(selectedLevel) && this.isLevelNullOrViewable(wall.getLevel()) && wall.containsPoint$float$float$boolean$float(x, y, includeBaseboards, 0) && wall.getStartPointToEndPointDistance() > 0) {
64235                             referenceWall = this.getReferenceWall(wall, x, y);
64236                             referenceWallArcExtent = wall.getArcExtent();
64237                             break;
64238                         }
64239                     }
64240                 }
64241             }
64242         }
64243         if (referenceWall == null) {
64244             var pieceAreaWithMargin = new java.awt.geom.Area(this.getRotatedRectangle(piece.getX() - piece.getWidthInPlan() / 2 - margin, piece.getY() - piece.getDepthInPlan() / 2 - margin, piece.getWidthInPlan() + 2 * margin, piece.getDepthInPlan() + 2 * margin, piece.getAngle()));
64245             var intersectionWithReferenceWallSurface = 0;
64246             for (var index = 0; index < walls.length; index++) {
64247                 var wall = walls[index];
64248                 {
64249                     if (wall.isAtLevel(selectedLevel) && this.isLevelNullOrViewable(wall.getLevel()) && wall.getStartPointToEndPointDistance() > 0) {
64250                         var wallPoints = wall.getPoints$boolean(includeBaseboards);
64251                         var wallAreaIntersection = new java.awt.geom.Area(this.getPath$float_A_A(wallPoints));
64252                         wallAreaIntersection.intersect(pieceAreaWithMargin);
64253                         if (!wallAreaIntersection.isEmpty()) {
64254                             var surface = this.getArea(wallAreaIntersection);
64255                             if (surface > intersectionWithReferenceWallSurface) {
64256                                 intersectionWithReferenceWallSurface = surface;
64257                                 if (forceOrientation) {
64258                                     referenceWall = this.getReferenceWall(wall, x, y);
64259                                     referenceWallArcExtent = wall.getArcExtent();
64260                                 }
64261                                 else {
64262                                     var intersectionBounds = wallAreaIntersection.getBounds2D();
64263                                     referenceWall = this.getReferenceWall(wall, intersectionBounds.getCenterX(), intersectionBounds.getCenterY());
64264                                     referenceWallArcExtent = wall.getArcExtent();
64265                                 }
64266                             }
64267                         }
64268                     }
64269                 }
64270             }
64271         }
64272         if (referenceWall != null) {
64273             var xPiece = x;
64274             var yPiece = y;
64275             var pieceAngle = piece.getAngle();
64276             var halfWidth = piece.getWidthInPlan() / 2;
64277             var halfDepth = piece.getDepthInPlan() / 2;
64278             var wallAngle = Math.atan2(referenceWall.getYEnd() - referenceWall.getYStart(), referenceWall.getXEnd() - referenceWall.getXStart());
64279             var wallPoints = referenceWall.getPoints$boolean(includeBaseboards);
64280             var magnetizedAtRight = wallAngle > -Math.PI / 2 && wallAngle <= Math.PI / 2;
64281             var cosWallAngle = Math.cos(wallAngle);
64282             var sinWallAngle = Math.sin(wallAngle);
64283             var distanceToLeftSide = wallPoints[0][0] !== wallPoints[0][1] || wallPoints[1][0] !== wallPoints[1][1] ? java.awt.geom.Line2D.ptLineDist(wallPoints[0][0], wallPoints[0][1], wallPoints[1][0], wallPoints[1][1], x, y) : java.awt.geom.Point2D.distance(wallPoints[0][0], wallPoints[0][1], x, y);
64284             var distanceToRightSide = wallPoints[2][0] !== wallPoints[2][1] || wallPoints[3][0] !== wallPoints[3][1] ? java.awt.geom.Line2D.ptLineDist(wallPoints[2][0], wallPoints[2][1], wallPoints[3][0], wallPoints[3][1], x, y) : java.awt.geom.Point2D.distance(wallPoints[2][0], wallPoints[2][1], x, y);
64285             var adjustOrientation = forceOrientation || piece.isDoorOrWindow() || referenceWall.containsPoint$float$float$boolean$float(x, y, includeBaseboards, margin);
64286             if (adjustOrientation) {
64287                 var distanceToPieceLeftSide = java.awt.geom.Line2D.ptLineDist(piecePoints[0][0], piecePoints[0][1], piecePoints[3][0], piecePoints[3][1], x, y);
64288                 var distanceToPieceRightSide = java.awt.geom.Line2D.ptLineDist(piecePoints[1][0], piecePoints[1][1], piecePoints[2][0], piecePoints[2][1], x, y);
64289                 var distanceToPieceSide = pieceAngle > (3 * Math.PI / 2 + 1.0E-6) || pieceAngle < (Math.PI / 2 + 1.0E-6) ? distanceToPieceLeftSide : distanceToPieceRightSide;
64290                 pieceAngle = (distanceToRightSide < distanceToLeftSide ? wallAngle : wallAngle + Math.PI);
64291                 if (piece.isDoorOrWindow()) {
64292                     var thicknessEpsilon = 7.5E-4;
64293                     var wallDistance = void 0;
64294                     if (referenceWallArcExtent == null || /* floatValue */ referenceWallArcExtent === 0) {
64295                         wallDistance = thicknessEpsilon / 2;
64296                         if (piece != null && piece instanceof HomeDoorOrWindow) {
64297                             var doorOrWindow = piece;
64298                             if (piece.isResizable() && this.isItemResizable(piece) && doorOrWindow.isWidthDepthDeformable() && doorOrWindow.getModelTransformations() == null) {
64299                                 piece.setDepth(thicknessEpsilon + referenceWall.getThickness() / doorOrWindow.getWallThickness());
64300                                 piece.setDepthInPlan(piece.getDepth());
64301                                 halfDepth = piece.getDepth() / 2;
64302                                 wallDistance += piece.getDepth() * doorOrWindow.getWallDistance();
64303                             }
64304                             else {
64305                                 wallDistance += piece.getDepth() * (doorOrWindow.getWallDistance() + doorOrWindow.getWallThickness()) - referenceWall.getThickness();
64306                             }
64307                         }
64308                     }
64309                     else {
64310                         wallDistance = -referenceWall.getThickness() / 2;
64311                         if (piece != null && piece instanceof HomeDoorOrWindow) {
64312                             var doorOrWindow = piece;
64313                             wallDistance += piece.getDepth() * (doorOrWindow.getWallDistance() + doorOrWindow.getWallThickness() / 2);
64314                         }
64315                     }
64316                     if (distanceToRightSide < distanceToLeftSide) {
64317                         xPiece += sinWallAngle * ((distanceToLeftSide + wallDistance) - halfDepth);
64318                         yPiece += cosWallAngle * (-(distanceToLeftSide + wallDistance) + halfDepth);
64319                     }
64320                     else {
64321                         xPiece += sinWallAngle * (-(distanceToRightSide + wallDistance) + halfDepth);
64322                         yPiece += cosWallAngle * ((distanceToRightSide + wallDistance) - halfDepth);
64323                     }
64324                     if (magnetizedAtRight) {
64325                         xPiece += cosWallAngle * (halfWidth - distanceToPieceSide);
64326                         yPiece += sinWallAngle * (halfWidth - distanceToPieceSide);
64327                     }
64328                     else {
64329                         xPiece += -cosWallAngle * (halfWidth - distanceToPieceSide);
64330                         yPiece += -sinWallAngle * (halfWidth - distanceToPieceSide);
64331                     }
64332                 }
64333                 else {
64334                     if (distanceToRightSide < distanceToLeftSide) {
64335                         var pointIndicator = java.awt.geom.Line2D.relativeCCW(wallPoints[2][0], wallPoints[2][1], wallPoints[3][0], wallPoints[3][1], x, y);
64336                         xPiece += pointIndicator * sinWallAngle * distanceToRightSide - sinWallAngle * halfDepth;
64337                         yPiece += -pointIndicator * cosWallAngle * distanceToRightSide + cosWallAngle * halfDepth;
64338                     }
64339                     else {
64340                         var pointIndicator = java.awt.geom.Line2D.relativeCCW(wallPoints[0][0], wallPoints[0][1], wallPoints[1][0], wallPoints[1][1], x, y);
64341                         xPiece += -pointIndicator * sinWallAngle * distanceToLeftSide + sinWallAngle * halfDepth;
64342                         yPiece += pointIndicator * cosWallAngle * distanceToLeftSide - cosWallAngle * halfDepth;
64343                     }
64344                     if (magnetizedAtRight) {
64345                         xPiece += cosWallAngle * (halfWidth - distanceToPieceSide);
64346                         yPiece += sinWallAngle * (halfWidth - distanceToPieceSide);
64347                     }
64348                     else {
64349                         xPiece += -cosWallAngle * (halfWidth - distanceToPieceSide);
64350                         yPiece += -sinWallAngle * (halfWidth - distanceToPieceSide);
64351                     }
64352                 }
64353             }
64354             else {
64355                 var centerLine = new java.awt.geom.Line2D.Float(referenceWall.getXStart(), referenceWall.getYStart(), referenceWall.getXEnd(), referenceWall.getYEnd());
64356                 var pieceBoundingBox = this.getRotatedRectangle(0, 0, piece.getWidthInPlan(), piece.getDepthInPlan(), (pieceAngle - wallAngle));
64357                 var rotatedBoundingBoxDepth = pieceBoundingBox.getBounds2D().getHeight();
64358                 var relativeCCWToPieceCenterSignum = (function (f) { if (f > 0) {
64359                     return 1;
64360                 }
64361                 else if (f < 0) {
64362                     return -1;
64363                 }
64364                 else {
64365                     return 0;
64366                 } })(centerLine.relativeCCW(piece.getX(), piece.getY()));
64367                 var relativeCCWToPointSignum = (function (f) { if (f > 0) {
64368                     return 1;
64369                 }
64370                 else if (f < 0) {
64371                     return -1;
64372                 }
64373                 else {
64374                     return 0;
64375                 } })(centerLine.relativeCCW(x, y));
64376                 var distance = relativeCCWToPieceCenterSignum * (-referenceWall.getThickness() / 2 + centerLine.ptLineDist(piece.getX(), piece.getY()) - rotatedBoundingBoxDepth / 2);
64377                 if (includeBaseboards) {
64378                     if (relativeCCWToPieceCenterSignum > 0 && referenceWall.getLeftSideBaseboard() != null) {
64379                         distance -= relativeCCWToPieceCenterSignum * referenceWall.getLeftSideBaseboard().getThickness();
64380                     }
64381                     else if (relativeCCWToPieceCenterSignum < 0 && referenceWall.getRightSideBaseboard() != null) {
64382                         distance -= relativeCCWToPieceCenterSignum * referenceWall.getRightSideBaseboard().getThickness();
64383                     }
64384                 }
64385                 if (relativeCCWToPointSignum !== relativeCCWToPieceCenterSignum) {
64386                     distance -= relativeCCWToPointSignum * (rotatedBoundingBoxDepth + referenceWall.getThickness());
64387                     if (referenceWall.getLeftSideBaseboard() != null) {
64388                         distance -= relativeCCWToPointSignum * referenceWall.getLeftSideBaseboard().getThickness();
64389                     }
64390                     if (referenceWall.getRightSideBaseboard() != null) {
64391                         distance -= relativeCCWToPointSignum * referenceWall.getRightSideBaseboard().getThickness();
64392                     }
64393                 }
64394                 xPiece = piece.getX() + (-distance * sinWallAngle);
64395                 yPiece = piece.getY() + (distance * cosWallAngle);
64396             }
64397             if (!piece.isDoorOrWindow() && (referenceWall.getArcExtent() == null || !adjustOrientation || java.awt.geom.Line2D.relativeCCW(referenceWall.getXStart(), referenceWall.getYStart(), referenceWall.getXEnd(), referenceWall.getYEnd(), x, y) > 0)) {
64398                 var wallsAreaIntersection = new java.awt.geom.Area(wallsArea);
64399                 var adjustedPieceArea = new java.awt.geom.Area(this.getRotatedRectangle(xPiece - halfWidth, yPiece - halfDepth, piece.getWidthInPlan(), piece.getDepthInPlan(), pieceAngle));
64400                 wallsAreaIntersection.subtract(new java.awt.geom.Area(this.getPath$float_A_A(wallPoints)));
64401                 wallsAreaIntersection.intersect(adjustedPieceArea);
64402                 if (!wallsAreaIntersection.isEmpty()) {
64403                     var closestWallIntersectionPath = this.getClosestPath(this.getAreaPaths(wallsAreaIntersection), x, y);
64404                     if (closestWallIntersectionPath != null) {
64405                         adjustedPieceArea.subtract(wallsArea);
64406                         if (adjustedPieceArea.isEmpty()) {
64407                             return null;
64408                         }
64409                         else {
64410                             var adjustedPieceAreaPaths = this.getAreaPaths(adjustedPieceArea);
64411                             var angleDifference = (wallAngle - pieceAngle + 2 * Math.PI) % Math.PI;
64412                             if (angleDifference < 1.0E-5 || Math.PI - angleDifference < 1.0E-5 || /* size */ adjustedPieceAreaPaths.length < 2) {
64413                                 var adjustedPiecePathInArea = this.getClosestPath(adjustedPieceAreaPaths, x, y);
64414                                 var adjustingArea = new java.awt.geom.Area(closestWallIntersectionPath);
64415                                 for (var index = 0; index < adjustedPieceAreaPaths.length; index++) {
64416                                     var path = adjustedPieceAreaPaths[index];
64417                                     {
64418                                         if (path !== adjustedPiecePathInArea) {
64419                                             adjustingArea.add(new java.awt.geom.Area(path));
64420                                         }
64421                                     }
64422                                 }
64423                                 var rotation = java.awt.geom.AffineTransform.getRotateInstance(-wallAngle);
64424                                 var adjustingAreaBounds = adjustingArea.createTransformedArea(rotation).getBounds2D();
64425                                 var adjustedPiecePathInAreaBounds = adjustedPiecePathInArea.createTransformedShape(rotation).getBounds2D();
64426                                 if (!adjustingAreaBounds.contains(adjustedPiecePathInAreaBounds)) {
64427                                     var adjustLeftBorder = (function (f) { if (f > 0) {
64428                                         return 1;
64429                                     }
64430                                     else if (f < 0) {
64431                                         return -1;
64432                                     }
64433                                     else {
64434                                         return 0;
64435                                     } })(adjustedPiecePathInAreaBounds.getCenterX() - adjustingAreaBounds.getCenterX());
64436                                     xPiece += adjustingAreaBounds.getWidth() * cosWallAngle * adjustLeftBorder;
64437                                     yPiece += adjustingAreaBounds.getWidth() * sinWallAngle * adjustLeftBorder;
64438                                 }
64439                             }
64440                         }
64441                     }
64442                 }
64443             }
64444             piece.setAngle(pieceAngle);
64445             piece.setX(xPiece);
64446             piece.setY(yPiece);
64447             if (piece != null && piece instanceof HomeDoorOrWindow) {
64448                 piece.setBoundToWall(referenceWallArcExtent == null || /* floatValue */ referenceWallArcExtent === 0);
64449             }
64450             return referenceWall;
64451         }
64452         return null;
64453     };
64454     /**
64455      * Returns <code>true</code> is the given <code>level</code> is viewable.
64456      * @param {Level} level
64457      * @return {boolean}
64458      * @private
64459      */
64460     PlanController.prototype.isLevelNullOrViewable = function (level) {
64461         return level == null || level.isViewable();
64462     };
64463     /**
64464      * Returns <code>wall</code> or a small wall part at the angle formed by the line joining wall center to
64465      * (<code>x</code>, <code>y</code>) point if the given <code>wall</code> is round.
64466      * @param {Wall} wall
64467      * @param {number} x
64468      * @param {number} y
64469      * @return {Wall}
64470      * @private
64471      */
64472     PlanController.prototype.getReferenceWall = function (wall, x, y) {
64473         var arcExtent = wall.getArcExtent();
64474         if (arcExtent == null || /* floatValue */ arcExtent === 0) {
64475             return wall;
64476         }
64477         else {
64478             var angle = Math.atan2(wall.getYArcCircleCenter() - y, x - wall.getXArcCircleCenter());
64479             var radius = java.awt.geom.Point2D.distance(wall.getXArcCircleCenter(), wall.getYArcCircleCenter(), wall.getXStart(), wall.getYStart());
64480             var epsilonAngle = 0.001;
64481             var wallPart = new Wall((wall.getXArcCircleCenter() + Math.cos(angle + epsilonAngle) * radius), (wall.getYArcCircleCenter() - Math.sin(angle + epsilonAngle) * radius), (wall.getXArcCircleCenter() + Math.cos(angle - epsilonAngle) * radius), (wall.getYArcCircleCenter() - Math.sin(angle - epsilonAngle) * radius), wall.getThickness(), 0);
64482             wallPart.setLeftSideBaseboard(wall.getLeftSideBaseboard());
64483             wallPart.setRightSideBaseboard(wall.getRightSideBaseboard());
64484             return wallPart;
64485         }
64486     };
64487     /**
64488      * Returns the closest path among <code>paths</code> ones to the given point.
64489      * @param {java.awt.geom.GeneralPath[]} paths
64490      * @param {number} x
64491      * @param {number} y
64492      * @return {java.awt.geom.GeneralPath}
64493      * @private
64494      */
64495     PlanController.prototype.getClosestPath = function (paths, x, y) {
64496         var closestPath = null;
64497         var closestPathDistance = 1.7976931348623157E308;
64498         for (var index = 0; index < paths.length; index++) {
64499             var path = paths[index];
64500             {
64501                 var pathPoints = this.getPathPoints(path, true);
64502                 for (var i = 0; i < pathPoints.length; i++) {
64503                     {
64504                         var distanceToPath = java.awt.geom.Line2D.ptSegDistSq(pathPoints[i][0], pathPoints[i][1], pathPoints[(i + 1) % pathPoints.length][0], pathPoints[(i + 1) % pathPoints.length][1], x, y);
64505                         if (distanceToPath < closestPathDistance) {
64506                             closestPathDistance = distanceToPath;
64507                             closestPath = path;
64508                         }
64509                     }
64510                     ;
64511                 }
64512             }
64513         }
64514         return closestPath;
64515     };
64516     /**
64517      * Returns the dimension lines that indicates how is placed a given <code>piece</code>
64518      * along a <code>wall</code>.
64519      * @param {HomePieceOfFurniture} piece
64520      * @param {Wall} wall
64521      * @return {DimensionLine[]}
64522      * @private
64523      */
64524     PlanController.prototype.getDimensionLinesAlongWall = function (piece, wall) {
64525         var piecePoints = piece.getPoints();
64526         var angle = piece.getAngle();
64527         var wallPoints = wall.getPoints$();
64528         var pieceLeftPoint;
64529         var pieceRightPoint;
64530         var piecePoint = piece.isDoorOrWindow() ? piecePoints[3] : piecePoints[0];
64531         if (java.awt.geom.Line2D.ptLineDistSq(wallPoints[0][0], wallPoints[0][1], wallPoints[1][0], wallPoints[1][1], piecePoint[0], piecePoint[1]) <= java.awt.geom.Line2D.ptLineDistSq(wallPoints[2][0], wallPoints[2][1], wallPoints[3][0], wallPoints[3][1], piecePoint[0], piecePoint[1])) {
64532             pieceLeftPoint = PlanController.computeIntersection$float_A$float_A$float_A$float_A(wallPoints[0], wallPoints[1], piecePoints[0], piecePoints[3]);
64533             pieceRightPoint = PlanController.computeIntersection$float_A$float_A$float_A$float_A(wallPoints[0], wallPoints[1], piecePoints[1], piecePoints[2]);
64534         }
64535         else {
64536             pieceLeftPoint = PlanController.computeIntersection$float_A$float_A$float_A$float_A(wallPoints[2], wallPoints[3], piecePoints[0], piecePoints[3]);
64537             pieceRightPoint = PlanController.computeIntersection$float_A$float_A$float_A$float_A(wallPoints[2], wallPoints[3], piecePoints[1], piecePoints[2]);
64538         }
64539         var dimensionLines = ([]);
64540         var wallEndPointJoinedToPieceLeftPoint = null;
64541         var wallEndPointJoinedToPieceRightPoint = null;
64542         var roomPaths = this.getRoomPathsFromWalls();
64543         for (var i = 0; i < /* size */ roomPaths.length && wallEndPointJoinedToPieceLeftPoint == null && wallEndPointJoinedToPieceRightPoint == null; i++) {
64544             {
64545                 var roomPoints = this.getPathPoints(/* get */ roomPaths[i], true);
64546                 for (var j = 0; j < roomPoints.length; j++) {
64547                     {
64548                         var startPoint = roomPoints[j];
64549                         var endPoint = roomPoints[(j + 1) % roomPoints.length];
64550                         var deltaX = endPoint[0] - startPoint[0];
64551                         var deltaY = endPoint[1] - startPoint[1];
64552                         var segmentAngle = Math.abs(deltaX) < 1.0E-5 ? Math.PI / 2 : (Math.abs(deltaY) < 1.0E-5 ? 0 : Math.atan2(deltaY, deltaX));
64553                         var angleDifference = (segmentAngle - angle + 2 * Math.PI) % Math.PI;
64554                         if (angleDifference < 1.0E-5 || Math.PI - angleDifference < 1.0E-5) {
64555                             var segmentContainsLeftPoint = java.awt.geom.Line2D.ptSegDistSq(startPoint[0], startPoint[1], endPoint[0], endPoint[1], pieceLeftPoint[0], pieceLeftPoint[1]) < 1.0E-4;
64556                             var segmentContainsRightPoint = java.awt.geom.Line2D.ptSegDistSq(startPoint[0], startPoint[1], endPoint[0], endPoint[1], pieceRightPoint[0], pieceRightPoint[1]) < 1.0E-4;
64557                             if (segmentContainsLeftPoint || segmentContainsRightPoint) {
64558                                 if (segmentContainsLeftPoint) {
64559                                     var startPointToLeftPointDistance = java.awt.geom.Point2D.distanceSq(startPoint[0], startPoint[1], pieceLeftPoint[0], pieceLeftPoint[1]);
64560                                     var startPointToRightPointDistance = java.awt.geom.Point2D.distanceSq(startPoint[0], startPoint[1], pieceRightPoint[0], pieceRightPoint[1]);
64561                                     if (startPointToLeftPointDistance < startPointToRightPointDistance || !segmentContainsRightPoint) {
64562                                         wallEndPointJoinedToPieceLeftPoint = /* clone */ startPoint.slice(0);
64563                                     }
64564                                     else {
64565                                         wallEndPointJoinedToPieceLeftPoint = /* clone */ endPoint.slice(0);
64566                                     }
64567                                 }
64568                                 if (segmentContainsRightPoint) {
64569                                     var endPointToLeftPointDistance = java.awt.geom.Point2D.distanceSq(endPoint[0], endPoint[1], pieceLeftPoint[0], pieceLeftPoint[1]);
64570                                     var endPointToRightPointDistance = java.awt.geom.Point2D.distanceSq(endPoint[0], endPoint[1], pieceRightPoint[0], pieceRightPoint[1]);
64571                                     if (endPointToLeftPointDistance < endPointToRightPointDistance && segmentContainsLeftPoint) {
64572                                         wallEndPointJoinedToPieceRightPoint = /* clone */ startPoint.slice(0);
64573                                     }
64574                                     else {
64575                                         wallEndPointJoinedToPieceRightPoint = /* clone */ endPoint.slice(0);
64576                                     }
64577                                 }
64578                                 break;
64579                             }
64580                         }
64581                     }
64582                     ;
64583                 }
64584             }
64585             ;
64586         }
64587         var pieceFrontSideAlongWallSide = !piece.isDoorOrWindow() && java.awt.geom.Line2D.ptLineDistSq(wall.getXStart(), wall.getYStart(), wall.getXEnd(), wall.getYEnd(), piecePoint[0], piecePoint[1]) > java.awt.geom.Line2D.ptLineDistSq(wall.getXStart(), wall.getYStart(), wall.getXEnd(), wall.getYEnd(), piecePoints[3][0], piecePoints[3][1]);
64588         if (wallEndPointJoinedToPieceLeftPoint != null) {
64589             var offset = void 0;
64590             if (pieceFrontSideAlongWallSide) {
64591                 offset = -java.awt.geom.Point2D.distance(pieceLeftPoint[0], pieceLeftPoint[1], piecePoints[0][0], piecePoints[0][1]) - 10 / this.getView().getScale();
64592             }
64593             else {
64594                 offset = java.awt.geom.Point2D.distance(pieceLeftPoint[0], pieceLeftPoint[1], piecePoints[3][0], piecePoints[3][1]) + 10 / this.getView().getScale();
64595             }
64596             /* add */ (dimensionLines.push(this.getDimensionLineBetweenPoints$float_A$float_A$float$double$boolean(wallEndPointJoinedToPieceLeftPoint, pieceLeftPoint, offset, 0, false)) > 0);
64597         }
64598         if (wallEndPointJoinedToPieceRightPoint != null) {
64599             var offset = void 0;
64600             if (pieceFrontSideAlongWallSide) {
64601                 offset = -java.awt.geom.Point2D.distance(pieceRightPoint[0], pieceRightPoint[1], piecePoints[1][0], piecePoints[1][1]) - 10 / this.getView().getScale();
64602             }
64603             else {
64604                 offset = java.awt.geom.Point2D.distance(pieceRightPoint[0], pieceRightPoint[1], piecePoints[2][0], piecePoints[2][1]) + 10 / this.getView().getScale();
64605             }
64606             /* add */ (dimensionLines.push(this.getDimensionLineBetweenPoints$float_A$float_A$float$double$boolean(pieceRightPoint, wallEndPointJoinedToPieceRightPoint, offset, 0, false)) > 0);
64607         }
64608         for (var i = dimensionLines.length - 1; i >= 0; i--) {
64609             {
64610                 if ( /* get */dimensionLines[i].getLength() < 0.01) {
64611                     /* remove */ dimensionLines.splice(i, 1)[0];
64612                 }
64613             }
64614             ;
64615         }
64616         return dimensionLines;
64617     };
64618     PlanController.computeIntersection$float_A$float_A$float_A$float_A = function (point1, point2, point3, point4) {
64619         return PlanController.computeIntersection$float$float$float$float$float$float$float$float(point1[0], point1[1], point2[0], point2[1], point3[0], point3[1], point4[0], point4[1]);
64620     };
64621     PlanController.computeIntersection$float$float$float$float$float$float$float$float = function (xPoint1, yPoint1, xPoint2, yPoint2, xPoint3, yPoint3, xPoint4, yPoint4) {
64622         var x = xPoint2;
64623         var y = yPoint2;
64624         var alpha1 = (yPoint2 - yPoint1) / (xPoint2 - xPoint1);
64625         var alpha2 = (yPoint4 - yPoint3) / (xPoint4 - xPoint3);
64626         if (alpha1 !== alpha2) {
64627             if (Math.abs(alpha1) > 4000) {
64628                 if (Math.abs(alpha2) < 4000) {
64629                     x = xPoint1;
64630                     var beta2 = yPoint4 - alpha2 * xPoint4;
64631                     y = alpha2 * x + beta2;
64632                 }
64633             }
64634             else if (Math.abs(alpha2) > 4000) {
64635                 if (Math.abs(alpha1) < 4000) {
64636                     x = xPoint3;
64637                     var beta1 = yPoint2 - alpha1 * xPoint2;
64638                     y = alpha1 * x + beta1;
64639                 }
64640             }
64641             else {
64642                 var sameSignum = (function (f) { if (f > 0) {
64643                     return 1;
64644                 }
64645                 else if (f < 0) {
64646                     return -1;
64647                 }
64648                 else {
64649                     return 0;
64650                 } })(alpha1) === /* signum */ (function (f) { if (f > 0) {
64651                     return 1;
64652                 }
64653                 else if (f < 0) {
64654                     return -1;
64655                 }
64656                 else {
64657                     return 0;
64658                 } })(alpha2);
64659                 if (Math.abs(alpha1 - alpha2) > 1.0E-5 && (!sameSignum || (Math.abs(alpha1) > Math.abs(alpha2) ? alpha1 / alpha2 : alpha2 / alpha1) > 1.004)) {
64660                     var beta1 = yPoint2 - alpha1 * xPoint2;
64661                     var beta2 = yPoint4 - alpha2 * xPoint4;
64662                     x = (beta2 - beta1) / (alpha1 - alpha2);
64663                     y = alpha1 * x + beta1;
64664                 }
64665             }
64666         }
64667         return [x, y];
64668     };
64669     /**
64670      * Returns the intersection point between the line joining the first two points and
64671      * the line joining the two last points.
64672      * @param {number} xPoint1
64673      * @param {number} yPoint1
64674      * @param {number} xPoint2
64675      * @param {number} yPoint2
64676      * @param {number} xPoint3
64677      * @param {number} yPoint3
64678      * @param {number} xPoint4
64679      * @param {number} yPoint4
64680      * @return {float[]}
64681      * @private
64682      */
64683     PlanController.computeIntersection = function (xPoint1, yPoint1, xPoint2, yPoint2, xPoint3, yPoint3, xPoint4, yPoint4) {
64684         if (((typeof xPoint1 === 'number') || xPoint1 === null) && ((typeof yPoint1 === 'number') || yPoint1 === null) && ((typeof xPoint2 === 'number') || xPoint2 === null) && ((typeof yPoint2 === 'number') || yPoint2 === null) && ((typeof xPoint3 === 'number') || xPoint3 === null) && ((typeof yPoint3 === 'number') || yPoint3 === null) && ((typeof xPoint4 === 'number') || xPoint4 === null) && ((typeof yPoint4 === 'number') || yPoint4 === null)) {
64685             return PlanController.computeIntersection$float$float$float$float$float$float$float$float(xPoint1, yPoint1, xPoint2, yPoint2, xPoint3, yPoint3, xPoint4, yPoint4);
64686         }
64687         else if (((xPoint1 != null && xPoint1 instanceof Array && (xPoint1.length == 0 || xPoint1[0] == null || (typeof xPoint1[0] === 'number'))) || xPoint1 === null) && ((yPoint1 != null && yPoint1 instanceof Array && (yPoint1.length == 0 || yPoint1[0] == null || (typeof yPoint1[0] === 'number'))) || yPoint1 === null) && ((xPoint2 != null && xPoint2 instanceof Array && (xPoint2.length == 0 || xPoint2[0] == null || (typeof xPoint2[0] === 'number'))) || xPoint2 === null) && ((yPoint2 != null && yPoint2 instanceof Array && (yPoint2.length == 0 || yPoint2[0] == null || (typeof yPoint2[0] === 'number'))) || yPoint2 === null) && xPoint3 === undefined && yPoint3 === undefined && xPoint4 === undefined && yPoint4 === undefined) {
64688             return PlanController.computeIntersection$float_A$float_A$float_A$float_A(xPoint1, yPoint1, xPoint2, yPoint2);
64689         }
64690         else
64691             throw new Error('invalid overload');
64692     };
64693     /**
64694      * Attempts to elevate <code>piece</code> depending on the shelf units which surrounds it or the highest piece that includes
64695      * its bounding box and returns that piece.
64696      * @see #adjustMagnetizedPieceOfFurniture(HomePieceOfFurniture, float, float)
64697      * @param {HomePieceOfFurniture} piece
64698      * @param {boolean} adjustOnlyNullElevation
64699      * @param {number} margin
64700      * @return {HomePieceOfFurniture}
64701      * @private
64702      */
64703     PlanController.prototype.adjustPieceOfFurnitureElevation = function (piece, adjustOnlyNullElevation, margin) {
64704         if (!adjustOnlyNullElevation || !piece.isDoorOrWindow() && piece.getElevation() === 0) {
64705             var distanceToClosestShelf = 3.4028235E38;
64706             var pieceElevation = piece.getElevation();
64707             var closestShelfElevation = pieceElevation;
64708             var surroundingFurniture = void 0;
64709             if (adjustOnlyNullElevation || piece.getElevation() === 0) {
64710                 var highestSurroundingPiece = this.getHighestSurroundingPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture(piece);
64711                 if (highestSurroundingPiece != null) {
64712                     surroundingFurniture = /* asList */ [highestSurroundingPiece];
64713                 }
64714                 else {
64715                     return null;
64716                 }
64717             }
64718             else {
64719                 surroundingFurniture = this.getSurroundingFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture(piece);
64720                 var containsShelfUnits = false;
64721                 for (var index = 0; index < surroundingFurniture.length; index++) {
64722                     var surroundingPiece = surroundingFurniture[index];
64723                     {
64724                         if (surroundingPiece != null && surroundingPiece instanceof HomeShelfUnit) {
64725                             containsShelfUnits = true;
64726                         }
64727                     }
64728                 }
64729                 if (!containsShelfUnits) {
64730                     return null;
64731                 }
64732             }
64733             for (var index = 0; index < surroundingFurniture.length; index++) {
64734                 var surroundingPiece = surroundingFurniture[index];
64735                 {
64736                     var shelfElevations = [];
64737                     if (!adjustOnlyNullElevation && (surroundingPiece != null && surroundingPiece instanceof HomeShelfUnit) && !surroundingPiece.isHorizontallyRotated()) {
64738                         var shelfUnit = surroundingPiece;
64739                         var shelfBoxes = shelfUnit.getShelfBoxes();
64740                         if (shelfBoxes.length > 0) {
64741                             shelfElevations = (function (s) { var a = []; while (s-- > 0)
64742                                 a.push(0); return a; })(shelfBoxes.length);
64743                             for (var i = 0; i < shelfElevations.length; i++) {
64744                                 {
64745                                     shelfElevations[i] = shelfBoxes[i].getZLower();
64746                                 }
64747                                 ;
64748                             }
64749                         }
64750                         else {
64751                             shelfElevations = shelfUnit.getShelfElevations();
64752                         }
64753                     }
64754                     if (shelfElevations.length === 0 || shelfElevations[0] !== 0 && piece.getElevation() === 0) {
64755                         shelfElevations = [surroundingPiece.getDropOnTopElevation()];
64756                     }
64757                     if (shelfElevations.length !== 0) {
64758                         for (var index1 = 0; index1 < shelfElevations.length; index1++) {
64759                             var shelfElevation = shelfElevations[index1];
64760                             {
64761                                 var elevation = surroundingPiece.getElevation();
64762                                 if (surroundingPiece.isHorizontallyRotated()) {
64763                                     elevation += surroundingPiece.getHeightInPlan();
64764                                 }
64765                                 else {
64766                                     elevation += surroundingPiece.getHeight() * shelfElevation;
64767                                 }
64768                                 if (surroundingPiece.getLevel() != null) {
64769                                     elevation += surroundingPiece.getLevel().getElevation() - (piece.getLevel() != null ? piece.getLevel().getElevation() : this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel().getElevation());
64770                                 }
64771                                 var distanceToShelf = Math.abs(pieceElevation - elevation);
64772                                 if (distanceToClosestShelf > distanceToShelf) {
64773                                     distanceToClosestShelf = distanceToShelf;
64774                                     closestShelfElevation = elevation;
64775                                 }
64776                             }
64777                         }
64778                     }
64779                 }
64780             }
64781             if (closestShelfElevation !== pieceElevation && Math.abs(closestShelfElevation - pieceElevation) < margin) {
64782                 piece.setElevation(closestShelfElevation);
64783                 return piece;
64784             }
64785         }
64786         return null;
64787     };
64788     /**
64789      * Attempts to align <code>piece</code> on the borders of home furniture at the same elevation
64790      * that intersects with it and returns that piece.
64791      * @see #adjustMagnetizedPieceOfFurniture(HomePieceOfFurniture, float, float)
64792      * @param {HomePieceOfFurniture} piece
64793      * @param {boolean} forceOrientation
64794      * @param {Wall} magnetWall
64795      * @return {HomePieceOfFurniture}
64796      * @private
64797      */
64798     PlanController.prototype.adjustPieceOfFurnitureSideBySideAt = function (piece, forceOrientation, magnetWall) {
64799         var piecePoints = piece.getPoints();
64800         var pieceArea = new java.awt.geom.Area(this.getPath$float_A_A(piecePoints));
64801         var doorOrWindowBoundToWall = (piece != null && piece instanceof HomeDoorOrWindow) && piece.isBoundToWall();
64802         var pieceElevation = piece.getGroundElevation();
64803         var margin = 2 * PlanController.PIXEL_MARGIN / this.getScale();
64804         var referencePiece = null;
64805         var intersectionWithReferencePieceArea = null;
64806         var intersectionWithReferencePieceSurface = 0;
64807         var referencePiecePoints = null;
64808         {
64809             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getFurniture();
64810             for (var index = 0; index < array.length; index++) {
64811                 var homePiece = array[index];
64812                 {
64813                     var homePieceElevation = homePiece.getGroundElevation();
64814                     if (homePiece !== piece && this.isPieceOfFurnitureVisibleAtSelectedLevel(homePiece) && pieceElevation < homePieceElevation + homePiece.getHeightInPlan() && pieceElevation + piece.getHeightInPlan() > homePieceElevation && (!doorOrWindowBoundToWall || homePiece.isDoorOrWindow())) {
64815                         var points = homePiece.getPoints();
64816                         var marginArea = void 0;
64817                         if (doorOrWindowBoundToWall && homePiece.isDoorOrWindow()) {
64818                             marginArea = new java.awt.geom.Area(this.getPath$float_A_A(new Wall(points[1][0], points[1][1], points[2][0], points[2][1], margin, 0).getPoints$()));
64819                             marginArea.add(new java.awt.geom.Area(this.getPath$float_A_A(new Wall(points[3][0], points[3][1], points[0][0], points[0][1], margin, 0).getPoints$())));
64820                         }
64821                         else {
64822                             marginArea = /* get */ (function (m, k) { if (m.entries == null)
64823                                 m.entries = []; for (var i = 0; i < m.entries.length; i++)
64824                                 if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
64825                                     return m.entries[i].value;
64826                                 } return null; })(this.furnitureSidesCache, homePiece);
64827                             if (marginArea == null) {
64828                                 var pieceSideWalls = (function (s) { var a = []; while (s-- > 0)
64829                                     a.push(null); return a; })(points.length);
64830                                 for (var i = 0; i < pieceSideWalls.length; i++) {
64831                                     {
64832                                         pieceSideWalls[i] = new Wall(points[i][0], points[i][1], points[(i + 1) % pieceSideWalls.length][0], points[(i + 1) % pieceSideWalls.length][1], margin, 0);
64833                                     }
64834                                     ;
64835                                 }
64836                                 for (var i = 0; i < pieceSideWalls.length; i++) {
64837                                     {
64838                                         pieceSideWalls[(i + 1) % pieceSideWalls.length].setWallAtStart(pieceSideWalls[i]);
64839                                         pieceSideWalls[i].setWallAtEnd(pieceSideWalls[(i + 1) % pieceSideWalls.length]);
64840                                     }
64841                                     ;
64842                                 }
64843                                 var pieceSidePoints = (function (s) { var a = []; while (s-- > 0)
64844                                     a.push(null); return a; })(pieceSideWalls.length * 2 + 2);
64845                                 var pieceSideWallPoints = null;
64846                                 for (var i = 0; i < pieceSideWalls.length; i++) {
64847                                     {
64848                                         pieceSideWallPoints = pieceSideWalls[i].getPoints$();
64849                                         pieceSidePoints[i] = pieceSideWallPoints[0];
64850                                         pieceSidePoints[pieceSidePoints.length - i - 1] = pieceSideWallPoints[3];
64851                                     }
64852                                     ;
64853                                 }
64854                                 pieceSidePoints[(pieceSidePoints.length / 2 | 0) - 1] = pieceSideWallPoints[1];
64855                                 pieceSidePoints[(pieceSidePoints.length / 2 | 0)] = pieceSideWallPoints[2];
64856                                 marginArea = new java.awt.geom.Area(this.getPath$float_A_A(pieceSidePoints));
64857                                 /* put */ (function (m, k, v) { if (m.entries == null)
64858                                     m.entries = []; for (var i = 0; i < m.entries.length; i++)
64859                                     if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
64860                                         m.entries[i].value = v;
64861                                         return;
64862                                     } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(this.furnitureSidesCache, homePiece, marginArea);
64863                             }
64864                         }
64865                         var intersection = new java.awt.geom.Area(marginArea);
64866                         intersection.intersect(pieceArea);
64867                         if (!intersection.isEmpty()) {
64868                             var exclusiveOr = new java.awt.geom.Area(pieceArea);
64869                             exclusiveOr.exclusiveOr(intersection);
64870                             if (exclusiveOr.isSingular()) {
64871                                 var insideArea = new java.awt.geom.Area(this.getPath$float_A_A(points));
64872                                 insideArea.subtract(marginArea);
64873                                 insideArea.intersect(pieceArea);
64874                                 if (insideArea.isEmpty()) {
64875                                     var surface = this.getArea(intersection);
64876                                     if (surface > intersectionWithReferencePieceSurface) {
64877                                         intersectionWithReferencePieceSurface = surface;
64878                                         referencePiece = homePiece;
64879                                         referencePiecePoints = points;
64880                                         intersectionWithReferencePieceArea = intersection;
64881                                     }
64882                                 }
64883                             }
64884                         }
64885                     }
64886                 }
64887             }
64888         }
64889         if (referencePiece != null) {
64890             var alignedOnReferencePieceFrontOrBackSide = void 0;
64891             if (doorOrWindowBoundToWall && referencePiece.isDoorOrWindow()) {
64892                 alignedOnReferencePieceFrontOrBackSide = false;
64893             }
64894             else {
64895                 var referencePieceLargerBoundingBox = this.getRotatedRectangle(referencePiece.getX() - referencePiece.getWidthInPlan(), referencePiece.getY() - referencePiece.getDepthInPlan(), referencePiece.getWidthInPlan() * 2, referencePiece.getDepthInPlan() * 2, referencePiece.getAngle());
64896                 var pathPoints = this.getPathPoints(referencePieceLargerBoundingBox, false);
64897                 alignedOnReferencePieceFrontOrBackSide = this.isAreaLargerOnFrontOrBackSide(intersectionWithReferencePieceArea, pathPoints);
64898             }
64899             if (forceOrientation) {
64900                 piece.setAngle(referencePiece.getAngle());
64901             }
64902             var pieceBoundingBox = this.getRotatedRectangle(0, 0, piece.getWidthInPlan(), piece.getDepthInPlan(), piece.getAngle() - referencePiece.getAngle());
64903             var deltaX = 0;
64904             var deltaY = 0;
64905             if (!alignedOnReferencePieceFrontOrBackSide) {
64906                 var centerLine = new java.awt.geom.Line2D.Float(referencePiece.getX(), referencePiece.getY(), (referencePiecePoints[0][0] + referencePiecePoints[1][0]) / 2, (referencePiecePoints[0][1] + referencePiecePoints[1][1]) / 2);
64907                 var rotatedBoundingBoxWidth = pieceBoundingBox.getBounds2D().getWidth();
64908                 var distance = centerLine.relativeCCW(piece.getX(), piece.getY()) * (-referencePiece.getWidthInPlan() / 2 + centerLine.ptLineDist(piece.getX(), piece.getY()) - rotatedBoundingBoxWidth / 2);
64909                 deltaX = (distance * Math.cos(referencePiece.getAngle()));
64910                 deltaY = (distance * Math.sin(referencePiece.getAngle()));
64911             }
64912             else {
64913                 var centerLine = new java.awt.geom.Line2D.Float(referencePiece.getX(), referencePiece.getY(), (referencePiecePoints[2][0] + referencePiecePoints[1][0]) / 2, (referencePiecePoints[2][1] + referencePiecePoints[1][1]) / 2);
64914                 var rotatedBoundingBoxDepth = pieceBoundingBox.getBounds2D().getHeight();
64915                 var distance = centerLine.relativeCCW(piece.getX(), piece.getY()) * (-referencePiece.getDepthInPlan() / 2 + centerLine.ptLineDist(piece.getX(), piece.getY()) - rotatedBoundingBoxDepth / 2);
64916                 deltaX = (-distance * Math.sin(referencePiece.getAngle()));
64917                 deltaY = (distance * Math.cos(referencePiece.getAngle()));
64918                 if (!this.isIntersectionEmpty$com_eteks_sweethome3d_model_HomePieceOfFurniture$com_eteks_sweethome3d_model_Wall$float$float(piece, magnetWall, deltaX, deltaY)) {
64919                     deltaX = deltaY = 0;
64920                 }
64921             }
64922             if (!this.isIntersectionEmpty$com_eteks_sweethome3d_model_HomePieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$float$float(piece, referencePiece, deltaX, deltaY)) {
64923                 piece.move(deltaX, deltaY);
64924                 return referencePiece;
64925             }
64926             else {
64927                 if (forceOrientation) {
64928                     piecePoints = piece.getPoints();
64929                 }
64930                 var alignedOnPieceFrontOrBackSide = this.isAreaLargerOnFrontOrBackSide(intersectionWithReferencePieceArea, piecePoints);
64931                 var referencePieceBoundingBox = this.getRotatedRectangle(0, 0, referencePiece.getWidthInPlan(), referencePiece.getDepthInPlan(), referencePiece.getAngle() - piece.getAngle());
64932                 if (!alignedOnPieceFrontOrBackSide) {
64933                     var centerLine = new java.awt.geom.Line2D.Float(piece.getX(), piece.getY(), (piecePoints[0][0] + piecePoints[1][0]) / 2, (piecePoints[0][1] + piecePoints[1][1]) / 2);
64934                     var rotatedBoundingBoxWidth = referencePieceBoundingBox.getBounds2D().getWidth();
64935                     var distance = centerLine.relativeCCW(referencePiece.getX(), referencePiece.getY()) * (-piece.getWidthInPlan() / 2 + centerLine.ptLineDist(referencePiece.getX(), referencePiece.getY()) - rotatedBoundingBoxWidth / 2);
64936                     deltaX = -(distance * Math.cos(piece.getAngle()));
64937                     deltaY = -(distance * Math.sin(piece.getAngle()));
64938                 }
64939                 else {
64940                     var centerLine = new java.awt.geom.Line2D.Float(piece.getX(), piece.getY(), (piecePoints[2][0] + piecePoints[1][0]) / 2, (piecePoints[2][1] + piecePoints[1][1]) / 2);
64941                     var rotatedBoundingBoxDepth = referencePieceBoundingBox.getBounds2D().getHeight();
64942                     var distance = centerLine.relativeCCW(referencePiece.getX(), referencePiece.getY()) * (-piece.getDepthInPlan() / 2 + centerLine.ptLineDist(referencePiece.getX(), referencePiece.getY()) - rotatedBoundingBoxDepth / 2);
64943                     deltaX = -(-distance * Math.sin(piece.getAngle()));
64944                     deltaY = -(distance * Math.cos(piece.getAngle()));
64945                     if (!this.isIntersectionEmpty$com_eteks_sweethome3d_model_HomePieceOfFurniture$com_eteks_sweethome3d_model_Wall$float$float(piece, magnetWall, deltaX, deltaY)) {
64946                         deltaX = deltaY = 0;
64947                     }
64948                 }
64949                 if (!this.isIntersectionEmpty$com_eteks_sweethome3d_model_HomePieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$float$float(piece, referencePiece, deltaX, deltaY)) {
64950                     piece.move(deltaX, deltaY);
64951                     return referencePiece;
64952                 }
64953             }
64954         }
64955         return null;
64956     };
64957     /**
64958      * Attempts to keep <code>piece</code> in the shelf boxes it intersects with at the same elevation
64959      * and returns that shelf unit.
64960      * @see #adjustMagnetizedPieceOfFurniture(HomePieceOfFurniture, float, float)
64961      * @param {HomePieceOfFurniture} piece
64962      * @param {boolean} forceOrientation
64963      * @return {HomePieceOfFurniture}
64964      * @private
64965      */
64966     PlanController.prototype.adjustPieceOfFurnitureInShelfBox = function (piece, forceOrientation) {
64967         var pieceElevation = piece.getGroundElevation();
64968         var piecePoints = piece.getPoints();
64969         var pieceArea = null;
64970         var largestIntersectionSurface = 0;
64971         var intersectedShelfUnit = null;
64972         var largestShelfPoints = null;
64973         var surroundingFurniture = this.getSurroundingFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture(piece);
64974         var pieceSurface = 0;
64975         for (var index = 0; index < surroundingFurniture.length; index++) {
64976             var surroundingPiece = surroundingFurniture[index];
64977             {
64978                 if ((surroundingPiece != null && surroundingPiece instanceof HomeShelfUnit) && !surroundingPiece.isHorizontallyRotated()) {
64979                     var shelfUnit = surroundingPiece;
64980                     var shelfUnitElevation = shelfUnit.getGroundElevation();
64981                     {
64982                         var array = shelfUnit.getShelfBoxes();
64983                         for (var index1 = 0; index1 < array.length; index1++) {
64984                             var shelfBox = array[index1];
64985                             {
64986                                 if (Math.abs(shelfUnitElevation + shelfBox.getZLower() * shelfUnit.getHeight() - pieceElevation) < 0.1) {
64987                                     var shelfPoints = [new java.awt.geom.Point2D.Float(shelfBox.getXLower() * shelfUnit.getWidth(), (1 - shelfBox.getYUpper()) * shelfUnit.getDepth()), new java.awt.geom.Point2D.Float(shelfBox.getXUpper() * shelfUnit.getWidth(), (1 - shelfBox.getYUpper()) * shelfUnit.getDepth()), new java.awt.geom.Point2D.Float(shelfBox.getXUpper() * shelfUnit.getWidth(), (1 - shelfBox.getYLower()) * shelfUnit.getDepth()), new java.awt.geom.Point2D.Float(shelfBox.getXLower() * shelfUnit.getWidth(), (1 - shelfBox.getYLower()) * shelfUnit.getDepth())];
64988                                     var transform = java.awt.geom.AffineTransform.getTranslateInstance(shelfUnit.getX() - shelfUnit.getWidth() / 2, shelfUnit.getY() - shelfUnit.getDepth() / 2);
64989                                     transform.concatenate(java.awt.geom.AffineTransform.getRotateInstance(shelfUnit.getAngle(), shelfUnit.getWidth() / 2, shelfUnit.getDepth() / 2));
64990                                     if (shelfUnit.isModelMirrored()) {
64991                                         transform.concatenate(new java.awt.geom.AffineTransform(-1, 0, 0, 1, shelfUnit.getWidth(), 0));
64992                                     }
64993                                     for (var i = 0; i < shelfPoints.length; i++) {
64994                                         {
64995                                             transform.transform(shelfPoints[i], shelfPoints[i]);
64996                                         }
64997                                         ;
64998                                     }
64999                                     var shelfPath = new java.awt.geom.GeneralPath();
65000                                     shelfPath.moveTo(shelfPoints[0].getX(), shelfPoints[0].getY());
65001                                     shelfPath.lineTo(shelfPoints[1].getX(), shelfPoints[1].getY());
65002                                     shelfPath.lineTo(shelfPoints[2].getX(), shelfPoints[2].getY());
65003                                     shelfPath.lineTo(shelfPoints[3].getX(), shelfPoints[3].getY());
65004                                     shelfPath.closePath();
65005                                     var intersectionWithShelf = new java.awt.geom.Area(shelfPath);
65006                                     if (pieceArea == null) {
65007                                         pieceArea = new java.awt.geom.Area(this.getPath$float_A_A(piecePoints));
65008                                     }
65009                                     intersectionWithShelf.intersect(pieceArea);
65010                                     if (!intersectionWithShelf.isEmpty()) {
65011                                         if (pieceSurface === 0) {
65012                                             pieceSurface = this.getArea(pieceArea);
65013                                         }
65014                                         var intersectionSurface = pieceSurface - this.getArea(intersectionWithShelf);
65015                                         intersectedShelfUnit = shelfUnit;
65016                                         if (Math.abs(intersectionSurface) > 0.01 && intersectionSurface < pieceSurface / 4 && largestIntersectionSurface < intersectionSurface) {
65017                                             largestIntersectionSurface = intersectionSurface;
65018                                             largestShelfPoints = shelfPoints;
65019                                         }
65020                                     }
65021                                 }
65022                             }
65023                         }
65024                     }
65025                 }
65026             }
65027         }
65028         if (forceOrientation && intersectedShelfUnit != null) {
65029             piece.setAngle(intersectedShelfUnit.getAngle());
65030             piecePoints = piece.getPoints();
65031         }
65032         if (largestShelfPoints != null) {
65033             var widthDelta = 0;
65034             for (var i = 0; i < piecePoints.length; i++) {
65035                 {
65036                     if (java.awt.geom.Line2D.relativeCCW(largestShelfPoints[0].getX(), largestShelfPoints[0].getY(), largestShelfPoints[3].getX(), largestShelfPoints[3].getY(), piecePoints[i][0], piecePoints[i][1]) === (intersectedShelfUnit.isModelMirrored() ? 1 : -1)) {
65037                         var distance = java.awt.geom.Line2D.ptLineDistSq(largestShelfPoints[0].getX(), largestShelfPoints[0].getY(), largestShelfPoints[3].getX(), largestShelfPoints[3].getY(), piecePoints[i][0], piecePoints[i][1]);
65038                         if (distance > widthDelta) {
65039                             widthDelta = distance;
65040                         }
65041                     }
65042                 }
65043                 ;
65044             }
65045             if (widthDelta > 0) {
65046                 widthDelta = Math.sqrt(widthDelta) * (intersectedShelfUnit.isModelMirrored() ? -1 : 1);
65047                 piece.move(widthDelta * Math.cos(intersectedShelfUnit.getAngle()), widthDelta * Math.sin(intersectedShelfUnit.getAngle()));
65048             }
65049             else {
65050                 for (var i = 0; i < piecePoints.length; i++) {
65051                     {
65052                         if (java.awt.geom.Line2D.relativeCCW(largestShelfPoints[1].getX(), largestShelfPoints[1].getY(), largestShelfPoints[2].getX(), largestShelfPoints[2].getY(), piecePoints[i][0], piecePoints[i][1]) === (intersectedShelfUnit.isModelMirrored() ? -1 : 1)) {
65053                             var distance = java.awt.geom.Line2D.ptLineDistSq(largestShelfPoints[1].getX(), largestShelfPoints[1].getY(), largestShelfPoints[2].getX(), largestShelfPoints[2].getY(), piecePoints[i][0], piecePoints[i][1]);
65054                             if (distance > widthDelta) {
65055                                 widthDelta = distance;
65056                             }
65057                         }
65058                     }
65059                     ;
65060                 }
65061                 if (widthDelta > 0) {
65062                     widthDelta = Math.sqrt(widthDelta) * (intersectedShelfUnit.isModelMirrored() ? 1 : -1);
65063                     piece.move(widthDelta * Math.cos(intersectedShelfUnit.getAngle()), widthDelta * Math.sin(intersectedShelfUnit.getAngle()));
65064                 }
65065             }
65066             var depthDelta = 0;
65067             for (var i = 0; i < piecePoints.length; i++) {
65068                 {
65069                     if (java.awt.geom.Line2D.relativeCCW(largestShelfPoints[0].getX(), largestShelfPoints[0].getY(), largestShelfPoints[1].getX(), largestShelfPoints[1].getY(), piecePoints[i][0], piecePoints[i][1]) === (intersectedShelfUnit.isModelMirrored() ? -1 : 1)) {
65070                         var distance = java.awt.geom.Line2D.ptLineDistSq(largestShelfPoints[0].getX(), largestShelfPoints[0].getY(), largestShelfPoints[1].getX(), largestShelfPoints[1].getY(), piecePoints[i][0], piecePoints[i][1]);
65071                         if (distance > depthDelta) {
65072                             depthDelta = distance;
65073                         }
65074                     }
65075                 }
65076                 ;
65077             }
65078             if (depthDelta > 0) {
65079                 depthDelta = Math.sqrt(depthDelta);
65080                 piece.move(depthDelta * -Math.sin(intersectedShelfUnit.getAngle()), depthDelta * Math.cos(intersectedShelfUnit.getAngle()));
65081             }
65082             else {
65083                 for (var i = 0; i < piecePoints.length; i++) {
65084                     {
65085                         if (java.awt.geom.Line2D.relativeCCW(largestShelfPoints[3].getX(), largestShelfPoints[3].getY(), largestShelfPoints[2].getX(), largestShelfPoints[2].getY(), piecePoints[i][0], piecePoints[i][1]) === (intersectedShelfUnit.isModelMirrored() ? 1 : -1)) {
65086                             var distance = java.awt.geom.Line2D.ptLineDistSq(largestShelfPoints[3].getX(), largestShelfPoints[3].getY(), largestShelfPoints[2].getX(), largestShelfPoints[2].getY(), piecePoints[i][0], piecePoints[i][1]);
65087                             if (distance > depthDelta) {
65088                                 depthDelta = distance;
65089                             }
65090                         }
65091                     }
65092                     ;
65093                 }
65094                 if (depthDelta > 0) {
65095                     depthDelta = -Math.sqrt(depthDelta);
65096                     piece.move(depthDelta * -Math.sin(intersectedShelfUnit.getAngle()), depthDelta * Math.cos(intersectedShelfUnit.getAngle()));
65097                 }
65098             }
65099             return intersectedShelfUnit;
65100         }
65101         return null;
65102     };
65103     /**
65104      * Returns <code>true</code> if the intersection between the given <code>area</code> and
65105      * the front or back sides of the rectangle defined by <code>piecePoints</code> is larger
65106      * than with the left and right sides of this rectangle.
65107      * @param {java.awt.geom.Area} area
65108      * @param {float[][]} piecePoints
65109      * @return {boolean}
65110      * @private
65111      */
65112     PlanController.prototype.isAreaLargerOnFrontOrBackSide = function (area, piecePoints) {
65113         var pieceFrontAndBackQuarters = new java.awt.geom.GeneralPath();
65114         pieceFrontAndBackQuarters.moveTo(piecePoints[0][0], piecePoints[0][1]);
65115         pieceFrontAndBackQuarters.lineTo(piecePoints[2][0], piecePoints[2][1]);
65116         pieceFrontAndBackQuarters.lineTo(piecePoints[3][0], piecePoints[3][1]);
65117         pieceFrontAndBackQuarters.lineTo(piecePoints[1][0], piecePoints[1][1]);
65118         pieceFrontAndBackQuarters.closePath();
65119         var intersectionWithFrontOrBack = new java.awt.geom.Area(area);
65120         intersectionWithFrontOrBack.intersect(new java.awt.geom.Area(pieceFrontAndBackQuarters));
65121         if (intersectionWithFrontOrBack.isEmpty()) {
65122             return false;
65123         }
65124         else {
65125             var pieceLeftAndRightQuarters = new java.awt.geom.GeneralPath();
65126             pieceLeftAndRightQuarters.moveTo(piecePoints[0][0], piecePoints[0][1]);
65127             pieceLeftAndRightQuarters.lineTo(piecePoints[2][0], piecePoints[2][1]);
65128             pieceLeftAndRightQuarters.lineTo(piecePoints[1][0], piecePoints[1][1]);
65129             pieceLeftAndRightQuarters.lineTo(piecePoints[3][0], piecePoints[3][1]);
65130             pieceLeftAndRightQuarters.closePath();
65131             var intersectionWithLeftAndRight = new java.awt.geom.Area(area);
65132             intersectionWithLeftAndRight.intersect(new java.awt.geom.Area(pieceLeftAndRightQuarters));
65133             return this.getArea(intersectionWithFrontOrBack) > this.getArea(intersectionWithLeftAndRight);
65134         }
65135     };
65136     /**
65137      * Returns the area of the given shape.
65138      * @param {java.awt.geom.Area} area
65139      * @return {number}
65140      * @private
65141      */
65142     PlanController.prototype.getArea = function (area) {
65143         var pathPoints = this.getPathPoints(this.getPath$java_awt_geom_Area(area), false);
65144         if (pathPoints.length > 1) {
65145             return new Room(pathPoints).getArea();
65146         }
65147         else {
65148             return 0;
65149         }
65150     };
65151     PlanController.prototype.isIntersectionEmpty$com_eteks_sweethome3d_model_HomePieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$float$float = function (piece1, piece2, deltaX, deltaY) {
65152         var intersection = new java.awt.geom.Area(this.getRotatedRectangle(piece1.getX() - piece1.getWidthInPlan() / 2 + deltaX, piece1.getY() - piece1.getDepthInPlan() / 2 + deltaY, piece1.getWidthInPlan(), piece1.getDepth(), piece1.getAngle()));
65153         var epsilon = 0.01;
65154         intersection.intersect(new java.awt.geom.Area(this.getRotatedRectangle(piece2.getX() - piece2.getWidthInPlan() / 2 - epsilon, piece2.getY() - piece2.getDepthInPlan() / 2 - epsilon, piece2.getWidthInPlan() + 2 * epsilon, piece2.getDepthInPlan() + 2 * epsilon, piece2.getAngle())));
65155         return intersection.isEmpty();
65156     };
65157     /**
65158      * Returns <code>true</code> if the given pieces don't intersect once the first is moved from
65159      * (<code>deltaX</code>, <code>deltaY</code>) vector.
65160      * @param {HomePieceOfFurniture} piece1
65161      * @param {HomePieceOfFurniture} piece2
65162      * @param {number} deltaX
65163      * @param {number} deltaY
65164      * @return {boolean}
65165      * @private
65166      */
65167     PlanController.prototype.isIntersectionEmpty = function (piece1, piece2, deltaX, deltaY) {
65168         if (((piece1 != null && piece1 instanceof HomePieceOfFurniture) || piece1 === null) && ((piece2 != null && piece2 instanceof HomePieceOfFurniture) || piece2 === null) && ((typeof deltaX === 'number') || deltaX === null) && ((typeof deltaY === 'number') || deltaY === null)) {
65169             return this.isIntersectionEmpty$com_eteks_sweethome3d_model_HomePieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture$float$float(piece1, piece2, deltaX, deltaY);
65170         }
65171         else if (((piece1 != null && piece1 instanceof HomePieceOfFurniture) || piece1 === null) && ((piece2 != null && piece2 instanceof Wall) || piece2 === null) && ((typeof deltaX === 'number') || deltaX === null) && ((typeof deltaY === 'number') || deltaY === null)) {
65172             return this.isIntersectionEmpty$com_eteks_sweethome3d_model_HomePieceOfFurniture$com_eteks_sweethome3d_model_Wall$float$float(piece1, piece2, deltaX, deltaY);
65173         }
65174         else
65175             throw new Error('invalid overload');
65176     };
65177     PlanController.prototype.isIntersectionEmpty$com_eteks_sweethome3d_model_HomePieceOfFurniture$com_eteks_sweethome3d_model_Wall$float$float = function (piece, wall, deltaX, deltaY) {
65178         if (wall != null) {
65179             var wallAreaIntersection = new java.awt.geom.Area(this.getPath$float_A_A(wall.getPoints$()));
65180             wallAreaIntersection.intersect(new java.awt.geom.Area(this.getRotatedRectangle(piece.getX() - piece.getWidthInPlan() / 2 + deltaX, piece.getY() - piece.getDepthInPlan() / 2 + deltaY, piece.getWidthInPlan(), piece.getDepthInPlan(), piece.getAngle())));
65181             return this.getArea(wallAreaIntersection) < 1.0E-4;
65182         }
65183         return true;
65184     };
65185     /**
65186      * Returns the shape of the given rectangle rotated of a given <code>angle</code>.
65187      * @param {number} x
65188      * @param {number} y
65189      * @param {number} width
65190      * @param {number} height
65191      * @param {number} angle
65192      * @return {java.awt.geom.GeneralPath}
65193      * @private
65194      */
65195     PlanController.prototype.getRotatedRectangle = function (x, y, width, height, angle) {
65196         var referencePieceLargerBoundingBox = new java.awt.geom.Rectangle2D.Float(x, y, width, height);
65197         var rotation = java.awt.geom.AffineTransform.getRotateInstance(angle, x + width / 2, y + height / 2);
65198         var rotatedBoundingBox = new java.awt.geom.GeneralPath();
65199         rotatedBoundingBox.append(referencePieceLargerBoundingBox.getPathIterator(rotation), false);
65200         return rotatedBoundingBox;
65201     };
65202     /**
65203      * Returns the dimension line that measures the side of a piece, the length of a room side
65204      * or the length of a wall side at (<code>x</code>, <code>y</code>) point,
65205      * or <code>null</code> if it doesn't exist.
65206      * @param {number} x
65207      * @param {number} y
65208      * @param {boolean} magnetismEnabled
65209      * @return {DimensionLine}
65210      * @private
65211      */
65212     PlanController.prototype.getMeasuringDimensionLineAt = function (x, y, magnetismEnabled) {
65213         var margin = this.getSelectionMargin();
65214         {
65215             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getFurniture();
65216             for (var index = 0; index < array.length; index++) {
65217                 var piece = array[index];
65218                 {
65219                     if (this.isPieceOfFurnitureVisibleAtSelectedLevel(piece)) {
65220                         var dimensionLine = this.getDimensionLineBetweenPointsAt(piece.getPoints(), x, y, margin, magnetismEnabled);
65221                         if (dimensionLine != null) {
65222                             return dimensionLine;
65223                         }
65224                     }
65225                 }
65226             }
65227         }
65228         {
65229             var array = this.getRoomPathsFromWalls();
65230             for (var index = 0; index < array.length; index++) {
65231                 var roomPath = array[index];
65232                 {
65233                     if (roomPath.intersects(x - margin, y - margin, 2 * margin, 2 * margin)) {
65234                         var dimensionLine = this.getDimensionLineBetweenPointsAt(this.getPathPoints(roomPath, true), x, y, margin, magnetismEnabled);
65235                         if (dimensionLine != null) {
65236                             return dimensionLine;
65237                         }
65238                     }
65239                 }
65240             }
65241         }
65242         {
65243             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getRooms();
65244             for (var index = 0; index < array.length; index++) {
65245                 var room = array[index];
65246                 {
65247                     if (this.isLevelNullOrViewable(room.getLevel()) && room.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel())) {
65248                         var dimensionLine = this.getDimensionLineBetweenPointsAt(room.getPoints(), x, y, margin, magnetismEnabled);
65249                         if (dimensionLine != null) {
65250                             return dimensionLine;
65251                         }
65252                     }
65253                 }
65254             }
65255         }
65256         return null;
65257     };
65258     /**
65259      * Returns the dimension line that measures the side of the given polygon at (<code>x</code>, <code>y</code>) point,
65260      * or <code>null</code> if it doesn't exist.
65261      * @param {float[][]} points
65262      * @param {number} x
65263      * @param {number} y
65264      * @param {number} margin
65265      * @param {boolean} magnetismEnabled
65266      * @return {DimensionLine}
65267      * @private
65268      */
65269     PlanController.prototype.getDimensionLineBetweenPointsAt = function (points, x, y, margin, magnetismEnabled) {
65270         for (var i = 0; i < points.length; i++) {
65271             {
65272                 var nextPointIndex = (i + 1) % points.length;
65273                 var distanceBetweenPointsSq = java.awt.geom.Point2D.distanceSq(points[i][0], points[i][1], points[nextPointIndex][0], points[nextPointIndex][1]);
65274                 if (distanceBetweenPointsSq > 0.01 && java.awt.geom.Line2D.ptSegDistSq(points[i][0], points[i][1], points[nextPointIndex][0], points[nextPointIndex][1], x, y) <= margin * margin) {
65275                     return this.getDimensionLineBetweenPoints$float_A$float_A$float$double$boolean(points[i], points[nextPointIndex], 0, distanceBetweenPointsSq, magnetismEnabled);
65276                 }
65277             }
65278             ;
65279         }
65280         return null;
65281     };
65282     PlanController.prototype.getDimensionLineBetweenPoints$float_A$float_A$float$boolean = function (point1, point2, offset, magnetismEnabled) {
65283         return this.getDimensionLineBetweenPoints$float_A$float_A$float$double$boolean(point1, point2, offset, java.awt.geom.Point2D.distanceSq(point1[0], point1[1], point2[0], point2[1]), magnetismEnabled);
65284     };
65285     PlanController.prototype.getDimensionLineBetweenPoints$float_A$float_A$float$double$boolean = function (point1, point2, offset, distanceBetweenPointsSq, magnetismEnabled) {
65286         var angle = Math.atan2(point1[1] - point2[1], point2[0] - point1[0]);
65287         var reverse = angle <= -Math.PI / 2 || angle > Math.PI / 2;
65288         var xStart;
65289         var yStart;
65290         var xEnd;
65291         var yEnd;
65292         if (reverse) {
65293             xStart = point2[0];
65294             yStart = point2[1];
65295             xEnd = point1[0];
65296             yEnd = point1[1];
65297             offset = -offset;
65298         }
65299         else {
65300             xStart = point1[0];
65301             yStart = point1[1];
65302             xEnd = point2[0];
65303             yEnd = point2[1];
65304         }
65305         if (magnetismEnabled) {
65306             var magnetizedLength = this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMagnetizedLength(Math.sqrt(distanceBetweenPointsSq), this.getView().getPixelLength());
65307             if (reverse) {
65308                 xEnd = point2[0] - (magnetizedLength * Math.cos(angle));
65309                 yEnd = point2[1] + (magnetizedLength * Math.sin(angle));
65310             }
65311             else {
65312                 xEnd = point1[0] + (magnetizedLength * Math.cos(angle));
65313                 yEnd = point1[1] - (magnetizedLength * Math.sin(angle));
65314             }
65315         }
65316         return new DimensionLine(xStart, yStart, xEnd, yEnd, offset);
65317     };
65318     /**
65319      * Returns the dimension line between the given points.
65320      * @param {float[]} point1
65321      * @param {float[]} point2
65322      * @param {number} offset
65323      * @param {number} distanceBetweenPointsSq
65324      * @param {boolean} magnetismEnabled
65325      * @return {DimensionLine}
65326      * @private
65327      */
65328     PlanController.prototype.getDimensionLineBetweenPoints = function (point1, point2, offset, distanceBetweenPointsSq, magnetismEnabled) {
65329         if (((point1 != null && point1 instanceof Array && (point1.length == 0 || point1[0] == null || (typeof point1[0] === 'number'))) || point1 === null) && ((point2 != null && point2 instanceof Array && (point2.length == 0 || point2[0] == null || (typeof point2[0] === 'number'))) || point2 === null) && ((typeof offset === 'number') || offset === null) && ((typeof distanceBetweenPointsSq === 'number') || distanceBetweenPointsSq === null) && ((typeof magnetismEnabled === 'boolean') || magnetismEnabled === null)) {
65330             return this.getDimensionLineBetweenPoints$float_A$float_A$float$double$boolean(point1, point2, offset, distanceBetweenPointsSq, magnetismEnabled);
65331         }
65332         else if (((point1 != null && point1 instanceof Array && (point1.length == 0 || point1[0] == null || (typeof point1[0] === 'number'))) || point1 === null) && ((point2 != null && point2 instanceof Array && (point2.length == 0 || point2[0] == null || (typeof point2[0] === 'number'))) || point2 === null) && ((typeof offset === 'number') || offset === null) && ((typeof distanceBetweenPointsSq === 'boolean') || distanceBetweenPointsSq === null) && magnetismEnabled === undefined) {
65333             return this.getDimensionLineBetweenPoints$float_A$float_A$float$boolean(point1, point2, offset, distanceBetweenPointsSq);
65334         }
65335         else
65336             throw new Error('invalid overload');
65337     };
65338     PlanController.prototype.addLevel$ = function () {
65339         this.addLevel$boolean(false);
65340     };
65341     /**
65342      * Controls the creation of a new level at same elevation.
65343      */
65344     PlanController.prototype.addLevelAtSameElevation = function () {
65345         this.addLevel$boolean(true);
65346     };
65347     PlanController.prototype.addLevel$boolean = function (sameElevation) {
65348         var allLevelsSelection = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection();
65349         var oldSelectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
65350         var oldSelection = oldSelectedItems.slice(0);
65351         var oldSelectedLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
65352         var homeBackgroundImage = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getBackgroundImage();
65353         var levels = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getLevels();
65354         var newWallHeight = this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getNewWallHeight();
65355         var newFloorThickness = this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getNewFloorThickness();
65356         var level0;
65357         if ( /* isEmpty */(levels.length == 0)) {
65358             var level0Name = this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "levelName", 0);
65359             level0 = this.createLevel(level0Name, 0, newFloorThickness, newWallHeight);
65360             this.moveHomeItemsToLevel(level0);
65361             level0.setBackgroundImage(homeBackgroundImage);
65362             this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBackgroundImage(null);
65363             levels = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getLevels();
65364         }
65365         else {
65366             level0 = null;
65367         }
65368         var newLevelName = this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "levelName", /* size */ levels.length);
65369         var newLevel;
65370         if (sameElevation) {
65371             var referencedLevel = level0 != null ? level0 : this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
65372             newLevel = this.createLevel(newLevelName, referencedLevel.getElevation(), referencedLevel.getFloorThickness(), referencedLevel.getHeight());
65373         }
65374         else {
65375             var newLevelElevation = levels[ /* size */levels.length - 1].getElevation() + newWallHeight + newFloorThickness;
65376             newLevel = this.createLevel(newLevelName, newLevelElevation, newFloorThickness, newWallHeight);
65377         }
65378         this.setSelectedLevel(newLevel);
65379         this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.LevelAdditionUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_home, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldSelection, allLevelsSelection, oldSelectedLevel, level0, homeBackgroundImage, newLevel));
65380     };
65381     /**
65382      * Controls the creation of a level.
65383      * @param {boolean} sameElevation
65384      * @private
65385      */
65386     PlanController.prototype.addLevel = function (sameElevation) {
65387         if (((typeof sameElevation === 'boolean') || sameElevation === null)) {
65388             return this.addLevel$boolean(sameElevation);
65389         }
65390         else if (sameElevation === undefined) {
65391             return this.addLevel$();
65392         }
65393         else
65394             throw new Error('invalid overload');
65395     };
65396     /**
65397      * Returns a new level added to home.
65398      * @param {string} name
65399      * @param {number} elevation
65400      * @param {number} floorThickness
65401      * @param {number} height
65402      * @return {Level}
65403      */
65404     PlanController.prototype.createLevel = function (name, elevation, floorThickness, height) {
65405         var newLevel = new Level(name, elevation, floorThickness, height);
65406         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addLevel(newLevel);
65407         return newLevel;
65408     };
65409     /**
65410      * Moves to the given <code>level</code> all existing furniture, walls, rooms, dimension lines
65411      * and labels.
65412      * @param {Level} level
65413      * @private
65414      */
65415     PlanController.prototype.moveHomeItemsToLevel = function (level) {
65416         {
65417             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getFurniture();
65418             for (var index = 0; index < array.length; index++) {
65419                 var piece = array[index];
65420                 {
65421                     piece.setLevel(level);
65422                 }
65423             }
65424         }
65425         {
65426             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getWalls();
65427             for (var index = 0; index < array.length; index++) {
65428                 var wall = array[index];
65429                 {
65430                     wall.setLevel(level);
65431                 }
65432             }
65433         }
65434         {
65435             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getRooms();
65436             for (var index = 0; index < array.length; index++) {
65437                 var room = array[index];
65438                 {
65439                     room.setLevel(level);
65440                 }
65441             }
65442         }
65443         {
65444             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getPolylines();
65445             for (var index = 0; index < array.length; index++) {
65446                 var polyline = array[index];
65447                 {
65448                     polyline.setLevel(level);
65449                 }
65450             }
65451         }
65452         {
65453             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getDimensionLines();
65454             for (var index = 0; index < array.length; index++) {
65455                 var dimensionLine = array[index];
65456                 {
65457                     dimensionLine.setLevel(level);
65458                 }
65459             }
65460         }
65461         {
65462             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getLabels();
65463             for (var index = 0; index < array.length; index++) {
65464                 var label = array[index];
65465                 {
65466                     label.setLevel(level);
65467                 }
65468             }
65469         }
65470     };
65471     /**
65472      * Toggles the viewability of the selected level.
65473      */
65474     PlanController.prototype.toggleSelectedLevelViewability = function () {
65475         var selectedLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
65476         selectedLevel.setViewable(!selectedLevel.isViewable());
65477         this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.LevelViewabilityModificationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, selectedLevel));
65478     };
65479     /**
65480      * Makes the selected level the only viewable one.
65481      */
65482     PlanController.prototype.setSelectedLevelOnlyViewable = function () {
65483         var viewableLevels = this.getLevels(true);
65484         var selectedLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
65485         var selectedLevelViewable = selectedLevel.isViewable();
65486         if (viewableLevels.length !== 1 || !selectedLevelViewable) {
65487             PlanController.setLevelsViewability(viewableLevels, false);
65488             selectedLevel.setViewable(true);
65489             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.LevelsViewabilityModificationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, selectedLevel, selectedLevelViewable, viewableLevels));
65490         }
65491     };
65492     /**
65493      * Makes all levels viewable.
65494      */
65495     PlanController.prototype.setAllLevelsViewable = function () {
65496         var unviewableLevels = this.getLevels(false);
65497         if (unviewableLevels.length > 0) {
65498             var selectedLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
65499             PlanController.setLevelsViewability(unviewableLevels, true);
65500             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.AllLevelsViewabilityModificationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, selectedLevel, unviewableLevels));
65501         }
65502     };
65503     /**
65504      * Returns levels which are viewable or not according to parameter.
65505      * @param {boolean} viewable
65506      * @return {com.eteks.sweethome3d.model.Level[]}
65507      * @private
65508      */
65509     PlanController.prototype.getLevels = function (viewable) {
65510         var levels = ([]);
65511         {
65512             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getLevels();
65513             for (var index = 0; index < array.length; index++) {
65514                 var level = array[index];
65515                 {
65516                     if (level.isViewable() === viewable) {
65517                         /* add */ (levels.push(level) > 0);
65518                     }
65519                 }
65520             }
65521         }
65522         return /* toArray */ levels.slice(0);
65523     };
65524     PlanController.setLevelsViewability = function (levels, viewable) {
65525         for (var index = 0; index < levels.length; index++) {
65526             var level = levels[index];
65527             {
65528                 level.setViewable(viewable);
65529             }
65530         }
65531     };
65532     PlanController.prototype.modifySelectedLevel = function () {
65533         if (this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel() != null) {
65534             new LevelController(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, this.__com_eteks_sweethome3d_viewcontroller_PlanController_viewFactory, this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport).displayView(this.getView());
65535         }
65536     };
65537     /**
65538      * Deletes the selected level and the items that belongs to it.
65539      */
65540     PlanController.prototype.deleteSelectedLevel = function () {
65541         this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.beginUpdate();
65542         var levelFurniture = ([]);
65543         var oldSelectedLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
65544         {
65545             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getFurniture();
65546             for (var index = 0; index < array.length; index++) {
65547                 var piece = array[index];
65548                 {
65549                     if (piece.getLevel() === oldSelectedLevel) {
65550                         /* add */ (levelFurniture.push(piece) > 0);
65551                     }
65552                 }
65553             }
65554         }
65555         this.deleteFurniture(levelFurniture);
65556         var levelOtherItems = ([]);
65557         this.addLevelItemsAtSelectedLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getWalls(), levelOtherItems);
65558         this.addLevelItemsAtSelectedLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getRooms(), levelOtherItems);
65559         this.addLevelItemsAtSelectedLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getDimensionLines(), levelOtherItems);
65560         this.addLevelItemsAtSelectedLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getLabels(), levelOtherItems);
65561         this.postDeleteItems(levelOtherItems, this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked(), this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection());
65562         this.doDeleteItems(levelOtherItems);
65563         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deleteLevel(oldSelectedLevel);
65564         var levels = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getLevels();
65565         var remainingLevel;
65566         var remainingLevelElevation;
65567         var remainingLevelViewable;
65568         if ( /* size */levels.length === 1) {
65569             remainingLevel = /* get */ levels[0];
65570             remainingLevelElevation = remainingLevel.getElevation();
65571             remainingLevelViewable = remainingLevel.isViewable();
65572             remainingLevel.setElevation(0);
65573             remainingLevel.setViewable(true);
65574         }
65575         else {
65576             remainingLevel = null;
65577             remainingLevelElevation = null;
65578             remainingLevelViewable = false;
65579         }
65580         this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.LevelDeletionUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_home, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldSelectedLevel, remainingLevel, remainingLevelElevation, remainingLevelViewable));
65581         this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.endUpdate();
65582     };
65583     PlanController.prototype.addLevelItemsAtSelectedLevel = function (items, levelItems) {
65584         var selectedLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
65585         for (var index = 0; index < items.length; index++) {
65586             var item = items[index];
65587             {
65588                 if ((item != null && (item.constructor != null && item.constructor["__interfaces"] != null && item.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Elevatable") >= 0)) && item.getLevel() === selectedLevel) {
65589                     /* add */ (levelItems.push(item) > 0);
65590                 }
65591             }
65592         }
65593     };
65594     /**
65595      * Returns a new wall instance between (<code>xStart</code>,
65596      * <code>yStart</code>) and (<code>xEnd</code>, <code>yEnd</code>)
65597      * end points. The new wall is added to home and its start point is joined
65598      * to the start of <code>wallStartAtStart</code> or
65599      * the end of <code>wallEndAtStart</code>.
65600      * @param {number} xStart
65601      * @param {number} yStart
65602      * @param {number} xEnd
65603      * @param {number} yEnd
65604      * @param {Wall} wallStartAtStart
65605      * @param {Wall} wallEndAtStart
65606      * @return {Wall}
65607      */
65608     PlanController.prototype.createWall = function (xStart, yStart, xEnd, yEnd, wallStartAtStart, wallEndAtStart) {
65609         var newWall = new Wall(xStart, yStart, xEnd, yEnd, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getNewWallThickness(), this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getNewWallHeight(), this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getNewWallPattern());
65610         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addWall(newWall);
65611         if (wallStartAtStart != null) {
65612             newWall.setWallAtStart(wallStartAtStart);
65613             wallStartAtStart.setWallAtStart(newWall);
65614         }
65615         else if (wallEndAtStart != null) {
65616             newWall.setWallAtStart(wallEndAtStart);
65617             wallEndAtStart.setWallAtEnd(newWall);
65618         }
65619         return newWall;
65620     };
65621     /**
65622      * Joins the end point of <code>wall</code> to the start of
65623      * <code>wallStartAtEnd</code> or the end of <code>wallEndAtEnd</code>.
65624      * @param {Wall} wall
65625      * @param {Wall} wallStartAtEnd
65626      * @param {Wall} wallEndAtEnd
65627      * @private
65628      */
65629     PlanController.prototype.joinNewWallEndToWall = function (wall, wallStartAtEnd, wallEndAtEnd) {
65630         if (wallStartAtEnd != null) {
65631             wall.setWallAtEnd(wallStartAtEnd);
65632             wallStartAtEnd.setWallAtStart(wall);
65633             wall.setXEnd(wallStartAtEnd.getXStart());
65634             wall.setYEnd(wallStartAtEnd.getYStart());
65635         }
65636         else if (wallEndAtEnd != null) {
65637             wall.setWallAtEnd(wallEndAtEnd);
65638             wallEndAtEnd.setWallAtEnd(wall);
65639             wall.setXEnd(wallEndAtEnd.getXEnd());
65640             wall.setYEnd(wallEndAtEnd.getYEnd());
65641         }
65642     };
65643     /**
65644      * Returns the wall at (<code>x</code>, <code>y</code>) point,
65645      * which has a start point not joined to any wall.
65646      * @param {number} x
65647      * @param {number} y
65648      * @param {Wall} ignoredWall
65649      * @return {Wall}
65650      * @private
65651      */
65652     PlanController.prototype.getWallStartAt = function (x, y, ignoredWall) {
65653         var margin = PlanController.WALL_ENDS_PIXEL_MARGIN / this.getScale();
65654         {
65655             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getWalls();
65656             for (var index = 0; index < array.length; index++) {
65657                 var wall = array[index];
65658                 {
65659                     if (wall !== ignoredWall && this.isLevelNullOrViewable(wall.getLevel()) && wall.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && wall.getWallAtStart() == null && wall.containsWallStartAt(x, y, margin)) {
65660                         return wall;
65661                     }
65662                 }
65663             }
65664         }
65665         return null;
65666     };
65667     /**
65668      * Returns the wall at (<code>x</code>, <code>y</code>) point,
65669      * which has a end point not joined to any wall.
65670      * @param {number} x
65671      * @param {number} y
65672      * @param {Wall} ignoredWall
65673      * @return {Wall}
65674      * @private
65675      */
65676     PlanController.prototype.getWallEndAt = function (x, y, ignoredWall) {
65677         var margin = PlanController.WALL_ENDS_PIXEL_MARGIN / this.getScale();
65678         {
65679             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getWalls();
65680             for (var index = 0; index < array.length; index++) {
65681                 var wall = array[index];
65682                 {
65683                     if (wall !== ignoredWall && this.isLevelNullOrViewable(wall.getLevel()) && wall.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && wall.getWallAtEnd() == null && wall.containsWallEndAt(x, y, margin)) {
65684                         return wall;
65685                     }
65686                 }
65687             }
65688         }
65689         return null;
65690     };
65691     /**
65692      * Returns the tolerance margin to handle an indicator.
65693      * @return {number}
65694      * @private
65695      */
65696     PlanController.prototype.getIndicatorMargin = function () {
65697         var indicatorPixelMagin = PlanController.INDICATOR_PIXEL_MARGIN;
65698         if (this.getPointerTypeLastMousePress() === View.PointerType.TOUCH) {
65699             indicatorPixelMagin *= 3;
65700         }
65701         return indicatorPixelMagin / this.getScale();
65702     };
65703     /**
65704      * Returns the selected wall with a start point
65705      * at (<code>x</code>, <code>y</code>).
65706      * @param {number} x
65707      * @param {number} y
65708      * @return {Wall}
65709      * @private
65710      */
65711     PlanController.prototype.getResizedWallStartAt = function (x, y) {
65712         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
65713         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Wall) && this.isItemResizable(/* get */ selectedItems[0])) {
65714             var wall = selectedItems[0];
65715             var margin = this.getIndicatorMargin();
65716             if (wall.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && wall.containsWallStartAt(x, y, margin)) {
65717                 return wall;
65718             }
65719         }
65720         return null;
65721     };
65722     /**
65723      * Returns the selected wall with an end point at (<code>x</code>, <code>y</code>).
65724      * @param {number} x
65725      * @param {number} y
65726      * @return {Wall}
65727      * @private
65728      */
65729     PlanController.prototype.getResizedWallEndAt = function (x, y) {
65730         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
65731         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Wall) && this.isItemResizable(/* get */ selectedItems[0])) {
65732             var wall = selectedItems[0];
65733             var margin = this.getIndicatorMargin();
65734             if (wall.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && wall.containsWallEndAt(x, y, margin)) {
65735                 return wall;
65736             }
65737         }
65738         return null;
65739     };
65740     /**
65741      * Returns the selected wall with a middle point at (<code>x</code>, <code>y</code>).
65742      * @param {number} x
65743      * @param {number} y
65744      * @return {Wall}
65745      * @private
65746      */
65747     PlanController.prototype.getArcExtentWallAt = function (x, y) {
65748         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
65749         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Wall) && this.isItemResizable(/* get */ selectedItems[0])) {
65750             var wall = selectedItems[0];
65751             var margin = this.getIndicatorMargin();
65752             if (wall.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && wall.isMiddlePointAt(x, y, margin)) {
65753                 return wall;
65754             }
65755         }
65756         return null;
65757     };
65758     /**
65759      * Returns a new room instance with the given points.
65760      * The new room is added to home.
65761      * @param {float[][]} roomPoints
65762      * @return {Room}
65763      */
65764     PlanController.prototype.createRoom = function (roomPoints) {
65765         var newRoom = new Room(roomPoints);
65766         newRoom.setFloorColor(this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getNewRoomFloorColor());
65767         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addRoom$com_eteks_sweethome3d_model_Room(newRoom);
65768         return newRoom;
65769     };
65770     /**
65771      * Returns the points of the room matching the closed path that contains the point at the given
65772      * coordinates or <code>null</code> if there's no closed path at this point.
65773      * @param {number} x
65774      * @param {number} y
65775      * @return {float[][]}
65776      * @private
65777      */
65778     PlanController.prototype.computeRoomPointsAt = function (x, y) {
65779         {
65780             var array = this.getRoomPathsFromWalls();
65781             for (var index = 0; index < array.length; index++) {
65782                 var roomPath = array[index];
65783                 {
65784                     if (roomPath.contains(x, y)) {
65785                         {
65786                             var array1 = this.getVisibleDoorsAndWindowsAtGround(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getFurniture());
65787                             for (var index1 = 0; index1 < array1.length; index1++) {
65788                                 var piece = array1[index1];
65789                                 {
65790                                     var doorPoints = piece.getPoints();
65791                                     var intersectionCount = 0;
65792                                     for (var i = 0; i < doorPoints.length; i++) {
65793                                         {
65794                                             if (roomPath.contains(doorPoints[i][0], doorPoints[i][1])) {
65795                                                 intersectionCount++;
65796                                             }
65797                                         }
65798                                         ;
65799                                     }
65800                                     if (doorPoints.length === 4) {
65801                                         var epsilon = 0.05;
65802                                         var doorStepPoints = null;
65803                                         if ((piece != null && piece instanceof HomeDoorOrWindow) && piece.isWallCutOutOnBothSides()) {
65804                                             var door = piece;
65805                                             var selectedLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
65806                                             var doorArea = new java.awt.geom.Area(this.getPath$float_A_A(doorPoints));
65807                                             var wallsDoorIntersection = new java.awt.geom.Area();
65808                                             {
65809                                                 var array2 = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getWalls();
65810                                                 for (var index2 = 0; index2 < array2.length; index2++) {
65811                                                     var wall = array2[index2];
65812                                                     {
65813                                                         if (wall.isAtLevel(selectedLevel) && door.isParallelToWall(wall)) {
65814                                                             var wallPath = this.getPath$float_A_A(wall.getPoints$());
65815                                                             var intersectionArea = new java.awt.geom.Area(wallPath);
65816                                                             intersectionArea.intersect(doorArea);
65817                                                             if (!intersectionArea.isEmpty()) {
65818                                                                 var deeperDoor = (function (o) { if (o.clone != undefined) {
65819                                                                     return o.clone();
65820                                                                 }
65821                                                                 else {
65822                                                                     var clone = Object.create(o);
65823                                                                     for (var p in o) {
65824                                                                         if (o.hasOwnProperty(p))
65825                                                                             clone[p] = o[p];
65826                                                                     }
65827                                                                     return clone;
65828                                                                 } })(door);
65829                                                                 deeperDoor.setDepthInPlan(deeperDoor.getDepth() + 4 * wall.getThickness());
65830                                                                 intersectionArea = new java.awt.geom.Area(wallPath);
65831                                                                 intersectionArea.intersect(new java.awt.geom.Area(this.getPath$float_A_A(deeperDoor.getPoints())));
65832                                                                 wallsDoorIntersection.add(intersectionArea);
65833                                                             }
65834                                                         }
65835                                                     }
65836                                                 }
65837                                             }
65838                                             if (!wallsDoorIntersection.isEmpty() && wallsDoorIntersection.isSingular()) {
65839                                                 var intersectionPoints = this.getPathPoints(this.getPath$java_awt_geom_Area(wallsDoorIntersection), true);
65840                                                 if (intersectionPoints.length === 4) {
65841                                                     var doorMiddleY = door.getY() + door.getDepth() * (-0.5 + door.getWallDistance() + door.getWallThickness() / 2);
65842                                                     var halfWidth = door.getWidth() / 2;
65843                                                     var doorMiddlePoints = [door.getX() - halfWidth, doorMiddleY, door.getX() + halfWidth, doorMiddleY];
65844                                                     var rotation = java.awt.geom.AffineTransform.getRotateInstance(door.getAngle(), door.getX(), door.getY());
65845                                                     rotation.transform(doorMiddlePoints, 0, doorMiddlePoints, 0, 2);
65846                                                     for (var i = 0; i < intersectionPoints.length - 1; i++) {
65847                                                         {
65848                                                             if (roomPath.intersects(intersectionPoints[i][0] - epsilon / 2, intersectionPoints[i][1] - epsilon / 2, epsilon, epsilon)) {
65849                                                                 var inPoint1 = i;
65850                                                                 var outPoint1 = void 0;
65851                                                                 var outPoint2 = void 0;
65852                                                                 if (roomPath.intersects(intersectionPoints[i + 1][0] - epsilon / 2, intersectionPoints[i + 1][1] - epsilon / 2, epsilon, epsilon)) {
65853                                                                     outPoint2 = (i + 2) % 4;
65854                                                                     outPoint1 = (i + 3) % 4;
65855                                                                 }
65856                                                                 else if (roomPath.intersects(intersectionPoints[(i + 3) % 4][0] - epsilon / 2, intersectionPoints[(i + 3) % 4][1] - epsilon / 2, epsilon, epsilon)) {
65857                                                                     outPoint1 = (i + 1) % 4;
65858                                                                     outPoint2 = (i + 2) % 4;
65859                                                                 }
65860                                                                 else {
65861                                                                     break;
65862                                                                 }
65863                                                                 if (java.awt.geom.Point2D.distanceSq(intersectionPoints[inPoint1][0], intersectionPoints[inPoint1][1], doorMiddlePoints[0], doorMiddlePoints[1]) < java.awt.geom.Point2D.distanceSq(intersectionPoints[inPoint1][0], intersectionPoints[inPoint1][1], doorMiddlePoints[2], doorMiddlePoints[3])) {
65864                                                                     intersectionPoints[outPoint1][0] = doorMiddlePoints[0];
65865                                                                     intersectionPoints[outPoint1][1] = doorMiddlePoints[1];
65866                                                                     intersectionPoints[outPoint2][0] = doorMiddlePoints[2];
65867                                                                     intersectionPoints[outPoint2][1] = doorMiddlePoints[3];
65868                                                                 }
65869                                                                 else {
65870                                                                     intersectionPoints[outPoint1][0] = doorMiddlePoints[2];
65871                                                                     intersectionPoints[outPoint1][1] = doorMiddlePoints[3];
65872                                                                     intersectionPoints[outPoint2][0] = doorMiddlePoints[0];
65873                                                                     intersectionPoints[outPoint2][1] = doorMiddlePoints[1];
65874                                                                 }
65875                                                                 doorStepPoints = intersectionPoints;
65876                                                                 break;
65877                                                             }
65878                                                         }
65879                                                         ;
65880                                                     }
65881                                                 }
65882                                             }
65883                                         }
65884                                         if (doorStepPoints == null && intersectionCount === 2) {
65885                                             var wallsDoorIntersection = new java.awt.geom.Area(this.getWallsArea(false));
65886                                             wallsDoorIntersection.intersect(new java.awt.geom.Area(this.getPath$float_A_A(doorPoints)));
65887                                             var intersectionPoints = this.getPathPoints(this.getPath$java_awt_geom_Area(wallsDoorIntersection), false);
65888                                             if (intersectionPoints.length === 4) {
65889                                                 for (var i = 0; i < intersectionPoints.length; i++) {
65890                                                     {
65891                                                         if (roomPath.intersects(intersectionPoints[i][0] - epsilon / 2, intersectionPoints[i][1] - epsilon / 2, epsilon, epsilon)) {
65892                                                             var inPoint1 = i;
65893                                                             var inPoint2 = void 0;
65894                                                             var outPoint1 = void 0;
65895                                                             var outPoint2 = void 0;
65896                                                             if (roomPath.intersects(intersectionPoints[i + 1][0] - epsilon / 2, intersectionPoints[i + 1][1] - epsilon / 2, epsilon, epsilon)) {
65897                                                                 inPoint2 = i + 1;
65898                                                                 outPoint2 = (i + 2) % 4;
65899                                                                 outPoint1 = (i + 3) % 4;
65900                                                             }
65901                                                             else {
65902                                                                 outPoint1 = (i + 1) % 4;
65903                                                                 outPoint2 = (i + 2) % 4;
65904                                                                 inPoint2 = (i + 3) % 4;
65905                                                             }
65906                                                             intersectionPoints[outPoint1][0] = (intersectionPoints[outPoint1][0] + intersectionPoints[inPoint1][0]) / 2;
65907                                                             intersectionPoints[outPoint1][1] = (intersectionPoints[outPoint1][1] + intersectionPoints[inPoint1][1]) / 2;
65908                                                             intersectionPoints[outPoint2][0] = (intersectionPoints[outPoint2][0] + intersectionPoints[inPoint2][0]) / 2;
65909                                                             intersectionPoints[outPoint2][1] = (intersectionPoints[outPoint2][1] + intersectionPoints[inPoint2][1]) / 2;
65910                                                             doorStepPoints = intersectionPoints;
65911                                                             break;
65912                                                         }
65913                                                     }
65914                                                     ;
65915                                                 }
65916                                             }
65917                                         }
65918                                         if (doorStepPoints != null) {
65919                                             var path = this.getPath$float_A_A(doorStepPoints);
65920                                             var bounds2D = path.getBounds2D();
65921                                             var transform = java.awt.geom.AffineTransform.getTranslateInstance(bounds2D.getCenterX(), bounds2D.getCenterY());
65922                                             var min = Math.min(bounds2D.getWidth(), bounds2D.getHeight());
65923                                             var scale = (min + epsilon) / min;
65924                                             transform.scale(scale, scale);
65925                                             transform.translate(-bounds2D.getCenterX(), -bounds2D.getCenterY());
65926                                             var doorStepPath = path.createTransformedShape(transform);
65927                                             var halfDoorRoomUnion = new java.awt.geom.Area(doorStepPath);
65928                                             halfDoorRoomUnion.add(new java.awt.geom.Area(roomPath));
65929                                             roomPath = this.getPath$java_awt_geom_Area(halfDoorRoomUnion);
65930                                         }
65931                                     }
65932                                 }
65933                             }
65934                         }
65935                         return this.getPathPoints(roomPath, false);
65936                     }
65937                 }
65938             }
65939         }
65940         return null;
65941     };
65942     /**
65943      * Returns all the visible doors and windows with a null elevation in the given <code>furniture</code>.
65944      * @param {HomePieceOfFurniture[]} furniture
65945      * @return {HomePieceOfFurniture[]}
65946      * @private
65947      */
65948     PlanController.prototype.getVisibleDoorsAndWindowsAtGround = function (furniture) {
65949         var doorsAndWindows = ([]);
65950         for (var index = 0; index < furniture.length; index++) {
65951             var piece = furniture[index];
65952             {
65953                 if (this.isPieceOfFurnitureVisibleAtSelectedLevel(piece) && piece.getElevation() === 0) {
65954                     if (piece != null && piece instanceof HomeFurnitureGroup) {
65955                         /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(doorsAndWindows, this.getVisibleDoorsAndWindowsAtGround(piece.getFurniture()));
65956                     }
65957                     else if (piece.isDoorOrWindow()) {
65958                         /* add */ (doorsAndWindows.push(piece) > 0);
65959                     }
65960                 }
65961             }
65962         }
65963         return doorsAndWindows;
65964     };
65965     /**
65966      * Returns the selected room with a point at (<code>x</code>, <code>y</code>).
65967      * @param {number} x
65968      * @param {number} y
65969      * @return {Room}
65970      * @private
65971      */
65972     PlanController.prototype.getResizedRoomAt = function (x, y) {
65973         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
65974         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Room) && this.isItemResizable(/* get */ selectedItems[0])) {
65975             var room = selectedItems[0];
65976             var margin = this.getIndicatorMargin();
65977             if (room.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && room.getPointIndexAt(x, y, margin) !== -1) {
65978                 return room;
65979             }
65980         }
65981         return null;
65982     };
65983     /**
65984      * Returns the selected room with its name center point at (<code>x</code>, <code>y</code>).
65985      * @param {number} x
65986      * @param {number} y
65987      * @return {Room}
65988      * @private
65989      */
65990     PlanController.prototype.getRoomNameAt = function (x, y) {
65991         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
65992         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Room) && this.isItemMovable(/* get */ selectedItems[0])) {
65993             var room = selectedItems[0];
65994             var margin = this.getIndicatorMargin();
65995             if (room.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && room.getName() != null && room.getName().trim().length > 0 && room.isNameCenterPointAt(x, y, margin)) {
65996                 return room;
65997             }
65998         }
65999         return null;
66000     };
66001     /**
66002      * Returns the selected room with its
66003      * name angle point at (<code>x</code>, <code>y</code>).
66004      * @param {number} x
66005      * @param {number} y
66006      * @return {Room}
66007      * @private
66008      */
66009     PlanController.prototype.getRoomRotatedNameAt = function (x, y) {
66010         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66011         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Room) && this.isItemMovable(/* get */ selectedItems[0])) {
66012             var room = selectedItems[0];
66013             var margin = this.getIndicatorMargin();
66014             if (room.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && room.getName() != null && room.getName().trim().length > 0 && this.isTextAnglePointAt(room, room.getName(), room.getNameStyle(), room.getXCenter() + room.getNameXOffset(), room.getYCenter() + room.getNameYOffset(), room.getNameAngle(), x, y, margin)) {
66015                 return room;
66016             }
66017         }
66018         return null;
66019     };
66020     /**
66021      * Returns the selected room with its area center point at (<code>x</code>, <code>y</code>).
66022      * @param {number} x
66023      * @param {number} y
66024      * @return {Room}
66025      * @private
66026      */
66027     PlanController.prototype.getRoomAreaAt = function (x, y) {
66028         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66029         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Room) && this.isItemMovable(/* get */ selectedItems[0])) {
66030             var room = selectedItems[0];
66031             var margin = this.getIndicatorMargin();
66032             if (room.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && room.isAreaVisible() && room.isAreaCenterPointAt(x, y, margin)) {
66033                 return room;
66034             }
66035         }
66036         return null;
66037     };
66038     /**
66039      * Returns the selected room with its
66040      * area angle point at (<code>x</code>, <code>y</code>).
66041      * @param {number} x
66042      * @param {number} y
66043      * @return {Room}
66044      * @private
66045      */
66046     PlanController.prototype.getRoomRotatedAreaAt = function (x, y) {
66047         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66048         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Room) && this.isItemMovable(/* get */ selectedItems[0])) {
66049             var room = selectedItems[0];
66050             var margin = this.getIndicatorMargin();
66051             if (room.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && room.isAreaVisible()) {
66052                 var area = room.getArea();
66053                 if (area > 0.01) {
66054                     var areaText = this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getAreaFormatWithUnit().format(area);
66055                     if (this.isTextAnglePointAt(room, areaText, room.getAreaStyle(), room.getXCenter() + room.getAreaXOffset(), room.getYCenter() + room.getAreaYOffset(), room.getAreaAngle(), x, y, margin)) {
66056                         return room;
66057                     }
66058                 }
66059             }
66060         }
66061         return null;
66062     };
66063     /**
66064      * Returns <code>true</code> if the given point can be removed from the <code>room</code>.
66065      * @param {Room} room
66066      * @param {number} x
66067      * @param {number} y
66068      * @return {boolean}
66069      */
66070     PlanController.prototype.isRoomPointDeletableAt = function (room, x, y) {
66071         return this.isItemResizable(room) && room.getPointIndexAt(x, y, this.getIndicatorMargin()) >= 0;
66072     };
66073     /**
66074      * Deletes the point of the selected room at the given coordinates and posts an undoable operation.
66075      * @param {number} x
66076      * @param {number} y
66077      */
66078     PlanController.prototype.deletePointFromSelectedRoom = function (x, y) {
66079         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66080         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Room) && this.isItemResizable(/* get */ selectedItems[0])) {
66081             var room = selectedItems[0];
66082             var index = room.getPointIndexAt(x, y, this.getIndicatorMargin());
66083             if (index >= 0) {
66084                 var points = room.getPoints();
66085                 var point = points[index];
66086                 var xPoint = point[0];
66087                 var yPoint = point[1];
66088                 room.removePoint(index);
66089                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setSelectedItems(/* asList */ [room].slice(0));
66090                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.RoomPointDeletionUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, /* toArray */ selectedItems.slice(0), room, index, xPoint, yPoint));
66091             }
66092         }
66093     };
66094     /**
66095      * Returns <code>true</code> if the <code>room</code> can be recomputed at the given coordinates.
66096      * @param {Room} room
66097      * @param {number} x
66098      * @param {number} y
66099      * @return {boolean}
66100      */
66101     PlanController.prototype.isRoomPointsComputableAt = function (room, x, y) {
66102         if (this.isItemResizable(room) && room.containsPoint(x, y, 0)) {
66103             var roomPoints = this.computeRoomPointsAt(x, y);
66104             return roomPoints != null && !(JSON.stringify(room.getPoints()) === JSON.stringify(roomPoints));
66105         }
66106         return false;
66107     };
66108     /**
66109      * Controls the recomputation of the points of the selected room at the given coordinates.
66110      * @param {number} x
66111      * @param {number} y
66112      */
66113     PlanController.prototype.recomputeSelectedRoomPoints = function (x, y) {
66114         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66115         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Room) && this.isItemResizable(/* get */ selectedItems[0])) {
66116             var room = selectedItems[0];
66117             var oldPoints = room.getPoints();
66118             var newPoints = this.computeRoomPointsAt(x, y);
66119             if (newPoints != null) {
66120                 room.setPoints(newPoints);
66121                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setSelectedItems(/* asList */ [room].slice(0));
66122                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.RoomPointsModificationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, /* toArray */ selectedItems.slice(0), room, oldPoints, newPoints));
66123             }
66124         }
66125     };
66126     /**
66127      * Adds a point to the selected room at the given coordinates and posts an undoable operation.
66128      * @param {number} x
66129      * @param {number} y
66130      */
66131     PlanController.prototype.addPointToSelectedRoom = function (x, y) {
66132         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66133         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Room) && this.isItemResizable(/* get */ selectedItems[0])) {
66134             var room = selectedItems[0];
66135             var points = room.getPoints();
66136             var closestSegmentIndex = -1;
66137             var smallestDistance = 1.7976931348623157E308;
66138             for (var i = 0; i < points.length; i++) {
66139                 {
66140                     var point = points[i];
66141                     var nextPoint = points[(i + 1) % points.length];
66142                     var distanceToSegment = java.awt.geom.Line2D.ptSegDistSq(point[0], point[1], nextPoint[0], nextPoint[1], x, y);
66143                     if (smallestDistance > distanceToSegment) {
66144                         smallestDistance = distanceToSegment;
66145                         closestSegmentIndex = i;
66146                     }
66147                 }
66148                 ;
66149             }
66150             var index = closestSegmentIndex + 1;
66151             room.addPoint$float$float$int(x, y, index);
66152             this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setSelectedItems(/* asList */ [room].slice(0));
66153             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.RoomPointAdditionUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, /* toArray */ selectedItems.slice(0), room, index, x, y));
66154         }
66155     };
66156     PlanController.prototype.createDimensionLine$float$float$float$float$float = function (xStart, yStart, xEnd, yEnd, offset) {
66157         var newDimensionLine = new DimensionLine(xStart, yStart, xEnd, yEnd, offset);
66158         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addDimensionLine(newDimensionLine);
66159         return newDimensionLine;
66160     };
66161     /**
66162      * Returns a new dimension instance joining (<code>xStart</code>,
66163      * <code>yStart</code>) and (<code>xEnd</code>, <code>yEnd</code>) points.
66164      * The new dimension line is added to home.
66165      * @param {number} xStart
66166      * @param {number} yStart
66167      * @param {number} xEnd
66168      * @param {number} yEnd
66169      * @param {number} offset
66170      * @return {DimensionLine}
66171      */
66172     PlanController.prototype.createDimensionLine = function (xStart, yStart, xEnd, yEnd, offset) {
66173         if (((typeof xStart === 'number') || xStart === null) && ((typeof yStart === 'number') || yStart === null) && ((typeof xEnd === 'number') || xEnd === null) && ((typeof yEnd === 'number') || yEnd === null) && ((typeof offset === 'number') || offset === null)) {
66174             return this.createDimensionLine$float$float$float$float$float(xStart, yStart, xEnd, yEnd, offset);
66175         }
66176         else if (((typeof xStart === 'number') || xStart === null) && ((typeof yStart === 'number') || yStart === null) && xEnd === undefined && yEnd === undefined && offset === undefined) {
66177             return this.createDimensionLine$float$float(xStart, yStart);
66178         }
66179         else
66180             throw new Error('invalid overload');
66181     };
66182     /**
66183      * Returns the selected dimension line with an end extension line
66184      * at (<code>x</code>, <code>y</code>).
66185      * @param {number} x
66186      * @param {number} y
66187      * @return {DimensionLine}
66188      * @private
66189      */
66190     PlanController.prototype.getResizedDimensionLineStartAt = function (x, y) {
66191         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66192         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof DimensionLine) && this.isItemResizable(/* get */ selectedItems[0])) {
66193             var dimensionLine = selectedItems[0];
66194             var margin = this.getIndicatorMargin();
66195             if (dimensionLine.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && dimensionLine.containsStartExtensionLinetAt(x, y, margin)) {
66196                 return dimensionLine;
66197             }
66198         }
66199         return null;
66200     };
66201     /**
66202      * Returns the selected dimension line with an end extension line
66203      * at (<code>x</code>, <code>y</code>).
66204      * @param {number} x
66205      * @param {number} y
66206      * @return {DimensionLine}
66207      * @private
66208      */
66209     PlanController.prototype.getResizedDimensionLineEndAt = function (x, y) {
66210         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66211         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof DimensionLine) && this.isItemResizable(/* get */ selectedItems[0])) {
66212             var dimensionLine = selectedItems[0];
66213             var margin = this.getIndicatorMargin();
66214             if (dimensionLine.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && dimensionLine.containsEndExtensionLineAt(x, y, margin)) {
66215                 return dimensionLine;
66216             }
66217         }
66218         return null;
66219     };
66220     /**
66221      * Returns the selected dimension line with a point
66222      * at (<code>x</code>, <code>y</code>) at its middle.
66223      * @param {number} x
66224      * @param {number} y
66225      * @return {DimensionLine}
66226      * @private
66227      */
66228     PlanController.prototype.getOffsetDimensionLineAt = function (x, y) {
66229         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66230         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof DimensionLine) && this.isItemResizable(/* get */ selectedItems[0])) {
66231             var dimensionLine = selectedItems[0];
66232             var margin = this.getIndicatorMargin();
66233             if (dimensionLine.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && (dimensionLine.isMiddlePointAt(x, y, margin) || dimensionLine.isTopPointAt(x, y, margin) && !dimensionLine.containsPoint(x, y, 0))) {
66234                 return dimensionLine;
66235             }
66236         }
66237         return null;
66238     };
66239     /**
66240      * Returns the selected piece of furniture with a point
66241      * at (<code>x</code>, <code>y</code>) that can be used to rotate the piece.
66242      * @param {number} x
66243      * @param {number} y
66244      * @return {DimensionLine}
66245      * @private
66246      */
66247     PlanController.prototype.getPitchRotatedDimensionLineAt = function (x, y) {
66248         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66249         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof DimensionLine) && this.isItemMovable(/* get */ selectedItems[0])) {
66250             var dimensionLine = selectedItems[0];
66251             var margin = this.getIndicatorMargin();
66252             if (dimensionLine.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && dimensionLine.isElevationDimensionLine() && dimensionLine.isBottomPointAt(x, y, margin) && !dimensionLine.containsPoint(x, y, 0)) {
66253                 return dimensionLine;
66254             }
66255         }
66256         return null;
66257     };
66258     /**
66259      * Returns the selected piece of furniture with a point
66260      * at (<code>x</code>, <code>y</code>) that can be used to elevate the piece.
66261      * @param {number} x
66262      * @param {number} y
66263      * @return {DimensionLine}
66264      * @private
66265      */
66266     PlanController.prototype.getElevatedDimensionLineAt = function (x, y) {
66267         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66268         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof DimensionLine) && this.isItemMovable(/* get */ selectedItems[0])) {
66269             var dimensionLine = selectedItems[0];
66270             var margin = this.getIndicatorMargin();
66271             if (dimensionLine.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && dimensionLine.isLeftPointAt(x, y, margin) && !dimensionLine.containsPoint(x, y, 0)) {
66272                 return dimensionLine;
66273             }
66274         }
66275         return null;
66276     };
66277     /**
66278      * Returns the selected piece of furniture with a point
66279      * at (<code>x</code>, <code>y</code>) that can be used to resize the height
66280      * of the piece.
66281      * @param {number} x
66282      * @param {number} y
66283      * @return {DimensionLine}
66284      * @private
66285      */
66286     PlanController.prototype.getHeightResizedDimensionLineAt = function (x, y) {
66287         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66288         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof DimensionLine) && this.isItemResizable(/* get */ selectedItems[0])) {
66289             var dimensionLine = selectedItems[0];
66290             var margin = this.getIndicatorMargin();
66291             if (dimensionLine.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && dimensionLine.isRightPointAt(x, y, margin) && !dimensionLine.containsPoint(x, y, 0)) {
66292                 return dimensionLine;
66293             }
66294         }
66295         return null;
66296     };
66297     /**
66298      * Returns a new polyline instance with the given points.
66299      * The new polyline is added to home.
66300      * @param {float[][]} polylinePoints
66301      * @return {Polyline}
66302      */
66303     PlanController.prototype.createPolyline = function (polylinePoints) {
66304         var newPolyline = new Polyline(polylinePoints);
66305         var lengthUnit = this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit();
66306         newPolyline.setThickness(lengthUnit.isMetric() ? 2 : LengthUnit.inchToCentimeter(1));
66307         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addPolyline$com_eteks_sweethome3d_model_Polyline(newPolyline);
66308         return newPolyline;
66309     };
66310     /**
66311      * Returns the selected polyline with a point at (<code>x</code>, <code>y</code>).
66312      * @param {number} x
66313      * @param {number} y
66314      * @return {Polyline}
66315      * @private
66316      */
66317     PlanController.prototype.getResizedPolylineAt = function (x, y) {
66318         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66319         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Polyline) && this.isItemResizable(/* get */ selectedItems[0])) {
66320             var polyline = selectedItems[0];
66321             var margin = this.getIndicatorMargin();
66322             if (polyline.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && polyline.getPointIndexAt(x, y, margin) !== -1) {
66323                 return polyline;
66324             }
66325         }
66326         return null;
66327     };
66328     /**
66329      * Returns the tolerance margin to select an item.
66330      * @return {number}
66331      * @private
66332      */
66333     PlanController.prototype.getSelectionMargin = function () {
66334         var indicatorPixelMagin = PlanController.PIXEL_MARGIN;
66335         if (this.getPointerTypeLastMousePress() === View.PointerType.TOUCH) {
66336             indicatorPixelMagin *= 2;
66337         }
66338         return indicatorPixelMagin / this.getScale();
66339     };
66340     /**
66341      * Returns the selected item at (<code>x</code>, <code>y</code>) point.
66342      * @param {number} x
66343      * @param {number} y
66344      * @return {boolean}
66345      * @private
66346      */
66347     PlanController.prototype.isItemSelectedAt = function (x, y) {
66348         var margin = this.getSelectionMargin();
66349         {
66350             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66351             for (var index = 0; index < array.length; index++) {
66352                 var item = array[index];
66353                 {
66354                     if (item.containsPoint(x, y, margin)) {
66355                         return true;
66356                     }
66357                 }
66358             }
66359         }
66360         return false;
66361     };
66362     PlanController.prototype.getSelectableItemAt$float$float = function (x, y) {
66363         return this.getSelectableItemAt$float$float$boolean(x, y, true);
66364     };
66365     PlanController.prototype.getSelectableItemAt$float$float$boolean = function (x, y, ignoreGroupsFurniture) {
66366         var selectableItems = this.getSelectableItemsAt$float$float$boolean$boolean(x, y, true, ignoreGroupsFurniture);
66367         if ( /* size */selectableItems.length !== 0) {
66368             return /* get */ selectableItems[0];
66369         }
66370         else {
66371             return null;
66372         }
66373     };
66374     /**
66375      * Returns the selectable item at (<code>x</code>, <code>y</code>) point.
66376      * @param {number} x
66377      * @param {number} y
66378      * @param {boolean} ignoreGroupsFurniture
66379      * @return {Object}
66380      * @private
66381      */
66382     PlanController.prototype.getSelectableItemAt = function (x, y, ignoreGroupsFurniture) {
66383         if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof ignoreGroupsFurniture === 'boolean') || ignoreGroupsFurniture === null)) {
66384             return this.getSelectableItemAt$float$float$boolean(x, y, ignoreGroupsFurniture);
66385         }
66386         else if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ignoreGroupsFurniture === undefined) {
66387             return this.getSelectableItemAt$float$float(x, y);
66388         }
66389         else
66390             throw new Error('invalid overload');
66391     };
66392     PlanController.prototype.getSelectableItemsAt$float$float = function (x, y) {
66393         return this.getSelectableItemsAt$float$float$boolean$boolean(x, y, false, true);
66394     };
66395     PlanController.prototype.getSelectableItemsAt$float$float$boolean$boolean = function (x, y, stopAtFirstItem, ignoreGroupsFurniture) {
66396         var items = ([]);
66397         var margin = this.getSelectionMargin();
66398         var textMargin = margin / 2;
66399         var camera = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getObserverCamera();
66400         if (camera != null && camera === this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getCamera() && camera.containsPoint(x, y, margin)) {
66401             /* add */ (items.push(camera) > 0);
66402             if (stopAtFirstItem) {
66403                 return items;
66404             }
66405         }
66406         var basePlanLocked = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked();
66407         var selectedLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
66408         {
66409             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getLabels();
66410             for (var index = 0; index < array.length; index++) {
66411                 var label = array[index];
66412                 {
66413                     if ((!basePlanLocked || !this.isItemPartOfBasePlan(label)) && this.isLevelNullOrViewable(label.getLevel()) && label.isAtLevel(selectedLevel) && (label.containsPoint(x, y, margin) || this.isItemTextAt(label, label.getText(), label.getStyle(), label.getX(), label.getY(), label.getAngle(), x, y, textMargin))) {
66414                         /* add */ (items.push(label) > 0);
66415                         if (stopAtFirstItem) {
66416                             return items;
66417                         }
66418                     }
66419                 }
66420             }
66421         }
66422         {
66423             var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getDimensionLines();
66424             for (var index = 0; index < array.length; index++) {
66425                 var dimensionLine = array[index];
66426                 {
66427                     if ((!basePlanLocked || !this.isItemPartOfBasePlan(dimensionLine)) && this.isLevelNullOrViewable(dimensionLine.getLevel()) && dimensionLine.isAtLevel(selectedLevel) && dimensionLine.containsPoint(x, y, margin)) {
66428                         /* add */ (items.push(dimensionLine) > 0);
66429                         if (stopAtFirstItem) {
66430                             return items;
66431                         }
66432                     }
66433                 }
66434             }
66435         }
66436         var polylines = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getPolylines();
66437         for (var i = polylines.length - 1; i >= 0; i--) {
66438             {
66439                 var polyline = polylines[i];
66440                 if ((!basePlanLocked || !this.isItemPartOfBasePlan(polyline)) && this.isLevelNullOrViewable(polyline.getLevel()) && polyline.isAtLevel(selectedLevel) && polyline.containsPoint(x, y, margin)) {
66441                     /* add */ (items.push(polyline) > 0);
66442                     if (stopAtFirstItem) {
66443                         return items;
66444                     }
66445                 }
66446             }
66447             ;
66448         }
66449         var furniture = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getFurniture();
66450         var foundFurniture = ([]);
66451         var foundPiece = null;
66452         for (var i = furniture.length - 1; i >= 0; i--) {
66453             {
66454                 var piece = furniture[i];
66455                 if ((!basePlanLocked || !this.isItemPartOfBasePlan(piece)) && this.isPieceOfFurnitureVisibleAtSelectedLevel(piece)) {
66456                     if (piece.containsPoint(x, y, margin)) {
66457                         /* add */ (foundFurniture.push(piece) > 0);
66458                         if (foundPiece == null || piece.getGroundElevation() > foundPiece.getGroundElevation()) {
66459                             foundPiece = piece;
66460                         }
66461                     }
66462                     else if (foundPiece == null) {
66463                         var pieceName = piece.getName();
66464                         if (pieceName != null && piece.isNameVisible() && this.isItemTextAt(piece, pieceName, piece.getNameStyle(), piece.getX() + piece.getNameXOffset(), piece.getY() + piece.getNameYOffset(), piece.getNameAngle(), x, y, textMargin)) {
66465                             /* add */ (foundFurniture.push(piece) > 0);
66466                             foundPiece = piece;
66467                         }
66468                     }
66469                 }
66470             }
66471             ;
66472         }
66473         if (foundPiece == null && basePlanLocked) {
66474             {
66475                 var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66476                 for (var index = 0; index < array.length; index++) {
66477                     var item = array[index];
66478                     {
66479                         if (item != null && item instanceof HomePieceOfFurniture) {
66480                             var piece = item;
66481                             if (!this.isItemPartOfBasePlan(piece) && this.isPieceOfFurnitureVisibleAtSelectedLevel(piece) && (piece.containsPoint(x, y, margin) || piece.getName() != null && piece.isNameVisible() && this.isItemTextAt(piece, piece.getName(), piece.getNameStyle(), piece.getX() + piece.getNameXOffset(), piece.getY() + piece.getNameYOffset(), piece.getNameAngle(), x, y, textMargin))) {
66482                                 /* add */ (foundFurniture.push(piece) > 0);
66483                                 foundPiece = piece;
66484                                 if (stopAtFirstItem) {
66485                                     break;
66486                                 }
66487                             }
66488                         }
66489                     }
66490                 }
66491             }
66492         }
66493         if (foundPiece != null && stopAtFirstItem) {
66494             if (!ignoreGroupsFurniture && (foundPiece != null && foundPiece instanceof HomeFurnitureGroup)) {
66495                 var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66496                 if ( /* size */selectedItems.length >= 1) {
66497                     if (( /* size */selectedItems.length === 1 && /* get */ selectedItems[0] === foundPiece) || /* containsAll */ (function (a, r) { for (var i = 0; i < r.length; i++) {
66498                         if (a.indexOf(r[i]) < 0)
66499                             return false;
66500                     } return true; })(foundPiece.getAllFurniture(), selectedItems)) {
66501                         for (var index = 0; index < selectedItems.length; index++) {
66502                             var selectedItem = selectedItems[index];
66503                             {
66504                                 if (selectedItem != null && selectedItem instanceof HomeFurnitureGroup) {
66505                                     var groupFurniture = selectedItem.getFurniture();
66506                                     for (var i = groupFurniture.length - 1; i >= 0; i--) {
66507                                         {
66508                                             var piece = groupFurniture[i];
66509                                             if ((!basePlanLocked || !this.isItemPartOfBasePlan(piece)) && !(selectedItems.indexOf((piece)) >= 0) && piece.containsPoint(x, y, margin)) {
66510                                                 return /* asList */ [piece].slice(0);
66511                                             }
66512                                         }
66513                                         ;
66514                                     }
66515                                 }
66516                             }
66517                         }
66518                         for (var index = 0; index < selectedItems.length; index++) {
66519                             var selectedItem = selectedItems[index];
66520                             {
66521                                 if (selectedItem != null && selectedItem instanceof HomePieceOfFurniture) {
66522                                     var groupFurniture = this.getFurnitureInSameGroup(selectedItem);
66523                                     for (var i = groupFurniture.length - 1; i >= 0; i--) {
66524                                         {
66525                                             var piece = groupFurniture[i];
66526                                             if ((!basePlanLocked || !this.isItemPartOfBasePlan(piece)) && piece.containsPoint(x, y, margin)) {
66527                                                 return /* asList */ [piece].slice(0);
66528                                             }
66529                                         }
66530                                         ;
66531                                     }
66532                                 }
66533                             }
66534                         }
66535                     }
66536                 }
66537             }
66538             return /* asList */ [foundPiece].slice(0);
66539         }
66540         else {
66541             /* sort */ (function (l, c) { if (c.compare)
66542                 l.sort(function (e1, e2) { return c.compare(e1, e2); });
66543             else
66544                 l.sort(c); })(foundFurniture, new PlanController.PlanController$7(this));
66545             /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(items, foundFurniture);
66546             {
66547                 var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getWalls();
66548                 for (var index = 0; index < array.length; index++) {
66549                     var wall = array[index];
66550                     {
66551                         if ((!basePlanLocked || !this.isItemPartOfBasePlan(wall)) && this.isLevelNullOrViewable(wall.getLevel()) && wall.isAtLevel(selectedLevel) && wall.containsPoint$float$float$float(x, y, margin)) {
66552                             /* add */ (items.push(wall) > 0);
66553                             if (stopAtFirstItem) {
66554                                 return items;
66555                             }
66556                         }
66557                     }
66558                 }
66559             }
66560             var rooms = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getRooms();
66561             var foundRoom = null;
66562             for (var i = rooms.length - 1; i >= 0; i--) {
66563                 {
66564                     var room = rooms[i];
66565                     if ((!basePlanLocked || !this.isItemPartOfBasePlan(room)) && this.isLevelNullOrViewable(room.getLevel()) && room.isAtLevel(selectedLevel)) {
66566                         if (room.containsPoint(x, y, margin)) {
66567                             /* add */ (items.push(room) > 0);
66568                             if (foundRoom == null || room.isCeilingVisible() && !foundRoom.isCeilingVisible()) {
66569                                 foundRoom = room;
66570                             }
66571                         }
66572                         else {
66573                             var roomName = room.getName();
66574                             if (roomName != null && this.isItemTextAt(room, roomName, room.getNameStyle(), room.getXCenter() + room.getNameXOffset(), room.getYCenter() + room.getNameYOffset(), room.getNameAngle(), x, y, textMargin)) {
66575                                 /* add */ (items.push(room) > 0);
66576                                 foundRoom = room;
66577                             }
66578                             if (room.isAreaVisible()) {
66579                                 var areaText = this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getAreaFormatWithUnit().format(room.getArea());
66580                                 if (this.isItemTextAt(room, areaText, room.getAreaStyle(), room.getXCenter() + room.getAreaXOffset(), room.getYCenter() + room.getAreaYOffset(), room.getAreaAngle(), x, y, textMargin)) {
66581                                     /* add */ (items.push(room) > 0);
66582                                     foundRoom = room;
66583                                 }
66584                             }
66585                         }
66586                     }
66587                 }
66588                 ;
66589             }
66590             if (foundRoom != null && stopAtFirstItem) {
66591                 return /* asList */ [foundRoom].slice(0);
66592             }
66593             else {
66594                 var compass = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getCompass();
66595                 if ((!basePlanLocked || !this.isItemPartOfBasePlan(compass)) && compass.containsPoint(x, y, textMargin)) {
66596                     /* add */ (items.push(compass) > 0);
66597                 }
66598                 return items;
66599             }
66600         }
66601     };
66602     /**
66603      * Returns the selectable items at (<code>x</code>, <code>y</code>) point.
66604      * @param {number} x
66605      * @param {number} y
66606      * @param {boolean} stopAtFirstItem
66607      * @param {boolean} ignoreGroupsFurniture
66608      * @return {*[]}
66609      * @private
66610      */
66611     PlanController.prototype.getSelectableItemsAt = function (x, y, stopAtFirstItem, ignoreGroupsFurniture) {
66612         if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((typeof stopAtFirstItem === 'boolean') || stopAtFirstItem === null) && ((typeof ignoreGroupsFurniture === 'boolean') || ignoreGroupsFurniture === null)) {
66613             return this.getSelectableItemsAt$float$float$boolean$boolean(x, y, stopAtFirstItem, ignoreGroupsFurniture);
66614         }
66615         else if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && stopAtFirstItem === undefined && ignoreGroupsFurniture === undefined) {
66616             return this.getSelectableItemsAt$float$float(x, y);
66617         }
66618         else
66619             throw new Error('invalid overload');
66620     };
66621     /**
66622      * Returns <code>true</code> if the <code>text</code> of an <code>item</code> displayed
66623      * at the point (<code>xText</code>, <code>yText</code>) contains the point (<code>x</code>, <code>y</code>).
66624      * @param {Object} item
66625      * @param {string} text
66626      * @param {TextStyle} textStyle
66627      * @param {number} xText
66628      * @param {number} yText
66629      * @param {number} textAngle
66630      * @param {number} x
66631      * @param {number} y
66632      * @param {number} textMargin
66633      * @return {boolean}
66634      * @private
66635      */
66636     PlanController.prototype.isItemTextAt = function (item, text, textStyle, xText, yText, textAngle, x, y, textMargin) {
66637         if (textStyle == null) {
66638             textStyle = this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getDefaultTextStyle(item.constructor);
66639         }
66640         var textBounds = this.getView().getTextBounds(text, textStyle, xText, yText, textAngle);
66641         return this.getPath$float_A_A(textBounds).intersects(x - textMargin, y - textMargin, 2 * textMargin, 2 * textMargin);
66642     };
66643     /**
66644      * Returns the items that intersects with the rectangle of (<code>x0</code>,
66645      * <code>y0</code>), (<code>x1</code>, <code>y1</code>) opposite corners.
66646      * @param {number} x0
66647      * @param {number} y0
66648      * @param {number} x1
66649      * @param {number} y1
66650      * @return {*[]}
66651      */
66652     PlanController.prototype.getSelectableItemsIntersectingRectangle = function (x0, y0, x1, y1) {
66653         var items = ([]);
66654         var basePlanLocked = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked();
66655         {
66656             var array = this.getVisibleItemsAtSelectedLevel();
66657             for (var index = 0; index < array.length; index++) {
66658                 var item = array[index];
66659                 {
66660                     if ((!basePlanLocked || !this.isItemPartOfBasePlan(item)) && item.intersectsRectangle(x0, y0, x1, y1)) {
66661                         /* add */ (items.push(item) > 0);
66662                     }
66663                 }
66664             }
66665         }
66666         var camera = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getObserverCamera();
66667         if (camera != null && camera.intersectsRectangle(x0, y0, x1, y1)) {
66668             /* add */ (items.push(camera) > 0);
66669         }
66670         return items;
66671     };
66672     /**
66673      * Returns the selected piece of furniture with a point
66674      * at (<code>x</code>, <code>y</code>) that can be used to rotate the piece.
66675      * @param {number} x
66676      * @param {number} y
66677      * @return {HomePieceOfFurniture}
66678      * @private
66679      */
66680     PlanController.prototype.getRotatedPieceOfFurnitureAt = function (x, y) {
66681         var selectedPiece = this.getSelectedMovablePieceOfFurniture();
66682         if (selectedPiece != null) {
66683             var margin = this.getIndicatorMargin();
66684             if (selectedPiece.isTopLeftPointAt(x, y, margin) && !selectedPiece.containsPoint(x, y, 0)) {
66685                 return selectedPiece;
66686             }
66687         }
66688         return null;
66689     };
66690     /**
66691      * Returns the selected piece of furniture with a point
66692      * at (<code>x</code>, <code>y</code>) that can be used to elevate the piece.
66693      * @param {number} x
66694      * @param {number} y
66695      * @return {HomePieceOfFurniture}
66696      * @private
66697      */
66698     PlanController.prototype.getElevatedPieceOfFurnitureAt = function (x, y) {
66699         var selectedPiece = this.getSelectedMovablePieceOfFurniture();
66700         if (selectedPiece != null) {
66701             var margin = this.getIndicatorMargin();
66702             if (selectedPiece.isTopRightPointAt(x, y, margin) && !selectedPiece.containsPoint(x, y, 0)) {
66703                 return selectedPiece;
66704             }
66705         }
66706         return null;
66707     };
66708     /**
66709      * Returns the selected piece of furniture with a point
66710      * at (<code>x</code>, <code>y</code>) that can be used to resize the height
66711      * of the piece.
66712      * @param {number} x
66713      * @param {number} y
66714      * @return {HomePieceOfFurniture}
66715      * @private
66716      */
66717     PlanController.prototype.getHeightResizedPieceOfFurnitureAt = function (x, y) {
66718         var selectedPiece = this.getSelectedResizablePieceOfFurniture();
66719         if (selectedPiece != null) {
66720             var margin = this.getIndicatorMargin();
66721             if (!selectedPiece.isHorizontallyRotated() && selectedPiece.isBottomLeftPointAt(x, y, margin) && !selectedPiece.containsPoint(x, y, 0)) {
66722                 return selectedPiece;
66723             }
66724         }
66725         return null;
66726     };
66727     /**
66728      * Returns the selected piece of furniture with a point
66729      * at (<code>x</code>, <code>y</code>) that can be used to rotate the piece
66730      * around the pitch axis.
66731      * @param {number} x
66732      * @param {number} y
66733      * @return {HomePieceOfFurniture}
66734      * @private
66735      */
66736     PlanController.prototype.getPitchRotatedPieceOfFurnitureAt = function (x, y) {
66737         var selectedPiece = this.getSelectedMovablePieceOfFurniture();
66738         if (selectedPiece != null && this.getView().isFurnitureSizeInPlanSupported()) {
66739             var margin = this.getIndicatorMargin();
66740             if (selectedPiece.getPitch() !== 0 && selectedPiece.isBottomLeftPointAt(x, y, margin) && !selectedPiece.containsPoint(x, y, 0)) {
66741                 return selectedPiece;
66742             }
66743         }
66744         return null;
66745     };
66746     /**
66747      * Returns the selected piece of furniture with a point
66748      * at (<code>x</code>, <code>y</code>) that can be used to rotate the piece
66749      * around the roll axis.
66750      * @param {number} x
66751      * @param {number} y
66752      * @return {HomePieceOfFurniture}
66753      * @private
66754      */
66755     PlanController.prototype.getRollRotatedPieceOfFurnitureAt = function (x, y) {
66756         var selectedPiece = this.getSelectedMovablePieceOfFurniture();
66757         if (selectedPiece != null && this.getView().isFurnitureSizeInPlanSupported()) {
66758             var margin = this.getIndicatorMargin();
66759             if (selectedPiece.getRoll() !== 0 && selectedPiece.isBottomLeftPointAt(x, y, margin) && !selectedPiece.containsPoint(x, y, 0)) {
66760                 return selectedPiece;
66761             }
66762         }
66763         return null;
66764     };
66765     /**
66766      * Returns the selected piece of furniture with a point
66767      * at (<code>x</code>, <code>y</code>) that can be used to resize
66768      * the width and the depth of the piece.
66769      * @param {number} x
66770      * @param {number} y
66771      * @return {HomePieceOfFurniture}
66772      * @private
66773      */
66774     PlanController.prototype.getWidthAndDepthResizedPieceOfFurnitureAt = function (x, y) {
66775         var selectedPiece = this.getSelectedResizablePieceOfFurniture();
66776         if (selectedPiece != null) {
66777             var margin = this.getIndicatorMargin();
66778             if (selectedPiece.isBottomRightPointAt(x, y, margin) && !selectedPiece.containsPoint(x, y, 0)) {
66779                 return selectedPiece;
66780             }
66781         }
66782         return null;
66783     };
66784     /**
66785      * Returns the selected item if selection contains one selected movable piece of furniture.
66786      * @return {HomePieceOfFurniture}
66787      * @private
66788      */
66789     PlanController.prototype.getSelectedMovablePieceOfFurniture = function () {
66790         var selectedPiece = this.getSelectedPieceOfFurniture();
66791         if (selectedPiece != null && this.isItemMovable(selectedPiece)) {
66792             return selectedPiece;
66793         }
66794         return null;
66795     };
66796     /**
66797      * Returns the selected item if selection contains one selected resizable piece of furniture.
66798      * @return {HomePieceOfFurniture}
66799      * @private
66800      */
66801     PlanController.prototype.getSelectedResizablePieceOfFurniture = function () {
66802         var selectedPiece = this.getSelectedPieceOfFurniture();
66803         if (selectedPiece != null && selectedPiece.isResizable() && this.isItemResizable(selectedPiece)) {
66804             return selectedPiece;
66805         }
66806         return null;
66807     };
66808     /**
66809      * Returns the selected item if selection contains one selected piece of furniture.
66810      * @return {HomePieceOfFurniture}
66811      * @private
66812      */
66813     PlanController.prototype.getSelectedPieceOfFurniture = function () {
66814         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66815         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof HomePieceOfFurniture)) {
66816             var piece = selectedItems[0];
66817             if (this.isPieceOfFurnitureVisibleAtSelectedLevel(piece)) {
66818                 return piece;
66819             }
66820         }
66821         return null;
66822     };
66823     /**
66824      * Returns the selected light with a point at (<code>x</code>, <code>y</code>)
66825      * that can be used to resize the power of the light.
66826      * @param {number} x
66827      * @param {number} y
66828      * @return {HomeLight}
66829      * @private
66830      */
66831     PlanController.prototype.getModifiedLightPowerAt = function (x, y) {
66832         var selectedPiece = this.getSelectedPieceOfFurniture();
66833         if (selectedPiece != null && selectedPiece instanceof HomeLight) {
66834             var margin = this.getIndicatorMargin();
66835             if (selectedPiece.isBottomLeftPointAt(x, y, margin) && !selectedPiece.containsPoint(x, y, 0)) {
66836                 return selectedPiece;
66837             }
66838         }
66839         return null;
66840     };
66841     /**
66842      * Returns the selected piece of furniture with its
66843      * name center point at (<code>x</code>, <code>y</code>).
66844      * @param {number} x
66845      * @param {number} y
66846      * @return {HomePieceOfFurniture}
66847      * @private
66848      */
66849     PlanController.prototype.getPieceOfFurnitureNameAt = function (x, y) {
66850         var selectedPiece = this.getSelectedMovablePieceOfFurniture();
66851         if (selectedPiece != null) {
66852             var margin = this.getIndicatorMargin();
66853             if (selectedPiece.isNameVisible() && selectedPiece.getName().trim().length > 0 && selectedPiece.isNameCenterPointAt(x, y, margin)) {
66854                 return selectedPiece;
66855             }
66856         }
66857         return null;
66858     };
66859     /**
66860      * Returns the selected piece of furniture with its
66861      * name angle point at (<code>x</code>, <code>y</code>).
66862      * @param {number} x
66863      * @param {number} y
66864      * @return {HomePieceOfFurniture}
66865      * @private
66866      */
66867     PlanController.prototype.getPieceOfFurnitureRotatedNameAt = function (x, y) {
66868         var selectedPiece = this.getSelectedMovablePieceOfFurniture();
66869         if (selectedPiece != null) {
66870             var margin = this.getIndicatorMargin();
66871             if (selectedPiece.isNameVisible() && selectedPiece.getName().trim().length > 0 && this.isTextAnglePointAt(selectedPiece, selectedPiece.getName(), selectedPiece.getNameStyle(), selectedPiece.getX() + selectedPiece.getNameXOffset(), selectedPiece.getY() + selectedPiece.getNameYOffset(), selectedPiece.getNameAngle(), x, y, margin)) {
66872                 return selectedPiece;
66873             }
66874         }
66875         return null;
66876     };
66877     /**
66878      * Returns <code>true</code> if the angle indicator of the <code>text</code> of an <code>item</code> displayed
66879      * at the point (<code>xText</code>, <code>yText</code>) is equal to the point (<code>x</code>, <code>y</code>).
66880      * @param {Object} item
66881      * @param {string} text
66882      * @param {TextStyle} textStyle
66883      * @param {number} xText
66884      * @param {number} yText
66885      * @param {number} textAngle
66886      * @param {number} x
66887      * @param {number} y
66888      * @param {number} margin
66889      * @return {boolean}
66890      * @private
66891      */
66892     PlanController.prototype.isTextAnglePointAt = function (item, text, textStyle, xText, yText, textAngle, x, y, margin) {
66893         if (textStyle == null) {
66894             textStyle = this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getDefaultTextStyle(item.constructor);
66895         }
66896         var textBounds = this.getView().getTextBounds(text, textStyle, xText, yText, textAngle);
66897         var anglePointX;
66898         var anglePointY;
66899         if (textStyle.getAlignment() === TextStyle.Alignment.LEFT) {
66900             anglePointX = textBounds[0][0];
66901             anglePointY = textBounds[0][1];
66902         }
66903         else if (textStyle.getAlignment() === TextStyle.Alignment.RIGHT) {
66904             anglePointX = textBounds[1][0];
66905             anglePointY = textBounds[1][1];
66906         }
66907         else {
66908             anglePointX = (textBounds[0][0] + textBounds[1][0]) / 2;
66909             anglePointY = (textBounds[0][1] + textBounds[1][1]) / 2;
66910         }
66911         return Math.abs(x - anglePointX) <= margin && Math.abs(y - anglePointY) <= margin;
66912     };
66913     /**
66914      * Returns the selected label with its angle point at (<code>x</code>, <code>y</code>).
66915      * @param {number} x
66916      * @param {number} y
66917      * @return {Label}
66918      * @private
66919      */
66920     PlanController.prototype.getRotatedLabelAt = function (x, y) {
66921         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66922         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Label) && this.isItemMovable(/* get */ selectedItems[0])) {
66923             var label = selectedItems[0];
66924             var margin = this.getIndicatorMargin();
66925             if (label.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && this.isTextAnglePointAt(label, label.getText(), label.getStyle(), label.getX(), label.getY(), label.getAngle(), x, y, margin)) {
66926                 return label;
66927             }
66928         }
66929         return null;
66930     };
66931     /**
66932      * Returns the selected label with its elevation point at (<code>x</code>, <code>y</code>).
66933      * @param {number} x
66934      * @param {number} y
66935      * @return {Label}
66936      * @private
66937      */
66938     PlanController.prototype.getElevatedLabelAt = function (x, y) {
66939         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66940         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Label)) {
66941             var label = selectedItems[0];
66942             if (label.getPitch() != null && this.isItemMovable(label)) {
66943                 var margin = this.getIndicatorMargin();
66944                 if (label.isAtLevel(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel())) {
66945                     var style = label.getStyle();
66946                     if (style == null) {
66947                         style = this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getDefaultTextStyle(label.constructor);
66948                     }
66949                     var textBounds = this.getView().getTextBounds(label.getText(), this.getItemTextStyle(label, label.getStyle()), label.getX(), label.getY(), label.getAngle());
66950                     var pointX = void 0;
66951                     var pointY = void 0;
66952                     if (style.getAlignment() === TextStyle.Alignment.LEFT) {
66953                         pointX = textBounds[3][0];
66954                         pointY = textBounds[3][1];
66955                     }
66956                     else if (style.getAlignment() === TextStyle.Alignment.RIGHT) {
66957                         pointX = textBounds[2][0];
66958                         pointY = textBounds[2][1];
66959                     }
66960                     else {
66961                         pointX = (textBounds[2][0] + textBounds[3][0]) / 2;
66962                         pointY = (textBounds[2][1] + textBounds[3][1]) / 2;
66963                     }
66964                     if (Math.abs(x - pointX) <= margin && Math.abs(y - pointY) <= margin) {
66965                         return label;
66966                     }
66967                 }
66968             }
66969         }
66970         return null;
66971     };
66972     /**
66973      * Returns the selected camera with a point at (<code>x</code>, <code>y</code>)
66974      * that can be used to change the camera yaw angle.
66975      * @param {number} x
66976      * @param {number} y
66977      * @return {Camera}
66978      * @private
66979      */
66980     PlanController.prototype.getYawRotatedCameraAt = function (x, y) {
66981         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
66982         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Camera) && this.isItemResizable(/* get */ selectedItems[0])) {
66983             var camera = selectedItems[0];
66984             var margin = this.getIndicatorMargin();
66985             var cameraPoints = camera.getPoints();
66986             var xMiddleFirstAndLastPoint = (cameraPoints[0][0] + cameraPoints[3][0]) / 2;
66987             var yMiddleFirstAndLastPoint = (cameraPoints[0][1] + cameraPoints[3][1]) / 2;
66988             if (Math.abs(x - xMiddleFirstAndLastPoint) <= margin && Math.abs(y - yMiddleFirstAndLastPoint) <= margin && !camera.containsPoint(x, y, 0)) {
66989                 return camera;
66990             }
66991         }
66992         return null;
66993     };
66994     /**
66995      * Returns the selected camera with a point at (<code>x</code>, <code>y</code>)
66996      * that can be used to change the camera pitch angle.
66997      * @param {number} x
66998      * @param {number} y
66999      * @return {Camera}
67000      * @private
67001      */
67002     PlanController.prototype.getPitchRotatedCameraAt = function (x, y) {
67003         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
67004         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Camera) && this.isItemResizable(/* get */ selectedItems[0])) {
67005             var camera = selectedItems[0];
67006             var margin = this.getIndicatorMargin();
67007             var cameraPoints = camera.getPoints();
67008             var xMiddleFirstAndLastPoint = (cameraPoints[1][0] + cameraPoints[2][0]) / 2;
67009             var yMiddleFirstAndLastPoint = (cameraPoints[1][1] + cameraPoints[2][1]) / 2;
67010             if (Math.abs(x - xMiddleFirstAndLastPoint) <= margin && Math.abs(y - yMiddleFirstAndLastPoint) <= margin && !camera.containsPoint(x, y, 0)) {
67011                 return camera;
67012             }
67013         }
67014         return null;
67015     };
67016     /**
67017      * Returns the selected camera with a point at (<code>x</code>, <code>y</code>)
67018      * that can be used to change the camera elevation.
67019      * @param {number} x
67020      * @param {number} y
67021      * @return {Camera}
67022      * @private
67023      */
67024     PlanController.prototype.getElevatedCameraAt = function (x, y) {
67025         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
67026         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Camera) && this.isItemResizable(/* get */ selectedItems[0])) {
67027             var camera = selectedItems[0];
67028             var margin = this.getIndicatorMargin();
67029             var cameraPoints = camera.getPoints();
67030             var xMiddleFirstAndSecondPoint = (cameraPoints[0][0] + cameraPoints[1][0]) / 2;
67031             var yMiddleFirstAndSecondPoint = (cameraPoints[0][1] + cameraPoints[1][1]) / 2;
67032             if (Math.abs(x - xMiddleFirstAndSecondPoint) <= margin && Math.abs(y - yMiddleFirstAndSecondPoint) <= margin && !camera.containsPoint(x, y, 0)) {
67033                 return camera;
67034             }
67035         }
67036         return null;
67037     };
67038     /**
67039      * Returns the selected compass with a point
67040      * at (<code>x</code>, <code>y</code>) that can be used to rotate it.
67041      * @param {number} x
67042      * @param {number} y
67043      * @return {Compass}
67044      * @private
67045      */
67046     PlanController.prototype.getRotatedCompassAt = function (x, y) {
67047         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
67048         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Compass) && this.isItemMovable(/* get */ selectedItems[0])) {
67049             var compass = selectedItems[0];
67050             var margin = this.getIndicatorMargin();
67051             var compassPoints = compass.getPoints();
67052             var xMiddleThirdAndFourthPoint = (compassPoints[2][0] + compassPoints[3][0]) / 2;
67053             var yMiddleThirdAndFourthPoint = (compassPoints[2][1] + compassPoints[3][1]) / 2;
67054             if (Math.abs(x - xMiddleThirdAndFourthPoint) <= margin && Math.abs(y - yMiddleThirdAndFourthPoint) <= margin && !compass.containsPoint(x, y, 0)) {
67055                 return compass;
67056             }
67057         }
67058         return null;
67059     };
67060     /**
67061      * Returns the selected compass with a point
67062      * at (<code>x</code>, <code>y</code>) that can be used to resize it.
67063      * @param {number} x
67064      * @param {number} y
67065      * @return {Compass}
67066      * @private
67067      */
67068     PlanController.prototype.getResizedCompassAt = function (x, y) {
67069         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
67070         if ( /* size */selectedItems.length === 1 && ( /* get */selectedItems[0] != null && /* get */ selectedItems[0] instanceof Compass) && this.isItemMovable(/* get */ selectedItems[0])) {
67071             var compass = selectedItems[0];
67072             var margin = this.getIndicatorMargin();
67073             var compassPoints = compass.getPoints();
67074             var xMiddleSecondAndThirdPoint = (compassPoints[1][0] + compassPoints[2][0]) / 2;
67075             var yMiddleSecondAndThirdPoint = (compassPoints[1][1] + compassPoints[2][1]) / 2;
67076             if (Math.abs(x - xMiddleSecondAndThirdPoint) <= margin && Math.abs(y - yMiddleSecondAndThirdPoint) <= margin && !compass.containsPoint(x, y, 0)) {
67077                 return compass;
67078             }
67079         }
67080         return null;
67081     };
67082     /**
67083      * Deletes <code>items</code> in plan and record it as an undoable operation.
67084      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items
67085      */
67086     PlanController.prototype.deleteItems = function (items) {
67087         var deletedItems = ([]);
67088         for (var index = 0; index < items.length; index++) {
67089             var item = items[index];
67090             {
67091                 if (this.isItemDeletable(item)) {
67092                     /* add */ (deletedItems.push(item) > 0);
67093                 }
67094             }
67095         }
67096         if (!(deletedItems.length == 0)) {
67097             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.beginUpdate();
67098             this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.removeSelectionListener(this.selectionListener);
67099             var allLevelsSelection = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection();
67100             var selectedItems = (items.slice(0));
67101             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.ItemsDeletionStartUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_home, allLevelsSelection, /* toArray */ selectedItems.slice(0)));
67102             this.deleteFurniture(Home.getFurnitureSubList(deletedItems));
67103             var deletedOtherItems = (Home.getWallsSubList(deletedItems).slice(0));
67104             /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(deletedOtherItems, Home.getRoomsSubList(deletedItems));
67105             /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(deletedOtherItems, Home.getDimensionLinesSubList(deletedItems));
67106             /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(deletedOtherItems, Home.getPolylinesSubList(deletedItems));
67107             /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(deletedOtherItems, Home.getLabelsSubList(deletedItems));
67108             this.postDeleteItems(deletedOtherItems, this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked(), this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection());
67109             this.doDeleteItems(deletedOtherItems);
67110             this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addSelectionListener(this.selectionListener);
67111             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.ItemsDeletionEndUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_home));
67112             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.endUpdate();
67113         }
67114     };
67115     /**
67116      * Posts an undoable delete items operation about <code>deletedItems</code>.
67117      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} deletedItems
67118      * @param {boolean} basePlanLocked
67119      * @param {boolean} allLevelsSelection
67120      * @private
67121      */
67122     PlanController.prototype.postDeleteItems = function (deletedItems, basePlanLocked, allLevelsSelection) {
67123         var deletedWalls = Home.getWallsSubList(deletedItems);
67124         var joinedDeletedWalls = PlanController.JoinedWall.getJoinedWalls(deletedWalls);
67125         var deletedRooms = Home.getRoomsSubList(deletedItems);
67126         var homeRooms = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getRooms();
67127         var sortedMap = ({});
67128         for (var index = 0; index < deletedRooms.length; index++) {
67129             var room = deletedRooms[index];
67130             {
67131                 /* put */ (function (m, k, v) { if (m.entries == null)
67132                     m.entries = []; for (var i = 0; i < m.entries.length; i++)
67133                     if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
67134                         var pv = m.entries[i].value;
67135                         m.entries[i].value = v;
67136                         return pv;
67137                     } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); m.entries.sort(function (e1, e2) { return (e1.key.compareTo != null) ? e1.key.compareTo(e2) : (e1.key - e2.key); }); return null; })(sortedMap, homeRooms.indexOf(room), room);
67138             }
67139         }
67140         var rooms = (function (a1, a2) { if (a1.length >= a2.length) {
67141             a1.length = 0;
67142             a1.push.apply(a1, a2);
67143             return a1;
67144         }
67145         else {
67146             return a2.slice(0);
67147         } })((function (s) { var a = []; while (s-- > 0)
67148             a.push(null); return a; })(/* size */ (function (m) { if (m.entries == null)
67149             m.entries = []; return m.entries.length; })(sortedMap)), /* values */ (function (m) { var r = []; if (m.entries == null)
67150             m.entries = []; for (var i_15 = 0; i_15 < m.entries.length; i_15++)
67151             r.push(m.entries[i_15].value); return r; })(sortedMap));
67152         var roomsIndices = (function (s) { var a = []; while (s-- > 0)
67153             a.push(0); return a; })(rooms.length);
67154         var roomsLevels = (function (s) { var a = []; while (s-- > 0)
67155             a.push(null); return a; })(rooms.length);
67156         var i = 0;
67157         {
67158             var array = /* keySet */ (function (m) { var r = []; if (m.entries == null)
67159                 m.entries = []; for (var i_16 = 0; i_16 < m.entries.length; i_16++)
67160                 r.push(m.entries[i_16].key); return r; })(sortedMap);
67161             for (var loopIndex = 0; loopIndex < array.length; loopIndex++) {
67162                 var index = array[loopIndex];
67163                 {
67164                     roomsIndices[i] = index;
67165                     roomsLevels[i] = rooms[i].getLevel();
67166                     i++;
67167                 }
67168             }
67169         }
67170         var deletedDimensionLines = Home.getDimensionLinesSubList(deletedItems);
67171         var dimensionLines = deletedDimensionLines.slice(0);
67172         var dimensionLinesLevels = (function (s) { var a = []; while (s-- > 0)
67173             a.push(null); return a; })(dimensionLines.length);
67174         for (i = 0; i < dimensionLines.length; i++) {
67175             {
67176                 dimensionLinesLevels[i] = dimensionLines[i].getLevel();
67177             }
67178             ;
67179         }
67180         var deletedPolylines = Home.getPolylinesSubList(deletedItems);
67181         var homePolylines = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getPolylines();
67182         var sortedPolylinesMap = ({});
67183         for (var index = 0; index < deletedPolylines.length; index++) {
67184             var polyline = deletedPolylines[index];
67185             {
67186                 /* put */ (function (m, k, v) { if (m.entries == null)
67187                     m.entries = []; for (var i = 0; i < m.entries.length; i++)
67188                     if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
67189                         var pv = m.entries[i].value;
67190                         m.entries[i].value = v;
67191                         return pv;
67192                     } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); m.entries.sort(function (e1, e2) { return (e1.key.compareTo != null) ? e1.key.compareTo(e2) : (e1.key - e2.key); }); return null; })(sortedPolylinesMap, homePolylines.indexOf(polyline), polyline);
67193             }
67194         }
67195         var polylines = (function (a1, a2) { if (a1.length >= a2.length) {
67196             a1.length = 0;
67197             a1.push.apply(a1, a2);
67198             return a1;
67199         }
67200         else {
67201             return a2.slice(0);
67202         } })((function (s) { var a = []; while (s-- > 0)
67203             a.push(null); return a; })(/* size */ (function (m) { if (m.entries == null)
67204             m.entries = []; return m.entries.length; })(sortedPolylinesMap)), /* values */ (function (m) { var r = []; if (m.entries == null)
67205             m.entries = []; for (var i_17 = 0; i_17 < m.entries.length; i_17++)
67206             r.push(m.entries[i_17].value); return r; })(sortedPolylinesMap));
67207         var polylinesIndices = (function (s) { var a = []; while (s-- > 0)
67208             a.push(0); return a; })(polylines.length);
67209         var polylinesLevels = (function (s) { var a = []; while (s-- > 0)
67210             a.push(null); return a; })(polylines.length);
67211         i = 0;
67212         {
67213             var array = /* keySet */ (function (m) { var r = []; if (m.entries == null)
67214                 m.entries = []; for (var i_18 = 0; i_18 < m.entries.length; i_18++)
67215                 r.push(m.entries[i_18].key); return r; })(sortedPolylinesMap);
67216             for (var loopIndex = 0; loopIndex < array.length; loopIndex++) {
67217                 var index = array[loopIndex];
67218                 {
67219                     polylinesIndices[i] = index;
67220                     polylinesLevels[i] = polylines[i].getLevel();
67221                     i++;
67222                 }
67223             }
67224         }
67225         var deletedLabels = Home.getLabelsSubList(deletedItems);
67226         var labels = deletedLabels.slice(0);
67227         var labelsLevels = (function (s) { var a = []; while (s-- > 0)
67228             a.push(null); return a; })(labels.length);
67229         for (i = 0; i < labels.length; i++) {
67230             {
67231                 labelsLevels[i] = labels[i].getLevel();
67232             }
67233             ;
67234         }
67235         this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.ItemsDeletionUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, basePlanLocked, allLevelsSelection, /* toArray */ deletedItems.slice(0), joinedDeletedWalls, rooms, roomsIndices, roomsLevels, dimensionLines, dimensionLinesLevels, polylines, polylinesIndices, polylinesLevels, labels, labelsLevels));
67236     };
67237     /**
67238      * Deletes <code>items</code> from home.
67239      * @param {*[]} items
67240      * @private
67241      */
67242     PlanController.prototype.doDeleteItems = function (items) {
67243         var basePlanLocked = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked();
67244         for (var index = 0; index < items.length; index++) {
67245             var item = items[index];
67246             {
67247                 if (item != null && item instanceof Wall) {
67248                     this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deleteWall(item);
67249                 }
67250                 else if (item != null && item instanceof DimensionLine) {
67251                     this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deleteDimensionLine(item);
67252                 }
67253                 else if (item != null && item instanceof Room) {
67254                     this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deleteRoom(item);
67255                 }
67256                 else if (item != null && item instanceof Polyline) {
67257                     this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deletePolyline(item);
67258                 }
67259                 else if (item != null && item instanceof Label) {
67260                     this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deleteLabel(item);
67261                 }
67262                 else if (item != null && item instanceof HomePieceOfFurniture) {
67263                     this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deletePieceOfFurniture(item);
67264                 }
67265                 basePlanLocked = !this.isItemPartOfBasePlan(item) && basePlanLocked;
67266             }
67267         }
67268         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(basePlanLocked);
67269         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setAllLevelsSelection(false);
67270     };
67271     /**
67272      * Moves and shows selected items in plan component of (<code>dx</code>,
67273      * <code>dy</code>) units and record it as undoable operation.
67274      * @param {number} dx
67275      * @param {number} dy
67276      * @private
67277      */
67278     PlanController.prototype.moveAndShowSelectedItems = function (dx, dy) {
67279         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
67280         var movedItems = ([]);
67281         for (var index = 0; index < selectedItems.length; index++) {
67282             var item = selectedItems[index];
67283             {
67284                 if (this.isItemMovable(item)) {
67285                     /* add */ (movedItems.push(item) > 0);
67286                 }
67287             }
67288         }
67289         if (!(movedItems.length == 0)) {
67290             this.moveItems(movedItems, dx, dy);
67291             this.selectAndShowItems$java_util_List$boolean(movedItems, this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection());
67292             if ( /* size */movedItems.length !== 1 || !( /* get */movedItems[0] != null && /* get */ movedItems[0] instanceof Camera)) {
67293                 this.postItemsMove(movedItems, selectedItems, dx, dy);
67294             }
67295         }
67296     };
67297     /**
67298      * Moves <code>items</code> of (<code>dx</code>, <code>dy</code>) units.
67299      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items
67300      * @param {number} dx
67301      * @param {number} dy
67302      */
67303     PlanController.prototype.moveItems = function (items, dx, dy) {
67304         for (var index = 0; index < items.length; index++) {
67305             var item = items[index];
67306             {
67307                 if (item != null && item instanceof Wall) {
67308                     var wall = item;
67309                     wall.removePropertyChangeListener(this.wallChangeListener);
67310                     PlanController.moveWallStartPoint(wall, wall.getXStart() + dx, wall.getYStart() + dy, !(items.indexOf((wall.getWallAtStart())) >= 0));
67311                     PlanController.moveWallEndPoint(wall, wall.getXEnd() + dx, wall.getYEnd() + dy, !(items.indexOf((wall.getWallAtEnd())) >= 0));
67312                     this.resetAreaCache();
67313                     wall.addPropertyChangeListener(this.wallChangeListener);
67314                 }
67315                 else {
67316                     var boundToWall = false;
67317                     if (item != null && item instanceof HomeDoorOrWindow) {
67318                         boundToWall = item.isBoundToWall();
67319                     }
67320                     item.move(dx, dy);
67321                     if (boundToWall) {
67322                         var itemArea = new java.awt.geom.Area(this.getPath$float_A_A(item.getPoints()));
67323                         itemArea.intersect(this.getWallsArea(true));
67324                         item.setBoundToWall(!itemArea.isEmpty());
67325                     }
67326                 }
67327             }
67328         }
67329     };
67330     /**
67331      * Moves <code>wall</code> start point to (<code>xStart</code>, <code>yStart</code>)
67332      * and the wall point joined to its start point if <code>moveWallAtStart</code> is true.
67333      * @param {Wall} wall
67334      * @param {number} xStart
67335      * @param {number} yStart
67336      * @param {boolean} moveWallAtStart
67337      * @private
67338      */
67339     PlanController.moveWallStartPoint = function (wall, xStart, yStart, moveWallAtStart) {
67340         var oldXStart = wall.getXStart();
67341         var oldYStart = wall.getYStart();
67342         wall.setXStart(xStart);
67343         wall.setYStart(yStart);
67344         var wallAtStart = wall.getWallAtStart();
67345         if (wallAtStart != null && moveWallAtStart) {
67346             if (wallAtStart.getWallAtStart() === wall && (wallAtStart.getWallAtEnd() !== wall || (wallAtStart.getXStart() === oldXStart && wallAtStart.getYStart() === oldYStart))) {
67347                 wallAtStart.setXStart(xStart);
67348                 wallAtStart.setYStart(yStart);
67349             }
67350             else if (wallAtStart.getWallAtEnd() === wall && (wallAtStart.getWallAtStart() !== wall || (wallAtStart.getXEnd() === oldXStart && wallAtStart.getYEnd() === oldYStart))) {
67351                 wallAtStart.setXEnd(xStart);
67352                 wallAtStart.setYEnd(yStart);
67353             }
67354         }
67355     };
67356     /**
67357      * Moves <code>wall</code> end point to (<code>xEnd</code>, <code>yEnd</code>)
67358      * and the wall point joined to its end if <code>moveWallAtEnd</code> is true.
67359      * @param {Wall} wall
67360      * @param {number} xEnd
67361      * @param {number} yEnd
67362      * @param {boolean} moveWallAtEnd
67363      * @private
67364      */
67365     PlanController.moveWallEndPoint = function (wall, xEnd, yEnd, moveWallAtEnd) {
67366         var oldXEnd = wall.getXEnd();
67367         var oldYEnd = wall.getYEnd();
67368         wall.setXEnd(xEnd);
67369         wall.setYEnd(yEnd);
67370         var wallAtEnd = wall.getWallAtEnd();
67371         if (wallAtEnd != null && moveWallAtEnd) {
67372             if (wallAtEnd.getWallAtStart() === wall && (wallAtEnd.getWallAtEnd() !== wall || (wallAtEnd.getXStart() === oldXEnd && wallAtEnd.getYStart() === oldYEnd))) {
67373                 wallAtEnd.setXStart(xEnd);
67374                 wallAtEnd.setYStart(yEnd);
67375             }
67376             else if (wallAtEnd.getWallAtEnd() === wall && (wallAtEnd.getWallAtStart() !== wall || (wallAtEnd.getXEnd() === oldXEnd && wallAtEnd.getYEnd() === oldYEnd))) {
67377                 wallAtEnd.setXEnd(xEnd);
67378                 wallAtEnd.setYEnd(yEnd);
67379             }
67380         }
67381     };
67382     /**
67383      * Moves <code>wall</code> start point to (<code>x</code>, <code>y</code>)
67384      * if <code>editingStartPoint</code> is true or <code>wall</code> end point
67385      * to (<code>x</code>, <code>y</code>) if <code>editingStartPoint</code> is false.
67386      * @param {Wall} wall
67387      * @param {number} x
67388      * @param {number} y
67389      * @param {boolean} startPoint
67390      * @private
67391      */
67392     PlanController.moveWallPoint = function (wall, x, y, startPoint) {
67393         if (startPoint) {
67394             PlanController.moveWallStartPoint(wall, x, y, true);
67395         }
67396         else {
67397             PlanController.moveWallEndPoint(wall, x, y, true);
67398         }
67399     };
67400     /**
67401      * Moves <code>room</code> point at the given index to (<code>x</code>, <code>y</code>).
67402      * @param {Room} room
67403      * @param {number} x
67404      * @param {number} y
67405      * @param {number} pointIndex
67406      * @private
67407      */
67408     PlanController.moveRoomPoint = function (room, x, y, pointIndex) {
67409         room.setPoint(x, y, pointIndex);
67410     };
67411     /**
67412      * Moves <code>dimensionLine</code> start point to (<code>x</code>, <code>y</code>)
67413      * if <code>editingStartPoint</code> is true or <code>dimensionLine</code> end point
67414      * to (<code>x</code>, <code>y</code>) if <code>editingStartPoint</code> is false.
67415      * @param {DimensionLine} dimensionLine
67416      * @param {number} x
67417      * @param {number} y
67418      * @param {boolean} startPoint
67419      * @private
67420      */
67421     PlanController.moveDimensionLinePoint = function (dimensionLine, x, y, startPoint) {
67422         if (startPoint) {
67423             dimensionLine.setXStart(x);
67424             dimensionLine.setYStart(y);
67425         }
67426         else {
67427             dimensionLine.setXEnd(x);
67428             dimensionLine.setYEnd(y);
67429         }
67430     };
67431     /**
67432      * Swaps start and end points of the given dimension line.
67433      * @param {DimensionLine} dimensionLine
67434      * @private
67435      */
67436     PlanController.reverseDimensionLine = function (dimensionLine) {
67437         var swappedX = dimensionLine.getXStart();
67438         var swappedY = dimensionLine.getYStart();
67439         dimensionLine.setXStart(dimensionLine.getXEnd());
67440         dimensionLine.setYStart(dimensionLine.getYEnd());
67441         dimensionLine.setXEnd(swappedX);
67442         dimensionLine.setYEnd(swappedY);
67443         dimensionLine.setOffset(-dimensionLine.getOffset());
67444     };
67445     PlanController.prototype.selectAndShowItems$java_util_List = function (items) {
67446         this.selectAndShowItems$java_util_List$boolean(items, false);
67447     };
67448     PlanController.prototype.selectAndShowItems$java_util_List$boolean = function (items, allLevelsSelection) {
67449         this.selectItems$java_util_List$boolean(items, allLevelsSelection);
67450         this.selectLevelFromSelectedItems();
67451         this.getView().makeSelectionVisible();
67452     };
67453     /**
67454      * Selects <code>items</code> and make them visible at screen.
67455      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items
67456      * @param {boolean} allLevelsSelection
67457      * @private
67458      */
67459     PlanController.prototype.selectAndShowItems = function (items, allLevelsSelection) {
67460         if (((items != null && (items instanceof Array)) || items === null) && ((typeof allLevelsSelection === 'boolean') || allLevelsSelection === null)) {
67461             return this.selectAndShowItems$java_util_List$boolean(items, allLevelsSelection);
67462         }
67463         else if (((items != null && (items instanceof Array)) || items === null) && allLevelsSelection === undefined) {
67464             return this.selectAndShowItems$java_util_List(items);
67465         }
67466         else
67467             throw new Error('invalid overload');
67468     };
67469     PlanController.prototype.selectItems$java_util_List = function (items) {
67470         this.selectItems$java_util_List$boolean(items, false);
67471     };
67472     PlanController.prototype.selectItems$java_util_List$boolean = function (items, allLevelsSelection) {
67473         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.removeSelectionListener(this.selectionListener);
67474         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setSelectedItems(items);
67475         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addSelectionListener(this.selectionListener);
67476         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setAllLevelsSelection(allLevelsSelection);
67477     };
67478     /**
67479      * Selects <code>items</code>.
67480      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items
67481      * @param {boolean} allLevelsSelection
67482      * @private
67483      */
67484     PlanController.prototype.selectItems = function (items, allLevelsSelection) {
67485         if (((items != null && (items instanceof Array)) || items === null) && ((typeof allLevelsSelection === 'boolean') || allLevelsSelection === null)) {
67486             return this.selectItems$java_util_List$boolean(items, allLevelsSelection);
67487         }
67488         else if (((items != null && (items instanceof Array)) || items === null) && allLevelsSelection === undefined) {
67489             return this.selectItems$java_util_List(items);
67490         }
67491         else
67492             throw new Error('invalid overload');
67493     };
67494     /**
67495      * Selects the given <code>item</code>.
67496      * @param {Object} item
67497      */
67498     PlanController.prototype.selectItem = function (item) {
67499         this.selectItems$java_util_List(/* asList */ [item].slice(0));
67500     };
67501     /**
67502      * Toggles the selection of the given <code>item</code>.
67503      * @param {Object} item
67504      */
67505     PlanController.prototype.toggleItemSelection = function (item) {
67506         var selectedItems = (this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems().slice(0));
67507         if ( /* contains */(selectedItems.indexOf((item)) >= 0)) {
67508             /* remove */ (function (a) { var index = a.indexOf(item); if (index >= 0) {
67509                 a.splice(index, 1);
67510                 return true;
67511             }
67512             else {
67513                 return false;
67514             } })(selectedItems);
67515         }
67516         else {
67517             /* add */ (selectedItems.push(item) > 0);
67518         }
67519         this.selectItems$java_util_List$boolean(selectedItems, this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection());
67520     };
67521     /**
67522      * Deselects all walls in plan.
67523      * @private
67524      */
67525     PlanController.prototype.deselectAll = function () {
67526         var emptyList = [];
67527         this.selectItems$java_util_List(emptyList);
67528     };
67529     /**
67530      * Adds <code>items</code> to home and post an undoable operation.
67531      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} items
67532      */
67533     PlanController.prototype.addItems = function (items) {
67534         this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.beginUpdate();
67535         this.addFurniture$java_util_List(Home.getFurnitureSubList(items));
67536         this.addWalls(Home.getWallsSubList(items));
67537         this.addRooms(Home.getRoomsSubList(items));
67538         this.addPolylines(Home.getPolylinesSubList(items));
67539         this.addDimensionLines(Home.getDimensionLinesSubList(items));
67540         this.addLabels(Home.getLabelsSubList(items));
67541         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setSelectedItems(items);
67542         this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.ItemsAdditionEndUndoableEdit(this.__com_eteks_sweethome3d_viewcontroller_PlanController_home, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, /* toArray */ items.slice(0)));
67543         this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.endUpdate();
67544     };
67545     PlanController.prototype.addFurniture = function (furniture, furnitureLevels, group, beforePiece) {
67546         if (((furniture != null && (furniture instanceof Array)) || furniture === null) && ((furnitureLevels != null && furnitureLevels instanceof Array && (furnitureLevels.length == 0 || furnitureLevels[0] == null || (furnitureLevels[0] != null && furnitureLevels[0] instanceof Level))) || furnitureLevels === null) && ((group != null && group instanceof HomeFurnitureGroup) || group === null) && ((beforePiece != null && beforePiece instanceof HomePieceOfFurniture) || beforePiece === null)) {
67547             _super.prototype.addFurniture.call(this, furniture, furnitureLevels, group, beforePiece);
67548         }
67549         else if (((furniture != null && (furniture instanceof Array)) || furniture === null) && ((furnitureLevels != null && furnitureLevels instanceof HomePieceOfFurniture) || furnitureLevels === null) && group === undefined && beforePiece === undefined) {
67550             return this.addFurniture$java_util_List$com_eteks_sweethome3d_model_HomePieceOfFurniture(furniture, furnitureLevels);
67551         }
67552         else if (((furniture != null && (furniture instanceof Array)) || furniture === null) && furnitureLevels === undefined && group === undefined && beforePiece === undefined) {
67553             return this.addFurniture$java_util_List(furniture);
67554         }
67555         else
67556             throw new Error('invalid overload');
67557     };
67558     PlanController.prototype.addFurniture$java_util_List = function (furniture) {
67559         _super.prototype.addFurniture$java_util_List.call(this, furniture);
67560         if (this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) {
67561             var wallsArea = this.getWallsArea(false);
67562             for (var index = 0; index < furniture.length; index++) {
67563                 var piece = furniture[index];
67564                 {
67565                     if (piece != null && piece instanceof HomeDoorOrWindow) {
67566                         var piecePoints = piece.getPoints();
67567                         var pieceAreaIntersection = new java.awt.geom.Area(this.getPath$float_A_A(piecePoints));
67568                         pieceAreaIntersection.intersect(wallsArea);
67569                         if (!pieceAreaIntersection.isEmpty() && new Room(piecePoints).getArea() / this.getArea(pieceAreaIntersection) > 0.999) {
67570                             piece.setBoundToWall(true);
67571                         }
67572                     }
67573                 }
67574             }
67575         }
67576     };
67577     /**
67578      * Adds <code>walls</code> to home and post an undoable new wall operation.
67579      * @param {Wall[]} walls
67580      */
67581     PlanController.prototype.addWalls = function (walls) {
67582         for (var index = 0; index < walls.length; index++) {
67583             var wall = walls[index];
67584             {
67585                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addWall(wall);
67586             }
67587         }
67588         this.postCreateWalls(walls, this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems(), this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked(), this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection());
67589     };
67590     /**
67591      * Posts an undoable new wall operation, about <code>newWalls</code>.
67592      * @param {Wall[]} newWalls
67593      * @param {*[]} oldSelectedItems
67594      * @param {boolean} oldBasePlanLocked
67595      * @param {boolean} oldAllLevelsSelection
67596      * @private
67597      */
67598     PlanController.prototype.postCreateWalls = function (newWalls, oldSelectedItems, oldBasePlanLocked, oldAllLevelsSelection) {
67599         if ( /* size */newWalls.length > 0) {
67600             var basePlanLocked = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked();
67601             if (basePlanLocked) {
67602                 for (var index = 0; index < newWalls.length; index++) {
67603                     var wall = newWalls[index];
67604                     {
67605                         basePlanLocked = !this.isItemPartOfBasePlan(wall) && basePlanLocked;
67606                     }
67607                 }
67608                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(basePlanLocked);
67609             }
67610             var newBasePlanLocked = basePlanLocked;
67611             var joinedNewWalls = PlanController.JoinedWall.getJoinedWalls(newWalls);
67612             var oldSelection = oldSelectedItems.slice(0);
67613             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.WallsCreationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldSelection, oldBasePlanLocked, oldAllLevelsSelection, joinedNewWalls, newBasePlanLocked));
67614         }
67615     };
67616     /**
67617      * Adds the walls in <code>joinedWalls</code> to plan component, joins
67618      * them to other walls if necessary.
67619      * @param {com.eteks.sweethome3d.viewcontroller.PlanController.JoinedWall[]} joinedWalls
67620      * @param {boolean} basePlanLocked
67621      * @private
67622      */
67623     PlanController.prototype.doAddWalls = function (joinedWalls, basePlanLocked) {
67624         for (var index = 0; index < joinedWalls.length; index++) {
67625             var joinedNewWall = joinedWalls[index];
67626             {
67627                 var wall = joinedNewWall.getWall();
67628                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addWall(wall);
67629                 wall.setLevel(joinedNewWall.getLevel());
67630             }
67631         }
67632         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(basePlanLocked);
67633         for (var index = 0; index < joinedWalls.length; index++) {
67634             var joinedNewWall = joinedWalls[index];
67635             {
67636                 var wall = joinedNewWall.getWall();
67637                 var wallAtStart = joinedNewWall.getWallAtStart();
67638                 if (wallAtStart != null) {
67639                     wall.setWallAtStart(wallAtStart);
67640                     if (joinedNewWall.isJoinedAtEndOfWallAtStart()) {
67641                         wallAtStart.setWallAtEnd(wall);
67642                     }
67643                     else {
67644                         wallAtStart.setWallAtStart(wall);
67645                     }
67646                 }
67647                 var wallAtEnd = joinedNewWall.getWallAtEnd();
67648                 if (wallAtEnd != null) {
67649                     wall.setWallAtEnd(wallAtEnd);
67650                     if (joinedNewWall.isJoinedAtStartOfWallAtEnd()) {
67651                         wallAtEnd.setWallAtStart(wall);
67652                     }
67653                     else {
67654                         wallAtEnd.setWallAtEnd(wall);
67655                     }
67656                 }
67657             }
67658         }
67659     };
67660     /**
67661      * Deletes walls referenced in <code>joinedDeletedWalls</code>.
67662      * @param {com.eteks.sweethome3d.viewcontroller.PlanController.JoinedWall[]} joinedDeletedWalls
67663      * @param {boolean} basePlanLocked
67664      * @private
67665      */
67666     PlanController.prototype.doDeleteWalls = function (joinedDeletedWalls, basePlanLocked) {
67667         for (var index = 0; index < joinedDeletedWalls.length; index++) {
67668             var joinedWall = joinedDeletedWalls[index];
67669             {
67670                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deleteWall(joinedWall.getWall());
67671             }
67672         }
67673         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(basePlanLocked);
67674     };
67675     /**
67676      * Add <code>newRooms</code> to home and post an undoable new room line operation.
67677      * @param {Room[]} rooms
67678      */
67679     PlanController.prototype.addRooms = function (rooms) {
67680         var newRooms = rooms.slice(0);
67681         var roomsIndex = (function (s) { var a = []; while (s-- > 0)
67682             a.push(0); return a; })(/* size */ rooms.length);
67683         var endIndex = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getRooms().length;
67684         for (var i = 0; i < roomsIndex.length; i++) {
67685             {
67686                 roomsIndex[i] = endIndex++;
67687                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addRoom$com_eteks_sweethome3d_model_Room$int(newRooms[i], roomsIndex[i]);
67688             }
67689             ;
67690         }
67691         this.postCreateRooms$com_eteks_sweethome3d_model_Room_A$int_A$java_util_List$boolean$boolean(newRooms, roomsIndex, this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems(), this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked(), this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection());
67692     };
67693     PlanController.prototype.postCreateRooms$com_eteks_sweethome3d_model_Room_A$int_A$java_util_List$boolean$boolean = function (newRooms, roomsIndex, oldSelectedItems, oldBasePlanLocked, oldAllLevelsSelection) {
67694         if (newRooms.length > 0) {
67695             var basePlanLocked = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked();
67696             if (basePlanLocked) {
67697                 for (var index = 0; index < newRooms.length; index++) {
67698                     var room = newRooms[index];
67699                     {
67700                         basePlanLocked = !this.isItemPartOfBasePlan(room) && basePlanLocked;
67701                     }
67702                 }
67703                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(basePlanLocked);
67704             }
67705             var newBasePlanLocked = basePlanLocked;
67706             var oldSelection = oldSelectedItems.slice(0);
67707             var roomsLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
67708             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.RoomsCreationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldSelection, oldBasePlanLocked, oldAllLevelsSelection, newRooms, roomsIndex, roomsLevel, newBasePlanLocked));
67709         }
67710     };
67711     /**
67712      * Posts an undoable new room operation, about <code>newRooms</code>.
67713      * @param {com.eteks.sweethome3d.model.Room[]} newRooms
67714      * @param {int[]} roomsIndex
67715      * @param {*[]} oldSelectedItems
67716      * @param {boolean} oldBasePlanLocked
67717      * @param {boolean} oldAllLevelsSelection
67718      * @private
67719      */
67720     PlanController.prototype.postCreateRooms = function (newRooms, roomsIndex, oldSelectedItems, oldBasePlanLocked, oldAllLevelsSelection) {
67721         if (((newRooms != null && newRooms instanceof Array && (newRooms.length == 0 || newRooms[0] == null || (newRooms[0] != null && newRooms[0] instanceof Room))) || newRooms === null) && ((roomsIndex != null && roomsIndex instanceof Array && (roomsIndex.length == 0 || roomsIndex[0] == null || (typeof roomsIndex[0] === 'number'))) || roomsIndex === null) && ((oldSelectedItems != null && (oldSelectedItems instanceof Array)) || oldSelectedItems === null) && ((typeof oldBasePlanLocked === 'boolean') || oldBasePlanLocked === null) && ((typeof oldAllLevelsSelection === 'boolean') || oldAllLevelsSelection === null)) {
67722             return this.postCreateRooms$com_eteks_sweethome3d_model_Room_A$int_A$java_util_List$boolean$boolean(newRooms, roomsIndex, oldSelectedItems, oldBasePlanLocked, oldAllLevelsSelection);
67723         }
67724         else if (((newRooms != null && (newRooms instanceof Array)) || newRooms === null) && ((roomsIndex != null && (roomsIndex instanceof Array)) || roomsIndex === null) && ((typeof oldSelectedItems === 'boolean') || oldSelectedItems === null) && ((typeof oldBasePlanLocked === 'boolean') || oldBasePlanLocked === null) && oldAllLevelsSelection === undefined) {
67725             return this.postCreateRooms$java_util_List$java_util_List$boolean$boolean(newRooms, roomsIndex, oldSelectedItems, oldBasePlanLocked);
67726         }
67727         else
67728             throw new Error('invalid overload');
67729     };
67730     PlanController.prototype.postCreateRooms$java_util_List$java_util_List$boolean$boolean = function (rooms, oldSelection, basePlanLocked, allLevelsSelection) {
67731         var newRooms = rooms.slice(0);
67732         var roomsIndex = (function (s) { var a = []; while (s-- > 0)
67733             a.push(0); return a; })(/* size */ rooms.length);
67734         var homeRooms = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getRooms();
67735         for (var i = 0; i < roomsIndex.length; i++) {
67736             {
67737                 roomsIndex[i] = homeRooms.lastIndexOf(newRooms[i]);
67738             }
67739             ;
67740         }
67741         this.postCreateRooms$com_eteks_sweethome3d_model_Room_A$int_A$java_util_List$boolean$boolean(newRooms, roomsIndex, oldSelection, basePlanLocked, allLevelsSelection);
67742     };
67743     /**
67744      * Adds the <code>rooms</code> to plan component.
67745      * @param {com.eteks.sweethome3d.model.Room[]} rooms
67746      * @param {int[]} roomsIndices
67747      * @param {com.eteks.sweethome3d.model.Level[]} roomsLevels
67748      * @param {Level} uniqueRoomsLevel
67749      * @param {boolean} basePlanLocked
67750      * @private
67751      */
67752     PlanController.prototype.doAddRooms = function (rooms, roomsIndices, roomsLevels, uniqueRoomsLevel, basePlanLocked) {
67753         for (var i = 0; i < roomsIndices.length; i++) {
67754             {
67755                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addRoom$com_eteks_sweethome3d_model_Room$int(rooms[i], roomsIndices[i]);
67756                 rooms[i].setLevel(roomsLevels != null ? roomsLevels[i] : uniqueRoomsLevel);
67757             }
67758             ;
67759         }
67760         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(basePlanLocked);
67761     };
67762     /**
67763      * Deletes <code>rooms</code>.
67764      * @param {com.eteks.sweethome3d.model.Room[]} rooms
67765      * @param {boolean} basePlanLocked
67766      * @private
67767      */
67768     PlanController.prototype.doDeleteRooms = function (rooms, basePlanLocked) {
67769         for (var index = 0; index < rooms.length; index++) {
67770             var room = rooms[index];
67771             {
67772                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deleteRoom(room);
67773             }
67774         }
67775         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(basePlanLocked);
67776     };
67777     /**
67778      * Add <code>dimensionLines</code> to home and post an undoable new dimension line operation.
67779      * @param {DimensionLine[]} dimensionLines
67780      */
67781     PlanController.prototype.addDimensionLines = function (dimensionLines) {
67782         for (var index = 0; index < dimensionLines.length; index++) {
67783             var dimensionLine = dimensionLines[index];
67784             {
67785                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addDimensionLine(dimensionLine);
67786             }
67787         }
67788         this.postCreateDimensionLines(dimensionLines, this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems(), this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked(), this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection());
67789     };
67790     /**
67791      * Posts an undoable new dimension line operation, about <code>newDimensionLines</code>.
67792      * @param {DimensionLine[]} newDimensionLines
67793      * @param {*[]} oldSelectedItems
67794      * @param {boolean} oldBasePlanLocked
67795      * @param {boolean} oldAllLevelsSelection
67796      * @private
67797      */
67798     PlanController.prototype.postCreateDimensionLines = function (newDimensionLines, oldSelectedItems, oldBasePlanLocked, oldAllLevelsSelection) {
67799         if ( /* size */newDimensionLines.length > 0) {
67800             var basePlanLocked = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked();
67801             if (basePlanLocked) {
67802                 for (var index = 0; index < newDimensionLines.length; index++) {
67803                     var dimensionLine = newDimensionLines[index];
67804                     {
67805                         basePlanLocked = !this.isItemPartOfBasePlan(dimensionLine) && basePlanLocked;
67806                     }
67807                 }
67808                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(basePlanLocked);
67809             }
67810             var newBasePlanLocked = basePlanLocked;
67811             var dimensionLines = newDimensionLines.slice(0);
67812             var oldSelection = oldSelectedItems.slice(0);
67813             var dimensionLinesLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
67814             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.DimensionLinesCreationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldSelection, oldBasePlanLocked, oldAllLevelsSelection, dimensionLines, dimensionLinesLevel, newBasePlanLocked));
67815         }
67816     };
67817     /**
67818      * Adds the dimension lines in <code>dimensionLines</code> to plan component.
67819      * @param {com.eteks.sweethome3d.model.DimensionLine[]} dimensionLines
67820      * @param {com.eteks.sweethome3d.model.Level[]} dimensionLinesLevels
67821      * @param {Level} uniqueDimensionLinesLevel
67822      * @param {boolean} basePlanLocked
67823      * @private
67824      */
67825     PlanController.prototype.doAddDimensionLines = function (dimensionLines, dimensionLinesLevels, uniqueDimensionLinesLevel, basePlanLocked) {
67826         for (var i = 0; i < dimensionLines.length; i++) {
67827             {
67828                 var dimensionLine = dimensionLines[i];
67829                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addDimensionLine(dimensionLine);
67830                 dimensionLine.setLevel(dimensionLinesLevels != null ? dimensionLinesLevels[i] : uniqueDimensionLinesLevel);
67831             }
67832             ;
67833         }
67834         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(basePlanLocked);
67835     };
67836     /**
67837      * Deletes dimension lines in <code>dimensionLines</code>.
67838      * @param {com.eteks.sweethome3d.model.DimensionLine[]} dimensionLines
67839      * @param {boolean} basePlanLocked
67840      * @private
67841      */
67842     PlanController.prototype.doDeleteDimensionLines = function (dimensionLines, basePlanLocked) {
67843         for (var index = 0; index < dimensionLines.length; index++) {
67844             var dimensionLine = dimensionLines[index];
67845             {
67846                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deleteDimensionLine(dimensionLine);
67847             }
67848         }
67849         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(basePlanLocked);
67850     };
67851     /**
67852      * Adds <code>polylines</code> to home and posts an undoable new polyline line operation.
67853      * @param {Polyline[]} polylines
67854      */
67855     PlanController.prototype.addPolylines = function (polylines) {
67856         var newPolylines = polylines.slice(0);
67857         var polylinesIndex = (function (s) { var a = []; while (s-- > 0)
67858             a.push(0); return a; })(/* size */ polylines.length);
67859         var endIndex = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getPolylines().length;
67860         for (var i = 0; i < polylinesIndex.length; i++) {
67861             {
67862                 polylinesIndex[i] = endIndex++;
67863                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addPolyline$com_eteks_sweethome3d_model_Polyline$int(newPolylines[i], polylinesIndex[i]);
67864             }
67865             ;
67866         }
67867         this.postCreatePolylines$com_eteks_sweethome3d_model_Polyline_A$int_A$java_util_List$boolean$boolean(newPolylines, polylinesIndex, this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems(), this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked(), this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection());
67868     };
67869     PlanController.prototype.postCreatePolylines$com_eteks_sweethome3d_model_Polyline_A$int_A$java_util_List$boolean$boolean = function (newPolylines, polylinesIndex, oldSelectedItems, oldBasePlanLocked, oldAllLevelsSelection) {
67870         if (newPolylines.length > 0) {
67871             var basePlanLocked = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked();
67872             if (basePlanLocked) {
67873                 for (var index = 0; index < newPolylines.length; index++) {
67874                     var polyline = newPolylines[index];
67875                     {
67876                         basePlanLocked = !this.isItemPartOfBasePlan(polyline) && basePlanLocked;
67877                     }
67878                 }
67879                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(basePlanLocked);
67880             }
67881             var newBasePlanLocked = basePlanLocked;
67882             var oldSelection = oldSelectedItems.slice(0);
67883             var polylinesLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
67884             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.PolylinesCreationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldSelection, oldBasePlanLocked, oldAllLevelsSelection, newPolylines, polylinesIndex, polylinesLevel, newBasePlanLocked));
67885         }
67886     };
67887     /**
67888      * Posts an undoable new polyline operation about <code>newPolylines</code>.
67889      * @param {com.eteks.sweethome3d.model.Polyline[]} newPolylines
67890      * @param {int[]} polylinesIndex
67891      * @param {*[]} oldSelectedItems
67892      * @param {boolean} oldBasePlanLocked
67893      * @param {boolean} oldAllLevelsSelection
67894      * @private
67895      */
67896     PlanController.prototype.postCreatePolylines = function (newPolylines, polylinesIndex, oldSelectedItems, oldBasePlanLocked, oldAllLevelsSelection) {
67897         if (((newPolylines != null && newPolylines instanceof Array && (newPolylines.length == 0 || newPolylines[0] == null || (newPolylines[0] != null && newPolylines[0] instanceof Polyline))) || newPolylines === null) && ((polylinesIndex != null && polylinesIndex instanceof Array && (polylinesIndex.length == 0 || polylinesIndex[0] == null || (typeof polylinesIndex[0] === 'number'))) || polylinesIndex === null) && ((oldSelectedItems != null && (oldSelectedItems instanceof Array)) || oldSelectedItems === null) && ((typeof oldBasePlanLocked === 'boolean') || oldBasePlanLocked === null) && ((typeof oldAllLevelsSelection === 'boolean') || oldAllLevelsSelection === null)) {
67898             return this.postCreatePolylines$com_eteks_sweethome3d_model_Polyline_A$int_A$java_util_List$boolean$boolean(newPolylines, polylinesIndex, oldSelectedItems, oldBasePlanLocked, oldAllLevelsSelection);
67899         }
67900         else if (((newPolylines != null && (newPolylines instanceof Array)) || newPolylines === null) && ((polylinesIndex != null && (polylinesIndex instanceof Array)) || polylinesIndex === null) && ((typeof oldSelectedItems === 'boolean') || oldSelectedItems === null) && ((typeof oldBasePlanLocked === 'boolean') || oldBasePlanLocked === null) && oldAllLevelsSelection === undefined) {
67901             return this.postCreatePolylines$java_util_List$java_util_List$boolean$boolean(newPolylines, polylinesIndex, oldSelectedItems, oldBasePlanLocked);
67902         }
67903         else
67904             throw new Error('invalid overload');
67905     };
67906     PlanController.prototype.postCreatePolylines$java_util_List$java_util_List$boolean$boolean = function (polylines, oldSelection, basePlanLocked, allLevelsSelection) {
67907         var newPolylines = polylines.slice(0);
67908         var polylinesIndex = (function (s) { var a = []; while (s-- > 0)
67909             a.push(0); return a; })(/* size */ polylines.length);
67910         var homePolylines = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getPolylines();
67911         for (var i = 0; i < polylinesIndex.length; i++) {
67912             {
67913                 polylinesIndex[i] = homePolylines.lastIndexOf(newPolylines[i]);
67914             }
67915             ;
67916         }
67917         this.postCreatePolylines$com_eteks_sweethome3d_model_Polyline_A$int_A$java_util_List$boolean$boolean(newPolylines, polylinesIndex, oldSelection, basePlanLocked, allLevelsSelection);
67918     };
67919     /**
67920      * Adds the <code>polylines</code> to plan component.
67921      * @param {com.eteks.sweethome3d.model.Polyline[]} polylines
67922      * @param {int[]} polylinesIndex
67923      * @param {com.eteks.sweethome3d.model.Level[]} polylinesLevels
67924      * @param {Level} uniqueDimensionLinesLevel
67925      * @param {boolean} basePlanLocked
67926      * @private
67927      */
67928     PlanController.prototype.doAddPolylines = function (polylines, polylinesIndex, polylinesLevels, uniqueDimensionLinesLevel, basePlanLocked) {
67929         for (var i = 0; i < polylinesIndex.length; i++) {
67930             {
67931                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addPolyline$com_eteks_sweethome3d_model_Polyline$int(polylines[i], polylinesIndex[i]);
67932                 polylines[i].setLevel(polylinesLevels != null ? polylinesLevels[i] : uniqueDimensionLinesLevel);
67933             }
67934             ;
67935         }
67936         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(basePlanLocked);
67937     };
67938     /**
67939      * Deletes <code>polylines</code>.
67940      * @param {com.eteks.sweethome3d.model.Polyline[]} polylines
67941      * @param {boolean} basePlanLocked
67942      * @private
67943      */
67944     PlanController.prototype.doDeletePolylines = function (polylines, basePlanLocked) {
67945         for (var index = 0; index < polylines.length; index++) {
67946             var polyline = polylines[index];
67947             {
67948                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deletePolyline(polyline);
67949             }
67950         }
67951         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(basePlanLocked);
67952     };
67953     /**
67954      * Add <code>labels</code> to home and post an undoable new label operation.
67955      * @param {Label[]} labels
67956      */
67957     PlanController.prototype.addLabels = function (labels) {
67958         for (var index = 0; index < labels.length; index++) {
67959             var label = labels[index];
67960             {
67961                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addLabel(label);
67962             }
67963         }
67964         this.postCreateLabels(labels, this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems(), this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked(), this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection());
67965     };
67966     /**
67967      * Posts an undoable new label operation, about <code>newLabels</code>.
67968      * @param {Label[]} newLabels
67969      * @param {*[]} oldSelectedItems
67970      * @param {boolean} oldBasePlanLocked
67971      * @param {boolean} oldAllLevelsSelection
67972      * @private
67973      */
67974     PlanController.prototype.postCreateLabels = function (newLabels, oldSelectedItems, oldBasePlanLocked, oldAllLevelsSelection) {
67975         if ( /* size */newLabels.length > 0) {
67976             var basePlanLocked = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked();
67977             if (basePlanLocked) {
67978                 for (var index = 0; index < newLabels.length; index++) {
67979                     var label = newLabels[index];
67980                     {
67981                         basePlanLocked = !this.isItemPartOfBasePlan(label) && basePlanLocked;
67982                     }
67983                 }
67984                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(basePlanLocked);
67985             }
67986             var newBasePlanLocked = basePlanLocked;
67987             var labels = newLabels.slice(0);
67988             var oldSelection = oldSelectedItems.slice(0);
67989             var labelsLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
67990             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.LabelsCreationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldSelection, oldBasePlanLocked, oldAllLevelsSelection, labels, labelsLevel, newBasePlanLocked));
67991         }
67992     };
67993     /**
67994      * Adds the labels in <code>labels</code> to plan component.
67995      * @param {com.eteks.sweethome3d.model.Label[]} labels
67996      * @param {com.eteks.sweethome3d.model.Level[]} labelsLevels
67997      * @param {Level} uniqueLabelLevel
67998      * @param {boolean} basePlanLocked
67999      * @private
68000      */
68001     PlanController.prototype.doAddLabels = function (labels, labelsLevels, uniqueLabelLevel, basePlanLocked) {
68002         for (var i = 0; i < labels.length; i++) {
68003             {
68004                 var label = labels[i];
68005                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addLabel(label);
68006                 label.setLevel(labelsLevels != null ? labelsLevels[i] : uniqueLabelLevel);
68007             }
68008             ;
68009         }
68010         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(basePlanLocked);
68011     };
68012     /**
68013      * Deletes labels in <code>labels</code>.
68014      * @param {com.eteks.sweethome3d.model.Label[]} labels
68015      * @param {boolean} basePlanLocked
68016      * @private
68017      */
68018     PlanController.prototype.doDeleteLabels = function (labels, basePlanLocked) {
68019         for (var index = 0; index < labels.length; index++) {
68020             var label = labels[index];
68021             {
68022                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deleteLabel(label);
68023             }
68024         }
68025         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setBasePlanLocked(basePlanLocked);
68026     };
68027     /**
68028      * Posts an undoable operation about <code>label</code> angle change.
68029      * @param {Label} label
68030      * @param {number} oldAngle
68031      * @private
68032      */
68033     PlanController.prototype.postLabelRotation = function (label, oldAngle) {
68034         var newAngle = label.getAngle();
68035         if (newAngle !== oldAngle) {
68036             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.LabelRotationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldAngle, label, newAngle));
68037         }
68038     };
68039     /**
68040      * Post to undo support an elevation change on <code>label</code>.
68041      * @param {Label} label
68042      * @param {number} oldElevation
68043      * @private
68044      */
68045     PlanController.prototype.postLabelElevation = function (label, oldElevation) {
68046         var newElevation = label.getElevation();
68047         if (newElevation !== oldElevation) {
68048             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.LabelElevationModificationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldElevation, label, newElevation));
68049         }
68050     };
68051     /**
68052      * Posts an undoable operation of a (<code>dx</code>, <code>dy</code>) move
68053      * of <code>movedItems</code>.
68054      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} movedItems
68055      * @param {? extends com.eteks.sweethome3d.model.Selectable[]} oldSelectedItems
68056      * @param {number} dx
68057      * @param {number} dy
68058      * @private
68059      */
68060     PlanController.prototype.postItemsMove = function (movedItems, oldSelectedItems, dx, dy) {
68061         if (dx !== 0 || dy !== 0) {
68062             var itemsArray = movedItems.slice(0);
68063             var allLevelsSelection = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection();
68064             var oldSelection = oldSelectedItems.slice(0);
68065             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.ItemsMovingUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldSelection, allLevelsSelection, itemsArray, dx, dy));
68066         }
68067     };
68068     /**
68069      * Moves <code>movedItems</code> of (<code>dx</code>, <code>dy</code>) pixels,
68070      * selects them and make them visible.
68071      * @param {com.eteks.sweethome3d.model.Selectable[]} movedItems
68072      * @param {com.eteks.sweethome3d.model.Selectable[]} selectedItems
68073      * @param {number} dx
68074      * @param {number} dy
68075      * @param {boolean} allLevelsSelection
68076      * @private
68077      */
68078     PlanController.prototype.doMoveAndShowItems = function (movedItems, selectedItems, dx, dy, allLevelsSelection) {
68079         this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.setAllLevelsSelection(allLevelsSelection);
68080         this.moveItems(/* asList */ movedItems.slice(0), dx, dy);
68081         this.selectAndShowItems$java_util_List$boolean(/* asList */ selectedItems.slice(0), allLevelsSelection);
68082     };
68083     /**
68084      * Posts an undoable operation of a (<code>dx</code>, <code>dy</code>) move
68085      * of the given <code>piece</code>.
68086      * @param {HomePieceOfFurniture} piece
68087      * @param {number} dx
68088      * @param {number} dy
68089      * @param {number} oldAngle
68090      * @param {number} oldDepth
68091      * @param {number} oldElevation
68092      * @param {boolean} oldDoorOrWindowBoundToWall
68093      * @private
68094      */
68095     PlanController.prototype.postPieceOfFurnitureMove = function (piece, dx, dy, oldAngle, oldDepth, oldElevation, oldDoorOrWindowBoundToWall) {
68096         var newAngle = piece.getAngle();
68097         var newDepth = piece.getDepth();
68098         var newElevation = piece.getElevation();
68099         if (dx !== 0 || dy !== 0 || newAngle !== oldAngle || newDepth !== oldDepth || newElevation !== oldElevation) {
68100             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.PieceOfFurnitureMovingUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldAngle, oldDepth, oldElevation, oldDoorOrWindowBoundToWall, piece, dx, dy, newAngle, newDepth, newElevation));
68101         }
68102     };
68103     /**
68104      * Posts an undoable operation about duplication <code>items</code>.
68105      * @param {*[]} items
68106      * @param {*[]} oldSelection
68107      * @private
68108      */
68109     PlanController.prototype.postItemsDuplication = function (items, oldSelection) {
68110         var basePlanLocked = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked();
68111         var allLevelsSelection = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection();
68112         var furniture = Home.getFurnitureSubList(items);
68113         for (var index = 0; index < furniture.length; index++) {
68114             var piece = furniture[index];
68115             {
68116                 this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deletePieceOfFurniture(piece);
68117             }
68118         }
68119         this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.beginUpdate();
68120         this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.DuplicationStartUndoableEdit(this, /* toArray */ oldSelection.slice(0), allLevelsSelection));
68121         this.addFurniture$java_util_List(furniture);
68122         var emptyList = [];
68123         this.postCreateWalls(Home.getWallsSubList(items), emptyList, basePlanLocked, allLevelsSelection);
68124         this.postCreateRooms$java_util_List$java_util_List$boolean$boolean(Home.getRoomsSubList(items), emptyList, basePlanLocked, allLevelsSelection);
68125         this.postCreatePolylines$java_util_List$java_util_List$boolean$boolean(Home.getPolylinesSubList(items), emptyList, basePlanLocked, allLevelsSelection);
68126         this.postCreateDimensionLines(Home.getDimensionLinesSubList(items), emptyList, basePlanLocked, allLevelsSelection);
68127         this.postCreateLabels(Home.getLabelsSubList(items), emptyList, basePlanLocked, allLevelsSelection);
68128         this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.DuplicationEndUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, /* toArray */ items.slice(0)));
68129         this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.endUpdate();
68130         this.selectItems$java_util_List(items);
68131     };
68132     /**
68133      * Posts an undoable operation about <code>wall</code> resizing.
68134      * @param {Wall} wall
68135      * @param {number} oldX
68136      * @param {number} oldY
68137      * @param {boolean} startPoint
68138      * @private
68139      */
68140     PlanController.prototype.postWallResize = function (wall, oldX, oldY, startPoint) {
68141         var newX;
68142         var newY;
68143         if (startPoint) {
68144             newX = wall.getXStart();
68145             newY = wall.getYStart();
68146         }
68147         else {
68148             newX = wall.getXEnd();
68149             newY = wall.getYEnd();
68150         }
68151         if (newX !== oldX || newY !== oldY) {
68152             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.WallResizingUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldX, oldY, wall, startPoint, newX, newY));
68153         }
68154     };
68155     /**
68156      * Posts an undoable operation about <code>wall</code> arc extent change.
68157      * @param {Wall} wall
68158      * @param {number} oldArcExtent
68159      * @private
68160      */
68161     PlanController.prototype.postWallArcExtent = function (wall, oldArcExtent) {
68162         var newArcExtent = wall.getArcExtent();
68163         if (newArcExtent !== oldArcExtent && (newArcExtent == null || !(newArcExtent === oldArcExtent))) {
68164             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.WallArcExtentModificationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldArcExtent, wall, newArcExtent));
68165         }
68166     };
68167     /**
68168      * Posts an undoable operation about <code>room</code> resizing.
68169      * @param {Room} room
68170      * @param {number} oldX
68171      * @param {number} oldY
68172      * @param {number} pointIndex
68173      * @private
68174      */
68175     PlanController.prototype.postRoomResize = function (room, oldX, oldY, pointIndex) {
68176         var roomPoint = room.getPoints()[pointIndex];
68177         var newX = roomPoint[0];
68178         var newY = roomPoint[1];
68179         if (newX !== oldX || newY !== oldY) {
68180             var undoableEdit = new PlanController.RoomResizingUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldX, oldY, room, pointIndex, newX, newY);
68181             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(undoableEdit);
68182         }
68183     };
68184     /**
68185      * Posts an undoable operation about <code>room</code> name offset change.
68186      * @param {Room} room
68187      * @param {number} oldNameXOffset
68188      * @param {number} oldNameYOffset
68189      * @private
68190      */
68191     PlanController.prototype.postRoomNameOffset = function (room, oldNameXOffset, oldNameYOffset) {
68192         var newNameXOffset = room.getNameXOffset();
68193         var newNameYOffset = room.getNameYOffset();
68194         if (newNameXOffset !== oldNameXOffset || newNameYOffset !== oldNameYOffset) {
68195             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.RoomNameOffsetModificationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldNameXOffset, oldNameYOffset, room, newNameXOffset, newNameYOffset));
68196         }
68197     };
68198     /**
68199      * Posts an undoable operation about <code>room</code> name angle change.
68200      * @param {Room} room
68201      * @param {number} oldNameAngle
68202      * @private
68203      */
68204     PlanController.prototype.postRoomNameRotation = function (room, oldNameAngle) {
68205         var newNameAngle = room.getNameAngle();
68206         if (newNameAngle !== oldNameAngle) {
68207             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.RoomNameRotationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldNameAngle, room, newNameAngle));
68208         }
68209     };
68210     /**
68211      * Posts an undoable operation about <code>room</code> area offset change.
68212      * @param {Room} room
68213      * @param {number} oldAreaXOffset
68214      * @param {number} oldAreaYOffset
68215      * @private
68216      */
68217     PlanController.prototype.postRoomAreaOffset = function (room, oldAreaXOffset, oldAreaYOffset) {
68218         var newAreaXOffset = room.getAreaXOffset();
68219         var newAreaYOffset = room.getAreaYOffset();
68220         if (newAreaXOffset !== oldAreaXOffset || newAreaYOffset !== oldAreaYOffset) {
68221             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.RoomAreaOffsetModificationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldAreaXOffset, oldAreaYOffset, room, newAreaXOffset, newAreaYOffset));
68222         }
68223     };
68224     /**
68225      * Posts an undoable operation about <code>room</code> area angle change.
68226      * @param {Room} room
68227      * @param {number} oldAreaAngle
68228      * @private
68229      */
68230     PlanController.prototype.postRoomAreaRotation = function (room, oldAreaAngle) {
68231         var newAreaAngle = room.getAreaAngle();
68232         if (newAreaAngle !== oldAreaAngle) {
68233             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.RoomAreaRotationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldAreaAngle, room, newAreaAngle));
68234         }
68235     };
68236     /**
68237      * Post to undo support an angle change on <code>piece</code>.
68238      * @param {HomePieceOfFurniture} piece
68239      * @param {number} oldAngle
68240      * @param {boolean} oldDoorOrWindowBoundToWall
68241      * @private
68242      */
68243     PlanController.prototype.postPieceOfFurnitureRotation = function (piece, oldAngle, oldDoorOrWindowBoundToWall) {
68244         var newAngle = piece.getAngle();
68245         if (newAngle !== oldAngle) {
68246             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.PieceOfFurnitureRotationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldAngle, oldDoorOrWindowBoundToWall, piece, newAngle));
68247         }
68248     };
68249     /**
68250      * Post to undo support a pitch change on <code>piece</code>.
68251      * @param {HomePieceOfFurniture} piece
68252      * @param {number} oldPitch
68253      * @param {number} oldWidthInPlan
68254      * @param {number} oldDepthInPlan
68255      * @param {number} oldHeightInPlan
68256      * @private
68257      */
68258     PlanController.prototype.postPieceOfFurniturePitchRotation = function (piece, oldPitch, oldWidthInPlan, oldDepthInPlan, oldHeightInPlan) {
68259         var newPitch = piece.getPitch();
68260         if (newPitch !== oldPitch) {
68261             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.PieceOfFurniturePitchRotationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldPitch, oldWidthInPlan, oldDepthInPlan, oldHeightInPlan, piece, newPitch, piece.getWidthInPlan(), piece.getDepthInPlan(), piece.getHeightInPlan()));
68262         }
68263     };
68264     /**
68265      * Sets the pitch angle on the given piece without computing new size in plan.
68266      * @param {HomePieceOfFurniture} piece
68267      * @param {number} pitch
68268      * @param {number} widthInPlan
68269      * @param {number} depthInPlan
68270      * @param {number} heightInPlan
68271      * @private
68272      */
68273     PlanController.prototype.setPieceOfFurniturePitch = function (piece, pitch, widthInPlan, depthInPlan, heightInPlan) {
68274         piece.removePropertyChangeListener(this.furnitureSizeChangeListener);
68275         piece.setPitch(pitch);
68276         piece.setWidthInPlan(widthInPlan);
68277         piece.setDepthInPlan(depthInPlan);
68278         piece.setHeightInPlan(heightInPlan);
68279         piece.addPropertyChangeListener(this.furnitureSizeChangeListener);
68280     };
68281     /**
68282      * Post to undo support a roll change on <code>piece</code>.
68283      * @param {HomePieceOfFurniture} piece
68284      * @param {number} oldRoll
68285      * @param {number} oldWidthInPlan
68286      * @param {number} oldDepthInPlan
68287      * @param {number} oldHeightInPlan
68288      * @private
68289      */
68290     PlanController.prototype.postPieceOfFurnitureRollRotation = function (piece, oldRoll, oldWidthInPlan, oldDepthInPlan, oldHeightInPlan) {
68291         var newRoll = piece.getRoll();
68292         if (newRoll !== oldRoll) {
68293             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.PieceOfFurnitureRollRotationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldRoll, oldWidthInPlan, oldDepthInPlan, oldHeightInPlan, piece, newRoll, piece.getWidthInPlan(), piece.getDepthInPlan(), piece.getHeightInPlan()));
68294         }
68295     };
68296     /**
68297      * Sets the roll angle on the given piece without computing new size in plan.
68298      * @param {HomePieceOfFurniture} piece
68299      * @param {number} roll
68300      * @param {number} widthInPlan
68301      * @param {number} depthInPlan
68302      * @param {number} heightInPlan
68303      * @private
68304      */
68305     PlanController.prototype.setPieceOfFurnitureRoll = function (piece, roll, widthInPlan, depthInPlan, heightInPlan) {
68306         piece.removePropertyChangeListener(this.furnitureSizeChangeListener);
68307         piece.setRoll(roll);
68308         piece.setWidthInPlan(widthInPlan);
68309         piece.setDepthInPlan(depthInPlan);
68310         piece.setHeightInPlan(heightInPlan);
68311         piece.addPropertyChangeListener(this.furnitureSizeChangeListener);
68312     };
68313     /**
68314      * Post to undo support an elevation change on <code>piece</code>.
68315      * @param {HomePieceOfFurniture} piece
68316      * @param {number} oldElevation
68317      * @private
68318      */
68319     PlanController.prototype.postPieceOfFurnitureElevation = function (piece, oldElevation) {
68320         var newElevation = piece.getElevation();
68321         if (newElevation !== oldElevation) {
68322             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.PieceOfFurnitureElevationModificationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldElevation, piece, newElevation));
68323         }
68324     };
68325     /**
68326      * Post to undo support a height change on <code>piece</code>.
68327      * @param {PlanController.ResizedPieceOfFurniture} resizedPiece
68328      * @private
68329      */
68330     PlanController.prototype.postPieceOfFurnitureHeightResize = function (resizedPiece) {
68331         if (resizedPiece.getPieceOfFurniture().getHeight() !== resizedPiece.getHeight()) {
68332             this.postPieceOfFurnitureResize(resizedPiece, "undoPieceOfFurnitureHeightResizeName");
68333         }
68334     };
68335     /**
68336      * Post to undo support a width and depth change on <code>piece</code>.
68337      * @param {PlanController.ResizedPieceOfFurniture} resizedPiece
68338      * @private
68339      */
68340     PlanController.prototype.postPieceOfFurnitureWidthAndDepthResize = function (resizedPiece) {
68341         var piece = resizedPiece.getPieceOfFurniture();
68342         if (piece.getWidth() !== resizedPiece.getWidth() || piece.getDepth() !== resizedPiece.getDepth()) {
68343             this.postPieceOfFurnitureResize(resizedPiece, "undoPieceOfFurnitureWidthAndDepthResizeName");
68344         }
68345     };
68346     /**
68347      * Post to undo support a size change on <code>piece</code>.
68348      * @param {PlanController.ResizedPieceOfFurniture} resizedPiece
68349      * @param {string} presentationNameKey
68350      * @private
68351      */
68352     PlanController.prototype.postPieceOfFurnitureResize = function (resizedPiece, presentationNameKey) {
68353         var piece = resizedPiece.getPieceOfFurniture();
68354         var doorOrWindowBoundToWall = (piece != null && piece instanceof HomeDoorOrWindow) && piece.isBoundToWall();
68355         this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.PieceOfFurnitureResizingUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, presentationNameKey, doorOrWindowBoundToWall, resizedPiece, piece.getX(), piece.getY(), piece.getWidth(), piece.getDepth(), piece.getHeight()));
68356     };
68357     /**
68358      * Sets the size of the given piece of furniture.
68359      * @param {PlanController.ResizedPieceOfFurniture} resizedPiece
68360      * @param {number} width
68361      * @param {number} depth
68362      * @param {number} height
68363      * @private
68364      */
68365     PlanController.prototype.setPieceOfFurnitureSize = function (resizedPiece, width, depth, height) {
68366         var piece = resizedPiece.getPieceOfFurniture();
68367         piece.removePropertyChangeListener(this.furnitureSizeChangeListener);
68368         if (piece != null && piece instanceof HomeFurnitureGroup) {
68369             {
68370                 var array = piece.getAllFurniture();
68371                 for (var index = 0; index < array.length; index++) {
68372                     var childPiece = array[index];
68373                     {
68374                         childPiece.removePropertyChangeListener(this.furnitureSizeChangeListener);
68375                     }
68376                 }
68377             }
68378         }
68379         PlanController.ResizedPieceOfFurniture.setPieceOfFurnitureSize(piece, width, depth, height);
68380         piece.addPropertyChangeListener(this.furnitureSizeChangeListener);
68381         if (piece != null && piece instanceof HomeFurnitureGroup) {
68382             {
68383                 var array = piece.getAllFurniture();
68384                 for (var index = 0; index < array.length; index++) {
68385                     var childPiece = array[index];
68386                     {
68387                         childPiece.addPropertyChangeListener(this.furnitureSizeChangeListener);
68388                     }
68389                 }
68390             }
68391         }
68392     };
68393     /**
68394      * Resets the size of the given piece of furniture.
68395      * @param {PlanController.ResizedPieceOfFurniture} resizedPiece
68396      * @private
68397      */
68398     PlanController.prototype.resetPieceOfFurnitureSize = function (resizedPiece) {
68399         var piece = resizedPiece.getPieceOfFurniture();
68400         piece.removePropertyChangeListener(this.furnitureSizeChangeListener);
68401         if (piece != null && piece instanceof HomeFurnitureGroup) {
68402             {
68403                 var array = piece.getAllFurniture();
68404                 for (var index = 0; index < array.length; index++) {
68405                     var childPiece = array[index];
68406                     {
68407                         childPiece.removePropertyChangeListener(this.furnitureSizeChangeListener);
68408                     }
68409                 }
68410             }
68411         }
68412         resizedPiece.reset();
68413         piece.addPropertyChangeListener(this.furnitureSizeChangeListener);
68414         if (piece != null && piece instanceof HomeFurnitureGroup) {
68415             {
68416                 var array = piece.getAllFurniture();
68417                 for (var index = 0; index < array.length; index++) {
68418                     var childPiece = array[index];
68419                     {
68420                         childPiece.addPropertyChangeListener(this.furnitureSizeChangeListener);
68421                     }
68422                 }
68423             }
68424         }
68425     };
68426     /**
68427      * Post to undo support a power modification on <code>light</code>.
68428      * @param {HomeLight} light
68429      * @param {number} oldPower
68430      * @private
68431      */
68432     PlanController.prototype.postLightPowerModification = function (light, oldPower) {
68433         var newPower = light.getPower();
68434         if (newPower !== oldPower) {
68435             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.LightPowerModificationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldPower, light, newPower));
68436         }
68437     };
68438     /**
68439      * Posts an undoable operation about <code>piece</code> name offset change.
68440      * @param {HomePieceOfFurniture} piece
68441      * @param {number} oldNameXOffset
68442      * @param {number} oldNameYOffset
68443      * @private
68444      */
68445     PlanController.prototype.postPieceOfFurnitureNameOffset = function (piece, oldNameXOffset, oldNameYOffset) {
68446         var newNameXOffset = piece.getNameXOffset();
68447         var newNameYOffset = piece.getNameYOffset();
68448         if (newNameXOffset !== oldNameXOffset || newNameYOffset !== oldNameYOffset) {
68449             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.PieceOfFurnitureNameOffsetModificationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldNameXOffset, oldNameYOffset, piece, newNameXOffset, newNameYOffset));
68450         }
68451     };
68452     /**
68453      * Posts an undoable operation about <code>piece</code> name angle change.
68454      * @param {HomePieceOfFurniture} piece
68455      * @param {number} oldNameAngle
68456      * @private
68457      */
68458     PlanController.prototype.postPieceOfFurnitureNameRotation = function (piece, oldNameAngle) {
68459         var newNameAngle = piece.getNameAngle();
68460         if (newNameAngle !== oldNameAngle) {
68461             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.PieceOfFurnitureNameRotationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldNameAngle, piece, newNameAngle));
68462         }
68463     };
68464     /**
68465      * Posts an undoable operation about <code>dimensionLine</code> resizing.
68466      * @param {DimensionLine} dimensionLine
68467      * @param {number} oldX
68468      * @param {number} oldY
68469      * @param {boolean} startPoint
68470      * @param {boolean} reversed
68471      * @private
68472      */
68473     PlanController.prototype.postDimensionLineResize = function (dimensionLine, oldX, oldY, startPoint, reversed) {
68474         var newX;
68475         var newY;
68476         if (startPoint) {
68477             newX = dimensionLine.getXStart();
68478             newY = dimensionLine.getYStart();
68479         }
68480         else {
68481             newX = dimensionLine.getXEnd();
68482             newY = dimensionLine.getYEnd();
68483         }
68484         if (newX !== oldX || newY !== oldY || reversed) {
68485             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.DimensionLineResizingUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldX, oldY, dimensionLine, newX, newY, startPoint, reversed));
68486         }
68487     };
68488     /**
68489      * Posts an undoable operation about <code>dimensionLine</code> offset change.
68490      * @param {DimensionLine} dimensionLine
68491      * @param {number} oldOffset
68492      * @private
68493      */
68494     PlanController.prototype.postDimensionLineOffset = function (dimensionLine, oldOffset) {
68495         var newOffset = dimensionLine.getOffset();
68496         if (newOffset !== oldOffset) {
68497             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.DimensionLineOffsetModificationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldOffset, dimensionLine, newOffset));
68498         }
68499     };
68500     /**
68501      * Post to undo support a pitch angle change on <code>dimensionLine</code>.
68502      * @param {DimensionLine} dimensionLine
68503      * @param {number} oldPitch
68504      * @private
68505      */
68506     PlanController.prototype.postDimensionLinePitchRotation = function (dimensionLine, oldPitch) {
68507         var newPitch = dimensionLine.getPitch();
68508         if (newPitch !== oldPitch) {
68509             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.DimensionLinePitchRotationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldPitch, dimensionLine, newPitch));
68510         }
68511     };
68512     /**
68513      * Posts an undoable operation about <code>dimensionLine</code> height change.
68514      * @param {DimensionLine} dimensionLine
68515      * @param {number} oldHeight
68516      * @private
68517      */
68518     PlanController.prototype.postDimensionLineHeight = function (dimensionLine, oldHeight) {
68519         var newHeight = dimensionLine.getElevationEnd() - dimensionLine.getElevationStart();
68520         if (newHeight !== oldHeight) {
68521             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.DimensionLineHeightResizingUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldHeight, dimensionLine, newHeight));
68522         }
68523     };
68524     /**
68525      * Post to undo support an elevation change on <code>dimensionLine</code>.
68526      * @param {DimensionLine} dimensionLine
68527      * @param {number} oldElevation
68528      * @private
68529      */
68530     PlanController.prototype.postDimensionLineElevation = function (dimensionLine, oldElevation) {
68531         var newElevation = dimensionLine.getElevationStart();
68532         if (newElevation !== oldElevation) {
68533             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.DimensionLineElevationModificationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldElevation, dimensionLine, newElevation));
68534         }
68535     };
68536     /**
68537      * Posts an undoable operation about <code>polyline</code> resizing.
68538      * @param {Polyline} polyline
68539      * @param {number} oldX
68540      * @param {number} oldY
68541      * @param {number} pointIndex
68542      * @private
68543      */
68544     PlanController.prototype.postPolylineResize = function (polyline, oldX, oldY, pointIndex) {
68545         var polylinePoint = polyline.getPoints()[pointIndex];
68546         var newX = polylinePoint[0];
68547         var newY = polylinePoint[1];
68548         if (newX !== oldX || newY !== oldY) {
68549             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.PolylineResizingUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldX, oldY, polyline, pointIndex, newX, newY));
68550         }
68551     };
68552     /**
68553      * Post to undo support a north direction change on <code>compass</code>.
68554      * @param {Compass} compass
68555      * @param {number} oldNorthDirection
68556      * @private
68557      */
68558     PlanController.prototype.postCompassRotation = function (compass, oldNorthDirection) {
68559         var newNorthDirection = compass.getNorthDirection();
68560         if (newNorthDirection !== oldNorthDirection) {
68561             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.CompassRotationUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldNorthDirection, compass, newNorthDirection));
68562         }
68563     };
68564     /**
68565      * Post to undo support a size change on <code>compass</code>.
68566      * @param {Compass} compass
68567      * @param {number} oldDiameter
68568      * @private
68569      */
68570     PlanController.prototype.postCompassResize = function (compass, oldDiameter) {
68571         var newDiameter = compass.getDiameter();
68572         if (newDiameter !== oldDiameter) {
68573             this.__com_eteks_sweethome3d_viewcontroller_PlanController_undoSupport.postEdit(new PlanController.CompassResizingUndoableEdit(this, this.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences, oldDiameter, compass, newDiameter));
68574         }
68575     };
68576     /**
68577      * Returns the points of a general path which contains only one path.
68578      * @param {java.awt.geom.GeneralPath} path
68579      * @param {boolean} removeAlignedPoints
68580      * @return {float[][]}
68581      * @private
68582      */
68583     PlanController.prototype.getPathPoints = function (path, removeAlignedPoints) {
68584         var pathPoints = ([]);
68585         var previousPathPoint = null;
68586         for (var it = path.getPathIterator(null); !it.isDone(); it.next()) {
68587             {
68588                 var pathPoint = [0, 0];
68589                 if (it.currentSegment(pathPoint) !== java.awt.geom.PathIterator.SEG_CLOSE && (previousPathPoint == null || !(function (a1, a2) { if (a1 == null && a2 == null)
68590                     return true; if (a1 == null || a2 == null)
68591                     return false; if (a1.length != a2.length)
68592                     return false; for (var i = 0; i < a1.length; i++) {
68593                     if (a1[i] != a2[i])
68594                         return false;
68595                 } return true; })(pathPoint, previousPathPoint))) {
68596                     var replacePoint = false;
68597                     if (removeAlignedPoints && /* size */ pathPoints.length > 1) {
68598                         var lastLineStartPoint = pathPoints[ /* size */pathPoints.length - 2];
68599                         var lastLineEndPoint = previousPathPoint;
68600                         replacePoint = java.awt.geom.Line2D.ptLineDistSq(lastLineStartPoint[0], lastLineStartPoint[1], lastLineEndPoint[0], lastLineEndPoint[1], pathPoint[0], pathPoint[1]) < 1.0E-4;
68601                     }
68602                     if (replacePoint) {
68603                         /* set */ (pathPoints[ /* size */pathPoints.length - 1] = pathPoint);
68604                     }
68605                     else {
68606                         /* add */ (pathPoints.push(pathPoint) > 0);
68607                     }
68608                     previousPathPoint = pathPoint;
68609                 }
68610             }
68611             ;
68612         }
68613         if ( /* size */pathPoints.length > 1 && /* equals */ (function (a1, a2) { if (a1 == null && a2 == null)
68614             return true; if (a1 == null || a2 == null)
68615             return false; if (a1.length != a2.length)
68616             return false; for (var i = 0; i < a1.length; i++) {
68617             if (a1[i] != a2[i])
68618                 return false;
68619         } return true; })(/* get */ pathPoints[0], /* get */ pathPoints[ /* size */pathPoints.length - 1])) {
68620             /* remove */ pathPoints.splice(/* size */ pathPoints.length - 1, 1)[0];
68621         }
68622         return /* toArray */ pathPoints.slice(0);
68623     };
68624     /**
68625      * Returns the list of closed paths that may define rooms from
68626      * the current set of home walls.
68627      * @return {java.awt.geom.GeneralPath[]}
68628      * @private
68629      */
68630     PlanController.prototype.getRoomPathsFromWalls = function () {
68631         if (this.roomPathsCache == null) {
68632             var wallsArea = this.getWallsArea(false);
68633             var roomPaths = this.getAreaPaths(wallsArea);
68634             var insideWallsArea = new java.awt.geom.Area(wallsArea);
68635             for (var index = 0; index < roomPaths.length; index++) {
68636                 var roomPath = roomPaths[index];
68637                 {
68638                     insideWallsArea.add(new java.awt.geom.Area(roomPath));
68639                 }
68640             }
68641             this.roomPathsCache = roomPaths;
68642             this.insideWallsAreaCache = insideWallsArea;
68643         }
68644         return this.roomPathsCache;
68645     };
68646     /**
68647      * Returns the paths described by the given <code>area</code>.
68648      * @param {java.awt.geom.Area} area
68649      * @return {java.awt.geom.GeneralPath[]}
68650      * @private
68651      */
68652     PlanController.prototype.getAreaPaths = function (area) {
68653         var roomPaths = ([]);
68654         var roomPath = null;
68655         var previousRoomPoint = null;
68656         for (var it = area.getPathIterator(null, 0.5); !it.isDone(); it.next()) {
68657             {
68658                 var roomPoint = [0, 0];
68659                 switch ((it.currentSegment(roomPoint))) {
68660                     case java.awt.geom.PathIterator.SEG_MOVETO:
68661                         roomPath = new java.awt.geom.GeneralPath();
68662                         roomPath.moveTo(roomPoint[0], roomPoint[1]);
68663                         previousRoomPoint = roomPoint;
68664                         break;
68665                     case java.awt.geom.PathIterator.SEG_LINETO:
68666                         if ((roomPoint[0] !== previousRoomPoint[0] || roomPoint[1] !== previousRoomPoint[1]) && java.awt.geom.Point2D.distanceSq(roomPoint[0], roomPoint[1], previousRoomPoint[0], previousRoomPoint[1]) > 1.0E-10) {
68667                             roomPath.lineTo(roomPoint[0], roomPoint[1]);
68668                             previousRoomPoint = roomPoint;
68669                         }
68670                         break;
68671                     case java.awt.geom.PathIterator.SEG_CLOSE:
68672                         roomPath.closePath();
68673                         /* add */ (roomPaths.push(roomPath) > 0);
68674                         break;
68675                 }
68676             }
68677             ;
68678         }
68679         return roomPaths;
68680     };
68681     /**
68682      * Returns the area that includes walls and inside walls area.
68683      * @return {java.awt.geom.Area}
68684      * @private
68685      */
68686     PlanController.prototype.getInsideWallsArea = function () {
68687         if (this.insideWallsAreaCache == null) {
68688             this.getRoomPathsFromWalls();
68689         }
68690         return this.insideWallsAreaCache;
68691     };
68692     /**
68693      * Returns the area covered by walls.
68694      * @param {boolean} includeBaseboards
68695      * @return {java.awt.geom.Area}
68696      * @private
68697      */
68698     PlanController.prototype.getWallsArea = function (includeBaseboards) {
68699         if (!includeBaseboards && this.wallsAreaCache == null || includeBaseboards && this.wallsIncludingBaseboardsAreaCache == null) {
68700             var wallsArea = new java.awt.geom.Area();
68701             var selectedLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
68702             {
68703                 var array = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getWalls();
68704                 for (var index = 0; index < array.length; index++) {
68705                     var wall = array[index];
68706                     {
68707                         if (wall.isAtLevel(selectedLevel)) {
68708                             wallsArea.add(new java.awt.geom.Area(this.getPath$float_A_A(wall.getPoints$boolean(includeBaseboards))));
68709                         }
68710                     }
68711                 }
68712             }
68713             if (includeBaseboards) {
68714                 this.wallsIncludingBaseboardsAreaCache = wallsArea;
68715             }
68716             else {
68717                 this.wallsAreaCache = wallsArea;
68718             }
68719         }
68720         return includeBaseboards ? this.wallsIncludingBaseboardsAreaCache : this.wallsAreaCache;
68721     };
68722     PlanController.prototype.getPath$float_A_A = function (points) {
68723         var path = new java.awt.geom.GeneralPath();
68724         path.moveTo(points[0][0], points[0][1]);
68725         for (var i = 1; i < points.length; i++) {
68726             {
68727                 path.lineTo(points[i][0], points[i][1]);
68728             }
68729             ;
68730         }
68731         path.closePath();
68732         return path;
68733     };
68734     /**
68735      * Returns the shape matching the coordinates in <code>points</code> array.
68736      * @param {float[][]} points
68737      * @return {java.awt.geom.GeneralPath}
68738      * @private
68739      */
68740     PlanController.prototype.getPath = function (points) {
68741         if (((points != null && points instanceof Array && (points.length == 0 || points[0] == null || points[0] instanceof Array)) || points === null)) {
68742             return this.getPath$float_A_A(points);
68743         }
68744         else if (((points != null && points instanceof java.awt.geom.Area) || points === null)) {
68745             return this.getPath$java_awt_geom_Area(points);
68746         }
68747         else
68748             throw new Error('invalid overload');
68749     };
68750     PlanController.prototype.getPath$java_awt_geom_Area = function (area) {
68751         var path = new java.awt.geom.GeneralPath();
68752         var point = [0, 0];
68753         for (var it = area.getPathIterator(null, 0.5); !it.isDone(); it.next()) {
68754             {
68755                 switch ((it.currentSegment(point))) {
68756                     case java.awt.geom.PathIterator.SEG_MOVETO:
68757                         path.moveTo(point[0], point[1]);
68758                         break;
68759                     case java.awt.geom.PathIterator.SEG_LINETO:
68760                         path.lineTo(point[0], point[1]);
68761                         break;
68762                 }
68763             }
68764             ;
68765         }
68766         return path;
68767     };
68768     /**
68769      * Selects the level of the first elevatable item in the current selection
68770      * if no selected item is visible at the selected level.
68771      * @private
68772      */
68773     PlanController.prototype.selectLevelFromSelectedItems = function () {
68774         var selectedLevel = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel();
68775         var selectedItems = this.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
68776         for (var index = 0; index < selectedItems.length; index++) {
68777             var item = selectedItems[index];
68778             {
68779                 if ((item != null && (item.constructor != null && item.constructor["__interfaces"] != null && item.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Elevatable") >= 0)) && item.isAtLevel(selectedLevel)) {
68780                     return;
68781                 }
68782             }
68783         }
68784         for (var index = 0; index < selectedItems.length; index++) {
68785             var item = selectedItems[index];
68786             {
68787                 if (item != null && (item.constructor != null && item.constructor["__interfaces"] != null && item.constructor["__interfaces"].indexOf("com.eteks.sweethome3d.model.Elevatable") >= 0)) {
68788                     this.setSelectedLevel(item.getLevel());
68789                     break;
68790                 }
68791             }
68792         }
68793     };
68794     PlanController.SCALE_VISUAL_PROPERTY = "com.eteks.sweethome3d.SweetHome3D.PlanScale";
68795     PlanController.PIXEL_MARGIN = 4;
68796     PlanController.INDICATOR_PIXEL_MARGIN = 5;
68797     PlanController.WALL_ENDS_PIXEL_MARGIN = 2;
68798     return PlanController;
68799 }(FurnitureController));
68800 PlanController["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController";
68801 PlanController["__interfaces"] = ["com.eteks.sweethome3d.viewcontroller.Controller"];
68802 (function (PlanController) {
68803     /**
68804      * Selectable modes in controller.
68805      * @class
68806      */
68807     var Mode = /** @class */ (function () {
68808         function Mode(name) {
68809             if (this.__name === undefined) {
68810                 this.__name = null;
68811             }
68812             this.__name = name;
68813         }
68814         Mode.SELECTION_$LI$ = function () { if (Mode.SELECTION == null) {
68815             Mode.SELECTION = new PlanController.Mode("SELECTION");
68816         } return Mode.SELECTION; };
68817         Mode.PANNING_$LI$ = function () { if (Mode.PANNING == null) {
68818             Mode.PANNING = new PlanController.Mode("PANNING");
68819         } return Mode.PANNING; };
68820         Mode.WALL_CREATION_$LI$ = function () { if (Mode.WALL_CREATION == null) {
68821             Mode.WALL_CREATION = new PlanController.Mode("WALL_CREATION");
68822         } return Mode.WALL_CREATION; };
68823         Mode.ROOM_CREATION_$LI$ = function () { if (Mode.ROOM_CREATION == null) {
68824             Mode.ROOM_CREATION = new PlanController.Mode("ROOM_CREATION");
68825         } return Mode.ROOM_CREATION; };
68826         Mode.POLYLINE_CREATION_$LI$ = function () { if (Mode.POLYLINE_CREATION == null) {
68827             Mode.POLYLINE_CREATION = new PlanController.Mode("POLYLINE_CREATION");
68828         } return Mode.POLYLINE_CREATION; };
68829         Mode.DIMENSION_LINE_CREATION_$LI$ = function () { if (Mode.DIMENSION_LINE_CREATION == null) {
68830             Mode.DIMENSION_LINE_CREATION = new PlanController.Mode("DIMENSION_LINE_CREATION");
68831         } return Mode.DIMENSION_LINE_CREATION; };
68832         Mode.LABEL_CREATION_$LI$ = function () { if (Mode.LABEL_CREATION == null) {
68833             Mode.LABEL_CREATION = new PlanController.Mode("LABEL_CREATION");
68834         } return Mode.LABEL_CREATION; };
68835         Mode.prototype.name = function () {
68836             return this.__name;
68837         };
68838         /**
68839          *
68840          * @return {string}
68841          */
68842         Mode.prototype.toString = function () {
68843             return this.__name;
68844         };
68845         return Mode;
68846     }());
68847     PlanController.Mode = Mode;
68848     Mode["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.Mode";
68849     /**
68850      * Undoable edit for plan locking.
68851      * @param {PlanController} controller
68852      * @param {Home} home
68853      * @param {UserPreferences} preferences
68854      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
68855      * @param {boolean} allLevelsSelection
68856      * @param {com.eteks.sweethome3d.model.Selectable[]} newSelectedItems
68857      * @class
68858      * @extends LocalizedUndoableEdit
68859      */
68860     var LockingUndoableEdit = /** @class */ (function (_super) {
68861         __extends(LockingUndoableEdit, _super);
68862         function LockingUndoableEdit(controller, home, preferences, oldSelection, allLevelsSelection, newSelectedItems) {
68863             var _this = _super.call(this, preferences, PlanController, "undoLockBasePlan") || this;
68864             if (_this.controller === undefined) {
68865                 _this.controller = null;
68866             }
68867             if (_this.home === undefined) {
68868                 _this.home = null;
68869             }
68870             if (_this.oldSelection === undefined) {
68871                 _this.oldSelection = null;
68872             }
68873             if (_this.allLevelsSelection === undefined) {
68874                 _this.allLevelsSelection = false;
68875             }
68876             if (_this.newSelectedItems === undefined) {
68877                 _this.newSelectedItems = null;
68878             }
68879             _this.controller = controller;
68880             _this.home = home;
68881             _this.oldSelection = oldSelection;
68882             _this.allLevelsSelection = allLevelsSelection;
68883             _this.newSelectedItems = newSelectedItems;
68884             return _this;
68885         }
68886         /**
68887          *
68888          */
68889         LockingUndoableEdit.prototype.undo = function () {
68890             _super.prototype.undo.call(this);
68891             this.home.setBasePlanLocked(false);
68892             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.oldSelection.slice(0), this.allLevelsSelection);
68893         };
68894         /**
68895          *
68896          */
68897         LockingUndoableEdit.prototype.redo = function () {
68898             _super.prototype.redo.call(this);
68899             this.home.setBasePlanLocked(true);
68900             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.newSelectedItems.slice(0), this.allLevelsSelection);
68901         };
68902         return LockingUndoableEdit;
68903     }(LocalizedUndoableEdit));
68904     PlanController.LockingUndoableEdit = LockingUndoableEdit;
68905     LockingUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.LockingUndoableEdit";
68906     LockingUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
68907     /**
68908      * Undoable edit for plan unlocking.
68909      * @param {PlanController} controller
68910      * @param {Home} home
68911      * @param {UserPreferences} preferences
68912      * @param {com.eteks.sweethome3d.model.Selectable[]} selectedItems
68913      * @param {boolean} allLevelsSelection
68914      * @class
68915      * @extends LocalizedUndoableEdit
68916      */
68917     var UnlockingUndoableEdit = /** @class */ (function (_super) {
68918         __extends(UnlockingUndoableEdit, _super);
68919         function UnlockingUndoableEdit(controller, home, preferences, selectedItems, allLevelsSelection) {
68920             var _this = _super.call(this, preferences, PlanController, "undoUnlockBasePlan") || this;
68921             if (_this.controller === undefined) {
68922                 _this.controller = null;
68923             }
68924             if (_this.home === undefined) {
68925                 _this.home = null;
68926             }
68927             if (_this.selectedItems === undefined) {
68928                 _this.selectedItems = null;
68929             }
68930             if (_this.allLevelsSelection === undefined) {
68931                 _this.allLevelsSelection = false;
68932             }
68933             _this.controller = controller;
68934             _this.home = home;
68935             _this.selectedItems = selectedItems;
68936             _this.allLevelsSelection = allLevelsSelection;
68937             return _this;
68938         }
68939         /**
68940          *
68941          */
68942         UnlockingUndoableEdit.prototype.undo = function () {
68943             _super.prototype.undo.call(this);
68944             this.home.setBasePlanLocked(true);
68945             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.selectedItems.slice(0), this.allLevelsSelection);
68946         };
68947         /**
68948          *
68949          */
68950         UnlockingUndoableEdit.prototype.redo = function () {
68951             _super.prototype.redo.call(this);
68952             this.home.setBasePlanLocked(false);
68953             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.selectedItems.slice(0), false);
68954         };
68955         return UnlockingUndoableEdit;
68956     }(LocalizedUndoableEdit));
68957     PlanController.UnlockingUndoableEdit = UnlockingUndoableEdit;
68958     UnlockingUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.UnlockingUndoableEdit";
68959     UnlockingUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
68960     /**
68961      * Undoable edit for flipped items.
68962      * @param {PlanController} controller
68963      * @param {UserPreferences} preferences
68964      * @param {boolean} allLevelsSelection
68965      * @param {com.eteks.sweethome3d.model.Selectable[]} items
68966      * @param {float[][]} itemTextBaseOffsets
68967      * @param {boolean} horizontalFlip
68968      * @class
68969      * @extends LocalizedUndoableEdit
68970      */
68971     var FlippingUndoableEdit = /** @class */ (function (_super) {
68972         __extends(FlippingUndoableEdit, _super);
68973         function FlippingUndoableEdit(controller, preferences, allLevelsSelection, items, itemTextBaseOffsets, horizontalFlip) {
68974             var _this = _super.call(this, preferences, PlanController, "undoFlipName") || this;
68975             if (_this.controller === undefined) {
68976                 _this.controller = null;
68977             }
68978             if (_this.allLevelsSelection === undefined) {
68979                 _this.allLevelsSelection = false;
68980             }
68981             if (_this.items === undefined) {
68982                 _this.items = null;
68983             }
68984             if (_this.itemTextBaseOffsets === undefined) {
68985                 _this.itemTextBaseOffsets = null;
68986             }
68987             if (_this.horizontalFlip === undefined) {
68988                 _this.horizontalFlip = false;
68989             }
68990             _this.controller = controller;
68991             _this.allLevelsSelection = allLevelsSelection;
68992             _this.items = items;
68993             _this.itemTextBaseOffsets = itemTextBaseOffsets;
68994             _this.horizontalFlip = horizontalFlip;
68995             return _this;
68996         }
68997         /**
68998          *
68999          */
69000         FlippingUndoableEdit.prototype.undo = function () {
69001             _super.prototype.undo.call(this);
69002             this.controller.doFlipItems(this.items, this.itemTextBaseOffsets, this.horizontalFlip);
69003             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.items.slice(0), this.allLevelsSelection);
69004         };
69005         /**
69006          *
69007          */
69008         FlippingUndoableEdit.prototype.redo = function () {
69009             _super.prototype.redo.call(this);
69010             this.controller.doFlipItems(this.items, this.itemTextBaseOffsets, this.horizontalFlip);
69011             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.items.slice(0), this.allLevelsSelection);
69012         };
69013         return FlippingUndoableEdit;
69014     }(LocalizedUndoableEdit));
69015     PlanController.FlippingUndoableEdit = FlippingUndoableEdit;
69016     FlippingUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.FlippingUndoableEdit";
69017     FlippingUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
69018     /**
69019      * Undoable edit for joining walls.
69020      * @param {PlanController} controller
69021      * @param {UserPreferences} preferences
69022      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
69023      * @param {boolean} allLevelsSelection
69024      * @param {com.eteks.sweethome3d.viewcontroller.PlanController.JoinedWall[]} joinedWalls
69025      * @param {float[]} joinPoint
69026      * @class
69027      * @extends LocalizedUndoableEdit
69028      */
69029     var WallsJoiningUndoableEdit = /** @class */ (function (_super) {
69030         __extends(WallsJoiningUndoableEdit, _super);
69031         function WallsJoiningUndoableEdit(controller, preferences, oldSelection, allLevelsSelection, joinedWalls, joinPoint) {
69032             var _this = _super.call(this, preferences, PlanController, "undoJoinWallsName") || this;
69033             if (_this.controller === undefined) {
69034                 _this.controller = null;
69035             }
69036             if (_this.oldSelection === undefined) {
69037                 _this.oldSelection = null;
69038             }
69039             if (_this.allLevelsSelection === undefined) {
69040                 _this.allLevelsSelection = false;
69041             }
69042             if (_this.joinedWalls === undefined) {
69043                 _this.joinedWalls = null;
69044             }
69045             if (_this.joinPoint === undefined) {
69046                 _this.joinPoint = null;
69047             }
69048             _this.controller = controller;
69049             _this.oldSelection = oldSelection;
69050             _this.allLevelsSelection = allLevelsSelection;
69051             _this.joinedWalls = joinedWalls;
69052             _this.joinPoint = joinPoint;
69053             return _this;
69054         }
69055         /**
69056          *
69057          */
69058         WallsJoiningUndoableEdit.prototype.undo = function () {
69059             _super.prototype.undo.call(this);
69060             for (var index = 0; index < this.joinedWalls.length; index++) {
69061                 var joinedWall = this.joinedWalls[index];
69062                 {
69063                     var wall = joinedWall.getWall();
69064                     wall.setWallAtStart(joinedWall.getWallAtStart());
69065                     if (joinedWall.getWallAtStart() != null) {
69066                         if (joinedWall.isJoinedAtEndOfWallAtStart()) {
69067                             joinedWall.getWallAtStart().setWallAtEnd(wall);
69068                         }
69069                         else {
69070                             joinedWall.getWallAtStart().setWallAtStart(wall);
69071                         }
69072                     }
69073                     wall.setWallAtEnd(joinedWall.getWallAtEnd());
69074                     if (joinedWall.getWallAtEnd() != null) {
69075                         if (joinedWall.isJoinedAtStartOfWallAtEnd()) {
69076                             joinedWall.getWallAtEnd().setWallAtStart(wall);
69077                         }
69078                         else {
69079                             joinedWall.getWallAtEnd().setWallAtEnd(wall);
69080                         }
69081                     }
69082                     wall.setXStart(joinedWall.getXStart());
69083                     wall.setYStart(joinedWall.getYStart());
69084                     wall.setXEnd(joinedWall.getXEnd());
69085                     wall.setYEnd(joinedWall.getYEnd());
69086                 }
69087             }
69088             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.oldSelection.slice(0), this.allLevelsSelection);
69089         };
69090         /**
69091          *
69092          */
69093         WallsJoiningUndoableEdit.prototype.redo = function () {
69094             _super.prototype.redo.call(this);
69095             this.controller.doJoinWalls(this.joinedWalls, this.joinPoint);
69096         };
69097         return WallsJoiningUndoableEdit;
69098     }(LocalizedUndoableEdit));
69099     PlanController.WallsJoiningUndoableEdit = WallsJoiningUndoableEdit;
69100     WallsJoiningUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.WallsJoiningUndoableEdit";
69101     WallsJoiningUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
69102     /**
69103      * Undoable edit for reversing walls direction.
69104      * @param {PlanController} controller
69105      * @param {UserPreferences} preferences
69106      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
69107      * @param {boolean} allLevelsSelection
69108      * @param {com.eteks.sweethome3d.model.Wall[]} walls
69109      * @class
69110      * @extends LocalizedUndoableEdit
69111      */
69112     var WallsDirectionReversingUndoableEdit = /** @class */ (function (_super) {
69113         __extends(WallsDirectionReversingUndoableEdit, _super);
69114         function WallsDirectionReversingUndoableEdit(controller, preferences, oldSelection, allLevelsSelection, walls) {
69115             var _this = _super.call(this, preferences, PlanController, "undoReverseWallsDirectionName") || this;
69116             if (_this.controller === undefined) {
69117                 _this.controller = null;
69118             }
69119             if (_this.oldSelection === undefined) {
69120                 _this.oldSelection = null;
69121             }
69122             if (_this.allLevelsSelection === undefined) {
69123                 _this.allLevelsSelection = false;
69124             }
69125             if (_this.walls === undefined) {
69126                 _this.walls = null;
69127             }
69128             _this.controller = controller;
69129             _this.oldSelection = oldSelection;
69130             _this.allLevelsSelection = allLevelsSelection;
69131             _this.walls = walls;
69132             return _this;
69133         }
69134         /**
69135          *
69136          */
69137         WallsDirectionReversingUndoableEdit.prototype.undo = function () {
69138             _super.prototype.undo.call(this);
69139             this.controller.doReverseWallsDirection(this.walls);
69140             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.oldSelection.slice(0), this.allLevelsSelection);
69141         };
69142         /**
69143          *
69144          */
69145         WallsDirectionReversingUndoableEdit.prototype.redo = function () {
69146             _super.prototype.redo.call(this);
69147             this.controller.doReverseWallsDirection(this.walls);
69148             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.walls.slice(0), false);
69149         };
69150         return WallsDirectionReversingUndoableEdit;
69151     }(LocalizedUndoableEdit));
69152     PlanController.WallsDirectionReversingUndoableEdit = WallsDirectionReversingUndoableEdit;
69153     WallsDirectionReversingUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.WallsDirectionReversingUndoableEdit";
69154     WallsDirectionReversingUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
69155     /**
69156      * Undoable edit for splitting wall.
69157      * @param {PlanController} controller
69158      * @param {UserPreferences} preferences
69159      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
69160      * @param {boolean} oldBasePlanLocked
69161      * @param {boolean} oldAllLevelsSelection
69162      * @param {PlanController.JoinedWall} splitJoinedWall
69163      * @param {PlanController.JoinedWall} firstJoinedWall
69164      * @param {PlanController.JoinedWall} secondJoinedWall
69165      * @param {boolean} newBasePlanLocked
69166      * @class
69167      * @extends LocalizedUndoableEdit
69168      */
69169     var WallSplittingUndoableEdit = /** @class */ (function (_super) {
69170         __extends(WallSplittingUndoableEdit, _super);
69171         function WallSplittingUndoableEdit(controller, preferences, oldSelection, oldBasePlanLocked, oldAllLevelsSelection, splitJoinedWall, firstJoinedWall, secondJoinedWall, newBasePlanLocked) {
69172             var _this = _super.call(this, preferences, PlanController, "undoSplitWallName") || this;
69173             if (_this.controller === undefined) {
69174                 _this.controller = null;
69175             }
69176             if (_this.oldSelection === undefined) {
69177                 _this.oldSelection = null;
69178             }
69179             if (_this.oldBasePlanLocked === undefined) {
69180                 _this.oldBasePlanLocked = false;
69181             }
69182             if (_this.oldAllLevelsSelection === undefined) {
69183                 _this.oldAllLevelsSelection = false;
69184             }
69185             if (_this.splitJoinedWall === undefined) {
69186                 _this.splitJoinedWall = null;
69187             }
69188             if (_this.firstJoinedWall === undefined) {
69189                 _this.firstJoinedWall = null;
69190             }
69191             if (_this.secondJoinedWall === undefined) {
69192                 _this.secondJoinedWall = null;
69193             }
69194             if (_this.newBasePlanLocked === undefined) {
69195                 _this.newBasePlanLocked = false;
69196             }
69197             _this.controller = controller;
69198             _this.oldSelection = oldSelection;
69199             _this.oldBasePlanLocked = oldBasePlanLocked;
69200             _this.oldAllLevelsSelection = oldAllLevelsSelection;
69201             _this.splitJoinedWall = splitJoinedWall;
69202             _this.firstJoinedWall = firstJoinedWall;
69203             _this.secondJoinedWall = secondJoinedWall;
69204             _this.newBasePlanLocked = newBasePlanLocked;
69205             return _this;
69206         }
69207         /**
69208          *
69209          */
69210         WallSplittingUndoableEdit.prototype.undo = function () {
69211             _super.prototype.undo.call(this);
69212             this.controller.doDeleteWalls([this.firstJoinedWall, this.secondJoinedWall], this.oldBasePlanLocked);
69213             this.controller.doAddWalls([this.splitJoinedWall], this.oldBasePlanLocked);
69214             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.oldSelection.slice(0), this.oldAllLevelsSelection);
69215         };
69216         /**
69217          *
69218          */
69219         WallSplittingUndoableEdit.prototype.redo = function () {
69220             _super.prototype.redo.call(this);
69221             this.controller.doDeleteWalls([this.splitJoinedWall], this.newBasePlanLocked);
69222             this.controller.doAddWalls([this.firstJoinedWall, this.secondJoinedWall], this.newBasePlanLocked);
69223             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ [this.firstJoinedWall.getWall()].slice(0), false);
69224         };
69225         return WallSplittingUndoableEdit;
69226     }(LocalizedUndoableEdit));
69227     PlanController.WallSplittingUndoableEdit = WallSplittingUndoableEdit;
69228     WallSplittingUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.WallSplittingUndoableEdit";
69229     WallSplittingUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
69230     /**
69231      * Undoable edit for text style modification.
69232      * @param {PlanController} controller
69233      * @param {UserPreferences} preferences
69234      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
69235      * @param {boolean} allLevelsSelection
69236      * @param {com.eteks.sweethome3d.model.TextStyle[]} oldStyles
69237      * @param {com.eteks.sweethome3d.model.Selectable[]} items
69238      * @param {com.eteks.sweethome3d.model.TextStyle[]} styles
69239      * @class
69240      * @extends LocalizedUndoableEdit
69241      */
69242     var TextStyleModificationUndoableEdit = /** @class */ (function (_super) {
69243         __extends(TextStyleModificationUndoableEdit, _super);
69244         function TextStyleModificationUndoableEdit(controller, preferences, oldSelection, allLevelsSelection, oldStyles, items, styles) {
69245             var _this = _super.call(this, preferences, PlanController, "undoModifyTextStyleName") || this;
69246             if (_this.controller === undefined) {
69247                 _this.controller = null;
69248             }
69249             if (_this.oldSelection === undefined) {
69250                 _this.oldSelection = null;
69251             }
69252             if (_this.allLevelsSelection === undefined) {
69253                 _this.allLevelsSelection = false;
69254             }
69255             if (_this.oldStyles === undefined) {
69256                 _this.oldStyles = null;
69257             }
69258             if (_this.items === undefined) {
69259                 _this.items = null;
69260             }
69261             if (_this.styles === undefined) {
69262                 _this.styles = null;
69263             }
69264             _this.controller = controller;
69265             _this.oldSelection = oldSelection;
69266             _this.allLevelsSelection = allLevelsSelection;
69267             _this.oldStyles = oldStyles;
69268             _this.items = items;
69269             _this.styles = styles;
69270             return _this;
69271         }
69272         /**
69273          *
69274          */
69275         TextStyleModificationUndoableEdit.prototype.undo = function () {
69276             _super.prototype.undo.call(this);
69277             PlanController.doModifyTextStyle(this.items, this.oldStyles);
69278             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.oldSelection.slice(0), this.allLevelsSelection);
69279         };
69280         /**
69281          *
69282          */
69283         TextStyleModificationUndoableEdit.prototype.redo = function () {
69284             _super.prototype.redo.call(this);
69285             PlanController.doModifyTextStyle(this.items, this.styles);
69286             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.oldSelection.slice(0), this.allLevelsSelection);
69287         };
69288         return TextStyleModificationUndoableEdit;
69289     }(LocalizedUndoableEdit));
69290     PlanController.TextStyleModificationUndoableEdit = TextStyleModificationUndoableEdit;
69291     TextStyleModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.TextStyleModificationUndoableEdit";
69292     TextStyleModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
69293     /**
69294      * Undoable edit for level addition.
69295      * @param {PlanController} controller
69296      * @param {Home} home
69297      * @param {UserPreferences} preferences
69298      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
69299      * @param {boolean} allLevelsSelection
69300      * @param {Level} oldSelectedLevel
69301      * @param {Level} level0
69302      * @param {BackgroundImage} homeBackgroundImage
69303      * @param {Level} newLevel
69304      * @class
69305      * @extends LocalizedUndoableEdit
69306      */
69307     var LevelAdditionUndoableEdit = /** @class */ (function (_super) {
69308         __extends(LevelAdditionUndoableEdit, _super);
69309         function LevelAdditionUndoableEdit(controller, home, preferences, oldSelection, allLevelsSelection, oldSelectedLevel, level0, homeBackgroundImage, newLevel) {
69310             var _this = _super.call(this, preferences, PlanController, "undoAddLevel") || this;
69311             if (_this.controller === undefined) {
69312                 _this.controller = null;
69313             }
69314             if (_this.home === undefined) {
69315                 _this.home = null;
69316             }
69317             if (_this.oldSelection === undefined) {
69318                 _this.oldSelection = null;
69319             }
69320             if (_this.allLevelsSelection === undefined) {
69321                 _this.allLevelsSelection = false;
69322             }
69323             if (_this.oldSelectedLevel === undefined) {
69324                 _this.oldSelectedLevel = null;
69325             }
69326             if (_this.level0 === undefined) {
69327                 _this.level0 = null;
69328             }
69329             if (_this.homeBackgroundImage === undefined) {
69330                 _this.homeBackgroundImage = null;
69331             }
69332             if (_this.newLevel === undefined) {
69333                 _this.newLevel = null;
69334             }
69335             _this.controller = controller;
69336             _this.home = home;
69337             _this.oldSelection = oldSelection;
69338             _this.allLevelsSelection = allLevelsSelection;
69339             _this.oldSelectedLevel = oldSelectedLevel;
69340             _this.level0 = level0;
69341             _this.homeBackgroundImage = homeBackgroundImage;
69342             _this.newLevel = newLevel;
69343             return _this;
69344         }
69345         /**
69346          *
69347          */
69348         LevelAdditionUndoableEdit.prototype.undo = function () {
69349             _super.prototype.undo.call(this);
69350             this.controller.setSelectedLevel(this.oldSelectedLevel);
69351             this.home.deleteLevel(this.newLevel);
69352             if (this.level0 != null) {
69353                 this.home.setBackgroundImage(this.homeBackgroundImage);
69354                 this.controller.moveHomeItemsToLevel(this.oldSelectedLevel);
69355                 this.home.deleteLevel(this.level0);
69356             }
69357             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.oldSelection.slice(0), this.allLevelsSelection);
69358         };
69359         /**
69360          *
69361          */
69362         LevelAdditionUndoableEdit.prototype.redo = function () {
69363             _super.prototype.redo.call(this);
69364             if (this.level0 != null) {
69365                 this.home.addLevel(this.level0);
69366                 this.controller.moveHomeItemsToLevel(this.level0);
69367                 this.level0.setBackgroundImage(this.homeBackgroundImage);
69368                 this.home.setBackgroundImage(null);
69369             }
69370             this.home.addLevel(this.newLevel);
69371             this.controller.setSelectedLevel(this.newLevel);
69372         };
69373         return LevelAdditionUndoableEdit;
69374     }(LocalizedUndoableEdit));
69375     PlanController.LevelAdditionUndoableEdit = LevelAdditionUndoableEdit;
69376     LevelAdditionUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.LevelAdditionUndoableEdit";
69377     LevelAdditionUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
69378     /**
69379      * Undoable edit for level viewability modification.
69380      * @param {PlanController} controller
69381      * @param {UserPreferences} preferences
69382      * @param {Level} selectedLevel
69383      * @class
69384      * @extends LocalizedUndoableEdit
69385      */
69386     var LevelViewabilityModificationUndoableEdit = /** @class */ (function (_super) {
69387         __extends(LevelViewabilityModificationUndoableEdit, _super);
69388         function LevelViewabilityModificationUndoableEdit(controller, preferences, selectedLevel) {
69389             var _this = _super.call(this, preferences, PlanController, "undoModifyLevelViewabilityName") || this;
69390             if (_this.controller === undefined) {
69391                 _this.controller = null;
69392             }
69393             if (_this.selectedLevel === undefined) {
69394                 _this.selectedLevel = null;
69395             }
69396             _this.controller = controller;
69397             _this.selectedLevel = selectedLevel;
69398             return _this;
69399         }
69400         /**
69401          *
69402          */
69403         LevelViewabilityModificationUndoableEdit.prototype.undo = function () {
69404             _super.prototype.undo.call(this);
69405             this.controller.setSelectedLevel(this.selectedLevel);
69406             this.selectedLevel.setViewable(!this.selectedLevel.isViewable());
69407         };
69408         /**
69409          *
69410          */
69411         LevelViewabilityModificationUndoableEdit.prototype.redo = function () {
69412             _super.prototype.redo.call(this);
69413             this.controller.setSelectedLevel(this.selectedLevel);
69414             this.selectedLevel.setViewable(!this.selectedLevel.isViewable());
69415         };
69416         return LevelViewabilityModificationUndoableEdit;
69417     }(LocalizedUndoableEdit));
69418     PlanController.LevelViewabilityModificationUndoableEdit = LevelViewabilityModificationUndoableEdit;
69419     LevelViewabilityModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.LevelViewabilityModificationUndoableEdit";
69420     LevelViewabilityModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
69421     /**
69422      * Undoable edit for the viewability modification of multiple levels.
69423      * @param {PlanController} controller
69424      * @param {UserPreferences} preferences
69425      * @param {Level} selectedLevel
69426      * @param {boolean} selectedLevelViewable
69427      * @param {com.eteks.sweethome3d.model.Level[]} viewableLevels
69428      * @class
69429      * @extends LocalizedUndoableEdit
69430      */
69431     var LevelsViewabilityModificationUndoableEdit = /** @class */ (function (_super) {
69432         __extends(LevelsViewabilityModificationUndoableEdit, _super);
69433         function LevelsViewabilityModificationUndoableEdit(controller, preferences, selectedLevel, selectedLevelViewable, viewableLevels) {
69434             var _this = _super.call(this, preferences, PlanController, "undoModifyLevelViewabilityName") || this;
69435             if (_this.controller === undefined) {
69436                 _this.controller = null;
69437             }
69438             if (_this.selectedLevel === undefined) {
69439                 _this.selectedLevel = null;
69440             }
69441             if (_this.selectedLevelViewable === undefined) {
69442                 _this.selectedLevelViewable = false;
69443             }
69444             if (_this.viewableLevels === undefined) {
69445                 _this.viewableLevels = null;
69446             }
69447             _this.controller = controller;
69448             _this.selectedLevel = selectedLevel;
69449             _this.selectedLevelViewable = selectedLevelViewable;
69450             _this.viewableLevels = viewableLevels;
69451             return _this;
69452         }
69453         /**
69454          *
69455          */
69456         LevelsViewabilityModificationUndoableEdit.prototype.undo = function () {
69457             _super.prototype.undo.call(this);
69458             this.controller.setSelectedLevel(this.selectedLevel);
69459             PlanController.setLevelsViewability(this.viewableLevels, true);
69460             this.selectedLevel.setViewable(this.selectedLevelViewable);
69461         };
69462         /**
69463          *
69464          */
69465         LevelsViewabilityModificationUndoableEdit.prototype.redo = function () {
69466             _super.prototype.redo.call(this);
69467             this.controller.setSelectedLevel(this.selectedLevel);
69468             PlanController.setLevelsViewability(this.viewableLevels, false);
69469             this.selectedLevel.setViewable(true);
69470         };
69471         return LevelsViewabilityModificationUndoableEdit;
69472     }(LocalizedUndoableEdit));
69473     PlanController.LevelsViewabilityModificationUndoableEdit = LevelsViewabilityModificationUndoableEdit;
69474     LevelsViewabilityModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.LevelsViewabilityModificationUndoableEdit";
69475     LevelsViewabilityModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
69476     /**
69477      * Undoable edit for the viewability modification of all levels.
69478      * @param {PlanController} controller
69479      * @param {UserPreferences} preferences
69480      * @param {Level} selectedLevel
69481      * @param {com.eteks.sweethome3d.model.Level[]} unviewableLevels
69482      * @class
69483      * @extends LocalizedUndoableEdit
69484      */
69485     var AllLevelsViewabilityModificationUndoableEdit = /** @class */ (function (_super) {
69486         __extends(AllLevelsViewabilityModificationUndoableEdit, _super);
69487         function AllLevelsViewabilityModificationUndoableEdit(controller, preferences, selectedLevel, unviewableLevels) {
69488             var _this = _super.call(this, preferences, PlanController, "undoModifyLevelViewabilityName") || this;
69489             if (_this.controller === undefined) {
69490                 _this.controller = null;
69491             }
69492             if (_this.selectedLevel === undefined) {
69493                 _this.selectedLevel = null;
69494             }
69495             if (_this.unviewableLevels === undefined) {
69496                 _this.unviewableLevels = null;
69497             }
69498             _this.controller = controller;
69499             _this.selectedLevel = selectedLevel;
69500             _this.unviewableLevels = unviewableLevels;
69501             return _this;
69502         }
69503         /**
69504          *
69505          */
69506         AllLevelsViewabilityModificationUndoableEdit.prototype.undo = function () {
69507             _super.prototype.undo.call(this);
69508             this.controller.setSelectedLevel(this.selectedLevel);
69509             PlanController.setLevelsViewability(this.unviewableLevels, false);
69510         };
69511         /**
69512          *
69513          */
69514         AllLevelsViewabilityModificationUndoableEdit.prototype.redo = function () {
69515             _super.prototype.redo.call(this);
69516             this.controller.setSelectedLevel(this.selectedLevel);
69517             PlanController.setLevelsViewability(this.unviewableLevels, true);
69518         };
69519         return AllLevelsViewabilityModificationUndoableEdit;
69520     }(LocalizedUndoableEdit));
69521     PlanController.AllLevelsViewabilityModificationUndoableEdit = AllLevelsViewabilityModificationUndoableEdit;
69522     AllLevelsViewabilityModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.AllLevelsViewabilityModificationUndoableEdit";
69523     AllLevelsViewabilityModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
69524     /**
69525      * Undoable edit for the level deletion.
69526      * @param {PlanController} controller
69527      * @param {Home} home
69528      * @param {UserPreferences} preferences
69529      * @param {Level} oldSelectedLevel
69530      * @param {Level} remainingLevel
69531      * @param {number} remainingLevelElevation
69532      * @param {boolean} remainingLevelViewable
69533      * @class
69534      * @extends LocalizedUndoableEdit
69535      */
69536     var LevelDeletionUndoableEdit = /** @class */ (function (_super) {
69537         __extends(LevelDeletionUndoableEdit, _super);
69538         function LevelDeletionUndoableEdit(controller, home, preferences, oldSelectedLevel, remainingLevel, remainingLevelElevation, remainingLevelViewable) {
69539             var _this = _super.call(this, preferences, PlanController, "undoDeleteSelectedLevel") || this;
69540             if (_this.controller === undefined) {
69541                 _this.controller = null;
69542             }
69543             if (_this.home === undefined) {
69544                 _this.home = null;
69545             }
69546             if (_this.oldSelectedLevel === undefined) {
69547                 _this.oldSelectedLevel = null;
69548             }
69549             if (_this.remainingLevel === undefined) {
69550                 _this.remainingLevel = null;
69551             }
69552             if (_this.remainingLevelElevation === undefined) {
69553                 _this.remainingLevelElevation = null;
69554             }
69555             if (_this.remainingLevelViewable === undefined) {
69556                 _this.remainingLevelViewable = false;
69557             }
69558             _this.controller = controller;
69559             _this.home = home;
69560             _this.oldSelectedLevel = oldSelectedLevel;
69561             _this.remainingLevel = remainingLevel;
69562             _this.remainingLevelElevation = remainingLevelElevation;
69563             _this.remainingLevelViewable = remainingLevelViewable;
69564             return _this;
69565         }
69566         /**
69567          *
69568          */
69569         LevelDeletionUndoableEdit.prototype.undo = function () {
69570             _super.prototype.undo.call(this);
69571             if (this.remainingLevel != null) {
69572                 this.remainingLevel.setElevation(this.remainingLevelElevation);
69573                 this.remainingLevel.setViewable(this.remainingLevelViewable);
69574             }
69575             this.home.addLevel(this.oldSelectedLevel);
69576             this.controller.setSelectedLevel(this.oldSelectedLevel);
69577         };
69578         /**
69579          *
69580          */
69581         LevelDeletionUndoableEdit.prototype.redo = function () {
69582             _super.prototype.redo.call(this);
69583             this.home.deleteLevel(this.oldSelectedLevel);
69584             if (this.remainingLevel != null) {
69585                 this.remainingLevel.setElevation(0);
69586                 this.remainingLevel.setViewable(true);
69587             }
69588         };
69589         return LevelDeletionUndoableEdit;
69590     }(LocalizedUndoableEdit));
69591     PlanController.LevelDeletionUndoableEdit = LevelDeletionUndoableEdit;
69592     LevelDeletionUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.LevelDeletionUndoableEdit";
69593     LevelDeletionUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
69594     /**
69595      * Undoable edit for room point addition.
69596      * @param {PlanController} controller
69597      * @param {UserPreferences} preferences
69598      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
69599      * @param {Room} room
69600      * @param {number} index
69601      * @param {number} x
69602      * @param {number} y
69603      * @class
69604      * @extends LocalizedUndoableEdit
69605      */
69606     var RoomPointAdditionUndoableEdit = /** @class */ (function (_super) {
69607         __extends(RoomPointAdditionUndoableEdit, _super);
69608         function RoomPointAdditionUndoableEdit(controller, preferences, oldSelection, room, index, x, y) {
69609             var _this = _super.call(this, preferences, PlanController, "undoAddRoomPointName") || this;
69610             if (_this.controller === undefined) {
69611                 _this.controller = null;
69612             }
69613             if (_this.oldSelection === undefined) {
69614                 _this.oldSelection = null;
69615             }
69616             if (_this.room === undefined) {
69617                 _this.room = null;
69618             }
69619             if (_this.index === undefined) {
69620                 _this.index = 0;
69621             }
69622             if (_this.x === undefined) {
69623                 _this.x = 0;
69624             }
69625             if (_this.y === undefined) {
69626                 _this.y = 0;
69627             }
69628             _this.controller = controller;
69629             _this.oldSelection = oldSelection;
69630             _this.room = room;
69631             _this.index = index;
69632             _this.x = x;
69633             _this.y = y;
69634             return _this;
69635         }
69636         /**
69637          *
69638          */
69639         RoomPointAdditionUndoableEdit.prototype.undo = function () {
69640             _super.prototype.undo.call(this);
69641             this.room.removePoint(this.index);
69642             this.controller.selectAndShowItems$java_util_List(/* asList */ this.oldSelection.slice(0));
69643         };
69644         /**
69645          *
69646          */
69647         RoomPointAdditionUndoableEdit.prototype.redo = function () {
69648             _super.prototype.redo.call(this);
69649             this.room.addPoint$float$float$int(this.x, this.y, this.index);
69650             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.room].slice(0));
69651         };
69652         return RoomPointAdditionUndoableEdit;
69653     }(LocalizedUndoableEdit));
69654     PlanController.RoomPointAdditionUndoableEdit = RoomPointAdditionUndoableEdit;
69655     RoomPointAdditionUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RoomPointAdditionUndoableEdit";
69656     RoomPointAdditionUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
69657     /**
69658      * Undoable edit for room point deletion.
69659      * @param {PlanController} controller
69660      * @param {UserPreferences} preferences
69661      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
69662      * @param {Room} room
69663      * @param {number} index
69664      * @param {number} xPoint
69665      * @param {number} yPoint
69666      * @class
69667      * @extends LocalizedUndoableEdit
69668      */
69669     var RoomPointDeletionUndoableEdit = /** @class */ (function (_super) {
69670         __extends(RoomPointDeletionUndoableEdit, _super);
69671         function RoomPointDeletionUndoableEdit(controller, preferences, oldSelection, room, index, xPoint, yPoint) {
69672             var _this = _super.call(this, preferences, PlanController, "undoDeleteRoomPointName") || this;
69673             if (_this.controller === undefined) {
69674                 _this.controller = null;
69675             }
69676             if (_this.oldSelection === undefined) {
69677                 _this.oldSelection = null;
69678             }
69679             if (_this.room === undefined) {
69680                 _this.room = null;
69681             }
69682             if (_this.index === undefined) {
69683                 _this.index = 0;
69684             }
69685             if (_this.xPoint === undefined) {
69686                 _this.xPoint = 0;
69687             }
69688             if (_this.yPoint === undefined) {
69689                 _this.yPoint = 0;
69690             }
69691             _this.controller = controller;
69692             _this.oldSelection = oldSelection;
69693             _this.room = room;
69694             _this.index = index;
69695             _this.xPoint = xPoint;
69696             _this.yPoint = yPoint;
69697             return _this;
69698         }
69699         /**
69700          *
69701          */
69702         RoomPointDeletionUndoableEdit.prototype.undo = function () {
69703             _super.prototype.undo.call(this);
69704             this.room.addPoint$float$float$int(this.xPoint, this.yPoint, this.index);
69705             this.controller.selectAndShowItems$java_util_List(/* asList */ this.oldSelection.slice(0));
69706         };
69707         /**
69708          *
69709          */
69710         RoomPointDeletionUndoableEdit.prototype.redo = function () {
69711             _super.prototype.redo.call(this);
69712             this.room.removePoint(this.index);
69713             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.room].slice(0));
69714         };
69715         return RoomPointDeletionUndoableEdit;
69716     }(LocalizedUndoableEdit));
69717     PlanController.RoomPointDeletionUndoableEdit = RoomPointDeletionUndoableEdit;
69718     RoomPointDeletionUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RoomPointDeletionUndoableEdit";
69719     RoomPointDeletionUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
69720     /**
69721      * Undoable edit for room points modification.
69722      * @param {PlanController} controller
69723      * @param {UserPreferences} preferences
69724      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
69725      * @param {Room} room
69726      * @param {float[][]} oldPoints
69727      * @param {float[][]} newPoints
69728      * @class
69729      * @extends LocalizedUndoableEdit
69730      */
69731     var RoomPointsModificationUndoableEdit = /** @class */ (function (_super) {
69732         __extends(RoomPointsModificationUndoableEdit, _super);
69733         function RoomPointsModificationUndoableEdit(controller, preferences, oldSelection, room, oldPoints, newPoints) {
69734             var _this = _super.call(this, preferences, PlanController, "undoRecomputeRoomPointsName") || this;
69735             if (_this.controller === undefined) {
69736                 _this.controller = null;
69737             }
69738             if (_this.oldSelection === undefined) {
69739                 _this.oldSelection = null;
69740             }
69741             if (_this.room === undefined) {
69742                 _this.room = null;
69743             }
69744             if (_this.oldPoints === undefined) {
69745                 _this.oldPoints = null;
69746             }
69747             if (_this.newPoints === undefined) {
69748                 _this.newPoints = null;
69749             }
69750             _this.controller = controller;
69751             _this.oldSelection = oldSelection;
69752             _this.room = room;
69753             _this.oldPoints = oldPoints;
69754             _this.newPoints = newPoints;
69755             return _this;
69756         }
69757         /**
69758          *
69759          */
69760         RoomPointsModificationUndoableEdit.prototype.undo = function () {
69761             _super.prototype.undo.call(this);
69762             this.room.setPoints(this.oldPoints);
69763             this.controller.selectAndShowItems$java_util_List(/* asList */ this.oldSelection.slice(0));
69764         };
69765         /**
69766          *
69767          */
69768         RoomPointsModificationUndoableEdit.prototype.redo = function () {
69769             _super.prototype.redo.call(this);
69770             this.room.setPoints(this.newPoints);
69771             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.room].slice(0));
69772         };
69773         return RoomPointsModificationUndoableEdit;
69774     }(LocalizedUndoableEdit));
69775     PlanController.RoomPointsModificationUndoableEdit = RoomPointsModificationUndoableEdit;
69776     RoomPointsModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RoomPointsModificationUndoableEdit";
69777     RoomPointsModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
69778     /**
69779      * Undoable edit for items deletion start.
69780      * @param {PlanController} controller
69781      * @param {Home} home
69782      * @param {boolean} allLevelsSelection
69783      * @param {com.eteks.sweethome3d.model.Selectable[]} selectedItems
69784      * @class
69785      * @extends javax.swing.undo.AbstractUndoableEdit
69786      */
69787     var ItemsDeletionStartUndoableEdit = /** @class */ (function (_super) {
69788         __extends(ItemsDeletionStartUndoableEdit, _super);
69789         function ItemsDeletionStartUndoableEdit(controller, home, allLevelsSelection, selectedItems) {
69790             var _this = _super.call(this) || this;
69791             if (_this.controller === undefined) {
69792                 _this.controller = null;
69793             }
69794             if (_this.home === undefined) {
69795                 _this.home = null;
69796             }
69797             if (_this.allLevelsSelection === undefined) {
69798                 _this.allLevelsSelection = false;
69799             }
69800             if (_this.selectedItems === undefined) {
69801                 _this.selectedItems = null;
69802             }
69803             _this.controller = controller;
69804             _this.home = home;
69805             _this.allLevelsSelection = allLevelsSelection;
69806             _this.selectedItems = selectedItems;
69807             return _this;
69808         }
69809         /**
69810          *
69811          */
69812         ItemsDeletionStartUndoableEdit.prototype.undo = function () {
69813             _super.prototype.undo.call(this);
69814             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.selectedItems.slice(0), this.allLevelsSelection);
69815         };
69816         /**
69817          *
69818          */
69819         ItemsDeletionStartUndoableEdit.prototype.redo = function () {
69820             _super.prototype.redo.call(this);
69821             this.home.removeSelectionListener(this.controller.getSelectionListener());
69822         };
69823         return ItemsDeletionStartUndoableEdit;
69824     }(javax.swing.undo.AbstractUndoableEdit));
69825     PlanController.ItemsDeletionStartUndoableEdit = ItemsDeletionStartUndoableEdit;
69826     ItemsDeletionStartUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.ItemsDeletionStartUndoableEdit";
69827     ItemsDeletionStartUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
69828     /**
69829      * Undoable edit for items deletion end.
69830      * @param {PlanController} controller
69831      * @param {Home} home
69832      * @class
69833      * @extends javax.swing.undo.AbstractUndoableEdit
69834      */
69835     var ItemsDeletionEndUndoableEdit = /** @class */ (function (_super) {
69836         __extends(ItemsDeletionEndUndoableEdit, _super);
69837         function ItemsDeletionEndUndoableEdit(controller, home) {
69838             var _this = _super.call(this) || this;
69839             if (_this.controller === undefined) {
69840                 _this.controller = null;
69841             }
69842             if (_this.home === undefined) {
69843                 _this.home = null;
69844             }
69845             _this.controller = controller;
69846             _this.home = home;
69847             return _this;
69848         }
69849         /**
69850          *
69851          */
69852         ItemsDeletionEndUndoableEdit.prototype.redo = function () {
69853             _super.prototype.redo.call(this);
69854             this.home.addSelectionListener(this.controller.getSelectionListener());
69855         };
69856         return ItemsDeletionEndUndoableEdit;
69857     }(javax.swing.undo.AbstractUndoableEdit));
69858     PlanController.ItemsDeletionEndUndoableEdit = ItemsDeletionEndUndoableEdit;
69859     ItemsDeletionEndUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.ItemsDeletionEndUndoableEdit";
69860     ItemsDeletionEndUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
69861     /**
69862      * Undoable edit for items deletion.
69863      * @param {PlanController} controller
69864      * @param {UserPreferences} preferences
69865      * @param {boolean} basePlanLocked
69866      * @param {boolean} allLevelsSelection
69867      * @param {com.eteks.sweethome3d.model.Selectable[]} deletedItems
69868      * @param {com.eteks.sweethome3d.viewcontroller.PlanController.JoinedWall[]} joinedDeletedWalls
69869      * @param {com.eteks.sweethome3d.model.Room[]} rooms
69870      * @param {int[]} roomsIndices
69871      * @param {com.eteks.sweethome3d.model.Level[]} roomsLevels
69872      * @param {com.eteks.sweethome3d.model.DimensionLine[]} dimensionLines
69873      * @param {com.eteks.sweethome3d.model.Level[]} dimensionLinesLevels
69874      * @param {com.eteks.sweethome3d.model.Polyline[]} polylines
69875      * @param {int[]} polylinesIndices
69876      * @param {com.eteks.sweethome3d.model.Level[]} polylinesLevels
69877      * @param {com.eteks.sweethome3d.model.Label[]} labels
69878      * @param {com.eteks.sweethome3d.model.Level[]} labelsLevels
69879      * @class
69880      * @extends LocalizedUndoableEdit
69881      */
69882     var ItemsDeletionUndoableEdit = /** @class */ (function (_super) {
69883         __extends(ItemsDeletionUndoableEdit, _super);
69884         function ItemsDeletionUndoableEdit(controller, preferences, basePlanLocked, allLevelsSelection, deletedItems, joinedDeletedWalls, rooms, roomsIndices, roomsLevels, dimensionLines, dimensionLinesLevels, polylines, polylinesIndices, polylinesLevels, labels, labelsLevels) {
69885             var _this = _super.call(this, preferences, PlanController, "undoDeleteSelectionName") || this;
69886             if (_this.controller === undefined) {
69887                 _this.controller = null;
69888             }
69889             if (_this.basePlanLocked === undefined) {
69890                 _this.basePlanLocked = false;
69891             }
69892             if (_this.allLevelsSelection === undefined) {
69893                 _this.allLevelsSelection = false;
69894             }
69895             if (_this.deletedItems === undefined) {
69896                 _this.deletedItems = null;
69897             }
69898             if (_this.joinedDeletedWalls === undefined) {
69899                 _this.joinedDeletedWalls = null;
69900             }
69901             if (_this.rooms === undefined) {
69902                 _this.rooms = null;
69903             }
69904             if (_this.roomsIndices === undefined) {
69905                 _this.roomsIndices = null;
69906             }
69907             if (_this.roomsLevels === undefined) {
69908                 _this.roomsLevels = null;
69909             }
69910             if (_this.dimensionLines === undefined) {
69911                 _this.dimensionLines = null;
69912             }
69913             if (_this.dimensionLinesLevels === undefined) {
69914                 _this.dimensionLinesLevels = null;
69915             }
69916             if (_this.polylines === undefined) {
69917                 _this.polylines = null;
69918             }
69919             if (_this.polylinesIndices === undefined) {
69920                 _this.polylinesIndices = null;
69921             }
69922             if (_this.polylinesLevels === undefined) {
69923                 _this.polylinesLevels = null;
69924             }
69925             if (_this.labels === undefined) {
69926                 _this.labels = null;
69927             }
69928             if (_this.labelsLevels === undefined) {
69929                 _this.labelsLevels = null;
69930             }
69931             _this.controller = controller;
69932             _this.basePlanLocked = basePlanLocked;
69933             _this.allLevelsSelection = allLevelsSelection;
69934             _this.deletedItems = deletedItems;
69935             _this.joinedDeletedWalls = joinedDeletedWalls;
69936             _this.rooms = rooms;
69937             _this.roomsIndices = roomsIndices;
69938             _this.roomsLevels = roomsLevels;
69939             _this.dimensionLines = dimensionLines;
69940             _this.dimensionLinesLevels = dimensionLinesLevels;
69941             _this.polylines = polylines;
69942             _this.polylinesIndices = polylinesIndices;
69943             _this.polylinesLevels = polylinesLevels;
69944             _this.labels = labels;
69945             _this.labelsLevels = labelsLevels;
69946             return _this;
69947         }
69948         /**
69949          *
69950          */
69951         ItemsDeletionUndoableEdit.prototype.undo = function () {
69952             _super.prototype.undo.call(this);
69953             this.controller.doAddWalls(this.joinedDeletedWalls, this.basePlanLocked);
69954             this.controller.doAddRooms(this.rooms, this.roomsIndices, this.roomsLevels, null, this.basePlanLocked);
69955             this.controller.doAddDimensionLines(this.dimensionLines, this.dimensionLinesLevels, null, this.basePlanLocked);
69956             this.controller.doAddPolylines(this.polylines, this.polylinesIndices, this.polylinesLevels, null, this.basePlanLocked);
69957             this.controller.doAddLabels(this.labels, this.labelsLevels, null, this.basePlanLocked);
69958             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.deletedItems.slice(0), this.allLevelsSelection);
69959         };
69960         /**
69961          *
69962          */
69963         ItemsDeletionUndoableEdit.prototype.redo = function () {
69964             _super.prototype.redo.call(this);
69965             this.controller.selectItems$java_util_List(/* asList */ this.deletedItems.slice(0));
69966             this.controller.doDeleteWalls(this.joinedDeletedWalls, this.basePlanLocked);
69967             this.controller.doDeleteRooms(this.rooms, this.basePlanLocked);
69968             this.controller.doDeleteDimensionLines(this.dimensionLines, this.basePlanLocked);
69969             this.controller.doDeletePolylines(this.polylines, this.basePlanLocked);
69970             this.controller.doDeleteLabels(this.labels, this.basePlanLocked);
69971         };
69972         return ItemsDeletionUndoableEdit;
69973     }(LocalizedUndoableEdit));
69974     PlanController.ItemsDeletionUndoableEdit = ItemsDeletionUndoableEdit;
69975     ItemsDeletionUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.ItemsDeletionUndoableEdit";
69976     ItemsDeletionUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
69977     /**
69978      * Undoable edit for items addition end.
69979      * @extends LocalizedUndoableEdit
69980      * @class
69981      */
69982     var ItemsAdditionEndUndoableEdit = /** @class */ (function (_super) {
69983         __extends(ItemsAdditionEndUndoableEdit, _super);
69984         function ItemsAdditionEndUndoableEdit(home, preferences, items) {
69985             var _this = _super.call(this, preferences, PlanController, "undoAddItemsName") || this;
69986             if (_this.home === undefined) {
69987                 _this.home = null;
69988             }
69989             if (_this.items === undefined) {
69990                 _this.items = null;
69991             }
69992             _this.home = home;
69993             _this.items = items;
69994             return _this;
69995         }
69996         /**
69997          *
69998          */
69999         ItemsAdditionEndUndoableEdit.prototype.redo = function () {
70000             _super.prototype.redo.call(this);
70001             this.home.setSelectedItems(/* asList */ this.items.slice(0));
70002         };
70003         return ItemsAdditionEndUndoableEdit;
70004     }(LocalizedUndoableEdit));
70005     PlanController.ItemsAdditionEndUndoableEdit = ItemsAdditionEndUndoableEdit;
70006     ItemsAdditionEndUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.ItemsAdditionEndUndoableEdit";
70007     ItemsAdditionEndUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
70008     /**
70009      * Undoable edit for walls creation.
70010      * @param {PlanController} controller
70011      * @param {UserPreferences} preferences
70012      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
70013      * @param {boolean} oldBasePlanLocked
70014      * @param {boolean} oldAllLevelsSelection
70015      * @param {com.eteks.sweethome3d.viewcontroller.PlanController.JoinedWall[]} joinedNewWalls
70016      * @param {boolean} newBasePlanLocked
70017      * @class
70018      * @extends LocalizedUndoableEdit
70019      */
70020     var WallsCreationUndoableEdit = /** @class */ (function (_super) {
70021         __extends(WallsCreationUndoableEdit, _super);
70022         function WallsCreationUndoableEdit(controller, preferences, oldSelection, oldBasePlanLocked, oldAllLevelsSelection, joinedNewWalls, newBasePlanLocked) {
70023             var _this = _super.call(this, preferences, PlanController, "undoCreateWallsName") || this;
70024             if (_this.controller === undefined) {
70025                 _this.controller = null;
70026             }
70027             if (_this.oldSelection === undefined) {
70028                 _this.oldSelection = null;
70029             }
70030             if (_this.oldBasePlanLocked === undefined) {
70031                 _this.oldBasePlanLocked = false;
70032             }
70033             if (_this.oldAllLevelsSelection === undefined) {
70034                 _this.oldAllLevelsSelection = false;
70035             }
70036             if (_this.joinedNewWalls === undefined) {
70037                 _this.joinedNewWalls = null;
70038             }
70039             if (_this.newBasePlanLocked === undefined) {
70040                 _this.newBasePlanLocked = false;
70041             }
70042             _this.controller = controller;
70043             _this.oldSelection = oldSelection;
70044             _this.oldBasePlanLocked = oldBasePlanLocked;
70045             _this.oldAllLevelsSelection = oldAllLevelsSelection;
70046             _this.joinedNewWalls = joinedNewWalls;
70047             _this.newBasePlanLocked = newBasePlanLocked;
70048             return _this;
70049         }
70050         /**
70051          *
70052          */
70053         WallsCreationUndoableEdit.prototype.undo = function () {
70054             _super.prototype.undo.call(this);
70055             this.controller.doDeleteWalls(this.joinedNewWalls, this.oldBasePlanLocked);
70056             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.oldSelection.slice(0), this.oldAllLevelsSelection);
70057         };
70058         /**
70059          *
70060          */
70061         WallsCreationUndoableEdit.prototype.redo = function () {
70062             _super.prototype.redo.call(this);
70063             this.controller.doAddWalls(this.joinedNewWalls, this.newBasePlanLocked);
70064             this.controller.selectAndShowItems$java_util_List$boolean(PlanController.JoinedWall.getWalls(this.joinedNewWalls), false);
70065         };
70066         return WallsCreationUndoableEdit;
70067     }(LocalizedUndoableEdit));
70068     PlanController.WallsCreationUndoableEdit = WallsCreationUndoableEdit;
70069     WallsCreationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.WallsCreationUndoableEdit";
70070     WallsCreationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
70071     /**
70072      * Undoable edit for rooms creation.
70073      * @param {PlanController} controller
70074      * @param {UserPreferences} preferences
70075      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
70076      * @param {boolean} oldBasePlanLocked
70077      * @param {boolean} oldAllLevelsSelection
70078      * @param {com.eteks.sweethome3d.model.Room[]} newRooms
70079      * @param {int[]} roomsIndex
70080      * @param {Level} roomsLevel
70081      * @param {boolean} newBasePlanLocked
70082      * @class
70083      * @extends LocalizedUndoableEdit
70084      */
70085     var RoomsCreationUndoableEdit = /** @class */ (function (_super) {
70086         __extends(RoomsCreationUndoableEdit, _super);
70087         function RoomsCreationUndoableEdit(controller, preferences, oldSelection, oldBasePlanLocked, oldAllLevelsSelection, newRooms, roomsIndex, roomsLevel, newBasePlanLocked) {
70088             var _this = _super.call(this, preferences, PlanController, "undoCreateRoomsName") || this;
70089             if (_this.controller === undefined) {
70090                 _this.controller = null;
70091             }
70092             if (_this.oldSelection === undefined) {
70093                 _this.oldSelection = null;
70094             }
70095             if (_this.oldBasePlanLocked === undefined) {
70096                 _this.oldBasePlanLocked = false;
70097             }
70098             if (_this.oldAllLevelsSelection === undefined) {
70099                 _this.oldAllLevelsSelection = false;
70100             }
70101             if (_this.newRooms === undefined) {
70102                 _this.newRooms = null;
70103             }
70104             if (_this.roomsIndex === undefined) {
70105                 _this.roomsIndex = null;
70106             }
70107             if (_this.roomsLevel === undefined) {
70108                 _this.roomsLevel = null;
70109             }
70110             if (_this.newBasePlanLocked === undefined) {
70111                 _this.newBasePlanLocked = false;
70112             }
70113             _this.controller = controller;
70114             _this.oldSelection = oldSelection;
70115             _this.oldBasePlanLocked = oldBasePlanLocked;
70116             _this.oldAllLevelsSelection = oldAllLevelsSelection;
70117             _this.newRooms = newRooms;
70118             _this.roomsIndex = roomsIndex;
70119             _this.roomsLevel = roomsLevel;
70120             _this.newBasePlanLocked = newBasePlanLocked;
70121             return _this;
70122         }
70123         /**
70124          *
70125          */
70126         RoomsCreationUndoableEdit.prototype.undo = function () {
70127             _super.prototype.undo.call(this);
70128             this.controller.doDeleteRooms(this.newRooms, this.oldBasePlanLocked);
70129             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.oldSelection.slice(0), this.oldAllLevelsSelection);
70130         };
70131         /**
70132          *
70133          */
70134         RoomsCreationUndoableEdit.prototype.redo = function () {
70135             _super.prototype.redo.call(this);
70136             this.controller.doAddRooms(this.newRooms, this.roomsIndex, null, this.roomsLevel, this.newBasePlanLocked);
70137             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.newRooms.slice(0), false);
70138         };
70139         return RoomsCreationUndoableEdit;
70140     }(LocalizedUndoableEdit));
70141     PlanController.RoomsCreationUndoableEdit = RoomsCreationUndoableEdit;
70142     RoomsCreationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RoomsCreationUndoableEdit";
70143     RoomsCreationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
70144     /**
70145      * Undoable edit for dimension lines creation.
70146      * @param {PlanController} controller
70147      * @param {UserPreferences} preferences
70148      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
70149      * @param {boolean} oldBasePlanLocked
70150      * @param {boolean} oldAllLevelsSelection
70151      * @param {com.eteks.sweethome3d.model.DimensionLine[]} dimensionLines
70152      * @param {Level} dimensionLinesLevel
70153      * @param {boolean} newBasePlanLocked
70154      * @class
70155      * @extends LocalizedUndoableEdit
70156      */
70157     var DimensionLinesCreationUndoableEdit = /** @class */ (function (_super) {
70158         __extends(DimensionLinesCreationUndoableEdit, _super);
70159         function DimensionLinesCreationUndoableEdit(controller, preferences, oldSelection, oldBasePlanLocked, oldAllLevelsSelection, dimensionLines, dimensionLinesLevel, newBasePlanLocked) {
70160             var _this = _super.call(this, preferences, PlanController, "undoCreateDimensionLinesName") || this;
70161             if (_this.controller === undefined) {
70162                 _this.controller = null;
70163             }
70164             if (_this.oldSelection === undefined) {
70165                 _this.oldSelection = null;
70166             }
70167             if (_this.oldBasePlanLocked === undefined) {
70168                 _this.oldBasePlanLocked = false;
70169             }
70170             if (_this.oldAllLevelsSelection === undefined) {
70171                 _this.oldAllLevelsSelection = false;
70172             }
70173             if (_this.dimensionLines === undefined) {
70174                 _this.dimensionLines = null;
70175             }
70176             if (_this.dimensionLinesLevel === undefined) {
70177                 _this.dimensionLinesLevel = null;
70178             }
70179             if (_this.newBasePlanLocked === undefined) {
70180                 _this.newBasePlanLocked = false;
70181             }
70182             _this.controller = controller;
70183             _this.oldSelection = oldSelection;
70184             _this.oldBasePlanLocked = oldBasePlanLocked;
70185             _this.oldAllLevelsSelection = oldAllLevelsSelection;
70186             _this.dimensionLines = dimensionLines;
70187             _this.dimensionLinesLevel = dimensionLinesLevel;
70188             _this.newBasePlanLocked = newBasePlanLocked;
70189             return _this;
70190         }
70191         /**
70192          *
70193          */
70194         DimensionLinesCreationUndoableEdit.prototype.undo = function () {
70195             _super.prototype.undo.call(this);
70196             this.controller.doDeleteDimensionLines(this.dimensionLines, this.oldBasePlanLocked);
70197             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.oldSelection.slice(0), this.oldAllLevelsSelection);
70198         };
70199         /**
70200          *
70201          */
70202         DimensionLinesCreationUndoableEdit.prototype.redo = function () {
70203             _super.prototype.redo.call(this);
70204             this.controller.doAddDimensionLines(this.dimensionLines, null, this.dimensionLinesLevel, this.newBasePlanLocked);
70205             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.dimensionLines.slice(0), false);
70206         };
70207         return DimensionLinesCreationUndoableEdit;
70208     }(LocalizedUndoableEdit));
70209     PlanController.DimensionLinesCreationUndoableEdit = DimensionLinesCreationUndoableEdit;
70210     DimensionLinesCreationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.DimensionLinesCreationUndoableEdit";
70211     DimensionLinesCreationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
70212     /**
70213      * Undoable edit for polylines creation.
70214      * @param {PlanController} controller
70215      * @param {UserPreferences} preferences
70216      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
70217      * @param {boolean} oldBasePlanLocked
70218      * @param {boolean} oldAllLevelsSelection
70219      * @param {com.eteks.sweethome3d.model.Polyline[]} newPolylines
70220      * @param {int[]} polylinesIndex
70221      * @param {Level} polylinesLevel
70222      * @param {boolean} newBasePlanLocked
70223      * @class
70224      * @extends LocalizedUndoableEdit
70225      */
70226     var PolylinesCreationUndoableEdit = /** @class */ (function (_super) {
70227         __extends(PolylinesCreationUndoableEdit, _super);
70228         function PolylinesCreationUndoableEdit(controller, preferences, oldSelection, oldBasePlanLocked, oldAllLevelsSelection, newPolylines, polylinesIndex, polylinesLevel, newBasePlanLocked) {
70229             var _this = _super.call(this, preferences, PlanController, "undoCreatePolylinesName") || this;
70230             if (_this.controller === undefined) {
70231                 _this.controller = null;
70232             }
70233             if (_this.oldSelection === undefined) {
70234                 _this.oldSelection = null;
70235             }
70236             if (_this.oldBasePlanLocked === undefined) {
70237                 _this.oldBasePlanLocked = false;
70238             }
70239             if (_this.oldAllLevelsSelection === undefined) {
70240                 _this.oldAllLevelsSelection = false;
70241             }
70242             if (_this.newPolylines === undefined) {
70243                 _this.newPolylines = null;
70244             }
70245             if (_this.polylinesIndex === undefined) {
70246                 _this.polylinesIndex = null;
70247             }
70248             if (_this.polylinesLevel === undefined) {
70249                 _this.polylinesLevel = null;
70250             }
70251             if (_this.newBasePlanLocked === undefined) {
70252                 _this.newBasePlanLocked = false;
70253             }
70254             _this.controller = controller;
70255             _this.oldSelection = oldSelection;
70256             _this.oldBasePlanLocked = oldBasePlanLocked;
70257             _this.oldAllLevelsSelection = oldAllLevelsSelection;
70258             _this.newPolylines = newPolylines;
70259             _this.polylinesIndex = polylinesIndex;
70260             _this.polylinesLevel = polylinesLevel;
70261             _this.newBasePlanLocked = newBasePlanLocked;
70262             return _this;
70263         }
70264         /**
70265          *
70266          */
70267         PolylinesCreationUndoableEdit.prototype.undo = function () {
70268             _super.prototype.undo.call(this);
70269             this.controller.doDeletePolylines(this.newPolylines, this.oldBasePlanLocked);
70270             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.oldSelection.slice(0), this.oldAllLevelsSelection);
70271         };
70272         /**
70273          *
70274          */
70275         PolylinesCreationUndoableEdit.prototype.redo = function () {
70276             _super.prototype.redo.call(this);
70277             this.controller.doAddPolylines(this.newPolylines, this.polylinesIndex, null, this.polylinesLevel, this.newBasePlanLocked);
70278             this.controller.selectAndShowItems$java_util_List(/* asList */ this.newPolylines.slice(0));
70279         };
70280         return PolylinesCreationUndoableEdit;
70281     }(LocalizedUndoableEdit));
70282     PlanController.PolylinesCreationUndoableEdit = PolylinesCreationUndoableEdit;
70283     PolylinesCreationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PolylinesCreationUndoableEdit";
70284     PolylinesCreationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
70285     /**
70286      * Undoable edit for label creation.
70287      * @param {PlanController} controller
70288      * @param {UserPreferences} preferences
70289      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
70290      * @param {boolean} oldBasePlanLocked
70291      * @param {boolean} oldAllLevelsSelection
70292      * @param {com.eteks.sweethome3d.model.Label[]} labels
70293      * @param {Level} labelsLevel
70294      * @param {boolean} newBasePlanLocked
70295      * @class
70296      * @extends LocalizedUndoableEdit
70297      */
70298     var LabelsCreationUndoableEdit = /** @class */ (function (_super) {
70299         __extends(LabelsCreationUndoableEdit, _super);
70300         function LabelsCreationUndoableEdit(controller, preferences, oldSelection, oldBasePlanLocked, oldAllLevelsSelection, labels, labelsLevel, newBasePlanLocked) {
70301             var _this = _super.call(this, preferences, PlanController, "undoCreateLabelsName") || this;
70302             if (_this.controller === undefined) {
70303                 _this.controller = null;
70304             }
70305             if (_this.oldSelection === undefined) {
70306                 _this.oldSelection = null;
70307             }
70308             if (_this.oldBasePlanLocked === undefined) {
70309                 _this.oldBasePlanLocked = false;
70310             }
70311             if (_this.oldAllLevelsSelection === undefined) {
70312                 _this.oldAllLevelsSelection = false;
70313             }
70314             if (_this.labels === undefined) {
70315                 _this.labels = null;
70316             }
70317             if (_this.labelsLevel === undefined) {
70318                 _this.labelsLevel = null;
70319             }
70320             if (_this.newBasePlanLocked === undefined) {
70321                 _this.newBasePlanLocked = false;
70322             }
70323             _this.controller = controller;
70324             _this.oldSelection = oldSelection;
70325             _this.oldBasePlanLocked = oldBasePlanLocked;
70326             _this.oldAllLevelsSelection = oldAllLevelsSelection;
70327             _this.labels = labels;
70328             _this.labelsLevel = labelsLevel;
70329             _this.newBasePlanLocked = newBasePlanLocked;
70330             return _this;
70331         }
70332         /**
70333          *
70334          */
70335         LabelsCreationUndoableEdit.prototype.undo = function () {
70336             _super.prototype.undo.call(this);
70337             this.controller.doDeleteLabels(this.labels, this.oldBasePlanLocked);
70338             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.oldSelection.slice(0), this.oldAllLevelsSelection);
70339         };
70340         /**
70341          *
70342          */
70343         LabelsCreationUndoableEdit.prototype.redo = function () {
70344             _super.prototype.redo.call(this);
70345             this.controller.doAddLabels(this.labels, null, this.labelsLevel, this.newBasePlanLocked);
70346             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.labels.slice(0), false);
70347         };
70348         return LabelsCreationUndoableEdit;
70349     }(LocalizedUndoableEdit));
70350     PlanController.LabelsCreationUndoableEdit = LabelsCreationUndoableEdit;
70351     LabelsCreationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.LabelsCreationUndoableEdit";
70352     LabelsCreationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
70353     /**
70354      * Undoable edit for label rotation.
70355      * @param {PlanController} controller
70356      * @param {UserPreferences} preferences
70357      * @param {number} oldAngle
70358      * @param {Label} label
70359      * @param {number} newAngle
70360      * @class
70361      * @extends LocalizedUndoableEdit
70362      */
70363     var LabelRotationUndoableEdit = /** @class */ (function (_super) {
70364         __extends(LabelRotationUndoableEdit, _super);
70365         function LabelRotationUndoableEdit(controller, preferences, oldAngle, label, newAngle) {
70366             var _this = _super.call(this, preferences, PlanController, "undoLabelRotationName") || this;
70367             if (_this.controller === undefined) {
70368                 _this.controller = null;
70369             }
70370             if (_this.oldAngle === undefined) {
70371                 _this.oldAngle = 0;
70372             }
70373             if (_this.label === undefined) {
70374                 _this.label = null;
70375             }
70376             if (_this.newAngle === undefined) {
70377                 _this.newAngle = 0;
70378             }
70379             _this.controller = controller;
70380             _this.oldAngle = oldAngle;
70381             _this.label = label;
70382             _this.newAngle = newAngle;
70383             return _this;
70384         }
70385         /**
70386          *
70387          */
70388         LabelRotationUndoableEdit.prototype.undo = function () {
70389             _super.prototype.undo.call(this);
70390             this.label.setAngle(this.oldAngle);
70391             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.label].slice(0));
70392         };
70393         /**
70394          *
70395          */
70396         LabelRotationUndoableEdit.prototype.redo = function () {
70397             _super.prototype.redo.call(this);
70398             this.label.setAngle(this.newAngle);
70399             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.label].slice(0));
70400         };
70401         return LabelRotationUndoableEdit;
70402     }(LocalizedUndoableEdit));
70403     PlanController.LabelRotationUndoableEdit = LabelRotationUndoableEdit;
70404     LabelRotationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.LabelRotationUndoableEdit";
70405     LabelRotationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
70406     /**
70407      * Undoable edit for label elevation modification.
70408      * @param {PlanController} controller
70409      * @param {UserPreferences} preferences
70410      * @param {number} oldElevation
70411      * @param {Label} label
70412      * @param {number} newElevation
70413      * @class
70414      * @extends LocalizedUndoableEdit
70415      */
70416     var LabelElevationModificationUndoableEdit = /** @class */ (function (_super) {
70417         __extends(LabelElevationModificationUndoableEdit, _super);
70418         function LabelElevationModificationUndoableEdit(controller, preferences, oldElevation, label, newElevation) {
70419             var _this = _super.call(this, preferences, PlanController, oldElevation < newElevation ? "undoLabelRaiseName" : "undoLabelLowerName") || this;
70420             if (_this.controller === undefined) {
70421                 _this.controller = null;
70422             }
70423             if (_this.oldElevation === undefined) {
70424                 _this.oldElevation = 0;
70425             }
70426             if (_this.label === undefined) {
70427                 _this.label = null;
70428             }
70429             if (_this.newElevation === undefined) {
70430                 _this.newElevation = 0;
70431             }
70432             _this.controller = controller;
70433             _this.oldElevation = oldElevation;
70434             _this.label = label;
70435             _this.newElevation = newElevation;
70436             return _this;
70437         }
70438         /**
70439          *
70440          */
70441         LabelElevationModificationUndoableEdit.prototype.undo = function () {
70442             _super.prototype.undo.call(this);
70443             this.label.setElevation(this.oldElevation);
70444             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.label].slice(0));
70445         };
70446         /**
70447          *
70448          */
70449         LabelElevationModificationUndoableEdit.prototype.redo = function () {
70450             _super.prototype.redo.call(this);
70451             this.label.setElevation(this.newElevation);
70452             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.label].slice(0));
70453         };
70454         return LabelElevationModificationUndoableEdit;
70455     }(LocalizedUndoableEdit));
70456     PlanController.LabelElevationModificationUndoableEdit = LabelElevationModificationUndoableEdit;
70457     LabelElevationModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.LabelElevationModificationUndoableEdit";
70458     LabelElevationModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
70459     /**
70460      * Undoable edit for moving items.
70461      * @param {PlanController} controller
70462      * @param {UserPreferences} preferences
70463      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
70464      * @param {boolean} allLevelsSelection
70465      * @param {com.eteks.sweethome3d.model.Selectable[]} items
70466      * @param {number} dx
70467      * @param {number} dy
70468      * @class
70469      * @extends LocalizedUndoableEdit
70470      */
70471     var ItemsMovingUndoableEdit = /** @class */ (function (_super) {
70472         __extends(ItemsMovingUndoableEdit, _super);
70473         function ItemsMovingUndoableEdit(controller, preferences, oldSelection, allLevelsSelection, items, dx, dy) {
70474             var _this = _super.call(this, preferences, PlanController, "undoMoveSelectionName") || this;
70475             if (_this.controller === undefined) {
70476                 _this.controller = null;
70477             }
70478             if (_this.oldSelection === undefined) {
70479                 _this.oldSelection = null;
70480             }
70481             if (_this.allLevelsSelection === undefined) {
70482                 _this.allLevelsSelection = false;
70483             }
70484             if (_this.itemsArray === undefined) {
70485                 _this.itemsArray = null;
70486             }
70487             if (_this.dx === undefined) {
70488                 _this.dx = 0;
70489             }
70490             if (_this.dy === undefined) {
70491                 _this.dy = 0;
70492             }
70493             _this.controller = controller;
70494             _this.oldSelection = oldSelection;
70495             _this.allLevelsSelection = allLevelsSelection;
70496             _this.itemsArray = items;
70497             _this.dx = dx;
70498             _this.dy = dy;
70499             return _this;
70500         }
70501         /**
70502          *
70503          */
70504         ItemsMovingUndoableEdit.prototype.undo = function () {
70505             _super.prototype.undo.call(this);
70506             this.controller.doMoveAndShowItems(this.itemsArray, this.oldSelection, -this.dx, -this.dy, this.allLevelsSelection);
70507         };
70508         /**
70509          *
70510          */
70511         ItemsMovingUndoableEdit.prototype.redo = function () {
70512             _super.prototype.redo.call(this);
70513             this.controller.doMoveAndShowItems(this.itemsArray, this.itemsArray, this.dx, this.dy, this.allLevelsSelection);
70514         };
70515         return ItemsMovingUndoableEdit;
70516     }(LocalizedUndoableEdit));
70517     PlanController.ItemsMovingUndoableEdit = ItemsMovingUndoableEdit;
70518     ItemsMovingUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.ItemsMovingUndoableEdit";
70519     ItemsMovingUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
70520     /**
70521      * Undoable edit for moving a piece of furniture.
70522      * @param {PlanController} controller
70523      * @param {UserPreferences} preferences
70524      * @param {number} oldAngle
70525      * @param {number} oldDepth
70526      * @param {number} oldElevation
70527      * @param {boolean} oldDoorOrWindowBoundToWall
70528      * @param {HomePieceOfFurniture} piece
70529      * @param {number} dx
70530      * @param {number} dy
70531      * @param {number} newAngle
70532      * @param {number} newDepth
70533      * @param {number} newElevation
70534      * @class
70535      * @extends LocalizedUndoableEdit
70536      */
70537     var PieceOfFurnitureMovingUndoableEdit = /** @class */ (function (_super) {
70538         __extends(PieceOfFurnitureMovingUndoableEdit, _super);
70539         function PieceOfFurnitureMovingUndoableEdit(controller, preferences, oldAngle, oldDepth, oldElevation, oldDoorOrWindowBoundToWall, piece, dx, dy, newAngle, newDepth, newElevation) {
70540             var _this = _super.call(this, preferences, PlanController, "undoMoveSelectionName") || this;
70541             if (_this.controller === undefined) {
70542                 _this.controller = null;
70543             }
70544             if (_this.oldAngle === undefined) {
70545                 _this.oldAngle = 0;
70546             }
70547             if (_this.oldDepth === undefined) {
70548                 _this.oldDepth = 0;
70549             }
70550             if (_this.oldElevation === undefined) {
70551                 _this.oldElevation = 0;
70552             }
70553             if (_this.oldDoorOrWindowBoundToWall === undefined) {
70554                 _this.oldDoorOrWindowBoundToWall = false;
70555             }
70556             if (_this.piece === undefined) {
70557                 _this.piece = null;
70558             }
70559             if (_this.dx === undefined) {
70560                 _this.dx = 0;
70561             }
70562             if (_this.dy === undefined) {
70563                 _this.dy = 0;
70564             }
70565             if (_this.newAngle === undefined) {
70566                 _this.newAngle = 0;
70567             }
70568             if (_this.newDepth === undefined) {
70569                 _this.newDepth = 0;
70570             }
70571             if (_this.newElevation === undefined) {
70572                 _this.newElevation = 0;
70573             }
70574             _this.controller = controller;
70575             _this.oldAngle = oldAngle;
70576             _this.oldDepth = oldDepth;
70577             _this.oldElevation = oldElevation;
70578             _this.oldDoorOrWindowBoundToWall = oldDoorOrWindowBoundToWall;
70579             _this.piece = piece;
70580             _this.dx = dx;
70581             _this.dy = dy;
70582             _this.newAngle = newAngle;
70583             _this.newDepth = newDepth;
70584             _this.newElevation = newElevation;
70585             return _this;
70586         }
70587         /**
70588          *
70589          */
70590         PieceOfFurnitureMovingUndoableEdit.prototype.undo = function () {
70591             _super.prototype.undo.call(this);
70592             this.piece.move(-this.dx, -this.dy);
70593             this.piece.setAngle(this.oldAngle);
70594             if ((this.piece != null && this.piece instanceof HomeDoorOrWindow) && this.piece.isResizable() && this.controller.isItemResizable(this.piece)) {
70595                 this.piece.setDepth(this.oldDepth);
70596             }
70597             this.piece.setElevation(this.oldElevation);
70598             if (this.piece != null && this.piece instanceof HomeDoorOrWindow) {
70599                 this.piece.setBoundToWall(this.oldDoorOrWindowBoundToWall);
70600             }
70601             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.piece].slice(0));
70602         };
70603         /**
70604          *
70605          */
70606         PieceOfFurnitureMovingUndoableEdit.prototype.redo = function () {
70607             _super.prototype.redo.call(this);
70608             this.piece.move(this.dx, this.dy);
70609             this.piece.setAngle(this.newAngle);
70610             if ((this.piece != null && this.piece instanceof HomeDoorOrWindow) && this.piece.isResizable() && this.controller.isItemResizable(this.piece)) {
70611                 this.piece.setDepth(this.newDepth);
70612             }
70613             this.piece.setElevation(this.newElevation);
70614             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.piece].slice(0));
70615         };
70616         return PieceOfFurnitureMovingUndoableEdit;
70617     }(LocalizedUndoableEdit));
70618     PlanController.PieceOfFurnitureMovingUndoableEdit = PieceOfFurnitureMovingUndoableEdit;
70619     PieceOfFurnitureMovingUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PieceOfFurnitureMovingUndoableEdit";
70620     PieceOfFurnitureMovingUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
70621     /**
70622      * Undoable edit for duplication start.
70623      * @param {PlanController} controller
70624      * @param {com.eteks.sweethome3d.model.Selectable[]} oldSelection
70625      * @param {boolean} allLevelsSelection
70626      * @class
70627      * @extends javax.swing.undo.AbstractUndoableEdit
70628      */
70629     var DuplicationStartUndoableEdit = /** @class */ (function (_super) {
70630         __extends(DuplicationStartUndoableEdit, _super);
70631         function DuplicationStartUndoableEdit(controller, oldSelection, allLevelsSelection) {
70632             var _this = _super.call(this) || this;
70633             if (_this.controller === undefined) {
70634                 _this.controller = null;
70635             }
70636             if (_this.oldSelection === undefined) {
70637                 _this.oldSelection = null;
70638             }
70639             if (_this.allLevelsSelection === undefined) {
70640                 _this.allLevelsSelection = false;
70641             }
70642             _this.controller = controller;
70643             _this.oldSelection = oldSelection;
70644             _this.allLevelsSelection = allLevelsSelection;
70645             return _this;
70646         }
70647         /**
70648          *
70649          */
70650         DuplicationStartUndoableEdit.prototype.undo = function () {
70651             _super.prototype.undo.call(this);
70652             this.controller.selectAndShowItems$java_util_List$boolean(/* asList */ this.oldSelection.slice(0), this.allLevelsSelection);
70653         };
70654         return DuplicationStartUndoableEdit;
70655     }(javax.swing.undo.AbstractUndoableEdit));
70656     PlanController.DuplicationStartUndoableEdit = DuplicationStartUndoableEdit;
70657     DuplicationStartUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.DuplicationStartUndoableEdit";
70658     DuplicationStartUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
70659     /**
70660      * Undoable edit for duplication end.
70661      * @param {PlanController} controller
70662      * @param {UserPreferences} preferences
70663      * @param {com.eteks.sweethome3d.model.Selectable[]} items
70664      * @class
70665      * @extends LocalizedUndoableEdit
70666      */
70667     var DuplicationEndUndoableEdit = /** @class */ (function (_super) {
70668         __extends(DuplicationEndUndoableEdit, _super);
70669         function DuplicationEndUndoableEdit(controller, preferences, items) {
70670             var _this = _super.call(this, preferences, PlanController, "undoDuplicateSelectionName") || this;
70671             if (_this.controller === undefined) {
70672                 _this.controller = null;
70673             }
70674             if (_this.items === undefined) {
70675                 _this.items = null;
70676             }
70677             _this.controller = controller;
70678             _this.items = items;
70679             return _this;
70680         }
70681         /**
70682          *
70683          */
70684         DuplicationEndUndoableEdit.prototype.redo = function () {
70685             _super.prototype.redo.call(this);
70686             this.controller.selectAndShowItems$java_util_List(/* asList */ this.items.slice(0));
70687         };
70688         return DuplicationEndUndoableEdit;
70689     }(LocalizedUndoableEdit));
70690     PlanController.DuplicationEndUndoableEdit = DuplicationEndUndoableEdit;
70691     DuplicationEndUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.DuplicationEndUndoableEdit";
70692     DuplicationEndUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
70693     /**
70694      * Undoable edit for wall resizing.
70695      * @param {PlanController} controller
70696      * @param {UserPreferences} preferences
70697      * @param {number} oldX
70698      * @param {number} oldY
70699      * @param {Wall} wall
70700      * @param {boolean} startPoint
70701      * @param {number} newX
70702      * @param {number} newY
70703      * @class
70704      * @extends LocalizedUndoableEdit
70705      */
70706     var WallResizingUndoableEdit = /** @class */ (function (_super) {
70707         __extends(WallResizingUndoableEdit, _super);
70708         function WallResizingUndoableEdit(controller, preferences, oldX, oldY, wall, startPoint, newX, newY) {
70709             var _this = _super.call(this, preferences, PlanController, "undoWallResizeName") || this;
70710             if (_this.controller === undefined) {
70711                 _this.controller = null;
70712             }
70713             if (_this.oldX === undefined) {
70714                 _this.oldX = 0;
70715             }
70716             if (_this.oldY === undefined) {
70717                 _this.oldY = 0;
70718             }
70719             if (_this.wall === undefined) {
70720                 _this.wall = null;
70721             }
70722             if (_this.startPoint === undefined) {
70723                 _this.startPoint = false;
70724             }
70725             if (_this.newX === undefined) {
70726                 _this.newX = 0;
70727             }
70728             if (_this.newY === undefined) {
70729                 _this.newY = 0;
70730             }
70731             _this.controller = controller;
70732             _this.oldX = oldX;
70733             _this.oldY = oldY;
70734             _this.wall = wall;
70735             _this.startPoint = startPoint;
70736             _this.newX = newX;
70737             _this.newY = newY;
70738             return _this;
70739         }
70740         /**
70741          *
70742          */
70743         WallResizingUndoableEdit.prototype.undo = function () {
70744             _super.prototype.undo.call(this);
70745             PlanController.moveWallPoint(this.wall, this.oldX, this.oldY, this.startPoint);
70746             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.wall].slice(0));
70747         };
70748         /**
70749          *
70750          */
70751         WallResizingUndoableEdit.prototype.redo = function () {
70752             _super.prototype.redo.call(this);
70753             PlanController.moveWallPoint(this.wall, this.newX, this.newY, this.startPoint);
70754             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.wall].slice(0));
70755         };
70756         return WallResizingUndoableEdit;
70757     }(LocalizedUndoableEdit));
70758     PlanController.WallResizingUndoableEdit = WallResizingUndoableEdit;
70759     WallResizingUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.WallResizingUndoableEdit";
70760     WallResizingUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
70761     /**
70762      * Undoable edit for wall arc extent modification.
70763      * @param {PlanController} controller
70764      * @param {UserPreferences} preferences
70765      * @param {number} oldArcExtent
70766      * @param {Wall} wall
70767      * @param {number} newArcExtent
70768      * @class
70769      * @extends LocalizedUndoableEdit
70770      */
70771     var WallArcExtentModificationUndoableEdit = /** @class */ (function (_super) {
70772         __extends(WallArcExtentModificationUndoableEdit, _super);
70773         function WallArcExtentModificationUndoableEdit(controller, preferences, oldArcExtent, wall, newArcExtent) {
70774             var _this = _super.call(this, preferences, PlanController, "undoWallArcExtentName") || this;
70775             if (_this.controller === undefined) {
70776                 _this.controller = null;
70777             }
70778             if (_this.oldArcExtent === undefined) {
70779                 _this.oldArcExtent = null;
70780             }
70781             if (_this.wall === undefined) {
70782                 _this.wall = null;
70783             }
70784             if (_this.newArcExtent === undefined) {
70785                 _this.newArcExtent = null;
70786             }
70787             _this.controller = controller;
70788             _this.oldArcExtent = oldArcExtent;
70789             _this.wall = wall;
70790             _this.newArcExtent = newArcExtent;
70791             return _this;
70792         }
70793         /**
70794          *
70795          */
70796         WallArcExtentModificationUndoableEdit.prototype.undo = function () {
70797             _super.prototype.undo.call(this);
70798             this.wall.setArcExtent(this.oldArcExtent);
70799             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.wall].slice(0));
70800         };
70801         /**
70802          *
70803          */
70804         WallArcExtentModificationUndoableEdit.prototype.redo = function () {
70805             _super.prototype.redo.call(this);
70806             this.wall.setArcExtent(this.newArcExtent);
70807             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.wall].slice(0));
70808         };
70809         return WallArcExtentModificationUndoableEdit;
70810     }(LocalizedUndoableEdit));
70811     PlanController.WallArcExtentModificationUndoableEdit = WallArcExtentModificationUndoableEdit;
70812     WallArcExtentModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.WallArcExtentModificationUndoableEdit";
70813     WallArcExtentModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
70814     /**
70815      * Undoable edit for room resizing.
70816      * @param {PlanController} controller
70817      * @param {UserPreferences} preferences
70818      * @param {number} oldX
70819      * @param {number} oldY
70820      * @param {Room} room
70821      * @param {number} pointIndex
70822      * @param {number} newX
70823      * @param {number} newY
70824      * @class
70825      * @extends LocalizedUndoableEdit
70826      */
70827     var RoomResizingUndoableEdit = /** @class */ (function (_super) {
70828         __extends(RoomResizingUndoableEdit, _super);
70829         function RoomResizingUndoableEdit(controller, preferences, oldX, oldY, room, pointIndex, newX, newY) {
70830             var _this = _super.call(this, preferences, PlanController, "undoRoomResizeName") || this;
70831             if (_this.controller === undefined) {
70832                 _this.controller = null;
70833             }
70834             if (_this.oldX === undefined) {
70835                 _this.oldX = 0;
70836             }
70837             if (_this.oldY === undefined) {
70838                 _this.oldY = 0;
70839             }
70840             if (_this.room === undefined) {
70841                 _this.room = null;
70842             }
70843             if (_this.pointIndex === undefined) {
70844                 _this.pointIndex = 0;
70845             }
70846             if (_this.newX === undefined) {
70847                 _this.newX = 0;
70848             }
70849             if (_this.newY === undefined) {
70850                 _this.newY = 0;
70851             }
70852             _this.controller = controller;
70853             _this.oldX = oldX;
70854             _this.oldY = oldY;
70855             _this.room = room;
70856             _this.pointIndex = pointIndex;
70857             _this.newX = newX;
70858             _this.newY = newY;
70859             return _this;
70860         }
70861         /**
70862          *
70863          */
70864         RoomResizingUndoableEdit.prototype.undo = function () {
70865             _super.prototype.undo.call(this);
70866             PlanController.moveRoomPoint(this.room, this.oldX, this.oldY, this.pointIndex);
70867             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.room].slice(0));
70868         };
70869         /**
70870          *
70871          */
70872         RoomResizingUndoableEdit.prototype.redo = function () {
70873             _super.prototype.redo.call(this);
70874             PlanController.moveRoomPoint(this.room, this.newX, this.newY, this.pointIndex);
70875             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.room].slice(0));
70876         };
70877         return RoomResizingUndoableEdit;
70878     }(LocalizedUndoableEdit));
70879     PlanController.RoomResizingUndoableEdit = RoomResizingUndoableEdit;
70880     RoomResizingUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RoomResizingUndoableEdit";
70881     RoomResizingUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
70882     /**
70883      * Undoable edit for room name offset modification.
70884      * @param {PlanController} controller
70885      * @param {UserPreferences} preferences
70886      * @param {number} oldNameXOffset
70887      * @param {number} oldNameYOffset
70888      * @param {Room} room
70889      * @param {number} newNameXOffset
70890      * @param {number} newNameYOffset
70891      * @class
70892      * @extends LocalizedUndoableEdit
70893      */
70894     var RoomNameOffsetModificationUndoableEdit = /** @class */ (function (_super) {
70895         __extends(RoomNameOffsetModificationUndoableEdit, _super);
70896         function RoomNameOffsetModificationUndoableEdit(controller, preferences, oldNameXOffset, oldNameYOffset, room, newNameXOffset, newNameYOffset) {
70897             var _this = _super.call(this, preferences, PlanController, "undoRoomNameOffsetName") || this;
70898             if (_this.controller === undefined) {
70899                 _this.controller = null;
70900             }
70901             if (_this.oldNameXOffset === undefined) {
70902                 _this.oldNameXOffset = 0;
70903             }
70904             if (_this.oldNameYOffset === undefined) {
70905                 _this.oldNameYOffset = 0;
70906             }
70907             if (_this.room === undefined) {
70908                 _this.room = null;
70909             }
70910             if (_this.newNameXOffset === undefined) {
70911                 _this.newNameXOffset = 0;
70912             }
70913             if (_this.newNameYOffset === undefined) {
70914                 _this.newNameYOffset = 0;
70915             }
70916             _this.controller = controller;
70917             _this.oldNameXOffset = oldNameXOffset;
70918             _this.oldNameYOffset = oldNameYOffset;
70919             _this.room = room;
70920             _this.newNameXOffset = newNameXOffset;
70921             _this.newNameYOffset = newNameYOffset;
70922             return _this;
70923         }
70924         /**
70925          *
70926          */
70927         RoomNameOffsetModificationUndoableEdit.prototype.undo = function () {
70928             _super.prototype.undo.call(this);
70929             this.room.setNameXOffset(this.oldNameXOffset);
70930             this.room.setNameYOffset(this.oldNameYOffset);
70931             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.room].slice(0));
70932         };
70933         /**
70934          *
70935          */
70936         RoomNameOffsetModificationUndoableEdit.prototype.redo = function () {
70937             _super.prototype.redo.call(this);
70938             this.room.setNameXOffset(this.newNameXOffset);
70939             this.room.setNameYOffset(this.newNameYOffset);
70940             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.room].slice(0));
70941         };
70942         return RoomNameOffsetModificationUndoableEdit;
70943     }(LocalizedUndoableEdit));
70944     PlanController.RoomNameOffsetModificationUndoableEdit = RoomNameOffsetModificationUndoableEdit;
70945     RoomNameOffsetModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RoomNameOffsetModificationUndoableEdit";
70946     RoomNameOffsetModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
70947     /**
70948      * Undoable edit for room name rotation.
70949      * @param {PlanController} controller
70950      * @param {UserPreferences} preferences
70951      * @param {number} oldNameAngle
70952      * @param {Room} room
70953      * @param {number} newNameAngle
70954      * @class
70955      * @extends LocalizedUndoableEdit
70956      */
70957     var RoomNameRotationUndoableEdit = /** @class */ (function (_super) {
70958         __extends(RoomNameRotationUndoableEdit, _super);
70959         function RoomNameRotationUndoableEdit(controller, preferences, oldNameAngle, room, newNameAngle) {
70960             var _this = _super.call(this, preferences, PlanController, "undoRoomNameRotationName") || this;
70961             if (_this.controller === undefined) {
70962                 _this.controller = null;
70963             }
70964             if (_this.oldNameAngle === undefined) {
70965                 _this.oldNameAngle = 0;
70966             }
70967             if (_this.room === undefined) {
70968                 _this.room = null;
70969             }
70970             if (_this.newNameAngle === undefined) {
70971                 _this.newNameAngle = 0;
70972             }
70973             _this.controller = controller;
70974             _this.oldNameAngle = oldNameAngle;
70975             _this.room = room;
70976             _this.newNameAngle = newNameAngle;
70977             return _this;
70978         }
70979         /**
70980          *
70981          */
70982         RoomNameRotationUndoableEdit.prototype.undo = function () {
70983             _super.prototype.undo.call(this);
70984             this.room.setNameAngle(this.oldNameAngle);
70985             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.room].slice(0));
70986         };
70987         /**
70988          *
70989          */
70990         RoomNameRotationUndoableEdit.prototype.redo = function () {
70991             _super.prototype.redo.call(this);
70992             this.room.setNameAngle(this.newNameAngle);
70993             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.room].slice(0));
70994         };
70995         return RoomNameRotationUndoableEdit;
70996     }(LocalizedUndoableEdit));
70997     PlanController.RoomNameRotationUndoableEdit = RoomNameRotationUndoableEdit;
70998     RoomNameRotationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RoomNameRotationUndoableEdit";
70999     RoomNameRotationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
71000     /**
71001      * Undoable edit for room area offset modification.
71002      * @param {PlanController} controller
71003      * @param {UserPreferences} preferences
71004      * @param {number} oldAreaXOffset
71005      * @param {number} oldAreaYOffset
71006      * @param {Room} room
71007      * @param {number} newAreaXOffset
71008      * @param {number} newAreaYOffset
71009      * @class
71010      * @extends LocalizedUndoableEdit
71011      */
71012     var RoomAreaOffsetModificationUndoableEdit = /** @class */ (function (_super) {
71013         __extends(RoomAreaOffsetModificationUndoableEdit, _super);
71014         function RoomAreaOffsetModificationUndoableEdit(controller, preferences, oldAreaXOffset, oldAreaYOffset, room, newAreaXOffset, newAreaYOffset) {
71015             var _this = _super.call(this, preferences, PlanController, "undoRoomAreaOffsetName") || this;
71016             if (_this.controller === undefined) {
71017                 _this.controller = null;
71018             }
71019             if (_this.oldAreaXOffset === undefined) {
71020                 _this.oldAreaXOffset = 0;
71021             }
71022             if (_this.oldAreaYOffset === undefined) {
71023                 _this.oldAreaYOffset = 0;
71024             }
71025             if (_this.room === undefined) {
71026                 _this.room = null;
71027             }
71028             if (_this.newAreaXOffset === undefined) {
71029                 _this.newAreaXOffset = 0;
71030             }
71031             if (_this.newAreaYOffset === undefined) {
71032                 _this.newAreaYOffset = 0;
71033             }
71034             _this.controller = controller;
71035             _this.oldAreaXOffset = oldAreaXOffset;
71036             _this.oldAreaYOffset = oldAreaYOffset;
71037             _this.room = room;
71038             _this.newAreaXOffset = newAreaXOffset;
71039             _this.newAreaYOffset = newAreaYOffset;
71040             return _this;
71041         }
71042         /**
71043          *
71044          */
71045         RoomAreaOffsetModificationUndoableEdit.prototype.undo = function () {
71046             _super.prototype.undo.call(this);
71047             this.room.setAreaXOffset(this.oldAreaXOffset);
71048             this.room.setAreaYOffset(this.oldAreaYOffset);
71049             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.room].slice(0));
71050         };
71051         /**
71052          *
71053          */
71054         RoomAreaOffsetModificationUndoableEdit.prototype.redo = function () {
71055             _super.prototype.redo.call(this);
71056             this.room.setAreaXOffset(this.newAreaXOffset);
71057             this.room.setAreaYOffset(this.newAreaYOffset);
71058             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.room].slice(0));
71059         };
71060         return RoomAreaOffsetModificationUndoableEdit;
71061     }(LocalizedUndoableEdit));
71062     PlanController.RoomAreaOffsetModificationUndoableEdit = RoomAreaOffsetModificationUndoableEdit;
71063     RoomAreaOffsetModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RoomAreaOffsetModificationUndoableEdit";
71064     RoomAreaOffsetModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
71065     /**
71066      * Undoable edit for room area rotation.
71067      * @param {PlanController} controller
71068      * @param {UserPreferences} preferences
71069      * @param {number} oldAreaAngle
71070      * @param {Room} room
71071      * @param {number} newAreaAngle
71072      * @class
71073      * @extends LocalizedUndoableEdit
71074      */
71075     var RoomAreaRotationUndoableEdit = /** @class */ (function (_super) {
71076         __extends(RoomAreaRotationUndoableEdit, _super);
71077         function RoomAreaRotationUndoableEdit(controller, preferences, oldAreaAngle, room, newAreaAngle) {
71078             var _this = _super.call(this, preferences, PlanController, "undoRoomAreaRotationName") || this;
71079             if (_this.controller === undefined) {
71080                 _this.controller = null;
71081             }
71082             if (_this.oldAreaAngle === undefined) {
71083                 _this.oldAreaAngle = 0;
71084             }
71085             if (_this.room === undefined) {
71086                 _this.room = null;
71087             }
71088             if (_this.newAreaAngle === undefined) {
71089                 _this.newAreaAngle = 0;
71090             }
71091             _this.controller = controller;
71092             _this.oldAreaAngle = oldAreaAngle;
71093             _this.room = room;
71094             _this.newAreaAngle = newAreaAngle;
71095             return _this;
71096         }
71097         /**
71098          *
71099          */
71100         RoomAreaRotationUndoableEdit.prototype.undo = function () {
71101             _super.prototype.undo.call(this);
71102             this.room.setAreaAngle(this.oldAreaAngle);
71103             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.room].slice(0));
71104         };
71105         /**
71106          *
71107          */
71108         RoomAreaRotationUndoableEdit.prototype.redo = function () {
71109             _super.prototype.redo.call(this);
71110             this.room.setAreaAngle(this.newAreaAngle);
71111             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.room].slice(0));
71112         };
71113         return RoomAreaRotationUndoableEdit;
71114     }(LocalizedUndoableEdit));
71115     PlanController.RoomAreaRotationUndoableEdit = RoomAreaRotationUndoableEdit;
71116     RoomAreaRotationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RoomAreaRotationUndoableEdit";
71117     RoomAreaRotationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
71118     /**
71119      * Undoable edit for the rotation of a piece of furniture.
71120      * @param {PlanController} controller
71121      * @param {UserPreferences} preferences
71122      * @param {number} oldAngle
71123      * @param {boolean} oldDoorOrWindowBoundToWall
71124      * @param {HomePieceOfFurniture} piece
71125      * @param {number} newAngle
71126      * @class
71127      * @extends LocalizedUndoableEdit
71128      */
71129     var PieceOfFurnitureRotationUndoableEdit = /** @class */ (function (_super) {
71130         __extends(PieceOfFurnitureRotationUndoableEdit, _super);
71131         function PieceOfFurnitureRotationUndoableEdit(controller, preferences, oldAngle, oldDoorOrWindowBoundToWall, piece, newAngle) {
71132             var _this = _super.call(this, preferences, PlanController, "undoPieceOfFurnitureRotationName") || this;
71133             if (_this.controller === undefined) {
71134                 _this.controller = null;
71135             }
71136             if (_this.oldAngle === undefined) {
71137                 _this.oldAngle = 0;
71138             }
71139             if (_this.oldDoorOrWindowBoundToWall === undefined) {
71140                 _this.oldDoorOrWindowBoundToWall = false;
71141             }
71142             if (_this.piece === undefined) {
71143                 _this.piece = null;
71144             }
71145             if (_this.newAngle === undefined) {
71146                 _this.newAngle = 0;
71147             }
71148             _this.controller = controller;
71149             _this.oldAngle = oldAngle;
71150             _this.oldDoorOrWindowBoundToWall = oldDoorOrWindowBoundToWall;
71151             _this.piece = piece;
71152             _this.newAngle = newAngle;
71153             return _this;
71154         }
71155         /**
71156          *
71157          */
71158         PieceOfFurnitureRotationUndoableEdit.prototype.undo = function () {
71159             _super.prototype.undo.call(this);
71160             this.piece.setAngle(this.oldAngle);
71161             if (this.piece != null && this.piece instanceof HomeDoorOrWindow) {
71162                 this.piece.setBoundToWall(this.oldDoorOrWindowBoundToWall);
71163             }
71164             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.piece].slice(0));
71165         };
71166         /**
71167          *
71168          */
71169         PieceOfFurnitureRotationUndoableEdit.prototype.redo = function () {
71170             _super.prototype.redo.call(this);
71171             this.piece.setAngle(this.newAngle);
71172             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.piece].slice(0));
71173         };
71174         return PieceOfFurnitureRotationUndoableEdit;
71175     }(LocalizedUndoableEdit));
71176     PlanController.PieceOfFurnitureRotationUndoableEdit = PieceOfFurnitureRotationUndoableEdit;
71177     PieceOfFurnitureRotationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PieceOfFurnitureRotationUndoableEdit";
71178     PieceOfFurnitureRotationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
71179     /**
71180      * Undoable edit for the pitch rotation of a piece of furniture.
71181      * @param {PlanController} controller
71182      * @param {UserPreferences} preferences
71183      * @param {number} oldPitch
71184      * @param {number} oldWidthInPlan
71185      * @param {number} oldDepthInPlan
71186      * @param {number} oldHeightInPlan
71187      * @param {HomePieceOfFurniture} piece
71188      * @param {number} newPitch
71189      * @param {number} newWidthInPlan
71190      * @param {number} newDepthInPlan
71191      * @param {number} newHeightInPlan
71192      * @class
71193      * @extends LocalizedUndoableEdit
71194      */
71195     var PieceOfFurniturePitchRotationUndoableEdit = /** @class */ (function (_super) {
71196         __extends(PieceOfFurniturePitchRotationUndoableEdit, _super);
71197         function PieceOfFurniturePitchRotationUndoableEdit(controller, preferences, oldPitch, oldWidthInPlan, oldDepthInPlan, oldHeightInPlan, piece, newPitch, newWidthInPlan, newDepthInPlan, newHeightInPlan) {
71198             var _this = _super.call(this, preferences, PlanController, "undoPieceOfFurnitureRotationName") || this;
71199             if (_this.controller === undefined) {
71200                 _this.controller = null;
71201             }
71202             if (_this.oldPitch === undefined) {
71203                 _this.oldPitch = 0;
71204             }
71205             if (_this.oldWidthInPlan === undefined) {
71206                 _this.oldWidthInPlan = 0;
71207             }
71208             if (_this.oldDepthInPlan === undefined) {
71209                 _this.oldDepthInPlan = 0;
71210             }
71211             if (_this.oldHeightInPlan === undefined) {
71212                 _this.oldHeightInPlan = 0;
71213             }
71214             if (_this.piece === undefined) {
71215                 _this.piece = null;
71216             }
71217             if (_this.newPitch === undefined) {
71218                 _this.newPitch = 0;
71219             }
71220             if (_this.newWidthInPlan === undefined) {
71221                 _this.newWidthInPlan = 0;
71222             }
71223             if (_this.newDepthInPlan === undefined) {
71224                 _this.newDepthInPlan = 0;
71225             }
71226             if (_this.newHeightInPlan === undefined) {
71227                 _this.newHeightInPlan = 0;
71228             }
71229             _this.controller = controller;
71230             _this.oldPitch = oldPitch;
71231             _this.oldWidthInPlan = oldWidthInPlan;
71232             _this.oldDepthInPlan = oldDepthInPlan;
71233             _this.oldHeightInPlan = oldHeightInPlan;
71234             _this.piece = piece;
71235             _this.newPitch = newPitch;
71236             _this.newWidthInPlan = newWidthInPlan;
71237             _this.newDepthInPlan = newDepthInPlan;
71238             _this.newHeightInPlan = newHeightInPlan;
71239             return _this;
71240         }
71241         /**
71242          *
71243          */
71244         PieceOfFurniturePitchRotationUndoableEdit.prototype.undo = function () {
71245             _super.prototype.undo.call(this);
71246             this.controller.setPieceOfFurniturePitch(this.piece, this.oldPitch, this.oldWidthInPlan, this.oldDepthInPlan, this.oldHeightInPlan);
71247             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.piece].slice(0));
71248         };
71249         /**
71250          *
71251          */
71252         PieceOfFurniturePitchRotationUndoableEdit.prototype.redo = function () {
71253             _super.prototype.redo.call(this);
71254             this.controller.setPieceOfFurniturePitch(this.piece, this.newPitch, this.newWidthInPlan, this.newDepthInPlan, this.newHeightInPlan);
71255             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.piece].slice(0));
71256         };
71257         return PieceOfFurniturePitchRotationUndoableEdit;
71258     }(LocalizedUndoableEdit));
71259     PlanController.PieceOfFurniturePitchRotationUndoableEdit = PieceOfFurniturePitchRotationUndoableEdit;
71260     PieceOfFurniturePitchRotationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PieceOfFurniturePitchRotationUndoableEdit";
71261     PieceOfFurniturePitchRotationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
71262     /**
71263      * Undoable edit for the roll rotation of a piece of furniture.
71264      * @param {PlanController} controller
71265      * @param {UserPreferences} preferences
71266      * @param {number} oldRoll
71267      * @param {number} oldWidthInPlan
71268      * @param {number} oldDepthInPlan
71269      * @param {number} oldHeightInPlan
71270      * @param {HomePieceOfFurniture} piece
71271      * @param {number} newRoll
71272      * @param {number} newWidthInPlan
71273      * @param {number} newDepthInPlan
71274      * @param {number} newHeightInPlan
71275      * @class
71276      * @extends LocalizedUndoableEdit
71277      */
71278     var PieceOfFurnitureRollRotationUndoableEdit = /** @class */ (function (_super) {
71279         __extends(PieceOfFurnitureRollRotationUndoableEdit, _super);
71280         function PieceOfFurnitureRollRotationUndoableEdit(controller, preferences, oldRoll, oldWidthInPlan, oldDepthInPlan, oldHeightInPlan, piece, newRoll, newWidthInPlan, newDepthInPlan, newHeightInPlan) {
71281             var _this = _super.call(this, preferences, PlanController, "undoPieceOfFurnitureRotationName") || this;
71282             if (_this.controller === undefined) {
71283                 _this.controller = null;
71284             }
71285             if (_this.oldRoll === undefined) {
71286                 _this.oldRoll = 0;
71287             }
71288             if (_this.oldWidthInPlan === undefined) {
71289                 _this.oldWidthInPlan = 0;
71290             }
71291             if (_this.oldDepthInPlan === undefined) {
71292                 _this.oldDepthInPlan = 0;
71293             }
71294             if (_this.oldHeightInPlan === undefined) {
71295                 _this.oldHeightInPlan = 0;
71296             }
71297             if (_this.piece === undefined) {
71298                 _this.piece = null;
71299             }
71300             if (_this.newRoll === undefined) {
71301                 _this.newRoll = 0;
71302             }
71303             if (_this.newWidthInPlan === undefined) {
71304                 _this.newWidthInPlan = 0;
71305             }
71306             if (_this.newDepthInPlan === undefined) {
71307                 _this.newDepthInPlan = 0;
71308             }
71309             if (_this.newHeightInPlan === undefined) {
71310                 _this.newHeightInPlan = 0;
71311             }
71312             _this.controller = controller;
71313             _this.oldRoll = oldRoll;
71314             _this.oldWidthInPlan = oldWidthInPlan;
71315             _this.oldDepthInPlan = oldDepthInPlan;
71316             _this.oldHeightInPlan = oldHeightInPlan;
71317             _this.piece = piece;
71318             _this.newRoll = newRoll;
71319             _this.newWidthInPlan = newWidthInPlan;
71320             _this.newDepthInPlan = newDepthInPlan;
71321             _this.newHeightInPlan = newHeightInPlan;
71322             return _this;
71323         }
71324         /**
71325          *
71326          */
71327         PieceOfFurnitureRollRotationUndoableEdit.prototype.undo = function () {
71328             _super.prototype.undo.call(this);
71329             this.controller.setPieceOfFurnitureRoll(this.piece, this.oldRoll, this.oldWidthInPlan, this.oldDepthInPlan, this.oldHeightInPlan);
71330             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.piece].slice(0));
71331         };
71332         /**
71333          *
71334          */
71335         PieceOfFurnitureRollRotationUndoableEdit.prototype.redo = function () {
71336             _super.prototype.redo.call(this);
71337             this.controller.setPieceOfFurnitureRoll(this.piece, this.newRoll, this.newWidthInPlan, this.newDepthInPlan, this.newHeightInPlan);
71338             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.piece].slice(0));
71339         };
71340         return PieceOfFurnitureRollRotationUndoableEdit;
71341     }(LocalizedUndoableEdit));
71342     PlanController.PieceOfFurnitureRollRotationUndoableEdit = PieceOfFurnitureRollRotationUndoableEdit;
71343     PieceOfFurnitureRollRotationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PieceOfFurnitureRollRotationUndoableEdit";
71344     PieceOfFurnitureRollRotationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
71345     /**
71346      * Undoable edit for the elevation modification of a piece of furniture.
71347      * @param {PlanController} controller
71348      * @param {UserPreferences} preferences
71349      * @param {number} oldElevation
71350      * @param {HomePieceOfFurniture} piece
71351      * @param {number} newElevation
71352      * @class
71353      * @extends LocalizedUndoableEdit
71354      */
71355     var PieceOfFurnitureElevationModificationUndoableEdit = /** @class */ (function (_super) {
71356         __extends(PieceOfFurnitureElevationModificationUndoableEdit, _super);
71357         function PieceOfFurnitureElevationModificationUndoableEdit(controller, preferences, oldElevation, piece, newElevation) {
71358             var _this = _super.call(this, preferences, PlanController, oldElevation < newElevation ? "undoPieceOfFurnitureRaiseName" : "undoPieceOfFurnitureLowerName") || this;
71359             if (_this.controller === undefined) {
71360                 _this.controller = null;
71361             }
71362             if (_this.oldElevation === undefined) {
71363                 _this.oldElevation = 0;
71364             }
71365             if (_this.piece === undefined) {
71366                 _this.piece = null;
71367             }
71368             if (_this.newElevation === undefined) {
71369                 _this.newElevation = 0;
71370             }
71371             _this.controller = controller;
71372             _this.oldElevation = oldElevation;
71373             _this.piece = piece;
71374             _this.newElevation = newElevation;
71375             return _this;
71376         }
71377         /**
71378          *
71379          */
71380         PieceOfFurnitureElevationModificationUndoableEdit.prototype.undo = function () {
71381             _super.prototype.undo.call(this);
71382             this.piece.setElevation(this.oldElevation);
71383             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.piece].slice(0));
71384         };
71385         /**
71386          *
71387          */
71388         PieceOfFurnitureElevationModificationUndoableEdit.prototype.redo = function () {
71389             _super.prototype.redo.call(this);
71390             this.piece.setElevation(this.newElevation);
71391             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.piece].slice(0));
71392         };
71393         return PieceOfFurnitureElevationModificationUndoableEdit;
71394     }(LocalizedUndoableEdit));
71395     PlanController.PieceOfFurnitureElevationModificationUndoableEdit = PieceOfFurnitureElevationModificationUndoableEdit;
71396     PieceOfFurnitureElevationModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PieceOfFurnitureElevationModificationUndoableEdit";
71397     PieceOfFurnitureElevationModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
71398     /**
71399      * Undoable edit for the resizing of a piece of furniture.
71400      * @param {PlanController} controller
71401      * @param {UserPreferences} preferences
71402      * @param {string} presentationNameKey
71403      * @param {boolean} doorOrWindowBoundToWall
71404      * @param {PlanController.ResizedPieceOfFurniture} resizedPiece
71405      * @param {number} newX
71406      * @param {number} newY
71407      * @param {number} newWidth
71408      * @param {number} newDepth
71409      * @param {number} newHeight
71410      * @class
71411      * @extends LocalizedUndoableEdit
71412      */
71413     var PieceOfFurnitureResizingUndoableEdit = /** @class */ (function (_super) {
71414         __extends(PieceOfFurnitureResizingUndoableEdit, _super);
71415         function PieceOfFurnitureResizingUndoableEdit(controller, preferences, presentationNameKey, doorOrWindowBoundToWall, resizedPiece, newX, newY, newWidth, newDepth, newHeight) {
71416             var _this = _super.call(this, preferences, PlanController, presentationNameKey) || this;
71417             if (_this.controller === undefined) {
71418                 _this.controller = null;
71419             }
71420             if (_this.doorOrWindowBoundToWall === undefined) {
71421                 _this.doorOrWindowBoundToWall = false;
71422             }
71423             if (_this.resizedPiece === undefined) {
71424                 _this.resizedPiece = null;
71425             }
71426             if (_this.newX === undefined) {
71427                 _this.newX = 0;
71428             }
71429             if (_this.newY === undefined) {
71430                 _this.newY = 0;
71431             }
71432             if (_this.newWidth === undefined) {
71433                 _this.newWidth = 0;
71434             }
71435             if (_this.newDepth === undefined) {
71436                 _this.newDepth = 0;
71437             }
71438             if (_this.newHeight === undefined) {
71439                 _this.newHeight = 0;
71440             }
71441             _this.controller = controller;
71442             _this.doorOrWindowBoundToWall = doorOrWindowBoundToWall;
71443             _this.resizedPiece = resizedPiece;
71444             _this.newX = newX;
71445             _this.newY = newY;
71446             _this.newWidth = newWidth;
71447             _this.newDepth = newDepth;
71448             _this.newHeight = newHeight;
71449             return _this;
71450         }
71451         /**
71452          *
71453          */
71454         PieceOfFurnitureResizingUndoableEdit.prototype.undo = function () {
71455             _super.prototype.undo.call(this);
71456             this.controller.resetPieceOfFurnitureSize(this.resizedPiece);
71457             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.resizedPiece.getPieceOfFurniture()].slice(0));
71458         };
71459         /**
71460          *
71461          */
71462         PieceOfFurnitureResizingUndoableEdit.prototype.redo = function () {
71463             _super.prototype.redo.call(this);
71464             var piece = this.resizedPiece.getPieceOfFurniture();
71465             piece.setX(this.newX);
71466             piece.setY(this.newY);
71467             this.controller.setPieceOfFurnitureSize(this.resizedPiece, this.newWidth, this.newDepth, this.newHeight);
71468             if (piece != null && piece instanceof HomeDoorOrWindow) {
71469                 piece.setBoundToWall(this.doorOrWindowBoundToWall);
71470             }
71471             this.controller.selectAndShowItems$java_util_List(/* asList */ [piece].slice(0));
71472         };
71473         return PieceOfFurnitureResizingUndoableEdit;
71474     }(LocalizedUndoableEdit));
71475     PlanController.PieceOfFurnitureResizingUndoableEdit = PieceOfFurnitureResizingUndoableEdit;
71476     PieceOfFurnitureResizingUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PieceOfFurnitureResizingUndoableEdit";
71477     PieceOfFurnitureResizingUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
71478     /**
71479      * Undoable edit for the light power modification.
71480      * @param {PlanController} controller
71481      * @param {UserPreferences} preferences
71482      * @param {number} oldPower
71483      * @param {HomeLight} light
71484      * @param {number} newPower
71485      * @class
71486      * @extends LocalizedUndoableEdit
71487      */
71488     var LightPowerModificationUndoableEdit = /** @class */ (function (_super) {
71489         __extends(LightPowerModificationUndoableEdit, _super);
71490         function LightPowerModificationUndoableEdit(controller, preferences, oldPower, light, newPower) {
71491             var _this = _super.call(this, preferences, PlanController, "undoLightPowerModificationName") || this;
71492             if (_this.controller === undefined) {
71493                 _this.controller = null;
71494             }
71495             if (_this.oldPower === undefined) {
71496                 _this.oldPower = 0;
71497             }
71498             if (_this.light === undefined) {
71499                 _this.light = null;
71500             }
71501             if (_this.newPower === undefined) {
71502                 _this.newPower = 0;
71503             }
71504             _this.controller = controller;
71505             _this.oldPower = oldPower;
71506             _this.light = light;
71507             _this.newPower = newPower;
71508             return _this;
71509         }
71510         /**
71511          *
71512          */
71513         LightPowerModificationUndoableEdit.prototype.undo = function () {
71514             _super.prototype.undo.call(this);
71515             this.light.setPower(this.oldPower);
71516             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.light].slice(0));
71517         };
71518         /**
71519          *
71520          */
71521         LightPowerModificationUndoableEdit.prototype.redo = function () {
71522             _super.prototype.redo.call(this);
71523             this.light.setPower(this.newPower);
71524             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.light].slice(0));
71525         };
71526         return LightPowerModificationUndoableEdit;
71527     }(LocalizedUndoableEdit));
71528     PlanController.LightPowerModificationUndoableEdit = LightPowerModificationUndoableEdit;
71529     LightPowerModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.LightPowerModificationUndoableEdit";
71530     LightPowerModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
71531     /**
71532      * Undoable edit for the name offset modification of a piece of furniture.
71533      * @param {PlanController} controller
71534      * @param {UserPreferences} preferences
71535      * @param {number} oldNameXOffset
71536      * @param {number} oldNameYOffset
71537      * @param {HomePieceOfFurniture} piece
71538      * @param {number} newNameXOffset
71539      * @param {number} newNameYOffset
71540      * @class
71541      * @extends LocalizedUndoableEdit
71542      */
71543     var PieceOfFurnitureNameOffsetModificationUndoableEdit = /** @class */ (function (_super) {
71544         __extends(PieceOfFurnitureNameOffsetModificationUndoableEdit, _super);
71545         function PieceOfFurnitureNameOffsetModificationUndoableEdit(controller, preferences, oldNameXOffset, oldNameYOffset, piece, newNameXOffset, newNameYOffset) {
71546             var _this = _super.call(this, preferences, PlanController, "undoPieceOfFurnitureNameOffsetName") || this;
71547             if (_this.controller === undefined) {
71548                 _this.controller = null;
71549             }
71550             if (_this.oldNameXOffset === undefined) {
71551                 _this.oldNameXOffset = 0;
71552             }
71553             if (_this.oldNameYOffset === undefined) {
71554                 _this.oldNameYOffset = 0;
71555             }
71556             if (_this.piece === undefined) {
71557                 _this.piece = null;
71558             }
71559             if (_this.newNameXOffset === undefined) {
71560                 _this.newNameXOffset = 0;
71561             }
71562             if (_this.newNameYOffset === undefined) {
71563                 _this.newNameYOffset = 0;
71564             }
71565             _this.controller = controller;
71566             _this.oldNameXOffset = oldNameXOffset;
71567             _this.oldNameYOffset = oldNameYOffset;
71568             _this.piece = piece;
71569             _this.newNameXOffset = newNameXOffset;
71570             _this.newNameYOffset = newNameYOffset;
71571             return _this;
71572         }
71573         /**
71574          *
71575          */
71576         PieceOfFurnitureNameOffsetModificationUndoableEdit.prototype.undo = function () {
71577             _super.prototype.undo.call(this);
71578             this.piece.setNameXOffset(this.oldNameXOffset);
71579             this.piece.setNameYOffset(this.oldNameYOffset);
71580             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.piece].slice(0));
71581         };
71582         /**
71583          *
71584          */
71585         PieceOfFurnitureNameOffsetModificationUndoableEdit.prototype.redo = function () {
71586             _super.prototype.redo.call(this);
71587             this.piece.setNameXOffset(this.newNameXOffset);
71588             this.piece.setNameYOffset(this.newNameYOffset);
71589             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.piece].slice(0));
71590         };
71591         return PieceOfFurnitureNameOffsetModificationUndoableEdit;
71592     }(LocalizedUndoableEdit));
71593     PlanController.PieceOfFurnitureNameOffsetModificationUndoableEdit = PieceOfFurnitureNameOffsetModificationUndoableEdit;
71594     PieceOfFurnitureNameOffsetModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PieceOfFurnitureNameOffsetModificationUndoableEdit";
71595     PieceOfFurnitureNameOffsetModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
71596     /**
71597      * Undoable edit for the name rotation of a piece of furniture.
71598      * @param {PlanController} controller
71599      * @param {UserPreferences} preferences
71600      * @param {number} oldNameAngle
71601      * @param {HomePieceOfFurniture} piece
71602      * @param {number} newNameAngle
71603      * @class
71604      * @extends LocalizedUndoableEdit
71605      */
71606     var PieceOfFurnitureNameRotationUndoableEdit = /** @class */ (function (_super) {
71607         __extends(PieceOfFurnitureNameRotationUndoableEdit, _super);
71608         function PieceOfFurnitureNameRotationUndoableEdit(controller, preferences, oldNameAngle, piece, newNameAngle) {
71609             var _this = _super.call(this, preferences, PlanController, "undoPieceOfFurnitureNameRotationName") || this;
71610             if (_this.controller === undefined) {
71611                 _this.controller = null;
71612             }
71613             if (_this.oldNameAngle === undefined) {
71614                 _this.oldNameAngle = 0;
71615             }
71616             if (_this.piece === undefined) {
71617                 _this.piece = null;
71618             }
71619             if (_this.newNameAngle === undefined) {
71620                 _this.newNameAngle = 0;
71621             }
71622             _this.controller = controller;
71623             _this.oldNameAngle = oldNameAngle;
71624             _this.piece = piece;
71625             _this.newNameAngle = newNameAngle;
71626             return _this;
71627         }
71628         /**
71629          *
71630          */
71631         PieceOfFurnitureNameRotationUndoableEdit.prototype.undo = function () {
71632             _super.prototype.undo.call(this);
71633             this.piece.setNameAngle(this.oldNameAngle);
71634             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.piece].slice(0));
71635         };
71636         /**
71637          *
71638          */
71639         PieceOfFurnitureNameRotationUndoableEdit.prototype.redo = function () {
71640             _super.prototype.redo.call(this);
71641             this.piece.setNameAngle(this.newNameAngle);
71642             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.piece].slice(0));
71643         };
71644         return PieceOfFurnitureNameRotationUndoableEdit;
71645     }(LocalizedUndoableEdit));
71646     PlanController.PieceOfFurnitureNameRotationUndoableEdit = PieceOfFurnitureNameRotationUndoableEdit;
71647     PieceOfFurnitureNameRotationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PieceOfFurnitureNameRotationUndoableEdit";
71648     PieceOfFurnitureNameRotationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
71649     /**
71650      * Undoable edit for dimension line resizing.
71651      * @param {PlanController} controller
71652      * @param {UserPreferences} preferences
71653      * @param {number} oldX
71654      * @param {number} oldY
71655      * @param {DimensionLine} dimensionLine
71656      * @param {number} newX
71657      * @param {number} newY
71658      * @param {boolean} startPoint
71659      * @param {boolean} reversed
71660      * @class
71661      * @extends LocalizedUndoableEdit
71662      */
71663     var DimensionLineResizingUndoableEdit = /** @class */ (function (_super) {
71664         __extends(DimensionLineResizingUndoableEdit, _super);
71665         function DimensionLineResizingUndoableEdit(controller, preferences, oldX, oldY, dimensionLine, newX, newY, startPoint, reversed) {
71666             var _this = _super.call(this, preferences, PlanController, "undoDimensionLineResizeName") || this;
71667             if (_this.controller === undefined) {
71668                 _this.controller = null;
71669             }
71670             if (_this.oldX === undefined) {
71671                 _this.oldX = 0;
71672             }
71673             if (_this.oldY === undefined) {
71674                 _this.oldY = 0;
71675             }
71676             if (_this.dimensionLine === undefined) {
71677                 _this.dimensionLine = null;
71678             }
71679             if (_this.newX === undefined) {
71680                 _this.newX = 0;
71681             }
71682             if (_this.newY === undefined) {
71683                 _this.newY = 0;
71684             }
71685             if (_this.startPoint === undefined) {
71686                 _this.startPoint = false;
71687             }
71688             if (_this.reversed === undefined) {
71689                 _this.reversed = false;
71690             }
71691             _this.controller = controller;
71692             _this.oldX = oldX;
71693             _this.oldY = oldY;
71694             _this.dimensionLine = dimensionLine;
71695             _this.newX = newX;
71696             _this.newY = newY;
71697             _this.startPoint = startPoint;
71698             _this.reversed = reversed;
71699             return _this;
71700         }
71701         /**
71702          *
71703          */
71704         DimensionLineResizingUndoableEdit.prototype.undo = function () {
71705             _super.prototype.undo.call(this);
71706             if (this.reversed) {
71707                 PlanController.reverseDimensionLine(this.dimensionLine);
71708                 PlanController.moveDimensionLinePoint(this.dimensionLine, this.oldX, this.oldY, !this.startPoint);
71709             }
71710             else {
71711                 PlanController.moveDimensionLinePoint(this.dimensionLine, this.oldX, this.oldY, this.startPoint);
71712             }
71713             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.dimensionLine].slice(0));
71714         };
71715         /**
71716          *
71717          */
71718         DimensionLineResizingUndoableEdit.prototype.redo = function () {
71719             _super.prototype.redo.call(this);
71720             if (this.reversed) {
71721                 PlanController.moveDimensionLinePoint(this.dimensionLine, this.newX, this.newY, !this.startPoint);
71722                 PlanController.reverseDimensionLine(this.dimensionLine);
71723             }
71724             else {
71725                 PlanController.moveDimensionLinePoint(this.dimensionLine, this.newX, this.newY, this.startPoint);
71726             }
71727             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.dimensionLine].slice(0));
71728         };
71729         return DimensionLineResizingUndoableEdit;
71730     }(LocalizedUndoableEdit));
71731     PlanController.DimensionLineResizingUndoableEdit = DimensionLineResizingUndoableEdit;
71732     DimensionLineResizingUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.DimensionLineResizingUndoableEdit";
71733     DimensionLineResizingUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
71734     /**
71735      * Undoable edit for dimension line offset modification.
71736      * @param {PlanController} controller
71737      * @param {UserPreferences} preferences
71738      * @param {number} oldOffset
71739      * @param {DimensionLine} dimensionLine
71740      * @param {number} newOffset
71741      * @class
71742      * @extends LocalizedUndoableEdit
71743      */
71744     var DimensionLineOffsetModificationUndoableEdit = /** @class */ (function (_super) {
71745         __extends(DimensionLineOffsetModificationUndoableEdit, _super);
71746         function DimensionLineOffsetModificationUndoableEdit(controller, preferences, oldOffset, dimensionLine, newOffset) {
71747             var _this = _super.call(this, preferences, PlanController, "undoDimensionLineOffsetName") || this;
71748             if (_this.controller === undefined) {
71749                 _this.controller = null;
71750             }
71751             if (_this.oldOffset === undefined) {
71752                 _this.oldOffset = 0;
71753             }
71754             if (_this.dimensionLine === undefined) {
71755                 _this.dimensionLine = null;
71756             }
71757             if (_this.newOffset === undefined) {
71758                 _this.newOffset = 0;
71759             }
71760             _this.controller = controller;
71761             _this.oldOffset = oldOffset;
71762             _this.dimensionLine = dimensionLine;
71763             _this.newOffset = newOffset;
71764             return _this;
71765         }
71766         /**
71767          *
71768          */
71769         DimensionLineOffsetModificationUndoableEdit.prototype.undo = function () {
71770             _super.prototype.undo.call(this);
71771             this.dimensionLine.setOffset(this.oldOffset);
71772             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.dimensionLine].slice(0));
71773         };
71774         /**
71775          *
71776          */
71777         DimensionLineOffsetModificationUndoableEdit.prototype.redo = function () {
71778             _super.prototype.redo.call(this);
71779             this.dimensionLine.setOffset(this.newOffset);
71780             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.dimensionLine].slice(0));
71781         };
71782         return DimensionLineOffsetModificationUndoableEdit;
71783     }(LocalizedUndoableEdit));
71784     PlanController.DimensionLineOffsetModificationUndoableEdit = DimensionLineOffsetModificationUndoableEdit;
71785     DimensionLineOffsetModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.DimensionLineOffsetModificationUndoableEdit";
71786     DimensionLineOffsetModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
71787     /**
71788      * Undoable edit for the pitch angle modification of a dimension line.
71789      * @param {PlanController} controller
71790      * @param {UserPreferences} preferences
71791      * @param {number} oldPitch
71792      * @param {DimensionLine} dimensionLine
71793      * @param {number} newPitch
71794      * @class
71795      * @extends LocalizedUndoableEdit
71796      */
71797     var DimensionLinePitchRotationUndoableEdit = /** @class */ (function (_super) {
71798         __extends(DimensionLinePitchRotationUndoableEdit, _super);
71799         function DimensionLinePitchRotationUndoableEdit(controller, preferences, oldPitch, dimensionLine, newPitch) {
71800             var _this = _super.call(this, preferences, PlanController, "undoDimensionLineRotationName") || this;
71801             if (_this.controller === undefined) {
71802                 _this.controller = null;
71803             }
71804             if (_this.oldPitch === undefined) {
71805                 _this.oldPitch = 0;
71806             }
71807             if (_this.dimensionLine === undefined) {
71808                 _this.dimensionLine = null;
71809             }
71810             if (_this.newPitch === undefined) {
71811                 _this.newPitch = 0;
71812             }
71813             _this.controller = controller;
71814             _this.oldPitch = oldPitch;
71815             _this.dimensionLine = dimensionLine;
71816             _this.newPitch = newPitch;
71817             return _this;
71818         }
71819         /**
71820          *
71821          */
71822         DimensionLinePitchRotationUndoableEdit.prototype.undo = function () {
71823             _super.prototype.undo.call(this);
71824             this.dimensionLine.setPitch(this.oldPitch);
71825             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.dimensionLine].slice(0));
71826         };
71827         /**
71828          *
71829          */
71830         DimensionLinePitchRotationUndoableEdit.prototype.redo = function () {
71831             _super.prototype.redo.call(this);
71832             this.dimensionLine.setPitch(this.newPitch);
71833             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.dimensionLine].slice(0));
71834         };
71835         return DimensionLinePitchRotationUndoableEdit;
71836     }(LocalizedUndoableEdit));
71837     PlanController.DimensionLinePitchRotationUndoableEdit = DimensionLinePitchRotationUndoableEdit;
71838     DimensionLinePitchRotationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.DimensionLinePitchRotationUndoableEdit";
71839     DimensionLinePitchRotationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
71840     /**
71841      * Undoable edit for dimension line height resizing.
71842      * @param {PlanController} controller
71843      * @param {UserPreferences} preferences
71844      * @param {number} oldHeight
71845      * @param {DimensionLine} dimensionLine
71846      * @param {number} newHeight
71847      * @class
71848      * @extends LocalizedUndoableEdit
71849      */
71850     var DimensionLineHeightResizingUndoableEdit = /** @class */ (function (_super) {
71851         __extends(DimensionLineHeightResizingUndoableEdit, _super);
71852         function DimensionLineHeightResizingUndoableEdit(controller, preferences, oldHeight, dimensionLine, newHeight) {
71853             var _this = _super.call(this, preferences, PlanController, "undoDimensionLineHeightResizeName") || this;
71854             if (_this.controller === undefined) {
71855                 _this.controller = null;
71856             }
71857             if (_this.oldHeight === undefined) {
71858                 _this.oldHeight = 0;
71859             }
71860             if (_this.dimensionLine === undefined) {
71861                 _this.dimensionLine = null;
71862             }
71863             if (_this.newHeight === undefined) {
71864                 _this.newHeight = 0;
71865             }
71866             _this.controller = controller;
71867             _this.oldHeight = oldHeight;
71868             _this.dimensionLine = dimensionLine;
71869             _this.newHeight = newHeight;
71870             return _this;
71871         }
71872         /**
71873          *
71874          */
71875         DimensionLineHeightResizingUndoableEdit.prototype.undo = function () {
71876             _super.prototype.undo.call(this);
71877             this.dimensionLine.setElevationEnd(this.dimensionLine.getElevationStart() + this.oldHeight);
71878             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.dimensionLine].slice(0));
71879         };
71880         /**
71881          *
71882          */
71883         DimensionLineHeightResizingUndoableEdit.prototype.redo = function () {
71884             _super.prototype.redo.call(this);
71885             this.dimensionLine.setElevationEnd(this.dimensionLine.getElevationStart() + this.newHeight);
71886             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.dimensionLine].slice(0));
71887         };
71888         return DimensionLineHeightResizingUndoableEdit;
71889     }(LocalizedUndoableEdit));
71890     PlanController.DimensionLineHeightResizingUndoableEdit = DimensionLineHeightResizingUndoableEdit;
71891     DimensionLineHeightResizingUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.DimensionLineHeightResizingUndoableEdit";
71892     DimensionLineHeightResizingUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
71893     /**
71894      * Undoable edit for dimension label elevation modification.
71895      * @param {PlanController} controller
71896      * @param {UserPreferences} preferences
71897      * @param {number} oldElevation
71898      * @param {DimensionLine} dimensionLine
71899      * @param {number} newElevation
71900      * @class
71901      * @extends LocalizedUndoableEdit
71902      */
71903     var DimensionLineElevationModificationUndoableEdit = /** @class */ (function (_super) {
71904         __extends(DimensionLineElevationModificationUndoableEdit, _super);
71905         function DimensionLineElevationModificationUndoableEdit(controller, preferences, oldElevation, dimensionLine, newElevation) {
71906             var _this = _super.call(this, preferences, PlanController, oldElevation < newElevation ? "undoDimensionLineRaiseName" : "undoDimensionLineLowerName") || this;
71907             if (_this.controller === undefined) {
71908                 _this.controller = null;
71909             }
71910             if (_this.oldElevation === undefined) {
71911                 _this.oldElevation = 0;
71912             }
71913             if (_this.dimensionLine === undefined) {
71914                 _this.dimensionLine = null;
71915             }
71916             if (_this.newElevation === undefined) {
71917                 _this.newElevation = 0;
71918             }
71919             _this.controller = controller;
71920             _this.oldElevation = oldElevation;
71921             _this.dimensionLine = dimensionLine;
71922             _this.newElevation = newElevation;
71923             return _this;
71924         }
71925         /**
71926          *
71927          */
71928         DimensionLineElevationModificationUndoableEdit.prototype.undo = function () {
71929             _super.prototype.undo.call(this);
71930             this.dimensionLine.setElevationStart(this.oldElevation);
71931             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.dimensionLine].slice(0));
71932         };
71933         /**
71934          *
71935          */
71936         DimensionLineElevationModificationUndoableEdit.prototype.redo = function () {
71937             _super.prototype.redo.call(this);
71938             this.dimensionLine.setElevationStart(this.newElevation);
71939             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.dimensionLine].slice(0));
71940         };
71941         return DimensionLineElevationModificationUndoableEdit;
71942     }(LocalizedUndoableEdit));
71943     PlanController.DimensionLineElevationModificationUndoableEdit = DimensionLineElevationModificationUndoableEdit;
71944     DimensionLineElevationModificationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.DimensionLineElevationModificationUndoableEdit";
71945     DimensionLineElevationModificationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
71946     /**
71947      * Undoable edit for polyline resizing.
71948      * @param {PlanController} controller
71949      * @param {UserPreferences} preferences
71950      * @param {number} oldX
71951      * @param {number} oldY
71952      * @param {Polyline} polyline
71953      * @param {number} pointIndex
71954      * @param {number} newX
71955      * @param {number} newY
71956      * @class
71957      * @extends LocalizedUndoableEdit
71958      */
71959     var PolylineResizingUndoableEdit = /** @class */ (function (_super) {
71960         __extends(PolylineResizingUndoableEdit, _super);
71961         function PolylineResizingUndoableEdit(controller, preferences, oldX, oldY, polyline, pointIndex, newX, newY) {
71962             var _this = _super.call(this, preferences, PlanController, "undoPolylineResizeName") || this;
71963             if (_this.controller === undefined) {
71964                 _this.controller = null;
71965             }
71966             if (_this.oldX === undefined) {
71967                 _this.oldX = 0;
71968             }
71969             if (_this.oldY === undefined) {
71970                 _this.oldY = 0;
71971             }
71972             if (_this.polyline === undefined) {
71973                 _this.polyline = null;
71974             }
71975             if (_this.pointIndex === undefined) {
71976                 _this.pointIndex = 0;
71977             }
71978             if (_this.newX === undefined) {
71979                 _this.newX = 0;
71980             }
71981             if (_this.newY === undefined) {
71982                 _this.newY = 0;
71983             }
71984             _this.controller = controller;
71985             _this.oldX = oldX;
71986             _this.oldY = oldY;
71987             _this.polyline = polyline;
71988             _this.pointIndex = pointIndex;
71989             _this.newX = newX;
71990             _this.newY = newY;
71991             return _this;
71992         }
71993         /**
71994          *
71995          */
71996         PolylineResizingUndoableEdit.prototype.undo = function () {
71997             _super.prototype.undo.call(this);
71998             this.polyline.setPoint(this.oldX, this.oldY, this.pointIndex);
71999             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.polyline].slice(0));
72000         };
72001         /**
72002          *
72003          */
72004         PolylineResizingUndoableEdit.prototype.redo = function () {
72005             _super.prototype.redo.call(this);
72006             this.polyline.setPoint(this.newX, this.newY, this.pointIndex);
72007             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.polyline].slice(0));
72008         };
72009         return PolylineResizingUndoableEdit;
72010     }(LocalizedUndoableEdit));
72011     PlanController.PolylineResizingUndoableEdit = PolylineResizingUndoableEdit;
72012     PolylineResizingUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PolylineResizingUndoableEdit";
72013     PolylineResizingUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
72014     /**
72015      * Undoable edit for compass rotation.
72016      * @param {PlanController} controller
72017      * @param {UserPreferences} preferences
72018      * @param {number} oldNorthDirection
72019      * @param {Compass} compass
72020      * @param {number} newNorthDirection
72021      * @class
72022      * @extends LocalizedUndoableEdit
72023      */
72024     var CompassRotationUndoableEdit = /** @class */ (function (_super) {
72025         __extends(CompassRotationUndoableEdit, _super);
72026         function CompassRotationUndoableEdit(controller, preferences, oldNorthDirection, compass, newNorthDirection) {
72027             var _this = _super.call(this, preferences, PlanController, "undoCompassRotationName") || this;
72028             if (_this.controller === undefined) {
72029                 _this.controller = null;
72030             }
72031             if (_this.oldNorthDirection === undefined) {
72032                 _this.oldNorthDirection = 0;
72033             }
72034             if (_this.compass === undefined) {
72035                 _this.compass = null;
72036             }
72037             if (_this.newNorthDirection === undefined) {
72038                 _this.newNorthDirection = 0;
72039             }
72040             _this.controller = controller;
72041             _this.compass = compass;
72042             _this.newNorthDirection = newNorthDirection;
72043             _this.oldNorthDirection = oldNorthDirection;
72044             return _this;
72045         }
72046         /**
72047          *
72048          */
72049         CompassRotationUndoableEdit.prototype.undo = function () {
72050             _super.prototype.undo.call(this);
72051             this.compass.setNorthDirection(this.oldNorthDirection);
72052             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.compass].slice(0));
72053         };
72054         /**
72055          *
72056          */
72057         CompassRotationUndoableEdit.prototype.redo = function () {
72058             _super.prototype.redo.call(this);
72059             this.compass.setNorthDirection(this.newNorthDirection);
72060             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.compass].slice(0));
72061         };
72062         return CompassRotationUndoableEdit;
72063     }(LocalizedUndoableEdit));
72064     PlanController.CompassRotationUndoableEdit = CompassRotationUndoableEdit;
72065     CompassRotationUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.CompassRotationUndoableEdit";
72066     CompassRotationUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
72067     /**
72068      * Undoable edit for compass resizing.
72069      * @param {PlanController} controller
72070      * @param {UserPreferences} preferences
72071      * @param {number} oldDiameter
72072      * @param {Compass} compass
72073      * @param {number} newDiameter
72074      * @class
72075      * @extends LocalizedUndoableEdit
72076      */
72077     var CompassResizingUndoableEdit = /** @class */ (function (_super) {
72078         __extends(CompassResizingUndoableEdit, _super);
72079         function CompassResizingUndoableEdit(controller, preferences, oldDiameter, compass, newDiameter) {
72080             var _this = _super.call(this, preferences, PlanController, "undoCompassResizeName") || this;
72081             if (_this.controller === undefined) {
72082                 _this.controller = null;
72083             }
72084             if (_this.oldDiameter === undefined) {
72085                 _this.oldDiameter = 0;
72086             }
72087             if (_this.compass === undefined) {
72088                 _this.compass = null;
72089             }
72090             if (_this.newDiameter === undefined) {
72091                 _this.newDiameter = 0;
72092             }
72093             _this.controller = controller;
72094             _this.oldDiameter = oldDiameter;
72095             _this.compass = compass;
72096             _this.newDiameter = newDiameter;
72097             return _this;
72098         }
72099         /**
72100          *
72101          */
72102         CompassResizingUndoableEdit.prototype.undo = function () {
72103             _super.prototype.undo.call(this);
72104             this.compass.setDiameter(this.oldDiameter);
72105             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.compass].slice(0));
72106         };
72107         /**
72108          *
72109          */
72110         CompassResizingUndoableEdit.prototype.redo = function () {
72111             _super.prototype.redo.call(this);
72112             this.compass.setDiameter(this.newDiameter);
72113             this.controller.selectAndShowItems$java_util_List(/* asList */ [this.compass].slice(0));
72114         };
72115         return CompassResizingUndoableEdit;
72116     }(LocalizedUndoableEdit));
72117     PlanController.CompassResizingUndoableEdit = CompassResizingUndoableEdit;
72118     CompassResizingUndoableEdit["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.CompassResizingUndoableEdit";
72119     CompassResizingUndoableEdit["__interfaces"] = ["javax.swing.undo.UndoableEdit"];
72120     /**
72121      * Stores the size of a resized piece of furniture.
72122      * @param {HomePieceOfFurniture} piece
72123      * @class
72124      */
72125     var ResizedPieceOfFurniture = /** @class */ (function () {
72126         function ResizedPieceOfFurniture(piece) {
72127             if (this.piece === undefined) {
72128                 this.piece = null;
72129             }
72130             if (this.x === undefined) {
72131                 this.x = 0;
72132             }
72133             if (this.y === undefined) {
72134                 this.y = 0;
72135             }
72136             if (this.width === undefined) {
72137                 this.width = 0;
72138             }
72139             if (this.depth === undefined) {
72140                 this.depth = 0;
72141             }
72142             if (this.height === undefined) {
72143                 this.height = 0;
72144             }
72145             if (this.doorOrWindowBoundToWall === undefined) {
72146                 this.doorOrWindowBoundToWall = false;
72147             }
72148             if (this.groupFurnitureX === undefined) {
72149                 this.groupFurnitureX = null;
72150             }
72151             if (this.groupFurnitureY === undefined) {
72152                 this.groupFurnitureY = null;
72153             }
72154             if (this.groupFurnitureWidth === undefined) {
72155                 this.groupFurnitureWidth = null;
72156             }
72157             if (this.groupFurnitureDepth === undefined) {
72158                 this.groupFurnitureDepth = null;
72159             }
72160             if (this.groupFurnitureHeight === undefined) {
72161                 this.groupFurnitureHeight = null;
72162             }
72163             this.piece = piece;
72164             this.x = piece.getX();
72165             this.y = piece.getY();
72166             this.width = piece.getWidth();
72167             this.depth = piece.getDepth();
72168             this.height = piece.getHeight();
72169             this.doorOrWindowBoundToWall = (piece != null && piece instanceof HomeDoorOrWindow) && piece.isBoundToWall();
72170             if (piece != null && piece instanceof HomeFurnitureGroup) {
72171                 var groupFurniture = piece.getAllFurniture();
72172                 this.groupFurnitureX = (function (s) { var a = []; while (s-- > 0)
72173                     a.push(0); return a; })(/* size */ groupFurniture.length);
72174                 this.groupFurnitureY = (function (s) { var a = []; while (s-- > 0)
72175                     a.push(0); return a; })(/* size */ groupFurniture.length);
72176                 this.groupFurnitureWidth = (function (s) { var a = []; while (s-- > 0)
72177                     a.push(0); return a; })(/* size */ groupFurniture.length);
72178                 this.groupFurnitureDepth = (function (s) { var a = []; while (s-- > 0)
72179                     a.push(0); return a; })(/* size */ groupFurniture.length);
72180                 this.groupFurnitureHeight = (function (s) { var a = []; while (s-- > 0)
72181                     a.push(0); return a; })(/* size */ groupFurniture.length);
72182                 for (var i = 0; i < /* size */ groupFurniture.length; i++) {
72183                     {
72184                         var groupPiece = groupFurniture[i];
72185                         this.groupFurnitureX[i] = groupPiece.getX();
72186                         this.groupFurnitureY[i] = groupPiece.getY();
72187                         this.groupFurnitureWidth[i] = groupPiece.getWidth();
72188                         this.groupFurnitureDepth[i] = groupPiece.getDepth();
72189                         this.groupFurnitureHeight[i] = groupPiece.getHeight();
72190                     }
72191                     ;
72192                 }
72193             }
72194             else {
72195                 this.groupFurnitureX = null;
72196                 this.groupFurnitureY = null;
72197                 this.groupFurnitureWidth = null;
72198                 this.groupFurnitureDepth = null;
72199                 this.groupFurnitureHeight = null;
72200             }
72201         }
72202         ResizedPieceOfFurniture.prototype.getPieceOfFurniture = function () {
72203             return this.piece;
72204         };
72205         ResizedPieceOfFurniture.prototype.getWidth = function () {
72206             return this.width;
72207         };
72208         ResizedPieceOfFurniture.prototype.getDepth = function () {
72209             return this.depth;
72210         };
72211         ResizedPieceOfFurniture.prototype.getHeight = function () {
72212             return this.height;
72213         };
72214         ResizedPieceOfFurniture.prototype.isDoorOrWindowBoundToWall = function () {
72215             return this.doorOrWindowBoundToWall;
72216         };
72217         ResizedPieceOfFurniture.prototype.reset = function () {
72218             this.piece.setX(this.x);
72219             this.piece.setY(this.y);
72220             ResizedPieceOfFurniture.setPieceOfFurnitureSize(this.piece, this.width, this.depth, this.height);
72221             if (this.piece != null && this.piece instanceof HomeDoorOrWindow) {
72222                 this.piece.setBoundToWall(this.doorOrWindowBoundToWall);
72223             }
72224             if (this.piece != null && this.piece instanceof HomeFurnitureGroup) {
72225                 var groupFurniture = this.piece.getAllFurniture();
72226                 for (var i = 0; i < /* size */ groupFurniture.length; i++) {
72227                     {
72228                         var groupPiece = groupFurniture[i];
72229                         if (this.piece.isResizable()) {
72230                             groupPiece.setX(this.groupFurnitureX[i]);
72231                             groupPiece.setY(this.groupFurnitureY[i]);
72232                             ResizedPieceOfFurniture.setPieceOfFurnitureSize(groupPiece, this.groupFurnitureWidth[i], this.groupFurnitureDepth[i], this.groupFurnitureHeight[i]);
72233                         }
72234                     }
72235                     ;
72236                 }
72237             }
72238         };
72239         ResizedPieceOfFurniture.setPieceOfFurnitureSize = function (piece, width, depth, height) {
72240             if (piece.isHorizontallyRotated()) {
72241                 var scale = width / piece.getWidth();
72242                 piece.scale(scale);
72243                 piece.setWidthInPlan(scale * piece.getWidthInPlan());
72244                 piece.setDepthInPlan(scale * piece.getDepthInPlan());
72245                 piece.setHeightInPlan(scale * piece.getHeightInPlan());
72246                 if (piece != null && piece instanceof HomeFurnitureGroup) {
72247                     {
72248                         var array = piece.getAllFurniture();
72249                         for (var index = 0; index < array.length; index++) {
72250                             var childPiece = array[index];
72251                             {
72252                                 childPiece.setWidthInPlan(scale * childPiece.getWidthInPlan());
72253                                 childPiece.setDepthInPlan(scale * childPiece.getDepthInPlan());
72254                                 childPiece.setHeightInPlan(scale * childPiece.getHeightInPlan());
72255                             }
72256                         }
72257                     }
72258                 }
72259             }
72260             else {
72261                 var widthInPlan = piece.getWidthInPlan() * width / piece.getWidth();
72262                 piece.setWidth(width);
72263                 piece.setWidthInPlan(widthInPlan);
72264                 var depthInPlan = piece.getDepthInPlan() * depth / piece.getDepth();
72265                 piece.setDepth(depth);
72266                 piece.setDepthInPlan(depthInPlan);
72267                 var heightInPlan = piece.getHeightInPlan() * height / piece.getHeight();
72268                 piece.setHeight(height);
72269                 piece.setHeightInPlan(heightInPlan);
72270                 if (piece != null && piece instanceof HomeFurnitureGroup) {
72271                     {
72272                         var array = piece.getAllFurniture();
72273                         for (var index = 0; index < array.length; index++) {
72274                             var childPiece = array[index];
72275                             {
72276                                 childPiece.setWidthInPlan(childPiece.getWidth());
72277                                 childPiece.setDepthInPlan(childPiece.getDepth());
72278                                 childPiece.setHeightInPlan(childPiece.getHeight());
72279                             }
72280                         }
72281                     }
72282                 }
72283             }
72284         };
72285         return ResizedPieceOfFurniture;
72286     }());
72287     PlanController.ResizedPieceOfFurniture = ResizedPieceOfFurniture;
72288     ResizedPieceOfFurniture["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.ResizedPieceOfFurniture";
72289     /**
72290      * Stores the walls at start and at end of a given wall. This data are useful
72291      * to add a collection of walls after an undo/redo delete operation.
72292      * @param {Wall} wall
72293      * @class
72294      */
72295     var JoinedWall = /** @class */ (function () {
72296         function JoinedWall(wall) {
72297             if (this.wall === undefined) {
72298                 this.wall = null;
72299             }
72300             if (this.level === undefined) {
72301                 this.level = null;
72302             }
72303             if (this.xStart === undefined) {
72304                 this.xStart = 0;
72305             }
72306             if (this.yStart === undefined) {
72307                 this.yStart = 0;
72308             }
72309             if (this.xEnd === undefined) {
72310                 this.xEnd = 0;
72311             }
72312             if (this.yEnd === undefined) {
72313                 this.yEnd = 0;
72314             }
72315             if (this.wallAtStart === undefined) {
72316                 this.wallAtStart = null;
72317             }
72318             if (this.wallAtEnd === undefined) {
72319                 this.wallAtEnd = null;
72320             }
72321             if (this.joinedAtEndOfWallAtStart === undefined) {
72322                 this.joinedAtEndOfWallAtStart = false;
72323             }
72324             if (this.joinedAtStartOfWallAtEnd === undefined) {
72325                 this.joinedAtStartOfWallAtEnd = false;
72326             }
72327             this.wall = wall;
72328             this.level = wall.getLevel();
72329             this.xStart = wall.getXStart();
72330             this.xEnd = wall.getXEnd();
72331             this.yStart = wall.getYStart();
72332             this.yEnd = wall.getYEnd();
72333             this.wallAtStart = wall.getWallAtStart();
72334             this.joinedAtEndOfWallAtStart = this.wallAtStart != null && this.wallAtStart.getWallAtEnd() === wall;
72335             this.wallAtEnd = wall.getWallAtEnd();
72336             this.joinedAtStartOfWallAtEnd = this.wallAtEnd != null && this.wallAtEnd.getWallAtStart() === wall;
72337         }
72338         JoinedWall.prototype.getWall = function () {
72339             return this.wall;
72340         };
72341         JoinedWall.prototype.getLevel = function () {
72342             return this.level;
72343         };
72344         JoinedWall.prototype.getXStart = function () {
72345             return this.xStart;
72346         };
72347         JoinedWall.prototype.getYStart = function () {
72348             return this.yStart;
72349         };
72350         JoinedWall.prototype.getXEnd = function () {
72351             return this.xEnd;
72352         };
72353         JoinedWall.prototype.getYEnd = function () {
72354             return this.yEnd;
72355         };
72356         JoinedWall.prototype.getWallAtEnd = function () {
72357             return this.wallAtEnd;
72358         };
72359         JoinedWall.prototype.getWallAtStart = function () {
72360             return this.wallAtStart;
72361         };
72362         JoinedWall.prototype.isJoinedAtEndOfWallAtStart = function () {
72363             return this.joinedAtEndOfWallAtStart;
72364         };
72365         JoinedWall.prototype.isJoinedAtStartOfWallAtEnd = function () {
72366             return this.joinedAtStartOfWallAtEnd;
72367         };
72368         /**
72369          * A helper method that builds an array of <code>JoinedWall</code> objects
72370          * for a given list of walls.
72371          * @param {Wall[]} walls
72372          * @return {com.eteks.sweethome3d.viewcontroller.PlanController.JoinedWall[]}
72373          */
72374         JoinedWall.getJoinedWalls = function (walls) {
72375             var joinedWalls = (function (s) { var a = []; while (s-- > 0)
72376                 a.push(null); return a; })(/* size */ walls.length);
72377             for (var i = 0; i < joinedWalls.length; i++) {
72378                 {
72379                     joinedWalls[i] = new PlanController.JoinedWall(/* get */ walls[i]);
72380                 }
72381                 ;
72382             }
72383             return joinedWalls;
72384         };
72385         /**
72386          * A helper method that builds a list of <code>Wall</code> objects
72387          * for a given array of <code>JoinedWall</code> objects.
72388          * @param {com.eteks.sweethome3d.viewcontroller.PlanController.JoinedWall[]} joinedWalls
72389          * @return {Wall[]}
72390          */
72391         JoinedWall.getWalls = function (joinedWalls) {
72392             var walls = (function (s) { var a = []; while (s-- > 0)
72393                 a.push(null); return a; })(joinedWalls.length);
72394             for (var i = 0; i < joinedWalls.length; i++) {
72395                 {
72396                     walls[i] = joinedWalls[i].getWall();
72397                 }
72398                 ;
72399             }
72400             return /* asList */ walls.slice(0);
72401         };
72402         return JoinedWall;
72403     }());
72404     PlanController.JoinedWall = JoinedWall;
72405     JoinedWall["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.JoinedWall";
72406     /**
72407      * A point which coordinates are computed with an angle magnetism algorithm.
72408      * @param {number} xStart
72409      * @param {number} yStart
72410      * @param {number} x
72411      * @param {number} y
72412      * @param {LengthUnit} unit
72413      * @param {number} maxLengthDelta
72414      * @param {number} circleSteps
72415      * @class
72416      */
72417     var PointWithAngleMagnetism = /** @class */ (function () {
72418         function PointWithAngleMagnetism(xStart, yStart, x, y, unit, maxLengthDelta, circleSteps) {
72419             if (((typeof xStart === 'number') || xStart === null) && ((typeof yStart === 'number') || yStart === null) && ((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((unit != null) || unit === null) && ((typeof maxLengthDelta === 'number') || maxLengthDelta === null) && ((typeof circleSteps === 'number') || circleSteps === null)) {
72420                 var __args = arguments;
72421                 if (this.x === undefined) {
72422                     this.x = 0;
72423                 }
72424                 if (this.y === undefined) {
72425                     this.y = 0;
72426                 }
72427                 if (this.angle === undefined) {
72428                     this.angle = 0;
72429                 }
72430                 this.x = x;
72431                 this.y = y;
72432                 if (xStart === x) {
72433                     var magnetizedLength = unit.getMagnetizedLength(Math.abs(yStart - y), maxLengthDelta);
72434                     this.y = yStart + (magnetizedLength * /* signum */ (function (f) { if (f > 0) {
72435                         return 1;
72436                     }
72437                     else if (f < 0) {
72438                         return -1;
72439                     }
72440                     else {
72441                         return 0;
72442                     } })(y - yStart));
72443                 }
72444                 else if (yStart === y) {
72445                     var magnetizedLength = unit.getMagnetizedLength(Math.abs(xStart - x), maxLengthDelta);
72446                     this.x = xStart + (magnetizedLength * /* signum */ (function (f) { if (f > 0) {
72447                         return 1;
72448                     }
72449                     else if (f < 0) {
72450                         return -1;
72451                     }
72452                     else {
72453                         return 0;
72454                     } })(x - xStart));
72455                 }
72456                 else {
72457                     var angleStep = 2 * Math.PI / circleSteps;
72458                     var angle = Math.atan2(yStart - y, x - xStart);
72459                     var previousStepAngle = Math.floor(angle / angleStep) * angleStep;
72460                     var angle1 = void 0;
72461                     var tanAngle1 = void 0;
72462                     var angle2 = void 0;
72463                     var tanAngle2 = void 0;
72464                     if (Math.tan(angle) > 0) {
72465                         angle1 = previousStepAngle;
72466                         tanAngle1 = Math.tan(previousStepAngle);
72467                         angle2 = previousStepAngle + angleStep;
72468                         tanAngle2 = Math.tan(previousStepAngle + angleStep);
72469                     }
72470                     else {
72471                         angle1 = previousStepAngle + angleStep;
72472                         tanAngle1 = Math.tan(previousStepAngle + angleStep);
72473                         angle2 = previousStepAngle;
72474                         tanAngle2 = Math.tan(previousStepAngle);
72475                     }
72476                     var firstQuarterTanAngle1 = Math.abs(tanAngle1);
72477                     var firstQuarterTanAngle2 = Math.abs(tanAngle2);
72478                     var xEnd1 = Math.abs(xStart - x);
72479                     var yEnd2 = Math.abs(yStart - y);
72480                     var xEnd2 = 0;
72481                     if (firstQuarterTanAngle2 > 1.0E-10) {
72482                         xEnd2 = (yEnd2 / firstQuarterTanAngle2);
72483                     }
72484                     var yEnd1 = 0;
72485                     if (firstQuarterTanAngle1 < 1.0E10) {
72486                         yEnd1 = (xEnd1 * firstQuarterTanAngle1);
72487                     }
72488                     var magnetismAngle = void 0;
72489                     if (Math.abs(xEnd2 - xEnd1) < Math.abs(yEnd1 - yEnd2)) {
72490                         magnetismAngle = angle2;
72491                         this.x = xStart + ((yStart - y) / tanAngle2);
72492                     }
72493                     else {
72494                         magnetismAngle = angle1;
72495                         this.y = yStart - ((x - xStart) * tanAngle1);
72496                     }
72497                     var magnetizedLength = unit.getMagnetizedLength(java.awt.geom.Point2D.distance(xStart, yStart, this.x, this.y), maxLengthDelta);
72498                     this.x = xStart + (magnetizedLength * Math.cos(magnetismAngle));
72499                     this.y = yStart - (magnetizedLength * Math.sin(magnetismAngle));
72500                     this.angle = magnetismAngle;
72501                 }
72502             }
72503             else if (((typeof xStart === 'number') || xStart === null) && ((typeof yStart === 'number') || yStart === null) && ((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null) && ((unit != null) || unit === null) && ((typeof maxLengthDelta === 'number') || maxLengthDelta === null) && circleSteps === undefined) {
72504                 var __args = arguments;
72505                 {
72506                     var __args_152 = arguments;
72507                     var circleSteps_1 = PointWithAngleMagnetism.CIRCLE_STEPS_15_DEG;
72508                     if (this.x === undefined) {
72509                         this.x = 0;
72510                     }
72511                     if (this.y === undefined) {
72512                         this.y = 0;
72513                     }
72514                     if (this.angle === undefined) {
72515                         this.angle = 0;
72516                     }
72517                     this.x = x;
72518                     this.y = y;
72519                     if (xStart === x) {
72520                         var magnetizedLength = unit.getMagnetizedLength(Math.abs(yStart - y), maxLengthDelta);
72521                         this.y = yStart + (magnetizedLength * /* signum */ (function (f) { if (f > 0) {
72522                             return 1;
72523                         }
72524                         else if (f < 0) {
72525                             return -1;
72526                         }
72527                         else {
72528                             return 0;
72529                         } })(y - yStart));
72530                     }
72531                     else if (yStart === y) {
72532                         var magnetizedLength = unit.getMagnetizedLength(Math.abs(xStart - x), maxLengthDelta);
72533                         this.x = xStart + (magnetizedLength * /* signum */ (function (f) { if (f > 0) {
72534                             return 1;
72535                         }
72536                         else if (f < 0) {
72537                             return -1;
72538                         }
72539                         else {
72540                             return 0;
72541                         } })(x - xStart));
72542                     }
72543                     else {
72544                         var angleStep = 2 * Math.PI / circleSteps_1;
72545                         var angle = Math.atan2(yStart - y, x - xStart);
72546                         var previousStepAngle = Math.floor(angle / angleStep) * angleStep;
72547                         var angle1 = void 0;
72548                         var tanAngle1 = void 0;
72549                         var angle2 = void 0;
72550                         var tanAngle2 = void 0;
72551                         if (Math.tan(angle) > 0) {
72552                             angle1 = previousStepAngle;
72553                             tanAngle1 = Math.tan(previousStepAngle);
72554                             angle2 = previousStepAngle + angleStep;
72555                             tanAngle2 = Math.tan(previousStepAngle + angleStep);
72556                         }
72557                         else {
72558                             angle1 = previousStepAngle + angleStep;
72559                             tanAngle1 = Math.tan(previousStepAngle + angleStep);
72560                             angle2 = previousStepAngle;
72561                             tanAngle2 = Math.tan(previousStepAngle);
72562                         }
72563                         var firstQuarterTanAngle1 = Math.abs(tanAngle1);
72564                         var firstQuarterTanAngle2 = Math.abs(tanAngle2);
72565                         var xEnd1 = Math.abs(xStart - x);
72566                         var yEnd2 = Math.abs(yStart - y);
72567                         var xEnd2 = 0;
72568                         if (firstQuarterTanAngle2 > 1.0E-10) {
72569                             xEnd2 = (yEnd2 / firstQuarterTanAngle2);
72570                         }
72571                         var yEnd1 = 0;
72572                         if (firstQuarterTanAngle1 < 1.0E10) {
72573                             yEnd1 = (xEnd1 * firstQuarterTanAngle1);
72574                         }
72575                         var magnetismAngle = void 0;
72576                         if (Math.abs(xEnd2 - xEnd1) < Math.abs(yEnd1 - yEnd2)) {
72577                             magnetismAngle = angle2;
72578                             this.x = xStart + ((yStart - y) / tanAngle2);
72579                         }
72580                         else {
72581                             magnetismAngle = angle1;
72582                             this.y = yStart - ((x - xStart) * tanAngle1);
72583                         }
72584                         var magnetizedLength = unit.getMagnetizedLength(java.awt.geom.Point2D.distance(xStart, yStart, this.x, this.y), maxLengthDelta);
72585                         this.x = xStart + (magnetizedLength * Math.cos(magnetismAngle));
72586                         this.y = yStart - (magnetizedLength * Math.sin(magnetismAngle));
72587                         this.angle = magnetismAngle;
72588                     }
72589                 }
72590                 if (this.x === undefined) {
72591                     this.x = 0;
72592                 }
72593                 if (this.y === undefined) {
72594                     this.y = 0;
72595                 }
72596                 if (this.angle === undefined) {
72597                     this.angle = 0;
72598                 }
72599             }
72600             else
72601                 throw new Error('invalid overload');
72602         }
72603         /**
72604          * Returns the abscissa of end point.
72605          * @return {number}
72606          */
72607         PointWithAngleMagnetism.prototype.getX = function () {
72608             return this.x;
72609         };
72610         /**
72611          * Sets the abscissa of end point.
72612          * @param {number} x
72613          */
72614         PointWithAngleMagnetism.prototype.setX = function (x) {
72615             this.x = x;
72616         };
72617         /**
72618          * Returns the ordinate of end point.
72619          * @return {number}
72620          */
72621         PointWithAngleMagnetism.prototype.getY = function () {
72622             return this.y;
72623         };
72624         /**
72625          * Sets the ordinate of end point.
72626          * @param {number} y
72627          */
72628         PointWithAngleMagnetism.prototype.setY = function (y) {
72629             this.y = y;
72630         };
72631         PointWithAngleMagnetism.prototype.getAngle = function () {
72632             return this.angle;
72633         };
72634         PointWithAngleMagnetism.CIRCLE_STEPS_15_DEG = 24;
72635         return PointWithAngleMagnetism;
72636     }());
72637     PlanController.PointWithAngleMagnetism = PointWithAngleMagnetism;
72638     PointWithAngleMagnetism["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PointWithAngleMagnetism";
72639     /**
72640      * A point which coordinates are equal to the closest point of a wall or a room.
72641      * @param {Room} editedRoom
72642      * @param {number} editedPointIndex
72643      * @param {number} x
72644      * @param {number} y
72645      * @class
72646      */
72647     var PointMagnetizedToClosestWallOrRoomPoint = /** @class */ (function () {
72648         function PointMagnetizedToClosestWallOrRoomPoint(__parent, editedRoom, editedPointIndex, x, y) {
72649             if (((editedRoom != null && editedRoom instanceof Room) || editedRoom === null) && ((typeof editedPointIndex === 'number') || editedPointIndex === null) && ((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null)) {
72650                 var __args = Array.prototype.slice.call(arguments, [1]);
72651                 if (this.x === undefined) {
72652                     this.x = 0;
72653                 }
72654                 if (this.y === undefined) {
72655                     this.y = 0;
72656                 }
72657                 if (this.magnetized === undefined) {
72658                     this.magnetized = false;
72659                 }
72660                 var margin = __parent.getSelectionMargin();
72661                 var smallestDistance = 1.7976931348623157E308;
72662                 {
72663                     var array = __parent.getRoomPathsFromWalls();
72664                     for (var index = 0; index < array.length; index++) {
72665                         var roomPath = array[index];
72666                         {
72667                             smallestDistance = this.updateMagnetizedPoint(-1, x, y, smallestDistance, __parent.getPathPoints(roomPath, false));
72668                         }
72669                     }
72670                 }
72671                 {
72672                     var array = __parent.getDetectableRoomsAtSelectedLevel();
72673                     for (var index = 0; index < array.length; index++) {
72674                         var room = array[index];
72675                         {
72676                             smallestDistance = this.updateMagnetizedPoint(room === editedRoom ? editedPointIndex : -1, x, y, smallestDistance, room.getPoints());
72677                         }
72678                     }
72679                 }
72680                 this.magnetized = smallestDistance <= margin * margin;
72681                 if (!this.magnetized) {
72682                     this.x = x;
72683                     this.y = y;
72684                 }
72685             }
72686             else if (((typeof editedRoom === 'number') || editedRoom === null) && ((typeof editedPointIndex === 'number') || editedPointIndex === null) && x === undefined && y === undefined) {
72687                 var __args = Array.prototype.slice.call(arguments, [1]);
72688                 var x_6 = __args[0];
72689                 var y_6 = __args[1];
72690                 {
72691                     var __args_153 = Array.prototype.slice.call(arguments, [1]);
72692                     var editedRoom_1 = null;
72693                     var editedPointIndex_1 = -1;
72694                     if (this.x === undefined) {
72695                         this.x = 0;
72696                     }
72697                     if (this.y === undefined) {
72698                         this.y = 0;
72699                     }
72700                     if (this.magnetized === undefined) {
72701                         this.magnetized = false;
72702                     }
72703                     var margin = __parent.getSelectionMargin();
72704                     var smallestDistance = 1.7976931348623157E308;
72705                     {
72706                         var array = __parent.getRoomPathsFromWalls();
72707                         for (var index = 0; index < array.length; index++) {
72708                             var roomPath = array[index];
72709                             {
72710                                 smallestDistance = this.updateMagnetizedPoint(-1, x_6, y_6, smallestDistance, __parent.getPathPoints(roomPath, false));
72711                             }
72712                         }
72713                     }
72714                     {
72715                         var array = __parent.getDetectableRoomsAtSelectedLevel();
72716                         for (var index = 0; index < array.length; index++) {
72717                             var room = array[index];
72718                             {
72719                                 smallestDistance = this.updateMagnetizedPoint(room === editedRoom_1 ? editedPointIndex_1 : -1, x_6, y_6, smallestDistance, room.getPoints());
72720                             }
72721                         }
72722                     }
72723                     this.magnetized = smallestDistance <= margin * margin;
72724                     if (!this.magnetized) {
72725                         this.x = x_6;
72726                         this.y = y_6;
72727                     }
72728                 }
72729                 if (this.x === undefined) {
72730                     this.x = 0;
72731                 }
72732                 if (this.y === undefined) {
72733                     this.y = 0;
72734                 }
72735                 if (this.magnetized === undefined) {
72736                     this.magnetized = false;
72737                 }
72738             }
72739             else
72740                 throw new Error('invalid overload');
72741         }
72742         PointMagnetizedToClosestWallOrRoomPoint.prototype.updateMagnetizedPoint = function (editedPointIndex, x, y, smallestDistance, points) {
72743             for (var i = 0; i < points.length; i++) {
72744                 {
72745                     if (i !== editedPointIndex) {
72746                         var distance = java.awt.geom.Point2D.distanceSq(points[i][0], points[i][1], x, y);
72747                         if (distance < smallestDistance) {
72748                             this.x = points[i][0];
72749                             this.y = points[i][1];
72750                             smallestDistance = distance;
72751                         }
72752                     }
72753                 }
72754                 ;
72755             }
72756             return smallestDistance;
72757         };
72758         /**
72759          * Returns the abscissa of end point computed with magnetism.
72760          * @return {number}
72761          */
72762         PointMagnetizedToClosestWallOrRoomPoint.prototype.getX = function () {
72763             return this.x;
72764         };
72765         /**
72766          * Returns the ordinate of end point computed with magnetism.
72767          * @return {number}
72768          */
72769         PointMagnetizedToClosestWallOrRoomPoint.prototype.getY = function () {
72770             return this.y;
72771         };
72772         PointMagnetizedToClosestWallOrRoomPoint.prototype.isMagnetized = function () {
72773             return this.magnetized;
72774         };
72775         return PointMagnetizedToClosestWallOrRoomPoint;
72776     }());
72777     PlanController.PointMagnetizedToClosestWallOrRoomPoint = PointMagnetizedToClosestWallOrRoomPoint;
72778     PointMagnetizedToClosestWallOrRoomPoint["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PointMagnetizedToClosestWallOrRoomPoint";
72779     /**
72780      * Controller state classes super class.
72781      * @class
72782      */
72783     var ControllerState = /** @class */ (function () {
72784         function ControllerState() {
72785         }
72786         ControllerState.prototype.enter = function () {
72787         };
72788         ControllerState.prototype.exit = function () {
72789         };
72790         ControllerState.prototype.setMode = function (mode) {
72791         };
72792         ControllerState.prototype.isModificationState = function () {
72793             return false;
72794         };
72795         ControllerState.prototype.isBasePlanModificationState = function () {
72796             return false;
72797         };
72798         ControllerState.prototype.deleteSelection = function () {
72799         };
72800         ControllerState.prototype.escape = function () {
72801         };
72802         ControllerState.prototype.moveSelection = function (dx, dy) {
72803         };
72804         ControllerState.prototype.toggleMagnetism = function (magnetismToggled) {
72805         };
72806         ControllerState.prototype.setAlignmentActivated = function (alignmentActivated) {
72807         };
72808         ControllerState.prototype.setDuplicationActivated = function (duplicationActivated) {
72809         };
72810         ControllerState.prototype.setEditionActivated = function (editionActivated) {
72811         };
72812         ControllerState.prototype.updateEditableProperty = function (editableField, value) {
72813         };
72814         ControllerState.prototype.pressMouse = function (x, y, clickCount, shiftDown, duplicationActivated) {
72815         };
72816         ControllerState.prototype.releaseMouse = function (x, y) {
72817         };
72818         ControllerState.prototype.moveMouse = function (x, y) {
72819         };
72820         ControllerState.prototype.zoom = function (factor) {
72821         };
72822         return ControllerState;
72823     }());
72824     PlanController.ControllerState = ControllerState;
72825     ControllerState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.ControllerState";
72826     /**
72827      * A point with coordinates computed with angle and wall points magnetism.
72828      * @param {Wall} editedWall
72829      * @param {number} xWall
72830      * @param {number} yWall
72831      * @param {number} x
72832      * @param {number} y
72833      * @class
72834      * @extends PlanController.PointWithAngleMagnetism
72835      */
72836     var WallPointWithAngleMagnetism = /** @class */ (function (_super) {
72837         __extends(WallPointWithAngleMagnetism, _super);
72838         function WallPointWithAngleMagnetism(__parent, editedWall, xWall, yWall, x, y) {
72839             var _this = _super.call(this, xWall, yWall, x, y, __parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit(), __parent.getView().getPixelLength()) || this;
72840             _this.__parent = __parent;
72841             var margin = PlanController.PIXEL_MARGIN / __parent.getScale();
72842             var deltaXToClosestWall = Infinity;
72843             var deltaYToClosestWall = Infinity;
72844             var xClosestWall = 0;
72845             var yClosestWall = 0;
72846             {
72847                 var array = __parent.getDetectableWallsAtSelectedLevel();
72848                 for (var index = 0; index < array.length; index++) {
72849                     var wall = array[index];
72850                     {
72851                         if (wall !== editedWall) {
72852                             if (Math.abs(_this.getX() - wall.getXStart()) < margin && (editedWall == null || !_this.equalsWallPoint(wall.getXStart(), wall.getYStart(), editedWall))) {
72853                                 if (Math.abs(deltaYToClosestWall) > Math.abs(_this.getY() - wall.getYStart())) {
72854                                     xClosestWall = wall.getXStart();
72855                                     deltaYToClosestWall = _this.getY() - yClosestWall;
72856                                 }
72857                             }
72858                             else if (Math.abs(_this.getX() - wall.getXEnd()) < margin && (editedWall == null || !_this.equalsWallPoint(wall.getXEnd(), wall.getYEnd(), editedWall))) {
72859                                 if (Math.abs(deltaYToClosestWall) > Math.abs(_this.getY() - wall.getYEnd())) {
72860                                     xClosestWall = wall.getXEnd();
72861                                     deltaYToClosestWall = _this.getY() - yClosestWall;
72862                                 }
72863                             }
72864                             if (Math.abs(_this.getY() - wall.getYStart()) < margin && (editedWall == null || !_this.equalsWallPoint(wall.getXStart(), wall.getYStart(), editedWall))) {
72865                                 if (Math.abs(deltaXToClosestWall) > Math.abs(_this.getX() - wall.getXStart())) {
72866                                     yClosestWall = wall.getYStart();
72867                                     deltaXToClosestWall = _this.getX() - xClosestWall;
72868                                 }
72869                             }
72870                             else if (Math.abs(_this.getY() - wall.getYEnd()) < margin && (editedWall == null || !_this.equalsWallPoint(wall.getXEnd(), wall.getYEnd(), editedWall))) {
72871                                 if (Math.abs(deltaXToClosestWall) > Math.abs(_this.getX() - wall.getXEnd())) {
72872                                     yClosestWall = wall.getYEnd();
72873                                     deltaXToClosestWall = _this.getX() - xClosestWall;
72874                                 }
72875                             }
72876                         }
72877                     }
72878                 }
72879             }
72880             if (editedWall != null) {
72881                 var alpha = -Math.tan(_this.getAngle());
72882                 var beta = Math.abs(alpha) < 1.0E10 ? yWall - alpha * xWall : Infinity;
72883                 if (deltaXToClosestWall !== Infinity && Math.abs(alpha) > 1.0E-10) {
72884                     var newX = ((yClosestWall - beta) / alpha);
72885                     if (java.awt.geom.Point2D.distanceSq(_this.getX(), _this.getY(), newX, yClosestWall) <= margin * margin) {
72886                         _this.setX(newX);
72887                         _this.setY(yClosestWall);
72888                         return _this;
72889                     }
72890                 }
72891                 if (deltaYToClosestWall !== Infinity && beta !== Infinity) {
72892                     var newY = (alpha * xClosestWall + beta);
72893                     if (java.awt.geom.Point2D.distanceSq(_this.getX(), _this.getY(), xClosestWall, newY) <= margin * margin) {
72894                         _this.setX(xClosestWall);
72895                         _this.setY(newY);
72896                     }
72897                 }
72898             }
72899             else {
72900                 if (deltaXToClosestWall !== Infinity) {
72901                     _this.setY(yClosestWall);
72902                 }
72903                 if (deltaYToClosestWall !== Infinity) {
72904                     _this.setX(xClosestWall);
72905                 }
72906             }
72907             return _this;
72908         }
72909         /**
72910          * Returns <code>true</code> if <code>wall</code> start or end point
72911          * equals the point (<code>x</code>, <code>y</code>).
72912          * @param {number} x
72913          * @param {number} y
72914          * @param {Wall} wall
72915          * @return {boolean}
72916          * @private
72917          */
72918         WallPointWithAngleMagnetism.prototype.equalsWallPoint = function (x, y, wall) {
72919             return x === wall.getXStart() && y === wall.getYStart() || x === wall.getXEnd() && y === wall.getYEnd();
72920         };
72921         return WallPointWithAngleMagnetism;
72922     }(PlanController.PointWithAngleMagnetism));
72923     PlanController.WallPointWithAngleMagnetism = WallPointWithAngleMagnetism;
72924     WallPointWithAngleMagnetism["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.WallPointWithAngleMagnetism";
72925     /**
72926      * A point with coordinates computed with angle and room points magnetism.
72927      * @param {Room} editedRoom
72928      * @param {number} editedPointIndex
72929      * @param {number} xRoom
72930      * @param {number} yRoom
72931      * @param {number} x
72932      * @param {number} y
72933      * @class
72934      * @extends PlanController.PointWithAngleMagnetism
72935      */
72936     var RoomPointWithAngleMagnetism = /** @class */ (function (_super) {
72937         __extends(RoomPointWithAngleMagnetism, _super);
72938         function RoomPointWithAngleMagnetism(__parent, editedRoom, editedPointIndex, xRoom, yRoom, x, y) {
72939             var _this = _super.call(this, xRoom, yRoom, x, y, __parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit(), __parent.getView().getPixelLength()) || this;
72940             _this.__parent = __parent;
72941             var planScale = __parent.getScale();
72942             var margin = PlanController.PIXEL_MARGIN / planScale;
72943             var deltaXToClosestObject = Infinity;
72944             var deltaYToClosestObject = Infinity;
72945             var xClosestObject = 0;
72946             var yClosestObject = 0;
72947             {
72948                 var array = __parent.getDetectableRoomsAtSelectedLevel();
72949                 for (var index = 0; index < array.length; index++) {
72950                     var room = array[index];
72951                     {
72952                         var roomPoints = room.getPoints();
72953                         for (var i = 0; i < roomPoints.length; i++) {
72954                             {
72955                                 if (editedPointIndex === -1 || (i !== editedPointIndex && roomPoints.length > 2)) {
72956                                     if (Math.abs(_this.getX() - roomPoints[i][0]) < margin && Math.abs(deltaYToClosestObject) > Math.abs(_this.getY() - roomPoints[i][1])) {
72957                                         xClosestObject = roomPoints[i][0];
72958                                         deltaYToClosestObject = _this.getY() - roomPoints[i][1];
72959                                     }
72960                                     if (Math.abs(_this.getY() - roomPoints[i][1]) < margin && Math.abs(deltaXToClosestObject) > Math.abs(_this.getX() - roomPoints[i][0])) {
72961                                         yClosestObject = roomPoints[i][1];
72962                                         deltaXToClosestObject = _this.getX() - roomPoints[i][0];
72963                                     }
72964                                 }
72965                             }
72966                             ;
72967                         }
72968                     }
72969                 }
72970             }
72971             {
72972                 var array = __parent.getDetectableWallsAtSelectedLevel();
72973                 for (var index = 0; index < array.length; index++) {
72974                     var wall = array[index];
72975                     {
72976                         var wallPoints = wall.getPoints$();
72977                         wallPoints = [wallPoints[0], wallPoints[(wallPoints.length / 2 | 0) - 1], wallPoints[(wallPoints.length / 2 | 0)], wallPoints[wallPoints.length - 1]];
72978                         for (var i = 0; i < wallPoints.length; i++) {
72979                             {
72980                                 if (Math.abs(_this.getX() - wallPoints[i][0]) < margin && Math.abs(deltaYToClosestObject) > Math.abs(_this.getY() - wallPoints[i][1])) {
72981                                     xClosestObject = wallPoints[i][0];
72982                                     deltaYToClosestObject = _this.getY() - wallPoints[i][1];
72983                                 }
72984                                 if (Math.abs(_this.getY() - wallPoints[i][1]) < margin && Math.abs(deltaXToClosestObject) > Math.abs(_this.getX() - wallPoints[i][0])) {
72985                                     yClosestObject = wallPoints[i][1];
72986                                     deltaXToClosestObject = _this.getX() - wallPoints[i][0];
72987                                 }
72988                             }
72989                             ;
72990                         }
72991                     }
72992                 }
72993             }
72994             if (editedRoom != null) {
72995                 var alpha = -Math.tan(_this.getAngle());
72996                 var beta = Math.abs(alpha) < 1.0E10 ? yRoom - alpha * xRoom : Infinity;
72997                 if (deltaXToClosestObject !== Infinity && Math.abs(alpha) > 1.0E-10) {
72998                     var newX = ((yClosestObject - beta) / alpha);
72999                     if (java.awt.geom.Point2D.distanceSq(_this.getX(), _this.getY(), newX, yClosestObject) <= margin * margin) {
73000                         _this.setX(newX);
73001                         _this.setY(yClosestObject);
73002                         return _this;
73003                     }
73004                 }
73005                 if (deltaYToClosestObject !== Infinity && beta !== Infinity) {
73006                     var newY = (alpha * xClosestObject + beta);
73007                     if (java.awt.geom.Point2D.distanceSq(_this.getX(), _this.getY(), xClosestObject, newY) <= margin * margin) {
73008                         _this.setX(xClosestObject);
73009                         _this.setY(newY);
73010                     }
73011                 }
73012             }
73013             else {
73014                 if (deltaXToClosestObject !== Infinity) {
73015                     _this.setY(yClosestObject);
73016                 }
73017                 if (deltaYToClosestObject !== Infinity) {
73018                     _this.setX(xClosestObject);
73019                 }
73020             }
73021             return _this;
73022         }
73023         return RoomPointWithAngleMagnetism;
73024     }(PlanController.PointWithAngleMagnetism));
73025     PlanController.RoomPointWithAngleMagnetism = RoomPointWithAngleMagnetism;
73026     RoomPointWithAngleMagnetism["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RoomPointWithAngleMagnetism";
73027     /**
73028      * A decorator on controller state, useful to change the behavior of an existing state.
73029      * @param {PlanController.ControllerState} state
73030      * @class
73031      * @extends PlanController.ControllerState
73032      */
73033     var ControllerStateDecorator = /** @class */ (function (_super) {
73034         __extends(ControllerStateDecorator, _super);
73035         function ControllerStateDecorator(state) {
73036             var _this = _super.call(this) || this;
73037             if (_this.state === undefined) {
73038                 _this.state = null;
73039             }
73040             _this.state = state;
73041             return _this;
73042         }
73043         /**
73044          *
73045          */
73046         ControllerStateDecorator.prototype.enter = function () {
73047             this.state.enter();
73048         };
73049         /**
73050          *
73051          */
73052         ControllerStateDecorator.prototype.exit = function () {
73053             this.state.exit();
73054         };
73055         /**
73056          *
73057          * @return {PlanController.Mode}
73058          */
73059         ControllerStateDecorator.prototype.getMode = function () {
73060             return this.state.getMode();
73061         };
73062         /**
73063          *
73064          * @param {PlanController.Mode} mode
73065          */
73066         ControllerStateDecorator.prototype.setMode = function (mode) {
73067             this.state.setMode(mode);
73068         };
73069         /**
73070          *
73071          * @return {boolean}
73072          */
73073         ControllerStateDecorator.prototype.isModificationState = function () {
73074             return this.state.isModificationState();
73075         };
73076         /**
73077          *
73078          * @return {boolean}
73079          */
73080         ControllerStateDecorator.prototype.isBasePlanModificationState = function () {
73081             return this.state.isBasePlanModificationState();
73082         };
73083         /**
73084          *
73085          */
73086         ControllerStateDecorator.prototype.deleteSelection = function () {
73087             this.state.deleteSelection();
73088         };
73089         /**
73090          *
73091          */
73092         ControllerStateDecorator.prototype.escape = function () {
73093             this.state.escape();
73094         };
73095         /**
73096          *
73097          * @param {number} dx
73098          * @param {number} dy
73099          */
73100         ControllerStateDecorator.prototype.moveSelection = function (dx, dy) {
73101             this.state.moveSelection(dx, dy);
73102         };
73103         /**
73104          *
73105          * @param {boolean} magnetismToggled
73106          */
73107         ControllerStateDecorator.prototype.toggleMagnetism = function (magnetismToggled) {
73108             this.state.toggleMagnetism(magnetismToggled);
73109         };
73110         /**
73111          *
73112          * @param {boolean} alignmentActivated
73113          */
73114         ControllerStateDecorator.prototype.setAlignmentActivated = function (alignmentActivated) {
73115             this.state.setAlignmentActivated(alignmentActivated);
73116         };
73117         /**
73118          *
73119          * @param {boolean} duplicationActivated
73120          */
73121         ControllerStateDecorator.prototype.setDuplicationActivated = function (duplicationActivated) {
73122             this.state.setDuplicationActivated(duplicationActivated);
73123         };
73124         /**
73125          *
73126          * @param {boolean} editionActivated
73127          */
73128         ControllerStateDecorator.prototype.setEditionActivated = function (editionActivated) {
73129             this.state.setEditionActivated(editionActivated);
73130         };
73131         /**
73132          *
73133          * @param {string} editableField
73134          * @param {Object} value
73135          */
73136         ControllerStateDecorator.prototype.updateEditableProperty = function (editableField, value) {
73137             this.state.updateEditableProperty(editableField, value);
73138         };
73139         /**
73140          *
73141          * @param {number} x
73142          * @param {number} y
73143          * @param {number} clickCount
73144          * @param {boolean} shiftDown
73145          * @param {boolean} duplicationActivated
73146          */
73147         ControllerStateDecorator.prototype.pressMouse = function (x, y, clickCount, shiftDown, duplicationActivated) {
73148             this.state.pressMouse(x, y, clickCount, shiftDown, duplicationActivated);
73149         };
73150         /**
73151          *
73152          * @param {number} x
73153          * @param {number} y
73154          */
73155         ControllerStateDecorator.prototype.releaseMouse = function (x, y) {
73156             this.state.releaseMouse(x, y);
73157         };
73158         /**
73159          *
73160          * @param {number} x
73161          * @param {number} y
73162          */
73163         ControllerStateDecorator.prototype.moveMouse = function (x, y) {
73164             this.state.moveMouse(x, y);
73165         };
73166         /**
73167          *
73168          * @param {number} factor
73169          */
73170         ControllerStateDecorator.prototype.zoom = function (factor) {
73171             this.state.zoom(factor);
73172         };
73173         return ControllerStateDecorator;
73174     }(PlanController.ControllerState));
73175     PlanController.ControllerStateDecorator = ControllerStateDecorator;
73176     ControllerStateDecorator["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.ControllerStateDecorator";
73177     /**
73178      * Abstract state able to manage the transition to other modes.
73179      * @extends PlanController.ControllerState
73180      * @class
73181      */
73182     var AbstractModeChangeState = /** @class */ (function (_super) {
73183         __extends(AbstractModeChangeState, _super);
73184         function AbstractModeChangeState(__parent) {
73185             var _this = _super.call(this) || this;
73186             _this.__parent = __parent;
73187             return _this;
73188         }
73189         /**
73190          *
73191          * @param {PlanController.Mode} mode
73192          */
73193         AbstractModeChangeState.prototype.setMode = function (mode) {
73194             if (mode === PlanController.Mode.SELECTION_$LI$()) {
73195                 this.__parent.setState(this.__parent.getSelectionState());
73196             }
73197             else if (mode === PlanController.Mode.PANNING_$LI$()) {
73198                 this.__parent.setState(this.__parent.getPanningState());
73199             }
73200             else if (mode === PlanController.Mode.WALL_CREATION_$LI$()) {
73201                 this.__parent.setState(this.__parent.getWallCreationState());
73202             }
73203             else if (mode === PlanController.Mode.ROOM_CREATION_$LI$()) {
73204                 this.__parent.setState(this.__parent.getRoomCreationState());
73205             }
73206             else if (mode === PlanController.Mode.POLYLINE_CREATION_$LI$()) {
73207                 this.__parent.setState(this.__parent.getPolylineCreationState());
73208             }
73209             else if (mode === PlanController.Mode.DIMENSION_LINE_CREATION_$LI$()) {
73210                 this.__parent.setState(this.__parent.getDimensionLineCreationState());
73211             }
73212             else if (mode === PlanController.Mode.LABEL_CREATION_$LI$()) {
73213                 this.__parent.setState(this.__parent.getLabelCreationState());
73214             }
73215         };
73216         /**
73217          *
73218          */
73219         AbstractModeChangeState.prototype.deleteSelection = function () {
73220             this.__parent.deleteItems(this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems());
73221             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
73222         };
73223         /**
73224          *
73225          * @param {number} dx
73226          * @param {number} dy
73227          */
73228         AbstractModeChangeState.prototype.moveSelection = function (dx, dy) {
73229             this.__parent.moveAndShowSelectedItems(dx, dy);
73230             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
73231         };
73232         /**
73233          *
73234          * @param {number} factor
73235          */
73236         AbstractModeChangeState.prototype.zoom = function (factor) {
73237             this.__parent.setScale(this.__parent.getScale() * factor);
73238         };
73239         return AbstractModeChangeState;
73240     }(PlanController.ControllerState));
73241     PlanController.AbstractModeChangeState = AbstractModeChangeState;
73242     AbstractModeChangeState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.AbstractModeChangeState";
73243     /**
73244      * Move selection state. This state manages the move of current selected items
73245      * with mouse and the selection of one item, if mouse isn't moved while button
73246      * is depressed. If duplication is activated during the move of the mouse,
73247      * moved items are duplicated first.
73248      * @extends PlanController.ControllerState
73249      * @class
73250      */
73251     var SelectionMoveState = /** @class */ (function (_super) {
73252         __extends(SelectionMoveState, _super);
73253         function SelectionMoveState(__parent) {
73254             var _this = _super.call(this) || this;
73255             _this.__parent = __parent;
73256             if (_this.xLastMouseMove === undefined) {
73257                 _this.xLastMouseMove = 0;
73258             }
73259             if (_this.yLastMouseMove === undefined) {
73260                 _this.yLastMouseMove = 0;
73261             }
73262             if (_this.mouseMoved === undefined) {
73263                 _this.mouseMoved = false;
73264             }
73265             if (_this.oldSelection === undefined) {
73266                 _this.oldSelection = null;
73267             }
73268             if (_this.selectionUpdateNeeded === undefined) {
73269                 _this.selectionUpdateNeeded = false;
73270             }
73271             if (_this.movedItems === undefined) {
73272                 _this.movedItems = null;
73273             }
73274             if (_this.duplicatedItems === undefined) {
73275                 _this.duplicatedItems = null;
73276             }
73277             if (_this.movedPieceOfFurniture === undefined) {
73278                 _this.movedPieceOfFurniture = null;
73279             }
73280             if (_this.angleMovedPieceOfFurniture === undefined) {
73281                 _this.angleMovedPieceOfFurniture = 0;
73282             }
73283             if (_this.depthMovedPieceOfFurniture === undefined) {
73284                 _this.depthMovedPieceOfFurniture = 0;
73285             }
73286             if (_this.elevationMovedPieceOfFurniture === undefined) {
73287                 _this.elevationMovedPieceOfFurniture = 0;
73288             }
73289             if (_this.xMovedPieceOfFurniture === undefined) {
73290                 _this.xMovedPieceOfFurniture = 0;
73291             }
73292             if (_this.yMovedPieceOfFurniture === undefined) {
73293                 _this.yMovedPieceOfFurniture = 0;
73294             }
73295             if (_this.movedDoorOrWindowBoundToWall === undefined) {
73296                 _this.movedDoorOrWindowBoundToWall = false;
73297             }
73298             if (_this.magnetismEnabled === undefined) {
73299                 _this.magnetismEnabled = false;
73300             }
73301             if (_this.duplicationActivated === undefined) {
73302                 _this.duplicationActivated = false;
73303             }
73304             if (_this.alignmentActivated === undefined) {
73305                 _this.alignmentActivated = false;
73306             }
73307             if (_this.basePlanModification === undefined) {
73308                 _this.basePlanModification = false;
73309             }
73310             return _this;
73311         }
73312         /**
73313          *
73314          * @return {PlanController.Mode}
73315          */
73316         SelectionMoveState.prototype.getMode = function () {
73317             return PlanController.Mode.SELECTION_$LI$();
73318         };
73319         /**
73320          *
73321          * @return {boolean}
73322          */
73323         SelectionMoveState.prototype.isModificationState = function () {
73324             return true;
73325         };
73326         /**
73327          *
73328          * @return {boolean}
73329          */
73330         SelectionMoveState.prototype.isBasePlanModificationState = function () {
73331             return this.basePlanModification;
73332         };
73333         /**
73334          *
73335          */
73336         SelectionMoveState.prototype.enter = function () {
73337             this.xLastMouseMove = this.__parent.getXLastMousePress();
73338             this.yLastMouseMove = this.__parent.getYLastMousePress();
73339             this.mouseMoved = false;
73340             var selectableItemsUnderCursor = this.__parent.getSelectableItemsAt(this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
73341             var selectableItemsAndGroupsFurnitureUnderCursor = (selectableItemsUnderCursor.slice(0));
73342             var selectionMargin = this.__parent.getSelectionMargin();
73343             for (var index = 0; index < selectableItemsUnderCursor.length; index++) {
73344                 var item = selectableItemsUnderCursor[index];
73345                 {
73346                     if (item != null && item instanceof HomeFurnitureGroup) {
73347                         {
73348                             var array = item.getAllFurniture();
73349                             for (var index1 = 0; index1 < array.length; index1++) {
73350                                 var piece = array[index1];
73351                                 {
73352                                     if (piece.containsPoint(this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress(), selectionMargin)) {
73353                                         /* add */ (selectableItemsAndGroupsFurnitureUnderCursor.push(piece) > 0);
73354                                     }
73355                                 }
73356                             }
73357                         }
73358                     }
73359                 }
73360             }
73361             this.oldSelection = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
73362             this.toggleMagnetism(this.__parent.wasMagnetismToggledLastMousePress());
73363             this.selectionUpdateNeeded = /* disjoint */ (function (c1, c2) { for (var i = 0; i < c1.length; i++) {
73364                 if (c2.indexOf(c1[i]) >= 0)
73365                     return false;
73366             } return true; })(selectableItemsAndGroupsFurnitureUnderCursor, this.oldSelection);
73367             if (this.selectionUpdateNeeded && this.__parent.getPointerTypeLastMousePress() !== View.PointerType.TOUCH) {
73368                 this.__parent.selectItem(this.__parent.getSelectableItemAt(this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress(), false));
73369             }
73370             var selectedItems = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
73371             this.movedItems = ([]);
73372             this.basePlanModification = false;
73373             for (var index = 0; index < selectedItems.length; index++) {
73374                 var item = selectedItems[index];
73375                 {
73376                     if (this.__parent.isItemMovable(item)) {
73377                         /* add */ (this.movedItems.push(item) > 0);
73378                         if (!this.basePlanModification && this.__parent.isItemPartOfBasePlan(item)) {
73379                             this.basePlanModification = true;
73380                         }
73381                     }
73382                 }
73383             }
73384             if ( /* size */this.movedItems.length === 1 && ( /* get */this.movedItems[0] != null && /* get */ this.movedItems[0] instanceof HomePieceOfFurniture)) {
73385                 this.movedPieceOfFurniture = this.movedItems[0];
73386                 this.xMovedPieceOfFurniture = this.movedPieceOfFurniture.getX();
73387                 this.yMovedPieceOfFurniture = this.movedPieceOfFurniture.getY();
73388                 this.angleMovedPieceOfFurniture = this.movedPieceOfFurniture.getAngle();
73389                 this.depthMovedPieceOfFurniture = this.movedPieceOfFurniture.getDepth();
73390                 this.elevationMovedPieceOfFurniture = this.movedPieceOfFurniture.getElevation();
73391                 this.movedDoorOrWindowBoundToWall = (this.movedPieceOfFurniture != null && this.movedPieceOfFurniture instanceof HomeDoorOrWindow) && this.movedPieceOfFurniture.isBoundToWall();
73392             }
73393             this.duplicatedItems = null;
73394             this.duplicationActivated = this.__parent.wasDuplicationActivatedLastMousePress() && !this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection();
73395             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
73396             if (!(this.__parent.getPointerTypeLastMousePress() === View.PointerType.TOUCH && this.selectionUpdateNeeded)) {
73397                 this.__parent.getView().setCursor(PlanView.CursorType.MOVE);
73398             }
73399         };
73400         /**
73401          *
73402          * @param {number} x
73403          * @param {number} y
73404          */
73405         SelectionMoveState.prototype.moveMouse = function (x, y) {
73406             if (this.__parent.getPointerTypeLastMousePress() === View.PointerType.TOUCH && this.selectionUpdateNeeded) {
73407                 this.__parent.setState(new SelectionMoveState.SelectionMoveState$0(this, this.__parent.getPanningState()));
73408             }
73409             else {
73410                 if (!this.mouseMoved) {
73411                     this.toggleDuplication(this.duplicationActivated);
73412                 }
73413                 if (this.alignmentActivated) {
73414                     var alignedPoint = new PlanController.PointWithAngleMagnetism(this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress(), x, y, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit(), this.__parent.getView().getPixelLength(), 4);
73415                     x = alignedPoint.getX();
73416                     y = alignedPoint.getY();
73417                 }
73418                 if (this.movedPieceOfFurniture != null) {
73419                     this.movedPieceOfFurniture.setX(this.xMovedPieceOfFurniture);
73420                     this.movedPieceOfFurniture.setY(this.yMovedPieceOfFurniture);
73421                     this.movedPieceOfFurniture.setAngle(this.angleMovedPieceOfFurniture);
73422                     if ((this.movedPieceOfFurniture != null && this.movedPieceOfFurniture instanceof HomeDoorOrWindow) && this.movedPieceOfFurniture.isResizable() && this.__parent.isItemResizable(this.movedPieceOfFurniture)) {
73423                         this.movedPieceOfFurniture.setDepth(this.depthMovedPieceOfFurniture);
73424                     }
73425                     this.movedPieceOfFurniture.setElevation(this.elevationMovedPieceOfFurniture);
73426                     this.movedPieceOfFurniture.move(x - this.__parent.getXLastMousePress(), y - this.__parent.getYLastMousePress());
73427                     if (this.magnetismEnabled && !this.alignmentActivated) {
73428                         var elevationAdjusted = this.__parent.adjustPieceOfFurnitureElevation(this.movedPieceOfFurniture, true, 3.4028235E38) != null;
73429                         var magnetWall = this.__parent.adjustPieceOfFurnitureOnWallAt(this.movedPieceOfFurniture, x, y, false);
73430                         var referencePiece = null;
73431                         if (!elevationAdjusted) {
73432                             referencePiece = this.__parent.adjustPieceOfFurnitureSideBySideAt(this.movedPieceOfFurniture, false, magnetWall);
73433                         }
73434                         if (referencePiece == null) {
73435                             this.__parent.adjustPieceOfFurnitureInShelfBox(this.movedPieceOfFurniture, false);
73436                         }
73437                         if (this.__parent.feedbackDisplayed && magnetWall != null) {
73438                             this.__parent.getView().setDimensionLinesFeedback(this.__parent.getDimensionLinesAlongWall(this.movedPieceOfFurniture, magnetWall));
73439                         }
73440                         else {
73441                             this.__parent.getView().setDimensionLinesFeedback(null);
73442                         }
73443                     }
73444                 }
73445                 else {
73446                     this.__parent.moveItems(this.movedItems, x - this.xLastMouseMove, y - this.yLastMouseMove);
73447                 }
73448                 if (!this.mouseMoved) {
73449                     this.__parent.selectItems(this.movedItems, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection());
73450                 }
73451                 this.__parent.getView().makePointVisible(x, y);
73452                 this.xLastMouseMove = x;
73453                 this.yLastMouseMove = y;
73454                 this.mouseMoved = true;
73455             }
73456         };
73457         /**
73458          *
73459          * @param {number} x
73460          * @param {number} y
73461          */
73462         SelectionMoveState.prototype.releaseMouse = function (x, y) {
73463             if (this.mouseMoved) {
73464                 if ( /* size */this.movedItems.length > 0 && !( /* get */this.movedItems[0] != null && /* get */ this.movedItems[0] instanceof Camera)) {
73465                     if (this.duplicatedItems != null) {
73466                         this.__parent.postItemsDuplication(this.movedItems, this.duplicatedItems);
73467                     }
73468                     else if (this.movedPieceOfFurniture != null) {
73469                         this.__parent.postPieceOfFurnitureMove(this.movedPieceOfFurniture, this.movedPieceOfFurniture.getX() - this.xMovedPieceOfFurniture, this.movedPieceOfFurniture.getY() - this.yMovedPieceOfFurniture, this.angleMovedPieceOfFurniture, this.depthMovedPieceOfFurniture, this.elevationMovedPieceOfFurniture, this.movedDoorOrWindowBoundToWall);
73470                     }
73471                     else {
73472                         this.__parent.postItemsMove(this.movedItems, this.oldSelection, this.xLastMouseMove - this.__parent.getXLastMousePress(), this.yLastMouseMove - this.__parent.getYLastMousePress());
73473                     }
73474                 }
73475             }
73476             else {
73477                 if (this.__parent.getPointerTypeLastMousePress() === View.PointerType.TOUCH || !(function (c1, c2) { for (var i = 0; i < c1.length; i++) {
73478                     if (c2.indexOf(c1[i]) >= 0)
73479                         return false;
73480                 } return true; })(this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems(), this.oldSelection)) {
73481                     var itemUnderCursor = this.__parent.getSelectableItemAt(x, y, false);
73482                     if (itemUnderCursor != null) {
73483                         this.__parent.selectItem(itemUnderCursor);
73484                     }
73485                     else {
73486                         this.__parent.deselectAll();
73487                     }
73488                 }
73489             }
73490             this.__parent.setState(this.__parent.getSelectionState());
73491         };
73492         /**
73493          *
73494          * @param {boolean} magnetismToggled
73495          */
73496         SelectionMoveState.prototype.toggleMagnetism = function (magnetismToggled) {
73497             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
73498             if (this.movedPieceOfFurniture != null) {
73499                 this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
73500                 if (!this.magnetismEnabled) {
73501                     this.__parent.getView().deleteFeedback();
73502                 }
73503             }
73504         };
73505         /**
73506          *
73507          */
73508         SelectionMoveState.prototype.escape = function () {
73509             if (this.mouseMoved) {
73510                 if (this.duplicatedItems != null) {
73511                     this.__parent.doDeleteItems(this.movedItems);
73512                     this.__parent.selectItems(this.duplicatedItems);
73513                 }
73514                 else {
73515                     if (this.movedPieceOfFurniture != null) {
73516                         this.movedPieceOfFurniture.setX(this.xMovedPieceOfFurniture);
73517                         this.movedPieceOfFurniture.setY(this.yMovedPieceOfFurniture);
73518                         this.movedPieceOfFurniture.setAngle(this.angleMovedPieceOfFurniture);
73519                         if ((this.movedPieceOfFurniture != null && this.movedPieceOfFurniture instanceof HomeDoorOrWindow) && this.movedPieceOfFurniture.isResizable() && this.__parent.isItemResizable(this.movedPieceOfFurniture)) {
73520                             this.movedPieceOfFurniture.setDepth(this.depthMovedPieceOfFurniture);
73521                         }
73522                         this.movedPieceOfFurniture.setElevation(this.elevationMovedPieceOfFurniture);
73523                         if (this.movedPieceOfFurniture != null && this.movedPieceOfFurniture instanceof HomeDoorOrWindow) {
73524                             this.movedPieceOfFurniture.setBoundToWall(this.movedDoorOrWindowBoundToWall);
73525                         }
73526                     }
73527                     else {
73528                         this.__parent.moveItems(this.movedItems, this.__parent.getXLastMousePress() - this.xLastMouseMove, this.__parent.getYLastMousePress() - this.yLastMouseMove);
73529                     }
73530                 }
73531             }
73532             this.__parent.setState(this.__parent.getSelectionState());
73533         };
73534         /**
73535          *
73536          * @param {boolean} duplicationActivated
73537          */
73538         SelectionMoveState.prototype.setDuplicationActivated = function (duplicationActivated) {
73539             duplicationActivated = !this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection() && duplicationActivated;
73540             if (this.mouseMoved) {
73541                 this.toggleDuplication(duplicationActivated);
73542             }
73543             this.duplicationActivated = duplicationActivated;
73544         };
73545         /**
73546          *
73547          * @param {boolean} alignmentActivated
73548          */
73549         SelectionMoveState.prototype.setAlignmentActivated = function (alignmentActivated) {
73550             if (this.__parent.getPointerTypeLastMousePress() === View.PointerType.TOUCH && this.selectionUpdateNeeded && !this.duplicationActivated) {
73551                 this.__parent.setState(this.__parent.getSelectionState());
73552                 this.__parent.pressMouse$float$float$int$boolean$boolean$boolean$boolean$com_eteks_sweethome3d_viewcontroller_View_PointerType(this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress(), 1, true, false, false, false, this.__parent.getPointerTypeLastMousePress());
73553             }
73554             else {
73555                 this.alignmentActivated = alignmentActivated;
73556                 if (this.mouseMoved) {
73557                     this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
73558                 }
73559                 if (this.alignmentActivated) {
73560                     this.__parent.getView().deleteFeedback();
73561                 }
73562             }
73563         };
73564         SelectionMoveState.prototype.toggleDuplication = function (duplicationActivated) {
73565             if ( /* size */this.movedItems.length > 1 || ( /* size */this.movedItems.length === 1 && !( /* get */this.movedItems[0] != null && /* get */ this.movedItems[0] instanceof Camera) && !( /* get */this.movedItems[0] != null && /* get */ this.movedItems[0] instanceof Compass))) {
73566                 if (duplicationActivated && this.duplicatedItems == null) {
73567                     this.duplicatedItems = this.movedItems;
73568                     this.movedItems = ([]);
73569                     {
73570                         var array = Home.duplicate(this.duplicatedItems);
73571                         for (var index = 0; index < array.length; index++) {
73572                             var item = array[index];
73573                             {
73574                                 if (item != null && item instanceof Wall) {
73575                                     this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addWall(item);
73576                                 }
73577                                 else if (item != null && item instanceof Room) {
73578                                     this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addRoom$com_eteks_sweethome3d_model_Room(item);
73579                                 }
73580                                 else if (item != null && item instanceof Polyline) {
73581                                     this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addPolyline$com_eteks_sweethome3d_model_Polyline(item);
73582                                 }
73583                                 else if (item != null && item instanceof DimensionLine) {
73584                                     this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addDimensionLine(item);
73585                                 }
73586                                 else if (item != null && item instanceof HomePieceOfFurniture) {
73587                                     this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addPieceOfFurniture$com_eteks_sweethome3d_model_HomePieceOfFurniture(item);
73588                                 }
73589                                 else if (item != null && item instanceof Label) {
73590                                     this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addLabel(item);
73591                                 }
73592                                 else {
73593                                     continue;
73594                                 }
73595                                 /* add */ (this.movedItems.push(item) > 0);
73596                             }
73597                         }
73598                     }
73599                     if (this.movedPieceOfFurniture != null) {
73600                         this.movedPieceOfFurniture.setX(this.xMovedPieceOfFurniture);
73601                         this.movedPieceOfFurniture.setY(this.yMovedPieceOfFurniture);
73602                         this.movedPieceOfFurniture.setAngle(this.angleMovedPieceOfFurniture);
73603                         if ((this.movedPieceOfFurniture != null && this.movedPieceOfFurniture instanceof HomeDoorOrWindow) && this.movedPieceOfFurniture.isResizable() && this.__parent.isItemResizable(this.movedPieceOfFurniture)) {
73604                             this.movedPieceOfFurniture.setDepth(this.depthMovedPieceOfFurniture);
73605                         }
73606                         this.movedPieceOfFurniture.setElevation(this.elevationMovedPieceOfFurniture);
73607                         this.movedPieceOfFurniture = this.movedItems[0];
73608                     }
73609                     else {
73610                         this.__parent.moveItems(this.duplicatedItems, this.__parent.getXLastMousePress() - this.xLastMouseMove, this.__parent.getYLastMousePress() - this.yLastMouseMove);
73611                     }
73612                     this.__parent.getView().setCursor(PlanView.CursorType.DUPLICATION);
73613                 }
73614                 else if (!duplicationActivated && this.duplicatedItems != null) {
73615                     this.__parent.doDeleteItems(this.movedItems);
73616                     this.__parent.moveItems(this.duplicatedItems, this.xLastMouseMove - this.__parent.getXLastMousePress(), this.yLastMouseMove - this.__parent.getYLastMousePress());
73617                     this.movedItems = this.duplicatedItems;
73618                     this.duplicatedItems = null;
73619                     if (this.movedPieceOfFurniture != null) {
73620                         this.movedPieceOfFurniture = this.movedItems[0];
73621                     }
73622                     this.__parent.getView().setCursor(PlanView.CursorType.MOVE);
73623                 }
73624                 this.__parent.selectItems(this.movedItems, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection());
73625             }
73626         };
73627         /**
73628          *
73629          */
73630         SelectionMoveState.prototype.exit = function () {
73631             this.__parent.getView().deleteFeedback();
73632             this.movedItems = null;
73633             this.duplicatedItems = null;
73634             this.movedPieceOfFurniture = null;
73635         };
73636         return SelectionMoveState;
73637     }(PlanController.ControllerState));
73638     PlanController.SelectionMoveState = SelectionMoveState;
73639     SelectionMoveState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.SelectionMoveState";
73640     (function (SelectionMoveState) {
73641         var SelectionMoveState$0 = /** @class */ (function (_super) {
73642             __extends(SelectionMoveState$0, _super);
73643             function SelectionMoveState$0(__parent, __arg0) {
73644                 var _this = _super.call(this, __arg0) || this;
73645                 _this.__parent = __parent;
73646                 return _this;
73647             }
73648             /**
73649              *
73650              */
73651             SelectionMoveState$0.prototype.enter = function () {
73652                 _super.prototype.enter.call(this);
73653                 this.pressMouse(this.__parent.__parent.getXLastMousePress(), this.__parent.__parent.getYLastMousePress(), 1, this.__parent.__parent.wasShiftDownLastMousePress(), this.__parent.__parent.wasDuplicationActivatedLastMousePress());
73654                 this.moveMouse(this.__parent.__parent.getXLastMouseMove(), this.__parent.__parent.getYLastMouseMove());
73655             };
73656             /**
73657              *
73658              * @param {number} x
73659              * @param {number} y
73660              */
73661             SelectionMoveState$0.prototype.releaseMouse = function (x, y) {
73662                 this.escape();
73663             };
73664             /**
73665              *
73666              */
73667             SelectionMoveState$0.prototype.escape = function () {
73668                 _super.prototype.escape.call(this);
73669                 this.__parent.__parent.setState(this.__parent.__parent.getSelectionState());
73670             };
73671             return SelectionMoveState$0;
73672         }(PlanController.ControllerStateDecorator));
73673         SelectionMoveState.SelectionMoveState$0 = SelectionMoveState$0;
73674     })(SelectionMoveState = PlanController.SelectionMoveState || (PlanController.SelectionMoveState = {}));
73675     /**
73676      * Selection with rectangle state. This state manages selection when mouse
73677      * press is done outside of an item or when mouse press is done with shift key
73678      * down.
73679      * @extends PlanController.ControllerState
73680      * @class
73681      */
73682     var RectangleSelectionState = /** @class */ (function (_super) {
73683         __extends(RectangleSelectionState, _super);
73684         function RectangleSelectionState(__parent) {
73685             var _this = _super.call(this) || this;
73686             _this.__parent = __parent;
73687             if (_this.selectedItemsMousePressed === undefined) {
73688                 _this.selectedItemsMousePressed = null;
73689             }
73690             if (_this.ignoreRectangleSelection === undefined) {
73691                 _this.ignoreRectangleSelection = false;
73692             }
73693             if (_this.mouseMoved === undefined) {
73694                 _this.mouseMoved = false;
73695             }
73696             return _this;
73697         }
73698         /**
73699          *
73700          * @return {PlanController.Mode}
73701          */
73702         RectangleSelectionState.prototype.getMode = function () {
73703             return PlanController.Mode.SELECTION_$LI$();
73704         };
73705         /**
73706          *
73707          * @return {boolean}
73708          */
73709         RectangleSelectionState.prototype.isModificationState = function () {
73710             return true;
73711         };
73712         /**
73713          *
73714          */
73715         RectangleSelectionState.prototype.enter = function () {
73716             var itemUnderCursor = this.__parent.getSelectableItemAt(this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
73717             if (itemUnderCursor == null && !this.__parent.wasShiftDownLastMousePress()) {
73718                 this.__parent.deselectAll();
73719             }
73720             this.selectedItemsMousePressed = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems().slice(0));
73721             var furniture = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getFurniture();
73722             this.ignoreRectangleSelection = false;
73723             for (var index = 0; index < this.selectedItemsMousePressed.length; index++) {
73724                 var item = this.selectedItemsMousePressed[index];
73725                 {
73726                     if ((item != null && item instanceof HomePieceOfFurniture) && !(furniture.indexOf((item)) >= 0)) {
73727                         this.ignoreRectangleSelection = true;
73728                         break;
73729                     }
73730                 }
73731             }
73732             this.mouseMoved = false;
73733         };
73734         /**
73735          *
73736          * @param {number} x
73737          * @param {number} y
73738          */
73739         RectangleSelectionState.prototype.moveMouse = function (x, y) {
73740             this.mouseMoved = true;
73741             if (!this.ignoreRectangleSelection) {
73742                 this.updateSelectedItems(this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress(), x, y, this.selectedItemsMousePressed);
73743                 if (this.__parent.feedbackDisplayed) {
73744                     var planView = this.__parent.getView();
73745                     planView.setRectangleFeedback(this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress(), x, y);
73746                 }
73747                 this.__parent.planView.makePointVisible(x, y);
73748             }
73749         };
73750         /**
73751          *
73752          * @param {number} x
73753          * @param {number} y
73754          */
73755         RectangleSelectionState.prototype.releaseMouse = function (x, y) {
73756             if (!this.mouseMoved) {
73757                 var itemUnderCursor_1 = this.__parent.getSelectableItemAt(x, y, false);
73758                 if (itemUnderCursor_1 != null) {
73759                     if ( /* contains */(this.selectedItemsMousePressed.indexOf((itemUnderCursor_1)) >= 0)) {
73760                         /* remove */ (function (a) { var index = a.indexOf(itemUnderCursor_1); if (index >= 0) {
73761                             a.splice(index, 1);
73762                             return true;
73763                         }
73764                         else {
73765                             return false;
73766                         } })(this.selectedItemsMousePressed);
73767                     }
73768                     else {
73769                         for (var i = this.selectedItemsMousePressed.length - 1; i >= 0; i--) {
73770                             {
73771                                 var item = this.selectedItemsMousePressed[i];
73772                                 if ((item != null && item instanceof Camera) || ((itemUnderCursor_1 != null && itemUnderCursor_1 instanceof HomePieceOfFurniture) && (item != null && item instanceof HomeFurnitureGroup) && /* contains */ (item.getAllFurniture().indexOf((itemUnderCursor_1)) >= 0)) || ((itemUnderCursor_1 != null && itemUnderCursor_1 instanceof HomeFurnitureGroup) && (item != null && item instanceof HomePieceOfFurniture) && /* contains */ (itemUnderCursor_1.getAllFurniture().indexOf((item)) >= 0))) {
73773                                     /* remove */ this.selectedItemsMousePressed.splice(i, 1)[0];
73774                                 }
73775                             }
73776                             ;
73777                         }
73778                         if (!(itemUnderCursor_1 != null && itemUnderCursor_1 instanceof Camera) || /* size */ this.selectedItemsMousePressed.length === 0) {
73779                             /* add */ (this.selectedItemsMousePressed.push(itemUnderCursor_1) > 0);
73780                         }
73781                     }
73782                     this.__parent.selectItems(this.selectedItemsMousePressed, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection() && this.__parent.wasShiftDownLastMousePress());
73783                 }
73784             }
73785             this.__parent.setState(this.__parent.getSelectionState());
73786         };
73787         /**
73788          *
73789          */
73790         RectangleSelectionState.prototype.escape = function () {
73791             this.__parent.setState(this.__parent.getSelectionState());
73792         };
73793         /**
73794          *
73795          */
73796         RectangleSelectionState.prototype.exit = function () {
73797             this.__parent.getView().deleteFeedback();
73798             this.selectedItemsMousePressed = null;
73799         };
73800         /**
73801          * Updates selection from <code>selectedItemsMousePressed</code> and the
73802          * items that intersects the rectangle at coordinates (<code>x0</code>,
73803          * <code>y0</code>) and (<code>x1</code>, <code>y1</code>).
73804          * @param {number} x0
73805          * @param {number} y0
73806          * @param {number} x1
73807          * @param {number} y1
73808          * @param {*[]} selectedItemsMousePressed
73809          * @private
73810          */
73811         RectangleSelectionState.prototype.updateSelectedItems = function (x0, y0, x1, y1, selectedItemsMousePressed) {
73812             var selectedItems;
73813             var shiftDown = this.__parent.wasShiftDownLastMousePress();
73814             if (shiftDown) {
73815                 selectedItems = (selectedItemsMousePressed.slice(0));
73816             }
73817             else {
73818                 selectedItems = ([]);
73819             }
73820             {
73821                 var array = this.__parent.getSelectableItemsIntersectingRectangle(x0, y0, x1, y1);
73822                 var _loop_4 = function (index) {
73823                     var item = array[index];
73824                     {
73825                         if (!(item != null && item instanceof Camera)) {
73826                             if (shiftDown) {
73827                                 if ( /* contains */(selectedItemsMousePressed.indexOf((item)) >= 0)) {
73828                                     /* remove */ (function (a) { var index = a.indexOf(item); if (index >= 0) {
73829                                         a.splice(index, 1);
73830                                         return true;
73831                                     }
73832                                     else {
73833                                         return false;
73834                                     } })(selectedItems);
73835                                 }
73836                                 else {
73837                                     /* add */ (selectedItems.push(item) > 0);
73838                                 }
73839                             }
73840                             else if (!(selectedItemsMousePressed.indexOf((item)) >= 0)) {
73841                                 /* add */ (selectedItems.push(item) > 0);
73842                             }
73843                         }
73844                     }
73845                 };
73846                 for (var index = 0; index < array.length; index++) {
73847                     _loop_4(index);
73848                 }
73849             }
73850             this.__parent.selectItems(selectedItems, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection() && shiftDown);
73851         };
73852         return RectangleSelectionState;
73853     }(PlanController.ControllerState));
73854     PlanController.RectangleSelectionState = RectangleSelectionState;
73855     RectangleSelectionState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RectangleSelectionState";
73856     /**
73857      * Panning state.
73858      * @extends PlanController.ControllerState
73859      * @class
73860      */
73861     var PanningState = /** @class */ (function (_super) {
73862         __extends(PanningState, _super);
73863         function PanningState(__parent) {
73864             var _this = _super.call(this) || this;
73865             _this.__parent = __parent;
73866             if (_this.xLastMouseMove === undefined) {
73867                 _this.xLastMouseMove = null;
73868             }
73869             if (_this.yLastMouseMove === undefined) {
73870                 _this.yLastMouseMove = null;
73871             }
73872             return _this;
73873         }
73874         /**
73875          *
73876          * @return {PlanController.Mode}
73877          */
73878         PanningState.prototype.getMode = function () {
73879             return PlanController.Mode.PANNING_$LI$();
73880         };
73881         /**
73882          *
73883          * @param {PlanController.Mode} mode
73884          */
73885         PanningState.prototype.setMode = function (mode) {
73886             if (mode === PlanController.Mode.SELECTION_$LI$()) {
73887                 this.__parent.setState(this.__parent.getSelectionState());
73888             }
73889             else if (mode === PlanController.Mode.WALL_CREATION_$LI$()) {
73890                 this.__parent.setState(this.__parent.getWallCreationState());
73891             }
73892             else if (mode === PlanController.Mode.ROOM_CREATION_$LI$()) {
73893                 this.__parent.setState(this.__parent.getRoomCreationState());
73894             }
73895             else if (mode === PlanController.Mode.POLYLINE_CREATION_$LI$()) {
73896                 this.__parent.setState(this.__parent.getPolylineCreationState());
73897             }
73898             else if (mode === PlanController.Mode.DIMENSION_LINE_CREATION_$LI$()) {
73899                 this.__parent.setState(this.__parent.getDimensionLineCreationState());
73900             }
73901             else if (mode === PlanController.Mode.LABEL_CREATION_$LI$()) {
73902                 this.__parent.setState(this.__parent.getLabelCreationState());
73903             }
73904         };
73905         /**
73906          *
73907          */
73908         PanningState.prototype.enter = function () {
73909             this.__parent.getView().setCursor(PlanView.CursorType.PANNING);
73910         };
73911         /**
73912          *
73913          * @param {number} dx
73914          * @param {number} dy
73915          */
73916         PanningState.prototype.moveSelection = function (dx, dy) {
73917             this.__parent.getView().moveView(dx * 10, dy * 10);
73918         };
73919         /**
73920          *
73921          * @param {number} x
73922          * @param {number} y
73923          * @param {number} clickCount
73924          * @param {boolean} shiftDown
73925          * @param {boolean} duplicationActivated
73926          */
73927         PanningState.prototype.pressMouse = function (x, y, clickCount, shiftDown, duplicationActivated) {
73928             if (clickCount === 1) {
73929                 this.xLastMouseMove = this.__parent.getView().convertXModelToScreen(x);
73930                 this.yLastMouseMove = this.__parent.getView().convertYModelToScreen(y);
73931             }
73932             else {
73933                 this.xLastMouseMove = null;
73934                 this.yLastMouseMove = null;
73935             }
73936         };
73937         /**
73938          *
73939          * @param {number} x
73940          * @param {number} y
73941          */
73942         PanningState.prototype.moveMouse = function (x, y) {
73943             if (this.xLastMouseMove != null) {
73944                 var newX = this.__parent.getView().convertXModelToScreen(x);
73945                 var newY = this.__parent.getView().convertYModelToScreen(y);
73946                 this.__parent.getView().moveView((this.xLastMouseMove - newX) / this.__parent.getScale(), (this.yLastMouseMove - newY) / this.__parent.getScale());
73947                 this.xLastMouseMove = newX;
73948                 this.yLastMouseMove = newY;
73949             }
73950         };
73951         /**
73952          *
73953          * @param {number} x
73954          * @param {number} y
73955          */
73956         PanningState.prototype.releaseMouse = function (x, y) {
73957             this.xLastMouseMove = null;
73958         };
73959         /**
73960          *
73961          */
73962         PanningState.prototype.escape = function () {
73963             this.xLastMouseMove = null;
73964         };
73965         /**
73966          *
73967          * @param {number} factor
73968          */
73969         PanningState.prototype.zoom = function (factor) {
73970             this.__parent.setScale(this.__parent.getScale() * factor);
73971         };
73972         return PanningState;
73973     }(PlanController.ControllerState));
73974     PlanController.PanningState = PanningState;
73975     PanningState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PanningState";
73976     /**
73977      * Drag and drop state. This state manages the dragging of items
73978      * transfered from outside of plan view with the mouse.
73979      * @extends PlanController.ControllerState
73980      * @class
73981      */
73982     var DragAndDropState = /** @class */ (function (_super) {
73983         __extends(DragAndDropState, _super);
73984         function DragAndDropState(__parent) {
73985             var _this = _super.call(this) || this;
73986             _this.__parent = __parent;
73987             if (_this.xLastMouseMove === undefined) {
73988                 _this.xLastMouseMove = 0;
73989             }
73990             if (_this.yLastMouseMove === undefined) {
73991                 _this.yLastMouseMove = 0;
73992             }
73993             if (_this.draggedPieceOfFurniture === undefined) {
73994                 _this.draggedPieceOfFurniture = null;
73995             }
73996             if (_this.xDraggedPieceOfFurniture === undefined) {
73997                 _this.xDraggedPieceOfFurniture = 0;
73998             }
73999             if (_this.yDraggedPieceOfFurniture === undefined) {
74000                 _this.yDraggedPieceOfFurniture = 0;
74001             }
74002             if (_this.angleDraggedPieceOfFurniture === undefined) {
74003                 _this.angleDraggedPieceOfFurniture = 0;
74004             }
74005             if (_this.depthDraggedPieceOfFurniture === undefined) {
74006                 _this.depthDraggedPieceOfFurniture = 0;
74007             }
74008             if (_this.elevationDraggedPieceOfFurniture === undefined) {
74009                 _this.elevationDraggedPieceOfFurniture = 0;
74010             }
74011             return _this;
74012         }
74013         /**
74014          *
74015          * @return {PlanController.Mode}
74016          */
74017         DragAndDropState.prototype.getMode = function () {
74018             return PlanController.Mode.SELECTION_$LI$();
74019         };
74020         /**
74021          *
74022          * @return {boolean}
74023          */
74024         DragAndDropState.prototype.isModificationState = function () {
74025             return false;
74026         };
74027         /**
74028          *
74029          * @return {boolean}
74030          */
74031         DragAndDropState.prototype.isBasePlanModificationState = function () {
74032             return this.draggedPieceOfFurniture != null && this.__parent.isPieceOfFurniturePartOfBasePlan(this.draggedPieceOfFurniture);
74033         };
74034         /**
74035          *
74036          */
74037         DragAndDropState.prototype.enter = function () {
74038             this.xLastMouseMove = 0;
74039             this.yLastMouseMove = 0;
74040             if (this.__parent.feedbackDisplayed) {
74041                 this.__parent.getView().setDraggedItemsFeedback(this.__parent.draggedItems);
74042             }
74043             if ( /* size */this.__parent.draggedItems.length === 1 && ( /* get */this.__parent.draggedItems[0] != null && /* get */ this.__parent.draggedItems[0] instanceof HomePieceOfFurniture)) {
74044                 this.draggedPieceOfFurniture = this.__parent.draggedItems[0];
74045                 this.xDraggedPieceOfFurniture = this.draggedPieceOfFurniture.getX();
74046                 this.yDraggedPieceOfFurniture = this.draggedPieceOfFurniture.getY();
74047                 this.angleDraggedPieceOfFurniture = this.draggedPieceOfFurniture.getAngle();
74048                 this.depthDraggedPieceOfFurniture = this.draggedPieceOfFurniture.getDepth();
74049                 this.elevationDraggedPieceOfFurniture = this.draggedPieceOfFurniture.getElevation();
74050             }
74051         };
74052         /**
74053          *
74054          * @param {number} x
74055          * @param {number} y
74056          */
74057         DragAndDropState.prototype.moveMouse = function (x, y) {
74058             var draggedItemsFeedback = (this.__parent.draggedItems.slice(0));
74059             this.__parent.moveItems(this.__parent.draggedItems, x - this.xLastMouseMove, y - this.yLastMouseMove);
74060             if (this.draggedPieceOfFurniture != null && this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) {
74061                 this.draggedPieceOfFurniture.setX(this.xDraggedPieceOfFurniture);
74062                 this.draggedPieceOfFurniture.setY(this.yDraggedPieceOfFurniture);
74063                 this.draggedPieceOfFurniture.setAngle(this.angleDraggedPieceOfFurniture);
74064                 if (this.draggedPieceOfFurniture.isResizable()) {
74065                     this.draggedPieceOfFurniture.setDepth(this.depthDraggedPieceOfFurniture);
74066                     this.draggedPieceOfFurniture.setDepthInPlan(this.depthDraggedPieceOfFurniture);
74067                 }
74068                 this.draggedPieceOfFurniture.setElevation(this.elevationDraggedPieceOfFurniture);
74069                 this.draggedPieceOfFurniture.move(x, y);
74070                 var elevationAdjusted = this.__parent.adjustPieceOfFurnitureElevation(this.draggedPieceOfFurniture, false, 3.4028235E38) != null;
74071                 var magnetWall = this.__parent.adjustPieceOfFurnitureOnWallAt(this.draggedPieceOfFurniture, x, y, true);
74072                 var referencePiece = null;
74073                 if (!elevationAdjusted) {
74074                     referencePiece = this.__parent.adjustPieceOfFurnitureSideBySideAt(this.draggedPieceOfFurniture, magnetWall == null, magnetWall);
74075                 }
74076                 if (referencePiece == null) {
74077                     this.__parent.adjustPieceOfFurnitureInShelfBox(this.draggedPieceOfFurniture, magnetWall == null);
74078                 }
74079                 if (this.__parent.feedbackDisplayed && magnetWall != null) {
74080                     this.__parent.getView().setDimensionLinesFeedback(this.__parent.getDimensionLinesAlongWall(this.draggedPieceOfFurniture, magnetWall));
74081                 }
74082                 else {
74083                     this.__parent.getView().setDimensionLinesFeedback(null);
74084                 }
74085             }
74086             if (this.__parent.feedbackDisplayed) {
74087                 this.__parent.getView().setDraggedItemsFeedback(draggedItemsFeedback);
74088             }
74089             this.xLastMouseMove = x;
74090             this.yLastMouseMove = y;
74091         };
74092         /**
74093          *
74094          */
74095         DragAndDropState.prototype.exit = function () {
74096             this.draggedPieceOfFurniture = null;
74097             this.__parent.getView().deleteFeedback();
74098         };
74099         return DragAndDropState;
74100     }(PlanController.ControllerState));
74101     PlanController.DragAndDropState = DragAndDropState;
74102     DragAndDropState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.DragAndDropState";
74103     /**
74104      * Wall modification state.
74105      * @extends PlanController.ControllerState
74106      * @class
74107      */
74108     var AbstractWallState = /** @class */ (function (_super) {
74109         __extends(AbstractWallState, _super);
74110         function AbstractWallState(__parent) {
74111             var _this = _super.call(this) || this;
74112             _this.__parent = __parent;
74113             if (_this.wallLengthToolTipFeedback === undefined) {
74114                 _this.wallLengthToolTipFeedback = null;
74115             }
74116             if (_this.wallAngleToolTipFeedback === undefined) {
74117                 _this.wallAngleToolTipFeedback = null;
74118             }
74119             if (_this.wallArcExtentToolTipFeedback === undefined) {
74120                 _this.wallArcExtentToolTipFeedback = null;
74121             }
74122             if (_this.wallThicknessToolTipFeedback === undefined) {
74123                 _this.wallThicknessToolTipFeedback = null;
74124             }
74125             return _this;
74126         }
74127         /**
74128          *
74129          */
74130         AbstractWallState.prototype.enter = function () {
74131             this.wallLengthToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "wallLengthToolTipFeedback");
74132             try {
74133                 this.wallAngleToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "wallAngleToolTipFeedback");
74134             }
74135             catch (ex) {
74136             }
74137             this.wallArcExtentToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "wallArcExtentToolTipFeedback");
74138             try {
74139                 this.wallThicknessToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "wallThicknessToolTipFeedback");
74140             }
74141             catch (ex) {
74142             }
74143         };
74144         AbstractWallState.prototype.getToolTipFeedbackText = function (wall, ignoreArcExtent) {
74145             var arcExtent = wall.getArcExtent();
74146             if (!ignoreArcExtent && arcExtent != null) {
74147                 return "<html>" + CoreTools.format(this.wallArcExtentToolTipFeedback, Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(arcExtent)));
74148             }
74149             else {
74150                 var startPointToEndPointDistance = wall.getStartPointToEndPointDistance();
74151                 var toolTipFeedbackText = "<html>" + CoreTools.format(this.wallLengthToolTipFeedback, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getFormatWithUnit().format(startPointToEndPointDistance));
74152                 if (this.wallAngleToolTipFeedback != null && this.wallAngleToolTipFeedback.length > 0) {
74153                     toolTipFeedbackText += "<br>" + CoreTools.format(this.wallAngleToolTipFeedback, this.getWallAngleInDegrees$com_eteks_sweethome3d_model_Wall$float(wall, startPointToEndPointDistance));
74154                 }
74155                 if (this.wallThicknessToolTipFeedback != null && this.wallThicknessToolTipFeedback.length > 0) {
74156                     toolTipFeedbackText += "<br>" + CoreTools.format(this.wallThicknessToolTipFeedback, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getFormatWithUnit().format(wall.getThickness()));
74157                 }
74158                 return toolTipFeedbackText;
74159             }
74160         };
74161         AbstractWallState.prototype.getWallAngleInDegrees$com_eteks_sweethome3d_model_Wall = function (wall) {
74162             return this.getWallAngleInDegrees$com_eteks_sweethome3d_model_Wall$float(wall, wall.getStartPointToEndPointDistance());
74163         };
74164         AbstractWallState.prototype.getWallAngleInDegrees$com_eteks_sweethome3d_model_Wall$float = function (wall, startPointToEndPointDistance) {
74165             var wallAtStart = wall.getWallAtStart();
74166             if (wallAtStart != null) {
74167                 var wallAtStartSegmentDistance = wallAtStart.getStartPointToEndPointDistance();
74168                 if (startPointToEndPointDistance !== 0 && wallAtStartSegmentDistance !== 0) {
74169                     var xWallVector = (wall.getXEnd() - wall.getXStart()) / startPointToEndPointDistance;
74170                     var yWallVector = (wall.getYEnd() - wall.getYStart()) / startPointToEndPointDistance;
74171                     var xWallAtStartVector = (wallAtStart.getXEnd() - wallAtStart.getXStart()) / wallAtStartSegmentDistance;
74172                     var yWallAtStartVector = (wallAtStart.getYEnd() - wallAtStart.getYStart()) / wallAtStartSegmentDistance;
74173                     if (wallAtStart.getWallAtStart() === wall) {
74174                         xWallAtStartVector = -xWallAtStartVector;
74175                         yWallAtStartVector = -yWallAtStartVector;
74176                     }
74177                     var wallAngle = (Math.round(180 - /* toDegrees */ (function (x) { return x * 180 / Math.PI; })(Math.atan2(yWallVector * xWallAtStartVector - xWallVector * yWallAtStartVector, xWallVector * xWallAtStartVector + yWallVector * yWallAtStartVector))) | 0);
74178                     if (wallAngle > 180) {
74179                         wallAngle -= 360;
74180                     }
74181                     return wallAngle;
74182                 }
74183             }
74184             if (startPointToEndPointDistance === 0) {
74185                 return 0;
74186             }
74187             else {
74188                 return (Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(Math.atan2(wall.getYStart() - wall.getYEnd(), wall.getXEnd() - wall.getXStart()))) | 0);
74189             }
74190         };
74191         AbstractWallState.prototype.getWallAngleInDegrees = function (wall, startPointToEndPointDistance) {
74192             if (((wall != null && wall instanceof Wall) || wall === null) && ((typeof startPointToEndPointDistance === 'number') || startPointToEndPointDistance === null)) {
74193                 return this.getWallAngleInDegrees$com_eteks_sweethome3d_model_Wall$float(wall, startPointToEndPointDistance);
74194             }
74195             else if (((wall != null && wall instanceof Wall) || wall === null) && startPointToEndPointDistance === undefined) {
74196                 return this.getWallAngleInDegrees$com_eteks_sweethome3d_model_Wall(wall);
74197             }
74198             else
74199                 throw new Error('invalid overload');
74200         };
74201         /**
74202          * Returns arc extent from the circumscribed circle of the triangle
74203          * with vertices (x1, y1) (x2, y2) (x, y).
74204          * @param {number} x1
74205          * @param {number} y1
74206          * @param {number} x2
74207          * @param {number} y2
74208          * @param {number} x
74209          * @param {number} y
74210          * @return {number}
74211          */
74212         AbstractWallState.prototype.getArcExtent = function (x1, y1, x2, y2, x, y) {
74213             var arcCenter = this.getCircumscribedCircleCenter(x1, y1, x2, y2, x, y);
74214             var startPointToBissectorLine1Distance = java.awt.geom.Point2D.distance(x1, y1, x2, y2) / 2;
74215             var arcCenterToWallDistance = (function (value) { return Number.NEGATIVE_INFINITY === value || Number.POSITIVE_INFINITY === value; })(arcCenter[0]) || /* isInfinite */ (function (value) { return Number.NEGATIVE_INFINITY === value || Number.POSITIVE_INFINITY === value; })(arcCenter[1]) ? Infinity : java.awt.geom.Line2D.ptLineDist(x1, y1, x2, y2, arcCenter[0], arcCenter[1]);
74216             var mousePosition = java.awt.geom.Line2D.relativeCCW(x1, y1, x2, y2, x, y);
74217             var centerPosition = java.awt.geom.Line2D.relativeCCW(x1, y1, x2, y2, arcCenter[0], arcCenter[1]);
74218             var arcExtent;
74219             if (centerPosition === mousePosition) {
74220                 arcExtent = (Math.PI + 2 * Math.atan2(arcCenterToWallDistance, startPointToBissectorLine1Distance));
74221             }
74222             else {
74223                 arcExtent = (2 * Math.atan2(startPointToBissectorLine1Distance, arcCenterToWallDistance));
74224             }
74225             arcExtent = Math.min(arcExtent, 3 * Math.PI / 2);
74226             arcExtent *= mousePosition;
74227             return arcExtent;
74228         };
74229         /**
74230          * Returns the circumscribed circle of the triangle with vertices (x1, y1) (x2, y2) (x, y).
74231          * @param {number} x1
74232          * @param {number} y1
74233          * @param {number} x2
74234          * @param {number} y2
74235          * @param {number} x
74236          * @param {number} y
74237          * @return {float[]}
74238          * @private
74239          */
74240         AbstractWallState.prototype.getCircumscribedCircleCenter = function (x1, y1, x2, y2, x, y) {
74241             var bissectorLine1 = this.getBissectorLine(x1, y1, x2, y2);
74242             var bissectorLine2 = this.getBissectorLine(x1, y1, x, y);
74243             var arcCenter = PlanController.computeIntersection(bissectorLine1[0], bissectorLine1[1], bissectorLine2[0], bissectorLine2[1]);
74244             return arcCenter;
74245         };
74246         AbstractWallState.prototype.getBissectorLine = function (x1, y1, x2, y2) {
74247             var xMiddlePoint = (x1 + x2) / 2;
74248             var yMiddlePoint = (y1 + y2) / 2;
74249             var bissectorLineAlpha = (x1 - x2) / (y2 - y1);
74250             if (bissectorLineAlpha > 1.0E10) {
74251                 return [[xMiddlePoint, yMiddlePoint], [xMiddlePoint, yMiddlePoint + 1]];
74252             }
74253             else {
74254                 return [[xMiddlePoint, yMiddlePoint], [xMiddlePoint + 1, bissectorLineAlpha + yMiddlePoint]];
74255             }
74256         };
74257         AbstractWallState.prototype.showWallAngleFeedback = function (wall, ignoreArcExtent) {
74258             var arcExtent = wall.getArcExtent();
74259             if (!ignoreArcExtent && arcExtent != null) {
74260                 if (arcExtent < 0) {
74261                     this.__parent.getView().setAngleFeedback(wall.getXArcCircleCenter(), wall.getYArcCircleCenter(), wall.getXStart(), wall.getYStart(), wall.getXEnd(), wall.getYEnd());
74262                 }
74263                 else {
74264                     this.__parent.getView().setAngleFeedback(wall.getXArcCircleCenter(), wall.getYArcCircleCenter(), wall.getXEnd(), wall.getYEnd(), wall.getXStart(), wall.getYStart());
74265                 }
74266             }
74267             else if (this.wallAngleToolTipFeedback != null && this.wallAngleToolTipFeedback.length > 0) {
74268                 var wallAtStart = wall.getWallAtStart();
74269                 if (wallAtStart != null) {
74270                     if (wallAtStart.getWallAtStart() === wall) {
74271                         if (this.getWallAngleInDegrees$com_eteks_sweethome3d_model_Wall(wall) > 0) {
74272                             this.__parent.getView().setAngleFeedback(wall.getXStart(), wall.getYStart(), wallAtStart.getXEnd(), wallAtStart.getYEnd(), wall.getXEnd(), wall.getYEnd());
74273                         }
74274                         else {
74275                             this.__parent.getView().setAngleFeedback(wall.getXStart(), wall.getYStart(), wall.getXEnd(), wall.getYEnd(), wallAtStart.getXEnd(), wallAtStart.getYEnd());
74276                         }
74277                     }
74278                     else {
74279                         if (this.getWallAngleInDegrees$com_eteks_sweethome3d_model_Wall(wall) > 0) {
74280                             this.__parent.getView().setAngleFeedback(wall.getXStart(), wall.getYStart(), wallAtStart.getXStart(), wallAtStart.getYStart(), wall.getXEnd(), wall.getYEnd());
74281                         }
74282                         else {
74283                             this.__parent.getView().setAngleFeedback(wall.getXStart(), wall.getYStart(), wall.getXEnd(), wall.getYEnd(), wallAtStart.getXStart(), wallAtStart.getYStart());
74284                         }
74285                     }
74286                 }
74287             }
74288         };
74289         return AbstractWallState;
74290     }(PlanController.ControllerState));
74291     PlanController.AbstractWallState = AbstractWallState;
74292     AbstractWallState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.AbstractWallState";
74293     /**
74294      * Furniture rotation state. This states manages the rotation of a piece of furniture around the vertical axis.
74295      * @extends PlanController.ControllerState
74296      * @class
74297      */
74298     var PieceOfFurnitureRotationState = /** @class */ (function (_super) {
74299         __extends(PieceOfFurnitureRotationState, _super);
74300         function PieceOfFurnitureRotationState(__parent) {
74301             var _this = _super.call(this) || this;
74302             _this.__parent = __parent;
74303             if (_this.magnetismEnabled === undefined) {
74304                 _this.magnetismEnabled = false;
74305             }
74306             if (_this.alignmentActivated === undefined) {
74307                 _this.alignmentActivated = false;
74308             }
74309             if (_this.selectedPiece === undefined) {
74310                 _this.selectedPiece = null;
74311             }
74312             if (_this.angleMousePress === undefined) {
74313                 _this.angleMousePress = 0;
74314             }
74315             if (_this.oldAngle === undefined) {
74316                 _this.oldAngle = 0;
74317             }
74318             if (_this.doorOrWindowBoundToWall === undefined) {
74319                 _this.doorOrWindowBoundToWall = false;
74320             }
74321             if (_this.rotationToolTipFeedback === undefined) {
74322                 _this.rotationToolTipFeedback = null;
74323             }
74324             return _this;
74325         }
74326         /**
74327          *
74328          * @return {PlanController.Mode}
74329          */
74330         PieceOfFurnitureRotationState.prototype.getMode = function () {
74331             return PlanController.Mode.SELECTION_$LI$();
74332         };
74333         /**
74334          *
74335          * @return {boolean}
74336          */
74337         PieceOfFurnitureRotationState.prototype.isModificationState = function () {
74338             return true;
74339         };
74340         /**
74341          *
74342          * @return {boolean}
74343          */
74344         PieceOfFurnitureRotationState.prototype.isBasePlanModificationState = function () {
74345             return this.selectedPiece != null && this.__parent.isPieceOfFurniturePartOfBasePlan(this.selectedPiece);
74346         };
74347         /**
74348          *
74349          */
74350         PieceOfFurnitureRotationState.prototype.enter = function () {
74351             this.rotationToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "rotationToolTipFeedback");
74352             this.selectedPiece = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
74353             this.angleMousePress = Math.atan2(this.selectedPiece.getY() - this.__parent.getYLastMousePress(), this.__parent.getXLastMousePress() - this.selectedPiece.getX());
74354             this.oldAngle = this.selectedPiece.getAngle();
74355             this.doorOrWindowBoundToWall = (this.selectedPiece != null && this.selectedPiece instanceof HomeDoorOrWindow) && this.selectedPiece.isBoundToWall();
74356             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
74357             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (this.__parent.wasMagnetismToggledLastMousePress());
74358             var planView = this.__parent.getView();
74359             planView.setResizeIndicatorVisible(true);
74360             if (this.__parent.feedbackDisplayed) {
74361                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.oldAngle), this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
74362             }
74363         };
74364         /**
74365          *
74366          * @param {number} x
74367          * @param {number} y
74368          */
74369         PieceOfFurnitureRotationState.prototype.moveMouse = function (x, y) {
74370             if (x !== this.selectedPiece.getX() || y !== this.selectedPiece.getY()) {
74371                 var angleMouseMove = Math.atan2(this.selectedPiece.getY() - y, x - this.selectedPiece.getX());
74372                 var newAngle = this.oldAngle - angleMouseMove + this.angleMousePress;
74373                 if (this.alignmentActivated || this.magnetismEnabled) {
74374                     var angleStep = 2 * Math.PI / PieceOfFurnitureRotationState.STEP_COUNT;
74375                     newAngle = Math.round(newAngle / angleStep) * angleStep;
74376                 }
74377                 this.selectedPiece.setAngle(newAngle);
74378                 var planView = this.__parent.getView();
74379                 planView.makePointVisible(x, y);
74380                 if (this.__parent.feedbackDisplayed) {
74381                     planView.setToolTipFeedback(this.getToolTipFeedbackText(newAngle), x, y);
74382                 }
74383             }
74384         };
74385         /**
74386          *
74387          * @param {number} x
74388          * @param {number} y
74389          */
74390         PieceOfFurnitureRotationState.prototype.releaseMouse = function (x, y) {
74391             this.__parent.postPieceOfFurnitureRotation(this.selectedPiece, this.oldAngle, this.doorOrWindowBoundToWall);
74392             this.__parent.setState(this.__parent.getSelectionState());
74393         };
74394         /**
74395          *
74396          * @param {boolean} magnetismToggled
74397          */
74398         PieceOfFurnitureRotationState.prototype.toggleMagnetism = function (magnetismToggled) {
74399             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
74400             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
74401         };
74402         /**
74403          *
74404          * @param {boolean} alignmentActivated
74405          */
74406         PieceOfFurnitureRotationState.prototype.setAlignmentActivated = function (alignmentActivated) {
74407             this.alignmentActivated = alignmentActivated;
74408             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
74409         };
74410         /**
74411          *
74412          */
74413         PieceOfFurnitureRotationState.prototype.escape = function () {
74414             this.selectedPiece.setAngle(this.oldAngle);
74415             if (this.selectedPiece != null && this.selectedPiece instanceof HomeDoorOrWindow) {
74416                 this.selectedPiece.setBoundToWall(this.doorOrWindowBoundToWall);
74417             }
74418             this.__parent.setState(this.__parent.getSelectionState());
74419         };
74420         /**
74421          *
74422          */
74423         PieceOfFurnitureRotationState.prototype.exit = function () {
74424             var planView = this.__parent.getView();
74425             planView.setResizeIndicatorVisible(false);
74426             planView.deleteFeedback();
74427             this.selectedPiece = null;
74428         };
74429         PieceOfFurnitureRotationState.prototype.getToolTipFeedbackText = function (angle) {
74430             return CoreTools.format(this.rotationToolTipFeedback, (Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(angle)) + 360) % 360);
74431         };
74432         PieceOfFurnitureRotationState.STEP_COUNT = 24;
74433         return PieceOfFurnitureRotationState;
74434     }(PlanController.ControllerState));
74435     PlanController.PieceOfFurnitureRotationState = PieceOfFurnitureRotationState;
74436     PieceOfFurnitureRotationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PieceOfFurnitureRotationState";
74437     /**
74438      * Furniture pitch rotation state. This states manages the rotation of a piece of furniture
74439      * around the horizontal pitch (transversal) axis.
74440      * @extends PlanController.ControllerState
74441      * @class
74442      */
74443     var PieceOfFurniturePitchRotationState = /** @class */ (function (_super) {
74444         __extends(PieceOfFurniturePitchRotationState, _super);
74445         function PieceOfFurniturePitchRotationState(__parent) {
74446             var _this = _super.call(this) || this;
74447             _this.__parent = __parent;
74448             if (_this.selectedPiece === undefined) {
74449                 _this.selectedPiece = null;
74450             }
74451             if (_this.oldPitch === undefined) {
74452                 _this.oldPitch = 0;
74453             }
74454             if (_this.oldWidthInPlan === undefined) {
74455                 _this.oldWidthInPlan = 0;
74456             }
74457             if (_this.oldDepthInPlan === undefined) {
74458                 _this.oldDepthInPlan = 0;
74459             }
74460             if (_this.oldHeightInPlan === undefined) {
74461                 _this.oldHeightInPlan = 0;
74462             }
74463             if (_this.pitchRotationToolTipFeedback === undefined) {
74464                 _this.pitchRotationToolTipFeedback = null;
74465             }
74466             return _this;
74467         }
74468         /**
74469          *
74470          * @return {PlanController.Mode}
74471          */
74472         PieceOfFurniturePitchRotationState.prototype.getMode = function () {
74473             return PlanController.Mode.SELECTION_$LI$();
74474         };
74475         /**
74476          *
74477          * @return {boolean}
74478          */
74479         PieceOfFurniturePitchRotationState.prototype.isModificationState = function () {
74480             return true;
74481         };
74482         /**
74483          *
74484          * @return {boolean}
74485          */
74486         PieceOfFurniturePitchRotationState.prototype.isBasePlanModificationState = function () {
74487             return this.selectedPiece != null && this.__parent.isPieceOfFurniturePartOfBasePlan(this.selectedPiece);
74488         };
74489         /**
74490          *
74491          */
74492         PieceOfFurniturePitchRotationState.prototype.enter = function () {
74493             this.pitchRotationToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "pitchRotationToolTipFeedback");
74494             this.selectedPiece = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
74495             this.oldPitch = this.selectedPiece.getPitch();
74496             this.oldWidthInPlan = this.selectedPiece.getWidthInPlan();
74497             this.oldDepthInPlan = this.selectedPiece.getDepthInPlan();
74498             this.oldHeightInPlan = this.selectedPiece.getHeightInPlan();
74499             var planView = this.__parent.getView();
74500             planView.setResizeIndicatorVisible(true);
74501             if (this.__parent.feedbackDisplayed) {
74502                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.oldPitch), this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
74503             }
74504         };
74505         /**
74506          *
74507          * @param {number} x
74508          * @param {number} y
74509          */
74510         PieceOfFurniturePitchRotationState.prototype.moveMouse = function (x, y) {
74511             var newPitch = (this.oldPitch - (y - this.__parent.getYLastMousePress()) * Math.cos(this.selectedPiece.getAngle()) * Math.PI / 360 + (x - this.__parent.getXLastMousePress()) * Math.sin(this.selectedPiece.getAngle()) * Math.PI / 360);
74512             if (Math.abs(newPitch) < 1.0E-8) {
74513                 newPitch = 0;
74514             }
74515             this.selectedPiece.setPitch(newPitch);
74516             if (this.__parent.feedbackDisplayed) {
74517                 this.__parent.getView().setToolTipFeedback(this.getToolTipFeedbackText(newPitch), x, y);
74518             }
74519         };
74520         /**
74521          *
74522          * @param {number} x
74523          * @param {number} y
74524          */
74525         PieceOfFurniturePitchRotationState.prototype.releaseMouse = function (x, y) {
74526             this.__parent.postPieceOfFurniturePitchRotation(this.selectedPiece, this.oldPitch, this.oldWidthInPlan, this.oldDepthInPlan, this.oldHeightInPlan);
74527             this.__parent.setState(this.__parent.getSelectionState());
74528         };
74529         /**
74530          *
74531          */
74532         PieceOfFurniturePitchRotationState.prototype.escape = function () {
74533             this.selectedPiece.setPitch(this.oldPitch);
74534             this.__parent.setState(this.__parent.getSelectionState());
74535         };
74536         /**
74537          *
74538          */
74539         PieceOfFurniturePitchRotationState.prototype.exit = function () {
74540             var planView = this.__parent.getView();
74541             planView.setResizeIndicatorVisible(false);
74542             planView.deleteFeedback();
74543             this.selectedPiece = null;
74544         };
74545         PieceOfFurniturePitchRotationState.prototype.getToolTipFeedbackText = function (pitch) {
74546             return CoreTools.format(this.pitchRotationToolTipFeedback, (Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(pitch)) + 360) % 360);
74547         };
74548         return PieceOfFurniturePitchRotationState;
74549     }(PlanController.ControllerState));
74550     PlanController.PieceOfFurniturePitchRotationState = PieceOfFurniturePitchRotationState;
74551     PieceOfFurniturePitchRotationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PieceOfFurniturePitchRotationState";
74552     /**
74553      * Furniture roll rotation state. This states manages the rotation of a piece of furniture
74554      * around the horizontal roll axis.
74555      * @extends PlanController.ControllerState
74556      * @class
74557      */
74558     var PieceOfFurnitureRollRotationState = /** @class */ (function (_super) {
74559         __extends(PieceOfFurnitureRollRotationState, _super);
74560         function PieceOfFurnitureRollRotationState(__parent) {
74561             var _this = _super.call(this) || this;
74562             _this.__parent = __parent;
74563             if (_this.selectedPiece === undefined) {
74564                 _this.selectedPiece = null;
74565             }
74566             if (_this.oldRoll === undefined) {
74567                 _this.oldRoll = 0;
74568             }
74569             if (_this.oldWidthInPlan === undefined) {
74570                 _this.oldWidthInPlan = 0;
74571             }
74572             if (_this.oldDepthInPlan === undefined) {
74573                 _this.oldDepthInPlan = 0;
74574             }
74575             if (_this.oldHeightInPlan === undefined) {
74576                 _this.oldHeightInPlan = 0;
74577             }
74578             if (_this.rollRotationToolTipFeedback === undefined) {
74579                 _this.rollRotationToolTipFeedback = null;
74580             }
74581             return _this;
74582         }
74583         /**
74584          *
74585          * @return {PlanController.Mode}
74586          */
74587         PieceOfFurnitureRollRotationState.prototype.getMode = function () {
74588             return PlanController.Mode.SELECTION_$LI$();
74589         };
74590         /**
74591          *
74592          * @return {boolean}
74593          */
74594         PieceOfFurnitureRollRotationState.prototype.isModificationState = function () {
74595             return true;
74596         };
74597         /**
74598          *
74599          * @return {boolean}
74600          */
74601         PieceOfFurnitureRollRotationState.prototype.isBasePlanModificationState = function () {
74602             return this.selectedPiece != null && this.__parent.isPieceOfFurniturePartOfBasePlan(this.selectedPiece);
74603         };
74604         /**
74605          *
74606          */
74607         PieceOfFurnitureRollRotationState.prototype.enter = function () {
74608             this.rollRotationToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "rollRotationToolTipFeedback");
74609             this.selectedPiece = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
74610             this.oldRoll = this.selectedPiece.getRoll();
74611             this.oldWidthInPlan = this.selectedPiece.getWidthInPlan();
74612             this.oldDepthInPlan = this.selectedPiece.getDepthInPlan();
74613             this.oldHeightInPlan = this.selectedPiece.getHeightInPlan();
74614             var planView = this.__parent.getView();
74615             planView.setResizeIndicatorVisible(true);
74616             if (this.__parent.feedbackDisplayed) {
74617                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.oldRoll), this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
74618             }
74619         };
74620         /**
74621          *
74622          * @param {number} x
74623          * @param {number} y
74624          */
74625         PieceOfFurnitureRollRotationState.prototype.moveMouse = function (x, y) {
74626             var newRoll = (this.oldRoll + (y - this.__parent.getYLastMousePress()) * Math.sin(this.selectedPiece.getAngle()) * Math.PI / 360 + (x - this.__parent.getXLastMousePress()) * Math.cos(this.selectedPiece.getAngle()) * Math.PI / 360);
74627             if (Math.abs(newRoll) < 1.0E-8) {
74628                 newRoll = 0;
74629             }
74630             this.selectedPiece.setRoll(newRoll);
74631             if (this.__parent.feedbackDisplayed) {
74632                 this.__parent.getView().setToolTipFeedback(this.getToolTipFeedbackText(newRoll), x, y);
74633             }
74634         };
74635         /**
74636          *
74637          * @param {number} x
74638          * @param {number} y
74639          */
74640         PieceOfFurnitureRollRotationState.prototype.releaseMouse = function (x, y) {
74641             this.__parent.postPieceOfFurnitureRollRotation(this.selectedPiece, this.oldRoll, this.oldWidthInPlan, this.oldDepthInPlan, this.oldHeightInPlan);
74642             this.__parent.setState(this.__parent.getSelectionState());
74643         };
74644         /**
74645          *
74646          */
74647         PieceOfFurnitureRollRotationState.prototype.escape = function () {
74648             this.selectedPiece.setRoll(this.oldRoll);
74649             this.__parent.setState(this.__parent.getSelectionState());
74650         };
74651         /**
74652          *
74653          */
74654         PieceOfFurnitureRollRotationState.prototype.exit = function () {
74655             var planView = this.__parent.getView();
74656             planView.setResizeIndicatorVisible(false);
74657             planView.deleteFeedback();
74658             this.selectedPiece = null;
74659         };
74660         PieceOfFurnitureRollRotationState.prototype.getToolTipFeedbackText = function (roll) {
74661             return CoreTools.format(this.rollRotationToolTipFeedback, (Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(roll)) + 360) % 360);
74662         };
74663         return PieceOfFurnitureRollRotationState;
74664     }(PlanController.ControllerState));
74665     PlanController.PieceOfFurnitureRollRotationState = PieceOfFurnitureRollRotationState;
74666     PieceOfFurnitureRollRotationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PieceOfFurnitureRollRotationState";
74667     /**
74668      * Furniture elevation state. This states manages the elevation change of a piece of furniture.
74669      * @extends PlanController.ControllerState
74670      * @class
74671      */
74672     var PieceOfFurnitureElevationState = /** @class */ (function (_super) {
74673         __extends(PieceOfFurnitureElevationState, _super);
74674         function PieceOfFurnitureElevationState(__parent) {
74675             var _this = _super.call(this) || this;
74676             _this.__parent = __parent;
74677             if (_this.magnetismEnabled === undefined) {
74678                 _this.magnetismEnabled = false;
74679             }
74680             if (_this.deltaYToElevationPoint === undefined) {
74681                 _this.deltaYToElevationPoint = 0;
74682             }
74683             if (_this.selectedPiece === undefined) {
74684                 _this.selectedPiece = null;
74685             }
74686             if (_this.oldElevation === undefined) {
74687                 _this.oldElevation = 0;
74688             }
74689             if (_this.elevationToolTipFeedback === undefined) {
74690                 _this.elevationToolTipFeedback = null;
74691             }
74692             return _this;
74693         }
74694         /**
74695          *
74696          * @return {PlanController.Mode}
74697          */
74698         PieceOfFurnitureElevationState.prototype.getMode = function () {
74699             return PlanController.Mode.SELECTION_$LI$();
74700         };
74701         /**
74702          *
74703          * @return {boolean}
74704          */
74705         PieceOfFurnitureElevationState.prototype.isModificationState = function () {
74706             return true;
74707         };
74708         /**
74709          *
74710          * @return {boolean}
74711          */
74712         PieceOfFurnitureElevationState.prototype.isBasePlanModificationState = function () {
74713             return this.selectedPiece != null && this.__parent.isPieceOfFurniturePartOfBasePlan(this.selectedPiece);
74714         };
74715         /**
74716          *
74717          */
74718         PieceOfFurnitureElevationState.prototype.enter = function () {
74719             this.elevationToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "elevationToolTipFeedback");
74720             this.selectedPiece = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
74721             var elevationPoint = this.selectedPiece.getPoints()[1];
74722             this.deltaYToElevationPoint = this.__parent.getYLastMousePress() - elevationPoint[1];
74723             this.oldElevation = this.selectedPiece.getElevation();
74724             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (this.__parent.wasMagnetismToggledLastMousePress());
74725             var planView = this.__parent.getView();
74726             planView.setResizeIndicatorVisible(true);
74727             if (this.__parent.feedbackDisplayed) {
74728                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.oldElevation), this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
74729             }
74730         };
74731         /**
74732          *
74733          * @param {number} x
74734          * @param {number} y
74735          */
74736         PieceOfFurnitureElevationState.prototype.moveMouse = function (x, y) {
74737             var planView = this.__parent.getView();
74738             var topRightPoint = this.selectedPiece.getPoints()[1];
74739             var deltaY = y - this.deltaYToElevationPoint - topRightPoint[1];
74740             var newElevation = this.oldElevation - deltaY;
74741             newElevation = Math.min(Math.max(newElevation, 0.0), this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMaximumElevation());
74742             if (this.magnetismEnabled) {
74743                 newElevation = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMagnetizedLength(newElevation, planView.getPixelLength());
74744             }
74745             this.selectedPiece.setElevation(newElevation);
74746             if (this.magnetismEnabled && this.selectedPiece != null) {
74747                 this.__parent.adjustPieceOfFurnitureElevation(this.selectedPiece, false, 3 * PlanController.PIXEL_MARGIN / this.__parent.getScale());
74748             }
74749             if (this.__parent.feedbackDisplayed) {
74750                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.selectedPiece.getElevation()), x, y);
74751             }
74752             planView.makeSelectionVisible();
74753         };
74754         /**
74755          *
74756          * @param {number} x
74757          * @param {number} y
74758          */
74759         PieceOfFurnitureElevationState.prototype.releaseMouse = function (x, y) {
74760             this.__parent.postPieceOfFurnitureElevation(this.selectedPiece, this.oldElevation);
74761             this.__parent.setState(this.__parent.getSelectionState());
74762         };
74763         /**
74764          *
74765          * @param {boolean} magnetismToggled
74766          */
74767         PieceOfFurnitureElevationState.prototype.toggleMagnetism = function (magnetismToggled) {
74768             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
74769             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
74770         };
74771         /**
74772          *
74773          */
74774         PieceOfFurnitureElevationState.prototype.escape = function () {
74775             this.selectedPiece.setElevation(this.oldElevation);
74776             this.__parent.setState(this.__parent.getSelectionState());
74777         };
74778         /**
74779          *
74780          */
74781         PieceOfFurnitureElevationState.prototype.exit = function () {
74782             var planView = this.__parent.getView();
74783             planView.setResizeIndicatorVisible(false);
74784             planView.deleteFeedback();
74785             this.selectedPiece = null;
74786         };
74787         PieceOfFurnitureElevationState.prototype.getToolTipFeedbackText = function (height) {
74788             return CoreTools.format(this.elevationToolTipFeedback, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getFormatWithUnit().format(height));
74789         };
74790         return PieceOfFurnitureElevationState;
74791     }(PlanController.ControllerState));
74792     PlanController.PieceOfFurnitureElevationState = PieceOfFurnitureElevationState;
74793     PieceOfFurnitureElevationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PieceOfFurnitureElevationState";
74794     /**
74795      * Furniture height state. This states manages the height resizing of a piece of furniture.
74796      * Caution: Do not use for furniture with a roll or pitch angle different from 0
74797      * @extends PlanController.ControllerState
74798      * @class
74799      */
74800     var PieceOfFurnitureHeightState = /** @class */ (function (_super) {
74801         __extends(PieceOfFurnitureHeightState, _super);
74802         function PieceOfFurnitureHeightState(__parent) {
74803             var _this = _super.call(this) || this;
74804             _this.__parent = __parent;
74805             if (_this.magnetismEnabled === undefined) {
74806                 _this.magnetismEnabled = false;
74807             }
74808             if (_this.deltaYToResizePoint === undefined) {
74809                 _this.deltaYToResizePoint = 0;
74810             }
74811             if (_this.resizedPiece === undefined) {
74812                 _this.resizedPiece = null;
74813             }
74814             if (_this.topLeftPoint === undefined) {
74815                 _this.topLeftPoint = null;
74816             }
74817             if (_this.resizePoint === undefined) {
74818                 _this.resizePoint = null;
74819             }
74820             if (_this.resizeToolTipFeedback === undefined) {
74821                 _this.resizeToolTipFeedback = null;
74822             }
74823             return _this;
74824         }
74825         /**
74826          *
74827          * @return {PlanController.Mode}
74828          */
74829         PieceOfFurnitureHeightState.prototype.getMode = function () {
74830             return PlanController.Mode.SELECTION_$LI$();
74831         };
74832         /**
74833          *
74834          * @return {boolean}
74835          */
74836         PieceOfFurnitureHeightState.prototype.isModificationState = function () {
74837             return true;
74838         };
74839         /**
74840          *
74841          * @return {boolean}
74842          */
74843         PieceOfFurnitureHeightState.prototype.isBasePlanModificationState = function () {
74844             return this.resizedPiece != null && this.__parent.isPieceOfFurniturePartOfBasePlan(this.resizedPiece.getPieceOfFurniture());
74845         };
74846         /**
74847          *
74848          */
74849         PieceOfFurnitureHeightState.prototype.enter = function () {
74850             this.resizeToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "heightResizeToolTipFeedback");
74851             var selectedPiece = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
74852             this.resizedPiece = new PlanController.ResizedPieceOfFurniture(selectedPiece);
74853             var resizedPiecePoints = selectedPiece.getPoints();
74854             this.resizePoint = resizedPiecePoints[3];
74855             this.deltaYToResizePoint = this.__parent.getYLastMousePress() - this.resizePoint[1];
74856             this.topLeftPoint = resizedPiecePoints[0];
74857             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (this.__parent.wasMagnetismToggledLastMousePress());
74858             var planView = this.__parent.getView();
74859             planView.setResizeIndicatorVisible(true);
74860             if (this.__parent.feedbackDisplayed) {
74861                 planView.setToolTipFeedback(this.getToolTipFeedbackText(selectedPiece.getHeight()), this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
74862             }
74863         };
74864         /**
74865          *
74866          * @param {number} x
74867          * @param {number} y
74868          */
74869         PieceOfFurnitureHeightState.prototype.moveMouse = function (x, y) {
74870             var planView = this.__parent.getView();
74871             var selectedPiece = this.resizedPiece.getPieceOfFurniture();
74872             var deltaY = y - this.deltaYToResizePoint - this.resizePoint[1];
74873             var newHeight = this.resizedPiece.getHeight() - deltaY;
74874             newHeight = Math.max(newHeight, 0.0);
74875             if (this.magnetismEnabled) {
74876                 newHeight = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMagnetizedLength(newHeight, planView.getPixelLength());
74877             }
74878             newHeight = Math.min(Math.max(newHeight, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMinimumLength()), this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMaximumLength());
74879             if (selectedPiece.isDeformable() && !selectedPiece.isHorizontallyRotated() && selectedPiece.getModelTransformations() == null) {
74880                 this.__parent.setPieceOfFurnitureSize(this.resizedPiece, this.resizedPiece.getWidth(), this.resizedPiece.getDepth(), newHeight);
74881             }
74882             else {
74883                 var scale = newHeight / this.resizedPiece.getHeight();
74884                 var newWidth = this.resizedPiece.getWidth() * scale;
74885                 var newDepth = this.resizedPiece.getDepth() * scale;
74886                 var angle = selectedPiece.getAngle();
74887                 var cos = Math.cos(angle);
74888                 var sin = Math.sin(angle);
74889                 var newX = (this.topLeftPoint[0] + (newWidth * cos - newDepth * sin) / 2.0);
74890                 var newY = (this.topLeftPoint[1] + (newWidth * sin + newDepth * cos) / 2.0);
74891                 selectedPiece.setX(newX);
74892                 selectedPiece.setY(newY);
74893                 this.__parent.setPieceOfFurnitureSize(this.resizedPiece, newWidth, newDepth, newHeight);
74894             }
74895             planView.makePointVisible(x, y);
74896             if (this.__parent.feedbackDisplayed) {
74897                 planView.setToolTipFeedback(this.getToolTipFeedbackText(newHeight), x, y);
74898             }
74899         };
74900         /**
74901          *
74902          * @param {number} x
74903          * @param {number} y
74904          */
74905         PieceOfFurnitureHeightState.prototype.releaseMouse = function (x, y) {
74906             this.__parent.postPieceOfFurnitureHeightResize(this.resizedPiece);
74907             this.__parent.setState(this.__parent.getSelectionState());
74908         };
74909         /**
74910          *
74911          * @param {boolean} magnetismToggled
74912          */
74913         PieceOfFurnitureHeightState.prototype.toggleMagnetism = function (magnetismToggled) {
74914             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
74915             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
74916         };
74917         /**
74918          *
74919          */
74920         PieceOfFurnitureHeightState.prototype.escape = function () {
74921             this.__parent.resetPieceOfFurnitureSize(this.resizedPiece);
74922             this.__parent.setState(this.__parent.getSelectionState());
74923         };
74924         /**
74925          *
74926          */
74927         PieceOfFurnitureHeightState.prototype.exit = function () {
74928             var planView = this.__parent.getView();
74929             planView.setResizeIndicatorVisible(false);
74930             planView.deleteFeedback();
74931             this.resizedPiece = null;
74932         };
74933         PieceOfFurnitureHeightState.prototype.getToolTipFeedbackText = function (height) {
74934             return CoreTools.format(this.resizeToolTipFeedback, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getFormatWithUnit().format(height));
74935         };
74936         return PieceOfFurnitureHeightState;
74937     }(PlanController.ControllerState));
74938     PlanController.PieceOfFurnitureHeightState = PieceOfFurnitureHeightState;
74939     PieceOfFurnitureHeightState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PieceOfFurnitureHeightState";
74940     /**
74941      * Furniture resize state. This states manages the resizing of a piece of furniture.
74942      * @extends PlanController.ControllerState
74943      * @class
74944      */
74945     var PieceOfFurnitureResizeState = /** @class */ (function (_super) {
74946         __extends(PieceOfFurnitureResizeState, _super);
74947         function PieceOfFurnitureResizeState(__parent) {
74948             var _this = _super.call(this) || this;
74949             _this.__parent = __parent;
74950             if (_this.magnetismEnabled === undefined) {
74951                 _this.magnetismEnabled = false;
74952             }
74953             if (_this.alignmentActivated === undefined) {
74954                 _this.alignmentActivated = false;
74955             }
74956             if (_this.widthOrDepthResizingActivated === undefined) {
74957                 _this.widthOrDepthResizingActivated = false;
74958             }
74959             if (_this.deltaXToResizePoint === undefined) {
74960                 _this.deltaXToResizePoint = 0;
74961             }
74962             if (_this.deltaYToResizePoint === undefined) {
74963                 _this.deltaYToResizePoint = 0;
74964             }
74965             if (_this.resizedPiece === undefined) {
74966                 _this.resizedPiece = null;
74967             }
74968             if (_this.resizedPieceWidthInPlan === undefined) {
74969                 _this.resizedPieceWidthInPlan = 0;
74970             }
74971             if (_this.resizePoint === undefined) {
74972                 _this.resizePoint = null;
74973             }
74974             if (_this.topLeftPoint === undefined) {
74975                 _this.topLeftPoint = null;
74976             }
74977             if (_this.widthResizeToolTipFeedback === undefined) {
74978                 _this.widthResizeToolTipFeedback = null;
74979             }
74980             if (_this.depthResizeToolTipFeedback === undefined) {
74981                 _this.depthResizeToolTipFeedback = null;
74982             }
74983             if (_this.heightResizeToolTipFeedback === undefined) {
74984                 _this.heightResizeToolTipFeedback = null;
74985             }
74986             return _this;
74987         }
74988         /**
74989          *
74990          * @return {PlanController.Mode}
74991          */
74992         PieceOfFurnitureResizeState.prototype.getMode = function () {
74993             return PlanController.Mode.SELECTION_$LI$();
74994         };
74995         /**
74996          *
74997          * @return {boolean}
74998          */
74999         PieceOfFurnitureResizeState.prototype.isModificationState = function () {
75000             return true;
75001         };
75002         /**
75003          *
75004          * @return {boolean}
75005          */
75006         PieceOfFurnitureResizeState.prototype.isBasePlanModificationState = function () {
75007             return this.resizedPiece != null && this.__parent.isPieceOfFurniturePartOfBasePlan(this.resizedPiece.getPieceOfFurniture());
75008         };
75009         /**
75010          *
75011          */
75012         PieceOfFurnitureResizeState.prototype.enter = function () {
75013             this.widthResizeToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "widthResizeToolTipFeedback");
75014             this.depthResizeToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "depthResizeToolTipFeedback");
75015             this.heightResizeToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "heightResizeToolTipFeedback");
75016             var selectedPiece = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
75017             this.resizedPiece = new PlanController.ResizedPieceOfFurniture(selectedPiece);
75018             this.resizedPieceWidthInPlan = selectedPiece.getWidthInPlan();
75019             var resizedPiecePoints = selectedPiece.getPoints();
75020             this.resizePoint = resizedPiecePoints[2];
75021             this.deltaXToResizePoint = this.__parent.getXLastMousePress() - this.resizePoint[0];
75022             this.deltaYToResizePoint = this.__parent.getYLastMousePress() - this.resizePoint[1];
75023             this.topLeftPoint = resizedPiecePoints[0];
75024             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (this.__parent.wasMagnetismToggledLastMousePress());
75025             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
75026             this.widthOrDepthResizingActivated = this.__parent.wasDuplicationActivatedLastMousePress();
75027             var planView = this.__parent.getView();
75028             planView.setResizeIndicatorVisible(true);
75029             if (this.__parent.feedbackDisplayed) {
75030                 planView.setToolTipFeedback(this.getToolTipFeedbackText(selectedPiece.getWidth(), selectedPiece.getDepth(), selectedPiece.getHeight()), this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
75031             }
75032         };
75033         /**
75034          *
75035          * @param {number} x
75036          * @param {number} y
75037          */
75038         PieceOfFurnitureResizeState.prototype.moveMouse = function (x, y) {
75039             var planView = this.__parent.getView();
75040             var selectedPiece = this.resizedPiece.getPieceOfFurniture();
75041             var angle = selectedPiece.getAngle();
75042             var cos = Math.cos(angle);
75043             var sin = Math.sin(angle);
75044             var deltaX = x - this.deltaXToResizePoint - this.topLeftPoint[0];
75045             var deltaY = y - this.deltaYToResizePoint - this.topLeftPoint[1];
75046             var newWidth = (deltaY * sin + deltaX * cos);
75047             if (this.magnetismEnabled) {
75048                 newWidth = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMagnetizedLength(newWidth, planView.getPixelLength());
75049             }
75050             newWidth = Math.min(Math.max(newWidth, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMinimumLength()), this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMaximumLength());
75051             var newDepth = this.resizedPiece.getDepth();
75052             var newHeight = this.resizedPiece.getHeight();
75053             var doorOrWindowBoundToWall = this.resizedPiece.isDoorOrWindowBoundToWall();
75054             if (this.isProprortionallyResized(selectedPiece)) {
75055                 var scale = newWidth / this.resizedPieceWidthInPlan;
75056                 newWidth = this.resizedPiece.getWidth() * scale;
75057                 newDepth = this.resizedPiece.getDepth() * scale;
75058                 newHeight = this.resizedPiece.getHeight() * scale;
75059                 doorOrWindowBoundToWall = newDepth === this.resizedPiece.getDepth();
75060             }
75061             else if (!selectedPiece.isWidthDepthDeformable()) {
75062                 newDepth = this.resizedPiece.getDepth() * newWidth / this.resizedPiece.getWidth();
75063             }
75064             else if (!this.resizedPiece.isDoorOrWindowBoundToWall() || !this.magnetismEnabled || this.widthOrDepthResizingActivated) {
75065                 newDepth = (deltaY * cos - deltaX * sin);
75066                 if (this.magnetismEnabled) {
75067                     newDepth = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMagnetizedLength(newDepth, planView.getPixelLength());
75068                 }
75069                 newDepth = Math.min(Math.max(newDepth, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMinimumLength()), this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMaximumLength());
75070                 doorOrWindowBoundToWall = newDepth === this.resizedPiece.getDepth();
75071                 if (this.widthOrDepthResizingActivated) {
75072                     if ( /* signum */(function (f) { if (f > 0) {
75073                         return 1;
75074                     }
75075                     else if (f < 0) {
75076                         return -1;
75077                     }
75078                     else {
75079                         return 0;
75080                     } })(java.awt.geom.Line2D.relativeCCW(this.topLeftPoint[0], this.topLeftPoint[1], this.resizePoint[0], this.resizePoint[1], x - this.deltaXToResizePoint, y - this.deltaYToResizePoint)) >= 0) {
75081                         newDepth = this.resizedPiece.getDepth();
75082                     }
75083                     else {
75084                         newWidth = this.resizedPiece.getWidth();
75085                     }
75086                 }
75087             }
75088             this.__parent.setPieceOfFurnitureSize(this.resizedPiece, newWidth, newDepth, newHeight);
75089             if (this.resizedPiece.isDoorOrWindowBoundToWall()) {
75090                 selectedPiece.setBoundToWall(this.magnetismEnabled && doorOrWindowBoundToWall);
75091             }
75092             var newX = (this.topLeftPoint[0] + (selectedPiece.getWidthInPlan() * cos - selectedPiece.getDepthInPlan() * sin) / 2.0);
75093             var newY = (this.topLeftPoint[1] + (selectedPiece.getWidthInPlan() * sin + selectedPiece.getDepthInPlan() * cos) / 2.0);
75094             selectedPiece.setX(newX);
75095             selectedPiece.setY(newY);
75096             planView.makePointVisible(x, y);
75097             if (this.__parent.feedbackDisplayed) {
75098                 planView.setToolTipFeedback(this.getToolTipFeedbackText(newWidth, newDepth, newHeight), x, y);
75099             }
75100         };
75101         /**
75102          * Returns <code>true</code> if the <code>piece</code> should be proportionally resized.
75103          * @param {HomePieceOfFurniture} piece
75104          * @return {boolean}
75105          * @private
75106          */
75107         PieceOfFurnitureResizeState.prototype.isProprortionallyResized = function (piece) {
75108             return !piece.isDeformable() || piece.isHorizontallyRotated() || piece.getModelTransformations() != null || this.alignmentActivated;
75109         };
75110         /**
75111          *
75112          * @param {number} x
75113          * @param {number} y
75114          */
75115         PieceOfFurnitureResizeState.prototype.releaseMouse = function (x, y) {
75116             this.__parent.postPieceOfFurnitureWidthAndDepthResize(this.resizedPiece);
75117             this.__parent.setState(this.__parent.getSelectionState());
75118         };
75119         /**
75120          *
75121          * @param {boolean} magnetismToggled
75122          */
75123         PieceOfFurnitureResizeState.prototype.toggleMagnetism = function (magnetismToggled) {
75124             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
75125             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
75126         };
75127         /**
75128          *
75129          * @param {boolean} alignmentActivated
75130          */
75131         PieceOfFurnitureResizeState.prototype.setAlignmentActivated = function (alignmentActivated) {
75132             this.alignmentActivated = alignmentActivated;
75133             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
75134         };
75135         /**
75136          *
75137          * @param {boolean} duplicationActivated
75138          */
75139         PieceOfFurnitureResizeState.prototype.setDuplicationActivated = function (duplicationActivated) {
75140             this.widthOrDepthResizingActivated = duplicationActivated;
75141             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
75142         };
75143         /**
75144          *
75145          */
75146         PieceOfFurnitureResizeState.prototype.escape = function () {
75147             this.__parent.resetPieceOfFurnitureSize(this.resizedPiece);
75148             this.__parent.setState(this.__parent.getSelectionState());
75149         };
75150         /**
75151          *
75152          */
75153         PieceOfFurnitureResizeState.prototype.exit = function () {
75154             var planView = this.__parent.getView();
75155             planView.setResizeIndicatorVisible(false);
75156             planView.deleteFeedback();
75157             this.resizedPiece = null;
75158         };
75159         PieceOfFurnitureResizeState.prototype.getToolTipFeedbackText = function (width, depth, height) {
75160             var toolTipFeedbackText = "<html>" + CoreTools.format(this.widthResizeToolTipFeedback, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getFormatWithUnit().format(width));
75161             if (!(this.resizedPiece.getPieceOfFurniture() != null && this.resizedPiece.getPieceOfFurniture() instanceof HomeDoorOrWindow) || !this.resizedPiece.getPieceOfFurniture().isBoundToWall() || this.isProprortionallyResized(this.resizedPiece.getPieceOfFurniture())) {
75162                 toolTipFeedbackText += "<br>" + CoreTools.format(this.depthResizeToolTipFeedback, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getFormatWithUnit().format(depth));
75163             }
75164             if (this.isProprortionallyResized(this.resizedPiece.getPieceOfFurniture())) {
75165                 toolTipFeedbackText += "<br>" + CoreTools.format(this.heightResizeToolTipFeedback, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getFormatWithUnit().format(height));
75166             }
75167             return toolTipFeedbackText;
75168         };
75169         return PieceOfFurnitureResizeState;
75170     }(PlanController.ControllerState));
75171     PlanController.PieceOfFurnitureResizeState = PieceOfFurnitureResizeState;
75172     PieceOfFurnitureResizeState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PieceOfFurnitureResizeState";
75173     /**
75174      * Light power state. This states manages the power modification of a light.
75175      * @extends PlanController.ControllerState
75176      * @class
75177      */
75178     var LightPowerModificationState = /** @class */ (function (_super) {
75179         __extends(LightPowerModificationState, _super);
75180         function LightPowerModificationState(__parent) {
75181             var _this = _super.call(this) || this;
75182             _this.__parent = __parent;
75183             if (_this.deltaXToModificationPoint === undefined) {
75184                 _this.deltaXToModificationPoint = 0;
75185             }
75186             if (_this.selectedLight === undefined) {
75187                 _this.selectedLight = null;
75188             }
75189             if (_this.oldPower === undefined) {
75190                 _this.oldPower = 0;
75191             }
75192             if (_this.lightPowerToolTipFeedback === undefined) {
75193                 _this.lightPowerToolTipFeedback = null;
75194             }
75195             return _this;
75196         }
75197         /**
75198          *
75199          * @return {PlanController.Mode}
75200          */
75201         LightPowerModificationState.prototype.getMode = function () {
75202             return PlanController.Mode.SELECTION_$LI$();
75203         };
75204         /**
75205          *
75206          * @return {boolean}
75207          */
75208         LightPowerModificationState.prototype.isModificationState = function () {
75209             return true;
75210         };
75211         /**
75212          *
75213          */
75214         LightPowerModificationState.prototype.enter = function () {
75215             this.lightPowerToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "lightPowerToolTipFeedback");
75216             this.selectedLight = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
75217             var resizePoint = this.selectedLight.getPoints()[3];
75218             this.deltaXToModificationPoint = this.__parent.getXLastMousePress() - resizePoint[0];
75219             this.oldPower = this.selectedLight.getPower();
75220             var planView = this.__parent.getView();
75221             planView.setResizeIndicatorVisible(true);
75222             if (this.__parent.feedbackDisplayed) {
75223                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.oldPower), this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
75224             }
75225         };
75226         /**
75227          *
75228          * @param {number} x
75229          * @param {number} y
75230          */
75231         LightPowerModificationState.prototype.moveMouse = function (x, y) {
75232             var planView = this.__parent.getView();
75233             var bottomLeftPoint = this.selectedLight.getPoints()[3];
75234             var deltaX = x - this.deltaXToModificationPoint - bottomLeftPoint[0];
75235             var newPower = this.oldPower + deltaX / 100.0 * this.__parent.getScale();
75236             newPower = Math.min(Math.max(newPower, 0.0), 1.0);
75237             this.selectedLight.setPower(newPower);
75238             planView.makePointVisible(x, y);
75239             if (this.__parent.feedbackDisplayed) {
75240                 planView.setToolTipFeedback(this.getToolTipFeedbackText(newPower), x, y);
75241             }
75242         };
75243         /**
75244          *
75245          * @param {number} x
75246          * @param {number} y
75247          */
75248         LightPowerModificationState.prototype.releaseMouse = function (x, y) {
75249             this.__parent.postLightPowerModification(this.selectedLight, this.oldPower);
75250             this.__parent.setState(this.__parent.getSelectionState());
75251         };
75252         /**
75253          *
75254          */
75255         LightPowerModificationState.prototype.escape = function () {
75256             this.selectedLight.setPower(this.oldPower);
75257             this.__parent.setState(this.__parent.getSelectionState());
75258         };
75259         /**
75260          *
75261          */
75262         LightPowerModificationState.prototype.exit = function () {
75263             var planView = this.__parent.getView();
75264             planView.setResizeIndicatorVisible(false);
75265             planView.deleteFeedback();
75266             this.selectedLight = null;
75267         };
75268         LightPowerModificationState.prototype.getToolTipFeedbackText = function (power) {
75269             return CoreTools.format(this.lightPowerToolTipFeedback, Math.round(power * 100));
75270         };
75271         return LightPowerModificationState;
75272     }(PlanController.ControllerState));
75273     PlanController.LightPowerModificationState = LightPowerModificationState;
75274     LightPowerModificationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.LightPowerModificationState";
75275     /**
75276      * Furniture name offset state. This state manages the name offset of a piece of furniture.
75277      * @extends PlanController.ControllerState
75278      * @class
75279      */
75280     var PieceOfFurnitureNameOffsetState = /** @class */ (function (_super) {
75281         __extends(PieceOfFurnitureNameOffsetState, _super);
75282         function PieceOfFurnitureNameOffsetState(__parent) {
75283             var _this = _super.call(this) || this;
75284             _this.__parent = __parent;
75285             if (_this.selectedPiece === undefined) {
75286                 _this.selectedPiece = null;
75287             }
75288             if (_this.oldNameXOffset === undefined) {
75289                 _this.oldNameXOffset = 0;
75290             }
75291             if (_this.oldNameYOffset === undefined) {
75292                 _this.oldNameYOffset = 0;
75293             }
75294             if (_this.xLastMouseMove === undefined) {
75295                 _this.xLastMouseMove = 0;
75296             }
75297             if (_this.yLastMouseMove === undefined) {
75298                 _this.yLastMouseMove = 0;
75299             }
75300             if (_this.alignmentActivated === undefined) {
75301                 _this.alignmentActivated = false;
75302             }
75303             return _this;
75304         }
75305         /**
75306          *
75307          * @return {PlanController.Mode}
75308          */
75309         PieceOfFurnitureNameOffsetState.prototype.getMode = function () {
75310             return PlanController.Mode.SELECTION_$LI$();
75311         };
75312         /**
75313          *
75314          * @return {boolean}
75315          */
75316         PieceOfFurnitureNameOffsetState.prototype.isModificationState = function () {
75317             return true;
75318         };
75319         /**
75320          *
75321          */
75322         PieceOfFurnitureNameOffsetState.prototype.enter = function () {
75323             this.selectedPiece = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
75324             this.oldNameXOffset = this.selectedPiece.getNameXOffset();
75325             this.oldNameYOffset = this.selectedPiece.getNameYOffset();
75326             this.xLastMouseMove = this.__parent.getXLastMousePress();
75327             this.yLastMouseMove = this.__parent.getYLastMousePress();
75328             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
75329             var planView = this.__parent.getView();
75330             planView.setResizeIndicatorVisible(true);
75331         };
75332         /**
75333          *
75334          * @param {number} x
75335          * @param {number} y
75336          */
75337         PieceOfFurnitureNameOffsetState.prototype.moveMouse = function (x, y) {
75338             if (this.alignmentActivated) {
75339                 var alignedPoint = new PlanController.PointWithAngleMagnetism(this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress(), x, y, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit(), this.__parent.getView().getPixelLength(), 4);
75340                 x = alignedPoint.getX();
75341                 y = alignedPoint.getY();
75342             }
75343             this.selectedPiece.setNameXOffset(this.selectedPiece.getNameXOffset() + x - this.xLastMouseMove);
75344             this.selectedPiece.setNameYOffset(this.selectedPiece.getNameYOffset() + y - this.yLastMouseMove);
75345             this.xLastMouseMove = x;
75346             this.yLastMouseMove = y;
75347             this.__parent.getView().makePointVisible(x, y);
75348         };
75349         /**
75350          *
75351          * @param {number} x
75352          * @param {number} y
75353          */
75354         PieceOfFurnitureNameOffsetState.prototype.releaseMouse = function (x, y) {
75355             this.__parent.postPieceOfFurnitureNameOffset(this.selectedPiece, this.oldNameXOffset, this.oldNameYOffset);
75356             this.__parent.setState(this.__parent.getSelectionState());
75357         };
75358         /**
75359          *
75360          */
75361         PieceOfFurnitureNameOffsetState.prototype.escape = function () {
75362             this.selectedPiece.setNameXOffset(this.oldNameXOffset);
75363             this.selectedPiece.setNameYOffset(this.oldNameYOffset);
75364             this.__parent.setState(this.__parent.getSelectionState());
75365         };
75366         /**
75367          *
75368          * @param {boolean} alignmentActivated
75369          */
75370         PieceOfFurnitureNameOffsetState.prototype.setAlignmentActivated = function (alignmentActivated) {
75371             this.alignmentActivated = alignmentActivated;
75372             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
75373         };
75374         /**
75375          *
75376          */
75377         PieceOfFurnitureNameOffsetState.prototype.exit = function () {
75378             this.__parent.getView().setResizeIndicatorVisible(false);
75379             this.selectedPiece = null;
75380         };
75381         return PieceOfFurnitureNameOffsetState;
75382     }(PlanController.ControllerState));
75383     PlanController.PieceOfFurnitureNameOffsetState = PieceOfFurnitureNameOffsetState;
75384     PieceOfFurnitureNameOffsetState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PieceOfFurnitureNameOffsetState";
75385     /**
75386      * Furniture name rotation state. This state manages the name rotation of a piece of furniture.
75387      * @extends PlanController.ControllerState
75388      * @class
75389      */
75390     var PieceOfFurnitureNameRotationState = /** @class */ (function (_super) {
75391         __extends(PieceOfFurnitureNameRotationState, _super);
75392         function PieceOfFurnitureNameRotationState(__parent) {
75393             var _this = _super.call(this) || this;
75394             _this.__parent = __parent;
75395             if (_this.selectedPiece === undefined) {
75396                 _this.selectedPiece = null;
75397             }
75398             if (_this.oldNameAngle === undefined) {
75399                 _this.oldNameAngle = 0;
75400             }
75401             if (_this.angleMousePress === undefined) {
75402                 _this.angleMousePress = 0;
75403             }
75404             if (_this.magnetismEnabled === undefined) {
75405                 _this.magnetismEnabled = false;
75406             }
75407             if (_this.alignmentActivated === undefined) {
75408                 _this.alignmentActivated = false;
75409             }
75410             return _this;
75411         }
75412         /**
75413          *
75414          * @return {PlanController.Mode}
75415          */
75416         PieceOfFurnitureNameRotationState.prototype.getMode = function () {
75417             return PlanController.Mode.SELECTION_$LI$();
75418         };
75419         /**
75420          *
75421          * @return {boolean}
75422          */
75423         PieceOfFurnitureNameRotationState.prototype.isModificationState = function () {
75424             return true;
75425         };
75426         /**
75427          *
75428          */
75429         PieceOfFurnitureNameRotationState.prototype.enter = function () {
75430             this.selectedPiece = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
75431             this.angleMousePress = Math.atan2(this.selectedPiece.getY() + this.selectedPiece.getNameYOffset() - this.__parent.getYLastMousePress(), this.__parent.getXLastMousePress() - this.selectedPiece.getX() - this.selectedPiece.getNameXOffset());
75432             this.oldNameAngle = this.selectedPiece.getNameAngle();
75433             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
75434             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (this.__parent.wasMagnetismToggledLastMousePress());
75435             var planView = this.__parent.getView();
75436             planView.setResizeIndicatorVisible(true);
75437         };
75438         /**
75439          *
75440          * @param {number} x
75441          * @param {number} y
75442          */
75443         PieceOfFurnitureNameRotationState.prototype.moveMouse = function (x, y) {
75444             if (x !== this.selectedPiece.getX() + this.selectedPiece.getNameXOffset() || y !== this.selectedPiece.getY() + this.selectedPiece.getNameYOffset()) {
75445                 var angleMouseMove = Math.atan2(this.selectedPiece.getY() + this.selectedPiece.getNameYOffset() - y, x - this.selectedPiece.getX() - this.selectedPiece.getNameXOffset());
75446                 var newAngle = this.oldNameAngle - angleMouseMove + this.angleMousePress;
75447                 if (this.alignmentActivated || this.magnetismEnabled) {
75448                     var angleStep = 2 * Math.PI / PieceOfFurnitureNameRotationState.STEP_COUNT;
75449                     newAngle = Math.round(newAngle / angleStep) * angleStep;
75450                 }
75451                 this.selectedPiece.setNameAngle(newAngle);
75452                 this.__parent.getView().makePointVisible(x, y);
75453             }
75454         };
75455         /**
75456          *
75457          * @param {number} x
75458          * @param {number} y
75459          */
75460         PieceOfFurnitureNameRotationState.prototype.releaseMouse = function (x, y) {
75461             this.__parent.postPieceOfFurnitureNameRotation(this.selectedPiece, this.oldNameAngle);
75462             this.__parent.setState(this.__parent.getSelectionState());
75463         };
75464         /**
75465          *
75466          * @param {boolean} magnetismToggled
75467          */
75468         PieceOfFurnitureNameRotationState.prototype.toggleMagnetism = function (magnetismToggled) {
75469             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
75470             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
75471         };
75472         /**
75473          *
75474          * @param {boolean} alignmentActivated
75475          */
75476         PieceOfFurnitureNameRotationState.prototype.setAlignmentActivated = function (alignmentActivated) {
75477             this.alignmentActivated = alignmentActivated;
75478             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
75479         };
75480         /**
75481          *
75482          */
75483         PieceOfFurnitureNameRotationState.prototype.escape = function () {
75484             this.selectedPiece.setNameAngle(this.oldNameAngle);
75485             this.__parent.setState(this.__parent.getSelectionState());
75486         };
75487         /**
75488          *
75489          */
75490         PieceOfFurnitureNameRotationState.prototype.exit = function () {
75491             this.__parent.getView().setResizeIndicatorVisible(false);
75492             this.selectedPiece = null;
75493         };
75494         PieceOfFurnitureNameRotationState.STEP_COUNT = 24;
75495         return PieceOfFurnitureNameRotationState;
75496     }(PlanController.ControllerState));
75497     PlanController.PieceOfFurnitureNameRotationState = PieceOfFurnitureNameRotationState;
75498     PieceOfFurnitureNameRotationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PieceOfFurnitureNameRotationState";
75499     /**
75500      * Camera yaw change state. This states manages the change of the observer camera yaw angle.
75501      * @extends PlanController.ControllerState
75502      * @class
75503      */
75504     var CameraYawRotationState = /** @class */ (function (_super) {
75505         __extends(CameraYawRotationState, _super);
75506         function CameraYawRotationState(__parent) {
75507             var _this = _super.call(this) || this;
75508             _this.__parent = __parent;
75509             if (_this.selectedCamera === undefined) {
75510                 _this.selectedCamera = null;
75511             }
75512             if (_this.oldYaw === undefined) {
75513                 _this.oldYaw = 0;
75514             }
75515             if (_this.xLastMouseMove === undefined) {
75516                 _this.xLastMouseMove = 0;
75517             }
75518             if (_this.yLastMouseMove === undefined) {
75519                 _this.yLastMouseMove = 0;
75520             }
75521             if (_this.angleLastMouseMove === undefined) {
75522                 _this.angleLastMouseMove = 0;
75523             }
75524             if (_this.rotationToolTipFeedback === undefined) {
75525                 _this.rotationToolTipFeedback = null;
75526             }
75527             return _this;
75528         }
75529         /**
75530          *
75531          * @return {PlanController.Mode}
75532          */
75533         CameraYawRotationState.prototype.getMode = function () {
75534             return PlanController.Mode.SELECTION_$LI$();
75535         };
75536         /**
75537          *
75538          * @return {boolean}
75539          */
75540         CameraYawRotationState.prototype.isModificationState = function () {
75541             return true;
75542         };
75543         /**
75544          *
75545          */
75546         CameraYawRotationState.prototype.enter = function () {
75547             this.rotationToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "cameraYawRotationToolTipFeedback");
75548             this.selectedCamera = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
75549             this.oldYaw = this.selectedCamera.getYaw();
75550             this.xLastMouseMove = this.__parent.getXLastMousePress();
75551             this.yLastMouseMove = this.__parent.getYLastMousePress();
75552             this.angleLastMouseMove = Math.atan2(this.selectedCamera.getY() - this.yLastMouseMove, this.xLastMouseMove - this.selectedCamera.getX());
75553             var planView = this.__parent.getView();
75554             planView.setResizeIndicatorVisible(true);
75555             if (this.__parent.feedbackDisplayed) {
75556                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.oldYaw), this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
75557             }
75558         };
75559         /**
75560          *
75561          * @param {number} x
75562          * @param {number} y
75563          */
75564         CameraYawRotationState.prototype.moveMouse = function (x, y) {
75565             if (x !== this.selectedCamera.getX() || y !== this.selectedCamera.getY()) {
75566                 var angleMouseMove = Math.atan2(this.selectedCamera.getY() - y, x - this.selectedCamera.getX());
75567                 var deltaYaw = this.angleLastMouseMove - angleMouseMove;
75568                 var orientation_2 = (function (f) { if (f > 0) {
75569                     return 1;
75570                 }
75571                 else if (f < 0) {
75572                     return -1;
75573                 }
75574                 else {
75575                     return 0;
75576                 } })((y - this.selectedCamera.getY()) * (this.xLastMouseMove - this.selectedCamera.getX()) - (this.yLastMouseMove - this.selectedCamera.getY()) * (x - this.selectedCamera.getX()));
75577                 if (orientation_2 < 0 && deltaYaw > 0) {
75578                     deltaYaw -= (Math.PI * 2.0);
75579                 }
75580                 else if (orientation_2 > 0 && deltaYaw < 0) {
75581                     deltaYaw += (Math.PI * 2.0);
75582                 }
75583                 var newYaw = this.selectedCamera.getYaw() + deltaYaw;
75584                 this.selectedCamera.setYaw(newYaw);
75585                 if (this.__parent.feedbackDisplayed) {
75586                     this.__parent.getView().setToolTipFeedback(this.getToolTipFeedbackText(newYaw), x, y);
75587                 }
75588                 this.xLastMouseMove = x;
75589                 this.yLastMouseMove = y;
75590                 this.angleLastMouseMove = angleMouseMove;
75591             }
75592         };
75593         /**
75594          *
75595          * @param {number} x
75596          * @param {number} y
75597          */
75598         CameraYawRotationState.prototype.releaseMouse = function (x, y) {
75599             this.__parent.setState(this.__parent.getSelectionState());
75600         };
75601         /**
75602          *
75603          */
75604         CameraYawRotationState.prototype.escape = function () {
75605             this.selectedCamera.setYaw(this.oldYaw);
75606             this.__parent.setState(this.__parent.getSelectionState());
75607         };
75608         /**
75609          *
75610          */
75611         CameraYawRotationState.prototype.exit = function () {
75612             var planView = this.__parent.getView();
75613             planView.setResizeIndicatorVisible(false);
75614             planView.deleteFeedback();
75615             this.selectedCamera = null;
75616         };
75617         CameraYawRotationState.prototype.getToolTipFeedbackText = function (angle) {
75618             return CoreTools.format(this.rotationToolTipFeedback, (Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(angle)) + 360) % 360);
75619         };
75620         return CameraYawRotationState;
75621     }(PlanController.ControllerState));
75622     PlanController.CameraYawRotationState = CameraYawRotationState;
75623     CameraYawRotationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.CameraYawRotationState";
75624     /**
75625      * Camera pitch rotation state. This states manages the change of the observer camera pitch angle.
75626      * @extends PlanController.ControllerState
75627      * @class
75628      */
75629     var CameraPitchRotationState = /** @class */ (function (_super) {
75630         __extends(CameraPitchRotationState, _super);
75631         function CameraPitchRotationState(__parent) {
75632             var _this = _super.call(this) || this;
75633             _this.__parent = __parent;
75634             if (_this.selectedCamera === undefined) {
75635                 _this.selectedCamera = null;
75636             }
75637             if (_this.oldPitch === undefined) {
75638                 _this.oldPitch = 0;
75639             }
75640             if (_this.rotationToolTipFeedback === undefined) {
75641                 _this.rotationToolTipFeedback = null;
75642             }
75643             return _this;
75644         }
75645         /**
75646          *
75647          * @return {PlanController.Mode}
75648          */
75649         CameraPitchRotationState.prototype.getMode = function () {
75650             return PlanController.Mode.SELECTION_$LI$();
75651         };
75652         /**
75653          *
75654          * @return {boolean}
75655          */
75656         CameraPitchRotationState.prototype.isModificationState = function () {
75657             return true;
75658         };
75659         /**
75660          *
75661          */
75662         CameraPitchRotationState.prototype.enter = function () {
75663             this.rotationToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "cameraPitchRotationToolTipFeedback");
75664             this.selectedCamera = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
75665             this.oldPitch = this.selectedCamera.getPitch();
75666             var planView = this.__parent.getView();
75667             planView.setResizeIndicatorVisible(true);
75668             if (this.__parent.feedbackDisplayed) {
75669                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.oldPitch), this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
75670             }
75671         };
75672         /**
75673          *
75674          * @param {number} x
75675          * @param {number} y
75676          */
75677         CameraPitchRotationState.prototype.moveMouse = function (x, y) {
75678             var newPitch = (this.oldPitch + (y - this.__parent.getYLastMousePress()) * Math.cos(this.selectedCamera.getYaw()) * Math.PI / 360 - (x - this.__parent.getXLastMousePress()) * Math.sin(this.selectedCamera.getYaw()) * Math.PI / 360);
75679             newPitch = Math.max(newPitch, -Math.PI / 2);
75680             newPitch = Math.min(newPitch, Math.PI / 2);
75681             this.selectedCamera.setPitch(newPitch);
75682             if (this.__parent.feedbackDisplayed) {
75683                 this.__parent.getView().setToolTipFeedback(this.getToolTipFeedbackText(newPitch), x, y);
75684             }
75685         };
75686         /**
75687          *
75688          * @param {number} x
75689          * @param {number} y
75690          */
75691         CameraPitchRotationState.prototype.releaseMouse = function (x, y) {
75692             this.__parent.setState(this.__parent.getSelectionState());
75693         };
75694         /**
75695          *
75696          */
75697         CameraPitchRotationState.prototype.escape = function () {
75698             this.selectedCamera.setPitch(this.oldPitch);
75699             this.__parent.setState(this.__parent.getSelectionState());
75700         };
75701         /**
75702          *
75703          */
75704         CameraPitchRotationState.prototype.exit = function () {
75705             var planView = this.__parent.getView();
75706             planView.setResizeIndicatorVisible(false);
75707             planView.deleteFeedback();
75708             this.selectedCamera = null;
75709         };
75710         CameraPitchRotationState.prototype.getToolTipFeedbackText = function (angle) {
75711             return CoreTools.format(this.rotationToolTipFeedback, Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(angle)) % 360);
75712         };
75713         return CameraPitchRotationState;
75714     }(PlanController.ControllerState));
75715     PlanController.CameraPitchRotationState = CameraPitchRotationState;
75716     CameraPitchRotationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.CameraPitchRotationState";
75717     /**
75718      * Camera elevation state. This states manages the change of the observer camera elevation.
75719      * @extends PlanController.ControllerState
75720      * @class
75721      */
75722     var CameraElevationState = /** @class */ (function (_super) {
75723         __extends(CameraElevationState, _super);
75724         function CameraElevationState(__parent) {
75725             var _this = _super.call(this) || this;
75726             _this.__parent = __parent;
75727             if (_this.selectedCamera === undefined) {
75728                 _this.selectedCamera = null;
75729             }
75730             if (_this.oldElevation === undefined) {
75731                 _this.oldElevation = 0;
75732             }
75733             if (_this.cameraElevationToolTipFeedback === undefined) {
75734                 _this.cameraElevationToolTipFeedback = null;
75735             }
75736             if (_this.observerHeightToolTipFeedback === undefined) {
75737                 _this.observerHeightToolTipFeedback = null;
75738             }
75739             return _this;
75740         }
75741         /**
75742          *
75743          * @return {PlanController.Mode}
75744          */
75745         CameraElevationState.prototype.getMode = function () {
75746             return PlanController.Mode.SELECTION_$LI$();
75747         };
75748         /**
75749          *
75750          * @return {boolean}
75751          */
75752         CameraElevationState.prototype.isModificationState = function () {
75753             return true;
75754         };
75755         /**
75756          *
75757          */
75758         CameraElevationState.prototype.enter = function () {
75759             this.cameraElevationToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "cameraElevationToolTipFeedback");
75760             this.observerHeightToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "observerHeightToolTipFeedback");
75761             this.selectedCamera = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
75762             this.oldElevation = this.selectedCamera.getZ();
75763             var planView = this.__parent.getView();
75764             planView.setResizeIndicatorVisible(true);
75765             if (this.__parent.feedbackDisplayed) {
75766                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.oldElevation), this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
75767             }
75768         };
75769         /**
75770          *
75771          * @param {number} x
75772          * @param {number} y
75773          */
75774         CameraElevationState.prototype.moveMouse = function (x, y) {
75775             var newElevation = (this.oldElevation - (y - this.__parent.getYLastMousePress()));
75776             var levels = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getLevels();
75777             var minimumElevation = levels.length === 0 ? 10 : 10 + /* get */ levels[0].getElevation();
75778             newElevation = Math.min(Math.max(newElevation, minimumElevation), this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMaximumElevation());
75779             this.selectedCamera.setZ(newElevation);
75780             if (this.__parent.feedbackDisplayed) {
75781                 this.__parent.getView().setToolTipFeedback(this.getToolTipFeedbackText(newElevation), x, y);
75782             }
75783         };
75784         /**
75785          *
75786          * @param {number} x
75787          * @param {number} y
75788          */
75789         CameraElevationState.prototype.releaseMouse = function (x, y) {
75790             this.__parent.setState(this.__parent.getSelectionState());
75791         };
75792         /**
75793          *
75794          */
75795         CameraElevationState.prototype.escape = function () {
75796             this.selectedCamera.setZ(this.oldElevation);
75797             this.__parent.setState(this.__parent.getSelectionState());
75798         };
75799         /**
75800          *
75801          */
75802         CameraElevationState.prototype.exit = function () {
75803             var planView = this.__parent.getView();
75804             planView.setResizeIndicatorVisible(false);
75805             planView.deleteFeedback();
75806             this.selectedCamera = null;
75807         };
75808         CameraElevationState.prototype.getToolTipFeedbackText = function (elevation) {
75809             var toolTipFeedbackText = "<html>" + CoreTools.format(this.cameraElevationToolTipFeedback, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getFormatWithUnit().format(elevation));
75810             if (!this.selectedCamera.isFixedSize() && elevation >= 70 && elevation <= 218.75) {
75811                 toolTipFeedbackText += "<br>" + CoreTools.format(this.observerHeightToolTipFeedback, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getFormatWithUnit().format(elevation * 15 / 14));
75812             }
75813             return toolTipFeedbackText;
75814         };
75815         return CameraElevationState;
75816     }(PlanController.ControllerState));
75817     PlanController.CameraElevationState = CameraElevationState;
75818     CameraElevationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.CameraElevationState";
75819     /**
75820      * Dimension line drawing state. This state manages dimension line creation at mouse press.
75821      * @extends PlanController.ControllerState
75822      * @class
75823      */
75824     var DimensionLineDrawingState = /** @class */ (function (_super) {
75825         __extends(DimensionLineDrawingState, _super);
75826         function DimensionLineDrawingState(__parent) {
75827             var _this = _super.call(this) || this;
75828             _this.__parent = __parent;
75829             if (_this.xStart === undefined) {
75830                 _this.xStart = 0;
75831             }
75832             if (_this.yStart === undefined) {
75833                 _this.yStart = 0;
75834             }
75835             if (_this.editingStartPoint === undefined) {
75836                 _this.editingStartPoint = false;
75837             }
75838             if (_this.newDimensionLine === undefined) {
75839                 _this.newDimensionLine = null;
75840             }
75841             if (_this.oldSelection === undefined) {
75842                 _this.oldSelection = null;
75843             }
75844             if (_this.oldBasePlanLocked === undefined) {
75845                 _this.oldBasePlanLocked = false;
75846             }
75847             if (_this.oldAllLevelsSelection === undefined) {
75848                 _this.oldAllLevelsSelection = false;
75849             }
75850             if (_this.magnetismEnabled === undefined) {
75851                 _this.magnetismEnabled = false;
75852             }
75853             if (_this.alignmentActivated === undefined) {
75854                 _this.alignmentActivated = false;
75855             }
75856             if (_this.offsetChoice === undefined) {
75857                 _this.offsetChoice = false;
75858             }
75859             return _this;
75860         }
75861         /**
75862          *
75863          * @return {PlanController.Mode}
75864          */
75865         DimensionLineDrawingState.prototype.getMode = function () {
75866             return PlanController.Mode.DIMENSION_LINE_CREATION_$LI$();
75867         };
75868         /**
75869          *
75870          * @return {boolean}
75871          */
75872         DimensionLineDrawingState.prototype.isModificationState = function () {
75873             return true;
75874         };
75875         /**
75876          *
75877          * @return {boolean}
75878          */
75879         DimensionLineDrawingState.prototype.isBasePlanModificationState = function () {
75880             return true;
75881         };
75882         /**
75883          *
75884          * @param {PlanController.Mode} mode
75885          */
75886         DimensionLineDrawingState.prototype.setMode = function (mode) {
75887             this.escape();
75888             if (mode === PlanController.Mode.SELECTION_$LI$()) {
75889                 this.__parent.setState(this.__parent.getSelectionState());
75890             }
75891             else if (mode === PlanController.Mode.PANNING_$LI$()) {
75892                 this.__parent.setState(this.__parent.getPanningState());
75893             }
75894             else if (mode === PlanController.Mode.WALL_CREATION_$LI$()) {
75895                 this.__parent.setState(this.__parent.getWallCreationState());
75896             }
75897             else if (mode === PlanController.Mode.ROOM_CREATION_$LI$()) {
75898                 this.__parent.setState(this.__parent.getRoomCreationState());
75899             }
75900             else if (mode === PlanController.Mode.POLYLINE_CREATION_$LI$()) {
75901                 this.__parent.setState(this.__parent.getPolylineCreationState());
75902             }
75903             else if (mode === PlanController.Mode.LABEL_CREATION_$LI$()) {
75904                 this.__parent.setState(this.__parent.getLabelCreationState());
75905             }
75906         };
75907         /**
75908          *
75909          */
75910         DimensionLineDrawingState.prototype.enter = function () {
75911             this.oldSelection = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
75912             this.oldBasePlanLocked = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked();
75913             this.oldAllLevelsSelection = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection();
75914             this.xStart = this.__parent.getXLastMouseMove();
75915             this.yStart = this.__parent.getYLastMouseMove();
75916             this.editingStartPoint = false;
75917             this.offsetChoice = false;
75918             this.newDimensionLine = null;
75919             this.__parent.deselectAll();
75920             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
75921             this.toggleMagnetism(this.__parent.wasMagnetismToggledLastMousePress());
75922             var dimensionLine = this.__parent.getMeasuringDimensionLineAt(this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress(), this.magnetismEnabled);
75923             if (this.__parent.feedbackDisplayed) {
75924                 if (dimensionLine != null) {
75925                     this.__parent.getView().setDimensionLinesFeedback(/* asList */ [dimensionLine].slice(0));
75926                 }
75927                 this.__parent.getView().setAlignmentFeedback(DimensionLine, null, this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress(), false);
75928             }
75929         };
75930         /**
75931          *
75932          * @param {number} x
75933          * @param {number} y
75934          */
75935         DimensionLineDrawingState.prototype.moveMouse = function (x, y) {
75936             var planView = this.__parent.getView();
75937             planView.deleteFeedback();
75938             if (this.offsetChoice) {
75939                 var distanceToDimensionLine = java.awt.geom.Line2D.ptLineDist(this.newDimensionLine.getXStart(), this.newDimensionLine.getYStart(), this.newDimensionLine.getXEnd(), this.newDimensionLine.getYEnd(), x, y);
75940                 if (this.newDimensionLine.getLength() > 0) {
75941                     var relativeCCW = java.awt.geom.Line2D.relativeCCW(this.newDimensionLine.getXStart(), this.newDimensionLine.getYStart(), this.newDimensionLine.getXEnd(), this.newDimensionLine.getYEnd(), x, y);
75942                     this.newDimensionLine.setOffset(-(function (f) { if (f > 0) {
75943                         return 1;
75944                     }
75945                     else if (f < 0) {
75946                         return -1;
75947                     }
75948                     else {
75949                         return 0;
75950                     } })(relativeCCW) * distanceToDimensionLine);
75951                 }
75952             }
75953             else {
75954                 var newX = void 0;
75955                 var newY = void 0;
75956                 if (this.magnetismEnabled || this.alignmentActivated) {
75957                     var point = new PlanController.PointWithAngleMagnetism(this.xStart, this.yStart, x, y, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit(), planView.getPixelLength());
75958                     newX = point.getX();
75959                     newY = point.getY();
75960                 }
75961                 else {
75962                     newX = x;
75963                     newY = y;
75964                 }
75965                 if (this.newDimensionLine == null) {
75966                     this.newDimensionLine = this.__parent.createDimensionLine(this.xStart, this.yStart, newX, newY, 0);
75967                     this.__parent.getView().setDimensionLinesFeedback(null);
75968                 }
75969                 else {
75970                     if (this.editingStartPoint) {
75971                         this.newDimensionLine.setXStart(newX);
75972                         this.newDimensionLine.setYStart(newY);
75973                     }
75974                     else {
75975                         this.newDimensionLine.setXEnd(newX);
75976                         this.newDimensionLine.setYEnd(newY);
75977                     }
75978                 }
75979                 this.updateReversedDimensionLine();
75980                 if (this.__parent.feedbackDisplayed) {
75981                     planView.setAlignmentFeedback(DimensionLine, this.newDimensionLine, newX, newY, false);
75982                 }
75983             }
75984             planView.makePointVisible(x, y);
75985         };
75986         /**
75987          * Swaps start and end point of the created dimension line if needed
75988          * to ensure its text is never upside down.
75989          * @private
75990          */
75991         DimensionLineDrawingState.prototype.updateReversedDimensionLine = function () {
75992             var angle = this.getDimensionLineAngle();
75993             var reverse = angle < -Math.PI / 2 || angle > Math.PI / 2;
75994             if ((reverse) !== (this.editingStartPoint)) {
75995                 PlanController.reverseDimensionLine(this.newDimensionLine);
75996                 this.editingStartPoint = !this.editingStartPoint;
75997             }
75998         };
75999         DimensionLineDrawingState.prototype.getDimensionLineAngle = function () {
76000             if (this.newDimensionLine.getLength() === 0) {
76001                 return 0;
76002             }
76003             else {
76004                 if (this.editingStartPoint) {
76005                     return Math.atan2(this.yStart - this.newDimensionLine.getYStart(), this.newDimensionLine.getXStart() - this.xStart);
76006                 }
76007                 else {
76008                     return Math.atan2(this.yStart - this.newDimensionLine.getYEnd(), this.newDimensionLine.getXEnd() - this.xStart);
76009                 }
76010             }
76011         };
76012         /**
76013          *
76014          * @param {number} x
76015          * @param {number} y
76016          * @param {number} clickCount
76017          * @param {boolean} shiftDown
76018          * @param {boolean} duplicationActivated
76019          */
76020         DimensionLineDrawingState.prototype.pressMouse = function (x, y, clickCount, shiftDown, duplicationActivated) {
76021             if (this.newDimensionLine == null && clickCount === 2) {
76022                 var dimensionLine = this.__parent.getMeasuringDimensionLineAt(x, y, this.magnetismEnabled);
76023                 if (dimensionLine != null) {
76024                     this.newDimensionLine = this.__parent.createDimensionLine(dimensionLine.getXStart(), dimensionLine.getYStart(), dimensionLine.getXEnd(), dimensionLine.getYEnd(), dimensionLine.getOffset());
76025                     if (this.__parent.getPointerTypeLastMousePress() === View.PointerType.TOUCH) {
76026                         this.validateDrawnDimensionLine();
76027                     }
76028                 }
76029                 else {
76030                     this.__parent.setState(this.__parent.getDimensionLineCreationState());
76031                     return;
76032                 }
76033             }
76034             if (this.newDimensionLine != null) {
76035                 if (this.offsetChoice) {
76036                     this.validateDrawnDimensionLine();
76037                 }
76038                 else {
76039                     this.offsetChoice = true;
76040                     var planView = this.__parent.getView();
76041                     planView.setCursor(PlanView.CursorType.HEIGHT);
76042                     planView.deleteFeedback();
76043                 }
76044             }
76045         };
76046         /**
76047          *
76048          * @param {number} x
76049          * @param {number} y
76050          */
76051         DimensionLineDrawingState.prototype.releaseMouse = function (x, y) {
76052             if (this.__parent.getPointerTypeLastMousePress() === View.PointerType.TOUCH && this.newDimensionLine != null) {
76053                 this.validateDrawnDimensionLine();
76054             }
76055         };
76056         DimensionLineDrawingState.prototype.validateDrawnDimensionLine = function () {
76057             this.__parent.selectItem(this.newDimensionLine);
76058             this.__parent.postCreateDimensionLines(/* asList */ [this.newDimensionLine].slice(0), this.oldSelection, this.oldBasePlanLocked, this.oldAllLevelsSelection);
76059             this.newDimensionLine = null;
76060             if (this.__parent.getPointerTypeLastMousePress() === View.PointerType.TOUCH) {
76061                 this.__parent.setState(this.__parent.getSelectionState());
76062             }
76063             else {
76064                 this.__parent.setState(this.__parent.getDimensionLineCreationState());
76065             }
76066         };
76067         /**
76068          *
76069          * @param {boolean} editionActivated
76070          */
76071         DimensionLineDrawingState.prototype.setEditionActivated = function (editionActivated) {
76072             var planView = this.__parent.getView();
76073             if (editionActivated) {
76074                 planView.deleteFeedback();
76075                 if (this.newDimensionLine == null) {
76076                     planView.setToolTipEditedProperties(["X", "Y"], [this.xStart, this.yStart], this.xStart, this.yStart);
76077                 }
76078                 else if (this.offsetChoice) {
76079                     planView.setToolTipEditedProperties(["OFFSET"], [this.newDimensionLine.getOffset()], this.newDimensionLine.getXEnd(), this.newDimensionLine.getYEnd());
76080                 }
76081                 else {
76082                     planView.setToolTipEditedProperties(["LENGTH", "ANGLE"], [this.newDimensionLine.getLength(), (Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(this.getDimensionLineAngle())) | 0)], this.newDimensionLine.getXEnd(), this.newDimensionLine.getYEnd());
76083                 }
76084                 this.showDimensionLineFeedback();
76085             }
76086             else {
76087                 if (this.newDimensionLine == null) {
76088                     var lengthUnit = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit();
76089                     var defaultLength = lengthUnit.isMetric() ? 100 : LengthUnit.footToCentimeter(3);
76090                     this.newDimensionLine = this.__parent.createDimensionLine(this.xStart, this.yStart, this.xStart + defaultLength, this.yStart, 0);
76091                     planView.deleteFeedback();
76092                     this.setEditionActivated(true);
76093                 }
76094                 else if (this.offsetChoice) {
76095                     this.validateDrawnDimensionLine();
76096                 }
76097                 else {
76098                     this.offsetChoice = true;
76099                     this.setEditionActivated(true);
76100                 }
76101             }
76102         };
76103         /**
76104          *
76105          * @param {string} editableProperty
76106          * @param {Object} value
76107          */
76108         DimensionLineDrawingState.prototype.updateEditableProperty = function (editableProperty, value) {
76109             var maximumLength = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMaximumLength();
76110             if (this.newDimensionLine == null) {
76111                 switch ((editableProperty)) {
76112                     case "X":
76113                         this.xStart = value != null ? /* floatValue */ value : 0;
76114                         this.xStart = Math.max(-maximumLength, Math.min(this.xStart, maximumLength));
76115                         break;
76116                     case "Y":
76117                         this.yStart = value != null ? /* floatValue */ value : 0;
76118                         this.yStart = Math.max(-maximumLength, Math.min(this.yStart, maximumLength));
76119                         break;
76120                 }
76121             }
76122             else if (this.offsetChoice) {
76123                 if (editableProperty === "OFFSET") {
76124                     var offset = value != null ? /* floatValue */ value : 0;
76125                     offset = Math.max(-maximumLength, Math.min(offset, maximumLength));
76126                     this.newDimensionLine.setOffset(offset);
76127                 }
76128             }
76129             else {
76130                 var newX = void 0;
76131                 var newY = void 0;
76132                 switch ((editableProperty)) {
76133                     case "LENGTH":
76134                         var length_1 = value != null ? /* floatValue */ value : 0;
76135                         length_1 = Math.max(0.001, Math.min(length_1, maximumLength));
76136                         var dimensionLineAngle = this.getDimensionLineAngle();
76137                         newX = (this.xStart + length_1 * Math.cos(dimensionLineAngle));
76138                         newY = (this.yStart - length_1 * Math.sin(dimensionLineAngle));
76139                         break;
76140                     case "ANGLE":
76141                         dimensionLineAngle = /* toRadians */ (function (x) { return x * Math.PI / 180; })(value != null ? /* floatValue */ value : 0);
76142                         var dimensionLineLength = this.newDimensionLine.getLength();
76143                         newX = (this.xStart + dimensionLineLength * Math.cos(dimensionLineAngle));
76144                         newY = (this.yStart - dimensionLineLength * Math.sin(dimensionLineAngle));
76145                         break;
76146                     default:
76147                         return;
76148                 }
76149                 if (this.editingStartPoint) {
76150                     this.newDimensionLine.setXStart(newX);
76151                     this.newDimensionLine.setYStart(newY);
76152                 }
76153                 else {
76154                     this.newDimensionLine.setXEnd(newX);
76155                     this.newDimensionLine.setYEnd(newY);
76156                 }
76157             }
76158             this.showDimensionLineFeedback();
76159         };
76160         DimensionLineDrawingState.prototype.showDimensionLineFeedback = function () {
76161             var planView = this.__parent.getView();
76162             if (this.newDimensionLine == null) {
76163                 if (this.__parent.feedbackDisplayed) {
76164                     planView.setAlignmentFeedback(DimensionLine, null, this.xStart, this.yStart, true);
76165                 }
76166                 planView.makePointVisible(this.xStart, this.yStart);
76167             }
76168             else if (!this.offsetChoice) {
76169                 var updatedX = void 0;
76170                 var updatedY = void 0;
76171                 if (this.editingStartPoint) {
76172                     updatedX = this.newDimensionLine.getXStart();
76173                     updatedY = this.newDimensionLine.getYStart();
76174                 }
76175                 else {
76176                     updatedX = this.newDimensionLine.getXEnd();
76177                     updatedY = this.newDimensionLine.getYEnd();
76178                 }
76179                 this.updateReversedDimensionLine();
76180                 if (this.__parent.feedbackDisplayed) {
76181                     planView.setAlignmentFeedback(DimensionLine, this.newDimensionLine, updatedX, updatedY, false);
76182                 }
76183                 planView.makePointVisible(this.xStart, this.yStart);
76184                 planView.makePointVisible(updatedX, updatedY);
76185             }
76186         };
76187         /**
76188          *
76189          * @param {boolean} magnetismToggled
76190          */
76191         DimensionLineDrawingState.prototype.toggleMagnetism = function (magnetismToggled) {
76192             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
76193             if (this.newDimensionLine != null && !this.offsetChoice) {
76194                 this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
76195             }
76196         };
76197         /**
76198          *
76199          * @param {boolean} alignmentActivated
76200          */
76201         DimensionLineDrawingState.prototype.setAlignmentActivated = function (alignmentActivated) {
76202             this.alignmentActivated = alignmentActivated;
76203             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
76204         };
76205         /**
76206          *
76207          */
76208         DimensionLineDrawingState.prototype.escape = function () {
76209             if (this.newDimensionLine != null) {
76210                 this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deleteDimensionLine(this.newDimensionLine);
76211             }
76212             if (this.__parent.getPointerTypeLastMousePress() === View.PointerType.TOUCH) {
76213                 this.__parent.setState(this.__parent.getSelectionState());
76214             }
76215             else {
76216                 this.__parent.setState(this.__parent.getDimensionLineCreationState());
76217             }
76218         };
76219         /**
76220          *
76221          */
76222         DimensionLineDrawingState.prototype.exit = function () {
76223             this.__parent.getView().deleteFeedback();
76224             this.newDimensionLine = null;
76225             this.oldSelection = null;
76226         };
76227         return DimensionLineDrawingState;
76228     }(PlanController.ControllerState));
76229     PlanController.DimensionLineDrawingState = DimensionLineDrawingState;
76230     DimensionLineDrawingState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.DimensionLineDrawingState";
76231     /**
76232      * Dimension line resize state. This state manages dimension line resizing.
76233      * @extends PlanController.ControllerState
76234      * @class
76235      */
76236     var DimensionLineResizeState = /** @class */ (function (_super) {
76237         __extends(DimensionLineResizeState, _super);
76238         function DimensionLineResizeState(__parent) {
76239             var _this = _super.call(this) || this;
76240             _this.__parent = __parent;
76241             if (_this.selectedDimensionLine === undefined) {
76242                 _this.selectedDimensionLine = null;
76243             }
76244             if (_this.editingStartPoint === undefined) {
76245                 _this.editingStartPoint = false;
76246             }
76247             if (_this.oldX === undefined) {
76248                 _this.oldX = 0;
76249             }
76250             if (_this.oldY === undefined) {
76251                 _this.oldY = 0;
76252             }
76253             if (_this.reversedDimensionLine === undefined) {
76254                 _this.reversedDimensionLine = false;
76255             }
76256             if (_this.deltaXToResizePoint === undefined) {
76257                 _this.deltaXToResizePoint = 0;
76258             }
76259             if (_this.deltaYToResizePoint === undefined) {
76260                 _this.deltaYToResizePoint = 0;
76261             }
76262             if (_this.distanceFromResizePointToDimensionBaseLine === undefined) {
76263                 _this.distanceFromResizePointToDimensionBaseLine = 0;
76264             }
76265             if (_this.magnetismEnabled === undefined) {
76266                 _this.magnetismEnabled = false;
76267             }
76268             if (_this.alignmentActivated === undefined) {
76269                 _this.alignmentActivated = false;
76270             }
76271             return _this;
76272         }
76273         /**
76274          *
76275          * @return {PlanController.Mode}
76276          */
76277         DimensionLineResizeState.prototype.getMode = function () {
76278             return PlanController.Mode.SELECTION_$LI$();
76279         };
76280         /**
76281          *
76282          * @return {boolean}
76283          */
76284         DimensionLineResizeState.prototype.isModificationState = function () {
76285             return true;
76286         };
76287         /**
76288          *
76289          * @return {boolean}
76290          */
76291         DimensionLineResizeState.prototype.isBasePlanModificationState = function () {
76292             return true;
76293         };
76294         /**
76295          *
76296          */
76297         DimensionLineResizeState.prototype.enter = function () {
76298             var planView = this.__parent.getView();
76299             planView.setResizeIndicatorVisible(true);
76300             this.selectedDimensionLine = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
76301             this.editingStartPoint = this.selectedDimensionLine === this.__parent.getResizedDimensionLineStartAt(this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
76302             if (this.editingStartPoint) {
76303                 this.oldX = this.selectedDimensionLine.getXStart();
76304                 this.oldY = this.selectedDimensionLine.getYStart();
76305             }
76306             else {
76307                 this.oldX = this.selectedDimensionLine.getXEnd();
76308                 this.oldY = this.selectedDimensionLine.getYEnd();
76309             }
76310             this.reversedDimensionLine = false;
76311             var xResizePoint;
76312             var yResizePoint;
76313             var alpha1 = (this.selectedDimensionLine.getYEnd() - this.selectedDimensionLine.getYStart()) / (this.selectedDimensionLine.getXEnd() - this.selectedDimensionLine.getXStart());
76314             if (Math.abs(alpha1) > 100000.0) {
76315                 xResizePoint = this.__parent.getXLastMousePress();
76316                 if (this.editingStartPoint) {
76317                     yResizePoint = this.selectedDimensionLine.getYStart();
76318                 }
76319                 else {
76320                     yResizePoint = this.selectedDimensionLine.getYEnd();
76321                 }
76322             }
76323             else if (this.selectedDimensionLine.getYStart() === this.selectedDimensionLine.getYEnd()) {
76324                 if (this.editingStartPoint) {
76325                     xResizePoint = this.selectedDimensionLine.getXStart();
76326                 }
76327                 else {
76328                     xResizePoint = this.selectedDimensionLine.getXEnd();
76329                 }
76330                 yResizePoint = this.__parent.getYLastMousePress();
76331             }
76332             else {
76333                 var beta1 = this.__parent.getYLastMousePress() - alpha1 * this.__parent.getXLastMousePress();
76334                 var alpha2 = -1 / alpha1;
76335                 var beta2 = void 0;
76336                 if (this.editingStartPoint) {
76337                     beta2 = this.selectedDimensionLine.getYStart() - alpha2 * this.selectedDimensionLine.getXStart();
76338                 }
76339                 else {
76340                     beta2 = this.selectedDimensionLine.getYEnd() - alpha2 * this.selectedDimensionLine.getXEnd();
76341                 }
76342                 xResizePoint = (beta2 - beta1) / (alpha1 - alpha2);
76343                 yResizePoint = alpha1 * xResizePoint + beta1;
76344             }
76345             this.deltaXToResizePoint = this.__parent.getXLastMousePress() - xResizePoint;
76346             this.deltaYToResizePoint = this.__parent.getYLastMousePress() - yResizePoint;
76347             if (this.editingStartPoint) {
76348                 this.distanceFromResizePointToDimensionBaseLine = java.awt.geom.Point2D.distance(xResizePoint, yResizePoint, this.selectedDimensionLine.getXStart(), this.selectedDimensionLine.getYStart());
76349                 if (this.__parent.feedbackDisplayed) {
76350                     planView.setAlignmentFeedback(DimensionLine, this.selectedDimensionLine, this.selectedDimensionLine.getXStart(), this.selectedDimensionLine.getYStart(), false);
76351                 }
76352             }
76353             else {
76354                 this.distanceFromResizePointToDimensionBaseLine = java.awt.geom.Point2D.distance(xResizePoint, yResizePoint, this.selectedDimensionLine.getXEnd(), this.selectedDimensionLine.getYEnd());
76355                 if (this.__parent.feedbackDisplayed) {
76356                     planView.setAlignmentFeedback(DimensionLine, this.selectedDimensionLine, this.selectedDimensionLine.getXEnd(), this.selectedDimensionLine.getYEnd(), false);
76357                 }
76358             }
76359             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
76360             this.toggleMagnetism(this.__parent.wasMagnetismToggledLastMousePress());
76361         };
76362         /**
76363          *
76364          * @param {number} x
76365          * @param {number} y
76366          */
76367         DimensionLineResizeState.prototype.moveMouse = function (x, y) {
76368             var planView = this.__parent.getView();
76369             var xResizePoint = x - this.deltaXToResizePoint;
76370             var yResizePoint = y - this.deltaYToResizePoint;
76371             if (this.editingStartPoint) {
76372                 var distanceFromResizePointToDimensionLineEnd = java.awt.geom.Point2D.distance(xResizePoint, yResizePoint, this.selectedDimensionLine.getXEnd(), this.selectedDimensionLine.getYEnd());
76373                 var distanceFromDimensionLineStartToDimensionLineEnd = Math.sqrt(distanceFromResizePointToDimensionLineEnd * distanceFromResizePointToDimensionLineEnd - this.distanceFromResizePointToDimensionBaseLine * this.distanceFromResizePointToDimensionBaseLine);
76374                 if (distanceFromDimensionLineStartToDimensionLineEnd > 0) {
76375                     var dimensionLineRelativeAngle = -Math.atan2(this.distanceFromResizePointToDimensionBaseLine, distanceFromDimensionLineStartToDimensionLineEnd);
76376                     if (this.selectedDimensionLine.getOffset() >= 0) {
76377                         dimensionLineRelativeAngle = -dimensionLineRelativeAngle;
76378                     }
76379                     var resizePointToDimensionLineEndAngle = Math.atan2(yResizePoint - this.selectedDimensionLine.getYEnd(), xResizePoint - this.selectedDimensionLine.getXEnd());
76380                     var dimensionLineStartToDimensionLineEndAngle = dimensionLineRelativeAngle + resizePointToDimensionLineEndAngle;
76381                     var xNewStartPoint = this.selectedDimensionLine.getXEnd() + (distanceFromDimensionLineStartToDimensionLineEnd * Math.cos(dimensionLineStartToDimensionLineEndAngle));
76382                     var yNewStartPoint = this.selectedDimensionLine.getYEnd() + (distanceFromDimensionLineStartToDimensionLineEnd * Math.sin(dimensionLineStartToDimensionLineEndAngle));
76383                     if (this.alignmentActivated || this.magnetismEnabled) {
76384                         var point = new PlanController.PointWithAngleMagnetism(this.selectedDimensionLine.getXEnd(), this.selectedDimensionLine.getYEnd(), xNewStartPoint, yNewStartPoint, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit(), planView.getPixelLength());
76385                         xNewStartPoint = point.getX();
76386                         yNewStartPoint = point.getY();
76387                     }
76388                     PlanController.moveDimensionLinePoint(this.selectedDimensionLine, xNewStartPoint, yNewStartPoint, this.editingStartPoint);
76389                     this.updateReversedDimensionLine();
76390                     if (this.__parent.feedbackDisplayed) {
76391                         planView.setAlignmentFeedback(DimensionLine, this.selectedDimensionLine, xNewStartPoint, yNewStartPoint, false);
76392                     }
76393                 }
76394                 else {
76395                     planView.deleteFeedback();
76396                 }
76397             }
76398             else {
76399                 var distanceFromResizePointToDimensionLineStart = java.awt.geom.Point2D.distance(xResizePoint, yResizePoint, this.selectedDimensionLine.getXStart(), this.selectedDimensionLine.getYStart());
76400                 var distanceFromDimensionLineStartToDimensionLineEnd = Math.sqrt(distanceFromResizePointToDimensionLineStart * distanceFromResizePointToDimensionLineStart - this.distanceFromResizePointToDimensionBaseLine * this.distanceFromResizePointToDimensionBaseLine);
76401                 if (distanceFromDimensionLineStartToDimensionLineEnd > 0) {
76402                     var dimensionLineRelativeAngle = Math.atan2(this.distanceFromResizePointToDimensionBaseLine, distanceFromDimensionLineStartToDimensionLineEnd);
76403                     if (this.selectedDimensionLine.getOffset() >= 0) {
76404                         dimensionLineRelativeAngle = -dimensionLineRelativeAngle;
76405                     }
76406                     var resizePointToDimensionLineStartAngle = Math.atan2(yResizePoint - this.selectedDimensionLine.getYStart(), xResizePoint - this.selectedDimensionLine.getXStart());
76407                     var dimensionLineStartToDimensionLineEndAngle = dimensionLineRelativeAngle + resizePointToDimensionLineStartAngle;
76408                     var xNewEndPoint = this.selectedDimensionLine.getXStart() + (distanceFromDimensionLineStartToDimensionLineEnd * Math.cos(dimensionLineStartToDimensionLineEndAngle));
76409                     var yNewEndPoint = this.selectedDimensionLine.getYStart() + (distanceFromDimensionLineStartToDimensionLineEnd * Math.sin(dimensionLineStartToDimensionLineEndAngle));
76410                     if (this.alignmentActivated || this.magnetismEnabled) {
76411                         var point = new PlanController.PointWithAngleMagnetism(this.selectedDimensionLine.getXStart(), this.selectedDimensionLine.getYStart(), xNewEndPoint, yNewEndPoint, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit(), planView.getPixelLength());
76412                         xNewEndPoint = point.getX();
76413                         yNewEndPoint = point.getY();
76414                     }
76415                     PlanController.moveDimensionLinePoint(this.selectedDimensionLine, xNewEndPoint, yNewEndPoint, this.editingStartPoint);
76416                     this.updateReversedDimensionLine();
76417                     if (this.__parent.feedbackDisplayed) {
76418                         planView.setAlignmentFeedback(DimensionLine, this.selectedDimensionLine, xNewEndPoint, yNewEndPoint, false);
76419                     }
76420                 }
76421                 else {
76422                     planView.deleteFeedback();
76423                 }
76424             }
76425             this.__parent.getView().makePointVisible(x, y);
76426         };
76427         /**
76428          * Swaps start and end point of the dimension line if needed
76429          * to ensure its text is never upside down.
76430          * @private
76431          */
76432         DimensionLineResizeState.prototype.updateReversedDimensionLine = function () {
76433             var angle = this.getDimensionLineAngle();
76434             if (angle < -Math.PI / 2 || angle > Math.PI / 2) {
76435                 PlanController.reverseDimensionLine(this.selectedDimensionLine);
76436                 this.editingStartPoint = !this.editingStartPoint;
76437                 this.reversedDimensionLine = !this.reversedDimensionLine;
76438             }
76439         };
76440         DimensionLineResizeState.prototype.getDimensionLineAngle = function () {
76441             if (this.selectedDimensionLine.getLength() === 0) {
76442                 return 0;
76443             }
76444             else {
76445                 return Math.atan2(this.selectedDimensionLine.getYStart() - this.selectedDimensionLine.getYEnd(), this.selectedDimensionLine.getXEnd() - this.selectedDimensionLine.getXStart());
76446             }
76447         };
76448         /**
76449          *
76450          * @param {number} x
76451          * @param {number} y
76452          */
76453         DimensionLineResizeState.prototype.releaseMouse = function (x, y) {
76454             this.__parent.postDimensionLineResize(this.selectedDimensionLine, this.oldX, this.oldY, this.editingStartPoint, this.reversedDimensionLine);
76455             this.__parent.setState(this.__parent.getSelectionState());
76456         };
76457         /**
76458          *
76459          * @param {boolean} magnetismToggled
76460          */
76461         DimensionLineResizeState.prototype.toggleMagnetism = function (magnetismToggled) {
76462             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
76463             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
76464         };
76465         /**
76466          *
76467          * @param {boolean} alignmentActivated
76468          */
76469         DimensionLineResizeState.prototype.setAlignmentActivated = function (alignmentActivated) {
76470             this.alignmentActivated = alignmentActivated;
76471             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
76472         };
76473         /**
76474          *
76475          */
76476         DimensionLineResizeState.prototype.escape = function () {
76477             if (this.reversedDimensionLine) {
76478                 PlanController.reverseDimensionLine(this.selectedDimensionLine);
76479                 this.editingStartPoint = !this.editingStartPoint;
76480             }
76481             PlanController.moveDimensionLinePoint(this.selectedDimensionLine, this.oldX, this.oldY, this.editingStartPoint);
76482             this.__parent.setState(this.__parent.getSelectionState());
76483         };
76484         /**
76485          *
76486          */
76487         DimensionLineResizeState.prototype.exit = function () {
76488             var planView = this.__parent.getView();
76489             planView.deleteFeedback();
76490             planView.setResizeIndicatorVisible(false);
76491             this.selectedDimensionLine = null;
76492         };
76493         return DimensionLineResizeState;
76494     }(PlanController.ControllerState));
76495     PlanController.DimensionLineResizeState = DimensionLineResizeState;
76496     DimensionLineResizeState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.DimensionLineResizeState";
76497     /**
76498      * Dimension line offset state. This state manages dimension line offset.
76499      * @extends PlanController.ControllerState
76500      * @class
76501      */
76502     var DimensionLineOffsetState = /** @class */ (function (_super) {
76503         __extends(DimensionLineOffsetState, _super);
76504         function DimensionLineOffsetState(__parent) {
76505             var _this = _super.call(this) || this;
76506             _this.__parent = __parent;
76507             if (_this.selectedDimensionLine === undefined) {
76508                 _this.selectedDimensionLine = null;
76509             }
76510             if (_this.oldOffset === undefined) {
76511                 _this.oldOffset = 0;
76512             }
76513             if (_this.deltaXToOffsetPoint === undefined) {
76514                 _this.deltaXToOffsetPoint = 0;
76515             }
76516             if (_this.deltaYToOffsetPoint === undefined) {
76517                 _this.deltaYToOffsetPoint = 0;
76518             }
76519             return _this;
76520         }
76521         /**
76522          *
76523          * @return {PlanController.Mode}
76524          */
76525         DimensionLineOffsetState.prototype.getMode = function () {
76526             return PlanController.Mode.SELECTION_$LI$();
76527         };
76528         /**
76529          *
76530          * @return {boolean}
76531          */
76532         DimensionLineOffsetState.prototype.isModificationState = function () {
76533             return true;
76534         };
76535         /**
76536          *
76537          * @return {boolean}
76538          */
76539         DimensionLineOffsetState.prototype.isBasePlanModificationState = function () {
76540             return true;
76541         };
76542         /**
76543          *
76544          */
76545         DimensionLineOffsetState.prototype.enter = function () {
76546             this.selectedDimensionLine = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
76547             this.oldOffset = this.selectedDimensionLine.getOffset();
76548             var angle = this.selectedDimensionLine.getYEnd() !== this.selectedDimensionLine.getYStart() || this.selectedDimensionLine.getXEnd() !== this.selectedDimensionLine.getXStart() ? Math.atan2(this.selectedDimensionLine.getYEnd() - this.selectedDimensionLine.getYStart(), this.selectedDimensionLine.getXEnd() - this.selectedDimensionLine.getXStart()) : this.selectedDimensionLine.getPitch();
76549             var dx = -Math.sin(angle) * this.oldOffset;
76550             var dy = Math.cos(angle) * this.oldOffset;
76551             var xMiddle = (this.selectedDimensionLine.getXStart() + this.selectedDimensionLine.getXEnd()) / 2 + dx;
76552             var yMiddle = (this.selectedDimensionLine.getYStart() + this.selectedDimensionLine.getYEnd()) / 2 + dy;
76553             this.deltaXToOffsetPoint = this.__parent.getXLastMousePress() - xMiddle;
76554             this.deltaYToOffsetPoint = this.__parent.getYLastMousePress() - yMiddle;
76555             var planView = this.__parent.getView();
76556             planView.setResizeIndicatorVisible(true);
76557         };
76558         /**
76559          *
76560          * @param {number} x
76561          * @param {number} y
76562          */
76563         DimensionLineOffsetState.prototype.moveMouse = function (x, y) {
76564             var newX = x - this.deltaXToOffsetPoint;
76565             var newY = y - this.deltaYToOffsetPoint;
76566             var distanceToDimensionLine;
76567             var relativeCCW;
76568             if (this.selectedDimensionLine.getYEnd() !== this.selectedDimensionLine.getYStart() || this.selectedDimensionLine.getXEnd() !== this.selectedDimensionLine.getXStart()) {
76569                 distanceToDimensionLine = java.awt.geom.Line2D.ptLineDist(this.selectedDimensionLine.getXStart(), this.selectedDimensionLine.getYStart(), this.selectedDimensionLine.getXEnd(), this.selectedDimensionLine.getYEnd(), newX, newY);
76570                 relativeCCW = java.awt.geom.Line2D.relativeCCW(this.selectedDimensionLine.getXStart(), this.selectedDimensionLine.getYStart(), this.selectedDimensionLine.getXEnd(), this.selectedDimensionLine.getYEnd(), newX, newY);
76571             }
76572             else {
76573                 distanceToDimensionLine = java.awt.geom.Point2D.distance(this.selectedDimensionLine.getXStart(), this.selectedDimensionLine.getYStart(), newX, newY);
76574                 relativeCCW = java.awt.geom.Line2D.relativeCCW(this.selectedDimensionLine.getXStart(), this.selectedDimensionLine.getYStart(), this.selectedDimensionLine.getXStart() + Math.cos(this.selectedDimensionLine.getPitch()), this.selectedDimensionLine.getYStart() + Math.sin(this.selectedDimensionLine.getPitch()), newX, newY);
76575             }
76576             var newOffset;
76577             newOffset = -(function (f) { if (f > 0) {
76578                 return 1;
76579             }
76580             else if (f < 0) {
76581                 return -1;
76582             }
76583             else {
76584                 return 0;
76585             } })(relativeCCW) * distanceToDimensionLine;
76586             this.selectedDimensionLine.setOffset(newOffset);
76587             this.__parent.getView().makePointVisible(x, y);
76588         };
76589         /**
76590          *
76591          * @param {number} x
76592          * @param {number} y
76593          */
76594         DimensionLineOffsetState.prototype.releaseMouse = function (x, y) {
76595             this.__parent.postDimensionLineOffset(this.selectedDimensionLine, this.oldOffset);
76596             this.__parent.setState(this.__parent.getSelectionState());
76597         };
76598         /**
76599          *
76600          */
76601         DimensionLineOffsetState.prototype.escape = function () {
76602             this.selectedDimensionLine.setOffset(this.oldOffset);
76603             this.__parent.setState(this.__parent.getSelectionState());
76604         };
76605         /**
76606          *
76607          */
76608         DimensionLineOffsetState.prototype.exit = function () {
76609             this.__parent.getView().setResizeIndicatorVisible(false);
76610             this.selectedDimensionLine = null;
76611         };
76612         return DimensionLineOffsetState;
76613     }(PlanController.ControllerState));
76614     PlanController.DimensionLineOffsetState = DimensionLineOffsetState;
76615     DimensionLineOffsetState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.DimensionLineOffsetState";
76616     /**
76617      * Dimension line rotation state. This states manages the pitch rotation modification
76618      * of an elevation dimension line.
76619      * @extends PlanController.ControllerState
76620      * @class
76621      */
76622     var DimensionLinePitchRotationState = /** @class */ (function (_super) {
76623         __extends(DimensionLinePitchRotationState, _super);
76624         function DimensionLinePitchRotationState(__parent) {
76625             var _this = _super.call(this) || this;
76626             _this.__parent = __parent;
76627             if (_this.selectedDimensionLine === undefined) {
76628                 _this.selectedDimensionLine = null;
76629             }
76630             if (_this.oldPitch === undefined) {
76631                 _this.oldPitch = 0;
76632             }
76633             if (_this.pitchMousePress === undefined) {
76634                 _this.pitchMousePress = 0;
76635             }
76636             if (_this.magnetismEnabled === undefined) {
76637                 _this.magnetismEnabled = false;
76638             }
76639             if (_this.alignmentActivated === undefined) {
76640                 _this.alignmentActivated = false;
76641             }
76642             return _this;
76643         }
76644         /**
76645          *
76646          * @return {PlanController.Mode}
76647          */
76648         DimensionLinePitchRotationState.prototype.getMode = function () {
76649             return PlanController.Mode.SELECTION_$LI$();
76650         };
76651         /**
76652          *
76653          * @return {boolean}
76654          */
76655         DimensionLinePitchRotationState.prototype.isModificationState = function () {
76656             return true;
76657         };
76658         /**
76659          *
76660          * @return {boolean}
76661          */
76662         DimensionLinePitchRotationState.prototype.isBasePlanModificationState = function () {
76663             return true;
76664         };
76665         /**
76666          *
76667          */
76668         DimensionLinePitchRotationState.prototype.enter = function () {
76669             this.selectedDimensionLine = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
76670             this.pitchMousePress = Math.atan2(this.selectedDimensionLine.getYStart() - this.__parent.getYLastMousePress(), this.__parent.getXLastMousePress() - this.selectedDimensionLine.getXStart());
76671             this.oldPitch = this.selectedDimensionLine.getPitch();
76672             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
76673             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (this.__parent.wasMagnetismToggledLastMousePress());
76674             this.__parent.getView().setResizeIndicatorVisible(true);
76675         };
76676         /**
76677          *
76678          * @param {number} x
76679          * @param {number} y
76680          */
76681         DimensionLinePitchRotationState.prototype.moveMouse = function (x, y) {
76682             if (x !== this.selectedDimensionLine.getXStart() || y !== this.selectedDimensionLine.getYStart()) {
76683                 var angleMouseMove = Math.atan2(this.selectedDimensionLine.getYStart() - y, x - this.selectedDimensionLine.getXStart());
76684                 var newPitch = ((this.oldPitch - angleMouseMove + this.pitchMousePress + 2 * Math.PI) % (2 * Math.PI));
76685                 if (this.alignmentActivated || this.magnetismEnabled) {
76686                     var angleStep = 2 * Math.PI / DimensionLinePitchRotationState.STEP_COUNT;
76687                     newPitch = Math.round(newPitch / angleStep) * angleStep;
76688                 }
76689                 this.selectedDimensionLine.setPitch(newPitch);
76690                 this.__parent.planView.makePointVisible(x, y);
76691             }
76692         };
76693         /**
76694          *
76695          * @param {number} x
76696          * @param {number} y
76697          */
76698         DimensionLinePitchRotationState.prototype.releaseMouse = function (x, y) {
76699             this.__parent.postDimensionLinePitchRotation(this.selectedDimensionLine, this.oldPitch);
76700             this.__parent.setState(this.__parent.getSelectionState());
76701         };
76702         /**
76703          *
76704          * @param {boolean} magnetismToggled
76705          */
76706         DimensionLinePitchRotationState.prototype.toggleMagnetism = function (magnetismToggled) {
76707             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
76708             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
76709         };
76710         /**
76711          *
76712          * @param {boolean} alignmentActivated
76713          */
76714         DimensionLinePitchRotationState.prototype.setAlignmentActivated = function (alignmentActivated) {
76715             this.alignmentActivated = alignmentActivated;
76716             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
76717         };
76718         /**
76719          *
76720          */
76721         DimensionLinePitchRotationState.prototype.escape = function () {
76722             this.selectedDimensionLine.setPitch(this.oldPitch);
76723             this.__parent.setState(this.__parent.getSelectionState());
76724         };
76725         /**
76726          *
76727          */
76728         DimensionLinePitchRotationState.prototype.exit = function () {
76729             this.__parent.getView().setResizeIndicatorVisible(false);
76730             this.selectedDimensionLine = null;
76731         };
76732         DimensionLinePitchRotationState.STEP_COUNT = 24;
76733         return DimensionLinePitchRotationState;
76734     }(PlanController.ControllerState));
76735     PlanController.DimensionLinePitchRotationState = DimensionLinePitchRotationState;
76736     DimensionLinePitchRotationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.DimensionLinePitchRotationState";
76737     /**
76738      * Dimension line height state. This states manages the height resizing of an elevation dimension line.
76739      * @extends PlanController.ControllerState
76740      * @class
76741      */
76742     var DimensionLineHeightState = /** @class */ (function (_super) {
76743         __extends(DimensionLineHeightState, _super);
76744         function DimensionLineHeightState(__parent) {
76745             var _this = _super.call(this) || this;
76746             _this.__parent = __parent;
76747             if (_this.selectedDimensionLine === undefined) {
76748                 _this.selectedDimensionLine = null;
76749             }
76750             if (_this.oldHeight === undefined) {
76751                 _this.oldHeight = 0;
76752             }
76753             if (_this.magnetismEnabled === undefined) {
76754                 _this.magnetismEnabled = false;
76755             }
76756             return _this;
76757         }
76758         /**
76759          *
76760          * @return {PlanController.Mode}
76761          */
76762         DimensionLineHeightState.prototype.getMode = function () {
76763             return PlanController.Mode.SELECTION_$LI$();
76764         };
76765         /**
76766          *
76767          * @return {boolean}
76768          */
76769         DimensionLineHeightState.prototype.isModificationState = function () {
76770             return true;
76771         };
76772         /**
76773          *
76774          * @return {boolean}
76775          */
76776         DimensionLineHeightState.prototype.isBasePlanModificationState = function () {
76777             return true;
76778         };
76779         /**
76780          *
76781          */
76782         DimensionLineHeightState.prototype.enter = function () {
76783             this.selectedDimensionLine = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
76784             this.oldHeight = this.selectedDimensionLine.getElevationEnd() - this.selectedDimensionLine.getElevationStart();
76785             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (this.__parent.wasMagnetismToggledLastMousePress());
76786             var planView = this.__parent.getView();
76787             planView.setResizeIndicatorVisible(true);
76788         };
76789         /**
76790          *
76791          * @param {number} x
76792          * @param {number} y
76793          */
76794         DimensionLineHeightState.prototype.moveMouse = function (x, y) {
76795             var deltaY = y - this.__parent.getYLastMousePress();
76796             var newHeight = Math.max(this.oldHeight - deltaY, 0.0);
76797             if (this.magnetismEnabled) {
76798                 newHeight = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMagnetizedLength(newHeight, this.__parent.planView.getPixelLength());
76799             }
76800             newHeight = Math.min(Math.max(newHeight, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMinimumLength()), this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMaximumLength());
76801             this.selectedDimensionLine.setElevationEnd(this.selectedDimensionLine.getElevationStart() + newHeight);
76802             this.__parent.getView().makePointVisible(x, y);
76803         };
76804         /**
76805          *
76806          * @param {number} x
76807          * @param {number} y
76808          */
76809         DimensionLineHeightState.prototype.releaseMouse = function (x, y) {
76810             this.__parent.postDimensionLineHeight(this.selectedDimensionLine, this.oldHeight);
76811             this.__parent.setState(this.__parent.getSelectionState());
76812         };
76813         /**
76814          *
76815          * @param {boolean} magnetismToggled
76816          */
76817         DimensionLineHeightState.prototype.toggleMagnetism = function (magnetismToggled) {
76818             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
76819             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
76820         };
76821         /**
76822          *
76823          */
76824         DimensionLineHeightState.prototype.escape = function () {
76825             this.selectedDimensionLine.setElevationEnd(this.selectedDimensionLine.getElevationStart() + this.oldHeight);
76826             this.__parent.setState(this.__parent.getSelectionState());
76827         };
76828         /**
76829          *
76830          */
76831         DimensionLineHeightState.prototype.exit = function () {
76832             this.__parent.getView().setResizeIndicatorVisible(false);
76833             this.selectedDimensionLine = null;
76834         };
76835         return DimensionLineHeightState;
76836     }(PlanController.ControllerState));
76837     PlanController.DimensionLineHeightState = DimensionLineHeightState;
76838     DimensionLineHeightState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.DimensionLineHeightState";
76839     /**
76840      * Dimension line elevation state. This states manages the elevation modification
76841      * of an elevation dimension line.
76842      * @extends PlanController.ControllerState
76843      * @class
76844      */
76845     var DimensionLineElevationState = /** @class */ (function (_super) {
76846         __extends(DimensionLineElevationState, _super);
76847         function DimensionLineElevationState(__parent) {
76848             var _this = _super.call(this) || this;
76849             _this.__parent = __parent;
76850             if (_this.selectedDimensionLine === undefined) {
76851                 _this.selectedDimensionLine = null;
76852             }
76853             if (_this.elevationToolTipFeedback === undefined) {
76854                 _this.elevationToolTipFeedback = null;
76855             }
76856             if (_this.oldElevation === undefined) {
76857                 _this.oldElevation = 0;
76858             }
76859             if (_this.magnetismEnabled === undefined) {
76860                 _this.magnetismEnabled = false;
76861             }
76862             return _this;
76863         }
76864         /**
76865          *
76866          * @return {PlanController.Mode}
76867          */
76868         DimensionLineElevationState.prototype.getMode = function () {
76869             return PlanController.Mode.SELECTION_$LI$();
76870         };
76871         /**
76872          *
76873          * @return {boolean}
76874          */
76875         DimensionLineElevationState.prototype.isModificationState = function () {
76876             return true;
76877         };
76878         /**
76879          *
76880          * @return {boolean}
76881          */
76882         DimensionLineElevationState.prototype.isBasePlanModificationState = function () {
76883             return true;
76884         };
76885         /**
76886          *
76887          */
76888         DimensionLineElevationState.prototype.enter = function () {
76889             this.selectedDimensionLine = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
76890             this.elevationToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "elevationToolTipFeedback");
76891             this.oldElevation = this.selectedDimensionLine.getElevationStart();
76892             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (this.__parent.wasMagnetismToggledLastMousePress());
76893             var planView = this.__parent.getView();
76894             planView.setResizeIndicatorVisible(true);
76895             if (this.__parent.feedbackDisplayed) {
76896                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.oldElevation), this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
76897             }
76898         };
76899         /**
76900          *
76901          * @param {number} x
76902          * @param {number} y
76903          */
76904         DimensionLineElevationState.prototype.moveMouse = function (x, y) {
76905             var planView = this.__parent.getView();
76906             var deltaY = y - this.__parent.getYLastMousePress();
76907             var newElevation = Math.max(this.oldElevation - deltaY, 0.0);
76908             if (this.magnetismEnabled) {
76909                 newElevation = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMagnetizedLength(newElevation, planView.getPixelLength());
76910             }
76911             newElevation = Math.min(newElevation, this.selectedDimensionLine.getElevationEnd() - this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMinimumLength());
76912             this.selectedDimensionLine.setElevationStart(newElevation);
76913             planView.makePointVisible(x, y);
76914             if (this.__parent.feedbackDisplayed) {
76915                 planView.setToolTipFeedback(this.getToolTipFeedbackText(newElevation), x, y);
76916             }
76917         };
76918         /**
76919          *
76920          * @param {number} x
76921          * @param {number} y
76922          */
76923         DimensionLineElevationState.prototype.releaseMouse = function (x, y) {
76924             this.__parent.postDimensionLineElevation(this.selectedDimensionLine, this.oldElevation);
76925             this.__parent.setState(this.__parent.getSelectionState());
76926         };
76927         /**
76928          *
76929          * @param {boolean} magnetismToggled
76930          */
76931         DimensionLineElevationState.prototype.toggleMagnetism = function (magnetismToggled) {
76932             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
76933             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
76934         };
76935         /**
76936          *
76937          */
76938         DimensionLineElevationState.prototype.escape = function () {
76939             this.selectedDimensionLine.setElevationStart(this.oldElevation);
76940             this.__parent.setState(this.__parent.getSelectionState());
76941         };
76942         /**
76943          *
76944          */
76945         DimensionLineElevationState.prototype.exit = function () {
76946             var planView = this.__parent.getView();
76947             planView.setResizeIndicatorVisible(false);
76948             planView.deleteFeedback();
76949             this.selectedDimensionLine = null;
76950         };
76951         DimensionLineElevationState.prototype.getToolTipFeedbackText = function (height) {
76952             return CoreTools.format(this.elevationToolTipFeedback, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getFormatWithUnit().format(height));
76953         };
76954         return DimensionLineElevationState;
76955     }(PlanController.ControllerState));
76956     PlanController.DimensionLineElevationState = DimensionLineElevationState;
76957     DimensionLineElevationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.DimensionLineElevationState";
76958     /**
76959      * Room modification state.
76960      * @extends PlanController.ControllerState
76961      * @class
76962      */
76963     var AbstractRoomState = /** @class */ (function (_super) {
76964         __extends(AbstractRoomState, _super);
76965         function AbstractRoomState(__parent) {
76966             var _this = _super.call(this) || this;
76967             _this.__parent = __parent;
76968             if (_this.roomSideLengthToolTipFeedback === undefined) {
76969                 _this.roomSideLengthToolTipFeedback = null;
76970             }
76971             if (_this.roomDiagonalLengthToolTipFeedback === undefined) {
76972                 _this.roomDiagonalLengthToolTipFeedback = null;
76973             }
76974             if (_this.roomSideAngleToolTipFeedback === undefined) {
76975                 _this.roomSideAngleToolTipFeedback = null;
76976             }
76977             return _this;
76978         }
76979         /**
76980          *
76981          */
76982         AbstractRoomState.prototype.enter = function () {
76983             this.roomSideLengthToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "roomSideLengthToolTipFeedback");
76984             try {
76985                 this.roomDiagonalLengthToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "roomDiagonalLengthToolTipFeedback");
76986             }
76987             catch (ex) {
76988             }
76989             try {
76990                 this.roomSideAngleToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "roomSideAngleToolTipFeedback");
76991             }
76992             catch (ex) {
76993             }
76994         };
76995         AbstractRoomState.prototype.getToolTipFeedbackText = function (room, pointIndex) {
76996             var length = this.getRoomSideLength(room, pointIndex);
76997             var angle = this.getRoomSideAngle(room, pointIndex);
76998             var toolTipFeedbackText = "<html>" + CoreTools.format(this.roomSideLengthToolTipFeedback, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getFormatWithUnit().format(length));
76999             if (this.roomDiagonalLengthToolTipFeedback != null && this.roomDiagonalLengthToolTipFeedback.length > 0 && room.getPointCount() > 2) {
77000                 var diagonalLength = this.getRoomDiagonalLength(room, pointIndex);
77001                 toolTipFeedbackText += "<br>" + CoreTools.format(this.roomDiagonalLengthToolTipFeedback, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getFormatWithUnit().format(diagonalLength));
77002             }
77003             if (this.roomSideAngleToolTipFeedback != null && this.roomSideAngleToolTipFeedback.length > 0) {
77004                 toolTipFeedbackText += "<br>" + CoreTools.format(this.roomSideAngleToolTipFeedback, angle);
77005             }
77006             return toolTipFeedbackText;
77007         };
77008         AbstractRoomState.prototype.getRoomSideLength = function (room, pointIndex) {
77009             var points = room.getPoints();
77010             var previousPoint = points[(pointIndex + points.length - 1) % points.length];
77011             return java.awt.geom.Point2D.distance(previousPoint[0], previousPoint[1], points[pointIndex][0], points[pointIndex][1]);
77012         };
77013         AbstractRoomState.prototype.getRoomDiagonalLength = function (room, pointIndex) {
77014             var points = room.getPoints();
77015             if (points.length > 2) {
77016                 var previousPreviousPoint = points[(pointIndex + points.length - 2) % points.length];
77017                 return java.awt.geom.Point2D.distance(points[pointIndex][0], points[pointIndex][1], previousPreviousPoint[0], previousPreviousPoint[1]);
77018             }
77019             else {
77020                 throw new IllegalArgumentException("Room doesn\'t have at least 3 points");
77021             }
77022         };
77023         AbstractRoomState.prototype.getTriangulationDimensionLines = function (room, pointIndex) {
77024             var points = room.getPoints();
77025             var previousPoint = points[(pointIndex + points.length - 1) % points.length];
77026             var dimensionLines = ([]);
77027             var offset = 20 / this.__parent.getView().getScale();
77028             if (!(function (a1, a2) { if (a1 == null && a2 == null)
77029                 return true; if (a1 == null || a2 == null)
77030                 return false; if (a1.length != a2.length)
77031                 return false; for (var i = 0; i < a1.length; i++) {
77032                 if (a1[i] != a2[i])
77033                     return false;
77034             } return true; })(points[pointIndex], previousPoint)) {
77035                 /* add */ (dimensionLines.push(this.__parent.getDimensionLineBetweenPoints(previousPoint, points[pointIndex], this.isDimensionInsideRoom(room, previousPoint, points[pointIndex]) ? -offset : offset, false)) > 0);
77036             }
77037             if (points.length > 2) {
77038                 var nextPoint = points[pointIndex + 1 < points.length ? pointIndex + 1 : 0];
77039                 if (!(function (a1, a2) { if (a1 == null && a2 == null)
77040                     return true; if (a1 == null || a2 == null)
77041                     return false; if (a1.length != a2.length)
77042                     return false; for (var i = 0; i < a1.length; i++) {
77043                     if (a1[i] != a2[i])
77044                         return false;
77045                 } return true; })(points[pointIndex], nextPoint)) {
77046                     /* add */ (dimensionLines.push(this.__parent.getDimensionLineBetweenPoints(points[pointIndex], nextPoint, this.isDimensionInsideRoom(room, points[pointIndex], nextPoint) ? -offset : offset, false)) > 0);
77047                 }
77048                 var previousPreviousPoint = points[(pointIndex + points.length - 2) % points.length];
77049                 if (points.length === 3) {
77050                     /* add */ (dimensionLines.push(this.__parent.getDimensionLineBetweenPoints(previousPoint, previousPreviousPoint, this.isDimensionInsideRoom(room, previousPoint, previousPreviousPoint) ? -offset : offset, false)) > 0);
77051                 }
77052                 else if (!(function (a1, a2) { if (a1 == null && a2 == null)
77053                     return true; if (a1 == null || a2 == null)
77054                     return false; if (a1.length != a2.length)
77055                     return false; for (var i = 0; i < a1.length; i++) {
77056                     if (a1[i] != a2[i])
77057                         return false;
77058                 } return true; })(points[pointIndex], previousPreviousPoint)) {
77059                     /* add */ (dimensionLines.push(this.__parent.getDimensionLineBetweenPoints(points[pointIndex], previousPreviousPoint, 0, false)) > 0);
77060                 }
77061             }
77062             return dimensionLines;
77063         };
77064         AbstractRoomState.prototype.isDimensionInsideRoom = function (room, point1, point2) {
77065             var rotation = java.awt.geom.AffineTransform.getRotateInstance(Math.atan2(point2[1] - point1[1], point2[0] - point1[0]), point1[0], point1[1]);
77066             var dimensionPoint = [(point1[0] + java.awt.geom.Point2D.distance(point1[0], point1[1], point2[0], point2[1]) / 2), point1[1] + 1.0];
77067             rotation.transform(dimensionPoint, 0, dimensionPoint, 0, 1);
77068             return room.containsPoint(dimensionPoint[0], dimensionPoint[1], 0);
77069         };
77070         /**
77071          * Returns room side angle at the given point index in degrees.
77072          * @param {Room} room
77073          * @param {number} pointIndex
77074          * @return {number}
77075          */
77076         AbstractRoomState.prototype.getRoomSideAngle = function (room, pointIndex) {
77077             var points = room.getPoints();
77078             var point = points[pointIndex];
77079             var previousPoint = points[(pointIndex + points.length - 1) % points.length];
77080             var previousPreviousPoint = points[(pointIndex + points.length - 2) % points.length];
77081             var sideLength = java.awt.geom.Point2D.distance(previousPoint[0], previousPoint[1], points[pointIndex][0], points[pointIndex][1]);
77082             var previousSideLength = java.awt.geom.Point2D.distance(previousPreviousPoint[0], previousPreviousPoint[1], previousPoint[0], previousPoint[1]);
77083             if (previousPreviousPoint !== point && sideLength !== 0 && previousSideLength !== 0) {
77084                 var xSideVector = (point[0] - previousPoint[0]) / sideLength;
77085                 var ySideVector = (point[1] - previousPoint[1]) / sideLength;
77086                 var xPreviousSideVector = (previousPoint[0] - previousPreviousPoint[0]) / previousSideLength;
77087                 var yPreviousSideVector = (previousPoint[1] - previousPreviousPoint[1]) / previousSideLength;
77088                 var sideAngle = (Math.round(180 - /* toDegrees */ (function (x) { return x * 180 / Math.PI; })(Math.atan2(ySideVector * xPreviousSideVector - xSideVector * yPreviousSideVector, xSideVector * xPreviousSideVector + ySideVector * yPreviousSideVector))) | 0);
77089                 if (sideAngle > 180) {
77090                     sideAngle -= 360;
77091                 }
77092                 return sideAngle;
77093             }
77094             if (sideLength === 0) {
77095                 return 0;
77096             }
77097             else {
77098                 return (Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(Math.atan2(previousPoint[1] - point[1], point[0] - previousPoint[0]))) | 0);
77099             }
77100         };
77101         AbstractRoomState.prototype.showRoomAngleFeedback = function (room, pointIndex) {
77102             var points = room.getPoints();
77103             if (this.roomSideAngleToolTipFeedback != null && this.roomSideAngleToolTipFeedback.length > 0 && points.length > 2) {
77104                 var previousPoint = points[(pointIndex + points.length - 1) % points.length];
77105                 var previousPreviousPoint = points[(pointIndex + points.length - 2) % points.length];
77106                 if (this.getRoomSideAngle(room, pointIndex) > 0) {
77107                     this.__parent.getView().setAngleFeedback(previousPoint[0], previousPoint[1], previousPreviousPoint[0], previousPreviousPoint[1], points[pointIndex][0], points[pointIndex][1]);
77108                 }
77109                 else {
77110                     this.__parent.getView().setAngleFeedback(previousPoint[0], previousPoint[1], points[pointIndex][0], points[pointIndex][1], previousPreviousPoint[0], previousPreviousPoint[1]);
77111                 }
77112             }
77113         };
77114         return AbstractRoomState;
77115     }(PlanController.ControllerState));
77116     PlanController.AbstractRoomState = AbstractRoomState;
77117     AbstractRoomState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.AbstractRoomState";
77118     /**
77119      * Room name offset state. This state manages room name offset.
77120      * @extends PlanController.ControllerState
77121      * @class
77122      */
77123     var RoomNameOffsetState = /** @class */ (function (_super) {
77124         __extends(RoomNameOffsetState, _super);
77125         function RoomNameOffsetState(__parent) {
77126             var _this = _super.call(this) || this;
77127             _this.__parent = __parent;
77128             if (_this.selectedRoom === undefined) {
77129                 _this.selectedRoom = null;
77130             }
77131             if (_this.oldNameXOffset === undefined) {
77132                 _this.oldNameXOffset = 0;
77133             }
77134             if (_this.oldNameYOffset === undefined) {
77135                 _this.oldNameYOffset = 0;
77136             }
77137             if (_this.xLastMouseMove === undefined) {
77138                 _this.xLastMouseMove = 0;
77139             }
77140             if (_this.yLastMouseMove === undefined) {
77141                 _this.yLastMouseMove = 0;
77142             }
77143             if (_this.alignmentActivated === undefined) {
77144                 _this.alignmentActivated = false;
77145             }
77146             return _this;
77147         }
77148         /**
77149          *
77150          * @return {PlanController.Mode}
77151          */
77152         RoomNameOffsetState.prototype.getMode = function () {
77153             return PlanController.Mode.SELECTION_$LI$();
77154         };
77155         /**
77156          *
77157          * @return {boolean}
77158          */
77159         RoomNameOffsetState.prototype.isModificationState = function () {
77160             return true;
77161         };
77162         /**
77163          *
77164          */
77165         RoomNameOffsetState.prototype.enter = function () {
77166             this.selectedRoom = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
77167             this.oldNameXOffset = this.selectedRoom.getNameXOffset();
77168             this.oldNameYOffset = this.selectedRoom.getNameYOffset();
77169             this.xLastMouseMove = this.__parent.getXLastMousePress();
77170             this.yLastMouseMove = this.__parent.getYLastMousePress();
77171             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
77172             var planView = this.__parent.getView();
77173             planView.setResizeIndicatorVisible(true);
77174         };
77175         /**
77176          *
77177          * @param {number} x
77178          * @param {number} y
77179          */
77180         RoomNameOffsetState.prototype.moveMouse = function (x, y) {
77181             if (this.alignmentActivated) {
77182                 var alignedPoint = new PlanController.PointWithAngleMagnetism(this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress(), x, y, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit(), this.__parent.getView().getPixelLength(), 4);
77183                 x = alignedPoint.getX();
77184                 y = alignedPoint.getY();
77185             }
77186             this.selectedRoom.setNameXOffset(this.selectedRoom.getNameXOffset() + x - this.xLastMouseMove);
77187             this.selectedRoom.setNameYOffset(this.selectedRoom.getNameYOffset() + y - this.yLastMouseMove);
77188             this.xLastMouseMove = x;
77189             this.yLastMouseMove = y;
77190             this.__parent.getView().makePointVisible(x, y);
77191         };
77192         /**
77193          *
77194          * @param {number} x
77195          * @param {number} y
77196          */
77197         RoomNameOffsetState.prototype.releaseMouse = function (x, y) {
77198             this.__parent.postRoomNameOffset(this.selectedRoom, this.oldNameXOffset, this.oldNameYOffset);
77199             this.__parent.setState(this.__parent.getSelectionState());
77200         };
77201         /**
77202          *
77203          * @param {boolean} alignmentActivated
77204          */
77205         RoomNameOffsetState.prototype.setAlignmentActivated = function (alignmentActivated) {
77206             this.alignmentActivated = alignmentActivated;
77207             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
77208         };
77209         /**
77210          *
77211          */
77212         RoomNameOffsetState.prototype.escape = function () {
77213             this.selectedRoom.setNameXOffset(this.oldNameXOffset);
77214             this.selectedRoom.setNameYOffset(this.oldNameYOffset);
77215             this.__parent.setState(this.__parent.getSelectionState());
77216         };
77217         /**
77218          *
77219          */
77220         RoomNameOffsetState.prototype.exit = function () {
77221             this.__parent.getView().setResizeIndicatorVisible(false);
77222             this.selectedRoom = null;
77223         };
77224         return RoomNameOffsetState;
77225     }(PlanController.ControllerState));
77226     PlanController.RoomNameOffsetState = RoomNameOffsetState;
77227     RoomNameOffsetState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RoomNameOffsetState";
77228     /**
77229      * Room name rotation state. This state manages the name rotation of a room.
77230      * @extends PlanController.ControllerState
77231      * @class
77232      */
77233     var RoomNameRotationState = /** @class */ (function (_super) {
77234         __extends(RoomNameRotationState, _super);
77235         function RoomNameRotationState(__parent) {
77236             var _this = _super.call(this) || this;
77237             _this.__parent = __parent;
77238             if (_this.selectedRoom === undefined) {
77239                 _this.selectedRoom = null;
77240             }
77241             if (_this.oldNameAngle === undefined) {
77242                 _this.oldNameAngle = 0;
77243             }
77244             if (_this.angleMousePress === undefined) {
77245                 _this.angleMousePress = 0;
77246             }
77247             if (_this.magnetismEnabled === undefined) {
77248                 _this.magnetismEnabled = false;
77249             }
77250             if (_this.alignmentActivated === undefined) {
77251                 _this.alignmentActivated = false;
77252             }
77253             return _this;
77254         }
77255         /**
77256          *
77257          * @return {PlanController.Mode}
77258          */
77259         RoomNameRotationState.prototype.getMode = function () {
77260             return PlanController.Mode.SELECTION_$LI$();
77261         };
77262         /**
77263          *
77264          * @return {boolean}
77265          */
77266         RoomNameRotationState.prototype.isModificationState = function () {
77267             return true;
77268         };
77269         /**
77270          *
77271          */
77272         RoomNameRotationState.prototype.enter = function () {
77273             this.selectedRoom = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
77274             this.angleMousePress = Math.atan2(this.selectedRoom.getYCenter() + this.selectedRoom.getNameYOffset() - this.__parent.getYLastMousePress(), this.__parent.getXLastMousePress() - this.selectedRoom.getXCenter() - this.selectedRoom.getNameXOffset());
77275             this.oldNameAngle = this.selectedRoom.getNameAngle();
77276             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
77277             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (this.__parent.wasMagnetismToggledLastMousePress());
77278             var planView = this.__parent.getView();
77279             planView.setResizeIndicatorVisible(true);
77280         };
77281         /**
77282          *
77283          * @param {number} x
77284          * @param {number} y
77285          */
77286         RoomNameRotationState.prototype.moveMouse = function (x, y) {
77287             if (x !== this.selectedRoom.getXCenter() + this.selectedRoom.getNameXOffset() || y !== this.selectedRoom.getYCenter() + this.selectedRoom.getNameYOffset()) {
77288                 var angleMouseMove = Math.atan2(this.selectedRoom.getYCenter() + this.selectedRoom.getNameYOffset() - y, x - this.selectedRoom.getXCenter() - this.selectedRoom.getNameXOffset());
77289                 var newAngle = this.oldNameAngle - angleMouseMove + this.angleMousePress;
77290                 if (this.alignmentActivated || this.magnetismEnabled) {
77291                     var angleStep = 2 * Math.PI / RoomNameRotationState.STEP_COUNT;
77292                     newAngle = Math.round(newAngle / angleStep) * angleStep;
77293                 }
77294                 this.selectedRoom.setNameAngle(newAngle);
77295                 this.__parent.getView().makePointVisible(x, y);
77296             }
77297         };
77298         /**
77299          *
77300          * @param {number} x
77301          * @param {number} y
77302          */
77303         RoomNameRotationState.prototype.releaseMouse = function (x, y) {
77304             this.__parent.postRoomNameRotation(this.selectedRoom, this.oldNameAngle);
77305             this.__parent.setState(this.__parent.getSelectionState());
77306         };
77307         /**
77308          *
77309          * @param {boolean} magnetismToggled
77310          */
77311         RoomNameRotationState.prototype.toggleMagnetism = function (magnetismToggled) {
77312             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
77313             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
77314         };
77315         /**
77316          *
77317          * @param {boolean} alignmentActivated
77318          */
77319         RoomNameRotationState.prototype.setAlignmentActivated = function (alignmentActivated) {
77320             this.alignmentActivated = alignmentActivated;
77321             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
77322         };
77323         /**
77324          *
77325          */
77326         RoomNameRotationState.prototype.escape = function () {
77327             this.selectedRoom.setNameAngle(this.oldNameAngle);
77328             this.__parent.setState(this.__parent.getSelectionState());
77329         };
77330         /**
77331          *
77332          */
77333         RoomNameRotationState.prototype.exit = function () {
77334             this.__parent.getView().setResizeIndicatorVisible(false);
77335             this.selectedRoom = null;
77336         };
77337         RoomNameRotationState.STEP_COUNT = 24;
77338         return RoomNameRotationState;
77339     }(PlanController.ControllerState));
77340     PlanController.RoomNameRotationState = RoomNameRotationState;
77341     RoomNameRotationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RoomNameRotationState";
77342     /**
77343      * Room area offset state. This state manages room area offset.
77344      * @extends PlanController.ControllerState
77345      * @class
77346      */
77347     var RoomAreaOffsetState = /** @class */ (function (_super) {
77348         __extends(RoomAreaOffsetState, _super);
77349         function RoomAreaOffsetState(__parent) {
77350             var _this = _super.call(this) || this;
77351             _this.__parent = __parent;
77352             if (_this.selectedRoom === undefined) {
77353                 _this.selectedRoom = null;
77354             }
77355             if (_this.oldAreaXOffset === undefined) {
77356                 _this.oldAreaXOffset = 0;
77357             }
77358             if (_this.oldAreaYOffset === undefined) {
77359                 _this.oldAreaYOffset = 0;
77360             }
77361             if (_this.xLastMouseMove === undefined) {
77362                 _this.xLastMouseMove = 0;
77363             }
77364             if (_this.yLastMouseMove === undefined) {
77365                 _this.yLastMouseMove = 0;
77366             }
77367             if (_this.alignmentActivated === undefined) {
77368                 _this.alignmentActivated = false;
77369             }
77370             return _this;
77371         }
77372         /**
77373          *
77374          * @return {PlanController.Mode}
77375          */
77376         RoomAreaOffsetState.prototype.getMode = function () {
77377             return PlanController.Mode.SELECTION_$LI$();
77378         };
77379         /**
77380          *
77381          * @return {boolean}
77382          */
77383         RoomAreaOffsetState.prototype.isModificationState = function () {
77384             return true;
77385         };
77386         /**
77387          *
77388          */
77389         RoomAreaOffsetState.prototype.enter = function () {
77390             this.selectedRoom = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
77391             this.oldAreaXOffset = this.selectedRoom.getAreaXOffset();
77392             this.oldAreaYOffset = this.selectedRoom.getAreaYOffset();
77393             this.xLastMouseMove = this.__parent.getXLastMousePress();
77394             this.yLastMouseMove = this.__parent.getYLastMousePress();
77395             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
77396             var planView = this.__parent.getView();
77397             planView.setResizeIndicatorVisible(true);
77398         };
77399         /**
77400          *
77401          * @param {number} x
77402          * @param {number} y
77403          */
77404         RoomAreaOffsetState.prototype.moveMouse = function (x, y) {
77405             if (this.alignmentActivated) {
77406                 var alignedPoint = new PlanController.PointWithAngleMagnetism(this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress(), x, y, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit(), this.__parent.getView().getPixelLength(), 4);
77407                 x = alignedPoint.getX();
77408                 y = alignedPoint.getY();
77409             }
77410             this.selectedRoom.setAreaXOffset(this.selectedRoom.getAreaXOffset() + x - this.xLastMouseMove);
77411             this.selectedRoom.setAreaYOffset(this.selectedRoom.getAreaYOffset() + y - this.yLastMouseMove);
77412             this.xLastMouseMove = x;
77413             this.yLastMouseMove = y;
77414             this.__parent.getView().makePointVisible(x, y);
77415         };
77416         /**
77417          *
77418          * @param {number} x
77419          * @param {number} y
77420          */
77421         RoomAreaOffsetState.prototype.releaseMouse = function (x, y) {
77422             this.__parent.postRoomAreaOffset(this.selectedRoom, this.oldAreaXOffset, this.oldAreaYOffset);
77423             this.__parent.setState(this.__parent.getSelectionState());
77424         };
77425         /**
77426          *
77427          * @param {boolean} alignmentActivated
77428          */
77429         RoomAreaOffsetState.prototype.setAlignmentActivated = function (alignmentActivated) {
77430             this.alignmentActivated = alignmentActivated;
77431             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
77432         };
77433         /**
77434          *
77435          */
77436         RoomAreaOffsetState.prototype.escape = function () {
77437             this.selectedRoom.setAreaXOffset(this.oldAreaXOffset);
77438             this.selectedRoom.setAreaYOffset(this.oldAreaYOffset);
77439             this.__parent.setState(this.__parent.getSelectionState());
77440         };
77441         /**
77442          *
77443          */
77444         RoomAreaOffsetState.prototype.exit = function () {
77445             this.__parent.getView().setResizeIndicatorVisible(false);
77446             this.selectedRoom = null;
77447         };
77448         return RoomAreaOffsetState;
77449     }(PlanController.ControllerState));
77450     PlanController.RoomAreaOffsetState = RoomAreaOffsetState;
77451     RoomAreaOffsetState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RoomAreaOffsetState";
77452     /**
77453      * Room area rotation state. This state manages the area rotation of a room.
77454      * @extends PlanController.ControllerState
77455      * @class
77456      */
77457     var RoomAreaRotationState = /** @class */ (function (_super) {
77458         __extends(RoomAreaRotationState, _super);
77459         function RoomAreaRotationState(__parent) {
77460             var _this = _super.call(this) || this;
77461             _this.__parent = __parent;
77462             if (_this.selectedRoom === undefined) {
77463                 _this.selectedRoom = null;
77464             }
77465             if (_this.oldAreaAngle === undefined) {
77466                 _this.oldAreaAngle = 0;
77467             }
77468             if (_this.angleMousePress === undefined) {
77469                 _this.angleMousePress = 0;
77470             }
77471             if (_this.magnetismEnabled === undefined) {
77472                 _this.magnetismEnabled = false;
77473             }
77474             if (_this.alignmentActivated === undefined) {
77475                 _this.alignmentActivated = false;
77476             }
77477             return _this;
77478         }
77479         /**
77480          *
77481          * @return {PlanController.Mode}
77482          */
77483         RoomAreaRotationState.prototype.getMode = function () {
77484             return PlanController.Mode.SELECTION_$LI$();
77485         };
77486         /**
77487          *
77488          * @return {boolean}
77489          */
77490         RoomAreaRotationState.prototype.isModificationState = function () {
77491             return true;
77492         };
77493         /**
77494          *
77495          */
77496         RoomAreaRotationState.prototype.enter = function () {
77497             this.selectedRoom = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
77498             this.angleMousePress = Math.atan2(this.selectedRoom.getYCenter() + this.selectedRoom.getAreaYOffset() - this.__parent.getYLastMousePress(), this.__parent.getXLastMousePress() - this.selectedRoom.getXCenter() - this.selectedRoom.getAreaXOffset());
77499             this.oldAreaAngle = this.selectedRoom.getAreaAngle();
77500             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
77501             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (this.__parent.wasMagnetismToggledLastMousePress());
77502             var planView = this.__parent.getView();
77503             planView.setResizeIndicatorVisible(true);
77504         };
77505         /**
77506          *
77507          * @param {number} x
77508          * @param {number} y
77509          */
77510         RoomAreaRotationState.prototype.moveMouse = function (x, y) {
77511             if (x !== this.selectedRoom.getXCenter() + this.selectedRoom.getAreaXOffset() || y !== this.selectedRoom.getYCenter() + this.selectedRoom.getAreaYOffset()) {
77512                 var angleMouseMove = Math.atan2(this.selectedRoom.getYCenter() + this.selectedRoom.getAreaYOffset() - y, x - this.selectedRoom.getXCenter() - this.selectedRoom.getAreaXOffset());
77513                 var newAngle = this.oldAreaAngle - angleMouseMove + this.angleMousePress;
77514                 if (this.alignmentActivated || this.magnetismEnabled) {
77515                     var angleStep = 2 * Math.PI / RoomAreaRotationState.STEP_COUNT;
77516                     newAngle = Math.round(newAngle / angleStep) * angleStep;
77517                 }
77518                 this.selectedRoom.setAreaAngle(newAngle);
77519                 this.__parent.getView().makePointVisible(x, y);
77520             }
77521         };
77522         /**
77523          *
77524          * @param {number} x
77525          * @param {number} y
77526          */
77527         RoomAreaRotationState.prototype.releaseMouse = function (x, y) {
77528             this.__parent.postRoomAreaRotation(this.selectedRoom, this.oldAreaAngle);
77529             this.__parent.setState(this.__parent.getSelectionState());
77530         };
77531         /**
77532          *
77533          * @param {boolean} magnetismToggled
77534          */
77535         RoomAreaRotationState.prototype.toggleMagnetism = function (magnetismToggled) {
77536             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
77537             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
77538         };
77539         /**
77540          *
77541          * @param {boolean} alignmentActivated
77542          */
77543         RoomAreaRotationState.prototype.setAlignmentActivated = function (alignmentActivated) {
77544             this.alignmentActivated = alignmentActivated;
77545             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
77546         };
77547         /**
77548          *
77549          */
77550         RoomAreaRotationState.prototype.escape = function () {
77551             this.selectedRoom.setAreaAngle(this.oldAreaAngle);
77552             this.__parent.setState(this.__parent.getSelectionState());
77553         };
77554         /**
77555          *
77556          */
77557         RoomAreaRotationState.prototype.exit = function () {
77558             this.__parent.getView().setResizeIndicatorVisible(false);
77559             this.selectedRoom = null;
77560         };
77561         RoomAreaRotationState.STEP_COUNT = 24;
77562         return RoomAreaRotationState;
77563     }(PlanController.ControllerState));
77564     PlanController.RoomAreaRotationState = RoomAreaRotationState;
77565     RoomAreaRotationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RoomAreaRotationState";
77566     /**
77567      * Polyline modification state.
77568      * @extends PlanController.ControllerState
77569      * @class
77570      */
77571     var AbstractPolylineState = /** @class */ (function (_super) {
77572         __extends(AbstractPolylineState, _super);
77573         function AbstractPolylineState(__parent) {
77574             var _this = _super.call(this) || this;
77575             _this.__parent = __parent;
77576             if (_this.polylineSegmentLengthToolTipFeedback === undefined) {
77577                 _this.polylineSegmentLengthToolTipFeedback = null;
77578             }
77579             if (_this.polylineSegmentAngleToolTipFeedback === undefined) {
77580                 _this.polylineSegmentAngleToolTipFeedback = null;
77581             }
77582             return _this;
77583         }
77584         /**
77585          *
77586          */
77587         AbstractPolylineState.prototype.enter = function () {
77588             this.polylineSegmentLengthToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "polylineSegmentLengthToolTipFeedback");
77589             try {
77590                 this.polylineSegmentAngleToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "polylineSegmentAngleToolTipFeedback");
77591             }
77592             catch (ex) {
77593             }
77594         };
77595         AbstractPolylineState.prototype.getToolTipFeedbackText = function (polyline, pointIndex) {
77596             var length = this.getPolylineSegmentLength(polyline, pointIndex);
77597             var angle = this.getPolylineSegmentAngle(polyline, pointIndex);
77598             var toolTipFeedbackText = "<html>" + CoreTools.format(this.polylineSegmentLengthToolTipFeedback, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getFormatWithUnit().format(length));
77599             if (this.polylineSegmentAngleToolTipFeedback != null && this.polylineSegmentAngleToolTipFeedback.length > 0) {
77600                 toolTipFeedbackText += "<br>" + CoreTools.format(this.polylineSegmentAngleToolTipFeedback, angle);
77601             }
77602             return toolTipFeedbackText;
77603         };
77604         AbstractPolylineState.prototype.getPolylineSegmentLength = function (polyline, pointIndex) {
77605             if (pointIndex === 0 && !polyline.isClosedPath()) {
77606                 pointIndex++;
77607             }
77608             var points = polyline.getPoints();
77609             var previousPoint = points[(pointIndex + points.length - 1) % points.length];
77610             return java.awt.geom.Point2D.distance(previousPoint[0], previousPoint[1], points[pointIndex][0], points[pointIndex][1]);
77611         };
77612         /**
77613          * Returns polyline segment angle at the given point index in degrees.
77614          * @param {Polyline} polyline
77615          * @param {number} pointIndex
77616          * @return {number}
77617          */
77618         AbstractPolylineState.prototype.getPolylineSegmentAngle = function (polyline, pointIndex) {
77619             if (pointIndex === 0 && !polyline.isClosedPath()) {
77620                 pointIndex++;
77621             }
77622             var points = polyline.getPoints();
77623             var point = points[pointIndex];
77624             var previousPoint = points[(pointIndex + points.length - 1) % points.length];
77625             var previousPreviousPoint = points[(pointIndex + points.length - 2) % points.length];
77626             var segmentLength = java.awt.geom.Point2D.distance(previousPoint[0], previousPoint[1], points[pointIndex][0], points[pointIndex][1]);
77627             var previousSegmentLength = java.awt.geom.Point2D.distance(previousPreviousPoint[0], previousPreviousPoint[1], previousPoint[0], previousPoint[1]);
77628             if (previousPreviousPoint !== point && segmentLength !== 0 && previousSegmentLength !== 0) {
77629                 var xSegmentVector = (point[0] - previousPoint[0]) / segmentLength;
77630                 var ySegmentVector = (point[1] - previousPoint[1]) / segmentLength;
77631                 var xPreviousSegmentVector = (previousPoint[0] - previousPreviousPoint[0]) / previousSegmentLength;
77632                 var yPreviousSegmentVector = (previousPoint[1] - previousPreviousPoint[1]) / previousSegmentLength;
77633                 var segmentAngle = (Math.round(180 - /* toDegrees */ (function (x) { return x * 180 / Math.PI; })(Math.atan2(ySegmentVector * xPreviousSegmentVector - xSegmentVector * yPreviousSegmentVector, xSegmentVector * xPreviousSegmentVector + ySegmentVector * yPreviousSegmentVector))) | 0);
77634                 if (segmentAngle > 180) {
77635                     segmentAngle -= 360;
77636                 }
77637                 return segmentAngle;
77638             }
77639             if (segmentLength === 0) {
77640                 return 0;
77641             }
77642             else {
77643                 return (Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(Math.atan2(previousPoint[1] - point[1], point[0] - previousPoint[0]))) | 0);
77644             }
77645         };
77646         AbstractPolylineState.prototype.showPolylineAngleFeedback = function (polyline, pointIndex) {
77647             var points = polyline.getPoints();
77648             if (this.polylineSegmentAngleToolTipFeedback != null && this.polylineSegmentAngleToolTipFeedback.length > 0 && (pointIndex >= 2 || points.length > 2 && polyline.isClosedPath())) {
77649                 var previousPoint = points[(pointIndex + points.length - 1) % points.length];
77650                 var previousPreviousPoint = points[(pointIndex + points.length - 2) % points.length];
77651                 this.__parent.getView().setAngleFeedback(previousPoint[0], previousPoint[1], previousPreviousPoint[0], previousPreviousPoint[1], points[pointIndex][0], points[pointIndex][1]);
77652             }
77653         };
77654         return AbstractPolylineState;
77655     }(PlanController.ControllerState));
77656     PlanController.AbstractPolylineState = AbstractPolylineState;
77657     AbstractPolylineState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.AbstractPolylineState";
77658     /**
77659      * Label rotation state. This state manages the rotation of a label.
77660      * @extends PlanController.ControllerState
77661      * @class
77662      */
77663     var LabelRotationState = /** @class */ (function (_super) {
77664         __extends(LabelRotationState, _super);
77665         function LabelRotationState(__parent) {
77666             var _this = _super.call(this) || this;
77667             _this.__parent = __parent;
77668             if (_this.selectedLabel === undefined) {
77669                 _this.selectedLabel = null;
77670             }
77671             if (_this.oldAngle === undefined) {
77672                 _this.oldAngle = 0;
77673             }
77674             if (_this.angleMousePress === undefined) {
77675                 _this.angleMousePress = 0;
77676             }
77677             if (_this.magnetismEnabled === undefined) {
77678                 _this.magnetismEnabled = false;
77679             }
77680             if (_this.alignmentActivated === undefined) {
77681                 _this.alignmentActivated = false;
77682             }
77683             return _this;
77684         }
77685         /**
77686          *
77687          * @return {PlanController.Mode}
77688          */
77689         LabelRotationState.prototype.getMode = function () {
77690             return PlanController.Mode.SELECTION_$LI$();
77691         };
77692         /**
77693          *
77694          * @return {boolean}
77695          */
77696         LabelRotationState.prototype.isModificationState = function () {
77697             return true;
77698         };
77699         /**
77700          *
77701          * @return {boolean}
77702          */
77703         LabelRotationState.prototype.isBasePlanModificationState = function () {
77704             return true;
77705         };
77706         /**
77707          *
77708          */
77709         LabelRotationState.prototype.enter = function () {
77710             this.selectedLabel = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
77711             this.angleMousePress = Math.atan2(this.selectedLabel.getY() - this.__parent.getYLastMousePress(), this.__parent.getXLastMousePress() - this.selectedLabel.getX());
77712             this.oldAngle = this.selectedLabel.getAngle();
77713             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
77714             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (this.__parent.wasMagnetismToggledLastMousePress());
77715             var planView = this.__parent.getView();
77716             planView.setResizeIndicatorVisible(true);
77717         };
77718         /**
77719          *
77720          * @param {number} x
77721          * @param {number} y
77722          */
77723         LabelRotationState.prototype.moveMouse = function (x, y) {
77724             if (x !== this.selectedLabel.getX() || y !== this.selectedLabel.getY()) {
77725                 var angleMouseMove = Math.atan2(this.selectedLabel.getY() - y, x - this.selectedLabel.getX());
77726                 var newAngle = this.oldAngle - angleMouseMove + this.angleMousePress;
77727                 if (this.alignmentActivated || this.magnetismEnabled) {
77728                     var angleStep = 2 * Math.PI / LabelRotationState.STEP_COUNT;
77729                     newAngle = Math.round(newAngle / angleStep) * angleStep;
77730                 }
77731                 this.selectedLabel.setAngle(newAngle);
77732                 this.__parent.getView().makePointVisible(x, y);
77733             }
77734         };
77735         /**
77736          *
77737          * @param {number} x
77738          * @param {number} y
77739          */
77740         LabelRotationState.prototype.releaseMouse = function (x, y) {
77741             this.__parent.postLabelRotation(this.selectedLabel, this.oldAngle);
77742             this.__parent.setState(this.__parent.getSelectionState());
77743         };
77744         /**
77745          *
77746          * @param {boolean} magnetismToggled
77747          */
77748         LabelRotationState.prototype.toggleMagnetism = function (magnetismToggled) {
77749             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
77750             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
77751         };
77752         /**
77753          *
77754          * @param {boolean} alignmentActivated
77755          */
77756         LabelRotationState.prototype.setAlignmentActivated = function (alignmentActivated) {
77757             this.alignmentActivated = alignmentActivated;
77758             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
77759         };
77760         /**
77761          *
77762          */
77763         LabelRotationState.prototype.escape = function () {
77764             this.selectedLabel.setAngle(this.oldAngle);
77765             this.__parent.setState(this.__parent.getSelectionState());
77766         };
77767         /**
77768          *
77769          */
77770         LabelRotationState.prototype.exit = function () {
77771             this.__parent.getView().setResizeIndicatorVisible(false);
77772             this.selectedLabel = null;
77773         };
77774         LabelRotationState.STEP_COUNT = 24;
77775         return LabelRotationState;
77776     }(PlanController.ControllerState));
77777     PlanController.LabelRotationState = LabelRotationState;
77778     LabelRotationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.LabelRotationState";
77779     /**
77780      * Label elevation state. This states manages the elevation change of a label.
77781      * @extends PlanController.ControllerState
77782      * @class
77783      */
77784     var LabelElevationState = /** @class */ (function (_super) {
77785         __extends(LabelElevationState, _super);
77786         function LabelElevationState(__parent) {
77787             var _this = _super.call(this) || this;
77788             _this.__parent = __parent;
77789             if (_this.magnetismEnabled === undefined) {
77790                 _this.magnetismEnabled = false;
77791             }
77792             if (_this.deltaYToElevationPoint === undefined) {
77793                 _this.deltaYToElevationPoint = 0;
77794             }
77795             if (_this.selectedLabel === undefined) {
77796                 _this.selectedLabel = null;
77797             }
77798             if (_this.oldElevation === undefined) {
77799                 _this.oldElevation = 0;
77800             }
77801             if (_this.elevationToolTipFeedback === undefined) {
77802                 _this.elevationToolTipFeedback = null;
77803             }
77804             return _this;
77805         }
77806         /**
77807          *
77808          * @return {PlanController.Mode}
77809          */
77810         LabelElevationState.prototype.getMode = function () {
77811             return PlanController.Mode.SELECTION_$LI$();
77812         };
77813         /**
77814          *
77815          * @return {boolean}
77816          */
77817         LabelElevationState.prototype.isModificationState = function () {
77818             return true;
77819         };
77820         /**
77821          *
77822          * @return {boolean}
77823          */
77824         LabelElevationState.prototype.isBasePlanModificationState = function () {
77825             return true;
77826         };
77827         /**
77828          *
77829          */
77830         LabelElevationState.prototype.enter = function () {
77831             this.elevationToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "elevationToolTipFeedback");
77832             this.selectedLabel = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
77833             var textStyle = this.__parent.getItemTextStyle(this.selectedLabel, this.selectedLabel.getStyle());
77834             var textBounds = this.__parent.getView().getTextBounds(this.selectedLabel.getText(), textStyle, this.selectedLabel.getX(), this.selectedLabel.getY(), this.selectedLabel.getAngle());
77835             this.deltaYToElevationPoint = this.__parent.getYLastMousePress() - (textBounds[2][1] + textBounds[3][1]) / 2;
77836             this.oldElevation = this.selectedLabel.getElevation();
77837             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (this.__parent.wasMagnetismToggledLastMousePress());
77838             var planView = this.__parent.getView();
77839             planView.setResizeIndicatorVisible(true);
77840             if (this.__parent.feedbackDisplayed) {
77841                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.oldElevation), this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
77842             }
77843         };
77844         /**
77845          *
77846          * @param {number} x
77847          * @param {number} y
77848          */
77849         LabelElevationState.prototype.moveMouse = function (x, y) {
77850             var planView = this.__parent.getView();
77851             var textStyle = this.__parent.getItemTextStyle(this.selectedLabel, this.selectedLabel.getStyle());
77852             var textBounds = this.__parent.getView().getTextBounds(this.selectedLabel.getText(), textStyle, this.selectedLabel.getX(), this.selectedLabel.getY(), this.selectedLabel.getAngle());
77853             var deltaY = y - this.deltaYToElevationPoint - (textBounds[2][1] + textBounds[3][1]) / 2;
77854             var newElevation = this.oldElevation - deltaY;
77855             newElevation = Math.min(Math.max(newElevation, 0.0), this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMaximumElevation());
77856             if (this.magnetismEnabled) {
77857                 newElevation = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMagnetizedLength(newElevation, planView.getPixelLength());
77858             }
77859             this.selectedLabel.setElevation(newElevation);
77860             planView.makePointVisible(x, y);
77861             if (this.__parent.feedbackDisplayed) {
77862                 planView.setToolTipFeedback(this.getToolTipFeedbackText(newElevation), x, y);
77863             }
77864         };
77865         /**
77866          *
77867          * @param {number} x
77868          * @param {number} y
77869          */
77870         LabelElevationState.prototype.releaseMouse = function (x, y) {
77871             this.__parent.postLabelElevation(this.selectedLabel, this.oldElevation);
77872             this.__parent.setState(this.__parent.getSelectionState());
77873         };
77874         /**
77875          *
77876          * @param {boolean} magnetismToggled
77877          */
77878         LabelElevationState.prototype.toggleMagnetism = function (magnetismToggled) {
77879             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
77880             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
77881         };
77882         /**
77883          *
77884          */
77885         LabelElevationState.prototype.escape = function () {
77886             this.selectedLabel.setElevation(this.oldElevation);
77887             this.__parent.setState(this.__parent.getSelectionState());
77888         };
77889         /**
77890          *
77891          */
77892         LabelElevationState.prototype.exit = function () {
77893             var planView = this.__parent.getView();
77894             planView.setResizeIndicatorVisible(false);
77895             planView.deleteFeedback();
77896             this.selectedLabel = null;
77897         };
77898         LabelElevationState.prototype.getToolTipFeedbackText = function (height) {
77899             return CoreTools.format(this.elevationToolTipFeedback, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getFormatWithUnit().format(height));
77900         };
77901         return LabelElevationState;
77902     }(PlanController.ControllerState));
77903     PlanController.LabelElevationState = LabelElevationState;
77904     LabelElevationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.LabelElevationState";
77905     /**
77906      * Compass rotation state. This states manages the rotation of the compass.
77907      * @extends PlanController.ControllerState
77908      * @class
77909      */
77910     var CompassRotationState = /** @class */ (function (_super) {
77911         __extends(CompassRotationState, _super);
77912         function CompassRotationState(__parent) {
77913             var _this = _super.call(this) || this;
77914             _this.__parent = __parent;
77915             if (_this.selectedCompass === undefined) {
77916                 _this.selectedCompass = null;
77917             }
77918             if (_this.angleMousePress === undefined) {
77919                 _this.angleMousePress = 0;
77920             }
77921             if (_this.oldNorthDirection === undefined) {
77922                 _this.oldNorthDirection = 0;
77923             }
77924             if (_this.rotationToolTipFeedback === undefined) {
77925                 _this.rotationToolTipFeedback = null;
77926             }
77927             return _this;
77928         }
77929         /**
77930          *
77931          * @return {PlanController.Mode}
77932          */
77933         CompassRotationState.prototype.getMode = function () {
77934             return PlanController.Mode.SELECTION_$LI$();
77935         };
77936         /**
77937          *
77938          * @return {boolean}
77939          */
77940         CompassRotationState.prototype.isModificationState = function () {
77941             return true;
77942         };
77943         /**
77944          *
77945          * @return {boolean}
77946          */
77947         CompassRotationState.prototype.isBasePlanModificationState = function () {
77948             return true;
77949         };
77950         /**
77951          *
77952          */
77953         CompassRotationState.prototype.enter = function () {
77954             this.rotationToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "rotationToolTipFeedback");
77955             this.selectedCompass = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
77956             this.angleMousePress = Math.atan2(this.selectedCompass.getY() - this.__parent.getYLastMousePress(), this.__parent.getXLastMousePress() - this.selectedCompass.getX());
77957             this.oldNorthDirection = this.selectedCompass.getNorthDirection();
77958             var planView = this.__parent.getView();
77959             planView.setResizeIndicatorVisible(true);
77960             if (this.__parent.feedbackDisplayed) {
77961                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.oldNorthDirection), this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
77962             }
77963         };
77964         /**
77965          *
77966          * @param {number} x
77967          * @param {number} y
77968          */
77969         CompassRotationState.prototype.moveMouse = function (x, y) {
77970             if (x !== this.selectedCompass.getX() || y !== this.selectedCompass.getY()) {
77971                 var angleMouseMove = Math.atan2(this.selectedCompass.getY() - y, x - this.selectedCompass.getX());
77972                 var newNorthDirection = this.oldNorthDirection - angleMouseMove + this.angleMousePress;
77973                 var angleStep = Math.PI / 180;
77974                 newNorthDirection = Math.round(newNorthDirection / angleStep) * angleStep;
77975                 newNorthDirection = ((newNorthDirection + 2 * Math.PI) % (2 * Math.PI));
77976                 this.selectedCompass.setNorthDirection(newNorthDirection);
77977                 var planView = this.__parent.getView();
77978                 planView.makePointVisible(x, y);
77979                 if (this.__parent.feedbackDisplayed) {
77980                     planView.setToolTipFeedback(this.getToolTipFeedbackText(newNorthDirection), x, y);
77981                 }
77982             }
77983         };
77984         /**
77985          *
77986          * @param {number} x
77987          * @param {number} y
77988          */
77989         CompassRotationState.prototype.releaseMouse = function (x, y) {
77990             this.__parent.postCompassRotation(this.selectedCompass, this.oldNorthDirection);
77991             this.__parent.setState(this.__parent.getSelectionState());
77992         };
77993         /**
77994          *
77995          */
77996         CompassRotationState.prototype.escape = function () {
77997             this.selectedCompass.setNorthDirection(this.oldNorthDirection);
77998             this.__parent.setState(this.__parent.getSelectionState());
77999         };
78000         /**
78001          *
78002          */
78003         CompassRotationState.prototype.exit = function () {
78004             var planView = this.__parent.getView();
78005             planView.setResizeIndicatorVisible(false);
78006             planView.deleteFeedback();
78007             this.selectedCompass = null;
78008         };
78009         CompassRotationState.prototype.getToolTipFeedbackText = function (angle) {
78010             return CoreTools.format(this.rotationToolTipFeedback, Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(angle)));
78011         };
78012         return CompassRotationState;
78013     }(PlanController.ControllerState));
78014     PlanController.CompassRotationState = CompassRotationState;
78015     CompassRotationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.CompassRotationState";
78016     /**
78017      * Compass resize state. This states manages the resizing of the compass.
78018      * @extends PlanController.ControllerState
78019      * @class
78020      */
78021     var CompassResizeState = /** @class */ (function (_super) {
78022         __extends(CompassResizeState, _super);
78023         function CompassResizeState(__parent) {
78024             var _this = _super.call(this) || this;
78025             _this.__parent = __parent;
78026             if (_this.selectedCompass === undefined) {
78027                 _this.selectedCompass = null;
78028             }
78029             if (_this.oldDiameter === undefined) {
78030                 _this.oldDiameter = 0;
78031             }
78032             if (_this.deltaXToResizePoint === undefined) {
78033                 _this.deltaXToResizePoint = 0;
78034             }
78035             if (_this.deltaYToResizePoint === undefined) {
78036                 _this.deltaYToResizePoint = 0;
78037             }
78038             if (_this.resizeToolTipFeedback === undefined) {
78039                 _this.resizeToolTipFeedback = null;
78040             }
78041             return _this;
78042         }
78043         /**
78044          *
78045          * @return {PlanController.Mode}
78046          */
78047         CompassResizeState.prototype.getMode = function () {
78048             return PlanController.Mode.SELECTION_$LI$();
78049         };
78050         /**
78051          *
78052          * @return {boolean}
78053          */
78054         CompassResizeState.prototype.isModificationState = function () {
78055             return true;
78056         };
78057         /**
78058          *
78059          * @return {boolean}
78060          */
78061         CompassResizeState.prototype.isBasePlanModificationState = function () {
78062             return true;
78063         };
78064         /**
78065          *
78066          */
78067         CompassResizeState.prototype.enter = function () {
78068             this.resizeToolTipFeedback = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLocalizedString(PlanController, "diameterToolTipFeedback");
78069             this.selectedCompass = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
78070             var compassPoints = this.selectedCompass.getPoints();
78071             var xMiddleSecondAndThirdPoint = (compassPoints[1][0] + compassPoints[2][0]) / 2;
78072             var yMiddleSecondAndThirdPoint = (compassPoints[1][1] + compassPoints[2][1]) / 2;
78073             this.deltaXToResizePoint = this.__parent.getXLastMousePress() - xMiddleSecondAndThirdPoint;
78074             this.deltaYToResizePoint = this.__parent.getYLastMousePress() - yMiddleSecondAndThirdPoint;
78075             this.oldDiameter = this.selectedCompass.getDiameter();
78076             var planView = this.__parent.getView();
78077             planView.setResizeIndicatorVisible(true);
78078             if (this.__parent.feedbackDisplayed) {
78079                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.oldDiameter), this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
78080             }
78081         };
78082         /**
78083          *
78084          * @param {number} x
78085          * @param {number} y
78086          */
78087         CompassResizeState.prototype.moveMouse = function (x, y) {
78088             var planView = this.__parent.getView();
78089             var newDiameter = java.awt.geom.Point2D.distance(this.selectedCompass.getX(), this.selectedCompass.getY(), x - this.deltaXToResizePoint, y - this.deltaYToResizePoint) * 2;
78090             newDiameter = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMagnetizedLength(newDiameter, planView.getPixelLength());
78091             newDiameter = Math.min(Math.max(newDiameter, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMinimumLength()), this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMaximumLength() / 10);
78092             this.selectedCompass.setDiameter(newDiameter);
78093             planView.makePointVisible(x, y);
78094             if (this.__parent.feedbackDisplayed) {
78095                 planView.setToolTipFeedback(this.getToolTipFeedbackText(newDiameter), x, y);
78096             }
78097         };
78098         /**
78099          *
78100          * @param {number} x
78101          * @param {number} y
78102          */
78103         CompassResizeState.prototype.releaseMouse = function (x, y) {
78104             this.__parent.postCompassResize(this.selectedCompass, this.oldDiameter);
78105             this.__parent.setState(this.__parent.getSelectionState());
78106         };
78107         /**
78108          *
78109          */
78110         CompassResizeState.prototype.escape = function () {
78111             this.selectedCompass.setDiameter(this.oldDiameter);
78112             this.__parent.setState(this.__parent.getSelectionState());
78113         };
78114         /**
78115          *
78116          */
78117         CompassResizeState.prototype.exit = function () {
78118             var planView = this.__parent.getView();
78119             planView.setResizeIndicatorVisible(false);
78120             planView.deleteFeedback();
78121             this.selectedCompass = null;
78122         };
78123         CompassResizeState.prototype.getToolTipFeedbackText = function (diameter) {
78124             return CoreTools.format(this.resizeToolTipFeedback, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getFormatWithUnit().format(diameter));
78125         };
78126         return CompassResizeState;
78127     }(PlanController.ControllerState));
78128     PlanController.CompassResizeState = CompassResizeState;
78129     CompassResizeState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.CompassResizeState";
78130     /**
78131      * Default selection state. This state manages transition to other modes,
78132      * the deletion of selected items, and the move of selected items with arrow keys.
78133      * @extends PlanController.AbstractModeChangeState
78134      * @class
78135      */
78136     var SelectionState = /** @class */ (function (_super) {
78137         __extends(SelectionState, _super);
78138         function SelectionState(__parent) {
78139             var _this = _super.call(this, __parent) || this;
78140             _this.__parent = __parent;
78141             _this.selectionListener = new SelectionState.SelectionState$0(_this);
78142             return _this;
78143         }
78144         /**
78145          *
78146          * @return {PlanController.Mode}
78147          */
78148         SelectionState.prototype.getMode = function () {
78149             return PlanController.Mode.SELECTION_$LI$();
78150         };
78151         /**
78152          *
78153          */
78154         SelectionState.prototype.enter = function () {
78155             if (this.__parent.getView() != null) {
78156                 if (this.__parent.getPointerTypeLastMousePress() !== View.PointerType.TOUCH) {
78157                     this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
78158                 }
78159                 this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.addSelectionListener(this.selectionListener);
78160                 this.selectionListener.selectionChanged(null);
78161             }
78162         };
78163         /**
78164          *
78165          * @param {number} x
78166          * @param {number} y
78167          */
78168         SelectionState.prototype.moveMouse = function (x, y) {
78169             if (this.__parent.getRotatedLabelAt(x, y) != null || this.__parent.getYawRotatedCameraAt(x, y) != null || this.__parent.getPitchRotatedCameraAt(x, y) != null) {
78170                 this.__parent.getView().setCursor(PlanView.CursorType.ROTATION);
78171             }
78172             else if (this.__parent.getElevatedLabelAt(x, y) != null || this.__parent.getElevatedCameraAt(x, y) != null) {
78173                 this.__parent.getView().setCursor(PlanView.CursorType.ELEVATION);
78174             }
78175             else if (this.__parent.getRoomNameAt(x, y) != null || this.__parent.getRoomAreaAt(x, y) != null) {
78176                 this.__parent.getView().setCursor(PlanView.CursorType.RESIZE);
78177             }
78178             else if (this.__parent.getRoomRotatedNameAt(x, y) != null || this.__parent.getRoomRotatedAreaAt(x, y) != null) {
78179                 this.__parent.getView().setCursor(PlanView.CursorType.ROTATION);
78180             }
78181             else if (this.__parent.getResizedDimensionLineStartAt(x, y) != null || this.__parent.getResizedDimensionLineEndAt(x, y) != null || this.__parent.getHeightResizedDimensionLineAt(x, y) != null || this.__parent.getWidthAndDepthResizedPieceOfFurnitureAt(x, y) != null || this.__parent.getResizedWallStartAt(x, y) != null || this.__parent.getResizedWallEndAt(x, y) != null || this.__parent.getResizedPolylineAt(x, y) != null || this.__parent.getResizedRoomAt(x, y) != null) {
78182                 this.__parent.getView().setCursor(PlanView.CursorType.RESIZE);
78183             }
78184             else if (this.__parent.getPitchRotatedPieceOfFurnitureAt(x, y) != null || this.__parent.getRollRotatedPieceOfFurnitureAt(x, y) != null) {
78185                 this.__parent.getView().setCursor(PlanView.CursorType.ROTATION);
78186             }
78187             else if (this.__parent.getModifiedLightPowerAt(x, y) != null) {
78188                 this.__parent.getView().setCursor(PlanView.CursorType.POWER);
78189             }
78190             else if (this.__parent.getOffsetDimensionLineAt(x, y) != null || this.__parent.getHeightResizedPieceOfFurnitureAt(x, y) != null || this.__parent.getArcExtentWallAt(x, y) != null) {
78191                 this.__parent.getView().setCursor(PlanView.CursorType.HEIGHT);
78192             }
78193             else if (this.__parent.getRotatedPieceOfFurnitureAt(x, y) != null || this.__parent.getPitchRotatedDimensionLineAt(x, y) != null) {
78194                 this.__parent.getView().setCursor(PlanView.CursorType.ROTATION);
78195             }
78196             else if (this.__parent.getElevatedPieceOfFurnitureAt(x, y) != null || this.__parent.getElevatedDimensionLineAt(x, y) != null) {
78197                 this.__parent.getView().setCursor(PlanView.CursorType.ELEVATION);
78198             }
78199             else if (this.__parent.getPieceOfFurnitureNameAt(x, y) != null) {
78200                 this.__parent.getView().setCursor(PlanView.CursorType.RESIZE);
78201             }
78202             else if (this.__parent.getPieceOfFurnitureRotatedNameAt(x, y) != null) {
78203                 this.__parent.getView().setCursor(PlanView.CursorType.ROTATION);
78204             }
78205             else if (this.__parent.getRotatedCompassAt(x, y) != null) {
78206                 this.__parent.getView().setCursor(PlanView.CursorType.ROTATION);
78207             }
78208             else if (this.__parent.getResizedCompassAt(x, y) != null) {
78209                 this.__parent.getView().setCursor(PlanView.CursorType.RESIZE);
78210             }
78211             else {
78212                 if (this.__parent.isItemSelectedAt(x, y)) {
78213                     this.__parent.getView().setCursor(PlanView.CursorType.MOVE);
78214                 }
78215                 else {
78216                     this.__parent.getView().setCursor(PlanView.CursorType.SELECTION);
78217                 }
78218             }
78219         };
78220         /**
78221          *
78222          * @param {number} x
78223          * @param {number} y
78224          * @param {number} clickCount
78225          * @param {boolean} shiftDown
78226          * @param {boolean} duplicationActivated
78227          */
78228         SelectionState.prototype.pressMouse = function (x, y, clickCount, shiftDown, duplicationActivated) {
78229             if (clickCount === 1) {
78230                 if (this.__parent.getPointerTypeLastMousePress() === View.PointerType.TOUCH) {
78231                     this.moveMouse(x, y);
78232                 }
78233                 if (this.__parent.getRotatedLabelAt(x, y) != null) {
78234                     this.__parent.setState(this.__parent.getLabelRotationState());
78235                 }
78236                 else if (this.__parent.getYawRotatedCameraAt(x, y) != null) {
78237                     this.__parent.setState(this.__parent.getCameraYawRotationState());
78238                 }
78239                 else if (this.__parent.getPitchRotatedCameraAt(x, y) != null) {
78240                     this.__parent.setState(this.__parent.getCameraPitchRotationState());
78241                 }
78242                 else if (this.__parent.getElevatedLabelAt(x, y) != null) {
78243                     this.__parent.setState(this.__parent.getLabelElevationState());
78244                 }
78245                 else if (this.__parent.getElevatedCameraAt(x, y) != null) {
78246                     this.__parent.setState(this.__parent.getCameraElevationState());
78247                 }
78248                 else if (this.__parent.getRoomNameAt(x, y) != null) {
78249                     this.__parent.setState(this.__parent.getRoomNameOffsetState());
78250                 }
78251                 else if (this.__parent.getRoomRotatedNameAt(x, y) != null) {
78252                     this.__parent.setState(this.__parent.getRoomNameRotationState());
78253                 }
78254                 else if (this.__parent.getRoomAreaAt(x, y) != null) {
78255                     this.__parent.setState(this.__parent.getRoomAreaOffsetState());
78256                 }
78257                 else if (this.__parent.getRoomRotatedAreaAt(x, y) != null) {
78258                     this.__parent.setState(this.__parent.getRoomAreaRotationState());
78259                 }
78260                 else if (this.__parent.getResizedDimensionLineStartAt(x, y) != null || this.__parent.getResizedDimensionLineEndAt(x, y) != null) {
78261                     this.__parent.setState(this.__parent.getDimensionLineResizeState());
78262                 }
78263                 else if (this.__parent.getHeightResizedDimensionLineAt(x, y) != null) {
78264                     this.__parent.setState(this.__parent.getDimensionLineHeightState());
78265                 }
78266                 else if (this.__parent.getWidthAndDepthResizedPieceOfFurnitureAt(x, y) != null) {
78267                     this.__parent.setState(this.__parent.getPieceOfFurnitureResizeState());
78268                 }
78269                 else if (this.__parent.getResizedWallStartAt(x, y) != null || this.__parent.getResizedWallEndAt(x, y) != null) {
78270                     this.__parent.setState(this.__parent.getWallResizeState());
78271                 }
78272                 else if (this.__parent.getResizedRoomAt(x, y) != null) {
78273                     this.__parent.setState(this.__parent.getRoomResizeState());
78274                 }
78275                 else if (this.__parent.getOffsetDimensionLineAt(x, y) != null) {
78276                     this.__parent.setState(this.__parent.getDimensionLineOffsetState());
78277                 }
78278                 else if (this.__parent.getResizedPolylineAt(x, y) != null) {
78279                     this.__parent.setState(this.__parent.getPolylineResizeState());
78280                 }
78281                 else if (this.__parent.getPitchRotatedPieceOfFurnitureAt(x, y) != null) {
78282                     this.__parent.setState(this.__parent.getPieceOfFurniturePitchRotationState());
78283                 }
78284                 else if (this.__parent.getRollRotatedPieceOfFurnitureAt(x, y) != null) {
78285                     this.__parent.setState(this.__parent.getPieceOfFurnitureRollRotationState());
78286                 }
78287                 else if (this.__parent.getModifiedLightPowerAt(x, y) != null) {
78288                     this.__parent.setState(this.__parent.getLightPowerModificationState());
78289                 }
78290                 else if (this.__parent.getHeightResizedPieceOfFurnitureAt(x, y) != null) {
78291                     this.__parent.setState(this.__parent.getPieceOfFurnitureHeightState());
78292                 }
78293                 else if (this.__parent.getArcExtentWallAt(x, y) != null) {
78294                     this.__parent.setState(this.__parent.getWallArcExtentState());
78295                 }
78296                 else if (this.__parent.getRotatedPieceOfFurnitureAt(x, y) != null) {
78297                     this.__parent.setState(this.__parent.getPieceOfFurnitureRotationState());
78298                 }
78299                 else if (this.__parent.getPitchRotatedDimensionLineAt(x, y) != null) {
78300                     this.__parent.setState(this.__parent.getDimensionLinePitchRotationState());
78301                 }
78302                 else if (this.__parent.getElevatedPieceOfFurnitureAt(x, y) != null) {
78303                     this.__parent.setState(this.__parent.getPieceOfFurnitureElevationState());
78304                 }
78305                 else if (this.__parent.getElevatedDimensionLineAt(x, y) != null) {
78306                     this.__parent.setState(this.__parent.getDimensionLineElevationState());
78307                 }
78308                 else if (this.__parent.getPieceOfFurnitureNameAt(x, y) != null) {
78309                     this.__parent.setState(this.__parent.getPieceOfFurnitureNameOffsetState());
78310                 }
78311                 else if (this.__parent.getPieceOfFurnitureRotatedNameAt(x, y) != null) {
78312                     this.__parent.setState(this.__parent.getPieceOfFurnitureNameRotationState());
78313                 }
78314                 else if (this.__parent.getRotatedCompassAt(x, y) != null) {
78315                     this.__parent.setState(this.__parent.getCompassRotationState());
78316                 }
78317                 else if (this.__parent.getResizedCompassAt(x, y) != null) {
78318                     this.__parent.setState(this.__parent.getCompassResizeState());
78319                 }
78320                 else {
78321                     if (!shiftDown && (this.__parent.getPointerTypeLastMousePress() === View.PointerType.TOUCH || this.__parent.getSelectableItemAt(x, y) != null)) {
78322                         this.__parent.setState(this.__parent.getSelectionMoveState());
78323                     }
78324                     else {
78325                         this.__parent.setState(this.__parent.getRectangleSelectionState());
78326                     }
78327                 }
78328             }
78329             else if (clickCount === 2) {
78330                 var item = this.__parent.getSelectableItemAt(x, y);
78331                 if (!shiftDown && item != null) {
78332                     this.__parent.modifySelectedItem();
78333                 }
78334             }
78335         };
78336         /**
78337          *
78338          */
78339         SelectionState.prototype.exit = function () {
78340             if (this.__parent.getView() != null) {
78341                 this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.removeSelectionListener(this.selectionListener);
78342                 this.__parent.getView().setResizeIndicatorVisible(false);
78343             }
78344         };
78345         return SelectionState;
78346     }(PlanController.AbstractModeChangeState));
78347     PlanController.SelectionState = SelectionState;
78348     SelectionState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.SelectionState";
78349     (function (SelectionState) {
78350         var SelectionState$0 = /** @class */ (function () {
78351             function SelectionState$0(__parent) {
78352                 this.__parent = __parent;
78353             }
78354             SelectionState$0.prototype.selectionChanged = function (selectionEvent) {
78355                 var selectedItems = this.__parent.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
78356                 this.__parent.__parent.getView().setResizeIndicatorVisible(/* size */ selectedItems.length === 1 && (this.__parent.__parent.isItemResizable(/* get */ selectedItems[0]) || this.__parent.__parent.isItemMovable(/* get */ selectedItems[0])));
78357             };
78358             return SelectionState$0;
78359         }());
78360         SelectionState.SelectionState$0 = SelectionState$0;
78361         SelectionState$0["__interfaces"] = ["com.eteks.sweethome3d.model.SelectionListener"];
78362     })(SelectionState = PlanController.SelectionState || (PlanController.SelectionState = {}));
78363     /**
78364      * Wall creation state. This state manages transition to other modes,
78365      * and initial wall creation.
78366      * @extends PlanController.AbstractModeChangeState
78367      * @class
78368      */
78369     var WallCreationState = /** @class */ (function (_super) {
78370         __extends(WallCreationState, _super);
78371         function WallCreationState(__parent) {
78372             var _this = _super.call(this, __parent) || this;
78373             _this.__parent = __parent;
78374             if (_this.magnetismEnabled === undefined) {
78375                 _this.magnetismEnabled = false;
78376             }
78377             return _this;
78378         }
78379         /**
78380          *
78381          * @return {PlanController.Mode}
78382          */
78383         WallCreationState.prototype.getMode = function () {
78384             return PlanController.Mode.WALL_CREATION_$LI$();
78385         };
78386         /**
78387          *
78388          */
78389         WallCreationState.prototype.enter = function () {
78390             this.__parent.getView().setCursor(PlanView.CursorType.DRAW);
78391             this.toggleMagnetism(this.__parent.wasMagnetismToggledLastMousePress());
78392         };
78393         /**
78394          *
78395          * @param {number} x
78396          * @param {number} y
78397          */
78398         WallCreationState.prototype.moveMouse = function (x, y) {
78399             if (this.magnetismEnabled) {
78400                 var point = new PlanController.WallPointWithAngleMagnetism(this.__parent, null, x, y, x, y);
78401                 x = point.getX();
78402                 y = point.getY();
78403             }
78404             if (this.__parent.feedbackDisplayed) {
78405                 this.__parent.getView().setAlignmentFeedback(Wall, null, x, y, false);
78406             }
78407         };
78408         /**
78409          *
78410          * @param {number} x
78411          * @param {number} y
78412          * @param {number} clickCount
78413          * @param {boolean} shiftDown
78414          * @param {boolean} duplicationActivated
78415          */
78416         WallCreationState.prototype.pressMouse = function (x, y, clickCount, shiftDown, duplicationActivated) {
78417             this.__parent.setState(this.__parent.getWallDrawingState());
78418         };
78419         /**
78420          *
78421          * @param {boolean} editionActivated
78422          */
78423         WallCreationState.prototype.setEditionActivated = function (editionActivated) {
78424             if (editionActivated) {
78425                 this.__parent.setState(this.__parent.getWallDrawingState());
78426                 this.setEditionActivated(editionActivated);
78427             }
78428         };
78429         /**
78430          *
78431          * @param {boolean} magnetismToggled
78432          */
78433         WallCreationState.prototype.toggleMagnetism = function (magnetismToggled) {
78434             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
78435             if (this.__parent.getPointerTypeLastMousePress() !== View.PointerType.TOUCH) {
78436                 this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
78437             }
78438         };
78439         /**
78440          *
78441          */
78442         WallCreationState.prototype.exit = function () {
78443             this.__parent.getView().deleteFeedback();
78444         };
78445         return WallCreationState;
78446     }(PlanController.AbstractModeChangeState));
78447     PlanController.WallCreationState = WallCreationState;
78448     WallCreationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.WallCreationState";
78449     /**
78450      * Dimension line creation state. This state manages transition to
78451      * other modes, and initial dimension line creation.
78452      * @extends PlanController.AbstractModeChangeState
78453      * @class
78454      */
78455     var DimensionLineCreationState = /** @class */ (function (_super) {
78456         __extends(DimensionLineCreationState, _super);
78457         function DimensionLineCreationState(__parent) {
78458             var _this = _super.call(this, __parent) || this;
78459             _this.__parent = __parent;
78460             if (_this.magnetismEnabled === undefined) {
78461                 _this.magnetismEnabled = false;
78462             }
78463             return _this;
78464         }
78465         /**
78466          *
78467          * @return {PlanController.Mode}
78468          */
78469         DimensionLineCreationState.prototype.getMode = function () {
78470             return PlanController.Mode.DIMENSION_LINE_CREATION_$LI$();
78471         };
78472         /**
78473          *
78474          */
78475         DimensionLineCreationState.prototype.enter = function () {
78476             this.__parent.getView().setCursor(PlanView.CursorType.DRAW);
78477             this.toggleMagnetism(this.__parent.wasMagnetismToggledLastMousePress());
78478         };
78479         /**
78480          *
78481          * @param {number} x
78482          * @param {number} y
78483          */
78484         DimensionLineCreationState.prototype.moveMouse = function (x, y) {
78485             if (this.__parent.feedbackDisplayed) {
78486                 this.__parent.getView().setAlignmentFeedback(DimensionLine, null, x, y, false);
78487                 var dimensionLine = this.__parent.getMeasuringDimensionLineAt(x, y, this.magnetismEnabled);
78488                 if (dimensionLine != null) {
78489                     this.__parent.getView().setDimensionLinesFeedback(/* asList */ [dimensionLine].slice(0));
78490                 }
78491                 else {
78492                     this.__parent.getView().setDimensionLinesFeedback(null);
78493                 }
78494             }
78495         };
78496         /**
78497          *
78498          * @param {number} x
78499          * @param {number} y
78500          * @param {number} clickCount
78501          * @param {boolean} shiftDown
78502          * @param {boolean} duplicationActivated
78503          */
78504         DimensionLineCreationState.prototype.pressMouse = function (x, y, clickCount, shiftDown, duplicationActivated) {
78505             if (clickCount === 1) {
78506                 if (this.__parent.wasDuplicationActivatedLastMousePress()) {
78507                     this.__parent.getView().deleteFeedback();
78508                     this.__parent.createDimensionLine(x, y);
78509                 }
78510                 else {
78511                     this.__parent.setState(this.__parent.getDimensionLineDrawingState());
78512                 }
78513             }
78514         };
78515         /**
78516          *
78517          * @param {boolean} editionActivated
78518          */
78519         DimensionLineCreationState.prototype.setEditionActivated = function (editionActivated) {
78520             if (editionActivated) {
78521                 this.__parent.setState(this.__parent.getDimensionLineDrawingState());
78522                 this.setEditionActivated(editionActivated);
78523             }
78524         };
78525         /**
78526          *
78527          * @param {boolean} magnetismToggled
78528          */
78529         DimensionLineCreationState.prototype.toggleMagnetism = function (magnetismToggled) {
78530             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
78531             if (this.__parent.getPointerTypeLastMousePress() !== View.PointerType.TOUCH) {
78532                 this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
78533             }
78534         };
78535         /**
78536          *
78537          */
78538         DimensionLineCreationState.prototype.exit = function () {
78539             this.__parent.getView().deleteFeedback();
78540         };
78541         return DimensionLineCreationState;
78542     }(PlanController.AbstractModeChangeState));
78543     PlanController.DimensionLineCreationState = DimensionLineCreationState;
78544     DimensionLineCreationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.DimensionLineCreationState";
78545     /**
78546      * Room creation state. This state manages transition to
78547      * other modes, and initial room creation.
78548      * @extends PlanController.AbstractModeChangeState
78549      * @class
78550      */
78551     var RoomCreationState = /** @class */ (function (_super) {
78552         __extends(RoomCreationState, _super);
78553         function RoomCreationState(__parent) {
78554             var _this = _super.call(this, __parent) || this;
78555             _this.__parent = __parent;
78556             if (_this.magnetismEnabled === undefined) {
78557                 _this.magnetismEnabled = false;
78558             }
78559             return _this;
78560         }
78561         /**
78562          *
78563          * @return {PlanController.Mode}
78564          */
78565         RoomCreationState.prototype.getMode = function () {
78566             return PlanController.Mode.ROOM_CREATION_$LI$();
78567         };
78568         /**
78569          *
78570          */
78571         RoomCreationState.prototype.enter = function () {
78572             this.__parent.getView().setCursor(PlanView.CursorType.DRAW);
78573             this.toggleMagnetism(this.__parent.wasMagnetismToggledLastMousePress());
78574         };
78575         /**
78576          *
78577          * @param {number} x
78578          * @param {number} y
78579          */
78580         RoomCreationState.prototype.moveMouse = function (x, y) {
78581             if (this.__parent.feedbackDisplayed && this.magnetismEnabled) {
78582                 var point = new PlanController.PointMagnetizedToClosestWallOrRoomPoint(this.__parent, x, y);
78583                 if (point.isMagnetized()) {
78584                     this.__parent.getView().setAlignmentFeedback(Room, null, point.getX(), point.getY(), point.isMagnetized());
78585                 }
78586                 else {
78587                     var pointWithAngleMagnetism = new PlanController.RoomPointWithAngleMagnetism(this.__parent, null, -1, this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove(), this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
78588                     this.__parent.getView().setAlignmentFeedback(Room, null, pointWithAngleMagnetism.getX(), pointWithAngleMagnetism.getY(), point.isMagnetized());
78589                 }
78590             }
78591             else {
78592                 this.__parent.getView().setAlignmentFeedback(Room, null, x, y, false);
78593             }
78594         };
78595         /**
78596          *
78597          * @param {number} x
78598          * @param {number} y
78599          * @param {number} clickCount
78600          * @param {boolean} shiftDown
78601          * @param {boolean} duplicationActivated
78602          */
78603         RoomCreationState.prototype.pressMouse = function (x, y, clickCount, shiftDown, duplicationActivated) {
78604             this.__parent.setState(this.__parent.getRoomDrawingState());
78605         };
78606         /**
78607          *
78608          * @param {boolean} editionActivated
78609          */
78610         RoomCreationState.prototype.setEditionActivated = function (editionActivated) {
78611             if (editionActivated) {
78612                 this.__parent.setState(this.__parent.getRoomDrawingState());
78613                 this.setEditionActivated(editionActivated);
78614             }
78615         };
78616         /**
78617          *
78618          * @param {boolean} magnetismToggled
78619          */
78620         RoomCreationState.prototype.toggleMagnetism = function (magnetismToggled) {
78621             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
78622             if (this.__parent.getPointerTypeLastMousePress() !== View.PointerType.TOUCH) {
78623                 this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
78624             }
78625         };
78626         /**
78627          *
78628          */
78629         RoomCreationState.prototype.exit = function () {
78630             this.__parent.getView().deleteFeedback();
78631         };
78632         return RoomCreationState;
78633     }(PlanController.AbstractModeChangeState));
78634     PlanController.RoomCreationState = RoomCreationState;
78635     RoomCreationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RoomCreationState";
78636     /**
78637      * Polyline creation state. This state manages transition to
78638      * other modes, and initial polyline creation.
78639      * @extends PlanController.AbstractModeChangeState
78640      * @class
78641      */
78642     var PolylineCreationState = /** @class */ (function (_super) {
78643         __extends(PolylineCreationState, _super);
78644         function PolylineCreationState(__parent) {
78645             var _this = _super.call(this, __parent) || this;
78646             _this.__parent = __parent;
78647             return _this;
78648         }
78649         /**
78650          *
78651          * @return {PlanController.Mode}
78652          */
78653         PolylineCreationState.prototype.getMode = function () {
78654             return PlanController.Mode.POLYLINE_CREATION_$LI$();
78655         };
78656         /**
78657          *
78658          */
78659         PolylineCreationState.prototype.enter = function () {
78660             this.__parent.getView().setCursor(PlanView.CursorType.DRAW);
78661         };
78662         /**
78663          *
78664          * @param {number} x
78665          * @param {number} y
78666          * @param {number} clickCount
78667          * @param {boolean} shiftDown
78668          * @param {boolean} duplicationActivated
78669          */
78670         PolylineCreationState.prototype.pressMouse = function (x, y, clickCount, shiftDown, duplicationActivated) {
78671             this.__parent.setState(this.__parent.getPolylineDrawingState());
78672         };
78673         /**
78674          *
78675          * @param {boolean} editionActivated
78676          */
78677         PolylineCreationState.prototype.setEditionActivated = function (editionActivated) {
78678             if (editionActivated) {
78679                 this.__parent.setState(this.__parent.getPolylineDrawingState());
78680                 this.setEditionActivated(editionActivated);
78681             }
78682         };
78683         return PolylineCreationState;
78684     }(PlanController.AbstractModeChangeState));
78685     PlanController.PolylineCreationState = PolylineCreationState;
78686     PolylineCreationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PolylineCreationState";
78687     /**
78688      * Label creation state. This state manages transition to
78689      * other modes, and initial label creation.
78690      * @extends PlanController.AbstractModeChangeState
78691      * @class
78692      */
78693     var LabelCreationState = /** @class */ (function (_super) {
78694         __extends(LabelCreationState, _super);
78695         function LabelCreationState(__parent) {
78696             var _this = _super.call(this, __parent) || this;
78697             _this.__parent = __parent;
78698             return _this;
78699         }
78700         /**
78701          *
78702          * @return {PlanController.Mode}
78703          */
78704         LabelCreationState.prototype.getMode = function () {
78705             return PlanController.Mode.LABEL_CREATION_$LI$();
78706         };
78707         /**
78708          *
78709          */
78710         LabelCreationState.prototype.enter = function () {
78711             this.__parent.getView().setCursor(PlanView.CursorType.DRAW);
78712         };
78713         /**
78714          *
78715          * @param {number} x
78716          * @param {number} y
78717          * @param {number} clickCount
78718          * @param {boolean} shiftDown
78719          * @param {boolean} duplicationActivated
78720          */
78721         LabelCreationState.prototype.pressMouse = function (x, y, clickCount, shiftDown, duplicationActivated) {
78722             this.__parent.createLabel(x, y);
78723             if (this.__parent.getPointerTypeLastMousePress() === View.PointerType.TOUCH) {
78724                 this.__parent.setState(this.__parent.getSelectionState());
78725             }
78726         };
78727         return LabelCreationState;
78728     }(PlanController.AbstractModeChangeState));
78729     PlanController.LabelCreationState = LabelCreationState;
78730     LabelCreationState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.LabelCreationState";
78731     /**
78732      * Wall drawing state. This state manages wall creation at each mouse press.
78733      * @extends PlanController.AbstractWallState
78734      * @class
78735      */
78736     var WallDrawingState = /** @class */ (function (_super) {
78737         __extends(WallDrawingState, _super);
78738         function WallDrawingState(__parent) {
78739             var _this = _super.call(this, __parent) || this;
78740             _this.__parent = __parent;
78741             if (_this.xStart === undefined) {
78742                 _this.xStart = 0;
78743             }
78744             if (_this.yStart === undefined) {
78745                 _this.yStart = 0;
78746             }
78747             if (_this.xLastEnd === undefined) {
78748                 _this.xLastEnd = 0;
78749             }
78750             if (_this.yLastEnd === undefined) {
78751                 _this.yLastEnd = 0;
78752             }
78753             if (_this.wallStartAtStart === undefined) {
78754                 _this.wallStartAtStart = null;
78755             }
78756             if (_this.wallEndAtStart === undefined) {
78757                 _this.wallEndAtStart = null;
78758             }
78759             if (_this.newWall === undefined) {
78760                 _this.newWall = null;
78761             }
78762             if (_this.wallStartAtEnd === undefined) {
78763                 _this.wallStartAtEnd = null;
78764             }
78765             if (_this.wallEndAtEnd === undefined) {
78766                 _this.wallEndAtEnd = null;
78767             }
78768             if (_this.lastWall === undefined) {
78769                 _this.lastWall = null;
78770             }
78771             if (_this.oldSelection === undefined) {
78772                 _this.oldSelection = null;
78773             }
78774             if (_this.oldBasePlanLocked === undefined) {
78775                 _this.oldBasePlanLocked = false;
78776             }
78777             if (_this.oldAllLevelsSelection === undefined) {
78778                 _this.oldAllLevelsSelection = false;
78779             }
78780             if (_this.newWalls === undefined) {
78781                 _this.newWalls = null;
78782             }
78783             if (_this.magnetismEnabled === undefined) {
78784                 _this.magnetismEnabled = false;
78785             }
78786             if (_this.alignmentActivated === undefined) {
78787                 _this.alignmentActivated = false;
78788             }
78789             if (_this.roundWall === undefined) {
78790                 _this.roundWall = false;
78791             }
78792             if (_this.lastWallCreationTime === undefined) {
78793                 _this.lastWallCreationTime = 0;
78794             }
78795             if (_this.wallArcExtent === undefined) {
78796                 _this.wallArcExtent = null;
78797             }
78798             return _this;
78799         }
78800         /**
78801          *
78802          * @return {PlanController.Mode}
78803          */
78804         WallDrawingState.prototype.getMode = function () {
78805             return PlanController.Mode.WALL_CREATION_$LI$();
78806         };
78807         /**
78808          *
78809          * @return {boolean}
78810          */
78811         WallDrawingState.prototype.isModificationState = function () {
78812             return true;
78813         };
78814         /**
78815          *
78816          * @return {boolean}
78817          */
78818         WallDrawingState.prototype.isBasePlanModificationState = function () {
78819             return true;
78820         };
78821         /**
78822          *
78823          * @param {PlanController.Mode} mode
78824          */
78825         WallDrawingState.prototype.setMode = function (mode) {
78826             this.escape();
78827             if (mode === PlanController.Mode.SELECTION_$LI$()) {
78828                 this.__parent.setState(this.__parent.getSelectionState());
78829             }
78830             else if (mode === PlanController.Mode.PANNING_$LI$()) {
78831                 this.__parent.setState(this.__parent.getPanningState());
78832             }
78833             else if (mode === PlanController.Mode.ROOM_CREATION_$LI$()) {
78834                 this.__parent.setState(this.__parent.getRoomCreationState());
78835             }
78836             else if (mode === PlanController.Mode.POLYLINE_CREATION_$LI$()) {
78837                 this.__parent.setState(this.__parent.getPolylineCreationState());
78838             }
78839             else if (mode === PlanController.Mode.DIMENSION_LINE_CREATION_$LI$()) {
78840                 this.__parent.setState(this.__parent.getDimensionLineCreationState());
78841             }
78842             else if (mode === PlanController.Mode.LABEL_CREATION_$LI$()) {
78843                 this.__parent.setState(this.__parent.getLabelCreationState());
78844             }
78845         };
78846         /**
78847          *
78848          */
78849         WallDrawingState.prototype.enter = function () {
78850             _super.prototype.enter.call(this);
78851             this.oldSelection = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
78852             this.oldBasePlanLocked = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked();
78853             this.oldAllLevelsSelection = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection();
78854             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
78855             this.toggleMagnetism(this.__parent.wasMagnetismToggledLastMousePress());
78856             this.xStart = this.__parent.getXLastMouseMove();
78857             this.yStart = this.__parent.getYLastMouseMove();
78858             this.wallEndAtStart = this.__parent.getWallEndAt(this.xStart, this.yStart, null);
78859             if (this.wallEndAtStart != null) {
78860                 this.wallStartAtStart = null;
78861                 this.xStart = this.wallEndAtStart.getXEnd();
78862                 this.yStart = this.wallEndAtStart.getYEnd();
78863             }
78864             else {
78865                 this.wallStartAtStart = this.__parent.getWallStartAt(this.xStart, this.yStart, null);
78866                 if (this.wallStartAtStart != null) {
78867                     this.xStart = this.wallStartAtStart.getXStart();
78868                     this.yStart = this.wallStartAtStart.getYStart();
78869                 }
78870                 else if (this.magnetismEnabled) {
78871                     var point = new PlanController.WallPointWithAngleMagnetism(this.__parent, null, this.xStart, this.yStart, this.xStart, this.yStart);
78872                     this.xStart = point.getX();
78873                     this.yStart = point.getY();
78874                 }
78875             }
78876             this.newWall = null;
78877             this.wallStartAtEnd = null;
78878             this.wallEndAtEnd = null;
78879             this.lastWall = null;
78880             this.newWalls = ([]);
78881             this.lastWallCreationTime = -1;
78882             this.__parent.deselectAll();
78883             this.setDuplicationActivated(this.__parent.wasDuplicationActivatedLastMousePress());
78884             if (this.__parent.feedbackDisplayed) {
78885                 this.__parent.getView().setAlignmentFeedback(Wall, null, this.xStart, this.yStart, false);
78886             }
78887         };
78888         /**
78889          *
78890          * @param {number} x
78891          * @param {number} y
78892          */
78893         WallDrawingState.prototype.moveMouse = function (x, y) {
78894             var planView = this.__parent.getView();
78895             var xEnd;
78896             var yEnd;
78897             if (this.alignmentActivated) {
78898                 var point = new PlanController.PointWithAngleMagnetism(this.xStart, this.yStart, x, y, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit(), planView.getPixelLength());
78899                 xEnd = point.getX();
78900                 yEnd = point.getY();
78901             }
78902             else if (this.magnetismEnabled) {
78903                 var point = new PlanController.WallPointWithAngleMagnetism(this.__parent, this.newWall, this.xStart, this.yStart, x, y);
78904                 xEnd = point.getX();
78905                 yEnd = point.getY();
78906             }
78907             else {
78908                 xEnd = x;
78909                 yEnd = y;
78910             }
78911             if (this.newWall == null) {
78912                 this.newWall = this.__parent.createWall(this.xStart, this.yStart, xEnd, yEnd, this.wallStartAtStart, this.wallEndAtStart);
78913                 /* add */ (this.newWalls.push(this.newWall) > 0);
78914             }
78915             else if (this.wallArcExtent != null) {
78916                 this.wallArcExtent = this.getArcExtent(this.newWall.getXStart(), this.newWall.getXEnd(), this.newWall.getYStart(), this.newWall.getYEnd(), x, y);
78917                 if (this.alignmentActivated || this.magnetismEnabled) {
78918                     this.wallArcExtent = (function (x) { return x * Math.PI / 180; })(Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(this.wallArcExtent)));
78919                 }
78920                 this.newWall.setArcExtent(this.wallArcExtent);
78921             }
78922             else {
78923                 this.newWall.setXEnd(xEnd);
78924                 this.newWall.setYEnd(yEnd);
78925             }
78926             if (this.__parent.feedbackDisplayed) {
78927                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.newWall, false), x, y);
78928                 planView.setAlignmentFeedback(Wall, this.newWall, xEnd, yEnd, false);
78929                 this.showWallAngleFeedback(this.newWall, false);
78930             }
78931             this.wallStartAtEnd = this.__parent.getWallStartAt(xEnd, yEnd, this.newWall);
78932             if (this.wallStartAtEnd != null) {
78933                 this.wallEndAtEnd = null;
78934                 this.__parent.selectItem(this.wallStartAtEnd);
78935             }
78936             else {
78937                 this.wallEndAtEnd = this.__parent.getWallEndAt(xEnd, yEnd, this.newWall);
78938                 if (this.wallEndAtEnd != null) {
78939                     this.__parent.selectItem(this.wallEndAtEnd);
78940                 }
78941                 else {
78942                     this.__parent.deselectAll();
78943                 }
78944             }
78945             planView.makePointVisible(x, y);
78946             this.xLastEnd = xEnd;
78947             this.yLastEnd = yEnd;
78948         };
78949         /**
78950          *
78951          * @param {number} x
78952          * @param {number} y
78953          * @param {number} clickCount
78954          * @param {boolean} shiftDown
78955          * @param {boolean} duplicationActivated
78956          */
78957         WallDrawingState.prototype.pressMouse = function (x, y, clickCount, shiftDown, duplicationActivated) {
78958             if (clickCount === 2) {
78959                 var selectableItem = this.__parent.getSelectableItemAt(x, y);
78960                 if ( /* size */this.newWalls.length === 0 && (selectableItem != null && selectableItem instanceof Room)) {
78961                     this.createWallsAroundRoom(selectableItem);
78962                 }
78963                 else {
78964                     if (this.roundWall && this.newWall != null) {
78965                         this.endWallCreation();
78966                     }
78967                     if (this.lastWall != null) {
78968                         this.__parent.joinNewWallEndToWall(this.lastWall, this.wallStartAtEnd, this.wallEndAtEnd);
78969                     }
78970                 }
78971                 this.validateDrawnWalls();
78972             }
78973             else {
78974                 if (this.newWall != null && this.newWall.getStartPointToEndPointDistance() > 0) {
78975                     if (this.roundWall && this.wallArcExtent == null) {
78976                         this.wallArcExtent = Math.PI;
78977                         this.newWall.setArcExtent(this.wallArcExtent);
78978                         if (this.__parent.feedbackDisplayed) {
78979                             this.__parent.getView().setToolTipFeedback(this.getToolTipFeedbackText(this.newWall, false), x, y);
78980                         }
78981                     }
78982                     else {
78983                         this.__parent.getView().deleteToolTipFeedback();
78984                         this.__parent.selectItem(this.newWall);
78985                         this.endWallCreation();
78986                     }
78987                 }
78988             }
78989         };
78990         /**
78991          * Creates walls around the given <code>room</code>.
78992          * @param {Room} room
78993          * @private
78994          */
78995         WallDrawingState.prototype.createWallsAroundRoom = function (room) {
78996             if (room.isSingular()) {
78997                 var roomPoints = room.getPoints();
78998                 var pointsList = ( /* asList */roomPoints.slice(0).slice(0));
78999                 if (!room.isClockwise()) {
79000                     /* reverse */ pointsList.reverse();
79001                 }
79002                 for (var i = 0; i < /* size */ pointsList.length;) {
79003                     {
79004                         var point = pointsList[i];
79005                         var nextPoint = pointsList[(i + 1) % /* size */ pointsList.length];
79006                         if (point[0] === nextPoint[0] && point[1] === nextPoint[1]) {
79007                             /* remove */ pointsList.splice(i, 1)[0];
79008                         }
79009                         else {
79010                             i++;
79011                         }
79012                     }
79013                     ;
79014                 }
79015                 roomPoints = /* toArray */ pointsList.slice(0);
79016                 var halfWallThickness = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getNewWallThickness() / 2;
79017                 var largerRoomPoints = (function (s) { var a = []; while (s-- > 0)
79018                     a.push(null); return a; })(roomPoints.length);
79019                 for (var i = 0; i < roomPoints.length; i++) {
79020                     {
79021                         var point = roomPoints[i];
79022                         var previousPoint = roomPoints[(i + roomPoints.length - 1) % roomPoints.length];
79023                         var nextPoint = roomPoints[(i + 1) % roomPoints.length];
79024                         var previousAngle = Math.atan2(point[0] - previousPoint[0], previousPoint[1] - point[1]);
79025                         var deltaX = (Math.cos(previousAngle) * halfWallThickness);
79026                         var deltaY = (Math.sin(previousAngle) * halfWallThickness);
79027                         var point1 = [previousPoint[0] - deltaX, previousPoint[1] - deltaY];
79028                         var point2 = [point[0] - deltaX, point[1] - deltaY];
79029                         var nextAngle = Math.atan2(nextPoint[0] - point[0], point[1] - nextPoint[1]);
79030                         deltaX = (Math.cos(nextAngle) * halfWallThickness);
79031                         deltaY = (Math.sin(nextAngle) * halfWallThickness);
79032                         var point3 = [point[0] - deltaX, point[1] - deltaY];
79033                         var point4 = [nextPoint[0] - deltaX, nextPoint[1] - deltaY];
79034                         largerRoomPoints[i] = PlanController.computeIntersection(point1, point2, point3, point4);
79035                     }
79036                     ;
79037                 }
79038                 var lastWall = null;
79039                 var wallsArea = this.__parent.getWallsArea(false);
79040                 var thinThickness = 0.05;
79041                 for (var i = 0; i < largerRoomPoints.length; i++) {
79042                     {
79043                         var sidePoint = largerRoomPoints[i];
79044                         var nextSidePoint = largerRoomPoints[(i + 1) % roomPoints.length];
79045                         var lineArea = new java.awt.geom.Area(this.__parent.getPath(new Wall(sidePoint[0], sidePoint[1], nextSidePoint[0], nextSidePoint[1], thinThickness, 0).getPoints$()));
79046                         lineArea.subtract(wallsArea);
79047                         var newWallPaths = this.__parent.getAreaPaths(lineArea);
79048                         var roomSideWalls = ([]);
79049                         var ignoredWall = 0;
79050                         for (var j = 0; j < /* size */ newWallPaths.length; j++) {
79051                             {
79052                                 var newWallPoints = this.__parent.getPathPoints(/* get */ newWallPaths[j], false);
79053                                 if (newWallPoints.length > 4) {
79054                                     newWallPoints = this.__parent.getPathPoints(/* get */ newWallPaths[j], true);
79055                                 }
79056                                 if (newWallPoints.length === 4) {
79057                                     var point1 = void 0;
79058                                     var point2 = void 0;
79059                                     if (java.awt.geom.Point2D.distanceSq(newWallPoints[0][0], newWallPoints[0][1], newWallPoints[1][0], newWallPoints[1][1]) < java.awt.geom.Point2D.distanceSq(newWallPoints[0][0], newWallPoints[0][1], newWallPoints[3][0], newWallPoints[3][1])) {
79060                                         point1 = [(newWallPoints[0][0] + newWallPoints[1][0]) / 2, (newWallPoints[0][1] + newWallPoints[1][1]) / 2];
79061                                         point2 = [(newWallPoints[2][0] + newWallPoints[3][0]) / 2, (newWallPoints[2][1] + newWallPoints[3][1]) / 2];
79062                                     }
79063                                     else {
79064                                         point1 = [(newWallPoints[0][0] + newWallPoints[3][0]) / 2, (newWallPoints[0][1] + newWallPoints[3][1]) / 2];
79065                                         point2 = [(newWallPoints[1][0] + newWallPoints[2][0]) / 2, (newWallPoints[1][1] + newWallPoints[2][1]) / 2];
79066                                     }
79067                                     var startPoint = void 0;
79068                                     var endPoint = void 0;
79069                                     if (java.awt.geom.Point2D.distanceSq(point1[0], point1[1], sidePoint[0], sidePoint[1]) < java.awt.geom.Point2D.distanceSq(point2[0], point2[1], sidePoint[0], sidePoint[1])) {
79070                                         startPoint = point1;
79071                                         endPoint = point2;
79072                                     }
79073                                     else {
79074                                         startPoint = point2;
79075                                         endPoint = point1;
79076                                     }
79077                                     if (java.awt.geom.Point2D.distanceSq(startPoint[0], startPoint[1], endPoint[0], endPoint[1]) > 0.01) {
79078                                         /* add */ (roomSideWalls.push(this.__parent.createWall(startPoint[0], startPoint[1], endPoint[0], endPoint[1], null, lastWall != null && java.awt.geom.Point2D.distanceSq(lastWall.getXEnd(), lastWall.getYEnd(), startPoint[0], startPoint[1]) < 0.01 ? lastWall : null)) > 0);
79079                                     }
79080                                     else {
79081                                         ignoredWall++;
79082                                     }
79083                                 }
79084                             }
79085                             ;
79086                         }
79087                         if ( /* size */newWallPaths.length > ignoredWall && /* isEmpty */ (roomSideWalls.length == 0)) {
79088                             var existingWall = null;
79089                             {
79090                                 var array = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getWalls();
79091                                 for (var index = 0; index < array.length; index++) {
79092                                     var wall = array[index];
79093                                     {
79094                                         if (wall.isAtLevel(this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel()) && Math.abs(wall.getXStart() - sidePoint[0]) < 0.05 && Math.abs(wall.getYStart() - sidePoint[1]) < 0.05 && Math.abs(wall.getXEnd() - nextSidePoint[0]) < 0.05 && Math.abs(wall.getYEnd() - nextSidePoint[1]) < 0.05 && (wall.getArcExtent() == null || wall.getArcExtent() === 0)) {
79095                                             existingWall = wall;
79096                                             break;
79097                                         }
79098                                     }
79099                                 }
79100                             }
79101                             if (existingWall == null) {
79102                                 /* add */ (roomSideWalls.push(this.__parent.createWall(sidePoint[0], sidePoint[1], nextSidePoint[0], nextSidePoint[1], null, lastWall)) > 0);
79103                             }
79104                         }
79105                         if ( /* size */roomSideWalls.length > 0) {
79106                             /* sort */ (function (l, c) { if (c.compare)
79107                                 l.sort(function (e1, e2) { return c.compare(e1, e2); });
79108                             else
79109                                 l.sort(c); })(roomSideWalls, new WallDrawingState.WallDrawingState$0(this, sidePoint));
79110                             /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(this.newWalls, roomSideWalls);
79111                             lastWall = /* get */ roomSideWalls[ /* size */roomSideWalls.length - 1];
79112                         }
79113                         else {
79114                             lastWall = null;
79115                         }
79116                     }
79117                     ;
79118                 }
79119                 if (lastWall != null && java.awt.geom.Point2D.distanceSq(lastWall.getXEnd(), lastWall.getYEnd(), /* get */ this.newWalls[0].getXStart(), /* get */ this.newWalls[0].getYStart()) < 0.01) {
79120                     this.__parent.joinNewWallEndToWall(lastWall, /* get */ this.newWalls[0], null);
79121                 }
79122             }
79123         };
79124         WallDrawingState.prototype.validateDrawnWalls = function () {
79125             if ( /* size */this.newWalls.length > 0) {
79126                 this.__parent.postCreateWalls(this.newWalls, this.oldSelection, this.oldBasePlanLocked, this.oldAllLevelsSelection);
79127                 this.__parent.selectItems(this.newWalls);
79128             }
79129             if (this.__parent.getPointerTypeLastMousePress() === View.PointerType.TOUCH) {
79130                 this.__parent.setState(this.__parent.getSelectionState());
79131             }
79132             else {
79133                 this.__parent.setState(this.__parent.getWallCreationState());
79134             }
79135         };
79136         WallDrawingState.prototype.endWallCreation = function () {
79137             this.lastWall = this.wallEndAtStart = this.newWall;
79138             this.wallStartAtStart = null;
79139             this.xStart = this.newWall.getXEnd();
79140             this.yStart = this.newWall.getYEnd();
79141             this.newWall = null;
79142             this.wallArcExtent = null;
79143         };
79144         /**
79145          *
79146          * @param {boolean} editionActivated
79147          */
79148         WallDrawingState.prototype.setEditionActivated = function (editionActivated) {
79149             var _this = this;
79150             var planView = this.__parent.getView();
79151             if (editionActivated) {
79152                 planView.deleteFeedback();
79153                 if ( /* size */this.newWalls.length === 0 && this.wallEndAtStart == null && this.wallStartAtStart == null) {
79154                     planView.setToolTipEditedProperties(["X", "Y"], [this.xStart, this.yStart], this.xStart, this.yStart);
79155                 }
79156                 else {
79157                     if (this.newWall == null) {
79158                         this.createNextWall();
79159                     }
79160                     if (this.wallArcExtent == null) {
79161                         planView.setToolTipEditedProperties(["LENGTH", "ANGLE", "THICKNESS"], [this.newWall.getLength(), this.getWallAngleInDegrees$com_eteks_sweethome3d_model_Wall(this.newWall), this.newWall.getThickness()], this.newWall.getXEnd(), this.newWall.getYEnd());
79162                     }
79163                     else {
79164                         planView.setToolTipEditedProperties(["ARC_EXTENT"], [new Number((Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(this.wallArcExtent)) | 0)).valueOf()], this.newWall.getXEnd(), this.newWall.getYEnd());
79165                     }
79166                 }
79167                 if (this.__parent.feedbackDisplayed) {
79168                     this.showWallFeedback();
79169                 }
79170             }
79171             else {
79172                 if (this.newWall == null) {
79173                     var lengthUnit = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit();
79174                     var defaultLength = !lengthUnit.isMetric() ? 300 : LengthUnit.footToCentimeter(10);
79175                     this.xLastEnd = this.xStart + defaultLength;
79176                     this.yLastEnd = this.yStart;
79177                     this.newWall = this.__parent.createWall(this.xStart, this.yStart, this.xLastEnd, this.yLastEnd, this.wallStartAtStart, this.wallEndAtStart);
79178                     /* add */ (this.newWalls.push(this.newWall) > 0);
79179                     planView.deleteFeedback();
79180                     this.setEditionActivated(true);
79181                 }
79182                 else if (this.roundWall && this.wallArcExtent == null) {
79183                     this.wallArcExtent = Math.PI;
79184                     this.newWall.setArcExtent(this.wallArcExtent);
79185                     this.setEditionActivated(true);
79186                 }
79187                 else if ( /* currentTimeMillis */Date.now() - this.lastWallCreationTime < 300) {
79188                     if ( /* size */this.newWalls.length > 1) {
79189                         /* remove */ (function (a) { var index = a.indexOf(_this.newWall); if (index >= 0) {
79190                             a.splice(index, 1);
79191                             return true;
79192                         }
79193                         else {
79194                             return false;
79195                         } })(this.newWalls);
79196                         this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deleteWall(this.newWall);
79197                     }
79198                     this.validateDrawnWalls();
79199                 }
79200                 else {
79201                     this.endWallCreation();
79202                     if ( /* size */this.newWalls.length > 2 && this.wallStartAtEnd != null) {
79203                         this.__parent.joinNewWallEndToWall(this.lastWall, this.wallStartAtEnd, null);
79204                         this.validateDrawnWalls();
79205                         return;
79206                     }
79207                     this.createNextWall();
79208                     planView.deleteToolTipFeedback();
79209                     this.setEditionActivated(true);
79210                 }
79211             }
79212         };
79213         WallDrawingState.prototype.createNextWall = function () {
79214             var previousWall = this.wallEndAtStart != null ? this.wallEndAtStart : this.wallStartAtStart;
79215             var previousWallAngle = Math.PI - Math.atan2(previousWall.getYStart() - previousWall.getYEnd(), previousWall.getXStart() - previousWall.getXEnd());
79216             previousWallAngle -= Math.PI / 2;
79217             var previousWallSegmentDistance = previousWall.getStartPointToEndPointDistance();
79218             this.xLastEnd = (this.xStart + previousWallSegmentDistance * Math.cos(previousWallAngle));
79219             this.yLastEnd = (this.yStart - previousWallSegmentDistance * Math.sin(previousWallAngle));
79220             this.newWall = this.__parent.createWall(this.xStart, this.yStart, this.xLastEnd, this.yLastEnd, this.wallStartAtStart, previousWall);
79221             this.newWall.setThickness(previousWall.getThickness());
79222             /* add */ (this.newWalls.push(this.newWall) > 0);
79223             this.lastWallCreationTime = /* currentTimeMillis */ Date.now();
79224             this.__parent.deselectAll();
79225         };
79226         /**
79227          *
79228          * @param {string} editableProperty
79229          * @param {Object} value
79230          */
79231         WallDrawingState.prototype.updateEditableProperty = function (editableProperty, value) {
79232             if (this.newWall == null) {
79233                 var maximumLength = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMaximumLength();
79234                 switch ((editableProperty)) {
79235                     case "X":
79236                         this.xStart = value != null ? /* floatValue */ value : 0;
79237                         this.xStart = Math.max(-maximumLength, Math.min(this.xStart, maximumLength));
79238                         break;
79239                     case "Y":
79240                         this.yStart = value != null ? /* floatValue */ value : 0;
79241                         this.yStart = Math.max(-maximumLength, Math.min(this.yStart, maximumLength));
79242                         break;
79243                 }
79244             }
79245             else {
79246                 if (editableProperty === "THICKNESS") {
79247                     var thickness = value != null ? Math.abs(/* floatValue */ value) : 0;
79248                     thickness = Math.max(0.01, Math.min(thickness, 1000));
79249                     this.newWall.setThickness(thickness);
79250                 }
79251                 else if (editableProperty === "ARC_EXTENT") {
79252                     var arcExtent = (function (x) { return x * Math.PI / 180; })(value != null ? /* doubleValue */ value : 0);
79253                     this.wallArcExtent = ( /* signum */(function (f) { if (f > 0) {
79254                         return 1;
79255                     }
79256                     else if (f < 0) {
79257                         return -1;
79258                     }
79259                     else {
79260                         return 0;
79261                     } })(arcExtent) * Math.min(Math.abs(arcExtent), 3 * Math.PI / 2));
79262                     this.newWall.setArcExtent(this.wallArcExtent);
79263                     if (this.__parent.feedbackDisplayed) {
79264                         this.showWallAngleFeedback(this.newWall, false);
79265                     }
79266                     return;
79267                 }
79268                 else {
79269                     switch ((editableProperty)) {
79270                         case "LENGTH":
79271                             var length_2 = value != null ? /* floatValue */ value : 0;
79272                             length_2 = Math.max(0.001, Math.min(length_2, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMaximumLength()));
79273                             var wallAngle = Math.PI - Math.atan2(this.yStart - this.yLastEnd, this.xStart - this.xLastEnd);
79274                             this.xLastEnd = (this.xStart + length_2 * Math.cos(wallAngle));
79275                             this.yLastEnd = (this.yStart - length_2 * Math.sin(wallAngle));
79276                             break;
79277                         case "ANGLE":
79278                             wallAngle = /* toRadians */ (function (x) { return x * Math.PI / 180; })(value != null ? /* doubleValue */ value : 0);
79279                             var previousWall = this.newWall.getWallAtStart();
79280                             if (previousWall != null && previousWall.getStartPointToEndPointDistance() > 0) {
79281                                 wallAngle -= Math.atan2(previousWall.getYStart() - previousWall.getYEnd(), previousWall.getXStart() - previousWall.getXEnd());
79282                             }
79283                             var startPointToEndPointDistance = this.newWall.getStartPointToEndPointDistance();
79284                             this.xLastEnd = (this.xStart + startPointToEndPointDistance * Math.cos(wallAngle));
79285                             this.yLastEnd = (this.yStart - startPointToEndPointDistance * Math.sin(wallAngle));
79286                             break;
79287                         default:
79288                             return;
79289                     }
79290                     this.newWall.setXEnd(this.xLastEnd);
79291                     this.newWall.setYEnd(this.yLastEnd);
79292                 }
79293             }
79294             if (this.__parent.feedbackDisplayed) {
79295                 this.showWallFeedback();
79296             }
79297         };
79298         WallDrawingState.prototype.showWallFeedback = function () {
79299             var planView = this.__parent.getView();
79300             if (this.newWall == null) {
79301                 planView.setAlignmentFeedback(Wall, null, this.xStart, this.yStart, true);
79302                 planView.makePointVisible(this.xStart, this.yStart);
79303             }
79304             else {
79305                 planView.setAlignmentFeedback(Wall, this.newWall, this.xLastEnd, this.yLastEnd, false);
79306                 this.showWallAngleFeedback(this.newWall, false);
79307                 planView.makePointVisible(this.xStart, this.yStart);
79308                 planView.makePointVisible(this.xLastEnd, this.yLastEnd);
79309                 if ( /* size */this.newWalls.length > 2 && /* get */ this.newWalls[0].getWallAtStart() == null && /* get */ this.newWalls[0].containsWallStartAt(this.xLastEnd, this.yLastEnd, 0.001)) {
79310                     this.wallStartAtEnd = /* get */ this.newWalls[0];
79311                     this.__parent.selectItem(this.wallStartAtEnd);
79312                 }
79313                 else {
79314                     this.wallStartAtEnd = null;
79315                     this.__parent.deselectAll();
79316                 }
79317             }
79318         };
79319         /**
79320          *
79321          * @param {boolean} magnetismToggled
79322          */
79323         WallDrawingState.prototype.toggleMagnetism = function (magnetismToggled) {
79324             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
79325             if (this.newWall != null) {
79326                 this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
79327             }
79328         };
79329         /**
79330          *
79331          * @param {boolean} alignmentActivated
79332          */
79333         WallDrawingState.prototype.setAlignmentActivated = function (alignmentActivated) {
79334             this.alignmentActivated = alignmentActivated;
79335             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
79336         };
79337         /**
79338          *
79339          * @param {boolean} duplicationActivated
79340          */
79341         WallDrawingState.prototype.setDuplicationActivated = function (duplicationActivated) {
79342             this.roundWall = duplicationActivated;
79343         };
79344         /**
79345          *
79346          */
79347         WallDrawingState.prototype.escape = function () {
79348             var _this = this;
79349             if (this.newWall != null) {
79350                 this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deleteWall(this.newWall);
79351                 /* remove */ (function (a) { var index = a.indexOf(_this.newWall); if (index >= 0) {
79352                     a.splice(index, 1);
79353                     return true;
79354                 }
79355                 else {
79356                     return false;
79357                 } })(this.newWalls);
79358             }
79359             this.validateDrawnWalls();
79360         };
79361         /**
79362          *
79363          */
79364         WallDrawingState.prototype.exit = function () {
79365             var planView = this.__parent.getView();
79366             planView.deleteFeedback();
79367             this.wallStartAtStart = null;
79368             this.wallEndAtStart = null;
79369             this.newWall = null;
79370             this.wallArcExtent = null;
79371             this.wallStartAtEnd = null;
79372             this.wallEndAtEnd = null;
79373             this.lastWall = null;
79374             this.oldSelection = null;
79375             this.newWalls = null;
79376         };
79377         return WallDrawingState;
79378     }(PlanController.AbstractWallState));
79379     PlanController.WallDrawingState = WallDrawingState;
79380     WallDrawingState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.WallDrawingState";
79381     (function (WallDrawingState) {
79382         var WallDrawingState$0 = /** @class */ (function () {
79383             function WallDrawingState$0(__parent, sidePoint) {
79384                 this.sidePoint = sidePoint;
79385                 this.__parent = __parent;
79386             }
79387             WallDrawingState$0.prototype.compare = function (wall1, wall2) {
79388                 return /* compare */ (java.awt.geom.Point2D.distanceSq(wall1.getXStart(), wall1.getYStart(), this.sidePoint[0], this.sidePoint[1]) - java.awt.geom.Point2D.distanceSq(wall2.getXStart(), wall2.getYStart(), this.sidePoint[0], this.sidePoint[1]));
79389             };
79390             return WallDrawingState$0;
79391         }());
79392         WallDrawingState.WallDrawingState$0 = WallDrawingState$0;
79393     })(WallDrawingState = PlanController.WallDrawingState || (PlanController.WallDrawingState = {}));
79394     /**
79395      * Wall resize state. This state manages wall resizing.
79396      * @extends PlanController.AbstractWallState
79397      * @class
79398      */
79399     var WallResizeState = /** @class */ (function (_super) {
79400         __extends(WallResizeState, _super);
79401         function WallResizeState(__parent) {
79402             var _this = _super.call(this, __parent) || this;
79403             _this.__parent = __parent;
79404             if (_this.selectedWall === undefined) {
79405                 _this.selectedWall = null;
79406             }
79407             if (_this.startPoint === undefined) {
79408                 _this.startPoint = false;
79409             }
79410             if (_this.oldX === undefined) {
79411                 _this.oldX = 0;
79412             }
79413             if (_this.oldY === undefined) {
79414                 _this.oldY = 0;
79415             }
79416             if (_this.deltaXToResizePoint === undefined) {
79417                 _this.deltaXToResizePoint = 0;
79418             }
79419             if (_this.deltaYToResizePoint === undefined) {
79420                 _this.deltaYToResizePoint = 0;
79421             }
79422             if (_this.magnetismEnabled === undefined) {
79423                 _this.magnetismEnabled = false;
79424             }
79425             if (_this.alignmentActivated === undefined) {
79426                 _this.alignmentActivated = false;
79427             }
79428             return _this;
79429         }
79430         /**
79431          *
79432          * @return {PlanController.Mode}
79433          */
79434         WallResizeState.prototype.getMode = function () {
79435             return PlanController.Mode.SELECTION_$LI$();
79436         };
79437         /**
79438          *
79439          * @return {boolean}
79440          */
79441         WallResizeState.prototype.isModificationState = function () {
79442             return true;
79443         };
79444         /**
79445          *
79446          * @return {boolean}
79447          */
79448         WallResizeState.prototype.isBasePlanModificationState = function () {
79449             return true;
79450         };
79451         /**
79452          *
79453          */
79454         WallResizeState.prototype.enter = function () {
79455             _super.prototype.enter.call(this);
79456             this.selectedWall = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
79457             this.startPoint = this.selectedWall === this.__parent.getResizedWallStartAt(this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
79458             if (this.startPoint) {
79459                 this.oldX = this.selectedWall.getXStart();
79460                 this.oldY = this.selectedWall.getYStart();
79461             }
79462             else {
79463                 this.oldX = this.selectedWall.getXEnd();
79464                 this.oldY = this.selectedWall.getYEnd();
79465             }
79466             this.deltaXToResizePoint = this.__parent.getXLastMousePress() - this.oldX;
79467             this.deltaYToResizePoint = this.__parent.getYLastMousePress() - this.oldY;
79468             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
79469             this.toggleMagnetism(this.__parent.wasMagnetismToggledLastMousePress());
79470             var planView = this.__parent.getView();
79471             planView.setResizeIndicatorVisible(true);
79472             if (this.__parent.feedbackDisplayed) {
79473                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.selectedWall, true), this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
79474                 planView.setAlignmentFeedback(Wall, this.selectedWall, this.oldX, this.oldY, false);
79475                 this.showWallAngleFeedback(this.selectedWall, true);
79476                 planView.setDimensionLinesFeedback(this.getDimensionLinesAlongWall(this.selectedWall));
79477             }
79478         };
79479         /**
79480          *
79481          * @param {number} x
79482          * @param {number} y
79483          */
79484         WallResizeState.prototype.moveMouse = function (x, y) {
79485             var planView = this.__parent.getView();
79486             var newX = x - this.deltaXToResizePoint;
79487             var newY = y - this.deltaYToResizePoint;
79488             var opositeEndX = this.startPoint ? this.selectedWall.getXEnd() : this.selectedWall.getXStart();
79489             var opositeEndY = this.startPoint ? this.selectedWall.getYEnd() : this.selectedWall.getYStart();
79490             if (this.alignmentActivated) {
79491                 var point = new PlanController.PointWithAngleMagnetism(opositeEndX, opositeEndY, newX, newY, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit(), planView.getPixelLength());
79492                 newX = point.getX();
79493                 newY = point.getY();
79494             }
79495             else if (this.magnetismEnabled) {
79496                 var point = new PlanController.WallPointWithAngleMagnetism(this.__parent, this.selectedWall, opositeEndX, opositeEndY, newX, newY);
79497                 newX = point.getX();
79498                 newY = point.getY();
79499             }
79500             PlanController.moveWallPoint(this.selectedWall, newX, newY, this.startPoint);
79501             if (this.__parent.feedbackDisplayed) {
79502                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.selectedWall, true), x, y);
79503                 planView.setAlignmentFeedback(Wall, this.selectedWall, newX, newY, false);
79504                 this.showWallAngleFeedback(this.selectedWall, true);
79505                 planView.setDimensionLinesFeedback(this.getDimensionLinesAlongWall(this.selectedWall));
79506             }
79507             planView.makePointVisible(x, y);
79508         };
79509         WallResizeState.prototype.getDimensionLinesAlongWall = function (wall) {
79510             var dimensionLines = ([]);
79511             if (wall.getArcExtent() == null || wall.getArcExtent() === 0) {
79512                 var offset = 20 / this.__parent.getView().getScale();
79513                 var wallPoints = wall.getPoints$();
79514                 var roomPaths = this.__parent.getRoomPathsFromWalls();
79515                 for (var i = 0; i < /* size */ roomPaths.length; i++) {
79516                     {
79517                         var roomPoints = this.__parent.getPathPoints(/* get */ roomPaths[i], true);
79518                         for (var j = 0; j < roomPoints.length; j++) {
79519                             {
79520                                 var startPoint = roomPoints[j];
79521                                 var endPoint = roomPoints[(j + 1) % roomPoints.length];
79522                                 var segmentPartOfLeftSide = java.awt.geom.Line2D.ptLineDistSq(wallPoints[0][0], wallPoints[0][1], wallPoints[1][0], wallPoints[1][1], startPoint[0], startPoint[1]) < 1.0E-4 && java.awt.geom.Line2D.ptLineDistSq(wallPoints[0][0], wallPoints[0][1], wallPoints[1][0], wallPoints[1][1], endPoint[0], endPoint[1]) < 1.0E-4;
79523                                 var segmentAccepted = void 0;
79524                                 if (segmentPartOfLeftSide) {
79525                                     segmentAccepted = java.awt.geom.Line2D.ptSegDistSq(wallPoints[0][0], wallPoints[0][1], wallPoints[1][0], wallPoints[1][1], startPoint[0], startPoint[1]) < 1.0E-4 || java.awt.geom.Line2D.ptSegDistSq(wallPoints[0][0], wallPoints[0][1], wallPoints[1][0], wallPoints[1][1], endPoint[0], endPoint[1]) < 1.0E-4 || java.awt.geom.Line2D.ptSegDistSq(startPoint[0], startPoint[1], endPoint[0], endPoint[1], wallPoints[0][0], wallPoints[0][1]) < 1.0E-4 || java.awt.geom.Line2D.ptSegDistSq(startPoint[0], startPoint[1], endPoint[0], endPoint[1], wallPoints[1][0], wallPoints[1][1]) < 1.0E-4;
79526                                 }
79527                                 else {
79528                                     segmentAccepted = java.awt.geom.Line2D.ptLineDistSq(wallPoints[2][0], wallPoints[2][1], wallPoints[3][0], wallPoints[3][1], startPoint[0], startPoint[1]) < 1.0E-4 && java.awt.geom.Line2D.ptLineDistSq(wallPoints[2][0], wallPoints[2][1], wallPoints[3][0], wallPoints[3][1], endPoint[0], endPoint[1]) < 1.0E-4 && (java.awt.geom.Line2D.ptSegDistSq(wallPoints[2][0], wallPoints[2][1], wallPoints[3][0], wallPoints[3][1], startPoint[0], startPoint[1]) < 1.0E-4 || java.awt.geom.Line2D.ptSegDistSq(wallPoints[2][0], wallPoints[2][1], wallPoints[3][0], wallPoints[3][1], endPoint[0], endPoint[1]) < 1.0E-4 || java.awt.geom.Line2D.ptSegDistSq(startPoint[0], startPoint[1], endPoint[0], endPoint[1], wallPoints[2][0], wallPoints[2][1]) < 1.0E-4 || java.awt.geom.Line2D.ptSegDistSq(startPoint[0], startPoint[1], endPoint[0], endPoint[1], wallPoints[3][0], wallPoints[3][1]) < 1.0E-4);
79529                                 }
79530                                 if (segmentAccepted) {
79531                                     /* add */ (dimensionLines.push(this.__parent.getDimensionLineBetweenPoints(startPoint, endPoint, this.isDimensionInsideWall(wall, startPoint, endPoint) ? -offset : offset, false)) > 0);
79532                                 }
79533                             }
79534                             ;
79535                         }
79536                     }
79537                     ;
79538                 }
79539                 for (var i = dimensionLines.length - 1; i >= 0; i--) {
79540                     {
79541                         if ( /* get */dimensionLines[i].getLength() < 0.01) {
79542                             /* remove */ dimensionLines.splice(i, 1)[0];
79543                         }
79544                     }
79545                     ;
79546                 }
79547                 if ( /* size */dimensionLines.length === 2 && Math.abs(/* get */ dimensionLines[0].getLength() - /* get */ dimensionLines[1].getLength()) < 0.01) {
79548                     /* remove */ dimensionLines.splice(1, 1)[0];
79549                 }
79550             }
79551             return dimensionLines;
79552         };
79553         WallResizeState.prototype.isDimensionInsideWall = function (wall, point1, point2) {
79554             var rotation = java.awt.geom.AffineTransform.getRotateInstance(Math.atan2(point2[1] - point1[1], point2[0] - point1[0]), point1[0], point1[1]);
79555             var dimensionPoint = [(point1[0] + java.awt.geom.Point2D.distance(point1[0], point1[1], point2[0], point2[1]) / 2), point1[1] + 0.01];
79556             rotation.transform(dimensionPoint, 0, dimensionPoint, 0, 1);
79557             return wall.containsPoint$float$float$float(dimensionPoint[0], dimensionPoint[1], 0);
79558         };
79559         /**
79560          *
79561          * @param {number} x
79562          * @param {number} y
79563          */
79564         WallResizeState.prototype.releaseMouse = function (x, y) {
79565             this.__parent.postWallResize(this.selectedWall, this.oldX, this.oldY, this.startPoint);
79566             this.__parent.setState(this.__parent.getSelectionState());
79567         };
79568         /**
79569          *
79570          * @param {boolean} magnetismToggled
79571          */
79572         WallResizeState.prototype.toggleMagnetism = function (magnetismToggled) {
79573             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
79574             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
79575         };
79576         /**
79577          *
79578          * @param {boolean} alignmentActivated
79579          */
79580         WallResizeState.prototype.setAlignmentActivated = function (alignmentActivated) {
79581             this.alignmentActivated = alignmentActivated;
79582             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
79583         };
79584         /**
79585          *
79586          */
79587         WallResizeState.prototype.escape = function () {
79588             PlanController.moveWallPoint(this.selectedWall, this.oldX, this.oldY, this.startPoint);
79589             this.__parent.setState(this.__parent.getSelectionState());
79590         };
79591         /**
79592          *
79593          */
79594         WallResizeState.prototype.exit = function () {
79595             var planView = this.__parent.getView();
79596             planView.setResizeIndicatorVisible(false);
79597             planView.deleteFeedback();
79598             this.selectedWall = null;
79599         };
79600         return WallResizeState;
79601     }(PlanController.AbstractWallState));
79602     PlanController.WallResizeState = WallResizeState;
79603     WallResizeState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.WallResizeState";
79604     /**
79605      * Wall arc extent state. This state manages wall arc extent change.
79606      * @extends PlanController.AbstractWallState
79607      * @class
79608      */
79609     var WallArcExtentState = /** @class */ (function (_super) {
79610         __extends(WallArcExtentState, _super);
79611         function WallArcExtentState(__parent) {
79612             var _this = _super.call(this, __parent) || this;
79613             _this.__parent = __parent;
79614             if (_this.selectedWall === undefined) {
79615                 _this.selectedWall = null;
79616             }
79617             if (_this.oldArcExtent === undefined) {
79618                 _this.oldArcExtent = null;
79619             }
79620             if (_this.deltaXToMiddlePoint === undefined) {
79621                 _this.deltaXToMiddlePoint = 0;
79622             }
79623             if (_this.deltaYToMiddlePoint === undefined) {
79624                 _this.deltaYToMiddlePoint = 0;
79625             }
79626             if (_this.magnetismEnabled === undefined) {
79627                 _this.magnetismEnabled = false;
79628             }
79629             if (_this.alignmentActivated === undefined) {
79630                 _this.alignmentActivated = false;
79631             }
79632             return _this;
79633         }
79634         /**
79635          *
79636          * @return {PlanController.Mode}
79637          */
79638         WallArcExtentState.prototype.getMode = function () {
79639             return PlanController.Mode.SELECTION_$LI$();
79640         };
79641         /**
79642          *
79643          * @return {boolean}
79644          */
79645         WallArcExtentState.prototype.isModificationState = function () {
79646             return true;
79647         };
79648         /**
79649          *
79650          * @return {boolean}
79651          */
79652         WallArcExtentState.prototype.isBasePlanModificationState = function () {
79653             return true;
79654         };
79655         /**
79656          *
79657          */
79658         WallArcExtentState.prototype.enter = function () {
79659             _super.prototype.enter.call(this);
79660             this.selectedWall = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
79661             this.oldArcExtent = this.selectedWall.getArcExtent();
79662             var wallPoints = this.selectedWall.getPoints$();
79663             var leftSideMiddlePointIndex = (wallPoints.length / 4 | 0);
79664             var rightSideMiddlePointIndex = wallPoints.length - 1 - leftSideMiddlePointIndex;
79665             if (wallPoints.length % 4 === 0) {
79666                 leftSideMiddlePointIndex--;
79667             }
79668             var middleX = (wallPoints[leftSideMiddlePointIndex][0] + wallPoints[rightSideMiddlePointIndex][0]) / 2;
79669             var middleY = (wallPoints[leftSideMiddlePointIndex][1] + wallPoints[rightSideMiddlePointIndex][1]) / 2;
79670             this.deltaXToMiddlePoint = this.__parent.getXLastMousePress() - middleX;
79671             this.deltaYToMiddlePoint = this.__parent.getYLastMousePress() - middleY;
79672             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
79673             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (this.__parent.wasMagnetismToggledLastMousePress());
79674             var planView = this.__parent.getView();
79675             planView.setResizeIndicatorVisible(true);
79676             if (this.__parent.feedbackDisplayed) {
79677                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.selectedWall, false), this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
79678                 this.showWallAngleFeedback(this.selectedWall, false);
79679             }
79680         };
79681         /**
79682          *
79683          * @param {number} x
79684          * @param {number} y
79685          */
79686         WallArcExtentState.prototype.moveMouse = function (x, y) {
79687             var planView = this.__parent.getView();
79688             var newX = x - this.deltaXToMiddlePoint;
79689             var newY = y - this.deltaYToMiddlePoint;
79690             var arcExtent = this.getArcExtent(this.selectedWall.getXStart(), this.selectedWall.getYStart(), this.selectedWall.getXEnd(), this.selectedWall.getYEnd(), newX, newY);
79691             if (this.alignmentActivated || this.magnetismEnabled) {
79692                 arcExtent = (function (x) { return x * Math.PI / 180; })(Math.round(/* toDegrees */ (function (x) { return x * 180 / Math.PI; })(arcExtent)));
79693             }
79694             this.selectedWall.setArcExtent(arcExtent);
79695             if (this.__parent.feedbackDisplayed) {
79696                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.selectedWall, false), x, y);
79697                 this.showWallAngleFeedback(this.selectedWall, false);
79698             }
79699             planView.makePointVisible(x, y);
79700         };
79701         /**
79702          *
79703          * @param {number} x
79704          * @param {number} y
79705          */
79706         WallArcExtentState.prototype.releaseMouse = function (x, y) {
79707             this.__parent.postWallArcExtent(this.selectedWall, this.oldArcExtent);
79708             this.__parent.setState(this.__parent.getSelectionState());
79709         };
79710         /**
79711          *
79712          * @param {boolean} magnetismToggled
79713          */
79714         WallArcExtentState.prototype.toggleMagnetism = function (magnetismToggled) {
79715             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
79716             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
79717         };
79718         /**
79719          *
79720          * @param {boolean} alignmentActivated
79721          */
79722         WallArcExtentState.prototype.setAlignmentActivated = function (alignmentActivated) {
79723             this.alignmentActivated = alignmentActivated;
79724             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
79725         };
79726         /**
79727          *
79728          */
79729         WallArcExtentState.prototype.escape = function () {
79730             this.selectedWall.setArcExtent(this.oldArcExtent);
79731             this.__parent.setState(this.__parent.getSelectionState());
79732         };
79733         /**
79734          *
79735          */
79736         WallArcExtentState.prototype.exit = function () {
79737             var planView = this.__parent.getView();
79738             planView.setResizeIndicatorVisible(false);
79739             planView.deleteFeedback();
79740             this.selectedWall = null;
79741         };
79742         return WallArcExtentState;
79743     }(PlanController.AbstractWallState));
79744     PlanController.WallArcExtentState = WallArcExtentState;
79745     WallArcExtentState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.WallArcExtentState";
79746     /**
79747      * Room drawing state. This state manages room creation at mouse press.
79748      * @extends PlanController.AbstractRoomState
79749      * @class
79750      */
79751     var RoomDrawingState = /** @class */ (function (_super) {
79752         __extends(RoomDrawingState, _super);
79753         function RoomDrawingState(__parent) {
79754             var _this = _super.call(this, __parent) || this;
79755             _this.__parent = __parent;
79756             if (_this.xPreviousPoint === undefined) {
79757                 _this.xPreviousPoint = 0;
79758             }
79759             if (_this.yPreviousPoint === undefined) {
79760                 _this.yPreviousPoint = 0;
79761             }
79762             if (_this.newRoom === undefined) {
79763                 _this.newRoom = null;
79764             }
79765             if (_this.newPoint === undefined) {
79766                 _this.newPoint = null;
79767             }
79768             if (_this.oldSelection === undefined) {
79769                 _this.oldSelection = null;
79770             }
79771             if (_this.oldBasePlanLocked === undefined) {
79772                 _this.oldBasePlanLocked = false;
79773             }
79774             if (_this.oldAllLevelsSelection === undefined) {
79775                 _this.oldAllLevelsSelection = false;
79776             }
79777             if (_this.magnetismEnabled === undefined) {
79778                 _this.magnetismEnabled = false;
79779             }
79780             if (_this.alignmentActivated === undefined) {
79781                 _this.alignmentActivated = false;
79782             }
79783             if (_this.lastPointCreationTime === undefined) {
79784                 _this.lastPointCreationTime = 0;
79785             }
79786             return _this;
79787         }
79788         /**
79789          *
79790          * @return {PlanController.Mode}
79791          */
79792         RoomDrawingState.prototype.getMode = function () {
79793             return PlanController.Mode.ROOM_CREATION_$LI$();
79794         };
79795         /**
79796          *
79797          * @return {boolean}
79798          */
79799         RoomDrawingState.prototype.isModificationState = function () {
79800             return true;
79801         };
79802         /**
79803          *
79804          * @return {boolean}
79805          */
79806         RoomDrawingState.prototype.isBasePlanModificationState = function () {
79807             return true;
79808         };
79809         /**
79810          *
79811          * @param {PlanController.Mode} mode
79812          */
79813         RoomDrawingState.prototype.setMode = function (mode) {
79814             this.escape();
79815             if (mode === PlanController.Mode.SELECTION_$LI$()) {
79816                 this.__parent.setState(this.__parent.getSelectionState());
79817             }
79818             else if (mode === PlanController.Mode.PANNING_$LI$()) {
79819                 this.__parent.setState(this.__parent.getPanningState());
79820             }
79821             else if (mode === PlanController.Mode.WALL_CREATION_$LI$()) {
79822                 this.__parent.setState(this.__parent.getWallCreationState());
79823             }
79824             else if (mode === PlanController.Mode.POLYLINE_CREATION_$LI$()) {
79825                 this.__parent.setState(this.__parent.getPolylineCreationState());
79826             }
79827             else if (mode === PlanController.Mode.DIMENSION_LINE_CREATION_$LI$()) {
79828                 this.__parent.setState(this.__parent.getDimensionLineCreationState());
79829             }
79830             else if (mode === PlanController.Mode.LABEL_CREATION_$LI$()) {
79831                 this.__parent.setState(this.__parent.getLabelCreationState());
79832             }
79833         };
79834         /**
79835          *
79836          */
79837         RoomDrawingState.prototype.enter = function () {
79838             _super.prototype.enter.call(this);
79839             this.oldSelection = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
79840             this.oldBasePlanLocked = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked();
79841             this.oldAllLevelsSelection = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection();
79842             this.newRoom = null;
79843             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
79844             this.toggleMagnetism(this.__parent.wasMagnetismToggledLastMousePress());
79845             if (this.magnetismEnabled) {
79846                 var point = new PlanController.PointMagnetizedToClosestWallOrRoomPoint(this.__parent, this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
79847                 if (point.isMagnetized()) {
79848                     this.xPreviousPoint = point.getX();
79849                     this.yPreviousPoint = point.getY();
79850                 }
79851                 else {
79852                     var pointWithAngleMagnetism = new PlanController.RoomPointWithAngleMagnetism(this.__parent, null, -1, this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove(), this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
79853                     this.xPreviousPoint = pointWithAngleMagnetism.getX();
79854                     this.yPreviousPoint = pointWithAngleMagnetism.getY();
79855                 }
79856                 if (this.__parent.feedbackDisplayed) {
79857                     this.__parent.getView().setAlignmentFeedback(Room, null, this.xPreviousPoint, this.yPreviousPoint, point.isMagnetized());
79858                 }
79859             }
79860             else {
79861                 this.xPreviousPoint = this.__parent.getXLastMousePress();
79862                 this.yPreviousPoint = this.__parent.getYLastMousePress();
79863                 if (this.__parent.feedbackDisplayed) {
79864                     this.__parent.getView().setAlignmentFeedback(Room, null, this.xPreviousPoint, this.yPreviousPoint, false);
79865                 }
79866             }
79867             this.__parent.deselectAll();
79868         };
79869         /**
79870          *
79871          * @param {number} x
79872          * @param {number} y
79873          */
79874         RoomDrawingState.prototype.moveMouse = function (x, y) {
79875             var planView = this.__parent.getView();
79876             var xEnd = x;
79877             var yEnd = y;
79878             var magnetizedPoint = false;
79879             if (this.alignmentActivated) {
79880                 var pointWithAngleMagnetism = new PlanController.PointWithAngleMagnetism(this.xPreviousPoint, this.yPreviousPoint, x, y, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit(), planView.getPixelLength());
79881                 xEnd = pointWithAngleMagnetism.getX();
79882                 yEnd = pointWithAngleMagnetism.getY();
79883             }
79884             else if (this.magnetismEnabled) {
79885                 var point = this.newRoom != null ? new PlanController.PointMagnetizedToClosestWallOrRoomPoint(this.__parent, this.newRoom, this.newRoom.getPointCount() - 1, x, y) : new PlanController.PointMagnetizedToClosestWallOrRoomPoint(this.__parent, x, y);
79886                 magnetizedPoint = point.isMagnetized();
79887                 if (magnetizedPoint) {
79888                     xEnd = point.getX();
79889                     yEnd = point.getY();
79890                 }
79891                 else {
79892                     var editedPointIndex = this.newRoom != null ? this.newRoom.getPointCount() - 1 : -1;
79893                     var pointWithAngleMagnetism = new PlanController.RoomPointWithAngleMagnetism(this.__parent, this.newRoom, editedPointIndex, this.xPreviousPoint, this.yPreviousPoint, x, y);
79894                     xEnd = pointWithAngleMagnetism.getX();
79895                     yEnd = pointWithAngleMagnetism.getY();
79896                 }
79897             }
79898             if (this.newRoom == null) {
79899                 this.newRoom = this.createAndSelectRoom(this.xPreviousPoint, this.yPreviousPoint, xEnd, yEnd);
79900             }
79901             else if (this.newPoint != null) {
79902                 var points = this.newRoom.getPoints();
79903                 this.xPreviousPoint = points[points.length - 1][0];
79904                 this.yPreviousPoint = points[points.length - 1][1];
79905                 this.newRoom.addPoint$float$float(xEnd, yEnd);
79906                 this.newPoint = null;
79907             }
79908             else {
79909                 this.newRoom.setPoint(xEnd, yEnd, this.newRoom.getPointCount() - 1);
79910             }
79911             if (this.__parent.feedbackDisplayed) {
79912                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.newRoom, this.newRoom.getPointCount() - 1), x, y);
79913                 planView.setAlignmentFeedback(Room, this.newRoom, xEnd, yEnd, magnetizedPoint);
79914                 this.showRoomAngleFeedback(this.newRoom, this.newRoom.getPointCount() - 1);
79915                 planView.setDimensionLinesFeedback(this.getTriangulationDimensionLines(this.newRoom, this.newRoom.getPointCount() - 1));
79916             }
79917             planView.makePointVisible(x, y);
79918         };
79919         /**
79920          * Returns a new room instance with one side between (<code>xStart</code>,
79921          * <code>yStart</code>) and (<code>xEnd</code>, <code>yEnd</code>) points.
79922          * The new room is added to home and selected
79923          * @param {number} xStart
79924          * @param {number} yStart
79925          * @param {number} xEnd
79926          * @param {number} yEnd
79927          * @return {Room}
79928          * @private
79929          */
79930         RoomDrawingState.prototype.createAndSelectRoom = function (xStart, yStart, xEnd, yEnd) {
79931             var newRoom = this.__parent.createRoom([[xStart, yStart], [xEnd, yEnd]]);
79932             var insideWallsArea = this.__parent.getInsideWallsArea();
79933             newRoom.setCeilingVisible(insideWallsArea.contains(xStart, yStart));
79934             this.__parent.selectItem(newRoom);
79935             return newRoom;
79936         };
79937         /**
79938          *
79939          * @param {number} x
79940          * @param {number} y
79941          * @param {number} clickCount
79942          * @param {boolean} shiftDown
79943          * @param {boolean} duplicationActivated
79944          */
79945         RoomDrawingState.prototype.pressMouse = function (x, y, clickCount, shiftDown, duplicationActivated) {
79946             if (clickCount === 2) {
79947                 if (this.newRoom == null) {
79948                     var roomPoints = this.__parent.computeRoomPointsAt(x, y);
79949                     if (roomPoints != null) {
79950                         this.newRoom = this.__parent.createRoom(roomPoints);
79951                         this.__parent.selectItem(this.newRoom);
79952                     }
79953                 }
79954                 this.validateDrawnRoom();
79955             }
79956             else {
79957                 this.endRoomSide();
79958             }
79959         };
79960         RoomDrawingState.prototype.validateDrawnRoom = function () {
79961             if (this.newRoom != null) {
79962                 var points = this.newRoom.getPoints();
79963                 if (points.length < 3) {
79964                     this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deleteRoom(this.newRoom);
79965                 }
79966                 else {
79967                     this.__parent.postCreateRooms(/* asList */ [this.newRoom].slice(0), this.oldSelection, this.oldBasePlanLocked, this.oldAllLevelsSelection);
79968                 }
79969             }
79970             if (this.__parent.getPointerTypeLastMousePress() === View.PointerType.TOUCH) {
79971                 this.__parent.setState(this.__parent.getSelectionState());
79972             }
79973             else {
79974                 this.__parent.setState(this.__parent.getRoomCreationState());
79975             }
79976         };
79977         RoomDrawingState.prototype.endRoomSide = function () {
79978             if (this.newRoom != null && this.getRoomSideLength(this.newRoom, this.newRoom.getPointCount() - 1) > 0) {
79979                 this.newPoint = [0, 0];
79980                 if (this.newRoom.isCeilingVisible()) {
79981                     var roomPoints = this.newRoom.getPoints();
79982                     var lastPoint = roomPoints[roomPoints.length - 1];
79983                     if (!this.__parent.getInsideWallsArea().contains(lastPoint[0], lastPoint[1])) {
79984                         this.newRoom.setCeilingVisible(false);
79985                     }
79986                 }
79987             }
79988         };
79989         /**
79990          *
79991          * @param {boolean} editionActivated
79992          */
79993         RoomDrawingState.prototype.setEditionActivated = function (editionActivated) {
79994             var planView = this.__parent.getView();
79995             if (editionActivated) {
79996                 planView.deleteFeedback();
79997                 if (this.newRoom == null) {
79998                     planView.setToolTipEditedProperties(["X", "Y"], [this.xPreviousPoint, this.yPreviousPoint], this.xPreviousPoint, this.yPreviousPoint);
79999                 }
80000                 else {
80001                     if (this.newPoint != null) {
80002                         this.createNextSide();
80003                     }
80004                     var points = this.newRoom.getPoints();
80005                     if (points.length > 2) {
80006                         planView.setToolTipEditedProperties(["LENGTH", "DIAGONAL", "ANGLE"], [this.getRoomSideLength(this.newRoom, points.length - 1), this.getRoomDiagonalLength(this.newRoom, points.length - 1), this.getRoomSideAngle(this.newRoom, points.length - 1)], points[points.length - 1][0], points[points.length - 1][1]);
80007                     }
80008                     else {
80009                         planView.setToolTipEditedProperties(["LENGTH", "ANGLE"], [this.getRoomSideLength(this.newRoom, points.length - 1), this.getRoomSideAngle(this.newRoom, points.length - 1)], points[points.length - 1][0], points[points.length - 1][1]);
80010                     }
80011                 }
80012                 this.showRoomFeedback();
80013             }
80014             else {
80015                 if (this.newRoom == null) {
80016                     var lengthUnit = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit();
80017                     var defaultLength = lengthUnit.isMetric() ? 300 : LengthUnit.footToCentimeter(10);
80018                     this.newRoom = this.createAndSelectRoom(this.xPreviousPoint, this.yPreviousPoint, this.xPreviousPoint + defaultLength, this.yPreviousPoint);
80019                     planView.deleteFeedback();
80020                     this.setEditionActivated(true);
80021                 }
80022                 else if ( /* currentTimeMillis */Date.now() - this.lastPointCreationTime < 300) {
80023                     this.escape();
80024                 }
80025                 else {
80026                     this.endRoomSide();
80027                     var points = this.newRoom.getPoints();
80028                     if (points.length > 2 && this.newRoom.getPointIndexAt(points[points.length - 1][0], points[points.length - 1][1], 0.001) === 0) {
80029                         this.newRoom.removePoint(this.newRoom.getPointCount() - 1);
80030                         this.validateDrawnRoom();
80031                         return;
80032                     }
80033                     this.createNextSide();
80034                     planView.deleteToolTipFeedback();
80035                     this.setEditionActivated(true);
80036                 }
80037             }
80038         };
80039         RoomDrawingState.prototype.createNextSide = function () {
80040             var points = this.newRoom.getPoints();
80041             this.xPreviousPoint = points[points.length - 1][0];
80042             this.yPreviousPoint = points[points.length - 1][1];
80043             var previousSideAngle = Math.PI - Math.atan2(points[points.length - 2][1] - points[points.length - 1][1], points[points.length - 2][0] - points[points.length - 1][0]);
80044             previousSideAngle -= Math.PI / 2;
80045             var previousSideLength = this.getRoomSideLength(this.newRoom, points.length - 1);
80046             this.newRoom.addPoint$float$float((this.xPreviousPoint + previousSideLength * Math.cos(previousSideAngle)), (this.yPreviousPoint - previousSideLength * Math.sin(previousSideAngle)));
80047             this.newPoint = null;
80048             this.lastPointCreationTime = /* currentTimeMillis */ Date.now();
80049         };
80050         /**
80051          *
80052          * @param {string} editableProperty
80053          * @param {Object} value
80054          */
80055         RoomDrawingState.prototype.updateEditableProperty = function (editableProperty, value) {
80056             if (this.newRoom == null) {
80057                 var maximumLength = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMaximumLength();
80058                 switch ((editableProperty)) {
80059                     case "X":
80060                         this.xPreviousPoint = value != null ? /* floatValue */ value : 0;
80061                         this.xPreviousPoint = Math.max(-maximumLength, Math.min(this.xPreviousPoint, maximumLength));
80062                         break;
80063                     case "Y":
80064                         this.yPreviousPoint = value != null ? /* floatValue */ value : 0;
80065                         this.yPreviousPoint = Math.max(-maximumLength, Math.min(this.yPreviousPoint, maximumLength));
80066                         break;
80067                 }
80068             }
80069             else {
80070                 var planView = this.__parent.getView();
80071                 var roomPoints = this.newRoom.getPoints();
80072                 var previousPoint = roomPoints[roomPoints.length - 2];
80073                 var point = roomPoints[roomPoints.length - 1];
80074                 switch ((editableProperty)) {
80075                     case "LENGTH":
80076                         var sideLength = value != null ? /* floatValue */ value : 0;
80077                         sideLength = Math.max(0.001, Math.min(sideLength, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMaximumLength()));
80078                         var sideAngle = Math.PI - Math.atan2(previousPoint[1] - point[1], previousPoint[0] - point[0]);
80079                         var newX = (previousPoint[0] + sideLength * Math.cos(sideAngle));
80080                         var newY = (previousPoint[1] - sideLength * Math.sin(sideAngle));
80081                         this.newRoom.setPoint(newX, newY, roomPoints.length - 1);
80082                         if (roomPoints.length > 2) {
80083                             planView.setToolTipEditedPropertyValue("DIAGONAL", this.getRoomDiagonalLength(this.newRoom, roomPoints.length - 1));
80084                         }
80085                         break;
80086                     case "DIAGONAL":
80087                         var diagonalLength = value != null ? /* floatValue */ value : 0;
80088                         sideLength = this.getRoomSideLength(this.newRoom, roomPoints.length - 1);
80089                         var previousSideLength = this.getRoomSideLength(this.newRoom, roomPoints.length - 2);
80090                         if (diagonalLength >= sideLength && diagonalLength <= sideLength + previousSideLength) {
80091                             var cosAngle = (sideLength * sideLength + previousSideLength * previousSideLength - diagonalLength * diagonalLength) / (2 * sideLength * previousSideLength);
80092                             sideAngle = /* signum */ (function (f) { if (f > 0) {
80093                                 return 1;
80094                             }
80095                             else if (f < 0) {
80096                                 return -1;
80097                             }
80098                             else {
80099                                 return 0;
80100                             } })(this.getRoomSideAngle(this.newRoom, roomPoints.length - 1)) * Math.acos(cosAngle);
80101                             sideAngle -= Math.atan2(roomPoints[roomPoints.length - 3][1] - previousPoint[1], roomPoints[roomPoints.length - 3][0] - previousPoint[0]);
80102                             newX = (previousPoint[0] + sideLength * Math.cos(sideAngle));
80103                             newY = (previousPoint[1] - sideLength * Math.sin(sideAngle));
80104                             this.newRoom.setPoint(newX, newY, roomPoints.length - 1);
80105                             planView.setToolTipEditedPropertyValue("ANGLE", this.getRoomSideAngle(this.newRoom, roomPoints.length - 1));
80106                         }
80107                         break;
80108                     case "ANGLE":
80109                         sideAngle = /* toRadians */ (function (x) { return x * Math.PI / 180; })(value != null ? /* floatValue */ value : 0);
80110                         if (roomPoints.length > 2) {
80111                             sideAngle -= Math.atan2(roomPoints[roomPoints.length - 3][1] - previousPoint[1], roomPoints[roomPoints.length - 3][0] - previousPoint[0]);
80112                         }
80113                         sideLength = this.getRoomSideLength(this.newRoom, roomPoints.length - 1);
80114                         newX = (previousPoint[0] + sideLength * Math.cos(sideAngle));
80115                         newY = (previousPoint[1] - sideLength * Math.sin(sideAngle));
80116                         this.newRoom.setPoint(newX, newY, roomPoints.length - 1);
80117                         if (roomPoints.length > 2) {
80118                             planView.setToolTipEditedPropertyValue("DIAGONAL", this.getRoomDiagonalLength(this.newRoom, roomPoints.length - 1));
80119                         }
80120                         break;
80121                     default:
80122                         return;
80123                 }
80124             }
80125             this.showRoomFeedback();
80126         };
80127         RoomDrawingState.prototype.showRoomFeedback = function () {
80128             var planView = this.__parent.getView();
80129             if (this.newRoom == null) {
80130                 if (this.__parent.feedbackDisplayed) {
80131                     planView.setAlignmentFeedback(Room, null, this.xPreviousPoint, this.yPreviousPoint, true);
80132                 }
80133                 planView.makePointVisible(this.xPreviousPoint, this.yPreviousPoint);
80134             }
80135             else {
80136                 var roomPoints = this.newRoom.getPoints();
80137                 var editedPoint = roomPoints[roomPoints.length - 1];
80138                 if (this.__parent.feedbackDisplayed) {
80139                     planView.setAlignmentFeedback(Room, this.newRoom, editedPoint[0], editedPoint[1], false);
80140                     this.showRoomAngleFeedback(this.newRoom, roomPoints.length - 1);
80141                     planView.setDimensionLinesFeedback(this.getTriangulationDimensionLines(this.newRoom, roomPoints.length - 1));
80142                 }
80143                 var previousPoint = roomPoints[roomPoints.length - 2];
80144                 planView.makePointVisible(previousPoint[0], previousPoint[1]);
80145                 planView.makePointVisible(editedPoint[0], editedPoint[1]);
80146             }
80147         };
80148         /**
80149          *
80150          * @param {boolean} magnetismToggled
80151          */
80152         RoomDrawingState.prototype.toggleMagnetism = function (magnetismToggled) {
80153             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
80154             if (this.newRoom != null) {
80155                 this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
80156             }
80157         };
80158         /**
80159          *
80160          * @param {boolean} alignmentActivated
80161          */
80162         RoomDrawingState.prototype.setAlignmentActivated = function (alignmentActivated) {
80163             this.alignmentActivated = alignmentActivated;
80164             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
80165         };
80166         /**
80167          *
80168          */
80169         RoomDrawingState.prototype.escape = function () {
80170             if (this.newRoom != null && this.newPoint == null) {
80171                 this.newRoom.removePoint(this.newRoom.getPointCount() - 1);
80172             }
80173             this.validateDrawnRoom();
80174         };
80175         /**
80176          *
80177          */
80178         RoomDrawingState.prototype.exit = function () {
80179             this.__parent.getView().deleteFeedback();
80180             this.newRoom = null;
80181             this.newPoint = null;
80182             this.oldSelection = null;
80183         };
80184         return RoomDrawingState;
80185     }(PlanController.AbstractRoomState));
80186     PlanController.RoomDrawingState = RoomDrawingState;
80187     RoomDrawingState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RoomDrawingState";
80188     /**
80189      * Room resize state. This state manages room resizing.
80190      * @extends PlanController.AbstractRoomState
80191      * @class
80192      */
80193     var RoomResizeState = /** @class */ (function (_super) {
80194         __extends(RoomResizeState, _super);
80195         function RoomResizeState(__parent) {
80196             var _this = _super.call(this, __parent) || this;
80197             _this.__parent = __parent;
80198             if (_this.selectedRoom === undefined) {
80199                 _this.selectedRoom = null;
80200             }
80201             if (_this.roomPointIndex === undefined) {
80202                 _this.roomPointIndex = 0;
80203             }
80204             if (_this.oldX === undefined) {
80205                 _this.oldX = 0;
80206             }
80207             if (_this.oldY === undefined) {
80208                 _this.oldY = 0;
80209             }
80210             if (_this.deltaXToResizePoint === undefined) {
80211                 _this.deltaXToResizePoint = 0;
80212             }
80213             if (_this.deltaYToResizePoint === undefined) {
80214                 _this.deltaYToResizePoint = 0;
80215             }
80216             if (_this.magnetismEnabled === undefined) {
80217                 _this.magnetismEnabled = false;
80218             }
80219             if (_this.alignmentActivated === undefined) {
80220                 _this.alignmentActivated = false;
80221             }
80222             return _this;
80223         }
80224         /**
80225          *
80226          * @return {PlanController.Mode}
80227          */
80228         RoomResizeState.prototype.getMode = function () {
80229             return PlanController.Mode.SELECTION_$LI$();
80230         };
80231         /**
80232          *
80233          * @return {boolean}
80234          */
80235         RoomResizeState.prototype.isModificationState = function () {
80236             return true;
80237         };
80238         /**
80239          *
80240          * @return {boolean}
80241          */
80242         RoomResizeState.prototype.isBasePlanModificationState = function () {
80243             return true;
80244         };
80245         /**
80246          *
80247          */
80248         RoomResizeState.prototype.enter = function () {
80249             _super.prototype.enter.call(this);
80250             this.selectedRoom = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
80251             var margin = this.__parent.getIndicatorMargin();
80252             this.roomPointIndex = this.selectedRoom.getPointIndexAt(this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress(), margin);
80253             var roomPoints = this.selectedRoom.getPoints();
80254             this.oldX = roomPoints[this.roomPointIndex][0];
80255             this.oldY = roomPoints[this.roomPointIndex][1];
80256             this.deltaXToResizePoint = this.__parent.getXLastMousePress() - this.oldX;
80257             this.deltaYToResizePoint = this.__parent.getYLastMousePress() - this.oldY;
80258             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
80259             this.toggleMagnetism(this.__parent.wasMagnetismToggledLastMousePress());
80260             var planView = this.__parent.getView();
80261             planView.setResizeIndicatorVisible(true);
80262             if (this.__parent.feedbackDisplayed) {
80263                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.selectedRoom, this.roomPointIndex), this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
80264                 this.showRoomAngleFeedback(this.selectedRoom, this.roomPointIndex);
80265                 planView.setDimensionLinesFeedback(this.getTriangulationDimensionLines(this.selectedRoom, this.roomPointIndex));
80266             }
80267         };
80268         /**
80269          *
80270          * @param {number} x
80271          * @param {number} y
80272          */
80273         RoomResizeState.prototype.moveMouse = function (x, y) {
80274             var planView = this.__parent.getView();
80275             var newX = x - this.deltaXToResizePoint;
80276             var newY = y - this.deltaYToResizePoint;
80277             var roomPoints = this.selectedRoom.getPoints();
80278             var previousPointIndex = this.roomPointIndex === 0 ? roomPoints.length - 1 : this.roomPointIndex - 1;
80279             var xPreviousPoint = roomPoints[previousPointIndex][0];
80280             var yPreviousPoint = roomPoints[previousPointIndex][1];
80281             var magnetizedPoint = false;
80282             if (this.alignmentActivated) {
80283                 var pointWithAngleMagnetism = new PlanController.PointWithAngleMagnetism(xPreviousPoint, yPreviousPoint, newX, newY, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit(), planView.getPixelLength());
80284                 newX = pointWithAngleMagnetism.getX();
80285                 newY = pointWithAngleMagnetism.getY();
80286             }
80287             else if (this.magnetismEnabled) {
80288                 var point = new PlanController.PointMagnetizedToClosestWallOrRoomPoint(this.__parent, this.selectedRoom, this.roomPointIndex, newX, newY);
80289                 magnetizedPoint = point.isMagnetized();
80290                 if (magnetizedPoint) {
80291                     newX = point.getX();
80292                     newY = point.getY();
80293                 }
80294                 else {
80295                     var pointWithAngleMagnetism = new PlanController.RoomPointWithAngleMagnetism(this.__parent, this.selectedRoom, this.roomPointIndex, xPreviousPoint, yPreviousPoint, newX, newY);
80296                     newX = pointWithAngleMagnetism.getX();
80297                     newY = pointWithAngleMagnetism.getY();
80298                 }
80299             }
80300             PlanController.moveRoomPoint(this.selectedRoom, newX, newY, this.roomPointIndex);
80301             if (this.__parent.feedbackDisplayed) {
80302                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.selectedRoom, this.roomPointIndex), x, y);
80303                 planView.setAlignmentFeedback(Room, this.selectedRoom, newX, newY, magnetizedPoint);
80304                 this.showRoomAngleFeedback(this.selectedRoom, this.roomPointIndex);
80305                 planView.setDimensionLinesFeedback(this.getTriangulationDimensionLines(this.selectedRoom, this.roomPointIndex));
80306             }
80307             planView.makePointVisible(x, y);
80308         };
80309         /**
80310          *
80311          * @param {number} x
80312          * @param {number} y
80313          */
80314         RoomResizeState.prototype.releaseMouse = function (x, y) {
80315             this.__parent.postRoomResize(this.selectedRoom, this.oldX, this.oldY, this.roomPointIndex);
80316             this.__parent.setState(this.__parent.getSelectionState());
80317         };
80318         /**
80319          *
80320          * @param {boolean} magnetismToggled
80321          */
80322         RoomResizeState.prototype.toggleMagnetism = function (magnetismToggled) {
80323             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
80324             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
80325         };
80326         /**
80327          *
80328          * @param {boolean} alignmentActivated
80329          */
80330         RoomResizeState.prototype.setAlignmentActivated = function (alignmentActivated) {
80331             this.alignmentActivated = alignmentActivated;
80332             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
80333         };
80334         /**
80335          *
80336          */
80337         RoomResizeState.prototype.escape = function () {
80338             PlanController.moveRoomPoint(this.selectedRoom, this.oldX, this.oldY, this.roomPointIndex);
80339             this.__parent.setState(this.__parent.getSelectionState());
80340         };
80341         /**
80342          *
80343          */
80344         RoomResizeState.prototype.exit = function () {
80345             var planView = this.__parent.getView();
80346             planView.setResizeIndicatorVisible(false);
80347             planView.deleteFeedback();
80348             this.selectedRoom = null;
80349         };
80350         return RoomResizeState;
80351     }(PlanController.AbstractRoomState));
80352     PlanController.RoomResizeState = RoomResizeState;
80353     RoomResizeState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.RoomResizeState";
80354     /**
80355      * Polyline drawing state. This state manages polyline creation at mouse press.
80356      * @extends PlanController.AbstractPolylineState
80357      * @class
80358      */
80359     var PolylineDrawingState = /** @class */ (function (_super) {
80360         __extends(PolylineDrawingState, _super);
80361         function PolylineDrawingState(__parent) {
80362             var _this = _super.call(this, __parent) || this;
80363             _this.__parent = __parent;
80364             if (_this.xPreviousPoint === undefined) {
80365                 _this.xPreviousPoint = 0;
80366             }
80367             if (_this.yPreviousPoint === undefined) {
80368                 _this.yPreviousPoint = 0;
80369             }
80370             if (_this.newPolyline === undefined) {
80371                 _this.newPolyline = null;
80372             }
80373             if (_this.newPoint === undefined) {
80374                 _this.newPoint = null;
80375             }
80376             if (_this.oldSelection === undefined) {
80377                 _this.oldSelection = null;
80378             }
80379             if (_this.oldBasePlanLocked === undefined) {
80380                 _this.oldBasePlanLocked = false;
80381             }
80382             if (_this.oldAllLevelsSelection === undefined) {
80383                 _this.oldAllLevelsSelection = false;
80384             }
80385             if (_this.magnetismEnabled === undefined) {
80386                 _this.magnetismEnabled = false;
80387             }
80388             if (_this.alignmentActivated === undefined) {
80389                 _this.alignmentActivated = false;
80390             }
80391             if (_this.curvedPolyline === undefined) {
80392                 _this.curvedPolyline = false;
80393             }
80394             if (_this.lastPointCreationTime === undefined) {
80395                 _this.lastPointCreationTime = 0;
80396             }
80397             return _this;
80398         }
80399         /**
80400          *
80401          * @return {PlanController.Mode}
80402          */
80403         PolylineDrawingState.prototype.getMode = function () {
80404             return PlanController.Mode.POLYLINE_CREATION_$LI$();
80405         };
80406         /**
80407          *
80408          * @return {boolean}
80409          */
80410         PolylineDrawingState.prototype.isModificationState = function () {
80411             return true;
80412         };
80413         /**
80414          *
80415          * @return {boolean}
80416          */
80417         PolylineDrawingState.prototype.isBasePlanModificationState = function () {
80418             return true;
80419         };
80420         /**
80421          *
80422          * @param {PlanController.Mode} mode
80423          */
80424         PolylineDrawingState.prototype.setMode = function (mode) {
80425             this.escape();
80426             if (mode === PlanController.Mode.SELECTION_$LI$()) {
80427                 this.__parent.setState(this.__parent.getSelectionState());
80428             }
80429             else if (mode === PlanController.Mode.PANNING_$LI$()) {
80430                 this.__parent.setState(this.__parent.getPanningState());
80431             }
80432             else if (mode === PlanController.Mode.WALL_CREATION_$LI$()) {
80433                 this.__parent.setState(this.__parent.getWallCreationState());
80434             }
80435             else if (mode === PlanController.Mode.ROOM_CREATION_$LI$()) {
80436                 this.__parent.setState(this.__parent.getRoomCreationState());
80437             }
80438             else if (mode === PlanController.Mode.DIMENSION_LINE_CREATION_$LI$()) {
80439                 this.__parent.setState(this.__parent.getDimensionLineCreationState());
80440             }
80441             else if (mode === PlanController.Mode.LABEL_CREATION_$LI$()) {
80442                 this.__parent.setState(this.__parent.getLabelCreationState());
80443             }
80444         };
80445         /**
80446          *
80447          */
80448         PolylineDrawingState.prototype.enter = function () {
80449             _super.prototype.enter.call(this);
80450             this.oldSelection = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems();
80451             this.oldBasePlanLocked = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isBasePlanLocked();
80452             this.oldAllLevelsSelection = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection();
80453             this.newPolyline = null;
80454             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
80455             this.toggleMagnetism(this.__parent.wasMagnetismToggledLastMousePress());
80456             this.xPreviousPoint = this.__parent.getXLastMousePress();
80457             this.yPreviousPoint = this.__parent.getYLastMousePress();
80458             this.setDuplicationActivated(this.__parent.wasDuplicationActivatedLastMousePress());
80459             this.__parent.deselectAll();
80460         };
80461         /**
80462          *
80463          * @param {number} x
80464          * @param {number} y
80465          */
80466         PolylineDrawingState.prototype.moveMouse = function (x, y) {
80467             var planView = this.__parent.getView();
80468             var xEnd = x;
80469             var yEnd = y;
80470             if (this.alignmentActivated || this.magnetismEnabled) {
80471                 var pointWithAngleMagnetism = new PlanController.PointWithAngleMagnetism(this.xPreviousPoint, this.yPreviousPoint, x, y, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit(), planView.getPixelLength());
80472                 xEnd = pointWithAngleMagnetism.getX();
80473                 yEnd = pointWithAngleMagnetism.getY();
80474             }
80475             if (this.newPolyline == null) {
80476                 this.newPolyline = this.createAndSelectPolyline(this.xPreviousPoint, this.yPreviousPoint, xEnd, yEnd);
80477             }
80478             else if (this.newPoint != null) {
80479                 var points = this.newPolyline.getPoints();
80480                 this.xPreviousPoint = points[points.length - 1][0];
80481                 this.yPreviousPoint = points[points.length - 1][1];
80482                 this.newPolyline.addPoint$float$float(xEnd, yEnd);
80483                 this.newPoint[0] = xEnd;
80484                 this.newPoint[1] = yEnd;
80485                 this.newPoint = null;
80486             }
80487             else {
80488                 this.newPolyline.setPoint(xEnd, yEnd, this.newPolyline.getPointCount() - 1);
80489             }
80490             if (this.__parent.feedbackDisplayed) {
80491                 planView.setAlignmentFeedback(Polyline, null, x, y, false);
80492                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.newPolyline, this.newPolyline.getPointCount() - 1), x, y);
80493                 if (this.newPolyline.getJoinStyle() !== Polyline.JoinStyle.CURVED) {
80494                     this.showPolylineAngleFeedback(this.newPolyline, this.newPolyline.getPointCount() - 1);
80495                 }
80496             }
80497             planView.makePointVisible(x, y);
80498         };
80499         /**
80500          * Returns a new polyline instance with one segment between (<code>xStart</code>,
80501          * <code>yStart</code>) and (<code>xEnd</code>, <code>yEnd</code>) points.
80502          * The new polyline is added to home and selected
80503          * @param {number} xStart
80504          * @param {number} yStart
80505          * @param {number} xEnd
80506          * @param {number} yEnd
80507          * @return {Polyline}
80508          * @private
80509          */
80510         PolylineDrawingState.prototype.createAndSelectPolyline = function (xStart, yStart, xEnd, yEnd) {
80511             var newPolyline = this.__parent.createPolyline([[xStart, yStart], [xEnd, yEnd]]);
80512             if (this.curvedPolyline) {
80513                 newPolyline.setJoinStyle(Polyline.JoinStyle.CURVED);
80514             }
80515             this.__parent.selectItems(/* asList */ [newPolyline].slice(0));
80516             return newPolyline;
80517         };
80518         /**
80519          *
80520          * @param {number} x
80521          * @param {number} y
80522          * @param {number} clickCount
80523          * @param {boolean} shiftDown
80524          * @param {boolean} duplicationActivated
80525          */
80526         PolylineDrawingState.prototype.pressMouse = function (x, y, clickCount, shiftDown, duplicationActivated) {
80527             if (clickCount === 2) {
80528                 if (this.newPolyline != null) {
80529                     var pointIndex = this.newPolyline.getPointIndexAt(x, y, this.__parent.getSelectionMargin());
80530                     if (pointIndex === 0) {
80531                         this.newPolyline.removePoint(this.newPolyline.getPointCount() - 1);
80532                         this.newPolyline.setClosedPath(true);
80533                     }
80534                     this.validateDrawnPolyline();
80535                 }
80536                 else {
80537                     if (this.__parent.getPointerTypeLastMousePress() === View.PointerType.TOUCH) {
80538                         this.__parent.setState(this.__parent.getSelectionState());
80539                     }
80540                     else {
80541                         this.__parent.setState(this.__parent.getPolylineCreationState());
80542                     }
80543                 }
80544             }
80545             else {
80546                 this.endPolylineSegment();
80547             }
80548         };
80549         PolylineDrawingState.prototype.validateDrawnPolyline = function () {
80550             if (this.newPolyline != null) {
80551                 var points = this.newPolyline.getPoints();
80552                 if (points.length < 2) {
80553                     this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.deletePolyline(this.newPolyline);
80554                 }
80555                 else {
80556                     this.__parent.postCreatePolylines(/* asList */ [this.newPolyline].slice(0), this.oldSelection, this.oldBasePlanLocked, this.oldAllLevelsSelection);
80557                 }
80558             }
80559             if (this.__parent.getPointerTypeLastMousePress() === View.PointerType.TOUCH) {
80560                 this.__parent.setState(this.__parent.getSelectionState());
80561             }
80562             else {
80563                 this.__parent.setState(this.__parent.getPolylineCreationState());
80564             }
80565         };
80566         PolylineDrawingState.prototype.endPolylineSegment = function () {
80567             if (this.newPolyline != null && this.getPolylineSegmentLength(this.newPolyline, this.newPolyline.getPointCount() - 1) > 0) {
80568                 this.newPoint = [0, 0];
80569                 if (this.newPolyline.getPointCount() <= 2 && this.curvedPolyline && this.newPolyline.getJoinStyle() !== Polyline.JoinStyle.CURVED) {
80570                     this.newPolyline.setJoinStyle(Polyline.JoinStyle.CURVED);
80571                 }
80572             }
80573         };
80574         /**
80575          *
80576          * @param {boolean} editionActivated
80577          */
80578         PolylineDrawingState.prototype.setEditionActivated = function (editionActivated) {
80579             var planView = this.__parent.getView();
80580             if (editionActivated) {
80581                 planView.deleteFeedback();
80582                 if (this.newPolyline == null) {
80583                     planView.setToolTipEditedProperties(["X", "Y"], [this.xPreviousPoint, this.yPreviousPoint], this.xPreviousPoint, this.yPreviousPoint);
80584                 }
80585                 else {
80586                     if (this.newPoint != null) {
80587                         this.createNextSegment();
80588                     }
80589                     var points = this.newPolyline.getPoints();
80590                     planView.setToolTipEditedProperties(["LENGTH", "ANGLE"], [this.getPolylineSegmentLength(this.newPolyline, points.length - 1), this.getPolylineSegmentAngle(this.newPolyline, points.length - 1)], points[points.length - 1][0], points[points.length - 1][1]);
80591                 }
80592                 this.showPolylineFeedback();
80593             }
80594             else {
80595                 if (this.newPolyline == null) {
80596                     var lengthUnit = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit();
80597                     var defaultLength = lengthUnit.isMetric() ? 300 : LengthUnit.footToCentimeter(10);
80598                     this.newPolyline = this.createAndSelectPolyline(this.xPreviousPoint, this.yPreviousPoint, this.xPreviousPoint + defaultLength, this.yPreviousPoint);
80599                     planView.deleteFeedback();
80600                     this.setEditionActivated(true);
80601                 }
80602                 else if ( /* currentTimeMillis */Date.now() - this.lastPointCreationTime < 300) {
80603                     this.escape();
80604                 }
80605                 else {
80606                     this.endPolylineSegment();
80607                     var points = this.newPolyline.getPoints();
80608                     if (points.length > 2 && this.newPolyline.getPointIndexAt(points[points.length - 1][0], points[points.length - 1][1], 0.001) === 0) {
80609                         this.newPolyline.removePoint(this.newPolyline.getPointCount() - 1);
80610                         this.newPolyline.setClosedPath(true);
80611                         this.validateDrawnPolyline();
80612                         return;
80613                     }
80614                     this.createNextSegment();
80615                     planView.deleteToolTipFeedback();
80616                     this.setEditionActivated(true);
80617                 }
80618             }
80619         };
80620         PolylineDrawingState.prototype.createNextSegment = function () {
80621             var points = this.newPolyline.getPoints();
80622             this.xPreviousPoint = points[points.length - 1][0];
80623             this.yPreviousPoint = points[points.length - 1][1];
80624             var previousSegmentAngle = Math.PI - Math.atan2(points[points.length - 2][1] - points[points.length - 1][1], points[points.length - 2][0] - points[points.length - 1][0]);
80625             previousSegmentAngle -= Math.PI / 2;
80626             var previousSegmentLength = this.getPolylineSegmentLength(this.newPolyline, points.length - 1);
80627             this.newPolyline.addPoint$float$float((this.xPreviousPoint + previousSegmentLength * Math.cos(previousSegmentAngle)), (this.yPreviousPoint - previousSegmentLength * Math.sin(previousSegmentAngle)));
80628             this.newPoint = null;
80629             this.lastPointCreationTime = /* currentTimeMillis */ Date.now();
80630         };
80631         /**
80632          *
80633          * @param {string} editableProperty
80634          * @param {Object} value
80635          */
80636         PolylineDrawingState.prototype.updateEditableProperty = function (editableProperty, value) {
80637             if (this.newPolyline == null) {
80638                 switch ((editableProperty)) {
80639                     case "X":
80640                         this.xPreviousPoint = value != null ? /* floatValue */ value : 0;
80641                         this.xPreviousPoint = Math.max(-100000.0, Math.min(this.xPreviousPoint, 100000.0));
80642                         break;
80643                     case "Y":
80644                         this.yPreviousPoint = value != null ? /* floatValue */ value : 0;
80645                         this.yPreviousPoint = Math.max(-100000.0, Math.min(this.yPreviousPoint, 100000.0));
80646                         break;
80647                 }
80648             }
80649             else {
80650                 var points = this.newPolyline.getPoints();
80651                 var previousPoint = points[points.length - 2];
80652                 var point = points[points.length - 1];
80653                 var newX = void 0;
80654                 var newY = void 0;
80655                 switch ((editableProperty)) {
80656                     case "LENGTH":
80657                         var length_3 = value != null ? /* floatValue */ value : 0;
80658                         length_3 = Math.max(0.001, Math.min(length_3, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit().getMaximumLength()));
80659                         var segmentAngle = Math.PI - Math.atan2(previousPoint[1] - point[1], previousPoint[0] - point[0]);
80660                         newX = (previousPoint[0] + length_3 * Math.cos(segmentAngle));
80661                         newY = (previousPoint[1] - length_3 * Math.sin(segmentAngle));
80662                         break;
80663                     case "ANGLE":
80664                         segmentAngle = /* toRadians */ (function (x) { return x * Math.PI / 180; })(value != null ? /* floatValue */ value : 0);
80665                         if (points.length > 2) {
80666                             segmentAngle -= Math.atan2(points[points.length - 3][1] - previousPoint[1], points[points.length - 3][0] - previousPoint[0]);
80667                         }
80668                         var segmentLength = this.getPolylineSegmentLength(this.newPolyline, points.length - 1);
80669                         newX = (previousPoint[0] + segmentLength * Math.cos(segmentAngle));
80670                         newY = (previousPoint[1] - segmentLength * Math.sin(segmentAngle));
80671                         break;
80672                     default:
80673                         return;
80674                 }
80675                 this.newPolyline.setPoint(newX, newY, points.length - 1);
80676             }
80677             this.showPolylineFeedback();
80678         };
80679         PolylineDrawingState.prototype.showPolylineFeedback = function () {
80680             var planView = this.__parent.getView();
80681             if (this.newPolyline == null) {
80682                 if (this.__parent.feedbackDisplayed) {
80683                     planView.setAlignmentFeedback(Polyline, null, this.xPreviousPoint, this.yPreviousPoint, true);
80684                 }
80685                 planView.makePointVisible(this.xPreviousPoint, this.yPreviousPoint);
80686             }
80687             else {
80688                 var points = this.newPolyline.getPoints();
80689                 var previousPoint = points[points.length - 2];
80690                 var editedPoint = points[points.length - 1];
80691                 if (this.__parent.feedbackDisplayed) {
80692                     if (this.newPolyline.getJoinStyle() !== Polyline.JoinStyle.CURVED) {
80693                         this.showPolylineAngleFeedback(this.newPolyline, points.length - 1);
80694                     }
80695                     planView.setAlignmentFeedback(Polyline, null, editedPoint[0], editedPoint[1], false);
80696                 }
80697                 planView.makePointVisible(previousPoint[0], previousPoint[1]);
80698                 planView.makePointVisible(editedPoint[0], editedPoint[1]);
80699             }
80700         };
80701         /**
80702          *
80703          * @param {boolean} magnetismToggled
80704          */
80705         PolylineDrawingState.prototype.toggleMagnetism = function (magnetismToggled) {
80706             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
80707             if (this.newPolyline != null) {
80708                 this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
80709             }
80710         };
80711         /**
80712          *
80713          * @param {boolean} alignmentActivated
80714          */
80715         PolylineDrawingState.prototype.setAlignmentActivated = function (alignmentActivated) {
80716             this.alignmentActivated = alignmentActivated;
80717             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
80718         };
80719         /**
80720          *
80721          * @param {boolean} duplicationActivated
80722          */
80723         PolylineDrawingState.prototype.setDuplicationActivated = function (duplicationActivated) {
80724             this.curvedPolyline = duplicationActivated;
80725         };
80726         /**
80727          *
80728          */
80729         PolylineDrawingState.prototype.escape = function () {
80730             if (this.newPolyline != null && this.newPoint == null) {
80731                 this.newPolyline.removePoint(this.newPolyline.getPointCount() - 1);
80732             }
80733             this.validateDrawnPolyline();
80734         };
80735         /**
80736          *
80737          */
80738         PolylineDrawingState.prototype.exit = function () {
80739             this.__parent.getView().deleteFeedback();
80740             this.newPolyline = null;
80741             this.newPoint = null;
80742             this.oldSelection = null;
80743         };
80744         return PolylineDrawingState;
80745     }(PlanController.AbstractPolylineState));
80746     PlanController.PolylineDrawingState = PolylineDrawingState;
80747     PolylineDrawingState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PolylineDrawingState";
80748     /**
80749      * Polyline resize state. This state manages polyline resizing.
80750      * @extends PlanController.AbstractPolylineState
80751      * @class
80752      */
80753     var PolylineResizeState = /** @class */ (function (_super) {
80754         __extends(PolylineResizeState, _super);
80755         function PolylineResizeState(__parent) {
80756             var _this = _super.call(this, __parent) || this;
80757             _this.__parent = __parent;
80758             if (_this.polylines === undefined) {
80759                 _this.polylines = null;
80760             }
80761             if (_this.selectedPolyline === undefined) {
80762                 _this.selectedPolyline = null;
80763             }
80764             if (_this.polylinePointIndex === undefined) {
80765                 _this.polylinePointIndex = 0;
80766             }
80767             if (_this.oldX === undefined) {
80768                 _this.oldX = 0;
80769             }
80770             if (_this.oldY === undefined) {
80771                 _this.oldY = 0;
80772             }
80773             if (_this.deltaXToResizePoint === undefined) {
80774                 _this.deltaXToResizePoint = 0;
80775             }
80776             if (_this.deltaYToResizePoint === undefined) {
80777                 _this.deltaYToResizePoint = 0;
80778             }
80779             if (_this.magnetismEnabled === undefined) {
80780                 _this.magnetismEnabled = false;
80781             }
80782             if (_this.alignmentActivated === undefined) {
80783                 _this.alignmentActivated = false;
80784             }
80785             return _this;
80786         }
80787         /**
80788          *
80789          * @return {PlanController.Mode}
80790          */
80791         PolylineResizeState.prototype.getMode = function () {
80792             return PlanController.Mode.SELECTION_$LI$();
80793         };
80794         /**
80795          *
80796          * @return {boolean}
80797          */
80798         PolylineResizeState.prototype.isModificationState = function () {
80799             return true;
80800         };
80801         /**
80802          *
80803          * @return {boolean}
80804          */
80805         PolylineResizeState.prototype.isBasePlanModificationState = function () {
80806             return true;
80807         };
80808         /**
80809          *
80810          */
80811         PolylineResizeState.prototype.enter = function () {
80812             var _this = this;
80813             _super.prototype.enter.call(this);
80814             this.selectedPolyline = this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems()[0];
80815             this.polylines = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getPolylines().slice(0));
80816             /* remove */ (function (a) { var index = a.indexOf(_this.selectedPolyline); if (index >= 0) {
80817                 a.splice(index, 1);
80818                 return true;
80819             }
80820             else {
80821                 return false;
80822             } })(this.polylines);
80823             var margin = this.__parent.getIndicatorMargin();
80824             this.polylinePointIndex = this.selectedPolyline.getPointIndexAt(this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress(), margin);
80825             var polylinePoints = this.selectedPolyline.getPoints();
80826             this.oldX = polylinePoints[this.polylinePointIndex][0];
80827             this.oldY = polylinePoints[this.polylinePointIndex][1];
80828             this.deltaXToResizePoint = this.__parent.getXLastMousePress() - this.oldX;
80829             this.deltaYToResizePoint = this.__parent.getYLastMousePress() - this.oldY;
80830             this.alignmentActivated = this.__parent.wasAlignmentActivatedLastMousePress();
80831             this.toggleMagnetism(this.__parent.wasMagnetismToggledLastMousePress());
80832             var planView = this.__parent.getView();
80833             planView.setResizeIndicatorVisible(true);
80834             var toolTipFeedbackText = this.getToolTipFeedbackText(this.selectedPolyline, this.polylinePointIndex);
80835             if (this.__parent.feedbackDisplayed && toolTipFeedbackText != null) {
80836                 planView.setToolTipFeedback(toolTipFeedbackText, this.__parent.getXLastMousePress(), this.__parent.getYLastMousePress());
80837                 if (this.selectedPolyline.getJoinStyle() !== Polyline.JoinStyle.CURVED) {
80838                     this.showPolylineAngleFeedback(this.selectedPolyline, this.polylinePointIndex);
80839                 }
80840             }
80841         };
80842         /**
80843          *
80844          * @param {number} x
80845          * @param {number} y
80846          */
80847         PolylineResizeState.prototype.moveMouse = function (x, y) {
80848             var planView = this.__parent.getView();
80849             var newX = x - this.deltaXToResizePoint;
80850             var newY = y - this.deltaYToResizePoint;
80851             if (this.alignmentActivated || this.magnetismEnabled) {
80852                 var polylinePoints = this.selectedPolyline.getPoints();
80853                 var previousPointIndex = this.polylinePointIndex === 0 ? (this.selectedPolyline.isClosedPath() ? polylinePoints.length - 1 : 1) : this.polylinePointIndex - 1;
80854                 var xPreviousPoint = polylinePoints[previousPointIndex][0];
80855                 var yPreviousPoint = polylinePoints[previousPointIndex][1];
80856                 var pointWithAngleMagnetism = new PlanController.PointWithAngleMagnetism(xPreviousPoint, yPreviousPoint, newX, newY, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.getLengthUnit(), planView.getPixelLength());
80857                 newX = pointWithAngleMagnetism.getX();
80858                 newY = pointWithAngleMagnetism.getY();
80859             }
80860             this.selectedPolyline.setPoint(newX, newY, this.polylinePointIndex);
80861             if (this.__parent.feedbackDisplayed) {
80862                 planView.setToolTipFeedback(this.getToolTipFeedbackText(this.selectedPolyline, this.polylinePointIndex), x, y);
80863                 if (this.selectedPolyline.getJoinStyle() !== Polyline.JoinStyle.CURVED) {
80864                     this.showPolylineAngleFeedback(this.selectedPolyline, this.polylinePointIndex);
80865                 }
80866             }
80867             planView.makePointVisible(x, y);
80868         };
80869         /**
80870          *
80871          * @param {number} x
80872          * @param {number} y
80873          */
80874         PolylineResizeState.prototype.releaseMouse = function (x, y) {
80875             this.__parent.postPolylineResize(this.selectedPolyline, this.oldX, this.oldY, this.polylinePointIndex);
80876             this.__parent.setState(this.__parent.getSelectionState());
80877         };
80878         /**
80879          *
80880          * @param {boolean} magnetismToggled
80881          */
80882         PolylineResizeState.prototype.toggleMagnetism = function (magnetismToggled) {
80883             this.magnetismEnabled = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_preferences.isMagnetismEnabled()) !== (magnetismToggled);
80884             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
80885         };
80886         /**
80887          *
80888          * @param {boolean} alignmentActivated
80889          */
80890         PolylineResizeState.prototype.setAlignmentActivated = function (alignmentActivated) {
80891             this.alignmentActivated = alignmentActivated;
80892             this.moveMouse(this.__parent.getXLastMouseMove(), this.__parent.getYLastMouseMove());
80893         };
80894         /**
80895          *
80896          */
80897         PolylineResizeState.prototype.escape = function () {
80898             this.selectedPolyline.setPoint(this.oldX, this.oldY, this.polylinePointIndex);
80899             this.__parent.setState(this.__parent.getSelectionState());
80900         };
80901         /**
80902          *
80903          */
80904         PolylineResizeState.prototype.exit = function () {
80905             var planView = this.__parent.getView();
80906             planView.setResizeIndicatorVisible(false);
80907             planView.deleteFeedback();
80908             this.selectedPolyline = null;
80909         };
80910         return PolylineResizeState;
80911     }(PlanController.AbstractPolylineState));
80912     PlanController.PolylineResizeState = PolylineResizeState;
80913     PolylineResizeState["__class"] = "com.eteks.sweethome3d.viewcontroller.PlanController.PolylineResizeState";
80914     var PlanController$0 = /** @class */ (function () {
80915         function PlanController$0(__parent, walls) {
80916             this.walls = walls;
80917             this.__parent = __parent;
80918         }
80919         PlanController$0.prototype.compare = function (wall1, wall2) {
80920             var intersection1 = PlanController.computeIntersection(wall1.getXStart(), wall1.getYStart(), wall1.getXEnd(), wall1.getYEnd(), this.walls[0].getXStart(), this.walls[0].getYStart(), this.walls[0].getXEnd(), this.walls[0].getYEnd());
80921             var intersection2 = PlanController.computeIntersection(wall2.getXStart(), wall2.getYStart(), wall2.getXEnd(), wall2.getYEnd(), this.walls[0].getXStart(), this.walls[0].getYStart(), this.walls[0].getXEnd(), this.walls[0].getYEnd());
80922             var closestPoint1 = Math.min(java.awt.geom.Point2D.distanceSq(this.walls[0].getXStart(), this.walls[0].getYStart(), intersection1[0], intersection1[1]), java.awt.geom.Point2D.distanceSq(this.walls[0].getXEnd(), this.walls[0].getYEnd(), intersection1[0], intersection1[1]));
80923             var closestPoint2 = Math.min(java.awt.geom.Point2D.distanceSq(this.walls[0].getXStart(), this.walls[0].getYStart(), intersection2[0], intersection2[1]), java.awt.geom.Point2D.distanceSq(this.walls[0].getXEnd(), this.walls[0].getYEnd(), intersection2[0], intersection2[1]));
80924             return /* compare */ (closestPoint1 - closestPoint2);
80925         };
80926         return PlanController$0;
80927     }());
80928     PlanController.PlanController$0 = PlanController$0;
80929     var PlanController$1 = /** @class */ (function () {
80930         function PlanController$1(__parent) {
80931             this.__parent = __parent;
80932         }
80933         PlanController$1.prototype.selectionChanged = function (ev) {
80934             this.__parent.selectLevelFromSelectedItems();
80935             if (this.__parent.getView() != null) {
80936                 this.__parent.getView().makeSelectionVisible();
80937             }
80938         };
80939         return PlanController$1;
80940     }());
80941     PlanController.PlanController$1 = PlanController$1;
80942     PlanController$1["__interfaces"] = ["com.eteks.sweethome3d.model.SelectionListener"];
80943     var PlanController$2 = /** @class */ (function () {
80944         function PlanController$2(__parent) {
80945             this.__parent = __parent;
80946         }
80947         PlanController$2.prototype.propertyChange = function (ev) {
80948             if ( /* contains */(this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems().indexOf((ev.getSource())) >= 0)) {
80949                 if (this.__parent.getView() != null) {
80950                     this.__parent.getView().makeSelectionVisible();
80951                 }
80952             }
80953         };
80954         return PlanController$2;
80955     }());
80956     PlanController.PlanController$2 = PlanController$2;
80957     var PlanController$3 = /** @class */ (function () {
80958         function PlanController$3(__parent) {
80959             this.__parent = __parent;
80960         }
80961         PlanController$3.prototype.propertyChange = function (ev) {
80962             var propertyName = ev.getPropertyName();
80963             if (( /* name */"X_START" === propertyName) || ( /* name */"X_END" === propertyName) || ( /* name */"Y_START" === propertyName) || ( /* name */"Y_END" === propertyName) || ( /* name */"WALL_AT_START" === propertyName) || ( /* name */"WALL_AT_END" === propertyName) || ( /* name */"THICKNESS" === propertyName) || ( /* name */"ARC_EXTENT" === propertyName) || ( /* name */"LEVEL" === propertyName) || ( /* name */"HEIGHT" === propertyName) || ( /* name */"HEIGHT_AT_END" === propertyName) || ( /* name */"LEFT_SIDE_BASEBOARD" === propertyName) || ( /* name */"RIGHT_SIDE_BASEBOARD" === propertyName)) {
80964                 this.__parent.resetAreaCache();
80965                 var wall_1 = ev.getSource();
80966                 if (!wall_1.isAtLevel(this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedLevel())) {
80967                     var selectedItems = (this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.getSelectedItems().slice(0));
80968                     if ( /* remove */(function (a) { var index = a.indexOf(wall_1); if (index >= 0) {
80969                         a.splice(index, 1);
80970                         return true;
80971                     }
80972                     else {
80973                         return false;
80974                     } })(selectedItems)) {
80975                         this.__parent.selectItems(selectedItems, this.__parent.__com_eteks_sweethome3d_viewcontroller_PlanController_home.isAllLevelsSelection());
80976                     }
80977                 }
80978             }
80979         };
80980         return PlanController$3;
80981     }());
80982     PlanController.PlanController$3 = PlanController$3;
80983     var PlanController$4 = /** @class */ (function () {
80984         function PlanController$4(__parent) {
80985             this.__parent = __parent;
80986         }
80987         PlanController$4.prototype.propertyChange = function (ev) {
80988             var propertyName = ev.getPropertyName();
80989             if (( /* name */"X" === propertyName) || ( /* name */"Y" === propertyName) || ( /* name */"WIDTH_IN_PLAN" === propertyName) || ( /* name */"DEPTH_IN_PLAN" === propertyName)) {
80990                 /* remove */ (function (m, k) { if (m.entries == null)
80991                     m.entries = []; for (var i = 0; i < m.entries.length; i++)
80992                     if (m.entries[i].key == null && k == null || m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
80993                         return m.entries.splice(i, 1)[0];
80994                     } })(this.__parent.furnitureSidesCache, ev.getSource());
80995             }
80996         };
80997         return PlanController$4;
80998     }());
80999     PlanController.PlanController$4 = PlanController$4;
81000     var PlanController$5 = /** @class */ (function () {
81001         function PlanController$5(__parent) {
81002             this.__parent = __parent;
81003         }
81004         PlanController$5.prototype.propertyChange = function (ev) {
81005             var piece = ev.getSource();
81006             var propertyName = ev.getPropertyName();
81007             if (( /* name */"MODEL" === propertyName) || ( /* name */"MODEL_MIRRORED" === propertyName) || ( /* name */"MODEL_ROTATION" === propertyName) || ( /* name */"WIDTH" === propertyName) || ( /* name */"DEPTH" === propertyName) || ( /* name */"HEIGHT" === propertyName) || ( /* name */"ROLL" === propertyName) || ( /* name */"PITCH" === propertyName)) {
81008                 var size = this.__parent.getView().getPieceOfFurnitureSizeInPlan(piece);
81009                 if (size != null) {
81010                     piece.setWidthInPlan(size[0]);
81011                     piece.setDepthInPlan(size[1]);
81012                     piece.setHeightInPlan(size[2]);
81013                 }
81014                 else if ( /* name */"WIDTH" === propertyName) {
81015                     var scale = piece.getWidth() / /* floatValue */ ev.getOldValue();
81016                     piece.setWidthInPlan(scale * piece.getWidthInPlan());
81017                     piece.setDepthInPlan(scale * piece.getDepthInPlan());
81018                     piece.setHeightInPlan(scale * piece.getHeightInPlan());
81019                 }
81020             }
81021         };
81022         return PlanController$5;
81023     }());
81024     PlanController.PlanController$5 = PlanController$5;
81025     var PlanController$6 = /** @class */ (function () {
81026         function PlanController$6(__parent) {
81027             this.__parent = __parent;
81028         }
81029         PlanController$6.prototype.propertyChange = function (ev) {
81030             this.__parent.resetAreaCache();
81031         };
81032         return PlanController$6;
81033     }());
81034     PlanController.PlanController$6 = PlanController$6;
81035     var PlanController$7 = /** @class */ (function () {
81036         function PlanController$7(__parent) {
81037             this.__parent = __parent;
81038         }
81039         PlanController$7.prototype.compare = function (p1, p2) {
81040             return -(p1.getGroundElevation() - p2.getGroundElevation());
81041         };
81042         return PlanController$7;
81043     }());
81044     PlanController.PlanController$7 = PlanController$7;
81045 })(PlanController || (PlanController = {}));
81046 PlanController.Mode.LABEL_CREATION_$LI$();
81047 PlanController.Mode.DIMENSION_LINE_CREATION_$LI$();
81048 PlanController.Mode.POLYLINE_CREATION_$LI$();
81049 PlanController.Mode.ROOM_CREATION_$LI$();
81050 PlanController.Mode.WALL_CREATION_$LI$();
81051 PlanController.Mode.PANNING_$LI$();
81052 PlanController.Mode.SELECTION_$LI$();
81053 Home.LEVEL_ELEVATION_COMPARATOR_$LI$();
81054 HomeController.UserPreferencesChangeListener.writingPreferences_$LI$();
81055 CatalogLight.EMPTY_LIGHT_SOURCE_MATERIAL_NAMES_$LI$();
81056 CatalogLight.EMPTY_LIGHT_SOURCES_$LI$();
81057 CatalogShelfUnit.EMPTY_SHELF_BOXES_$LI$();
81058 CatalogShelfUnit.EMPTY_SHELF_ELEVATIONS_$LI$();
81059 HomePieceOfFurniture.SORTABLE_PROPERTY_COMPARATORS_$LI$();
81060 HomePieceOfFurniture.EMPTY_PROPERTY_ARRAY_$LI$();
81061 HomePieceOfFurniture.ROUND_WALL_ANGLE_MARGIN_$LI$();
81062 HomePieceOfFurniture.STRAIGHT_WALL_ANGLE_MARGIN_$LI$();
81063 HomePieceOfFurniture.TWICE_PI_$LI$();
81064 HomePieceOfFurniture.__static_initialize();
81065 Label.TWICE_PI_$LI$();
81066 Room.TWICE_PI_$LI$();
81067 ExportableView.FormatType.CSV_$LI$();
81068 ExportableView.FormatType.SVG_$LI$();
81069 TransferableView.DataType.FURNITURE_LIST_$LI$();
81070 TransferableView.DataType.PLAN_IMAGE_$LI$();
81071 FurnitureCategory.COMPARATOR_$LI$();
81072 CatalogPieceOfFurniture.recentFilters_$LI$();
81073 CatalogPieceOfFurniture.COMPARATOR_$LI$();
81074 CatalogPieceOfFurniture.EMPTY_CRITERIA_$LI$();
81075 CatalogPieceOfFurniture.__static_initialize();
81076 Baseboard.baseboardsCache_$LI$();
81077 TextStyle.textStylesCache_$LI$();
81078 CatalogTexture.recentFilters_$LI$();
81079 CatalogTexture.COMPARATOR_$LI$();
81080 CatalogTexture.EMPTY_CRITERIA_$LI$();
81081 CatalogTexture.__static_initialize();
81082 TexturesCategory.COMPARATOR_$LI$();
81083