1 |
- var DesignCAD=function(){"use strict";var t=KanKan.config(),o={zh:{cad:{floor:"楼层",remove:"删除部件",attribute:"属性",split:"拆分",toolbar:{recall:"撤销",recover:"恢复",clear:"清空",default:"恢复默认",rotate:"旋转",download:"下载",flex:"适应视图",panos:"漫游点",texture:"底图",unit:"测量单位"},classify:{wall:"墙类",door:"门",window:"窗",structure:"构建",tag:"标注"},items:{Wall:"内墙",OutWall:"外墙",SingleDoor:"门",DoubleDoor:"双开门",SlideDoor:"移门",Pass:"垭口",SingleWindow:"窗",BayWindow:"飘窗",FrenchWindow:"落地窗",Beam:"柱子",Flue:"烟道",Corridor:"楼道",Tag:"标注",WallCorner:"点",compass:"指南针"}}}},i=t.lang||"zh";"zh"!=i&&"object"!=typeof t[o]&&(o[i]=t[i]);var s=function(t){if(!t||!o[i])return t;if(-1===t.indexOf("."))return o[i]||t;for(var e=t.split("."),n=null,s=0;s<e.length;s++)if("object"!=typeof(n=null===n?o[i][e[s]]:n[e[s]])&&s===e.length-1)return void 0===n?t:n;return void 0===n?t:n},r=function(){this.version="v4.0",this.floors=[]};r.prototype.initFloor=function(t){this.floors[t]={},this.floors[t].points={},this.floors[t].walls={},this.floors[t].symbols={},this.floors[t].components={},this.floors[t].tags={},this.floors[t].furnitures={},this.floors[t].boundingBox={},this.floors[t].rooms=[],this.floors[t].panos=[]};var l=new r;window.floorplanData=l;var a={minPixDistance:10,minPixLen:3,minScreenDis:2,minAdsorbRec:3,furnitureWidth:32,minRealDis:.1,minAdsorb:.1,minAngle:15,maxAngle:165,defaultZoom:100,minSymbolLen:.2,maxSymbolLen:10,ratio:3,miniMap_Width:1200,miniMap_Height:1200},h=function(){};h.prototype.getFixed=function(t,e){return e||(e=5),parseFloat(t.toFixed(e))},h.prototype.getDistance=function(t,e){var o=t.x,i=t.y,n=e.x,s=e.y,r=Math.sqrt(Math.pow(o-n,2)+Math.pow(i-s,2));return this.getFixed(r)},h.prototype.createLine1=function(t,e){if(t.x==e.x&&t.y==e.y)return null;if(0==this.getFixed(Math.abs(t.x-e.x)))return{x:t.x};if(0==this.getFixed(Math.abs(t.y-e.y)))return{y:t.y};var o=(t.y-e.y)/(t.x-e.x),i=(t.x*e.y-e.x*t.y)/(t.x-e.x);return 0==this.getFixed(o)?{y:this.getFixed(i)}:{a:this.getFixed(o),b:this.getFixed(i)}},h.prototype.createLine2=function(t,e){if(e==Math.PI/2||e==1.5*Math.PI)return{x:t.x};var o=Math.tan(e),i=t.y-o*t.x;return 0!=o?{a:o,b:i}:{y:t.y}},h.prototype.createLine3=function(t,e){var o={};return void 0===t.a?void 0!==t.x?o.x=e.x:void 0!==t.y&&(o.y=e.y):(o.a=t.a,o.b=e.y-e.x*t.a),o},h.prototype.create2AngleLine=function(t,e,o){return{line1:this.createLine2(t,e-o/2),line2:this.createLine2(t,e+o/2)}},h.prototype.distanceForPoints=function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},h.prototype.getParallelLineForDistance=function(t,e){var o={},i={};if(t.hasOwnProperty("a")){o.a=t.a,o.b=t.b,i.a=t.a,i.b=t.b;var n=Math.atan(t.a),s=Math.abs(e/Math.cos(n)),r=t.b;o.b=r+s,i.b=r-s}else if(t.hasOwnProperty("x")){var l=t.x;o.x=l+e,i.x=l-e}else if(t.hasOwnProperty("y")){var a=t.y;o.y=a+e,i.y=a-e}return{line1:o,line2:i}},h.prototype.getEndpoint=function(t,e,o){var i=this.create2AngleLine(t,e,o),n=this.createLine2(t,e);n=this.getLineForPoint(n,t);var s=this.getParallelLineForDistance(n,15),r=this.getIntersectionPoint(i.line1,s.line1),l=this.getIntersectionPoint(i.line1,s.line2),a=this.getIntersectionPoint(i.line2,s.line1),h=this.getIntersectionPoint(i.line2,s.line2),c=this.Angle(t,r,{x:t.x+1,y:t.y}),u=this.Angle(t,l,{x:t.x+1,y:t.y}),d=this.Angle(t,a,{x:t.x+1,y:t.y}),y=this.Angle(t,h,{x:t.x+1,y:t.y});return e>Math.PI&&(e=2*Math.PI-e),Math.abs((c+d)/2-e)<Math.abs((u+y)/2-e)?{p1:r,p2:a}:{p1:l,p2:h}},h.prototype.isClockwise=function(t){for(var e=0,o=0;o<t.length;o++){var i=(o+1)%t.length;e+=t[o].x*t[i].y,e-=t[i].x*t[o].y}return e/2>0},h.prototype.reverse=function(t){for(var e=[],o=t.length-1;o>-1;--o)e.push(t[o]);return e},h.prototype.getIntersectionPoint=function(t,e){if(this.isParallel(t,e))return null;if(void 0===t.a&&void 0!==e.a){if(t.x)return{x:t.x,y:e.a*t.x+e.b};if(t.y)return{x:(t.y-e.b)/e.a,y:t.y}}else if(void 0===e.a&&void 0!==t.a){if(e.x)return{x:e.x,y:t.a*e.x+t.b};if(e.y)return{x:(e.y-t.b)/t.a,y:e.y}}else if(void 0===e.a&&void 0===t.a)return t.hasOwnProperty("x")&&e.hasOwnProperty("y")?{x:t.x,y:e.y}:t.hasOwnProperty("y")&&e.hasOwnProperty("x")?{x:e.x,y:t.y}:null;return t.a==e.a?null:{x:(e.b-t.b)/(t.a-e.a),y:(t.a*e.b-e.a*t.b)/(t.a-e.a)}},h.prototype.getIntersectionPoint2=function(t,e,o,i){var n=(e.y-t.y)*(i.x-o.x)-(t.x-e.x)*(o.y-i.y);return 0==n?null:{x:((e.x-t.x)*(i.x-o.x)*(o.y-t.y)+(e.y-t.y)*(i.x-o.x)*t.x-(i.y-o.y)*(e.x-t.x)*o.x)/n,y:-((e.y-t.y)*(i.y-o.y)*(o.x-t.x)+(e.x-t.x)*(i.y-o.y)*t.y-(i.x-o.x)*(e.y-t.y)*o.y)/n}},h.prototype.getIntersectionPoint3=function(t,e,o,i){var n=this.getIntersectionPoint2(t,e,o,i);if(n){var s=n.x,r=n.y;return(s-t.x)*(s-e.x)<=.001&&(r-t.y)*(r-e.y)<=.001&&(s-o.x)*(s-i.x)<=.001&&(r-o.y)*(r-i.y)<=.001?{x:s,y:r}:null}return null},h.prototype.getIntersectionPoint4=function(t,e,o){var i=this.createLine1(t,e),n=this.getIntersectionPoint(i,o);return null==n?null:this.PointInSegment(n,t,e)?n:null},h.prototype.isParallel=function(t,e){return void 0===t.a&&void 0===e.a?!(!t.hasOwnProperty("x")||!e.hasOwnProperty("x"))||!(!t.hasOwnProperty("y")||!e.hasOwnProperty("y")):void 0!==t.a&&void 0!==e.a&&this.getFixed(t.a)==this.getFixed(e.a)},h.prototype.Angle=function(t,e,o){var i,n,s=0,r=e.x-t.x,l=e.y-t.y,a=o.x-t.x,h=o.y-t.y;return s=r*a+l*h,n=(r*r+l*l)*(a*a+h*h),(s/=Math.sqrt(n))>=1?0:s<=-1?Math.PI:180*(i=Math.acos(s))/Math.PI<180?i:2*Math.PI-i},h.prototype.getLineForPoint=function(t,e){var o={};return 0==t.a||void 0===t.a?t.hasOwnProperty("x")?o.y=e.y:t.hasOwnProperty("y")&&(o.x=e.x):(o.a=-1/t.a,o.b=e.y-e.x*o.a),o},h.prototype.getJoinLinePoint=function(t,e){var o=this.getVerticalLine(e,t);return this.getIntersectionPoint(e,o)},h.prototype.getDisForPoinLine=function(t,e){var o=this.getJoinLinePoint(t,e);return this.getDistance(t,o)},h.prototype.getVerticalLine=function(t,e){if(void 0===t.a)return t.hasOwnProperty("x")?{y:e.y}:t.hasOwnProperty("y")?{x:e.x}:null;if(0==t.a)return{x:e.x};var o={};return o.a=-1/t.a,this.createLine3(o,e)},h.prototype.isContainForSegment=function(t,e,o,i){i||(i=a.minAdsorb);var n=this.getDistance(e,t)+this.getDistance(o,t),s=this.getDistance(e,o);return Math.abs(n-s)<i},h.prototype.isPointInPoly=function(t,e){for(var o=t.x,i=t.y,n=!1,s=0,r=e.length-1;s<e.length;r=s++){var l=e[s],a=e[r],h=l.x,c=l.y,u=a.x,d=a.y;c>i!=d>i&&o<(u-h)*(i-c)/(d-c)+h&&(n=!n)}return n},h.prototype.getDisForPoinSegment=function(t,e,o,i){var n=this.createLine1(e,o),s=this.getJoinLinePoint(t,n),r=this.getDistance(e,o),l=this.getDistance(s,e),a=this.getDistance(s,o);return this.getDistance(s,e)>r||this.getDistance(s,o)>r?l<a&&l<i?{type:1,join:e}:a<l&&a<i?{type:2,join:o}:null:l<i?{type:1,join:e}:a<i?{type:2,join:o}:this.getDistance(t,s)<i?{type:0,join:s}:void 0},h.prototype.PointInSegment=function(t,e,o,i){if(this.getDistance(t,e)<a.minAdsorb||this.getDistance(t,o)<a.minAdsorb)return!0;i||(i=.1),i/=2;var n=(t.x-e.x)*(o.y-e.y)-(o.x-e.x)*(t.y-e.y),s=Math.min(e.x,o.x)-t.x,r=t.x-Math.max(e.x,o.x),l=Math.min(e.y,o.y)-t.y,h=t.y-Math.max(e.y,o.y);return Math.abs(n)<i&&(s<=0||Math.abs(s)<i)&&(r<=0||Math.abs(r)<i)&&(l<=0||Math.abs(l)<i)&&(h<=0||Math.abs(h)<i)},h.prototype.isPointOnSegment=function(t,e,o){var i=t.x-e.x,n=t.y-e.y,s=t.x-o.x,r=t.y-o.y,l=o.x-e.x,a=o.y-e.y,h=this.getDistance(e,o),c=l/h,u=a/h;return i*c+n*u>=0&&s*c+r*u<=0&&Math.abs(i*r-n*s)<=.001},h.prototype.clonePoint=function(t,e){t.x=e.x,t.y=e.y},h.prototype.equalPoint=function(t,e){return t.x==e.x&&t.y==e.y},h.prototype.crossTwoLines=function(t,e,o,i,n){void 0===n&&(n=a.minAdsorb);var s=this.getIntersectionPoint2(t,e,o,i);if(null!=s){if(this.getDistance(t,s)>n&&this.getDistance(e,s)>n&&this.getDistance(o,s)>n&&this.getDistance(i,s)>n)return this.getDistance(t,s)<this.getDistance(t,e)&&this.getDistance(e,s)<this.getDistance(t,e)&&this.getDistance(o,s)<this.getDistance(o,i)&&this.getDistance(i,s)<this.getDistance(o,i)}else if(this.PointInSegment(t,o,i)||this.PointInSegment(e,o,i))return!0;return!1},h.prototype.getDisPointsLine=function(t,e,o,i){var n={},s={},r={};if(t.hasOwnProperty("x"))n.x=t.x,n.y=e.y-o,s.x=t.x,s.y=e.y+i;else if(t.hasOwnProperty("y"))n.y=t.y,n.x=e.x-o,s.y=t.y,s.x=e.x+i;else{var l=Math.atan(t.a),a={a:-1/t.a},h=this.createLine3(a,e),c=this.getIntersectionPoint(t,h);n.x=c.x-o*Math.cos(l),n.y=c.y-o*Math.sin(l),s.x=c.x+i*Math.cos(l),s.y=c.y+i*Math.sin(l)}return r.newpoint1=n,r.newpoint2=s,r},h.prototype.getBoundingBox=function(t){for(var e=t[0].x,o=t[0].x,i=t[0].y,n=t[0].y,s=1;s<t.length;++s){var r=t[s];e>r.x&&(e=r.x),i>r.y&&(i=r.y),o<r.x&&(o=r.x),n<r.y&&(n=r.y)}var l={};return l.minX=e,l.minY=i,l.maxX=o,l.maxY=n,l},h.prototype.getBoundingBox2=function(t){var e=null,o=null,i=null,n=null;for(var s in t){var r=t[s];(null==e||e>r.x)&&(e=r.x),(null==i||i>r.y)&&(i=r.y),(null==o||o<r.x)&&(o=r.x),(null==n||n<r.y)&&(n=r.y)}var l={};return l.minX=e,l.minY=i,l.maxX=o,l.maxY=n,l},h.prototype.ComputePolygonArea=function(t){var e=t.length;if(e<3)return 0;for(var o=t[0].y*(t[e-1].x-t[1].x),i=1;i<e;++i)o+=t[i].y*(t[i-1].x-t[(i+1)%e].x);return Math.abs(o/2)},h.prototype.getPolygonCore=function(t){function e(t,e,o){return(t.x*e.y+e.x*o.y+o.x*t.y-e.x*t.y-o.x*e.y-t.x*o.y)/2}for(var o=0,i=0,n=0,s=t[1],r=2;r<t.length;r++){var l=t[r],a=e(t[0],s,l);n+=a,o+=(t[0].x+s.x+l.x)*a,i+=(t[0].y+s.y+l.y)*a,s=l}return{x:o/n/3,y:i/n/3}},h.prototype.isPolyInPoly=function(t,e,o){for(var i=0;i<t.length;++i){for(var n=!1,s=0;s<e.length;++s)if(this.equalPoint(t[i],e[s])){n=!0;break}if(n){var r=i==t.length-1?0:i+1,l={x:(t[i].x+t[r].x)/2,y:(t[i].y+t[r].y)/2};if(!this.isPointInPoly(l,e,o))return!1}else if(!this.isPointInPoly(t[i],e,o))return!1}return!0},h.prototype.dotPoints=function(t,e,o,i){var n={},s={};return n.start={},n.end={},n.start.x=0,n.start.y=0,n.end.x=e.x-t.x,n.end.y=e.y-t.y,s.start={},s.end={},s.start.x=0,s.start.y=0,s.end.x=i.x-o.x,s.end.y=i.y-o.y,n.end.x*s.end.x+n.end.y*s.end.y},h.prototype.translate=function(t,e,o,i){var n=e.x-t.x,s=e.y-t.y,r=Math.sqrt(Math.pow(n,2)+Math.pow(s,2));return{x:o.x+n*i/r,y:o.y+s*i/r}},h.prototype.raySegmentIntersection=function(t,e,o,i){var n={x:t.x+e.x,y:t.y-e.z},s=this.createLine1(t,n),r=this.getIntersectionPoint4(o,i,s);return null==r||this.getDistance(n,r)-(this.getDistance(t,r)+this.getDistance(t,n))+.01>0?null:r};var c=new h,u="Point",d="WallCorner",y="Wall",p="SingleDoor",x="DoubleDoor",g="SlideDoor",f="SingleWindow",m="BayWindow",v="FrenchWindow",S="Pass",P="Beam",b="Flue",I="Corridor",k="Line",T="Tag",F="TV",w="CombinationSofa",C="SingleSofa",W="TeaTable",D="Carpet",z="Plant",L="DiningTable",M="DoubleBed",R="SingleBed",O="Wardrobe",A="Dresser",E="BedsideCupboard",B="Pillow",_="GasStove",Y="Cupboard",N="Bathtub",X="Closestool",j="Washstand",U="Desk",J="BalconyChair",V="Elevator",H="all",$="start",Z="end",G="select",K="LEFT",q="RIGHT",Q=function(){this.len=null};Q.prototype.setId=function(t){null==t||void 0===t?(t=he.getCurrentId(),he.updateCurrentId(),this.vectorId=this.geoType+t):this.vectorId=t},Q.prototype.setSymbolPosition=function(t,e){"start"==e?c.clonePoint(this.startPoint,t):"end"==e&&c.clonePoint(this.endPoint,t)},Q.prototype.setSymbolParent=function(t){this.parent=t},Q.prototype.setPointParent=function(t,e){null==this.parent&&(this.parent={}),this.parent[t]=e},Q.prototype.setOpenSide=function(t){var e=[];e.push(this.startPoint),e.push(this.endPoint),e.push(t);var o=null;o=c.isClockwise(e)?K:q,this.openSide=o},Q.prototype.rotatePoint=function(t,e,o){o*=-1;var i=e.x,n=e.y,s=t.x,r=t.y;return{x:i+(s-i)*Math.cos(o*Math.PI/180)-(r-n)*Math.sin(o*Math.PI/180),y:n+(s-i)*Math.sin(o*Math.PI/180)+(r-n)*Math.cos(o*Math.PI/180)}};var tt=function(t){function e(e,o,i,n){t.call(this),this.startPoint=e,this.endPoint=o,this.floor=n,this.openSide=null,this.parent=null,this.enter=null,this.points2d=[],this.position3d={},this.name="单开门",this.geoType=p,this.setId(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setPoints2d=function(){var t=c.createLine1(this.startPoint,this.endPoint),e=c.getDistance(this.startPoint,this.endPoint),o=c.getParallelLineForDistance(t,e),i=c.getVerticalLine(t,this.startPoint),n=c.getVerticalLine(t,this.endPoint),s=c.getIntersectionPoint(o.line1,i),r=c.getIntersectionPoint(o.line2,i),l=c.getIntersectionPoint(o.line1,n),a=c.getIntersectionPoint(o.line2,n);if(this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(this.endPoint),this.points2d.push(l),this.points2d.push(s),this.openSide==K){if(c.isClockwise(this.points2d))return;this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(this.endPoint),this.points2d.push(a),this.points2d.push(r)}else if(this.openSide==q){if(!c.isClockwise(this.points2d))return;this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(this.endPoint),this.points2d.push(a),this.points2d.push(r)}},e.prototype.isContain=function(t){var e=c.getDistance(t,this.startPoint),o=c.getDistance(t,this.endPoint);if(e<a.minAdsorb)return $;if(o<a.minAdsorb)return Z;if(c.isContainForSegment(t,this.startPoint,this.endPoint))return G;var i=c.getDistance(this.points2d[0],this.points2d[1]);if(c.getDistance(t,this.points2d[0])>i)return null;var n=c.Angle(this.points2d[0],t,this.points2d[1]),s=c.Angle(this.points2d[0],t,this.points2d[3]);return n<Math.PI/2&&s<Math.PI/2?G:null},e}(Q),et=function(t){function e(e,o,i,n){t.call(this),this.startPoint=e,this.endPoint=o,this.floor=n,this.openSide=null,this.parent=null,this.enter=null,this.points2d=[],this.position3d={},this.name="双开门",this.geoType=x,this.setId(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setPoints2d=function(){var t=c.createLine1(this.startPoint,this.endPoint),e=c.getDistance(this.startPoint,this.endPoint),o=c.getParallelLineForDistance(t,e/2),i=c.getVerticalLine(t,this.startPoint),n=c.getVerticalLine(t,this.endPoint),s={x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2},r=c.getVerticalLine(t,s),l=c.getIntersectionPoint(o.line1,i),a=c.getIntersectionPoint(o.line2,i),h=c.getIntersectionPoint(o.line1,n),u=c.getIntersectionPoint(o.line2,n),d=c.getIntersectionPoint(o.line1,r),y=c.getIntersectionPoint(o.line2,r);if(this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(s),this.points2d.push(this.endPoint),this.points2d.push(h),this.points2d.push(d),this.points2d.push(l),this.openSide==K){if(c.isClockwise(this.points2d))return;this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(s),this.points2d.push(this.endPoint),this.points2d.push(u),this.points2d.push(y),this.points2d.push(a)}else if(this.openSide==q){if(!c.isClockwise(this.points2d))return;this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(s),this.points2d.push(this.endPoint),this.points2d.push(u),this.points2d.push(y),this.points2d.push(a)}},e.prototype.isContain=function(t){var e=c.getDistance(t,this.startPoint),o=c.getDistance(t,this.endPoint);if(e<a.minAdsorb)return $;if(o<a.minAdsorb)return Z;if(c.isContainForSegment(t,this.startPoint,this.endPoint))return G;var i=[];if(i.push(this.startPoint),i.push(this.endPoint),i.push(t),this.openSide==K){if(!c.isClockwise(i))return null}else if(this.openSide==q&&c.isClockwise(i))return null;var n={x:(this.points2d[0].x+this.points2d[1].x)/2,y:(this.points2d[0].y+this.points2d[1].y)/2},s=c.getDistance(this.points2d[1],this.points2d[2]),r=c.getDistance(t,this.points2d[0]);if(r<s){var l=c.Angle(this.points2d[0],t,this.points2d[5]),h=c.Angle(this.points2d[0],t,n);if(l<Math.PI/2&&h<Math.PI/2)return G}if((r=c.getDistance(t,this.points2d[2]))<s){var u=c.Angle(this.points2d[2],t,this.points2d[3]),d=c.Angle(this.points2d[2],t,n);if(u<Math.PI/2&&d<Math.PI/2)return G}return null},e}(Q),ot=function(t){function e(e,o,i,n){t.call(this),this.startPoint=e,this.endPoint=o,this.floor=n,this.openSide=null,this.parent=null,this.enter=null,this.points2d=[],this.position3d={},this.name="滑动门",this.geoType=g,this.setId(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setPoints2d=function(){var t=c.createLine1(this.startPoint,this.endPoint),e=2/le.res,o=c.getParallelLineForDistance(t,e);if(this.startPoint.x>this.endPoint.x){var i=o.line1;o.line1=o.line2,o.line2=i}var n=c.getVerticalLine(t,this.startPoint),s=c.getVerticalLine(t,this.endPoint),r=o.line1,l=o.line2,a=c.getIntersectionPoint(o.line1,n),h=c.getIntersectionPoint(o.line2,s);this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(this.endPoint),this.points2d.push(a),c.isClockwise(this.points2d)?null==this.openSide||"LEFT"==this.openSide||(r=o.line2,l=o.line1,a=c.getIntersectionPoint(r,n),h=c.getIntersectionPoint(l,s)):null!=this.openSide&&"LEFT"!=this.openSide||(r=o.line2,l=o.line1,a=c.getIntersectionPoint(r,n),h=c.getIntersectionPoint(l,s));var u={x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2};this.points2d=[],this.points2d.push(this.startPoint);var d=4/le.res,y=c.getVerticalLine(t,u),p=c.getParallelLineForDistance(y,d),x=c.getIntersectionPoint(r,p.line1),g=c.getIntersectionPoint(r,p.line2),f=c.getIntersectionPoint(l,p.line1),m=c.getIntersectionPoint(l,p.line2),v=c.getIntersectionPoint(t,p.line1),S=c.getIntersectionPoint(t,p.line2);c.getDistance(this.startPoint,v)<c.getDistance(this.startPoint,S)?(this.points2d.push(S),this.points2d.push(g),this.points2d.push(a),this.points2d.push(this.endPoint),this.points2d.push(v),this.points2d.push(f),this.points2d.push(h)):(this.points2d.push(v),this.points2d.push(x),this.points2d.push(a),this.points2d.push(this.endPoint),this.points2d.push(S),this.points2d.push(m),this.points2d.push(h))},e.prototype.isContain=function(t){var e=c.getDistance(t,this.startPoint),o=c.getDistance(t,this.endPoint);return e<a.minAdsorb?$:o<a.minAdsorb?Z:c.isContainForSegment(t,this.startPoint,this.endPoint)?G:null},e}(Q),it=function(t){function e(e,o,i,n){t.call(this),this.startPoint=e,this.endPoint=o,this.floor=n,this.parent=null,this.points2d=[],this.position3d={},this.name="单开窗",this.geoType=f,this.setId(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setPoints2d=function(){this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(this.endPoint);var t=4/le.res,e=c.createLine1(this.startPoint,this.endPoint),o=c.getParallelLineForDistance(e,t),i=c.getVerticalLine(e,this.startPoint),n=c.getVerticalLine(e,this.endPoint),s=c.getIntersectionPoint(i,o.line1),r=c.getIntersectionPoint(n,o.line1),l=c.getIntersectionPoint(n,o.line2),a=c.getIntersectionPoint(i,o.line2);this.points2d.push(s),this.points2d.push(r),this.points2d.push(l),this.points2d.push(a)},e.prototype.isContain=function(t){var e=c.getDistance(t,this.startPoint),o=c.getDistance(t,this.endPoint);return e<a.minAdsorb?$:o<a.minAdsorb?Z:c.isContainForSegment(t,this.startPoint,this.endPoint)?G:null},e}(Q),nt=function(t){function e(e,o,i,n){t.call(this),this.startPoint=e,this.endPoint=o,this.floor=n,this.parent=null,this.points2d=[],this.position3d={},this.name="落地窗",this.geoType=v,this.setId(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setPoints2d=function(){var t=4/le.res,e=c.createLine1(this.startPoint,this.endPoint),o=c.getParallelLineForDistance(e,t),i=c.getVerticalLine(e,this.startPoint),n=c.getVerticalLine(e,this.endPoint);this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(this.endPoint);var s={x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2},r=c.getVerticalLine(e,s),l=c.getIntersectionPoint(i,o.line1),a=c.getIntersectionPoint(n,o.line1);this.points2d.push(l),this.points2d.push(a);var h=c.getIntersectionPoint(i,o.line2),u=c.getIntersectionPoint(n,o.line2);this.points2d.push(h),this.points2d.push(u);var d=c.getIntersectionPoint(r,o.line1),y=c.getIntersectionPoint(r,o.line2);this.points2d.push(d),this.points2d.push(y)},e.prototype.isContain=function(t){var e=c.getDistance(t,this.startPoint),o=c.getDistance(t,this.endPoint);return e<a.minAdsorb?$:o<a.minAdsorb?Z:c.isContainForSegment(t,this.startPoint,this.endPoint)?G:null},e}(Q),st=function(t){function e(e,o,i,n){t.call(this),this.startPoint=e,this.endPoint=o,this.floor=n,this.openSide="LEFT",this.parent=null,this.thickness=1,this.points2d=[],this.position3d={},this.name="飘窗",this.geoType=m,this.setId(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setPoints2d=function(){var t,e,o,i,n=c.createLine1(this.startPoint,this.endPoint),s=c.getDistance(this.startPoint,this.endPoint)/2,r=4/le.res+s,l={x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2},a=c.getVerticalLine(n,l),h=c.getParallelLineForDistance(a,s),u=c.getParallelLineForDistance(a,r);c.getDisForPoinLine(this.startPoint,h.line1)>c.getDisForPoinLine(this.startPoint,h.line2)?(t=h.line2,e=u.line2,o=h.line1,i=u.line1):(t=h.line1,e=u.line1,o=h.line2,i=u.line2);var d=c.getParallelLineForDistance(n,2/le.res),y=c.getParallelLineForDistance(n,this.thickness-2/le.res),p=c.getParallelLineForDistance(n,this.thickness),x=d.line1,g=d.line2,f=y.line2,m=p.line2,v=d.line2,S=d.line1,P=y.line1,b=p.line1,I=c.getIntersectionPoint(t,x),k=c.getIntersectionPoint(o,x),T=c.getIntersectionPoint(o,f),F=c.getIntersectionPoint(t,f),w=c.getIntersectionPoint(e,g),C=c.getIntersectionPoint(i,g),W=c.getIntersectionPoint(i,m),D=c.getIntersectionPoint(e,m),z=c.getIntersectionPoint(t,v),L=c.getIntersectionPoint(o,v),M=c.getIntersectionPoint(o,P),R=c.getIntersectionPoint(t,P),O=c.getIntersectionPoint(e,S),A=c.getIntersectionPoint(i,S),E=c.getIntersectionPoint(i,b),B=c.getIntersectionPoint(e,b);this.points2d=[],this.points2d.push(I),this.points2d.push(k),this.points2d.push(T),this.points2d.push(F),"LEFT"==this.openSide?c.isClockwise(this.points2d)?(this.points2d.push(w),this.points2d.push(C),this.points2d.push(W),this.points2d.push(D)):(this.points2d=[],this.points2d.push(z),this.points2d.push(L),this.points2d.push(M),this.points2d.push(R),this.points2d.push(O),this.points2d.push(A),this.points2d.push(E),this.points2d.push(B)):"RIGHT"==this.openSide&&(c.isClockwise(this.points2d)?(this.points2d=[],this.points2d.push(z),this.points2d.push(L),this.points2d.push(M),this.points2d.push(R),this.points2d.push(O),this.points2d.push(A),this.points2d.push(E),this.points2d.push(B)):(this.points2d.push(w),this.points2d.push(C),this.points2d.push(W),this.points2d.push(D)))},e.prototype.isContain=function(t){var e=c.getDistance(t,this.startPoint),o=c.getDistance(t,this.endPoint);if(e<a.minAdsorb)return $;if(o<a.minAdsorb)return Z;var i=c.isContainForSegment(t,this.startPoint,this.endPoint);if(i)return G;var n=[];return n[0]=this.points2d[4],n[1]=this.points2d[5],n[2]=this.points2d[6],n[3]=this.points2d[7],(i=c.isPointInPoly(t,n))?G:null},e}(Q),rt=function(t){function e(e,o,i,n){t.call(this),this.startPoint=e,this.endPoint=o,this.floor=n,this.parent=null,this.points2d=[],this.name="垭口",this.geoType=S,this.setId(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setPoints2d=function(){this.points2d=[];var t=5/le.res,e=c.createLine1(this.startPoint,this.endPoint),o=c.getParallelLineForDistance(e,t),i=c.getVerticalLine(e,this.startPoint),n=c.getVerticalLine(e,this.endPoint),s=c.getIntersectionPoint(i,o.line1),r=c.getIntersectionPoint(n,o.line1),l=c.getIntersectionPoint(n,o.line2),a=c.getIntersectionPoint(i,o.line2);this.points2d.push(s),this.points2d.push(r),this.points2d.push(l),this.points2d.push(a),t=2/le.res,o=c.getParallelLineForDistance(e,t);var h=c.getIntersectionPoint(i,o.line1),u=c.getIntersectionPoint(n,o.line1),d=c.getIntersectionPoint(n,o.line2),y=c.getIntersectionPoint(i,o.line2);this.points2d.push(h),this.points2d.push(u),this.points2d.push(d),this.points2d.push(y)},e.prototype.isContain=function(t){var e=c.getDistance(t,this.startPoint),o=c.getDistance(t,this.endPoint);return e<a.minAdsorb?$:o<a.minAdsorb?Z:c.isContainForSegment(t,this.startPoint,this.endPoint)?G:null},e}(Q),lt=function(t){function e(e,o,i,n){t.call(this),this.x=e,this.y=o,this.display=!1,this.floor=n,this.name=null,this.parent={},this.geoType=u,this.setId(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setPosition=function(t){this.x=t.x,this.y=t.y},e}(Q),at=function(t){function e(e,o,i,n){t.call(this),this.start=e,this.end=o,this.floor=n,this.children=[],this.out=!1,this.important=!1,this.geoType=y,this.setId(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getOtherPointId=function(t){return this.start==t?this.end:this.end==t?this.start:null},e.prototype.getPointId=function(t){return"start"==t?this.start:this.end},e.prototype.clearChildren=function(){this.children=[]},e.prototype.setImportant=function(t){this.important=t},e.prototype.setOut=function(t){this.out=t},e.prototype.setChildren=function(t){this.children=t},e}(Q),ht=function(){};ht.prototype.getLine=function(t){var e=he.getPoint(t.start),o=he.getPoint(t.end);return c.createLine1(e,o)},ht.prototype.isContain=function(t,e,o){var i=he.getPoint(t.start),n=he.getPoint(t.end);return c.isContainForSegment(e,i,n,o)},ht.prototype.addChildren=function(t,e){t.children.indexOf(e)<0&&t.children.push(e)},ht.prototype.createWall=function(t,e,o,i){var n=new at(t,e,o,i);return null!=i&&void 0!==i||(i=he.currentFloor),he.addWall(n,i),this.setPointParent(n.vectorId,t,"start",i),this.setPointParent(n.vectorId,e,"end",i),n},ht.prototype.createPoint=function(t,e,o,i){var n=new lt(t,e,o,i);return null!=i&&void 0!==i||(i=he.currentFloor),he.addPoint(n,i),n},ht.prototype.setPointParent=function(t,e,o,i){var n=he.getPoint(e,i),s=he.getWall(t,i);n.setPointParent(t,o),"start"==o?s.start=e:"end"==o&&(s.end=e)},ht.prototype.splitWall=function(t,e,o){var i=he.getWall(t),n=he.getPoint(i.start),s=he.getPoint(i.end),r=he.getPoint(e);c.getDistance(n,r)<a.minAdsorb||(c.getDistance(s,r),a.minAdsorb);var l=null;"start"==o?(delete s.parent[t],(l=this.createWall(e,i.end)).setOut(i.out),l.setImportant(i.important),this.setPointParent(t,e,"end"),s.setPointParent(l.vectorId,o)):"end"==o&&(delete n.parent[t],(l=this.createWall(i.start,e)).setOut(i.out),l.setImportant(i.important),this.setPointParent(t,e,"start"),n.setPointParent(l.vectorId,o));for(var h=0;h<i.children.length;++h){var u=i.children[h],d=he.getSymbol(u),y={x:(d.startPoint.x+d.endPoint.x)/2,y:(d.startPoint.y+d.endPoint.y)/2};this.isContain(l,y)&&(d.setSymbolParent(l.vectorId),i.children.splice(h,1),--h,l.children.push(u))}return l.vectorId},ht.prototype.getWallId=function(t,e){var o=he.getPoint(t),i=he.getPoint(e);if(!o||!i)return console.log("pointId1或者pointId2不存在"),null;if(t==e)return console.log("给的是同一个point"),null;var n=o.parent,s=i.parent;for(var r in n)if(s.hasOwnProperty(r))return r;return null},ht.prototype.isWallLink=function(t,e){var o=he.getWall(t),i=he.getWall(e);return o.start==i.start||o.start==i.end||o.end==i.start||o.end==i.end},ht.prototype.AngleForWall=function(t,e){var o=he.getWall(t),i=he.getWall(e);if(null==o||null==i||void 0===o||void 0===i)return null;var n=he.getPoint(o.start),s=he.getPoint(o.end),r=he.getPoint(i.start),l=he.getPoint(i.end),a=c.getDistance(n,r),h=c.getDistance(n,l),u=c.getDistance(s,r),d=c.getDistance(s,l),y=Math.min(a,h,u,d);return null==c.getIntersectionPoint2(n,s,r,l)?Math.PI:a==y?(s.x+=r.x-n.x,s.y+=r.y-n.y,c.Angle(r,s,l)):h==y?(s.x+=l.x-n.x,s.y+=l.y-n.y,c.Angle(l,s,r)):u==y?(n.x+=r.x-s.x,n.y+=r.y-s.y,c.Angle(r,n,l)):d==y?(n.x+=l.x-s.x,n.y+=l.y-s.y,c.Angle(l,n,r)):(console.error("AngleForWall**************************1"),null)},ht.prototype.AngleForWall2=function(t,e){var o=he.getWall(t),i=he.getWall(e);if(null==o||null==i||void 0===o||void 0===i)return null;var n=he.getPoint(o.start),s=he.getPoint(o.end),r=he.getPoint(i.start),l=he.getPoint(i.end),a=null,h=[];return h.push(n),h.push(s),o.start==i.start?(a=c.Angle(n,s,l),h.push(l)):o.start==i.end?(a=c.Angle(n,s,r),h.push(r)):o.end==i.start?(a=c.Angle(s,n,l),h[0]=s,h[1]=n,h.push(l)):o.end==i.end&&(a=c.Angle(s,n,r),h[0]=s,h[1]=n,h.push(r)),null==a?null:c.isClockwise(h)?{angle:a,clockwise:1}:{angle:a,clockwise:0}},ht.prototype.AngleForWall3=function(t,e){var o=he.getWall(t),i=he.getWall(e);if(null==o||null==i||void 0===o||void 0===i)return null;var n=he.getPoint(o.start),s=he.getPoint(o.end),r=he.getPoint(i.start),l=he.getPoint(i.end),a=c.getDistance(n,r),h=c.getDistance(n,l),u=c.getDistance(s,r),d=c.getDistance(s,l),y=Math.min(a,h,u,d),p={},x={};return a==y?(x.x=s.x+r.x-n.x,x.y=s.y+r.y-n.y,c.Angle(r,x,l)):h==y?(x.x=s.x+l.x-n.x,x.y=s.y+l.y-n.y,c.Angle(l,x,r)):u==y?(p.x=n.x+r.x-s.x,p.y=n.y+r.y-s.y,c.Angle(r,p,l)):d==y?(p.x=n.x+l.x-s.x,p.y=n.y+l.y-s.y,c.Angle(l,p,r)):(console.error("WallService.AngleForWall3************************************1"),null)},ht.prototype.wallIdForMinAngle=function(t,e){var o,i,n,s,r=he.getPoint(t).parent,l=null,a=null,h=null,c=null;if(Object.keys(r).length>2){for(var u in r)if(u!=e){var d=this.AngleForWall2(e,u);null==h&&1==d.clockwise?((i=d).wallId=u,h=d.angle,(s=d).wallId=u,c=d.angle):h>d.angle&&1==d.clockwise?((i=d).wallId=u,h=d.angle):c<d.angle&&1==d.clockwise?((s=d).wallId=u,c=d.angle):null==l&&0==d.clockwise?((o=d).wallId=u,l=d.angle,(n=d).wallId=u,a=d.angle):l>d.angle&&0==d.clockwise?((o=d).wallId=u,l=d.angle):a<d.angle&&0==d.clockwise&&((n=d).wallId=u,a=d.angle)}var y={min0:o,min1:i};return y.min0||(y.min0=s,y.min0.angle=360-s.angle),y.min1||(y.min1=n,y.min1.angle=360-n.angle),y}return console.error("wallIdForMinAngle*********************************************************"),null},ht.prototype.mergeWall=function(t,e){var o=this.getLinkPointId(t,e),i=he.getWall(e).getOtherPointId(o),n=he.getPoint(i);if(this.changeSymbolsWallToWall(e,t),Object.keys(n.parent).length>1)this.moveTo(o,i);else{he.deleteWall(e);var s=he.getPoint(o);c.clonePoint(s,n)}return i},ht.prototype.changeSymbolsWallToWall=function(t,e,o){for(var i=he.getWall(t,o),n=he.getWall(e,o),s=0;s<i.children.length;++s){var r=i.children[s];he.getSymbol(r,o).setSymbolParent(e),this.addChildren(n,r)}i.clearChildren()},ht.prototype.mergeWallForPoint=function(t){var e=he.getPoint(t);if(null!=e&&2==Object.keys(e.parent).length&&this.AngleForWall(Object.keys(e.parent)[0],Object.keys(e.parent)[1])>a.maxAngle/180*Math.PI)return this.mergeWall(Object.keys(e.parent)[0],Object.keys(e.parent)[1]);return null},ht.prototype.getLinkPointId=function(t,e){var o=he.getWall(t),i=he.getWall(e);return o.start==i.start||o.start==i.end?o.start:o.end==i.start||o.end==i.end?o.end:o.start==i.start?null:void 0},ht.prototype.moveTo=function(t,e){var o=this.getWallId(t,e),i=he.getPoint(t),n=he.getPoint(e);i.x,n.x,i.y,n.y;var s=i.parent,r=n.parent;for(var l in s)if(l!=o){var h=he.getWall(l).getOtherPointId(t),u=he.getPoint(h);for(var d in r)if(d!=o){var y=he.getWall(d).getOtherPointId(e),p=he.getPoint(y),x=c.Angle(n,u,p);if(Math.abs(x)<a.minAngle/180*Math.PI)return!1}}if(null!=o&&he.deleteWall(o),i=he.getPoint(t),n=he.getPoint(e),!i||!n)return!1;for(var g in s){var f=he.getWall(g),m=f.getOtherPointId(t);if(null!=this.getWallId(m,e))return!1;f.start==t?(he.deletePoint(f.start,g),f.start=e,n.setPointParent(g,"start")):f.end==t?(he.deletePoint(f.end,g),f.end=e,n.setPointParent(g,"end")):console.error("wallService.moveTo****************************************************")}return!0},ht.prototype.getDirction=function(t,e){var o=he.getWall(e);return o.start==t?"start":o.end==t?"end":(console.error("WallService.getDirction*******************************************************************************************"),null)},ht.prototype.isOverlapForMergePoint=function(t,e){var o=this.getWallId(t,e),i=he.getPoint(t),n=he.getPoint(e),s=i.x-n.x,r=i.y-n.y,l=i.parent,h=n.parent;for(var u in l)if(u!=o){var d=he.getWall(u).getOtherPointId(t),y=he.getPoint(d),p={x:y.x-s,y:y.y-r};for(var x in h)if(x!=o){var g=he.getWall(x).getOtherPointId(e),f=he.getPoint(g),m=c.Angle(n,p,f);if(Math.abs(m)<a.minAngle/180*Math.PI)return!0}}return!1},ht.prototype.subtraWallFromIntersect=function(t,e){var o=he.getPoint(t),i=o.parent,n=this.getDirction(t,e);if(1!=Object.keys(i).length){delete i[e];var s=this.createPoint(o.x,o.y);s.setPointParent(e,n);var r=he.getWall(e);"start"==n?r.start=s.vectorId:"end"==n&&(r.end=s.vectorId)}},ht.prototype.setWallInfo=function(t){var e=he.getWall(t.vectorId);return e.start=t.start,e.end=t.end,e.children=t.children,e.out=t.out,e.important=t.important,e},ht.prototype.setPointInfo=function(t){var e=he.getPoint(t.vectorId);return c.clonePoint(e,t.position),e.parent=JSON.parse(JSON.stringify(t.parent)),e},ht.prototype.getNeighPoints=function(t,e){var o=[],i=he.getPoint(t);for(var n in i.parent){var s=he.getWall(n).getOtherPointId(t);if(!e||e!=s){var r=he.getPoint(s);o.push(r)}}return o},ht.prototype.deleteWallCorner=function(t){var e=he.getPoint(t);if(1==Object.keys(e.parent).length)he.deleteWall(Object.keys(e.parent)[0]);else if(Object.keys(e.parent).length>2)for(var o in e.parent)he.deleteWall(o);else if(2==Object.keys(e.parent).length){this.AngleForWall(Object.keys(e.parent)[0],Object.keys(e.parent)[1])>a.maxAngle/180*Math.PI?this.mergeWall(Object.keys(e.parent)[0],Object.keys(e.parent)[1]):(he.deleteWall(Object.keys(e.parent)[0]),he.deleteWall(Object.keys(e.parent)[0]))}};var ct=new ht,ut=function(t){function e(e,o){t.call(this),this.center=e,this.angle=0,this.points2d=[],this.sideWidth=.65,this.sideThickness=.65,this.name="柱子",this.geoType=P,this.setId(o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isContain=function(t){return c.isPointInPoly(t,this.points2d)},e.prototype.setPoints2d=function(){this.points2d=[];var t=this.center.x-this.sideWidth/2,e=this.center.y-this.sideThickness/2,o=this.center.x+this.sideWidth/2,i=this.center.y+this.sideThickness/2,n=this.rotatePoint({x:t,y:i},this.center,this.angle),s=this.rotatePoint({x:o,y:i},this.center,this.angle),r=this.rotatePoint({x:o,y:e},this.center,this.angle),l=this.rotatePoint({x:t,y:e},this.center,this.angle);this.points2d.push(n),this.points2d.push(s),this.points2d.push(r),this.points2d.push(l)},e}(Q),dt=function(t){function e(e,o){t.call(this),this.center=e,this.angle=0,this.points2d=[],this.sideWidth=.65,this.sideThickness=.65,this.name="烟道",this.geoType=b,this.setId(o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isContain=function(t){var e=[];return e.push(this.points2d[0]),e.push(this.points2d[1]),e.push(this.points2d[2]),e.push(this.points2d[3]),c.isPointInPoly(t,e)},e.prototype.setPoints2d=function(){this.points2d=[];var t=this.center.x-this.sideWidth/2,e=this.center.y-this.sideThickness/2,o=this.center.x+this.sideWidth/2,i=this.center.y+this.sideThickness/2,n=this.rotatePoint({x:t,y:i},this.center,this.angle),s=this.rotatePoint({x:o,y:i},this.center,this.angle),r=this.rotatePoint({x:o,y:e},this.center,this.angle),l=this.rotatePoint({x:t,y:e},this.center,this.angle);this.points2d.push(n),this.points2d.push(s),this.points2d.push(r),this.points2d.push(l),t=this.center.x-(this.sideWidth-.1)/2,e=this.center.y-(this.sideThickness-.1)/2,o=this.center.x+(this.sideWidth-.1)/2,i=this.center.y+(this.sideThickness-.1)/2;var a=this.rotatePoint({x:t,y:i},this.center,this.angle),h=this.rotatePoint({x:o,y:i},this.center,this.angle),c=this.rotatePoint({x:o,y:e},this.center,this.angle),u=this.rotatePoint({x:t,y:e},this.center,this.angle),d={x:(this.center.x+h.x)/2,y:(this.center.y+h.y)/2};this.points2d.push(a),this.points2d.push(h),this.points2d.push(c),this.points2d.push(u),this.points2d.push(d)},e}(Q),yt=function(t){function e(e,o){t.call(this),this.center=e,this.angle=0,this.points2d=[],this.sideWidth=.65,this.sideThickness=.65,this.name="楼道",this.geoType=I,this.setId(o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isContain=function(t){var e=[];return e.push(this.points2d[0]),e.push(this.points2d[1]),e.push(this.points2d[2]),e.push(this.points2d[3]),c.isPointInPoly(t,e)},e.prototype.setPoints2d=function(){this.points2d=[];var t=this.center.x-this.sideWidth/2,e=this.center.y-this.sideThickness/2,o=this.center.x+this.sideWidth/2,i=this.center.y+this.sideThickness/2,n=this.rotatePoint({x:t,y:i},this.center,this.angle),s=this.rotatePoint({x:o,y:i},this.center,this.angle),r=this.rotatePoint({x:o,y:e},this.center,this.angle),l=this.rotatePoint({x:t,y:e},this.center,this.angle);this.points2d.push(n),this.points2d.push(s),this.points2d.push(r),this.points2d.push(l);var a=this.center.x-2/le.res,h=this.center.x+2/le.res,c=3/le.res,u=this.rotatePoint({x:a,y:i},this.center,this.angle),d=this.rotatePoint({x:a,y:e},this.center,this.angle);this.points2d.push(u),this.points2d.push(d);var y=this.rotatePoint({x:h,y:i},this.center,this.angle),p=this.rotatePoint({x:h,y:e},this.center,this.angle);this.points2d.push(y),this.points2d.push(p);for(var x=Math.floor(this.sideThickness*le.res/3),g=0;g<x-2;++g){var f=this.rotatePoint({x:t,y:i-(g+2)*c},this.center,this.angle),m=this.rotatePoint({x:a,y:i-(g+2)*c},this.center,this.angle);this.points2d.push(f),this.points2d.push(m);var v=this.rotatePoint({x:h,y:i-(g+1)*c},this.center,this.angle),S=this.rotatePoint({x:o,y:i-(g+1)*c},this.center,this.angle);this.points2d.push(v),this.points2d.push(S)}},e}(Q),pt=function(){this.sideWidth=.65,this.sideThickness=.65};pt.prototype.createComponent=function(t,e,o){var i=null;switch(e){case P:i=new ut(t,o);break;case b:i=new dt(t,o);break;case I:i=new yt(t,o)}return i.setPoints2d(),he.addComponent(i),i},pt.prototype.isComponent=function(t){switch(t){case P:case b:case I:return!0}return!1},pt.prototype.setComponentInfo=function(t){var e=he.getComponent(t.vectorId);e.vectorId=t.vectorId,e.angle=t.angle,e.center=JSON.parse(JSON.stringify(t.center)),e.points2d=JSON.parse(JSON.stringify(t.points2d))},pt.prototype.getBoundingVertexs=function(t,e){var o=he.getComponent(t),i=e.x-o.sideWidth/2,n=e.y-o.sideThickness/2,s=e.x+o.sideWidth/2,r=e.y+o.sideThickness/2,l=o.rotatePoint({x:i,y:r},e,o.angle),a=o.rotatePoint({x:s,y:r},e,o.angle),h=o.rotatePoint({x:s,y:n},e,o.angle),c=o.rotatePoint({x:i,y:n},e,o.angle),u=[];return u.push(l),u.push(a),u.push(h),u.push(c),u};var xt=new pt,gt=function(t){function e(e,o,i){t.call(this),this.center=e,this.geoType=i,this.angle=0,this.zoom=1,this.setId(o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isContain=function(t){var e=this.getBoundingVertexs(this.center);return c.isPointInPoly(t,e)},e.prototype.getScale=function(){switch(this.geoType){case F:return 1.3;case w:return 3.4;case C:return 1;case W:return.8;case D:return 2;case z:return 1;case L:return 2.4;case M:case R:return 2;case O:return 1.2;case A:return.8;case E:return.4;case B:return.6;case _:return 1;case Y:return 1.2;case N:return 1.6;case X:return.63;case j:return.8;case U:return 1.2;case J:return 2;case V:return 1.5}},e.prototype.getLengthWidth=function(){switch(this.geoType){case F:return{length:32,width:10};case w:return{length:32,width:28};case C:return{length:26,width:20};case W:return{length:30,width:16};case D:return{length:32,width:20};case z:return{length:28,width:28};case L:return{length:28,width:26};case M:return{length:24,width:26};case R:return{length:18,width:26};case O:return{length:30,width:18};case A:return{length:28,width:26};case E:return{length:28,width:28};case B:return{length:26,width:26};case _:return{length:32,width:20};case Y:return{length:12,width:32};case N:return{length:32,width:18};case X:return{length:22,width:28};case j:return{length:28,width:20};case U:return{length:26,width:20};case J:return{length:32,width:10};case V:return{length:28,width:28}}},e.prototype.getBoundingVertexs=function(t){var e=[],o=this.getLengthWidth(),i=this.getScale()*o.length*this.zoom/a.furnitureWidth,n=this.getScale()*o.width*this.zoom/a.furnitureWidth,s=t.x-i/2,r=t.y-n/2,l=t.x+i/2,h=t.y+n/2,c=this.rotatePoint({x:s,y:h},t,this.angle),u=this.rotatePoint({x:l,y:h},t,this.angle),d=this.rotatePoint({x:l,y:r},t,this.angle),y=this.rotatePoint({x:s,y:r},t,this.angle);return e.push(c),e.push(u),e.push(d),e.push(y),e},e}(Q),ft="Wall",mt="OutWall",vt="SingleDoor",St="DoubleDoor",Pt="SlideDoor",bt="SingleWindow",It="BayWindow",kt="FrenchWindow",Tt="Pass",Ft="Beam",wt="Flue",Ct="Corridor",Wt="Tag",Dt="TV",zt="CombinationSofa",Lt="SingleSofa",Mt="TeaTable",Rt="Carpet",Ot="Plant",At="DiningTable",Et="DoubleBed",Bt="SingleBed",_t="Wardrobe",Yt="Dresser",Nt="BedsideCupboard",Xt="Pillow",jt="GasStove",Ut="Cupboard",Jt="Bathtub",Vt="Closestool",Ht="Washstand",$t="Desk",Zt="BalconyChair",Gt="Elevator",Kt={TV:Dt,CombinationSofa:zt,SingleSofa:Lt,TeaTable:Mt,Carpet:Rt,Plant:Ot,DiningTable:At,DoubleBed:Et,SingleBed:Bt,Wardrobe:_t,Dresser:Yt,BedsideCupboard:Nt,Pillow:Xt,GasStove:jt,Cupboard:Ut,Bathtub:Jt,Closestool:Vt,Washstand:Ht,Desk:$t,BalconyChair:Zt,Elevator:Gt},qt=function(){this.$app=null,this.furnitures=null};qt.prototype.fetchFurnitures=function(){var t=this;if(!this.furnitures){this.furnitures={};var e=function(e){e==Kt.TV&&t.$app.store.getAppImage("images/cad/furnitures/"+Kt[e]+".svg").then((function(o){t.furnitures[Kt[e]]=o,console.log(t.furnitures)})).catch((function(t){console.error(t)}))};for(var o in Kt)e(o)}},qt.prototype.createFurniture=function(t,e,o){var i=null;switch(e){case F:i=new gt(t,o,F);break;case w:i=new gt(t,o,w);break;case C:i=new gt(t,o,C);break;case W:i=new gt(t,o,W);break;case D:i=new gt(t,o,D);break;case z:i=new gt(t,o,z);break;case L:i=new gt(t,o,L);break;case M:i=new gt(t,o,M);break;case R:i=new gt(t,o,R);break;case O:i=new gt(t,o,O);break;case A:i=new gt(t,o,A);break;case E:i=new gt(t,o,E);break;case B:i=new gt(t,o,B);break;case _:i=new gt(t,o,_);break;case Y:i=new gt(t,o,Y);break;case N:i=new gt(t,o,N);break;case X:i=new gt(t,o,X);break;case j:i=new gt(t,o,j);break;case U:i=new gt(t,o,U);break;case J:i=new gt(t,o,J);break;case V:i=new gt(t,o,V)}return he.addFurniture(i),i},qt.prototype.isFurniture=function(t){switch(t){case F:case w:case C:case W:case D:case z:case L:case M:case R:case O:case A:case E:case B:case _:case Y:case N:case X:case j:case U:case J:case V:return!0}return!1},qt.prototype.setFurnitureInfo=function(t){var e=he.getFurniture(t.vectorId);e.vectorId=t.vectorId,e.angle=t.angle,e.center=JSON.parse(JSON.stringify(t.center))},qt.prototype.getFurniture=function(t){return this.furnitures[t]};var Qt=new qt,te=function(){this.eventName=null,this.selectItem=null,this.focusItem=null,this.draggingItem=null};te.prototype.getEventName=function(){return this.eventName},te.prototype.setEventName=function(t){this.eventName=t},te.prototype.clearEventName=function(){this.eventName=null},te.prototype.setSelectItem=function(t,e,o){this.selectItem={},this.selectItem.vectorId=t,this.selectItem.type=e,se.isSymbol(e)?this.selectItem.selectIndex=o==G?H:o:xt.isComponent(e)?o==G&&(this.selectItem.selectIndex=H):e==T?this.selectItem.selectIndex=o==G?H:o:Qt.isFurniture(e)&&o==G&&(this.selectItem.selectIndex=H)},te.prototype.getSelectItem=function(){return this.selectItem},te.prototype.clearSelectItem=function(){this.selectItem=null},te.prototype.getDraggingItem=function(){return this.draggingItem},te.prototype.setDraggingItem=function(t){this.draggingItem=t},te.prototype.clearDraggingItem=function(){this.draggingItem=null},te.prototype.getFocusItem=function(){return this.focusItem},te.prototype.setFocusItem=function(t){this.focusItem=t},te.prototype.clearFocusItem=function(){this.focusItem=null},te.prototype.clearItems=function(){this.selectItem=null,this.focusItem=null,this.draggingItem=null};var ee=new te,oe=function(){this.symbol=null};oe.prototype.moveFullSymbol=function(t,e,o){var i=he.getSymbol(e),n=he.getWall(o);if(!n)return null;var s=ct.getLine(n),r=c.getVerticalLine(s,t),l=i.len;null==l&&(l=c.getDistance(i.startPoint,i.endPoint));var a=c.getIntersectionPoint(r,s),h=se.getNewPosForSymbol(a,o,e);null!=h&&h.state&&(c.dotPoints(i.startPoint,i.endPoint,h.position1,h.position2)>0?(c.clonePoint(i.startPoint,h.position1),c.clonePoint(i.endPoint,h.position2)):(c.clonePoint(i.endPoint,h.position1),c.clonePoint(i.startPoint,h.position2)),i.parent!=o&&se.changeSymbolForBelong(e,o),i.setOpenSide(t),i.setPoints2d(),se.setPosition3d(i))},oe.prototype.moveSymbolPoint=function(t,e,o){var i=se.moveSymbolSinglePoint(t,e,o);if(null==i)return null;var n=he.getSymbol(e),s={x:(n.startPoint.x+n.endPoint.x)/2,y:(n.startPoint.y+n.endPoint.y)/2},r=c.getDistance(s,i.position);if(r<a.minSymbolLen)return null;if(2*r>a.maxSymbolLen)return null;var l=he.getWall(n.parent),h=he.getPoint(l.start),u=he.getPoint(l.end);if(o==$){var d=se.getNewForContainSymbols(n.endPoint,i.position,n.parent,e);if(null==d||d.collision)return null;ct.isContain(l,i.position)?se.setPosition(n,i.position,"start"):c.getDistance(n.startPoint,h)<c.getDistance(n.startPoint,u)?se.setPosition(n,h,"start"):se.setPosition(n,u,"start")}else{var y=se.getNewForContainSymbols(n.startPoint,i.position,n.parent,e);if(null==y||y.collision)return null;ct.isContain(l,i.position)?se.setPosition(n,i.position,"end"):c.getDistance(n.endPoint,h)<c.getDistance(n.endPoint,u)?se.setPosition(n,h,"end"):se.setPosition(n,u,"end")}n.setPoints2d(),se.setPosition3d(n)};var ie=new oe,ne=function(){this.enterImg=null};ne.prototype.createSymbol=function(t,e,o,i,n){var s=null;switch(o){case m:s=new st(t,e,n);break;case v:s=new nt(t,e,n);break;case p:s=new tt(t,e,n);break;case x:s=new et(t,e,n);break;case g:s=new ot(t,e,n);break;case f:s=new it(t,e,n);break;case S:s=new rt(t,e,n)}if(null!=s&&(s.setSymbolParent(i),s.setPoints2d(),this.setPosition3d(s),he.addSymbol(s)),i){var r=he.getWall(i);ct.addChildren(r,s.vectorId)}return s.len=c.getDistance(t,e),s},ne.prototype.addSymbol=function(t,e,o){var i=this.getDefaultSymbolLen(e),n=he.getWall(o),s=ct.getLine(n);t=c.getJoinLinePoint(t,s);var r=this.getNewPosForSymbol(t,o,null,i);return r.state?this.createSymbol(r.position1,r.position2,e,o).vectorId:null},ne.prototype.setPosition3d=function(t){var e={x:(t.startPoint.x+t.endPoint.x)/2,y:(t.startPoint.y+t.endPoint.y)/2},o=he.getFloorHeight();t.position3d={x:e.x,y:o,z:-1*e.y}},ne.prototype.isSymbol=function(t){switch(t){case"BayWindow":case"FrenchWindow":case"SingleDoor":case"DoubleDoor":case"SlideDoor":case"SingleWindow":case"Pass":return!0}return!1},ne.prototype.getDefaultSymbolLen=function(t){var e=0;switch(t){case"BayWindow":case"FrenchWindow":e=1.5;break;case"SingleDoor":e=.8;break;case"DoubleDoor":case"SlideDoor":e=1.5;break;case"SingleWindow":case"Pass":e=.8}return e},ne.prototype.deleteSymbolForWall=function(t,e){if(t){var o=t.children.indexOf(e);o>-1&&t.children.splice(o,1),he.getSymbol(e).parent=null}},ne.prototype.deleteSymbol=function(t){var e=he.getSymbol(t);if(e.parent){var o=he.getWall(e.parent);this.deleteSymbolForWall(o,t)}he.deleteSymbol(t)},ne.prototype.changeSymbolForBelong=function(t,e){var o=he.getSymbol(t),i=o.parent,n=he.getWall(i);this.deleteSymbolForWall(n,t),o.setSymbolParent(e);var s=he.getWall(e);ct.addChildren(s,t)},ne.prototype.reBelongForSplitWall=function(t,e,o){for(var i=he.getWall(t),n=0;n<i.children.length;++n){var s=i.children[n];t!=e&&this.isContainSymbolForWall(s,e)?this.changeSymbolForBelong(s,e):t!=o&&this.isContainSymbolForWall(s,o)&&this.changeSymbolForBelong(s,o)}},ne.prototype.isContainSymbolForWall=function(t,e){var o=he.getWall(e),i=he.getSymbol(t),n={x:(i.startPoint.x+i.endPoint.x)/2,y:(i.startPoint.y+i.endPoint.y)/2};if(ct.isContain(o,n))return!0},ne.prototype.changeSymbolForBelong=function(t,e){var o=he.getSymbol(t),i=o.parent,n=he.getWall(i);this.deleteSymbolForWall(n,t),o.setSymbolParent(e);var s=he.getWall(e);ct.addChildren(s,t)},ne.prototype.updateSymbolsPositionsForWallCorner=function(t){var e=he.getPoint(t).parent;for(var o in e)this.updateSymbolsPositionsForWall(o)},ne.prototype.updateSymbolsPositionsForWall=function(t){for(var e=he.getWall(t).children,o=0;o<e.length;++o){var i=he.getSymbol(e[o]);this.updateSEForChangeWall(i)}},ne.prototype.updateSEForChangeWall=function(t){var e=t.vectorId,o=he.getWall(t.parent),i=he.getPoint(o.start),n=he.getPoint(o.end),s=c.createLine1(i,n),r=c.getJoinLinePoint(t.startPoint,s),l=c.getJoinLinePoint(t.endPoint,s),a={x:0,y:0},h=!0;ct.isContain(o,r)?ct.isContain(o,l)||(c.getDistance(l,i)<c.getDistance(l,n)?(a.x=i.x-l.x,a.y=i.y-l.y):(a.x=n.x-l.x,a.y=n.y-l.y),l.x+=a.x,l.y+=a.y,ct.isContain(o,{x:r.x+a.x,y:r.y+a.y})&&(r.x+=a.x,r.y+=a.y),h=!1):(c.getDistance(r,i)<c.getDistance(r,n)?(a.x=i.x-r.x,a.y=i.y-r.y):(a.x=n.x-r.x,a.y=n.y-r.y),r.x+=a.x,r.y+=a.y,ct.isContain(o,{x:l.x+a.x,y:l.y+a.y})&&(l.x+=a.x,l.y+=a.y),h=!1),h?(this.setPosition(t,r,"start"),this.setPosition(t,l,"end"),t.setPoints2d()):this.updateSEForCollideSymbols(e,r,l)},ne.prototype.updateSEForCollideSymbols=function(t,e,o){var i=he.getSymbol(t),n=this.getNewForContainSymbols(e,o,i.parent,t);null!=n&&(c.getDistance(n.position1,n.position2)<a.minSymbolLen?this.deleteSymbol(t):(this.setPosition(i,n.position1,"start"),this.setPosition(i,n.position2,"end"),i.setPoints2d()))},ne.prototype.getNewForContainSymbols=function(t,e,o,i){for(var n=he.getWall(o),s=[],r=0;r<n.children.length;++r){var l=n.children[r];if(l!=i){var h=he.getSymbol(l);s.push({x:h.startPoint.x,y:h.startPoint.y,index:1,vectorId:l}),s.push({x:h.endPoint.x,y:h.endPoint.y,index:2,vectorId:l})}}s.push({x:t.x,y:t.y,index:1,vectorId:i}),s.push({x:e.x,y:e.y,index:2,vectorId:i});var u=he.getPoint(n.start);s=s.sort(function(t,e){return c.getDistance(u,t)-c.getDistance(u,e)}.bind(this));for(var d=0;d<s.length-1;++d)if(s[d].vectorId==i)if(0==d||d==s.length-2){if(c.getDistance(s[d],s[d+1])<a.minSymbolLen)return null;if(s[d+1].vectorId==i)return{position1:t,position2:{x:s[d+1].x,y:s[d+1].y}};if(s[d+1].vectorId!=i)return{position1:t,position2:{x:s[d+1].x,y:s[d+1].y},collision:!0}}else if(s[d+1].vectorId==i&&s[d-1].vectorId!=s[d+2].vectorId)return c.getDistance({x:s[d-1].x,y:s[d-1].y},{x:s[d+2].x,y:s[d+2].y})<a.minSymbolLen?null:{position1:{x:s[d-1].x,y:s[d-1].y},position2:{x:s[d+2].x,y:s[d+2].y}};return null},ne.prototype.getNewPosForSymbol=function(t,e,o,i){var n=he.getWall(e),s=he.getPoint(n.start),r=he.getPoint(n.end),l=ct.getLine(n),h=c.getVerticalLine(l,t),u=i;o&&(u=he.getSymbol(o).len);var d=c.getParallelLineForDistance(h,u/2),p=c.getIntersectionPoint(d.line1,l),x=c.getIntersectionPoint(d.line2,l);if(c.getDistance(s,r)<u)c.clonePoint(p,s),c.clonePoint(x,r);else{var g,f,m={},v={};ct.isContain(n,p)?ct.isContain(n,x)||(g=s.x-x.x,f=s.y-x.y,m.x=p.x+g,m.y=p.y+f,ct.isContain(n,m)?(p.x+=g,p.y+=f,c.clonePoint(x,s)):(g=r.x-x.x,f=r.y-x.y,p.x+=g,p.y+=f,c.clonePoint(x,r))):(g=s.x-p.x,f=s.y-p.y,v.x=x.x+g,v.y=x.y+f,ct.isContain(n,v)?(x.x+=g,x.y+=f,c.clonePoint(p,s)):(g=r.x-p.x,f=r.y-p.y,x.x+=g,x.y+=f,c.clonePoint(p,r)))}for(var S=[],P=0;P<n.children.length;++P){var b=n.children[P];if(b!=o){var I=he.getSymbol(b);S.push({x:I.startPoint.x,y:I.startPoint.y,index:1,vectorId:b}),S.push({x:I.endPoint.x,y:I.endPoint.y,index:2,vectorId:b})}}S.push({x:s.x,y:s.y,index:1,vectorId:e,type:y}),S.push({x:r.x,y:r.y,index:2,vectorId:e,type:y}),S=S.sort(function(t,e){return c.getDistance(s,t)-c.getDistance(s,e)}.bind(this));for(var k=0;k<S.length-1;++k)if(c.isContainForSegment(t,S[k],S[k+1])){if(c.getDistance(S[k],S[k+1])>u){if(S[k].vectorId==S[k+1].vectorId&&S[k].type!=y)return{position1:p,position2:x,collision:!0,state:!1};if(S[k].vectorId==S[k+1].vectorId&&S[k].type==y)return{position1:p,position2:x,collision:!0,state:!0};if(!c.isContainForSegment(p,S[k],S[k+1])||!c.isContainForSegment(x,S[k],S[k+1]))return{position1:p,position2:x,collision:!0,state:!1}}else{if(c.getDistance(S[k],S[k+1])<a.minSymbolLen)return{position1:p,position2:x,collision:!0,state:!1};if(S[k].vectorId!=S[k+1].vectorId)return{position1:{x:S[k].x,y:S[k].y},position2:{x:S[k+1].x,y:S[k+1].y},collision:!0,state:!0};if(S[k].vectorId==S[k+1].vectorId&&S[k].type!=y)return{position1:p,position2:x,collision:!0,state:!1};if(S[k].vectorId==S[k+1].vectorId&&S[k].type==y)return{position1:{x:S[k].x,y:S[k].y},position2:{x:S[k+1].x,y:S[k+1].y},collision:!0,state:!0}}!1}else if(c.getDistance(t,S[k])<a.minAdsorb)return{position1:p,position2:x,collision:!0,state:!1};return{position1:p,position2:x,collision:!1,state:!0}},ne.prototype.setPosition=function(t,e,o){"start"==o?c.clonePoint(t.startPoint,e):"end"==o&&c.clonePoint(t.endPoint,e)},ne.prototype.updateSymbolsPositionsForNeighWall=function(t){for(var e=he.getWall(t).children,o=0;o<e.length;++o)this.updateSEForWallSize(e[o])},ne.prototype.updateSEForWallSize=function(t){var e=he.getSymbol(t),o=he.getWall(e.parent),i=he.getPoint(o.start),n=he.getPoint(o.end),s={x:e.startPoint.x,y:e.startPoint.y},r={x:e.endPoint.x,y:e.endPoint.y},l={x:0,y:0};if(ct.isContain(o,s)){if(ct.isContain(o,r))return null;c.getDistance(r,i)<c.getDistance(r,n)?(l.x=i.x-r.x,l.y=i.y-r.y):(l.x=n.x-r.x,l.y=n.y-r.y),r.x+=l.x,r.y+=l.y}else c.getDistance(s,i)<c.getDistance(s,n)?(l.x=i.x-s.x,l.y=i.y-s.y):(l.x=n.x-s.x,l.y=n.y-s.y),s.x+=l.x,s.y+=l.y;this.updateSEForCollideSymbols(t,s,r)},ne.prototype.updateSymbolForLen=function(t,e){var o=he.getSymbol(t),i=o.startPoint,n=o.endPoint,s=c.createLine1(i,n),r={x:(i.x+n.x)/2,y:(i.y+n.y)/2},l=c.getVerticalLine(s,r),a=he.getWall(o.parent),h=he.getPoint(a.start),u=he.getPoint(a.end);if(null==e||void 0===e){e=c.getDistance(i,n);var d=c.getDistance(h,u);e>d&&(e=d)}var y=c.getParallelLineForDistance(l,e/2),p=c.getIntersectionPoint(y.line1,s),x=c.getIntersectionPoint(y.line2,s),g={};c.getDistance(i,p)<c.getDistance(i,x)?(g.start=p,g.end=x):(g.start=x,g.end=p);var f,m,v=!1,S=!1,P=this.getNearestPosition(o.parent,t,!0);return null!=P.startPosition&&c.PointInSegment(P.startPosition,g.start,g.end)&&(f=g.start.x-P.startPosition.x,m=g.start.y-P.startPosition.y,c.clonePoint(g.start,P.startPosition),g.end.x-=f,g.end.y-=m,v=!0),null!=P.endPosition&&c.PointInSegment(P.endPosition,g.start,g.end)&&(f=g.end.x-P.endPosition.x,m=g.end.y-P.endPosition.y,c.clonePoint(g.end,P.endPosition),v||(g.start.x-=f,g.start.y-=m,c.PointInSegment(P.startPosition,g.start,g.end)&&(c.clonePoint(g.start,P.startPosition),v=!0)),S=!0),g.vectorId=t,c.clonePoint(o.startPoint,g.start),c.clonePoint(o.endPoint,g.end),o.setPoints2d(),{block:v&S,start:g.start,end:g.end}},ne.prototype.getNearestPosition=function(t,e,o,i,n){var s=he.getWall(t),r=he.getPoint(s.start),l=he.getPoint(s.end),a=s.children,h=he.getSymbol(e);h||e||(h={},(h={struct:{}}).startPoint=i,h.endPoint=n);for(var u=1e4,d=1e4,y=null,p=null,x=null,g=null,f=0;f<a.length;++f)if(a[f]!=e){var m=he.getSymbol(a[f]),v=c.getDistance(h.startPoint,m.startPoint),S=c.getDistance(h.startPoint,m.endPoint);u>Math.min(v,S)&&(v<S?(y=m.startPoint,x=m.endPoint):(y=m.endPoint,x=m.startPoint),c.getDistance(h.startPoint,y)>c.getDistance(h.endPoint,y)?(y=null,x=null):u=Math.min(v,S));var P=c.getDistance(h.endPoint,m.startPoint),b=c.getDistance(h.endPoint,m.endPoint);d>Math.min(P,b)&&(P<b?(p=m.startPoint,g=m.endPoint):(p=m.endPoint,g=m.startPoint),c.getDistance(h.endPoint,p)>c.getDistance(h.startPoint,p)?(p=null,g=null):d=Math.min(P,b))}return o&&(null==y&&(c.getDistance(r,h.startPoint)>c.getDistance(r,h.endPoint)?(y=l,x=l):(y=r,x=r)),null==p&&(c.getDistance(r,h.startPoint)>c.getDistance(r,h.endPoint)?(p=r,g=r):(p=l,g=l))),{startPosition:y,startPosition2:x,endPosition:p,endPosition2:g}},ne.prototype.moveSymbolSinglePoint=function(t,e,o){var i=he.getSymbol(e),n=c.createLine1(i.startPoint,i.endPoint),s=c.getVerticalLine(n,t);t=c.getIntersectionPoint(s,n);var r={x:(i.startPoint.x+i.endPoint.x)/2,y:(i.startPoint.y+i.endPoint.y)/2},l=he.getWall(i.parent),a=he.getPoint(l.start),h=he.getPoint(l.end);if("start"==o){if(!c.PointInSegment(r,t,i.endPoint))return null;c.getDistance(i.startPoint,a)<c.getDistance(i.endPoint,a)?c.getDistance(t,r)>c.getDistance(a,r)&&c.clonePoint(t,a):c.getDistance(t,r)>c.getDistance(h,r)&&c.clonePoint(t,h)}else if("end"==o){if(!c.PointInSegment(r,t,i.startPoint))return null;c.getDistance(i.endPoint,h)<c.getDistance(i.startPoint,h)?c.getDistance(t,r)>c.getDistance(h,r)&&c.clonePoint(t,h):c.getDistance(t,r)>c.getDistance(a,r)&&c.clonePoint(t,a)}return{dir:o,position:t}},ne.prototype.setSymbolInfo=function(t){var e=he.getSymbol(t.vectorId);return e.openSide=t.openSide,e.startPoint=t.start,e.endPoint=t.end,e.points2d=JSON.parse(JSON.stringify(t.points2d)),e.enter=t.enter,e.parent=t.parent,e},ne.prototype.setEnterImg=function(t){this.enterImg=t},ne.prototype.getEnterImg=function(){return this.enterImg},ne.prototype.createSymbolFromPanorama=function(t,e,o){var i=[],n={x:t.ray.origin.x,y:-1*t.ray.origin.z},s=he.getWalls();for(var r in s){var l=he.getWall(r),a=he.getPoint(l.start),h=he.getPoint(l.end),u=c.raySegmentIntersection(n,t.ray.direction,a,h);null!=u&&i.push({wallId:r,join:u})}if(i.length>0){function t(t,e){return c.getDistance(n,t.join)-c.getDistance(n,e.join)}i=i.sort(t.bind(this));var d=this.addSymbol(i[0].join,e,i[0].wallId);return null!=d?(ie.moveFullSymbol(i[0].join,d,i[0].wallId),he.getSymbol(d),d):(console.error("漫游模式下添加门/窗:门/窗区域太小,加不上"),null)}return console.error("漫游模式下添加门/窗:没有与任何墙相交"),null};var se=new ne,re=function(){this.defaultCenter=null,this.center=null,this.zoom=100,this.res=80,this.ratio=1,this.cadImg_Width=1920,this.cadImg_Height=937,this.initRes=null,this.initWidth=null,this.initHeight=null};re.prototype.init=function(t){var e=he.getBoundingBox();this.setCenter(e),this.updateForCanvas(t)},re.prototype.setInitInfo=function(t,e,o){null==this.initRes&&(this.initRes=t),null==this.initWidth&&(this.initWidth=e),null==this.initHeight&&(this.initHeight=o)},re.prototype.updateResForReSize=function(t,e,o){Math.abs(o)<.01||Math.abs(o-2*Math.PI)<.01?this.res=this.initRes*t/this.initWidth:this.res=this.initRes*e/this.initHeight,a.minRealDis=a.minPixDistance/this.res*a.defaultZoom/this.zoom,a.minAdsorb=a.minPixLen/this.res*a.defaultZoom/this.zoom},re.prototype.setCenter=function(t){this.defaultCenter?this.center={x:this.defaultCenter.x,y:this.defaultCenter.y}:(this.cadBoundingbox=JSON.parse(JSON.stringify(t)),null!=this.cadBoundingbox&&(this.center={x:(this.cadBoundingbox.maxX+this.cadBoundingbox.minX)/2,y:(this.cadBoundingbox.maxY+this.cadBoundingbox.minY)/2}))},re.prototype._setDefaultCenter=function(t){this.defaultCenter={x:t.x,y:t.y}},re.prototype.setDefaultCenter=function(t){this.defaultCenter={x:t.x,y:-t.z}},re.prototype._setRes=function(t){this.res=t,a.minRealDis=a.minPixDistance/this.res*a.defaultZoom/this.zoom,a.minAdsorb=a.minPixLen/this.res*a.defaultZoom/this.zoom},re.prototype.setRes=function(t,e){this.res=this.width/Math.abs(e-t),a.minRealDis=a.minPixDistance/this.res*a.defaultZoom/this.zoom,a.minAdsorb=a.minPixLen/this.res*a.defaultZoom/this.zoom},re.prototype.getScreenXY=function(t){if(null==this.width||null==this.height)return null;var e=t.x,o=t.y,i=this.width/2+(e-this.center.x)*this.res*this.zoom/100,n=this.height/2-(o-this.center.y)*this.res*this.zoom/100;return i=.5+(i*=this.ratio)<<0,n=.5+(n*=this.ratio)<<0,{x:Math.floor(i),y:Math.floor(n)}},re.prototype.getXYFromScreen=function(t){var e={};return e.x=(t.x-this.width/2)/this.res*100/this.zoom+this.center.x,e.y=(this.height/2-t.y)/this.res*100/this.zoom+this.center.y,e},re.prototype.getPointForRevRotate=function(t,e){if(Math.abs(e)<.01||Math.abs(e-2*Math.PI)<.01)return t;var o=(t.x-this.center.x)*Math.cos(e)-(t.y-this.center.y)*Math.sin(e)+this.center.x,i=(t.y-this.center.y)*Math.cos(e)+(t.x-this.center.x)*Math.sin(e)+this.center.y;return t.x=o,t.y=i,t},re.prototype.getVectorForRotate=function(t,e){if(e=-e,Math.abs(e)<.01||Math.abs(e-2*Math.PI)<.01)return t;var o=(t.x-this.center.x)*Math.cos(e)-(t.y-this.center.y)*Math.sin(e)+this.center.x,i=(t.y-this.center.y)*Math.cos(e)+(t.x-this.center.x)*Math.sin(e)+this.center.y;return t.x=o,t.y=i,t},re.prototype.updateCenterForRotate=function(t){if(!(Math.abs(t)<.01||Math.abs(t-2*Math.PI)<.01)){var e=this.center.x*Math.cos(t)-this.center.y*Math.sin(t),o=this.center.y*Math.cos(t)+this.center.x*Math.sin(t);return this.center.x=e,this.center.y=o,this.center}},re.prototype.updateForCanvas=function(t){t&&(this.width=t.clientWidth,this.height=t.clientHeight,t.width=t.clientWidth,t.height=t.clientHeight)},re.prototype.updateZoom=function(t){this.zoom=t,a.minRealDis=a.minPixDistance/this.res*a.defaultZoom/this.zoom,a.minAdsorb=a.minPixLen/this.res*a.defaultZoom/this.zoom},re.prototype.moveTo=function(t,e){var o=this.getXYFromScreen(e);this.zoom=t;var i=(100*e.x/this.zoom-this.width/2)/this.res,n=(this.height/2-100*e.y/this.zoom)/this.res;this.center.x=o.x-i,this.center.y=o.y-n},re.prototype.getXYFromScreenForDefaultZoom=function(t){var e={};return e.x=(t.x-this.width/2)/this.res+this.center.x,e.y=(this.height/2-t.y)/this.res+this.center.y,e},re.prototype.getScreenInfoForCAD=function(){var t=this.getXYFromScreen({x:this.width,y:this.height}),e=this.getXYFromScreen({x:0,y:0}),o={x:this.center.x,y:this.center.y};return{width:Math.abs(t.x-e.x),height:Math.abs(t.y-e.y),center:{x:o.x,y:o.y},defaultCenter:this.defaultCenter}},re.prototype.getPixelRatio=function(t){var e=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/e},re.prototype.reSet=function(){this.center={x:this.defaultCenter.x,y:this.defaultCenter.y},this.zoom=100},re.prototype.updateForRotate=function(t){void 0===t&&(t=Math.PI/2);for(var e=0;e<l.floors.length;++e){var o=l.floors[e].points;for(var i in o)o[i]=this.getVectorForRotate(o[i],t);var n=l.floors[e].symbols;for(var s in n)n[s].startPoint=this.getVectorForRotate(n[s].startPoint,t),n[s].endPoint=this.getVectorForRotate(n[s].endPoint,t),n[s].setPoints2d(),se.setPosition3d(n[s]);var r=l.floors[e].components;for(var a in r){var h=r[a];h.sideWidth=c.getDistance(h.points2d[0],h.points2d[1]),h.sideThickness=c.getDistance(h.points2d[1],h.points2d[2]),h.center=this.getVectorForRotate(h.center,t),h.angle=(h.angle+t/Math.PI*180)%360,h.setPoints2d()}var u=l.floors[e].tags;for(var d in u)u[d].center=this.getVectorForRotate(u[d].center,t),u[d].setPoints2d();var y=l.floors[e].furnitures;for(var p in y){var x=y[p];x.center=this.getVectorForRotate(x.center,t),x.angle=(x.angle+t/Math.PI*180)%360}}},re.prototype.updatePanosForRotate=function(t){for(var e=l.panos,o=0;o<e.length;++o){var i=JSON.parse(JSON.stringify(e[o]));i=this.getVectorForRotate(i,t),e[o].x=i.x,e[o].y=i.y}},re.prototype.setRadio=function(t){this.ratio=t,this.cadImg_Width=1920*t,this.cadImg_Height=937*t},re.prototype.clear=function(){this.defaultCenter=null,this.center=null,this.zoom=100,this.res=80,this.ratio=1};var le=new re,ae=function(){this.currentId=0,this.currentFloor=0,this.angle=0,this.$app=null,this.cadBoundingBox=null};ae.prototype.setCurrentId=function(t){this.currentId=t},ae.prototype.getCurrentId=function(){return this.currentId},ae.prototype.updateCurrentId=function(){++this.currentId},ae.prototype.setCurrentFloor=function(t){1==l.floors.length?this.currentFloor=0:this.currentFloor=t},ae.prototype.getCurrentFloor=function(){return this.currentFloor},ae.prototype.getCompass=function(){return l.compass},ae.prototype.setCompass=function(t){l.compass=t},ae.prototype.getFloorNum=function(){return l.floors.length},ae.prototype.initFloor=function(t){l.initFloor(t)},ae.prototype.getFloors=function(){return l.floors},ae.prototype.getPoint=function(t,e){return null!=e&&void 0!==e||(e=this.currentFloor),l.floors[e].points[t]},ae.prototype.deletePoint=function(t,e,o){null!=o&&void 0!==o||(o=this.currentFloor);var i=this.getPoint(t);if(i)if(0==Object.keys(i.parent).length)i=null,delete l.floors[o].points[t];else if(1!=Object.keys(i.parent).length||e)if(1==Object.keys(i.parent).length&&i.parent[e])delete l.floors[o].points[t];else{if(1==Object.keys(i.parent).length&&!i.parent[e])return;delete i.parent[e]}else delete l.floors[o].points[t]},ae.prototype.getWall=function(t,e){return null!=e&&void 0!==e||(e=this.currentFloor),l.floors[e].walls[t]},ae.prototype.deleteWall=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor);for(var o=this.getWall(t,e),i=0;i<o.children.length;++i)this.deleteSymbol(o.children[i],e);this.deletePoint(o.start,t,e),this.deletePoint(o.end,t,e),delete l.floors[e].walls[t]},ae.prototype.deleteWallNoSymbol=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor);var o=this.getWall(t,e);this.deletePoint(o.start,t,e),this.deletePoint(o.end,t,e),delete l.floors[e].walls[t]},ae.prototype.getAngle=function(){return this.angle},ae.prototype.setAngle=function(t){this.angle=t},ae.prototype.setBoundingBox=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),l.floors[e].boundingBox=JSON.parse(JSON.stringify(t))},ae.prototype.getBoundingBox=function(t){if(null==t||void 0===t){for(var e=null,o=null,i=null,n=null,s=0;s<l.floors.length;++s)l.floors[s].boundingBox.hasOwnProperty("maxX")&&l.floors[s].boundingBox.hasOwnProperty("minX")&&l.floors[s].boundingBox.hasOwnProperty("maxY")&&l.floors[s].boundingBox.hasOwnProperty("minY")||this.updateBoundingBox(s),(null==e||e>l.floors[s].boundingBox.minX)&&(e=l.floors[s].boundingBox.minX),(null==o||o<l.floors[s].boundingBox.maxX)&&(o=l.floors[s].boundingBox.maxX),(null==i||i>l.floors[s].boundingBox.minY)&&(i=l.floors[s].boundingBox.minY),(null==n||n<l.floors[s].boundingBox.maxY)&&(n=l.floors[s].boundingBox.maxY);return{minX:e,maxX:o,minY:i,maxY:n}}return l.floors[t].boundingBox},ae.prototype.setCadBoundingBox=function(){for(var t=null,e=null,o=null,i=null,n=0;n<l.floors.length;++n){var s=l.floors[n].boundingBox;(null==t||t>s.minX)&&(t=s.minX),(null==e||e>s.minY)&&(e=s.minY),(null==o||o<s.maxX)&&(o=s.maxX),(null==i||i<s.maxY)&&(i=s.maxY)}this.cadBoundingBox={maxX:o,maxY:i,minX:t,minY:e}},ae.prototype.getCadBoundingBox=function(){return this.cadBoundingBox},ae.prototype.updateBoundingBox=function(t){var e=this.getPoints(t),o=null,i=null,n=null,s=null;for(var r in e){var l=e[r];(null==o||o>l.x)&&(o=l.x),(null==i||i<l.x)&&(i=l.x),(null==n||n>l.y)&&(n=l.y),(null==s||s<l.y)&&(s=l.y)}this.setBoundingBox({minX:o,maxX:i,minY:n,maxY:s},t)},ae.prototype.getFloorData=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),l.floors[t]},ae.prototype.getWalls=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),l.floors[t].walls},ae.prototype.getPoints=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),l.floors[t].points},ae.prototype.getSymbol=function(t,e){return null!=e&&void 0!==e||(e=this.currentFloor),l.floors[e].symbols[t]},ae.prototype.addWall=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),l.floors[e].walls[t.vectorId]=t},ae.prototype.addPoint=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),l.floors[e].points[t.vectorId]=t},ae.prototype.addSymbol=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),l.floors[e].symbols[t.vectorId]=t},ae.prototype.addComponent=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),l.floors[e].components[t.vectorId]=t},ae.prototype.addFurniture=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),l.floors[e].furnitures[t.vectorId]=t},ae.prototype.deleteSymbol=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),this.getSymbol(t,e),delete l.floors[e].symbols[t]},ae.prototype.getComponent=function(t,e){return null!=e&&void 0!==e||(e=this.currentFloor),l.floors[e].components[t]},ae.prototype.deleteComponent=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),this.getComponent(t,e),delete l.floors[e].components[t]},ae.prototype.getFurniture=function(t,e){return null!=e&&void 0!==e||(e=this.currentFloor),l.floors[e].furnitures[t]},ae.prototype.deleteFurniture=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),this.getFurniture(t,e),delete l.floors[e].furnitures[t]},ae.prototype.addTag=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),l.floors[e].tags[t.vectorId]=t},ae.prototype.getTag=function(t,e){return null!=e&&void 0!==e||(e=this.currentFloor),l.floors[e].tags[t]},ae.prototype.deleteTag=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),this.getTag(t,e),delete l.floors[e].tags[t]},ae.prototype.getSymbols=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),l.floors[t].symbols},ae.prototype.getComponents=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),l.floors[t].components},ae.prototype.getTags=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),l.floors[t].tags},ae.prototype.getFurnitures=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),l.floors[t].furnitures},ae.prototype.getAllBoundingBox=function(){for(var t=[],e=0;e<l.floors.length;++e){var o=void 0,i=void 0,n=void 0,s=void 0,r={};for(var a in l.floors[e].points){var h=l.floors[e].points[a].x,c=l.floors[e].points[a].y;(void 0===o||o>h)&&(o=h),(void 0===n||n<h)&&(n=h),(void 0===i||i>c)&&(i=c),(void 0===s||s<c)&&(s=c)}r.left=o,r.top=s,r.right=n,r.bottom=i,t.push(r)}return t},ae.prototype.getCadInfo=function(t){for(var e=[],o=this.getAllBoundingBox(),i=0;i<o.length;++i){var n={},s=le.getScreenXY({x:o[i].left,y:o[i].top}),r=le.getScreenXY({x:o[i].right,y:o[i].bottom}),l=s.x,a=s.y,h=t.width-r.x,c=t.height-r.y;n.left=l,n.top=a,n.right=h,n.bottom=c,n.bound=o[i],n.bound.top=-1*n.bound.top,n.bound.bottom=-1*n.bound.bottom,e.push(n)}return e},ae.prototype.getRooms=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),l.floors[t].rooms},ae.prototype.clear=function(t){l.floors[this.currentFloor]&&(l.floors[this.currentFloor].points={},l.floors[this.currentFloor].walls={},l.floors[this.currentFloor].symbols={},l.floors[this.currentFloor].components={},l.floors[this.currentFloor].tags={},l.floors[this.currentFloor].furnitures={},t||(l.floors[this.currentFloor].boundingBox={}),l.floors[this.currentFloor].rooms=[])},ae.prototype.getBoundingBox2DPosition=function(t){var e=le.getScreenXY({x:t.min.x,y:t.max.z}),o=le.getScreenXY({x:t.max.x,y:t.min.z});return{top:e.y,bottom:o.y,left:e.x,right:o.x}},ae.prototype.deleteFloorData=function(){l.floors=[]},ae.prototype.setFloorName=function(t,e){l.floors[e].name=t},ae.prototype.setFloorId=function(t,e){l.floors[e].id=t},ae.prototype.setFloorSubgroup=function(t,e){l.floors[e].subgroup=t},ae.prototype.setFloorHeight=function(t,e){l.floors[t].height=e},ae.prototype.getFloorHeight=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),l.floors[t].height};var he=new ae,ce=function(t){function e(e,o){t.call(this),this.center=e,this.points2d=[],this.title="",this.des="",this.unit="m",this.name="标注",this.adding=!0,this.sideWidth=30,this.sideThickness=30,this.geoType=T,this.setId(o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isContain=function(t){var e=[];return e.push(this.points2d[0]),e.push(this.points2d[1]),e.push(this.points2d[2]),e.push(this.points2d[3]),c.isPointInPoly(t,e)},e.prototype.setPoints2d=function(){this.points2d=[];var t=this.center.x-this.sideWidth/le.res*a.defaultZoom/le.zoom/2,e=this.center.y-this.sideThickness/le.res*a.defaultZoom/le.zoom/2,o=this.center.x+this.sideWidth/le.res*a.defaultZoom/le.zoom/2,i=this.center.y+this.sideThickness/le.res*a.defaultZoom/le.zoom/2,n={x:t,y:i},s={x:o,y:i},r={x:o,y:e},l={x:t,y:e};this.points2d.push(n),this.points2d.push(s),this.points2d.push(r),this.points2d.push(l);var h=(n.x-this.center.x)/2,c=(n.y-this.center.y)/2;this.points2d.push({x:n.x-h,y:n.y-c}),this.points2d.push({x:s.x+h,y:n.y-c}),this.points2d.push({x:this.center.x,y:n.y-c}),this.points2d.push({x:this.center.x,y:r.y+c})},e.prototype.setTitle=function(t){this.title=t},e.prototype.setDes=function(t){this.des=t},e.prototype.setUnit=function(t){this.unit=t},e.prototype.setAdding=function(t){this.adding=t},e}(Q),ue=function(){this.pad={top:60,bottom:60,left:265,right:265},this.region={},this.measureLines={top:[],bottom:[],left:[],right:[]},this.minDis=null,this.unit="m",this.defalutMeasurePad={bottom:60,right:265},this.margin={top:60,bottom:60,left:70,right:70}};ue.prototype.padding=function(t){void 0===t&&(t={}),Object.assign(this.pad,t),Object.assign(this.defalutMeasurePad,t)},ue.prototype.updatePad=function(t){Object.assign(this.pad,t)},ue.prototype.updateRegion=function(t){this.region.top=this.pad.top,this.region.bottom=le.height-this.pad.bottom,this.region.left=this.pad.left,this.region.right=le.width-this.pad.right},ue.prototype.updateNewRegion=function(t,e,o,i){var n=le.getScreenXY({x:t,y:o}),s=le.getScreenXY({x:e,y:i});this.region.top=s.y-this.margin.top*le.ratio,this.region.bottom=n.y+this.margin.bottom*le.ratio,this.region.left=n.x-this.margin.left*le.ratio,this.region.right=s.x+this.margin.right*le.ratio},ue.prototype.update=function(t){null==this.minDis&&(this.minDis=100/le.res);var e=[],o=[],i=[],n=[],s=[];if(he.getFloorData()){var r=he.getPoints();for(var l in r){var a=r[l];s.push({x:a.x,y:a.y})}e=[].concat(s).sort(w.bind(this)),(o=[].concat(e)).reverse(),i=[].concat(s).sort(C.bind(this)),(n=[].concat(i)).reverse(),t?this.updateNewRegion(i[0].x,n[0].x,o[0].y,e[0].y):this.updateRegion();var h=null,c=null;this.measureLines.top=[];for(var u=0;u<e.length;++u)if(0==u)h=e[0].x,c=e[0].x,this.measureLines.top.push({x:e[0].x,y:this.region.top});else{if(e[u].x>=h&&e[u].x<=c)continue;(h=Math.min(h,e[u].x))!=(c=Math.max(c,e[u].x))&&this.measureLines.top.push({x:e[u].x,y:this.region.top})}e=this.measureLines.top.sort(C.bind(this)),this.measureLines.top=[],this.measureLines.top.push(e[0]);for(var d=0;d<e.length-1;++d){h=e[d],c=null;for(var y=d+1;y<e.length&&(c=e[y],Math.abs(h.x-c.x)<this.minDis);++y)c=null,++d;if(null!=c)this.measureLines.top.push(c);else if(d==e.length-1){var p=this.measureLines.top.length;this.measureLines.top[p-1]=e[d];break}}this.measureLines.bottom=[];for(var x=0;x<o.length;++x)if(0==x)h=o[0].x,c=o[0].x,this.measureLines.bottom.push({x:o[0].x,y:this.region.bottom});else{if(o[x].x>=h&&o[x].x<=c)continue;(h=Math.min(h,o[x].x))!=(c=Math.max(c,o[x].x))&&this.measureLines.bottom.push({x:o[x].x,y:this.region.bottom})}o=this.measureLines.bottom.sort(C.bind(this)),this.measureLines.bottom=[],this.measureLines.bottom.push(o[0]);for(var g=0;g<o.length-1;++g){h=o[g],c=null;for(var f=g+1;f<o.length&&(c=o[f],Math.abs(h.x-c.x)<this.minDis);++f)c=null,++g;if(null!=c)this.measureLines.bottom.push(c);else if(g==o.length-1){var m=this.measureLines.bottom.length;this.measureLines.bottom[m-1]=o[g];break}}this.measureLines.left=[];for(var v=0;v<i.length;++v)if(0==v)h=i[0].y,c=i[0].y,this.measureLines.left.push({x:this.region.left,y:i[0].y});else{if(i[v].y>=h&&i[v].y<=c)continue;(h=Math.min(h,i[v].y))!=(c=Math.max(c,i[v].y))&&this.measureLines.left.push({x:this.region.left,y:i[v].y})}i=this.measureLines.left.sort(w.bind(this)),this.measureLines.left=[],this.measureLines.left.push(i[0]);for(var S=0;S<i.length-1;++S){h=i[S],c=null;for(var P=S+1;P<i.length&&(c=i[P],Math.abs(h.y-c.y)<this.minDis);++P)c=null,++S;if(null!=c)this.measureLines.left.push(c);else if(S==i.length-1){var b=this.measureLines.left.length;this.measureLines.left[b-1]=i[S];break}}this.measureLines.right=[];for(var I=0;I<n.length;++I)if(0==I)h=n[0].y,c=n[0].y,this.measureLines.right.push({x:this.region.right,y:n[0].y});else{if(n[I].y>=h&&n[I].y<=c)continue;(h=Math.min(h,n[I].y))!=(c=Math.max(c,n[I].y))&&this.measureLines.right.push({x:this.region.right,y:n[I].y})}n=this.measureLines.right.sort(w.bind(this)),this.measureLines.right=[],this.measureLines.right.push(n[0]);for(var k=0;k<n.length-1;++k){h=n[k],c=null;for(var T=k+1;T<n.length&&(c=n[T],Math.abs(h.y-c.y)<this.minDis);++T)c=null,++k;if(null!=c)this.measureLines.right.push(c);else if(k==n.length-1){var F=this.measureLines.right.length;this.measureLines.right[F-1]=n[k];break}}}function w(t,e){return e.y-t.y}function C(t,e){return t.x-e.x}};var de=new ue,ye=["","⅛","¼","⅜","½","⅝","¾","⅞"],pe=function(t,e,o,i){this.name=t,this.symbol=e,this.base=o,this.factor=i};pe.prototype.toBase=function(t){return t*this.factor},pe.prototype.fromBase=function(t){return t/this.factor};var xe={MILLIMETER:["Millimeter","mm"],CENTIMETER:["Centimeter","cm"],METER:["Meter","m"],KILOMETER:["Kilometer","km"],INCH:["Inch","in"],FOOT:["Foot","ft"],MILE:["Mile","mi"],SQUAREMETER:["SquareMeter","m²"],SQUAREFOOT:["SquareFoot","ft²"],CUBICMETER:["CubicMeter","m³"],CUBICFOOT:["CubicFoot","ft³"],BYTE:["Byte","B"],KILOBYTE:["Kilobyte","kB"],MEGABYTE:["Megabyte","MB"],GIGABYTE:["Gigabyte","GB"],TERABYTE:["Terabyte","TB"],PETABYTE:["Petabyte","PB"],init:function(){var t,e,o,i,n,s,r,l,a,h,c,u=new pe(xe.METER[0],xe.METER[1],void 0,1),d=new pe(xe.SQUAREMETER[0],xe.SQUAREMETER[1],void 0,1),y=new pe(xe.CUBICMETER[0],xe.CUBICMETER[1],void 0,1),p=new pe(xe.BYTE[0],xe.BYTE[1],void 0,1);xe.DISTANCE=((t={}).metric=((e={})[xe.MILLIMETER[0]]=new pe(xe.MILLIMETER[0],xe.MILLIMETER[1],u,.001),e[xe.CENTIMETER[0]]=new pe(xe.CENTIMETER[0],xe.CENTIMETER[1],u,.01),e[xe.METER[0]]=u,e[xe.KILOMETER[0]]=new pe(xe.KILOMETER[0],xe.KILOMETER[1],u,1e3),e),t.imperial=((o={})[xe.INCH[0]]=new pe(xe.INCH[0],xe.INCH[1],u,.0254),o[xe.FOOT[0]]=new pe(xe.FOOT[0],xe.FOOT[1],u,.3048),o[xe.MILE[0]]=new pe(xe.MILE[0],xe.MILE[1],u,1609.344),o),t),xe.AREA=((i={}).metric=((n={})[xe.SQUAREMETER[0]]=d,n),i.imperial=((s={})[xe.SQUAREFOOT[0]]=new pe(xe.SQUAREFOOT[0],xe.SQUAREFOOT[1],d,.092903),s),i),xe.VOLUME=((r={}).metric=((l={})[xe.CUBICMETER[0]]=y,l),r.imperial=((a={})[xe.CUBICFOOT[0]]=new pe(xe.CUBICFOOT[0],xe.CUBICFOOT[1],y,.0283168),a),r);var x=((h={})[xe.BYTE[0]]=p,h[xe.KILOBYTE[0]]=new pe(xe.KILOBYTE[0],xe.KILOBYTE[1],p,1e3),h[xe.MEGABYTE[0]]=new pe(xe.MEGABYTE[0],xe.MEGABYTE[1],p,1e6),h[xe.GIGABYTE[0]]=new pe(xe.GIGABYTE[0],xe.GIGABYTE[1],p,1e9),h[xe.TERABYTE[0]]=new pe(xe.TERABYTE[0],xe.TERABYTE[1],p,1e12),h[xe.PETABYTE[0]]=new pe(xe.PETABYTE[0],xe.PETABYTE[1],p,1e15),h);xe.DATA=((c={}).metric=x,c.imperial=x,c)},getUnitsOfMeasurementByDomain:function(t){return this[t.toUpperCase()]},getUnitsOfMeasurementByDomainAndSystem:function(t,e){var o=this.getUnitsOfMeasurementByDomain(t);if(o.hasOwnProperty(e.toLowerCase()))return o[e.toLowerCase()];console.error(n+" measurement system is not supported.")},getDefaultUnitByDomainAndSystem:function(t,e){switch(t.toUpperCase()){case"DISTANCE":switch(e.toLowerCase()){case"metric":return this.DISTANCE.metric[this.METER[0]];case"imperial":return this.DISTANCE.imperial[this.FOOT[0]];default:console.error(e+" measurement system is not supported.")}case"AREA":switch(e.toLowerCase()){case"metric":return this.AREA.metric[this.SQUAREMETER[0]];case"imperial":return this.AREA.imperial[this.SQUAREFOOT[0]];default:console.error(e+" measurement system is not supported.")}case"VOLUME":switch(e.toLowerCase()){case"metric":return this.VOLUME.metric[this.CUBICMETER[0]];case"imperial":return this.VOLUME.imperial[this.CUBICFOOT[0]];default:console.error(e+" measurement system is not supported.")}case"DATA":switch(e.toLowerCase()){case"metric":return this.DATA.metric[this.BYTE[0]];case"imperial":return this.DATA.imperial[this.BYTE[0]];default:console.error(e+" measurement system is not supported.")}default:console.error(t+" measurement domain is not supported.")}}},ge=function(){this.LOCAL_STORAGE_KEY="iv_unit_key",xe.init(),this.unitSystems=["metric","imperial"],this.defaultSystem="metric"},fe=function(){this.UnitService=new ge};fe.prototype.scopedConvert=function(t,o,i,n,s){return void 0===i&&(i=2),e.convert(t,o,i,n,s)},fe.prototype.convert=function(t,e,o,i,n,s){if(void 0===o&&(o=2),void 0===s&&(s=!1),!t)return"";var r=this.getMostRelevantMeasurement(e,i||this.UnitService.currentSystem,t,n);return this.getFormattedMeasurementString(r[0],r[1],o,s)},fe.prototype.getFormattedMeasurementString=function(t,e,o,i){return i&&e.name===xe.FOOT[0]?this.formatImperialDistance(12*t):i&&e.name===xe.INCH[0]?this.formatImperialDistance(t):t.toLocaleString(void 0,{minimumFractionDigits:o,maximumFractionDigits:o})+" "+e.symbol},fe.prototype.formatImperialDistance=function(t){var e=Math.round(8*t),o=Math.floor(e/8),i=Math.floor(o/12),n=o-12*i,s=ye[e%8],r=0===n&&""!==s?"":n;return""!==r&&""!==s&&(s=" "+s),0!==i?i+"' "+r+s+'"':""+r+s+'"'},fe.prototype.getMostRelevantMeasurement=function(t,e,o,i){void 0===i&&(i=0);var n=[],s=xe.getUnitsOfMeasurementByDomainAndSystem(t,e);for(var r in s)n.push(s[r]);var l=n.filter((function(t){return t.factor>=i})).reduce((function(t,e){return e.fromBase(o)<t.fromBase(o)&&e.fromBase(o)>=1?e:t}));return l?[l.fromBase(o),l]:void 0},fe.prototype.getMostRelevantMeasurement2=function(t,e,o,i){void 0===i&&(i=0);var n=[],s=xe.getUnitsOfMeasurementByDomainAndSystem(t,e);for(var r in s)n.push(s[r]);var l=n.filter((function(t){return t.factor>=i})).reduce((function(t,e){return e.toBase(o)<t.toBase(o)&&e.toBase(o)>=1?e:t}));return l?[l.toBase(o),l]:void 0},fe.prototype.convertBack=function(t,e,o,i,n){if(void 0===o&&(o=2),!t)return"";t=t.trim().replace(",","");var s=xe.getDefaultUnitByDomainAndSystem(e,"metric"),r=this.getMostRelevantMeasurement2(e,i,t,n);return this.getFormattedMeasurementString(r[0],s,o)};var me=new fe,ve=function(){};ve.prototype.createTag=function(t,e,o){var i=new ce(t,e);return i.setPoints2d(),he.addTag(i,o),i},ve.prototype.setTagInfo=function(t){var e=he.getTag(t.vectorId);e.vectorId=t.vectorId,e.center=JSON.parse(JSON.stringify(t.center)),e.points2d=JSON.parse(JSON.stringify(t.points2d)),e.title=t.title,e.des=t.des,e.unit=t.unit,e.adding=t.adding},ve.prototype.deleteTag=function(t,e){he.deleteTag(t,e)},ve.prototype.clearDefaultTags=function(){for(var t=0;t<l.floors.length;++t){var e=l.floors[t].tags;for(var o in e){var i=e[o];null!=i.title&&""!=i.title.trim()||null!=i.des&&""!=i.des||this.deleteTag(i.vectorId,t)}}},ve.prototype.convertUnit=function(t){for(var e=0;e<l.floors.length;++e){var o=l.floors[e].tags;for(var i in o){var n=o[i];n.unit!=t&&(n.des&&(n.unit=t,"m"==t?(n.des=me.convertBack(n.des,"area",7,"imperial",.01,!1),n.des=parseFloat(n.des)):(n.des=me.convert(n.des,"area",7,"imperial",.01,!1),n.des=n.des.replace("ft²",""))))}}},ve.prototype.getTags=function(t){return l.floors[t].tags};var Se=new ve,Pe=function(){this.aspect=le.cadImg_Width/le.cadImg_Height,this.top=null,this.bottom=null,this.left=null,this.right=null};Pe.prototype.getCurrentScale=function(t){var e=he.getAngle();t=t.clone().applyEuler(new THREE.Euler(0,e,0));var o=Math.max(Math.abs(t.x),Math.abs(t.z)*this.aspect),i=Math.min(le.cadImg_Width/le.ratio,le.cadImg_Height/le.ratio);return o/2/10*Math.max(1.2*i/800,1.2)},Pe.prototype.setCamera=function(t){var e=-10*t,o=10*t,i=10*t/this.aspect,n=-10*t/this.aspect;this.top=i,this.bottom=n,this.left=e,this.right=o};var be=new Pe,Ie=function(t){this.layer=t,this.version="v1.1",this.vectorsJson=null,this.saveFloors=[],this.newVectorId=null,this.boundingBox=null,this.uploadData={}};Ie.prototype.loadFloorJson=function(t){var e=this;return!t&&l.floors.length?Promise.resolve(l):this.layer.app.store.get("flooruser",t).then((function(t){return t.version?t.version==l.version&&(isNaN(t.angle)||void 0===t.angle||null==t.angle?he.setAngle(0):he.setAngle(t.angle),isNaN(t.compass)||void 0===t.compass||null==t.compass?he.setCompass(0):he.setCompass(t.compass),he.setCurrentId(t.currentId),e.load(t.floors)):(e.layer.analyService.initVectors(t),he.setAngle(0),e.layer.reRender()),t})).catch((function(t){return console.error(t)}))},Ie.prototype.load=function(t){for(var e=0;e<t.length;++e){var o=t[e],i=e;for(var n in o.hasOwnProperty("subgroup")&&(i=o.subgroup),he.initFloor(i),he.setCurrentFloor(i),o.points)ct.createPoint(o.points[n].x,o.points[n].y,o.points[n].vectorId,i);for(var s in o.walls){var r=ct.createWall(o.walls[s].start,o.walls[s].end,o.walls[s].vectorId,i);r.setImportant(o.walls[s].important),r.setOut(o.walls[s].out),r.setChildren(o.walls[s].children)}for(var l in he.setFloorHeight(he.currentFloor,this.layer.player.model.floors.index[he.currentFloor].center.y),o.symbols){var a=se.createSymbol(o.symbols[l].startPoint,o.symbols[l].endPoint,o.symbols[l].geoType,o.symbols[l].parent,o.symbols[l].vectorId);a.openSide=o.symbols[l].openSide,a.enter=o.symbols[l].enter,a.points2d=JSON.parse(JSON.stringify(o.symbols[l].points2d))}for(var h in o.components){var u=xt.createComponent(o.components[h].center,o.components[h].geoType,o.components[h].vectorId);u.angle=o.components[h].angle,u.sideThickness=o.components[h].sideThickness,u.sideWidth=o.components[h].sideWidth,u.points2d=JSON.parse(JSON.stringify(o.components[h].points2d))}for(var d in o.boundingBox||(o.boundingBox=c.getBoundingBox2(o.points)),he.setBoundingBox(o.boundingBox,i),o.tags){var y=Se.createTag(o.tags[d].center,o.tags[d].vectorId,i);y.setPoints2d(),y.setTitle(o.tags[d].title),y.setDes(o.tags[d].des),y.setUnit(o.tags[d].unit),y.setAdding(!1)}for(var p in o.furnitures){var x=Qt.createFurniture(o.furnitures[p].center,o.furnitures[p].geoType,o.furnitures[p].vectorId);x.angle=o.furnitures[p].angle,o.furnitures[p].scale?x.zoom=o.furnitures[p].scale:x.zoom=o.furnitures[p].zoom}o.hasOwnProperty("name")&&he.setFloorName(o.name,i),o.hasOwnProperty("subgroup")&&he.setFloorSubgroup(o.subgroup,i),o.hasOwnProperty("id")&&he.setFloorId(o.id,i)}},Ie.prototype.uploadCad=function(){return this.initCameraService(),this.uploadData.cadInfo=[],this.exportCadImgs()},Ie.prototype.initCameraService=function(){var t=this.layer.app.core.get("Player").model.size,e=be.getCurrentScale(t);be.setCamera(e)},Ie.prototype.base64ToBlob=function(t){for(var e=t.split(","),o=e[0].match(/:(.*?);/)[1],i=atob(e[1]),n=i.length,s=new Uint8Array(n);n--;)s[n]=i.charCodeAt(n);return new Blob([s],{type:o})},Ie.prototype.exportImg=function(t){var e=t.toDataURL("png",3);return this.base64ToBlob(e)},Ie.prototype.exportCadImgs=function(){var t=this;this.layer.uiControl.menu_flex(),Se.clearDefaultTags(),this.layer.history.save(),ee.clearItems(),de.updateRegion(!0),de.update(!1);var e=this.layer.canvas;e.width=le.cadImg_Width,e.height=le.cadImg_Height,le.width=le.cadImg_Width/le.ratio,le.height=le.cadImg_Height/le.ratio,le.res=Math.min(le.cadImg_Width/le.ratio/Math.abs(be.right-be.left),le.cadImg_Height/le.ratio/Math.abs(be.top-be.bottom)),this.layer.renderer.autoRedrawForImg();var o=window.KanKan.Deferred();return setTimeout((function(){var i=he.getFloorNum();if(t.uploadData.files=[],1==i){var n=t.exportImg(e);t.uploadData.files.push(n),historyService.clearHistoryRecord(),t.layer.$xui.toolbar.recall=!1,t.layer.$xui.toolbar.recover=!1}else{for(var s=t.exportImg(e),r=he.getCurrentFloor(),l=0;l<i;++l)if(l!=r){t.layer.uiControl.currentFloor=l,t.layer.renderer.autoRedrawForImg();var a=t.exportImg(e);t.uploadData.files.push(a)}else t.uploadData.files.push(s);t.layer.uiControl.currentFloor=r}t.uploadData.cadInfo=he.getCadInfo(e),t.exportMiniMap(o),le.updateForCanvas(e),le.setRes(be.left,be.right),le.ratio=1,t.layer.renderer.autoRedraw()}),100),o},Ie.prototype.exportMiniMap=function(t){var e=this;t=t||window.KanKan.Deferred(),ee.clearItems();var o=this.layer.canvas;return o.width=a.miniMap_Width,o.height=a.miniMap_Height,le.width=a.miniMap_Width/a.ratio,le.height=a.miniMap_Height/a.ratio,le.ratio=a.ratio,le.res=Math.min(a.miniMap_Width/a.ratio/Math.abs(be.right-be.left),a.miniMap_Height/a.ratio/Math.abs(be.top-be.bottom)),this.layer.renderer.redrawCore(),setTimeout((function(){var i=he.getFloorNum();if(e.uploadData.miniMaps=[],1==i){var n=e.exportImg(o);e.uploadData.miniMaps.push(n)}else{for(var s=e.exportImg(o),r=he.getCurrentFloor(),l=0;l<i;++l)if(l!=r){e.layer.uiControl.currentFloor=l;var a=e.exportImg(o);e.layer.renderer.redrawCore(),e.uploadData.miniMaps.push(a)}else e.uploadData.miniMaps.push(s);e.layer.uiControl.currentFloor=r}o.width=window.innerWidth,o.height=window.innerHeight,le.updateForCanvas(o);var h=e.layer.app.core.get("CameraControls").activeControl.camera;le.setRes(h.left,h.right),le.ratio=1,e.layer.renderer.autoRedraw(),t.resolve(e.uploadData)}),100),t},Ie.prototype.getCustomCadInfoItem=function(t,e,o){function i(t,i){var n=t.x,s=t.y,r=e/2+(n-le.center.x)*i,l=o/2-(s-le.center.y)*i;return r=.5+r<<0,l=.5+l<<0,{x:Math.floor(r),y:Math.floor(l)}}var n=he.getAllBoundingBox(),s=Math.min(e/Math.abs(be.right-be.left),o/Math.abs(be.top-be.bottom)),r={},l=i({x:n[t].left,y:n[t].top},s),a=i({x:n[t].right,y:n[t].bottom},s),h=l.x,c=l.y,u=e-a.x,d=o-a.y;return r.left=h,r.top=c,r.right=u,r.bottom=d,r.bound=n[t],r.bound.top=-1*r.bound.top,r.bound.bottom=-1*r.bound.bottom,r},Ie.prototype.uploadCadImg=function(t,e,o,i){this.initCameraService();var n=this.getCustomCadInfoItem(t,o,i);this.layer.app.core.get("Player").model.floorplanCadImg.createCustomPlane(t,e,n,o,i)},Ie.prototype.recoverForCadImg=function(t,e){this.layer.app.core.get("Player").model.floorplanCadImg.updateCustomFloorTexture(t,e)},Ie.prototype.uploadCadImg2=function(t,e,o,i){this.layer.app.core.get("Player").model.floorplanCadImg.createCustomPlane(t,e,o,i)};var ke=function(t){function e(e,o,i){t.call(this),this.start=e,this.end=o,this.name=null,this.display=!1,this.geoType=k,this.setId(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setPositions=function(t,e){this.start.x=t.x,this.start.y=t.y,this.end.x=e.x,this.end.y=e.y},e}(Q),Te="StartAddWall",Fe="NewWall",we="StartSymbolPoints",Ce="EndSymbolPoints",We="CheckLinesX",De="CheckLinesY",ze="vCheckLinesX",Le="vCheckLinesY",Me="SignLine1",Re="SignLine2",Oe=function(){this.wallInfo={wallId:null,state:null},this.pointInfo={pointId:null,state:null},this.symbolInfo={symbolId:null,state:null},this.componentInfo={componentId:null,state:null},this.tagInfo={tagId:null,state:null},this.furnitureInfo={furnitureId:null,state:null},this.modifyPoint=null};Oe.prototype.start=function(t,e,o){var i=this.getNearForVectors(t,e,o);i.modifyPoint&&(i.modifyPoint.hasOwnProperty("linkedPointId")||i.modifyPoint.hasOwnProperty("linkedPointIdX")||i.modifyPoint.hasOwnProperty("linkedPointIdY")||i.modifyPoint.hasOwnProperty("linkedWallId"))?(this.modifyPoint={x:i.modifyPoint.x,y:i.modifyPoint.y},i.modifyPoint.hasOwnProperty("linkedPointId")&&null!=i.modifyPoint.linkedPointId?this.modifyPoint.linkedPointId=i.modifyPoint.linkedPointId:i.modifyPoint.hasOwnProperty("linkedWallId")&&null!=i.modifyPoint.linkedWallId?this.modifyPoint.linkedWallId=i.modifyPoint.linkedWallId:(i.modifyPoint.hasOwnProperty("linkedPointIdX")&&null!=i.modifyPoint.linkedPointIdX&&(this.modifyPoint.linkedPointIdX=i.modifyPoint.linkedPointIdX),i.modifyPoint.hasOwnProperty("linkedPointIdY")&&null!=i.modifyPoint.linkedPointIdY&&(this.modifyPoint.linkedPointIdY=i.modifyPoint.linkedPointIdY))):this.modifyPoint=null;var n=this.updateSelectInfos(i,a.minAdsorb);return this.updateSelectItem(),n},Oe.prototype.getNearForVectors=function(t,e,o){var i=null,n=null,s={},r=null,l=[];e&&l.push(e);var h=he.getWalls();for(var u in h)if(!o||!o.hasOwnProperty(u)){var d=he.getWall(u),y=he.getPoint(d.start),p=he.getPoint(d.end),x=null,g=ct.getLine(d);if(g){var f=c.getJoinLinePoint(t,g);if(-1==l.indexOf(d.start)){if(l.push(d.start),x=c.getDistance(t,y),(null==i||i.distance>x)&&(i={distance:x,pointId:d.start},c.getDistance(f,t)<a.minAdsorb&&c.getDistance(f,y)<a.minAdsorb||i.distance<a.minAdsorb)){s.linkedPointId=d.start,s.x=y.x,s.y=y.y,delete s.linkedPointIdX,delete s.linkedPointIdY;break}if(Math.abs(t.x-y.x)<a.minAdsorb)if(s.linkedPointIdX){var m=he.getPoint(s.linkedPointIdX);c.getDistance(t,m)>c.getDistance(t,y)&&(s.x=y.x,s.linkedPointIdX=d.start)}else s.x=y.x,s.linkedPointIdX=d.start;if(Math.abs(t.y-y.y)<a.minAdsorb)if(s.linkedPointIdY){var v=he.getPoint(s.linkedPointIdY);c.getDistance(t,v)>c.getDistance(t,y)&&(s.y=y.y,s.linkedPointIdY=d.start)}else s.y=y.y,s.linkedPointIdY=d.start}if(-1==l.indexOf(d.end)){if(l.push(d.end),x=c.getDistance(t,p),(null==i||i.distance>x)&&(i={distance:x,pointId:d.end},c.getDistance(f,t)<a.minAdsorb&&c.getDistance(f,p)<a.minAdsorb||i.distance<a.minAdsorb)){s.linkedPointId=d.end,s.x=p.x,s.y=p.y,delete s.linkedPointIdX,delete s.linkedPointIdY;break}if(Math.abs(t.x-p.x)<a.minAdsorb)if(s.linkedPointIdX){var S=he.getPoint(s.linkedPointIdX);c.getDistance(t,S)>c.getDistance(t,p)&&(s.x=p.x,s.linkedPointIdX=d.end)}else s.x=p.x,s.linkedPointIdX=d.end;if(Math.abs(t.y-p.y)<a.minAdsorb)if(s.linkedPointIdY){var P=he.getPoint(s.linkedPointIdY);c.getDistance(t,P)>c.getDistance(t,p)&&(s.y=p.y,s.linkedPointIdY=d.end)}else s.y=p.y,s.linkedPointIdY=d.end}x=c.getDistance(t,f);var b=ct.isContain(d,f);b&&(null==n||n.distance>x)&&(n={distance:x,wallId:u}),b&&c.getDistance(t,f)<a.minAdsorb&&((r=f).linkedWallId=u)}else he.deleteWall(u)}var I={minPoint:i,minWall:n,symbolInfo:{},componentInfo:{},tagInfo:{},furnitureInfo:{}};null!=r?I.modifyPoint=JSON.parse(JSON.stringify(r)):s.hasOwnProperty("x")&&s.hasOwnProperty("y")?I.modifyPoint=JSON.parse(JSON.stringify(s)):s.hasOwnProperty("x")?(I.modifyPoint=JSON.parse(JSON.stringify(s)),I.modifyPoint.x=s.x,I.modifyPoint.y=t.y):s.hasOwnProperty("y")&&(I.modifyPoint=JSON.parse(JSON.stringify(s)),I.modifyPoint.x=t.x,I.modifyPoint.y=s.y);var k=he.getSymbols();for(var T in k){var F=he.getSymbol(T).isContain(t);if(null!=F){I.symbolInfo={symbolId:T,state:F};break}}var w=he.getComponents();for(var C in w){if(he.getComponent(C).isContain(t)){I.componentInfo={componentId:C,state:"all"};break}}var W=he.getTags();for(var D in W){if(he.getTag(D).isContain(t)){I.tagInfo={tagId:D,state:"all"};break}}var z=he.getFurnitures();for(var L in z){if(he.getFurniture(L).isContain(t)){I.furnitureInfo={furnitureId:L,state:"all"};break}}return I},Oe.prototype.updateSelectInfos=function(t,e){var o=!1;null!=t.minPoint?t.minPoint.distance<e?(o=this.isChanged(t.minPoint.pointId,G,1),this.pointInfo={pointId:t.minPoint.pointId,state:G}):(o=this.isChanged(t.minPoint.pointId,null,1),this.pointInfo={pointId:t.minPoint.pointId,state:null}):(o=this.isChanged(null,null,1),this.pointInfo={pointId:null,state:null});var i=!1;null!=t.minWall?t.minWall.distance<e?(i=this.isChanged(t.minWall.wallId,G,2),this.wallInfo={wallId:t.minWall.wallId,state:G}):(i=this.isChanged(t.minWall.wallId,null,2),this.wallInfo={wallId:t.minWall.wallId,state:null}):(i=this.isChanged(null,null,2),this.wallInfo={wallId:null,state:null});var n=this.isChanged(t.symbolInfo.symbolId,t.symbolInfo.state,3);this.symbolInfo={symbolId:t.symbolInfo.symbolId,state:t.symbolInfo.state};var s=this.isChanged(t.componentInfo.componentId,t.componentInfo.state,4);this.componentInfo={componentId:t.componentInfo.componentId,state:t.componentInfo.state};var r=this.isChanged(t.tagInfo.tagId,t.tagInfo.state,5);this.tagInfo={tagId:t.tagInfo.tagId,state:t.tagInfo.state};var l=this.isChanged(t.furnitureInfo.furnitureId,t.furnitureInfo.state,6);return this.furnitureInfo={furnitureId:t.furnitureInfo.furnitureId,state:t.furnitureInfo.state},o||i||n||s||r||l},Oe.prototype.isChanged=function(t,e,o){var i=!1;return 1==o?i=(null!=e||e!=this.pointInfo.state)&&(this.pointInfo.pointId!=t||e!=this.pointInfo.state):2==o?i=(null!=e||e!=this.wallInfo.state)&&(this.wallInfo.wallId!=t||e!=this.wallInfo.state):3==o?i=(null!=e||e!=this.symbolInfo.state)&&(this.symbolInfo.symbolId!=t||e!=this.symbolInfo.state):4==o?i=(null!=e||e!=this.componentInfo.state)&&(this.componentInfo.componentId!=t||e!=this.componentInfo.state):5==o?i=(null!=e||e!=this.tagInfo.state)&&(this.tagInfo.tagId!=t||e!=this.tagInfo.state):6==o&&(i=(null!=e||e!=this.furnitureInfo.state)&&(this.furnitureInfo.furnitureId!=t||e!=this.furnitureInfo.state)),i},Oe.prototype.updateSelectItem=function(){if(null!=this.tagInfo.tagId&&null!=this.tagInfo.state){var t=he.getTag(this.tagInfo.tagId);ee.setSelectItem(this.tagInfo.tagId,t.geoType,this.tagInfo.state)}else if(null!=this.componentInfo.componentId&&null!=this.componentInfo.state){var e=he.getComponent(this.componentInfo.componentId);ee.setSelectItem(this.componentInfo.componentId,e.geoType,this.componentInfo.state)}else if(null!=this.furnitureInfo.furnitureId&&null!=this.furnitureInfo.state){var o=he.getFurniture(this.furnitureInfo.furnitureId);ee.setSelectItem(this.furnitureInfo.furnitureId,o.geoType,this.furnitureInfo.state)}else if(null!=this.symbolInfo.symbolId&&null!=this.symbolInfo.state){var i=he.getSymbol(this.symbolInfo.symbolId);ee.setSelectItem(this.symbolInfo.symbolId,i.geoType,this.symbolInfo.state)}else null!=this.pointInfo.pointId&&null!=this.pointInfo.state?ee.setSelectItem(this.pointInfo.pointId,d,G):null!=this.wallInfo.wallId&&null!=this.wallInfo.state?ee.setSelectItem(this.wallInfo.wallId,y,G):ee.clearSelectItem()},Oe.prototype.clear=function(){this.wallInfo={wallId:null,state:null},this.pointInfo={pointId:null,state:null},this.symbolInfo={symbolId:null,state:null},this.componentInfo={componentId:null,state:null},this.furnitureInfo={furnitureId:null,state:null},this.modifyPoint=null};var Ae=new Oe,Ee=function(){this.startAddWall=null,this.newWall=null,this.symbolPoints={Start:null,End:null},this.checkLines={X:null,Y:null},this.vCheckLines={X:null,Y:null},this.signLine1={X:null,Y:null},this.signLine2={X:null,Y:null},this.init()};Ee.prototype.init=function(){this.startAddWall=new lt(0,0),this.startAddWall.name=Te,this.newWall=new ke({x:0,y:0},{x:1,y:1}),this.newWall.name=Fe,this.symbolPoints.Start=new lt(0,0),this.symbolPoints.Start.name=we,this.symbolPoints.End=new lt(0,0),this.symbolPoints.End.name=Ce,this.checkLines.X=new ke({x:0,y:0},{x:1,y:1}),this.checkLines.X.name=We,this.checkLines.Y=new ke({x:0,y:0},{x:1,y:1}),this.checkLines.Y.name=De,this.vCheckLines.X=new ke({x:0,y:0},{x:1,y:1}),this.vCheckLines.X.name=ze,this.vCheckLines.Y=new ke({x:0,y:0},{x:1,y:1}),this.vCheckLines.Y.name=Le,this.signLine1=new ke({x:0,y:0},{x:1,y:1}),this.signLine1.name=Me,this.signLine2=new ke({x:0,y:0},{x:1,y:1}),this.signLine2.name=Re},Ee.prototype.showStartAddWall=function(){this.startAddWall.display=!0},Ee.prototype.hideStartAddWall=function(){this.startAddWall.display=!1},Ee.prototype.setStartAddWall=function(t){this.startAddWall.setPosition(t)},Ee.prototype.showSymbolPoints=function(){this.symbolPoints.Start.display=!0,this.symbolPoints.End.display=!0},Ee.prototype.hideSymbolPoints=function(){this.symbolPoints.Start.display=!1,this.symbolPoints.End.display=!1},Ee.prototype.setSymbolPoints=function(t,e){this.symbolPoints.Start.setPosition(t),this.symbolPoints.End.setPosition(e)},Ee.prototype.showNewWall=function(){this.newWall.display=!0},Ee.prototype.hideNewWall=function(){this.newWall.display=!1},Ee.prototype.setNewWall=function(t,e){this.newWall.setPositions(t,e)},Ee.prototype.setNewWallStartPosition=function(t){this.newWall.start.x=t.x,this.newWall.start.y=t.y},Ee.prototype.setNewWallEndPosition=function(t){this.newWall.end.x=t.x,this.newWall.end.y=t.y},Ee.prototype.setNewWallState=function(t){this.newWall.state=t},Ee.prototype.showCheckLinesX=function(){this.checkLines.X.display=!0},Ee.prototype.hideCheckLinesX=function(){this.checkLines.X.display=!1},Ee.prototype.setCheckLinesX=function(t,e){this.checkLines.X.setPositions(t,e)},Ee.prototype.showCheckLinesY=function(){this.checkLines.Y.display=!0},Ee.prototype.hideCheckLinesY=function(){this.checkLines.Y.display=!1},Ee.prototype.setCheckLinesY=function(t,e){this.checkLines.Y.setPositions(t,e)},Ee.prototype.showVCheckLinesX=function(){this.vCheckLines.X.display=!0},Ee.prototype.hideVCheckLinesX=function(){this.vCheckLines.X.display=!1},Ee.prototype.setVCheckLinesX=function(t,e){this.vCheckLines.X.setPositions(t,e)},Ee.prototype.showVCheckLinesY=function(){this.vCheckLines.Y.display=!0},Ee.prototype.hideVCheckLinesY=function(){this.vCheckLines.Y.display=!1},Ee.prototype.setVCheckLinesY=function(t,e){this.vCheckLines.Y.setPositions(t,e)},Ee.prototype.setSignLine1=function(t,e){this.signLine1.setPositions(t,e)},Ee.prototype.showSignLine1=function(){this.signLine1.display=!0},Ee.prototype.hideSignLine1=function(){this.signLine1.display=!1},Ee.prototype.setSignLine2=function(t,e){this.signLine2.setPositions(t,e)},Ee.prototype.showSignLine2=function(){this.signLine2.display=!0},Ee.prototype.hideSignLine2=function(){this.signLine2.display=!1},Ee.prototype.hideAll=function(){this.hideCheckLinesX(),this.hideCheckLinesY(),this.hideStartAddWall(),this.hideNewWall(),this.hideSymbolPoints(),this.hideVCheckLinesX(),this.hideVCheckLinesY(),this.hideSignLine1(),this.hideSignLine2()},Ee.prototype.execute=function(t,e){if(this.hideVCheckLinesX(),this.hideVCheckLinesY(),this.hideCheckLinesX(),this.hideCheckLinesY(),t){var o=le.getXYFromScreen({x:0,y:0}),i=le.getXYFromScreen({x:le.width,y:le.height});Math.abs(e.x-t.x)<a.minAdsorb&&(e.x=t.x,o.x=e.x,i.x=e.x,this.setVCheckLinesX(o,i),this.showVCheckLinesX()),Math.abs(e.y-t.y)<a.minAdsorb&&(e.y=t.y,o.y=e.y,i.y=e.y,this.setVCheckLinesY(o,i),this.showVCheckLinesY()),c.equalPoint(e,t)&&(this.hideVCheckLinesX(),this.hideVCheckLinesY())}if(!this.vCheckLines.Y.display&&!this.vCheckLines.Y.display&&Ae.modifyPoint){if(Ae.modifyPoint.linkedPointIdX){var n=he.getPoint(Ae.modifyPoint.linkedPointIdX);this.setCheckLinesX(n,e),this.showCheckLinesX()}if(Ae.modifyPoint.linkedPointIdY){var s=he.getPoint(Ae.modifyPoint.linkedPointIdY);this.setCheckLinesY(s,e),this.showCheckLinesY()}}},Ee.prototype.checkAngle=function(t,e,o){function i(t,e,o,i){var n=c.createLine1(e,o),s=null;if(1==i){var r=c.getVerticalLine(n,e);s=c.getJoinLinePoint(t,r)}else 2==i&&(s=c.getJoinLinePoint(t,n));return s}for(var n=ct.getNeighPoints(e,o),s=he.getPoint(e),r=null,l=0;l<n.length;++l){var a=c.Angle(s,t,n[l]);if(Math.abs(a/Math.PI*180-90)<5?r=i(t,s,n[l],1):(Math.abs(a/Math.PI*180)<5||Math.abs(a/Math.PI*180-180)<5)&&(r=i(t,s,n[l],2)),null!=r)return r}return r};var Be=new Ee,_e=function(){this.history={records:[],currentRecordIndex:-1,state:{pre:0,next:0}}};_e.prototype.getCurrentRecordIndex=function(){return this.history.currentRecordIndex},_e.prototype.getHistoryRecord=function(){return null==this.history.currentRecordIndex||0==this.history.records.length?null:this.history.records[this.history.currentRecordIndex]},_e.prototype.getHistoryRecords=function(){return this.history.records},_e.prototype.getHistoryState=function(){return this.history.state},_e.prototype.addHistoryRecord=function(t){var e=this.history.records.length;if(0==e)this.history.records.push(t),this.history.currentRecordIndex=0;else if(this.history.currentRecordIndex+1==e)this.history.records.push(t),++this.history.currentRecordIndex;else{var o=this.history.records.slice(0,this.history.currentRecordIndex+1);o.push(t),this.history.records=o,++this.history.currentRecordIndex}},_e.prototype.setHistoryState=function(t,e){this.history.state.pre=t,this.history.state.next=e},_e.prototype.undoHistoryRecord=function(){--this.history.currentRecordIndex},_e.prototype.redoHistoryRecord=function(){++this.history.currentRecordIndex},_e.prototype.clearHistoryRecord=function(){this.history.records=[],this.setHistoryState(0,0)},_e.prototype.hasRecords=function(){return this.history.records.length>0};var Ye=new _e;window.historyService=Ye;var Ne=function(t){this.layer=t,this.app=this.layer.app,this.houseData=null};Ne.prototype.initVectors=function(t){for(var e=t.floors,o=-1,i=0,n=0,s=0;s<e.length;++s){var r=e[s].subgroup,a=e[s];l.floors[r]={},l.floors[r].points={},l.floors[r].walls={},l.floors[r].symbols={},l.floors[r].components={},l.floors[r].tags={},l.floors[r].furnitures={},l.floors[r].boundingBox={},l.floors[r].rooms=[];for(var h=null,c=null,d=null,p=null,x=0;x<a["vertex-xy"].length;++x){var g=a["vertex-xy"][x].id+n;o<g&&(o=g),g=u+g;var f={x:a["vertex-xy"][x].x,y:a["vertex-xy"][x].y};ct.createPoint(f.x,f.y,g,r),(null==h||h>f.x)&&(h=f.x),(null==c||c>f.y)&&(c=f.y),(null==d||d<f.x)&&(d=f.x),(null==p||p<f.y)&&(p=f.y)}i=o+1,l.floors[r].boundingBox.minX=h,l.floors[r].boundingBox.minY=c,l.floors[r].boundingBox.maxX=d,l.floors[r].boundingBox.maxY=p;for(var m=0;m<a.segment.length;++m){var v=a.segment[m].id+i;o<v&&(o=v),v=y+v;var S=u+(a.segment[m].a+n),P=u+(a.segment[m].b+n);ct.createWall(S,P,v,r)}i=o+1,n=o+1}he.setCurrentId(o+1);var b=this.app.core.get("Player").model.currentFloor.floorIndex;he.setCurrentFloor(b)},Ne.prototype.createDecorateData=function(t){for(var e={name:"houseType.json",version:"2.1",floors:[]},o=0;o<t.floors.length;++o){var i={points:[],walls:[]};for(var n in t.floors[o].points){var s={};s.x=t.floors[o].points[n].x,s.y=t.floors[o].points[n].y,s.parent=t.floors[o].points[n].parent,s.vectorId=t.floors[o].points[n].vectorId,i.points.push(s)}for(var r in t.floors[o].walls){var l={};l.start=t.floors[o].walls[r].start,l.end=t.floors[o].walls[r].end,l.children=[],l.vectorId=t.floors[o].walls[r].vectorId,l.width=.2,i.walls.push(l)}e.floors.push(i)}return e};var Xe="panBackGround",je="addWall",Ue="addingWall",Je="moveWall",Ve="moveWallPoint",He="addSymbol",$e="moveSymbol",Ze="moveSymbolPoint",Ge="addComponent",Ke="moveComponent",qe="addTag",Qe="moveTag",to="addFurniture",eo="moveFurniture",oo=function(t,e,o){this.name=o||"未命名",this.floor=e,this.roomId=t,this.center=null,this.area=null,this.wallIds=[],this.wallPointIDs=[],this.childrenRooms=[],this.childrenWalls=[],this.parent=null,this.tagName=null,this.backgroundImg_src="default",this.boundingBox={}};oo.prototype.setInfo=function(t){this.wallIds=t.wallIds,this.wallPointIDs=t.wallPointIDs,this.area=t.area,this.center=t.center,this.boundingBox=t.boundingBox,this.parent=t.parent,this.childrenWalls=t.childrenWalls,this.childrenRooms=t.childrenRooms},oo.prototype.containPoint=function(t){for(var e=[],o=0;o<this.wallPointIDs.length;++o){var i=he.getPoint(this.wallPointIDs[o],this.floor);e.push({x:i.x,y:i.y})}return c.isPointInPoly(t,e)};var io=function(t,e,o){this.pointIds=e,this.segmentIds=t,this.childrenPolygonIds=[],this.childrenSegmentIds=[],this.id=o,this.parent=null,this.center=null,this.boundingBox=null,this.area=0,this.floor=1,this.geoType="Polygon"},no=function(){this.segments={},this.points={},this.polygons=[],this.matrix={},this.maxPolygons=[],this.pre="",this.currentId=1};no.prototype.init=function(){this.segments={},this.points={},this.polygons=[],this.matrix={},this.maxPolygons=[]},no.prototype.start=function(t,e,o){this.pre=o||"",this.init(),this.segments=JSON.parse(JSON.stringify(t)),this.points=JSON.parse(JSON.stringify(e)),this.createPolygon(null,this.segments,this.points),this.segments=JSON.parse(JSON.stringify(t)),this.points=JSON.parse(JSON.stringify(e)),this.getIncludePolygonInfos(),this.updateChildrenSegmentIds(this.segments,this.points,this.polygons)},no.prototype.getStartPoint=function(t,e){var o=null,i=null;for(var n in t)if(n!==e){var s=t[n];(null===o||o.x>s.x||o.x===s.x&&o.y>s.y)&&(o={x:s.x,y:s.y},i=n)}return i},no.prototype.createPolygon=function(t,e,o){if(0!==Object.keys(o).length&&0!==Object.keys(e).length){this.matrix={};var i=[];this.preHandle(o,e);var n=Object.keys(e).length;if(0!==Object.keys(o).length&&0!==Object.keys(e).length){null!==t&&o[t]||(t=this.getStartPoint(o)),i.push(t);var s=this.getNextForMinAngleX(t,o,e);if(null!==s){i.push(s);var r=this.getMaxPolygon(i,o,e);this.checkPolygonSegmentIds(r,o,e);var l=this.splitPolygon(r);if(l){var a=this.getPolygonData(l,o,e),h=Object.keys(a.points),c=Object.keys(a.segments);if(a.segments=this.getChildSegments(a.points,a.segments,e),this.createPolygon(l[0],a.segments,a.points),this.updateMartix2(h,c,o,e),this.preHandle(o,e),0===Object.keys(o).length||0===Object.keys(e).length)return;this.createPolygon(t,e,o)}else if(0!==Object.keys(o).length&&0!==Object.keys(e).length){this.maxPolygons.push(r),this.updateMartix(r,o,e),o[t]||(t=this.getStartPoint(o),s=this.getNextForMinAngleX(t,o,e));var u=[];u.push(t),u.push(s);var d=this.getMinPolygon(u,o,e);if(this.checkPolygonSegmentIds(d,o,e),l=this.splitPolygon(d)){var y=this.getPolygonData(l,o,e),p=Object.keys(y.points),x=Object.keys(y.segments);if(this.createPolygon(l[0],y.segments,y.points),this.updateMartix2(p,x,o,e),this.preHandle(o,e),0===Object.keys(o).length||0===Object.keys(e).length)return;this.createPolygon(t,e,o)}else if(0!==r.length&&0!==d.length){if(this.addPolygon(d,o,e)){var g=d.slice(0);if(g.push(d[0]),this.updateMartix(g,o,e),this.preHandle(o,e),0===Object.keys(o).length||0===Object.keys(e).length)return}if(n===Object.keys(e).length){this.addPolygon(r,o,e);var f=r.slice(0);if(f.push(r[0]),this.updateMartix(f,o,e),this.updateMartix(f,o,e),this.preHandle(o,e),0===Object.keys(o).length||0===Object.keys(e).length)return}var m=this.getStartPoint(o,t);this.createPolygon(m,e,o)}else console.error("createPolygon——————————————————————————————————————————————————————————————出错!")}}}}},no.prototype.splitPolygon=function(t){for(var e=[],o=0;o<t.length-1;++o){if(-1!==e.indexOf(t[o])){var i=t.slice(0,o+1),n=t.indexOf(t[o]);return i=i.splice(n)}e.push(t[o])}return null},no.prototype.getPolygonData=function(t,e,o){for(var i={},n={},s=[],r=0;r<t.length;++r)i[t[r]]=e[t[r]],s.push(e[t[r]]);for(var l=this.checkPolygonSegmentIds(t,e,o),a=0;a<l.length;++a)n[l[a]]=o[l[a]];var h=[],u=[];for(var d in e)if(!(t.indexOf(d)>-1||h.indexOf(d)>-1)){var y=e[d];if(c.isPointInPoly(y,s)){h.push(d);var p=y.parent;for(var x in p)if(o[x]&&!n[x]&&-1===u.indexOf(x)){var g=null;o[x].start===d?g=o[x].end:o[x].end===d&&(g=o[x].start);var f=e[g];t.indexOf(g)>-1||h.indexOf(g)>-1?u.push(x):c.isPointInPoly(f,s)&&(u.push(x),h.push(g))}}}for(var m=0;m<h.length;++m)i[h[m]]||(i[h[m]]=e[h[m]]);for(var v=0;v<u.length;++v)n[u[v]]||(n[u[v]]=o[u[v]]);return{points:i,segments:n}},no.prototype.getChildSegments=function(t,e,o){var i=[];for(var n in t)i.push(n);for(var s=0;s<i.length-1;++s)for(var r=s+1;r<i.length;++r){var l=this.getSegmentId2(t[i[s]],t[i[r]]);null==l||e[l]||(e[l]=o[l])}return e},no.prototype.updateMartix2=function(t,e,o,i){for(var n=0;n<e.length;++n){var s=e[n];delete this.matrix[s],delete i[s],this.deleteSegment(s,i,o)}for(var r=0;r<t.length;++r){var l=t[r],a=o[l];a&&0!==Object.keys(a.parent).length||delete o[l]}},no.prototype.addPolygon=function(t,e,o){var i=[],n=[];i[0]=this.getPoint(t[0],e);for(var s=0;s<t.length-1;++s){var r=t[s],l=t[s+1],a=this.getSegmentId(r,l,e,o);n.push(a);var h=this.getPoint(l,e);i.push(h)}var u=this.getId();t.pop();var d=new io(n,t,u);return d.area=this.getArea(d),d.center=this.getCenter(d),d.boundingBox=c.getBoundingBox(i),this.polygons.push(d),!0},no.prototype.getMaxPolygon=function(t,e,o){var i=t[t.length-2],n=t[t.length-1],s=this.getNextForMaxMinAngle(i,n,e,o);return t[0]===s.min?(t.push(s.min),t):(t.push(s.min),this.getMaxPolygon(t,e,o))},no.prototype.getMinPolygon=function(t,e,o){var i=t[t.length-2],n=t[t.length-1],s=this.getNextForMaxMinAngle(i,n,e,o);return t[0]===s.max?(t.push(s.max),t):(t.push(s.max),this.getMinPolygon(t,e,o))},no.prototype.getNextForMinAngleX=function(t,e,o){for(var i=e[t],n=this.getAllLinkedPoint(t,e,o),s=null,r=null,l=0;l<n.length;++l){var a=e[n[l]];if(a){var h=c.Angle(i,{x:i.x+1,y:i.y},a);a.y-i.y<0&&(h*=-1),(null===s||s>h)&&(s=h,r=n[l])}}return r},no.prototype.getNextForMaxMinAngle=function(t,e,o,i){var n=o[t],s=o[e];n&&s||console.error("getNextForMaxMinAngle******************************************");for(var r=s.x-n.x,l=s.y-n.y,a={x:s.x+r,y:s.y+l},h=this.getAllLinkedPoint(e,o,i),u=null,d=null,y=null,p=null,x=0;x<h.length;++x)if(h[x]!==t){var g=o[h[x]];if(g){var f=c.Angle(s,a,g);r*(g.y-s.y)-(g.x-s.x)*l<0&&(f*=-1),(null===u||u<f)&&(u=f,d=h[x]),(null===y||y>f)&&(y=f,p=h[x])}}return{max:d,min:p}},no.prototype.updateMartix=function(t,e,o){for(var i=0;i<t.length-1;++i){var n=i===t.length-1?0:i+1,s=this.getSegmentId(t[i],t[n],e,o);this.matrix[s]?(delete this.matrix[s],this.deleteSegment(s,o,e)):this.matrix[s]=1}},no.prototype.getSegmentId=function(t,e,o,i){var n=o[t];if(!n)return null;var s=n.parent;for(var r in s){var l=i[r];if(l&&(l.start===e||l.end===e))return r}return null},no.prototype.getSegmentId2=function(t,e){var o=t.parent,i=e.parent;for(var n in o)if(i[n])return n;return null},no.prototype.getAllLinkedPoint=function(t,e,o){var i=[],n=e[t];n||console.error("getAllLinkedPoint");var s=n.parent;for(var r in s){var l=o[r];l&&(l.start===t?i.push(l.end):l.end===t&&i.push(l.start))}return i},no.prototype.deleteLinksSegment=function(t,e,o){var i=e[t];if(i&&0!==Object.keys(i.parent).length&&o[Object.keys(i.parent)[0]]){var n=this.getOtherPointId(Object.keys(i.parent)[0],t,o);this.deleteSegment(Object.keys(i.parent)[0],o,e);var s=e[n];s&&Object.keys(s.parent).length<2&&this.deleteLinksSegment(n,e,o)}},no.prototype.deleteSegment=function(t,e,o){if(t&&e[t]){var i=e[t];this.deletePoint(i.start,t,o),this.deletePoint(i.end,t,o),delete e[t]}},no.prototype.deletePoint=function(t,e,o){if(t&&o[t]){var i=this.getPoint(t,o);delete i.parent[e],0===Object.keys(i.parent).length&&delete o[t]}},no.prototype.getOtherPointId=function(t,e,o){var i=o[t];return i||console.error("getOtherPointId**********************************************************************"),i.start===e?i.end:i.end===e?i.start:void console.error("getOtherPointId**********************************************************************")},no.prototype.preHandle=function(t,e){var o=!1;for(var i in t){var n=t[i];if(Object.keys(n.parent).length<2)this.deleteLinksSegment(i,t,e),o=!0;else{var s=0;for(var r in n.parent)e[r]&&++s;if(s>1)continue;delete t[i]}}return o},no.prototype.getPoint=function(t,e){return e[t]},no.prototype.isClockwise=function(t,e){for(var o=[],i=0;i<t.length;++i){var n=e[t[i]];o.push({x:n.x,y:n.y})}return c.isClockwise(o)},no.prototype.getId=function(){var t=this.currentId;return++this.currentId,"Polygon"+t},no.prototype.getArea=function(t){for(var e=[],o=0;o<t.pointIds.length;++o){var i=this.points[t.pointIds[o]];e.push(i)}return c.ComputePolygonArea(e)},no.prototype.getCenter=function(t){for(var e=[],o=0;o<t.pointIds.length;++o){var i=this.points[t.pointIds[o]];e.push(i)}return c.getPolygonCore(e)},no.prototype.getIncludePolygonInfos=function(){this.polygons=this.polygons.sort((function(t,e){return t.area-e.area}));for(var t=0;t<this.polygons.length-1;++t){for(var e=null,o=t+1;o<this.polygons.length;++o)if(o!==t&&this.isContain(this.polygons[t],this.polygons[o])){e=this.polygons[o];break}null!=e&&(this.polygons[t].parent=e.id,e.childrenPolygonIds.push(this.polygons[t].id),e=null)}},no.prototype.updateChildrenSegmentIds=function(t,e,o){for(var i=[],n=0;n<o.length;++n){var s=o[n];i=i.concat(s.segmentIds)}for(var r in t)if(!(i.indexOf(r)>-1))for(var l=t[r],a=e[l.start],h=e[l.end],c=0;c<o.length;++c){var u=!1,d=!1,y=o[c];(y.pointIds.indexOf(l.start)>-1||this.containPoint(y,a))&&(u=!0),(y.pointIds.indexOf(l.end)>-1||this.containPoint(y,h))&&(d=!0),u&&d&&y.childrenSegmentIds.push(r)}},no.prototype.isContain=function(t,e){for(var o=[],i=[],n=0;n<t.pointIds.length;++n){var s=this.points[t.pointIds[n]];o.push(s)}for(var r=0;r<e.pointIds.length;++r){var l=this.points[e.pointIds[r]];i.push(l)}return c.isPolyInPoly(o,i,.01)},no.prototype.containPoint=function(t,e){for(var o=[],i=0;i<t.pointIds.length;++i){var n=this.points[t.pointIds[i]];o.push(n)}return c.isPointInPoly(e,o)},no.prototype.checkPolygonSegmentIds=function(t,e,o){for(var i=[],n=0;n<t.length;++n){var s=n===t.length-1?0:n+1;if(t[n]!==t[s]){if(!t[n]||!t[s])return;var r=this.getSegmentId(t[n],t[s],e,o);if(!r)return;i.push(r)}}return i},no.prototype.setCaves=function(){for(var t=0;t<this.polygons.length;++t){var e=this.polygons[t],o=e.childrenPolygonIds.slice(0);this.getChildMaxPolygons(e,o)}},no.prototype.getChildPolygonInfo=function(t){if(t.length<2)return null;for(var e=[],o=[],i=0;i<this.polygons.length;++i){var n=this.polygons[i];t.indexOf(n.id)>-1&&(e=e.concat(n.pointIds),o=o.concat(n.segmentIds))}for(var s={},r={},l=0;l<e.length;++l)s[e[l]]=this.points[e[l]];for(var a=0;a<o.length;++a)r[o[a]]=this.segments[o[a]];return{points:s,segments:r}},no.prototype.getChildMaxPolygons=function(t,e){var o=this.getChildPolygonInfo(e);if(null!=o){var i=this.getStartPoint(o.points),n=[];n.push(i);var s=this.getNextForMinAngleX(i,o.points,o.segments);n.push(s);var r=this.getMaxPolygon(n,o.points,o.segments);r.pop(),t.caves.push(r);for(var l=0;l<e.length;++l)for(var a=this.getPolygon(e[l]),h=0;h<a.pointIds.length;++h)if(r.indexOf(a.pointIds[h])>-1){e.splice(l,1),--l;break}this.getChildMaxPolygons(t,e)}else if(1===e.length){var c=this.getPolygon(e[0]);t.caves.push(c.pointIds)}},no.prototype.getPolygon=function(t){for(var e=0;e<this.polygons.length;++e){var o=this.polygons[e];if(o.id===t)return o}return console.error("找不到多边形!"),null};var so=new no,ro=function(){this.room_hallImg=null,this.room_defaultImg=null,this.room_other_White_Img=null,this.room_other_Black_Img=null};ro.prototype.addRoom=function(t,e){l.floors[e].rooms.push(t)},ro.prototype.getRoom=function(t,e){return l.floors[e].rooms[t]},ro.prototype.getRooms=function(t){return l.floors[t].rooms},ro.prototype.clearRooms=function(t){l.floors[t].rooms=[]},ro.prototype.setHallImg=function(t){this.room_hallImg=t},ro.prototype.getHallImg=function(){return this.room_hallImg},ro.prototype.setDefaultImg=function(t){this.room_defaultImg=t},ro.prototype.getDefaultImg=function(){return this.room_defaultImg},ro.prototype.setOtherWhiteImg=function(t){this.room_other_White_Img=t},ro.prototype.getOtherWhiteImg=function(){return this.room_other_White_Img},ro.prototype.setOtherBlackImg=function(t){this.room_other_Black_Img=t},ro.prototype.getOtherBlackImg=function(){return this.room_other_Black_Img};var lo=new ro,ao=function(){this.points={},this.segments={},this.polygons=[],this.tempRooms=[]};ao.prototype.start=function(){var t=l.floors;console.log("从头开始分房间!");for(var e=0;e<t.length;++e){var o=t[e].walls,i=t[e].points;lo.clearRooms(e),this.getRoomForSingleFloor(o,i,e)}this.updateRoomsTagName()},ao.prototype.getRoomForSingleFloor=function(t,e,o){this.getRooms(t,e,o);for(var i=0;i<this.tempRooms.length;++i){var n=this.tempRooms[i];n.floor=o;var s=new oo(n.roomId,n.floor);s.setInfo({wallIds:n.wallIds,wallPointIDs:n.wallPointIDs,area:n.area,center:n.center,boundingBox:n.boundingBox,parent:n.parent,childrenWalls:n.childrenWalls,childrenRooms:n.childrenRooms}),lo.addRoom(s,o)}this.tempRooms=[]},ao.prototype.getRooms=function(t,e,o){this.convertToSegments(t,o),this.convertToPoints(e,o),so.start(this.segments,this.points),this.convertToRoomForPolygon(o),this.points={},this.segments={},this.polygons=[]},ao.prototype.convertToPoints=function(t,e){for(var o in t){var i=he.getPoint(o,e),n={pointId:i.vectorId,x:i.x,y:i.y,parent:JSON.parse(JSON.stringify(i.parent))};this.points[i.vectorId]=n}},ao.prototype.convertToSegments=function(t,e){for(var o in t){var i=he.getWall(o,e),n={segmentId:i.vectorId,start:i.start,end:i.end};this.segments[i.vectorId]=n}},ao.prototype.convertToRoomForPolygon=function(){for(var t=0;t<so.polygons.length;++t){var e=so.polygons[t],o={};o.roomId=e.id.replace("Polygon","Room"),console.log("房间:"+o.roomId),o.wallIds=e.segmentIds,o.wallPointIDs=e.pointIds,o.area=e.area,o.center=e.center,o.boundingBox=e.boundingBox,null!=e.parent?o.parent=e.parent.replace("Polygon","Room"):o.parent=null,o.childrenRooms=[];for(var i=0;i<e.childrenPolygonIds.length;++i)o.childrenRooms.push(e.childrenPolygonIds[i].replace("Polygon","Room"));o.childrenWalls=[];for(var n=0;n<e.childrenSegmentIds.length;++n)o.childrenWalls.push(e.childrenSegmentIds[n]);this.tempRooms.push(o)}so.polygons=[]},ao.prototype.updateRoomsName=function(){for(var t=0;t<l.floors.length;++t){var e=lo.getRooms(t),o=Se.getTags(t);o=JSON.parse(JSON.stringify(o));for(var i=0;i<e.length;++i)e[i]}},ao.prototype.updateRoomsTagName=function(){function t(t,e){return t.area-e.area}for(var e=0;e<l.floors.length;++e){var o=lo.getRooms(e),i=Se.getTags(e);i=JSON.parse(JSON.stringify(i)),o=o.sort(t);for(var n=0;n<o.length;++n){for(var s=o[n],r=[],a=0;a<s.wallPointIDs.length;++a){var h=he.getPoint(s.wallPointIDs[a],e);r.push(h)}for(var u in i)if(c.isPointInPoly(i[u].center,r)){s.tagName=i[u].title,delete i[u];break}}}};var ho=new ao,co=function(){this.startInfo={},this.endInfo={},this.canAdd=!1};co.prototype.setPointInfo=function(t,e){"start"==t?this.startInfo={position:{x:e.x,y:e.y},linkedPointId:e.linkedPointId,linkedWallId:e.linkedWallId}:"end"==t&&(this.endInfo={position:{x:e.x,y:e.y},linkedPointId:e.linkedPointId,linkedWallId:e.linkedWallId})},co.prototype.buildWall=function(t){console.log("添加新墙!");var e=this.getJoinsForWalls(),o=this.splitAllJoins(e);this.creatNewWalls(o,t),this.canAdd=!1,this.updateStart(this.endInfo.position,o[o.length-1]),Ae.clear()},co.prototype.creatNewWalls=function(t,e){for(var o=0;o<t.length-1;++o){var i=t[o],n=t[o+1];if(!ct.getWallId(i,n))ct.createWall(i,n).setOut(e)}},co.prototype.canAddWallForEnd=function(t){if(Ae.modifyPoint){if(c.getDistance(this.startInfo.position,Ae.modifyPoint)<a.minAdsorb)return!1}else if(c.getDistance(this.startInfo.position,t)<a.minAdsorb)return!1;if(Ae.symbolInfo.symbolId)return!1;var e=he.getSymbols();for(var o in e){var i=e[o];if(i.geoType!=S)if(null!=c.getIntersectionPoint3(i.startPoint,i.endPoint,this.startInfo.position,t))return!1}return!0},co.prototype.getJoinsForWalls=function(){var t=[],e=he.getWalls(),o=[],i=[];this.startInfo.linkedPointId?(o.push(this.startInfo.linkedPointId),i.push(this.startInfo.linkedPointId),t.push({join:{x:this.startInfo.position.x,y:this.startInfo.position.y},pointId:this.startInfo.linkedPointId})):this.startInfo.linkedWallId?t.push({join:{x:this.startInfo.position.x,y:this.startInfo.position.y},wallId:this.startInfo.linkedWallId}):t.push({join:{x:this.startInfo.position.x,y:this.startInfo.position.y}}),this.endInfo.linkedPointId?(o.push(this.endInfo.linkedPointId),i.push(this.endInfo.linkedPointId),t.push({join:{x:this.endInfo.position.x,y:this.endInfo.position.y},pointId:this.endInfo.linkedPointId})):this.endInfo.linkedWallId?t.push({join:{x:this.endInfo.position.x,y:this.endInfo.position.y},wallId:this.endInfo.linkedWallId}):t.push({join:{x:this.endInfo.position.x,y:this.endInfo.position.y}});var n=c.createLine1(this.startInfo.position,this.endInfo.position);for(var s in e)if(!(this.startInfo.linkedWallId&&this.startInfo.linkedWallId==s||this.endInfo.linkedWallId&&this.endInfo.linkedWallId==s)){var r=e[s];if(!(i.indexOf(r.start)>-1||i.indexOf(r.end)>-1)){var l=he.getPoint(r.start),h=he.getPoint(r.end),u=!1;if(o.indexOf(r.start)<0){o.push(r.start);var d=c.getJoinLinePoint(l,n);c.PointInSegment(d,this.startInfo.position,this.endInfo.position,a.minAdsorb)&&c.getDistance(l,d)<a.minAdsorb&&(t.push({join:{x:d.x,y:d.y},pointId:r.start}),u=!0,i.push(r.start))}if(o.indexOf(r.end)<0){o.push(r.end);var y=c.getJoinLinePoint(h,n);c.PointInSegment(y,this.startInfo.position,this.endInfo.position,a.minAdsorb)&&c.getDistance(h,y)<a.minAdsorb&&(t.push({join:{x:y.x,y:y.y},pointId:r.end}),u=!0,i.push(r.end))}if(!u&&i.indexOf(r.start)<0&&i.indexOf(r.end)<0){var p=c.getIntersectionPoint3(l,h,this.startInfo.position,this.endInfo.position);p&&t.push({join:{x:p.x,y:p.y},wallId:s})}}}return t},co.prototype.splitAllJoins=function(t){t=t.sort(function(t,e){return c.getDistance(this.startInfo.position,t.join)-c.getDistance(this.startInfo.position,e.join)}.bind(this));for(var e=[],o=0;o<t.length;++o){var i=t[o],n=i.join,s=i.wallId,r=i.pointId;if(r)e.push(r);else if(s){var l=ct.createPoint(n.x,n.y).vectorId,a=null;if(t[o+1]&&t[o].wallId==t[o+1].wallId){var h=he.getWall(s),u=he.getPoint(h.start);a=c.getDistance(u,t[o].join)<c.getDistance(u,t[o+1].join)?ct.splitWall(s,l,"end"):ct.splitWall(s,l,"start")}else a=ct.splitWall(s,l,"start");if(null==a){he.deletePoint(l);continue}se.reBelongForSplitWall(s,s,a),e.push(l)}else{var d=ct.createPoint(n.x,n.y);e.push(d.vectorId)}}return e},co.prototype.updateStart=function(t,e){c.clonePoint(this.startInfo.position,t),this.startInfo.linkedPointId=e,Be.setNewWallStartPosition(this.startInfo.position)},co.prototype.clear=function(){this.startInfo={},this.endInfo={},this.canAdd=!1,Be.hideNewWall(),Be.hideStartAddWall()};var uo=new co,yo=function(){this.lastInfo=null};yo.prototype.save=function(t,e,o,i){this.lastInfo={res:t,center:JSON.stringify(e),defaultCenter:JSON.stringify(o),floor:i},he.setCadBoundingBox()},yo.prototype.setTransform=function(t){var e=he.getCadBoundingBox(),o=he.getBoundingBox(t),i=this.lastInfo.res/(Math.abs(o.maxX-o.minX)/Math.abs(e.maxX-e.minX)),n=this.lastInfo.res/(Math.abs(o.maxY-o.minY)/Math.abs(e.maxY-e.minY)),s=Math.min(i,n);le._setRes(s);var r={x:1*(o.maxX+o.minX)/2,y:(o.maxY+o.minY)/2};le._setDefaultCenter(r),le.setCenter(r)},yo.prototype.recover=function(){le._setRes(this.lastInfo.res),le._setDefaultCenter(JSON.parse(this.lastInfo.defaultCenter)),le.setCenter(JSON.parse(this.lastInfo.center)),this.lastInfo=null};var po,xo=new yo,go=function(t,e){var o=window.location.search.substr(1).split("&");if(e){for(var i=0;i<o.length;i++){var n=o[i].split("=");if(2===n.length&&n[0]===t)return n[1]}return""}for(var s=0;s<o.length;s++){if(o[s].split("=")[0]==t)return!0}return!1},fo={delayOneFrame:function(t){window.setTimeout(t,1)},normalizeUrl:function(t){return t.replace("https://","http://")},domainFromUrl:function(t){var e=/^([^:]*:\/\/)?(www\.)?([^\/]+)/.exec(t);return e?e[3]:t},average:function(t,e){if(0===t.length)return null;for(var o=0,i=0,n=0;n<t.length;n++){o+=e?t[n][e]:t[n],i++}return o/i},countUnique:function(t){for(var e={},o=0;o<t.length;o++)e[t[o]]=1+(e[t[o]]||0);return Object.keys(e).length},averageVectors:function(t,e){var o=new THREE.Vector3;if(0===t.length)return o;for(var i=0,n=0;n<t.length;n++){var s=e?t[n][e]:t[n];o.add(s),i++}return o.divideScalar(i)},equalLists:function(t,e){if(t.length!==e.length)return!1;for(var o=0;o<t.length;o++)if(t[o]!==e[o])return!1;return!0},lowerMedian:function(t,e){return 0===t.length?null:(e=e||2,t.sort((function(t,e){return t-e})),t[Math.floor(t.length/e)])},stableSort:function(t,e){return t.map((function(t,e){return{value:t,index:e}})).sort((function(t,o){var i=e(t.value,o.value);return 0!==i?i:t.index-o.index})).map((function(t){return t.value}))},sortByScore:function(t,e,o){var i=e?fo.filterAll(t,e):t;return 0===i.length?[]:i=i.map((function(t){var e=o.map((function(e){return e(t)}));return{item:t,scores:e,score:e.reduce((function(t,e){return t+e}),0)}})).sort((function(t,e){return e.score-t.score}))},filterAll:function(t,e){return t.filter((function(t){return e.every((function(e){return e(t)}))}))},formatDate:function(t){return[t.getFullYear(),t.getMonth()+1,t.getDate()].join("-")},formatDatetime:function(t){return[t.getFullYear(),t.getMonth()+1,t.getDate(),t.getHours(),t.getMinutes()].join("-")},randomString:function(t){for(var e="",o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<t;i++)e+=o.charAt(Math.floor(Math.random()*o.length));return e},uint8ToBase64:function(t,e){e&&"number"==typeof e||(e=8192);for(var o=[],i=0;i<t.length;i+=e)o.push(String.fromCharCode.apply(null,t.subarray(i,i+e)));return btoa(o.join(""))},uuid4:function t(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,t)},nth:function(t){return 1===(t%=10)?t+"st":2===t?t+"nd":3===t?t+"rd":t+"th"},extendObject:function(t,e){return Object.keys(e).forEach((function(o){t[o]=e[o]})),t},deepExtend:function t(e){var o=arguments;e=e||{};for(var i=1;i<arguments.length;i++){var n=o[i];if(n)for(var s in n)n.hasOwnProperty(s)&&("object"==typeof n[s]?e[s]=t(e[s],n[s]):e[s]=n[s])}return e},inherit:function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t},extend:function(t,e){for(var o in e.prototype)t.prototype[o]=e.prototype[o]},extendObject:function(t,e){if(e instanceof Object)return Object.keys(e).forEach((function(o){t[o]=e[o]})),t},_textureCache:{},loadTextureFromCache:function(t){return this._textureCache[t]||(this._textureCache[t]=mo(t)),this._textureCache[t]},extend:function(t,e){for(var o in e.prototype)t.prototype[o]=e.prototype[o]},valueFromHash:function(t,e){var o=new RegExp("[#&?]"+t+"=([^#&?]*)").exec(window.location.href);if(!o)return e;var i=o[1];return"boolean"==typeof e?"true"===i||"1"===i:"number"==typeof e?parseFloat(i):window.decodeURIComponent(i)},deepFreeze:function(t){var e=this;return Object.freeze(t),Object.getOwnPropertyNames(t).forEach((function(o){!t.hasOwnProperty(o)||null===t[o]||"object"!=typeof t[o]&&"function"!=typeof t[o]||Object.isFrozen(t[o])||e.deepFreeze(t[o])})),t},defaultValue:function(t){if(null!=t&&"object"==typeof t)return Array.isArray(t)?[]:{}},randomUnique:function(){return crypto.getRandomValues(new Uint32Array(1))[0]},debounce:function(t,e,o){void 0===o&&(o=!1);var i=null;return o?function(){for(var o=[],i=arguments.length;i--;)o[i]=arguments[i];var n=this,s=Date.now();s-lastCallTime>=e&&(t.apply(n,o),lastCallTime=s)}:function(){for(var o=[],n=arguments.length;n--;)o[n]=arguments[n];i&&clearTimeout(i);var s=this;i=setTimeout((function(){t.apply(s,o)}),e)}},getMixedSet:function(t,e){return t.filter((function(t){return e.includes(t)}))},getUnionSet:function(t,e){return t.concat(e.filter((function(e){return!t.includes(e)})))},getDifferenceSet:function(t,e){var o=t.filter((function(t){return!e.includes(t)})),i=e.filter((function(e){return!t.includes(e)}));return o.concat(i)},getDifferenceSetMuti:function(t){var e=[];return t.forEach((function(t){t.forEach((function(t){var o=e.indexOf(t);o>-1?e.splice(o,1):e.push(t)}))})),e},getMAXCUBETEXTURESIZE:function(){try{var t=document.createElement("canvas"),e=t.getContext("webgl");return e||(e=t.getContext("experimental-webgl")),e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE)}catch(t){return 0}}},mo=((po=new THREE.TextureLoader).setCrossOrigin("Anonymous"),po.crossOrigin=!0,function(t,e,o,i){var n=po.load(t,e,o,i);return n.magFilter=n.minFilter=THREE.LinearFilter,n.needsUpadte=!0,n});fo.dataURLtoBlob=function(t){for(var e=t.split(","),o=e[0].match(/:(.*?);/)[1],i=atob(e[1]),n=i.length,s=new Uint8Array(n);n--;)s[n]=i.charCodeAt(n);return new Blob([s],{type:o})},fo.dataURLtoFile=function(t,e){for(var o=t.split(","),i=o[0].match(/:(.*?);/)[1],n=atob(o[1]),s=n.length,r=new Uint8Array(s);s--;)r[s]=n.charCodeAt(s);return new File([r],e,{type:i})},fo.saveFile=function(t,e,o){var i=document.createElementNS("http://www.w3.org/1999/xhtml","a");i.href=t,i.download=e;var n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),i.dispatchEvent(n),o&&o()},fo.PrefixPng="data:image/png;base64,",fo.getBlobSrc=function(t,e){var o=fo.dataURLtoBlob((e?fo.PrefixPng:"")+t);return window.URL.createObjectURL(o)},fo.replaceAll=function(t,e,o){var i=new RegExp(e,"g");return t.replace(i,o)},fo.randomWord=function(t,e,o){var i="",n=e,s=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];t&&(n=Math.round(Math.random()*(o-e))+e);for(var r=0;r<n;r++){i+=s[Math.round(Math.random()*(s.length-1))]}return i},fo.getRandomSid=function(){var t=fo.randomWord(!0,5,7),e=(new Date).getTime()+"",o=e.length;return t+(e=e.substring(o-8,o-5)+e.substring(o-3,o))},fo.getTime=function(t){var e="",o=parseInt(t/60);return o<10&&(e+="0"),e+=o,1==(t=parseInt(t%60)+"").length&&(t="0"+t),e=e+":"+t},fo.CloneJson=function(t){var e=JSON.stringify(t);return JSON.parse(e)},fo.CloneObject=function(t,e,o,i){var n=this;if(void 0===i&&(i=[]),i.push(THREE.Object3D),!t||"number"==typeof t||"string"==typeof t||t instanceof Function||i.some((function(e){return t instanceof e})))return t;if(e=e||{},t instanceof Array)return t.map((function(t){return n.CloneObject(t)}));if(t.clone instanceof Function)return t.clone();for(var s in t)t[s]instanceof Object&&!o?e[s]=this.CloneObject(t[s]):e[s]=t[s];return e},fo.CloneClassObject=function(t){var e=new t.constructor;return this.CopyClassObject(e,t),e},fo.CopyClassObject=function(t,e){for(var o in e){if(o in e.__proto__)break;t[o]=this.CloneObject(e[o],null)}},fo.ifSame=function(t,e){if(t==e)return!0;if(!t||!e)return!1;if(t.constructor!=e.constructor)return!1;if(t instanceof Array){if(t.length!=e.length)return!1;for(var o=e.slice(0),i=function(e){var i=o.find((function(o){return ifSame(t[e],o)}));if(null==i&&!o.includes(i)&&!t.includes(i))return{v:!1};var n=o.indexOf(i);o.splice(n,1)},n=0;n<t.length;n++){var s=i(n);if(s)return s.v}return!0}if(t.equals instanceof Function)return t.equals(e);if("number"==typeof t||"string"==typeof t)return!(!isNaN(t)||!isNaN(e))||t==e;if("object"==typeof t){var r=Object.keys(t),l=Object.keys(e);if(!ifSame(r,l))return!1;for(var a in t){if(!ifSame(t[a],e[a]))return!1}return!0}console.log("isSame出现例外")},fo.canvasToImg=function(t,e,o,i,n){void 0===e&&(e=1),void 0===i&&(i="image/jpeg");var s=t.toDataURL(i,e);return o&&this.saveTex(s,i,n),s};var vo;fo.saveTex=function(t,e,o){void 0===e&&(e="image/jpeg"),t=t.replace(function(t){return"image/"+(t=t.toLowerCase().replace(/jpg/i,"jpeg")).match(/png|jpeg|bmp|gif/)[0]}(e),"image/octet-stream");o=o||"4dage_"+(new Date).getTime()+("png"==e?".png":".jpg");fo.saveFile(t,o)},fo.imgAddLabel=function(t,e,o){void 0===o&&(o={});var i=document.createElement("canvas"),n=i.getContext("2d");n.canvas.width=t.width,n.canvas.height=t.height,n.drawImage(t,0,0,t.width,t.height);var s=t.width*o.widthRatioToImg,r=s*e.height/e.width;!o.leftRatioToImg&&o.rightRatioToImg&&(o.leftRatioToImg=1-o.rightRatioToImg-o.widthRatioToImg),!o.topRatioToImg&&o.bottomRatioToImg&&(o.topRatioToImg=1-o.bottomRatioToImg-r/t.height);var l=t.width*o.leftRatioToImg,a=t.height*o.topRatioToImg;return n.globalAlpha=null!=o.opacity?o.opacity:1,n.drawImage(e,l,a,s,r),fo.canvasToImg(i)},fo.pixelsArrayToDataUrl=function(t,e,o,i){void 0===i&&(i=.7);var n=document.createElement("canvas");n.width=e,n.height=o;var s=n.getContext("2d");t=new t.constructor(t);for(var r=4*e,l=0;l<parseInt(o/2);l++){var a=o-l-1,h=t.slice(l*r,l*r+r),c=t.slice(a*r,a*r+r);t.set(c,l*r),t.set(h,a*r)}var u=s.createImageData(e,o);return u.data.set(t),s.putImageData(u,0,0),n.toDataURL(i)},fo.renderTargetToDataUrl=function(t,e,o,i,n){void 0===n&&(n=.7);var s=new Uint8Array(4*(e*o));return i.readRenderTargetPixels(t,0,0,e,o,s),this.pixelsArrayToDataUrl(s,e,o,n)},fo.screenPass=new function(){this.screenScene=new THREE.Scene,this.screenQuad=new THREE.Mesh(new THREE.PlaneBufferGeometry(2,2,1)),this.screenQuad.material.depthTest=!0,this.screenQuad.material.depthWrite=!0,this.screenQuad.material.transparent=!0,this.screenScene.add(this.screenQuad),this.camera=new THREE.Camera,this.render=function(t,e,o){if(this.screenQuad.material=e,void 0===o)t.render(this.screenScene,this.camera);else{var i=t.getRenderTarget();t.setRenderTarget(o),t.clear(),t.render(this.screenScene,this.camera),t.setRenderTarget(i)}}},fo.renderTex=function(t,e,o){var i=new THREE.WebGLRenderTarget(o.x,o.y,{minFilter:THREE.LinearMipmapLinearFilter,generateMipmaps:!0,format:THREE.RGBAFormat});return this.screenPass.render(e,t,i),i.texture},fo.updateVisible=function(t,e,o,i,n){void 0===i&&(i=0),t.unvisibleReasons||(t.unvisibleReasons=[]),t.visibleReasons||(t.visibleReasons=[]);var s;o?((s=t.unvisibleReasons.findIndex((function(t){return t.reason==e})))>-1&&(n="cancel",t.unvisibleReasons.splice(s,1)),"add"==n&&(t.visibleReasons.some((function(t){return t.reason==e}))||t.visibleReasons.push({reason:e,level:i}))):((s=t.visibleReasons.findIndex((function(t){return t.reason==e})))>-1&&(n="cancel",t.visibleReasons.splice(s,1)),"cancel"!=n&&(t.unvisibleReasons.some((function(t){return t.reason==e}))||t.unvisibleReasons.push({reason:e,level:i})));!function(){t.unvisibleReasons=t.unvisibleReasons.sort((function(t,e){return e.level-t.level})),t.visibleReasons=t.visibleReasons.sort((function(t,e){return e.level-t.level}));var o=(t.visibleReasons[0]?t.visibleReasons[0].level:-1)>=(t.unvisibleReasons[0]?t.unvisibleReasons[0].level:-1);t.visible!=o&&(t.visible=o,t.dispatchEvent({type:"isVisible",visible:o,reason:e}))}()},fo.getObjVisiByReason=function(t,e){return!!t.visible||(!t.unvisibleReasons||!t.unvisibleReasons.some((function(t){return t.reason==e})))},fo.setCameraLayers=function(t,e,o){void 0===o&&(o=[]),t.layers.disableAll(),e.concat(o).forEach((function(e){var o=Potree.config.renderLayers[e];null!=o?t.layers.enable(o):console.error("setCameraLayer没找到layer!")}))},fo.setObjectLayers=function(t,e){var o=Potree.config.renderLayers[e];null!=o?t.traverse((function(t){t.layers.set(o)})):console.error("setCameraLayer没找到layer!")},fo.intervalTool={list:[],isWaiting:function(t,e,o){var i=this,n=this.list.find((function(e){return e.name==t}));if(n)n.requestUpdate=!0;else{var s=e();n={name:t},this.list.push(n),setTimeout((function(){var r=i.list.indexOf(n);i.list.splice(r,1),(n.requestUpdate||s)&&i.isWaiting(t,e,o)}),o)}}},fo.batchHandling={lists:[],getSlice:function(t,e,o){var i=o.stopWhenAllUsed,n=o.minCount;void 0===n&&(n=5);var s=o.maxCount;void 0===s&&(s=100);var r=o.durBound1,l=o.durBound2,a=o.maxUseCount;if(0==e.length||!(a=null==a?fo.getBestCount({name:t,minCount:n,maxCount:s,durBound1:r,durBound2:l,ifLog:!1}):a))return{list:[]};this.lists[t]||(this.lists[t]={list:[]});var h=this.lists[t].list.filter((function(t){return e.some((function(e){return t.item==e}))}));this.lists[t].list=h,e.forEach((function(t){h.some((function(e){return e.item==t}))||h.push({item:t,count:0})}));var c=h.filter((function(t){return 0==t.count})),u=[];if(c.slice(0,a).forEach((function(t){u.push(t.item),t.count++})),c.length>a);else{if(!i){var d=Math.min(e.length,a)-u.length;h.slice(0,d).forEach((function(t){u.push(t.item),t.count++}))}h.forEach((function(t){return t.count--}))}return{list:u}},addSliceListen:function(t){var e=t.getList,o=t.callback,i=t.minCount,n=t.maxCount;t.durBound1,t.durBound2,t.maxHistory;var s,r,l=t.player;l.on("update",(function(t){if(!l.flying){var a,h=e(),c=!l.lastFrameChanged,u=l.lastFrameChanged||!r;u?(a=h,s=null):(s||(s=fo.getDifferenceSet(h,r)),a=s);var d=fo.batchHandling.getSlice("ifVideoInsight",a,{stopWhenAllUsed:c,minCount:i,maxCount:n,durBound1:3,durBound2:13,maxHistory:3}).list;d.forEach(o),u||(s=fo.getDifferenceSet(s,d)),r=d}}))}},fo.getBestCount=(vo={},function(t){var e=t.name,o=t.minCount;void 0===o&&(o=1);var i=t.maxCount;void 0===i&&(i=6);var n=t.durBound1;void 0===n&&(n=1);var s=t.durBound2;void 0===s&&(s=4);var r,l=t.ifLog,a=t.maxHistory,h=performance.getEntriesByName("loop-start");if(h.length){var c=performance.now()-h[h.length-1].startTime;r=Math.round(math.linearClamp(c,n,s,i,o)),a&&(vo[e]||(vo[e]=[]),0==r&&vo[e].length>a-1&&!vo[e].some((function(t){return t>0}))&&(r=1),vo[e].push(r),vo[e].length>a&&vo[e].splice(0,1)),l&&console.log(e,r," ,dur:",c.toFixed(3))}else r=i;return r}),fo.getPos2d=function(t,e,o,i){o=o||e.camera,i=i||e.domElement;var n,s,r=t.clone().project(o);n=(r.x+1)/2*i.clientWidth,s=(1-(r.y+1)/2)*i.clientHeight;var l=n<=i.clientWidth&&n>=0&&s<=i.clientHeight&&s>=0;return{pos:new THREE.Vector2(n,s),vector:r,trueSide:r.z<1,inSight:l}},fo.realVisible=function(t){for(var e,o=!0,i=t;i;){if(!1===i.visible){o=!1;break}e=i,i=i.parent}return!o||e instanceof THREE.Scene||(o=!1),o};var So=function(t){this.layer=t,this.showTexture=!0},Po={selectUI:{configurable:!0},currentUI:{configurable:!0},currentFloor:{configurable:!0},currentUnit:{configurable:!0}};Po.selectUI.get=function(){return this.layer.$xui.selectName},Po.selectUI.set=function(t){this.layer.$xui.selectName=t,this.layer.updateEventNameForSelectUI()},Po.currentUI.get=function(){return this.layer.$xui.currentName},Po.currentUI.set=function(t){null===t?this.layer.$xui.hideProps():this.layer.$xui.showProps(t)},Po.currentFloor.get=function(){return this.layer.$xui.currentFloor},Po.currentFloor.set=function(t){this.layer.display&&("image"==this.layer.app.store.getValue("flooruser").type?he.setCurrentFloor(t):(he.setCurrentFloor(t),this.layer.initPanos(he.currentFloor),de.update(!1),Ye.clearHistoryRecord(),this.layer.$xui.toolbar.recall=!1,this.layer.$xui.toolbar.recover=!1,this.layer.history.init(),setTimeout(function(){this.layer.renderer.autoRedraw()}.bind(this),50)))},Po.currentUnit.get=function(){return this.layer.$xui.currentUnit},Po.currentUnit.set=function(t){this.layer.uiControl.currentUI=null,de.unit=t,Se.convertUnit(t),this.layer.history.save(),this.layer.renderer.autoRedraw()},So.prototype.setAttributes=function(t,e,o){console.log(e);var i=ee.getFocusItem();switch(e){case"remove":if(t==y||"OutWall"==t)he.deleteWall(i.vectorId);else if(se.isSymbol(t))se.deleteSymbol(i.vectorId);else if(xt.isComponent(t))he.deleteComponent(i.vectorId);else if(t==T){he.deleteTag(i.vectorId);var n=ee.getDraggingItem();n&&n.vectorId!=i.vectorId&&he.deleteTag(n.vectorId)}else t==d?ct.deleteWallCorner(i.vectorId):Qt.isFurniture(t)&&he.deleteFurniture(i.vectorId);ee.clearItems(),ee.clearEventName(),this.layer.renderer.autoRedraw();break;case"rotate":if(se.isSymbol(t)){var s=he.getSymbol(i.vectorId);if(t==p){if(s.openSide==K)if(c.isClockwise(s.points2d))s.openSide=q;else{var r=s.endPoint;s.endPoint=s.startPoint,s.startPoint=r,s.openSide=q}else if(s.openSide==q)if(c.isClockwise(s.points2d))s.openSide=K;else{var l=s.endPoint;s.endPoint=s.startPoint,s.startPoint=l,s.openSide=K}}else if(t==g||t==x||t==m)s.openSide==K?s.openSide=q:s.openSide==q&&(s.openSide=K);else{var a=s.endPoint;s.endPoint=s.startPoint,s.startPoint=a}s.setPoints2d(),this.layer.renderer.autoRedraw()}break;case"angle":if(xt.isComponent(t)){var h=he.getComponent(i.vectorId);h.angle=o,h.setPoints2d(),this.layer.renderer.autoRedraw()}else if(Qt.isFurniture(t)){he.getFurniture(i.vectorId).angle=o,this.layer.renderer.autoRedraw()}break;case"width":if(se.isSymbol(t)){if(se.updateSymbolForLen(i.vectorId,o).block){var u=he.getSymbol(i.vectorId);console.log("长度阻止:"+c.getDistance(u.startPoint,u.endPoint)),this.layer.$xui.currentAttributes={limit:c.getDistance(u.startPoint,u.endPoint),type:i.type,name:"width",width:c.getDistance(u.startPoint,u.endPoint),thickness:u.thickness}}}else if(xt.isComponent(t)){var f=he.getComponent(i.vectorId);f.sideWidth=o,f.setPoints2d()}this.layer.renderer.autoRedraw();break;case"scale":if(Qt.isFurniture(t))he.getFurniture(i.vectorId).zoom=o,this.layer.renderer.autoRedraw();break;case"thickness":if(xt.isComponent(t)){var v=he.getComponent(i.vectorId);v.sideThickness=o,v.setPoints2d(),this.layer.renderer.autoRedraw()}else if(t==m){var S=he.getSymbol(i.vectorId);S.thickness=o,S.setPoints2d(),this.layer.renderer.autoRedraw()}break;case"split":if(t==y||"OutWall"==t){var P=he.getWall(i.vectorId),b=he.getPoint(P.start),I=he.getPoint(P.end),k={x:(b.x+I.x)/2,y:(b.y+I.y)/2},F=ct.createPoint(k.x,k.y),w=ct.splitWall(i.vectorId,F.vectorId,"start");P=he.getWall(i.vectorId),b=he.getPoint(P.start),I=he.getPoint(P.end);var C={x:(b.x+I.x)/2,y:(b.y+I.y)/2},W={vectorId:w,type:t};(k.x<C.x||k.x==C.x&&k.y>C.y)&&ee.setFocusItem(W),this.layer.renderer.autoRedraw()}break;case"tag":if(t==T){var D=he.getTag(i.vectorId);null!=o&&""!=o.trim()?D.setTitle(o):D.setTitle(KanKan.Config.i18n("cad.input")),this.layer.renderer.autoRedraw()}break;case"area":if(t==T){var z=he.getTag(i.vectorId);z.setDes(o),z.setUnit(de.unit),this.layer.renderer.autoRedraw()}break;case"default":if("compass"==t)return void he.setCompass(0);if(se.isSymbol(t)){var L=se.getDefaultSymbolLen(t),M=se.updateSymbolForLen(i.vectorId,L);he.getSymbol(i.vectorId).enter=null,M.block||(this.layer.$xui.currentAttributes={type:i.type,name:"width",width:c.getFixed(c.getDistance(M.start,M.end),2)})}else if(xt.isComponent(t)){var R=he.getComponent(i.vectorId);R.sideWidth=xt.sideWidth,R.sideThickness=xt.sideThickness,R.angle=0,R.setPoints2d(),this.layer.$xui.currentAttributes={name:i.type,width:c.getFixed(R.sideWidth,2),thickness:c.getFixed(R.sideThickness,2),angle:0}}this.layer.renderer.autoRedraw();break;case"enter":if(t==p||t==x||t==g){var O=he.getSymbol(i.vectorId);O.enter=o?"default":null,this.layer.renderer.autoRedraw()}break;case"enterRotate":if(t==p||t==x||t==g){var A=he.getSymbol(i.vectorId);null==A.enter?A.enter="default":"default"==A.enter?A.enter="reverse":"reverse"==A.enter&&(A.enter="default")}this.layer.renderer.autoRedraw();break;case"important":if(t==y)he.getWall(i.vectorId).setImportant(o),this.layer.renderer.autoRedraw();break;case"wallType":if(t==y){var E=he.getWall(i.vectorId);"OutWall"==o?E.setOut(!0):E.setOut(!1),this.layer.renderer.autoRedraw()}break;case"compass":he.setCompass(parseFloat(o))}},So.prototype.saveAttributes=function(t,e){"compass"==e||"compass"==t&&"default"==e||this.layer.history.save()},So.prototype.showAttributes=function(t){if("compass"!=t){var e=ee.getFocusItem();if(null==e&&(e=ee.getDraggingItem()),se.isSymbol(e.type)){var o=he.getSymbol(e.vectorId),i=c.getDistance(o.startPoint,o.endPoint);i=c.getFixed(i,2),e.type==p||e.type==x||e.type==g?this.layer.$xui.currentAttributes={name:e.type,width:i,enter:o.enter?o.enter:null}:e.type==m?this.layer.$xui.currentAttributes={name:e.type,width:i,thickness:c.getFixed(o.thickness,2)}:this.layer.$xui.currentAttributes={name:e.type,width:i}}else if(xt.isComponent(e.type)){var n=he.getComponent(e.vectorId),s=n.sideWidth,r=n.sideThickness;this.layer.$xui.currentAttributes={name:e.type,width:c.getFixed(s,2),thickness:c.getFixed(r,2),angle:n.angle}}else if(e.type==T){var l=he.getTag(e.vectorId);this.layer.$xui.currentAttributes={name:e.type,tag:l.title,area:l.des}}else if(e.type==y){var a=he.getWall(e.vectorId);this.layer.$xui.currentAttributes={name:a.out?"OutWall":e.type,important:a.important||a.out,wallType:a.out?"OutWall":e.type}}else if(Qt.isFurniture(e.type)){var h=he.getFurniture(e.vectorId),u=h.zoom;this.layer.$xui.currentAttributes={name:e.type,scale:u,angle:h.angle}}}else this.layer.$xui.currentAttributes={name:"compass",compass:he.getCompass()}},So.prototype.clearUI=function(){this.selectUI=null},So.prototype.getSymbolTypeForUI=function(){return this.selectUI==vt?p:this.selectUI==St?x:this.selectUI==Pt?g:this.selectUI==bt?f:this.selectUI==It?m:this.selectUI==kt?v:this.selectUI==Tt?S:void 0},So.prototype.getComponentTypeForUI=function(){return this.selectUI==Ft?P:this.selectUI==wt?b:this.selectUI==Ct?I:void 0},So.prototype.getFurnitureTypeForUI=function(){return this.selectUI==Dt?F:this.selectUI==zt?w:this.selectUI==Lt?C:this.selectUI==Mt?W:this.selectUI==Rt?D:this.selectUI==Ot?z:this.selectUI==At?L:this.selectUI==Et?M:this.selectUI==Bt?R:this.selectUI==_t?O:this.selectUI==Yt?A:this.selectUI==Nt?E:this.selectUI==Xt?B:this.selectUI==jt?_:this.selectUI==Ut?Y:this.selectUI==Jt?N:this.selectUI==Vt?X:this.selectUI==Ht?j:this.selectUI==$t?U:this.selectUI==Zt?J:this.selectUI==Gt?V:void 0},So.prototype.screenShot=function(t){var e=this;return new Promise((function(o){e.menu_flex(),ee.clearItems(),ho.start();var i=e.layer.canvas;le.setRadio(a.ratio),i.width=window.innerWidth*le.ratio,i.height=window.innerHeight*le.ratio,le.width=window.innerWidth,le.height=window.innerHeight;var n=e.layer.app.core.get("CameraControls").activeControl.camera;le.res=Math.min(window.innerWidth/Math.abs(n.right-n.left),window.innerHeight/Math.abs(n.top-n.bottom)),setTimeout(function(){var e=this;if(1==he.getFloorNum())de.update(!0),this.layer.renderer.autoRedrawForDownLoadImg(t),this.downloadCadImg(i,"floorPlan.jpg");else{var s=he.getCurrentFloor();xo.save(le.res,le.center,le.defaultCenter,s),this.layer.app.store.getValue("flooruser").floors.forEach((function(o,n){e.currentFloor=o.subgroup,xo.setTransform(o.subgroup),de.update(!0),e.layer.renderer.autoRedrawForDownLoadImg(t),fo.canvasToImg(i,3,!0,"image/jpeg",o.name+".jpg")})),this.currentFloor=s,xo.recover()}le.updateForCanvas(i),le.setRes(n.left,n.right),le.ratio=1,de.updateRegion(!0),de.update(!1),this.layer.renderer.autoRedraw(),o()}.bind(e),100)}))},So.prototype.downloadPanosImg=function(){var t=this;return new Promise((function(e){var o=__sdk.core.get("Player"),i=go("panoImgcolor",!0)?"#"+go("panoImgcolor",!0):"#fff",n=o.domElement.clientWidth,s=o.domElement.clientHeight,r=t.layer.app.store.getValue("metadata").floorPlanAngle;r=parseFloat(r);var l=o.model.size.clone().applyEuler(new THREE.Euler(0,r,0));l.x=Math.abs(l.x),l.z=Math.abs(l.z),s=Math.round(l.z/l.x*n),o.domElement.clientHeight,o.cameraControls.controls.floorplan.screenshot=!0,o.flyToMode("floorplan",(function(){o.domElement.style.height=s+"px",o.domElement.style.transformOrigin="top",o.$app.core.get("SceneRenderer").updateScreenSize();o.floorplanMode(null,null,null,1.2),o.updateFromControls();var t=Math.max(n,s);n=Math.round(1024/t*n),s=Math.round(1024/t*s);for(var r,a=1/0,h=o.model.currentFloor.panos.filter((function(t){return t.isAligned()})),c=0,u=h.length;c<u;c++)for(var d=c+1;d<u;d++){var y=h[c].position.clone().setY(0).distanceTo(h[d].position.clone().setY(0));y<a&&y>.001&&(a=y,r=[h[c].id,h[d].id])}r&&console.log("最小距离:"+a+", panos: "+r[0]+", "+r[1]);var p=35*Math.max(l.x,l.z)/a*1.2;p>Math.max(n,s)&&(p=Math.min(8192,Math.round(p)),console.log(p),n>s?(s=Math.round(s/n*p),n=p):(n=Math.round(n/s*p),s=p)),o.$app.Camera.screenshot([{width:n,height:s}],!1).done((function(t){var r=document.createElement("canvas");r.width=n,r.height=s;var l=r.getContext("2d"),a=new Image;a.src=t[0].data,a.onload=function(){l.drawImage(a,0,0),l.font="14px sans-serif",l.fillStyle=i,l.shadowColor="rgba(0, 0, 0, 1)",l.shadowOffsetX=1,l.shadowOffsetY=1,l.shadowBlur=2,l.strokeStyle=i,l.lineWidth="2",l.textAlign="center",l.textBaseline="middle",t.o.camera.projectionMatrix.elements[5]=-t.o.camera.projectionMatrix.elements[5],h.forEach((function(e){var i=fo.getPos2d(e.position,o,t.o.camera),r=(i.vector.x+1)/2*n,a=(1-(i.vector.y+1)/2)*s;l.fillText(e.id+"",r,a-10),l.beginPath(),l.arc(r,a,1,0,2*Math.PI),l.stroke()})),fo.canvasToImg(r,.9,!0,"image/jpeg","点位图.jpg"),e()},o.domElement.style.height="",o.domElement.style.transform="",o.domElement.style.transformOrigin="",o.$app.core.get("SceneRenderer").updateScreenSize(),o.floorplanMode(),o.cameraControls.controls.floorplan.screenshot=!1}))}))}))},So.prototype.downloadCadImg=function(t,e){var o=t.toDataURL("jpg",3);o=o.replace(this._fixType("jpg"),"image/octet-stream"),this.saveFile(o,e)},So.prototype.saveFile=function(t,e){var o=document.createElementNS("http://www.w3.org/1999/xhtml","a");o.href=t,o.download=e;var i=document.createEvent("MouseEvents");i.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),o.dispatchEvent(i)},So.prototype._fixType=function(t){return"image/"+(t=t.toLowerCase().replace(/jpg/i,"jpeg")).match(/png|jpeg|bmp|gif/)[0]},So.prototype.execute=function(t,e){var o=this;switch(ee.clearFocusItem(),ee.clearSelectItem(),this.layer.uiControl.currentUI=null,t){case"recall":this.menu_revoke();break;case"recover":this.menu_recovery();break;case"default":this.menu_default();break;case"download":this.layer.div.style.visibility="hidden",this.menu_screenShot(e).then((function(){o.layer.div.style.visibility="visible"}));break;case"texture":this.showTexture=e,this.layer.app.dom.querySelector('.player[name="main"]').style.visibility=this.showTexture?"visible":"hidden";break;case"clear":this.menu_clear();break;case"panos":this.menu_panos(e);break;case"rotate":this.menu_rotate();break;case"flex":this.menu_flex()}},So.prototype.menu_revoke=function(){this.layer.stopAddVector(),this.layer.revokeHistory()},So.prototype.menu_recovery=function(){this.layer.recoveryHistory()},So.prototype.menu_default=function(){var t=this;Ye.clearHistoryRecord();var e=he.angle;he.setAngle(0),this.layer.app.store.getValue("metadata").floorPlanUser=0,this.layer.app.store.getValue("metadata").floorPlanAngle=0,this.menu_flex(!0);var o=le.getScreenInfoForCAD();if(0!=e){o.floorPlanAngle=0,this.layer.app.store.getValue("metadata").floorPlanAngle=0,this.layer.app.core.get("CameraControls").emit("syncCadAnd3DForRotate",o);var i=this.layer.app.core.get("CameraControls").activeControl.camera;le.setRes(i.left,i.right)}var n=he.getCurrentFloor();this.layer.load.loadFloorJson(!0).then((function(){t.layer.app.core.get("Player").model.floorplanCadImg.updateAllCadPlanes(),t.layer.app.core.get("Player").model.floorplanCadImg.changeModelOpacity(1),he.setCurrentFloor(n),t.layer.render(),t.layer.app.MinMap.reload(),t.layer.app.core.get("Player").labelManager.reset()}))},So.prototype.menu_screenShot=function(t){return this.layer.stopAddVector(),this.screenShot(t)},So.prototype.menu_clear=function(t){he.clear(t),ee.clearEventName(),uo.clear(),Be.hideAll(),this.layer.history.save(),this.layer.renderer.autoRedraw()},So.prototype.menu_panos=function(t){this.layer.renderer.displayPanos=t,this.layer.renderer.autoRedraw()},So.prototype.menu_rotate=function(){le.reSet();var t=he.getAngle();t=parseFloat(t)+Math.PI/2,Math.abs(t-2*Math.PI)<.1&&(t=0),t%=360,he.setAngle(t);var e=le.getScreenInfoForCAD();e.floorPlanAngle=t,this.layer.app.store.getValue("metadata").floorPlanAngle=t,this.layer.app.core.get("CameraControls").emit("syncCadAnd3DForRotate",e);var o=this.layer.app.core.get("CameraControls").activeControl.camera;le.setRes(o.left,o.right),le.updateForRotate(),this.layer.initPanos(he.getCurrentFloor()),de.update(!1),this.layer.history.save(),this.layer.renderer.autoRedraw()},So.prototype.menu_flex=function(t){if(le.center){le.reSet(),this.layer.renderer.autoRedraw();var e=le.getScreenInfoForCAD();if(e.floorPlanAngle=he.getAngle(),this.layer.app.core.get("CameraControls").emit("syncCadAnd3D",e),t){var o=this.layer.app.core.get("CameraControls").activeControl.camera;le.setRes(o.left,o.right)}}},Object.defineProperties(So.prototype,Po);var bo={strokeStyle:"#FFFFFF",lineWidth:4,lineWidth_out:8,important:{strokeStyle:"#FFFFFF",lineWidth:8},error:{strokeStyle:"rgba(255,0,0,0.5)",fillStyle:"rgba(255,0,0,0.8)"}},Io={strokeStyle:"green",fillStyle:"rgb(0, 200, 175)",radius:4},ko={strokeStyle:"rgba(255,255,255,1)",fillStyle:"rgba(255,255,255,0)",lineWidth:1,Pass:{}},To={strokeStyle:"rgba(255,255,255,1)",fillStyle:"rgba(255,255,255,0)",lineWidth:1},Fo={strokeStyle:"rgb(255,255,255,1)",fillStyle:"rgb(255,255,255,1)",strokeStyle_adding:"rgba(243, 255, 0, 0.8)",fillStyle_adding:"rgba(243, 255, 0, 0.8)",lineWidth:1},wo={strokeStyle:"rgb(255,255,255,1)",fillStyle:"rgba(0,0,0,0)",lineWidth:1},Co={Wall:{strokeStyle:"rgba(243, 255, 0, 1)"},Wall_out:{strokeStyle:"rgba(243, 255, 0, 1)"},Symbol:{strokeStyle:"rgba(243, 255, 0, 0.8)",fillStyle:"rgba(243, 255, 0, 0.5)",lineWidth:2},Component:{strokeStyle:"rgba(243, 255, 0, 0.8)",fillStyle:"rgba(243, 255, 0, 0.5)"},Tag:{strokeStyle:"#00C8AF",fillStyle:"#00C8AF"},Furniture:{strokeStyle:"rgba(243, 255, 0, 0.8)",fillStyle:"rgba(243, 255, 0, 0.5)"},Point:{radius:4,lineWidth:2,fillStyle:"rgba(245, 255, 0, 1)",strokeStyle:"rgba(245, 255, 255, 1)"}},Wo={Wall:{strokeStyle:"rgba(243, 255, 0, 1)"},Wall_out:{strokeStyle:"rgba(162, 164, 124, 1)"},Symbol:{strokeStyle:"rgba(243, 255, 0, 0.8)",fillStyle:"rgba(243, 255, 0, 0.5)"},Component:{strokeStyle:"rgba(243, 255, 0, 0.8)",fillStyle:"rgba(243, 255, 0, 0.5)"},Tag:{strokeStyle:"#00C8AF",fillStyle:"#00C8AF"},Furniture:{strokeStyle:"rgba(243, 255, 0, 0.8)",fillStyle:"rgba(243, 255, 0, 0.5)"},Point:{radius:4,lineWidth:2,fillStyle:"rgba(245, 255, 0, 1)",strokeStyle:"rgba(245, 255, 255, 1)"}},Do={StartAddWall:{radius:4,fillStyle:"yellow",strokeStyle:"green"},NewWall:{lineWidth:4,lineWidth_out:6,strokeStyle:"rgba(255,255,255,0.3)",strokeStyle_out:"rgba(102,102,102,0.3)",errorStrokeStyle:"rgb(250,63,72,0.3)"},StartSymbolPoints:{radius:4,fillStyle:"yellow",strokeStyle:"green"},EndSymbolPoints:{radius:4,fillStyle:"yellow",strokeStyle:"green"},CheckLinesX:{lineWidth:2,strokeStyle:"#CED806"},CheckLinesY:{lineWidth:2,strokeStyle:"#CED806"},VCheckLinesX:{lineWidth:2,strokeStyle:"#CED806"},VCheckLinesY:{lineWidth:2,strokeStyle:"#CED806"},SignLine1:{lineWidth:2,strokeStyle:"blue"},SignLine2:{lineWidth:2,strokeStyle:"green"}},zo={font:"14px Microsoft YaHei",fillStyle:"#FFFFFF",strokeStyle:"#FFFFFF",textAlign:"center",textBaseline:"middle",miterLimit:10,direction:"ltr"},Lo={radius:10,lineWidth:2,strokeStyle:"rgba(255,255,255,0.4)",fillStyle:"rgba(255,255,255,0.1)"},Mo={txt:"rgba(255,255,255,1)",strokeStyle:"rgba(255,255,255,1)",lineWidth:1},Ro={style1:{Wall:{strokeStyle:"#666666",lineWidth:4,lineWidth_out:6,important:{strokeStyle:"#666666",lineWidth:6}},Symbol:{strokeStyle:"#666666",lineWidth:1},Component:{strokeStyle:"#666666",fillStyle:"#666666",lineWidth:1},Tag:{strokeStyle:"#000000",fillStyle:"#000000",lineWidth:1},Font:{font:"14px Microsoft YaHei",fillStyle:"#000000",strokeStyle:"#000000",textAlign:"center",textBaseline:"middle",miterLimit:10,direction:"ltr"},Measure:{strokeStyle:"#CCCCCC",lineWidth:1},Furniture:{strokeStyle:"#666666",fillStyle:"#666666"}},style2:{Wall:{strokeStyle:"#FFFFFF",lineWidth:4,lineWidth_out:6,important:{strokeStyle:"#FFFFFF",lineWidth:6}},Symbol:{strokeStyle:"#FFFFFF",lineWidth:1},Component:{strokeStyle:"#FFFFFF",fillStyle:"#FFFFFF",lineWidth:1},Tag:{strokeStyle:"#FFFFFF",fillStyle:"#FFFFFF",lineWidth:1},Font:{font:"14px Microsoft YaHei",fillStyle:"#FFFFFF",strokeStyle:"#FFFFFF",textAlign:"center",textBaseline:"middle",miterLimit:10,direction:"ltr"},Measure:{strokeStyle:"#FFFFFF",lineWidth:1},Furniture:{strokeStyle:"#FFFFFF",fillStyle:"#FFFFFF"}},style3:{Wall:{strokeStyle:"#666666",lineWidth:4,lineWidth_out:6,important:{strokeStyle:"#666666",lineWidth:6}},Symbol:{strokeStyle:"#666666",lineWidth:1},Component:{strokeStyle:"#666666",fillStyle:"#666666",lineWidth:1},Tag:{strokeStyle:"#000000",fillStyle:"#000000",strokeStyle_adding:"rgba(243, 255, 0, 0.8)",fillStyle_adding:"rgba(243, 255, 0, 0.8)",lineWidth:1},Font:{font:"14px Microsoft YaHei",fillStyle:"#000000",strokeStyle:"#000000",textAlign:"center",textBaseline:"middle",miterLimit:10,direction:"ltr"},Measure:{strokeStyle:"#CCCCCC",lineWidth:2},Furniture:{strokeStyle:"#666666",fillStyle:"#666666"}},style4:{Wall:{strokeStyle:"#FFFFFF",lineWidth:4,lineWidth_out:6,important:{strokeStyle:"#FFFFFF",lineWidth:6}},Symbol:{strokeStyle:"#FFFFFF",lineWidth:1},Component:{strokeStyle:"#FFFFFF",fillStyle:"#FFFFFF",lineWidth:1},Tag:{strokeStyle:"#FFFFFF",fillStyle:"#FFFFFF",lineWidth:1},Font:{font:"14px Microsoft YaHei",fillStyle:"#FFFFFF",strokeStyle:"#FFFFFF",textAlign:"center",textBaseline:"middle",miterLimit:10,direction:"ltr"},Measure:{strokeStyle:"#FFFFFF",lineWidth:1},Furniture:{strokeStyle:"#FFFFFF",fillStyle:"#FFFFFF"}}},Oo=function(){this.whiteImg=null,this.blackImg=null};Oo.prototype.setWhiteImg=function(t){this.whiteImg=t},Oo.prototype.setBlackImg=function(t){this.blackImg=t},Oo.prototype.getWhiteImg=function(){return this.whiteImg},Oo.prototype.getBlackImg=function(){return this.blackImg};var Ao=new Oo,Eo=function(){this.context=null};Eo.prototype.initContext=function(t){this.context=t?t.getContext("2d"):null},Eo.prototype.clear=function(){this.context.clearRect(0,0,this.context.canvas.width,this.context.canvas.height)},Eo.prototype.drawBackGround=function(t){this.context.save(),this.context.fillStyle=t,this.context.fillRect(0,0,this.context.canvas.width,this.context.canvas.height),this.context.restore()},Eo.prototype.drawWall=function(t,e){var o=he.getPoint(t.start),i=he.getPoint(t.end),n=[];n.push(o);for(var s=0;s<t.children.length;++s){var r=he.getSymbol(t.children[s]);n.push(r.startPoint),n.push(r.endPoint)}n.push(i),n=n.sort(function(t,e){return c.getDistance(o,t)-c.getDistance(o,e)}.bind(this)),this.context.save(),this.context.beginPath(),this.context.lineCap="round",this.context.strokeStyle=bo.strokeStyle,t.out||t.important?(this.context.lineWidth=bo.important.lineWidth*le.ratio,this.context.strokeStyle=bo.important.strokeStyle):(this.context.lineWidth=bo.lineWidth*le.ratio,this.context.strokeStyle=bo.strokeStyle);var l=ee.getSelectItem(),a=ee.getDraggingItem(),h=ee.getFocusItem();e?"style-1"==e?t.out||t.important?(this.context.lineWidth=Ro.style1.Wall.important.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Wall.important.strokeStyle):(this.context.lineWidth=Ro.style1.Wall.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Wall.strokeStyle):"style-2"==e?t.out||t.important?(this.context.lineWidth=Ro.style2.Wall.important.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Wall.important.strokeStyle):(this.context.lineWidth=Ro.style2.Wall.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Wall.strokeStyle):"style-3"==e?t.out||t.important?(this.context.lineWidth=Ro.style3.Wall.important.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Wall.important.strokeStyle):(this.context.lineWidth=Ro.style3.Wall.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Wall.strokeStyle):"style-4"==e&&(t.out||t.important?(this.context.lineWidth=Ro.style4.Wall.important.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Wall.important.strokeStyle):(this.context.lineWidth=Ro.style4.Wall.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Wall.strokeStyle)):(l&&l.type==y?t.vectorId==l.vectorId&&(t.out||t.important?this.context.strokeStyle=Co.Wall_out.strokeStyle:this.context.strokeStyle=Co.Wall.strokeStyle):a&&a.type==y&&t.vectorId==a.vectorId&&(t.out||t.important?this.context.strokeStyle=Co.Wall_out.strokeStyle:this.context.strokeStyle=Co.Wall.strokeStyle),h&&h.type==y&&t.vectorId==h.vectorId&&(this.context.strokeStyle=Wo.Wall.strokeStyle));for(var u=0;u<n.length-1;u+=2){var d=le.getScreenXY(n[u]),p=le.getScreenXY(n[u+1]);this.context.moveTo(d.x,d.y),this.context.lineTo(p.x,p.y)}this.context.stroke(),this.context.restore(),(l&&l.type==y&&t.vectorId==l.vectorId||a&&a.type==y&&t.vectorId==a.vectorId||h&&h.type==y&&t.vectorId==h.vectorId)&&this.drawMeasureTxt(o,i)},Eo.prototype.drawSpecialPoint=function(){var t=ee.getSelectItem(),e=ee.getDraggingItem(),o=ee.getFocusItem(),i=null;if(this.context.save(),t&&(i=he.getPoint(t.vectorId),this.context.lineWidth=Co.Point.lineWidth*le.ratio,this.context.strokeStyle=Co.Point.strokeStyle,this.context.fillStyle=Co.Point.fillStyle),e&&(i=he.getPoint(e.vectorId),this.context.lineWidth=Co.Point.lineWidth*le.ratio,this.context.strokeStyle=Co.Point.strokeStyle,this.context.fillStyle=Co.Point.fillStyle),o&&(i=he.getPoint(o.vectorId),this.context.lineWidth=Wo.Point.lineWidth*le.ratio,this.context.strokeStyle=Wo.Point.strokeStyle,this.context.fillStyle=Wo.Point.fillStyle),null!=i){var n=le.getScreenXY({x:i.x,y:i.y}),s=Io.radius;this.context.beginPath(),this.context.arc(n.x,n.y,s*le.ratio,0,2*Math.PI,!0),this.context.stroke(),this.context.fill(),this.context.restore()}else this.context.restore()},Eo.prototype.drawPoint=function(t){var e=le.getScreenXY({x:t.x,y:t.y}),o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem(),s=Io.radius;if(i&&i.type==d&&t.vectorId==i.vectorId||o&&o.type==d&&t.vectorId==o.vectorId)this.context.save(),this.context.lineWidth=Co.Point.lineWidth*le.ratio,this.context.strokeStyle=Co.Point.strokeStyle,this.context.fillStyle=Co.Point.fillStyle,s=Co.Point.radius;else{if(!n||n.type!=d||t.vectorId!=n.vectorId)return;this.context.save(),this.context.lineWidth=Wo.Point.lineWidth*le.ratio,this.context.strokeStyle=Wo.Point.strokeStyle,this.context.fillStyle=Wo.Point.fillStyle,s=Wo.Point.radius}this.context.beginPath(),this.context.arc(e.x,e.y,s*le.ratio,0,2*Math.PI,!0),this.context.stroke(),this.context.fill(),this.context.restore()},Eo.prototype.drawSelectSymbolPoint=function(){var t=ee.getSelectItem(),e=ee.getDraggingItem(),o=ee.getFocusItem(),i=null,n=null,s=null;this.context.save(),t&&t.selectIndex&&t.selectIndex!=H&&se.isSymbol(t.type)?(i=he.getSymbol(t.vectorId),t.selectIndex==$?n=le.getScreenXY({x:i.startPoint.x,y:i.startPoint.y}):t.selectIndex==Z&&(n=le.getScreenXY({x:i.endPoint.x,y:i.endPoint.y})),this.context.lineWidth=Co.Point.lineWidth*le.ratio,this.context.strokeStyle=Co.Point.strokeStyle,this.context.fillStyle=Co.Point.fillStyle,s=Co.Point.radius):e&&e.selectIndex&&e.selectIndex!=H&&se.isSymbol(e.type)&&(i=he.getSymbol(e.vectorId),e.selectIndex==$?n=le.getScreenXY({x:i.startPoint.x,y:i.startPoint.y}):e.selectIndex==Z&&(n=le.getScreenXY({x:i.endPoint.x,y:i.endPoint.y})),this.context.lineWidth=Co.Point.lineWidth*le.ratio,this.context.strokeStyle=Co.Point.strokeStyle,this.context.fillStyle=Co.Point.fillStyle,s=Co.Point.radius),o&&o.selectIndex&&o.selectIndex!=H&&se.isSymbol(o.type)&&(i=he.getSymbol(o.vectorId),o.selectIndex==$?n=le.getScreenXY({x:i.startPoint.x,y:i.startPoint.y}):o.selectIndex==Z&&(n=le.getScreenXY({x:i.endPoint.x,y:i.endPoint.y})),this.context.lineWidth=Wo.Point.lineWidth*le.ratio,this.context.strokeStyle=Wo.Point.strokeStyle,this.context.fillStyle=Wo.Point.fillStyle,s=Wo.Point.radius),null!=n&&null!=s&&(this.context.beginPath(),this.context.arc(n.x,n.y,s*le.ratio,0,2*Math.PI,!0),this.context.stroke(),this.context.fill()),this.context.restore()},Eo.prototype.drawSymbolPoint=function(t){var e=le.getScreenXY({x:t.startPoint.x,y:t.startPoint.y}),o=le.getScreenXY({x:t.endPoint.x,y:t.endPoint.y}),i=Io.radius;this.context.save(),this.context.lineWidth=Io.lineWidth*le.ratio,this.context.strokeStyle=Io.strokeStyle,this.context.fillStyle=Io.fillStyle,this.context.beginPath(),this.context.arc(e.x,e.y,i*le.ratio,0,2*Math.PI,!0),this.context.stroke(),this.context.fill(),this.context.beginPath(),this.context.arc(o.x,o.y,i*le.ratio,0,2*Math.PI,!0),this.context.stroke(),this.context.fill(),this.context.restore()},Eo.prototype.drawText=function(t,e,o,i){this.context.save(),this.setCanvasStyle(zo),le.ratio==a.ratio?this.context.font="36px Microsoft YaHei":this.context.font="12px Microsoft YaHei";var n={x:t.x,y:t.y};o||(n=le.getScreenXY({x:t.x,y:t.y})),i?(this.context.translate(n.x,n.y),this.context.rotate(i),this.context.fillText(e,0,0)):this.context.fillText(e,n.x,n.y),this.context.restore()},Eo.prototype.drawSingleDoor=function(t,e,o){for(var i=t.points2d,n=[],s=0;s<i.length;++s)n[s]=le.getScreenXY({x:i[s].x,y:i[s].y});var r=c.getDistance(n[0],n[1]);this.context.save(),this.context.lineWidth=ko.lineWidth*le.ratio,this.context.lineCap="square",this.context.strokeStyle=ko.strokeStyle;var l=!1;if(e)"style-1"==e?(this.context.lineWidth=Ro.style1.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Symbol.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Symbol.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Symbol.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Symbol.strokeStyle);else{var a=ee.getSelectItem(),h=ee.getDraggingItem(),u=ee.getFocusItem();a&&a.type==p&&a.selectIndex==H?t.vectorId==a.vectorId&&(this.context.strokeStyle=Co.Symbol.strokeStyle,this.context.fillStyle=Co.Symbol.fillStyle,l=!0):h&&h.type==p&&h.selectIndex==H&&t.vectorId==h.vectorId&&(this.context.strokeStyle=Co.Symbol.strokeStyle,this.context.fillStyle=Co.Symbol.fillStyle,l=!0),u&&u.type==p&&t.vectorId==u.vectorId&&(this.context.strokeStyle=Wo.Symbol.strokeStyle,this.context.fillStyle=Wo.Symbol.fillStyle,l=!0)}this.context.beginPath(),this.context.moveTo(n[0].x,n[0].y),this.context.lineTo(n[1].x,n[1].y),this.context.arcTo(n[2].x,n[2].y,n[3].x,n[3].y,r),this.context.closePath(),this.context.stroke(),l&&this.context.fill(),this.context.restore(),o||null==t.enter||this.drawEntranceDoor(t)},Eo.prototype.drawDoubleDoor=function(t,e,o){for(var i=t.points2d,n=[],s=0;s<i.length;++s)n[s]=le.getScreenXY({x:i[s].x,y:i[s].y});var r=c.getDistance(n[0],n[1]);this.context.save(),this.context.lineWidth=ko.lineWidth*le.ratio,this.context.lineCap="square",this.context.strokeStyle=ko.strokeStyle;var l=!1;if(e)"style-1"==e?(this.context.lineWidth=Ro.style1.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Symbol.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Symbol.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Symbol.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Symbol.strokeStyle);else{var a=ee.getSelectItem(),h=ee.getDraggingItem(),u=ee.getFocusItem();a&&a.type==x&&a.selectIndex==H?t.vectorId==a.vectorId&&(this.context.strokeStyle=Co.Symbol.strokeStyle,this.context.fillStyle=Co.Symbol.fillStyle,l=!0):h&&h.type==x&&h.selectIndex==H&&t.vectorId==h.vectorId&&(this.context.strokeStyle=Co.Symbol.strokeStyle,this.context.fillStyle=Co.Symbol.fillStyle,l=!0),u&&u.type==x&&t.vectorId==u.vectorId&&(this.context.strokeStyle=Wo.Symbol.strokeStyle,this.context.fillStyle=Wo.Symbol.fillStyle,l=!0)}this.context.beginPath(),this.context.moveTo(n[0].x,n[0].y),this.context.lineTo(n[1].x,n[1].y),this.context.arcTo(n[4].x,n[4].y,n[5].x,n[5].y,r),this.context.closePath(),this.context.stroke(),l&&this.context.fill(),this.context.beginPath(),this.context.moveTo(n[2].x,n[2].y),this.context.lineTo(n[1].x,n[1].y),this.context.arcTo(n[4].x,n[4].y,n[3].x,n[3].y,r),this.context.closePath(),this.context.stroke(),l&&this.context.fill(),this.context.restore(),o||null==t.enter||this.drawEntranceDoor(t)},Eo.prototype.drawSlideDoor=function(t,e,o){for(var i=t.points2d,n=[],s=0;s<i.length;++s)n[s]=le.getScreenXY({x:i[s].x,y:i[s].y});if(this.context.save(),this.context.lineWidth=ko.lineWidth*le.ratio,this.context.strokeStyle=ko.strokeStyle,e)"style-1"==e?(this.context.lineWidth=Ro.style1.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Symbol.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Symbol.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Symbol.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Symbol.strokeStyle);else{var r=ee.getSelectItem(),l=ee.getDraggingItem(),a=ee.getFocusItem();r&&r.type==g&&r.selectIndex==H?t.vectorId==r.vectorId&&(this.context.strokeStyle=Co.Symbol.strokeStyle):l&&l.type==g&&l.selectIndex==H&&t.vectorId==l.vectorId&&(this.context.strokeStyle=Co.Symbol.strokeStyle),a&&a.type==g&&t.vectorId==a.vectorId&&(this.context.strokeStyle=Wo.Symbol.strokeStyle)}this.context.beginPath(),this.context.moveTo(n[0].x,n[0].y),this.context.lineTo(n[1].x,n[1].y),this.context.lineTo(n[2].x,n[2].y),this.context.lineTo(n[3].x,n[3].y),this.context.closePath(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(n[4].x,n[4].y),this.context.lineTo(n[5].x,n[5].y),this.context.lineTo(n[6].x,n[6].y),this.context.lineTo(n[7].x,n[7].y),this.context.closePath(),this.context.stroke(),this.context.restore(),o||null==t.enter||this.drawEntranceDoor(t)},Eo.prototype.drawSingleWindow=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=le.getScreenXY({x:o[n].x,y:o[n].y});if(this.context.save(),this.context.lineWidth=ko.lineWidth*le.ratio,this.context.strokeStyle=ko.strokeStyle,e)"style-1"==e?(this.context.lineWidth=Ro.style1.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Symbol.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Symbol.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Symbol.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Symbol.strokeStyle);else{var s=ee.getSelectItem(),r=ee.getDraggingItem(),l=ee.getFocusItem();s&&s.type==f&&s.selectIndex==H?t.vectorId==s.vectorId&&(this.context.strokeStyle=Co.Symbol.strokeStyle):r&&r.type==f&&r.selectIndex==H&&t.vectorId==r.vectorId&&(this.context.strokeStyle=Co.Symbol.strokeStyle),l&&l.type==f&&t.vectorId==l.vectorId&&(this.context.strokeStyle=Wo.Symbol.strokeStyle)}this.context.beginPath(),this.context.moveTo(i[0].x,i[0].y),this.context.lineTo(i[1].x,i[1].y),this.context.stroke(),this.context.beginPath(),this.context.moveTo(i[2].x,i[2].y),this.context.lineTo(i[3].x,i[3].y),this.context.lineTo(i[4].x,i[4].y),this.context.lineTo(i[5].x,i[5].y),this.context.closePath(),this.context.stroke(),this.context.restore()},Eo.prototype.drawBayWindow=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=le.getScreenXY({x:o[n].x,y:o[n].y});this.context.save(),this.context.lineWidth=ko.lineWidth*le.ratio,this.context.strokeStyle=ko.strokeStyle;var s=!1;if(e)"style-1"==e?(this.context.lineWidth=Ro.style1.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Symbol.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Symbol.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Symbol.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Symbol.strokeStyle);else{var r=ee.getSelectItem(),l=ee.getDraggingItem(),a=ee.getFocusItem();r&&r.type==m&&r.selectIndex==H?t.vectorId==r.vectorId&&(this.context.strokeStyle=Co.Symbol.strokeStyle,this.context.fillStyle=Co.Symbol.fillStyle,s=!0):l&&l.type==m&&l.selectIndex==H&&t.vectorId==l.vectorId&&(this.context.strokeStyle=Co.Symbol.strokeStyle,this.context.fillStyle=Co.Symbol.fillStyle,s=!0),a&&a.type==m&&t.vectorId==a.vectorId&&(this.context.strokeStyle=Wo.Symbol.strokeStyle,this.context.fillStyle=Wo.Symbol.fillStyle,s=!0)}this.context.beginPath(),this.context.moveTo(i[0].x,i[0].y),this.context.lineTo(i[1].x,i[1].y),this.context.lineTo(i[2].x,i[2].y),this.context.lineTo(i[3].x,i[3].y),this.context.closePath(),this.context.stroke(),s&&this.context.fill(),this.context.beginPath(),this.context.moveTo(i[5].x,i[5].y),this.context.lineTo(i[6].x,i[6].y),this.context.lineTo(i[7].x,i[7].y),this.context.lineTo(i[4].x,i[4].y),this.context.stroke(),this.context.restore()},Eo.prototype.drawFrenchWindow=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=le.getScreenXY({x:o[n].x,y:o[n].y});if(this.context.save(),this.context.lineWidth=ko.lineWidth*le.ratio,this.context.strokeStyle=ko.strokeStyle,e)"style-1"==e?(this.context.lineWidth=Ro.style1.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Symbol.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Symbol.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Symbol.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Symbol.strokeStyle);else{var s=ee.getSelectItem(),r=ee.getDraggingItem(),l=ee.getFocusItem();s&&s.type==v&&s.selectIndex==H?t.vectorId==s.vectorId&&(this.context.strokeStyle=Co.Symbol.strokeStyle):r&&r.type==v&&r.selectIndex==H&&t.vectorId==r.vectorId&&(this.context.strokeStyle=Co.Symbol.strokeStyle),l&&l.type==v&&t.vectorId==l.vectorId&&(this.context.strokeStyle=Wo.Symbol.strokeStyle)}this.context.beginPath(),this.context.moveTo(i[0].x,i[0].y),this.context.lineTo(i[1].x,i[1].y),this.context.moveTo(i[2].x,i[2].y),this.context.lineTo(i[3].x,i[3].y),this.context.moveTo(i[4].x,i[4].y),this.context.lineTo(i[5].x,i[5].y),this.context.moveTo(i[2].x,i[2].y),this.context.lineTo(i[4].x,i[4].y),this.context.moveTo(i[3].x,i[3].y),this.context.lineTo(i[5].x,i[5].y),this.context.moveTo(i[6].x,i[6].y),this.context.lineTo(i[7].x,i[7].y),this.context.stroke(),this.context.restore()},Eo.prototype.drawPass=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=le.getScreenXY({x:o[n].x,y:o[n].y});if(this.context.save(),this.context.lineWidth=ko.lineWidth*le.ratio,this.context.strokeStyle=ko.strokeStyle,e)"style-1"==e?(this.context.lineWidth=Ro.style1.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Symbol.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Symbol.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Symbol.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Symbol.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Symbol.strokeStyle);else{var s=ee.getSelectItem(),r=ee.getDraggingItem(),l=ee.getFocusItem();s&&s.type==S&&s.selectIndex==H?t.vectorId==s.vectorId&&(this.context.strokeStyle=Co.Symbol.strokeStyle):r&&r.type==S&&r.selectIndex==H&&t.vectorId==r.vectorId&&(this.context.strokeStyle=Co.Symbol.strokeStyle),l&&l.type==S&&t.vectorId==l.vectorId&&(this.context.strokeStyle=Wo.Symbol.strokeStyle)}this.context.beginPath(),this.context.moveTo(i[0].x,i[0].y),this.context.lineTo(i[1].x,i[1].y),this.context.lineTo(i[2].x,i[2].y),this.context.lineTo(i[3].x,i[3].y),this.context.closePath(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(i[4].x,i[4].y),this.context.lineTo(i[5].x,i[5].y),this.context.setLineDash([3,2,2]),this.context.stroke(),this.context.beginPath(),this.context.moveTo(i[6].x,i[6].y),this.context.lineTo(i[7].x,i[7].y),this.context.setLineDash([3,2,2]),this.context.stroke(),this.context.restore()},Eo.prototype.drawBeam=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=le.getScreenXY({x:o[n].x,y:o[n].y});this.context.save(),this.context.lineWidth=To.lineWidth*le.ratio,this.context.strokeStyle=To.strokeStyle;var s=!1;if(e)"style-1"==e?(this.context.lineWidth=Ro.style1.Component.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Component.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Component.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Component.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Component.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Component.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Component.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Component.strokeStyle);else{var r=ee.getSelectItem(),l=ee.getDraggingItem(),a=ee.getFocusItem();r&&r.type==P?t.vectorId==r.vectorId&&(this.context.strokeStyle=Co.Component.strokeStyle,this.context.fillStyle=Co.Component.fillStyle,s=!0):l&&l.type==P&&t.vectorId==l.vectorId&&(this.context.strokeStyle=Co.Component.strokeStyle,this.context.fillStyle=Co.Component.fillStyle,s=!0),a&&a.type==P&&t.vectorId==a.vectorId&&(this.context.strokeStyle=Wo.Component.strokeStyle,this.context.fillStyle=Wo.Component.fillStyle,s=!0)}this.context.beginPath(),this.context.moveTo(i[0].x,i[0].y),this.context.lineTo(i[1].x,i[1].y),this.context.lineTo(i[2].x,i[2].y),this.context.lineTo(i[3].x,i[3].y),this.context.closePath(),this.context.stroke(),s&&this.context.fill(),this.context.moveTo(i[0].x,i[0].y),this.context.lineTo(i[2].x,i[2].y),this.context.moveTo(i[1].x,i[1].y),this.context.lineTo(i[3].x,i[3].y),this.context.stroke(),this.context.restore()},Eo.prototype.drawFlue=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=le.getScreenXY({x:o[n].x,y:o[n].y});this.context.save(),this.context.lineWidth=To.lineWidth*le.ratio,this.context.strokeStyle=To.strokeStyle;var s=!1;if(e)"style-1"==e?(this.context.lineWidth=Ro.style1.Component.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Component.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Component.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Component.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Component.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Component.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Component.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Component.strokeStyle);else{var r=ee.getSelectItem(),l=ee.getDraggingItem(),a=ee.getFocusItem();r&&r.type==b?t.vectorId==r.vectorId&&(this.context.strokeStyle=Co.Component.strokeStyle,this.context.fillStyle=Co.Component.fillStyle,s=!0):l&&l.type==b&&t.vectorId==l.vectorId&&(this.context.strokeStyle=Co.Component.strokeStyle,this.context.fillStyle=Co.Component.fillStyle,s=!0),a&&a.type==b&&t.vectorId==a.vectorId&&(this.context.strokeStyle=Wo.Component.strokeStyle,this.context.fillStyle=Wo.Component.fillStyle,s=!0)}this.context.beginPath(),this.context.moveTo(i[0].x,i[0].y),this.context.lineTo(i[1].x,i[1].y),this.context.lineTo(i[2].x,i[2].y),this.context.lineTo(i[3].x,i[3].y),this.context.closePath(),this.context.stroke(),s&&this.context.fill(),this.context.beginPath(),this.context.moveTo(i[4].x,i[4].y),this.context.lineTo(i[5].x,i[5].y),this.context.lineTo(i[6].x,i[6].y),this.context.lineTo(i[7].x,i[7].y),this.context.closePath(),this.context.stroke(),this.context.moveTo(i[4].x,i[4].y),this.context.lineTo(i[8].x,i[8].y),this.context.lineTo(i[6].x,i[6].y),this.context.stroke(),this.context.restore()},Eo.prototype.drawCorridor=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=le.getScreenXY({x:o[n].x,y:o[n].y});if(this.context.save(),this.context.lineWidth=To.lineWidth*le.ratio,this.context.strokeStyle=To.strokeStyle,e)"style-1"==e?(this.context.lineWidth=Ro.style1.Component.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Component.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Component.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Component.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Component.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Component.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Component.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Component.strokeStyle);else{var s=ee.getSelectItem(),r=ee.getDraggingItem(),l=ee.getFocusItem();s&&s.type==I?t.vectorId==s.vectorId&&(this.context.strokeStyle=Co.Component.strokeStyle):r&&r.type==I&&t.vectorId==r.vectorId&&(this.context.strokeStyle=Co.Component.strokeStyle),l&&l.type==I&&t.vectorId==l.vectorId&&(this.context.strokeStyle=Wo.Component.strokeStyle)}this.context.beginPath(),this.context.moveTo(i[0].x,i[0].y),this.context.lineTo(i[1].x,i[1].y),this.context.lineTo(i[2].x,i[2].y),this.context.lineTo(i[3].x,i[3].y),this.context.closePath(),this.context.stroke();for(var a=4;a<i.length-1;a+=2)this.context.moveTo(i[a].x,i[a].y),this.context.lineTo(i[a+1].x,i[a+1].y);this.context.stroke(),this.context.restore()},Eo.prototype.drawTag=function(t,e,o){if(this.context.save(),this.context.lineWidth=Fo.lineWidth*le.ratio,this.context.strokeStyle=Fo.strokeStyle,this.context.fillStyle=Fo.fillStyle,e)"style-1"==e?(this.context.lineWidth=Ro.style1.Tag.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Tag.strokeStyle,this.context.fillStyle=Ro.style1.Tag.fillStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Tag.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Tag.strokeStyle,this.context.fillStyle=Ro.style2.Tag.fillStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Tag.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Tag.strokeStyle,this.context.fillStyle=Ro.style3.Tag.fillStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Tag.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Tag.strokeStyle,this.context.fillStyle=Ro.style4.Tag.fillStyle);else{var i=ee.getSelectItem(),n=ee.getDraggingItem(),s=ee.getFocusItem();i&&i.type==T?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Tag.strokeStyle,this.context.fillStyle=Co.Tag.fillStyle):n&&n.type==T&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Co.Tag.strokeStyle,this.context.fillStyle=Co.Tag.fillStyle),s&&s.type==T&&t.vectorId==s.vectorId&&(this.context.strokeStyle=Wo.Tag.strokeStyle,this.context.fillStyle=Wo.Tag.fillStyle)}if(t.adding){for(var r=t.points2d,l=[],h=0;h<r.length;++h)l[h]=le.getScreenXY({x:r[h].x,y:r[h].y});this.context.strokeStyle=Fo.strokeStyle_adding,this.context.fillStyle=Fo.fillStyle_adding,this.context.beginPath(),this.context.moveTo(l[0].x,l[0].y),this.context.lineTo(l[1].x,l[1].y),this.context.lineTo(l[2].x,l[2].y),this.context.lineTo(l[3].x,l[3].y),this.context.closePath(),this.context.stroke();for(var u=4;u<l.length-1;u+=2)this.context.moveTo(l[u].x,l[u].y),this.context.lineTo(l[u+1].x,l[u+1].y);this.context.stroke()}else{var d=le.ratio==a.ratio?36:12;this.context.font="400 "+d+"px Microsoft YaHei";var y=t.title;o||null!=y&&""!=y.trim()||(console.log(he.$app.config),y=he.$app.config.i18n("cad.input")),t.des+="",""!=t.des&&(t.sideWidth=Math.max(this.context.measureText(y).width,this.context.measureText(parseFloat(t.des.replace(",","")).toFixed(2)).width),t.setPoints2d());for(var p=t.points2d,x=[],g=0;g<p.length;++g)x[g]=le.getScreenXY({x:p[g].x,y:p[g].y});var f=(t.center.x,t.center.y);f=le.getScreenXY({x:t.center.x,y:t.center.y});var m=this.context.measureText(y).width,v=(c.createLine1({x:(x[0].x+x[3].x)/2,y:(x[0].y+x[3].y)/2},{x:(x[2].x+x[1].x)/2,y:(x[2].y+x[1].y)/2}),this.context.measureText(t.des+"m²").width);""!=t.des&&"ft"==t.unit&&(v=this.context.measureText(parseFloat(t.des.replace(",","")).toFixed(2)+"ft²").width);var S,P;c.createLine1(x[2],x[3]);if(S=c.getDisPointsLine({y:(x[0].y+x[3].y)/2},f,m/2,m/2),P=c.getDisPointsLine({y:x[3].y},{x:(x[2].x+x[3].x)/2,y:(x[2].y+x[3].y)/2},v/2,v/2),S.newpoint1.x<S.newpoint2.x){if(this.context.fillText(y,S.newpoint1.x,S.newpoint1.y),t.des)if("ft"==de.unit&&"m"==t.unit){var b=me.convert(t.des,"area",void 0,"imperial",.01,!1);this.context.fillText(parseFloat(b.replace(",","")).toFixed(2),P.newpoint1.x+d/1.5,P.newpoint1.y)}else if("m"==de.unit&&"ft"==t.unit){var I=me.convertBack(t.des,"area",7,"imperial",.01,!1);this.context.fillText(parseFloat(I.replace(",","")).toFixed(2),P.newpoint1.x+d/1.5,P.newpoint1.y)}else"m"==t.unit?this.context.fillText(parseFloat(t.des).toFixed(2)+"m²",P.newpoint1.x,P.newpoint1.y):"ft"==t.unit&&this.context.fillText(parseFloat(t.des.replace(",","")).toFixed(2)+"ft²",P.newpoint1.x,P.newpoint1.y)}else if(this.context.fillText(y,S.newpoint2.x,S.newpoint2.y),t.des)if("ft"==de.unit&&"m"==t.unit){var k=me.convert(t.des,"area",void 0,"imperial",.01,!1);this.context.fillText(parseFloat(k.replace(",","")).toFixed(2),P.newpoint2.x+d/1.5,P.newpoint2.y)}else if("m"==de.unit&&"ft"==t.unit){var F=me.convertBack(t.des,"area",7,"imperial",.01,!1);this.context.fillText(parseFloat(F.replace(",","")).toFixed(2),P.newpoint2.x+d/1.5,P.newpoint2.y)}else"m"==t.unit?this.context.fillText(parseFloat(t.des).toFixed(2)+"m²",P.newpoint2.x,P.newpoint2.y):"ft"==t.unit&&this.context.fillText(parseFloat(t.des.replace(",","")).toFixed(2)+"ft²",P.newpoint2.x,P.newpoint2.y)}this.context.restore()},Eo.prototype.drawCircle=function(t){var e=null,o=2*Math.PI,i=le.getScreenXY(t);this.context.save(),t.name==Te?(e=Do.StartAddWall.radius*le.ratio,this.context.strokeStyle=Do.StartAddWall.strokeStyle,this.context.fillStyle=Do.StartAddWall.fillStyle):t.name==we?(e=Do.StartSymbolPoints.radius*le.ratio,this.context.strokeStyle=Do.StartSymbolPoints.strokeStyle,this.context.fillStyle=Do.StartSymbolPoints.fillStyle):t.name==Ce?(e=Do.EndSymbolPoints.radius*le.ratio,this.context.strokeStyle=Do.EndSymbolPoints.strokeStyle,this.context.fillStyle=Do.EndSymbolPoints.fillStyle):"pano"==t.name&&(e=Lo.radius*le.ratio,this.context.strokeStyle=Lo.strokeStyle,this.context.fillStyle=Lo.fillStyle,this.context.lineWidth=Lo.lineWidth),this.context.beginPath(),this.context.arc(i.x,i.y,e,0,o,!0),this.context.stroke(),this.context.fill(),this.context.restore()},Eo.prototype.drawLine=function(t){var e=le.getScreenXY(t.start),o=le.getScreenXY(t.end);this.context.save(),t.name==ze?(this.context.lineWidth=Do.VCheckLinesX.lineWidth*le.ratio,this.context.strokeStyle=Do.VCheckLinesX.strokeStyle,this.context.setLineDash([3,2,2]),e.y=0,o.y=this.context.canvas.clientHeight):t.name==Le?(this.context.lineWidth=Do.VCheckLinesY.lineWidth*le.ratio,this.context.strokeStyle=Do.VCheckLinesY.strokeStyle,this.context.setLineDash([3,2,2]),e.x=0,o.x=this.context.canvas.clientWidth):t.name==Fe?(this.context.lineWidth=Do.NewWall.lineWidth*le.ratio,this.context.strokeStyle=Do.NewWall.strokeStyle,"error"==t.state?this.context.strokeStyle=Do.NewWall.errorStrokeStyle:"normal-out"==t.state&&(this.context.strokeStyle=Do.NewWall.strokeStyle_out,this.context.lineWidth=Do.NewWall.lineWidth_out*le.ratio)):t.name==We?(this.context.lineWidth=Do.CheckLinesX.lineWidth*le.ratio,this.context.strokeStyle=Do.CheckLinesX.strokeStyle,this.context.setLineDash([3,2,2])):t.name==De?(this.context.lineWidth=Do.CheckLinesY.lineWidth*le.ratio,this.context.strokeStyle=Do.CheckLinesY.strokeStyle,this.context.setLineDash([3,2,2])):t.name==Me?(this.context.lineWidth=Do.SignLine1.lineWidth*le.ratio,this.context.strokeStyle=Do.SignLine1.strokeStyle,this.context.setLineDash([3,2,2])):t.name==Re&&(this.context.lineWidth=Do.SignLine2.lineWidth*le.ratio,this.context.strokeStyle=Do.SignLine2.strokeStyle,this.context.setLineDash([3,2,2])),this.context.beginPath(),this.context.moveTo(e.x,e.y),this.context.lineTo(o.x,o.y),this.context.stroke(),this.context.restore(),t.name==Fe&&this.drawMeasureTxt(t.start,t.end),this.context.save(),this.context.lineWidth=Io.lineWidth*le.ratio,this.context.strokeStyle=Io.strokeStyle,this.context.fillStyle=Io.fillStyle;var i=Io.radius;this.context.beginPath(),this.context.arc(e.x,e.y,i*le.ratio,0,2*Math.PI,!0),this.context.stroke(),this.context.fill(),this.context.restore()},Eo.prototype.drawMeasure=function(t,e,o,i){this.context.save(),this.context.strokeStyle=Mo.strokeStyle,this.context.lineWidth=Mo.lineWidth*le.ratio,o&&("style-1"==o||"style-2"==o||"style-3"==o||"style-4"==o)&&(this.context.lineWidth=Ro.style1.Measure.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Measure.strokeStyle);for(var n=i?1:le.ratio,s=0;s<t.length-1;++s){var r=le.getScreenXY(t[s]),l=le.getScreenXY(t[s+1]),h=0;"top"==e?(r.y=de.region.top*n,l.y=de.region.top*n):"bottom"==e?(r.y=de.region.bottom*n,l.y=de.region.bottom*n):"left"==e?(r.x=de.region.left*n,l.x=de.region.left*n,h=-.5*Math.PI):"right"==e&&(r.x=de.region.right*n,l.x=de.region.right*n,h=.5*Math.PI);var u=c.createLine1(r,l);if(null!=u){var d=c.getParallelLineForDistance(u,6*le.ratio),y=c.getJoinLinePoint(r,d.line1),p=c.getJoinLinePoint(l,d.line1),x=c.getJoinLinePoint(r,d.line2),g=c.getJoinLinePoint(l,d.line2);this.context.beginPath(),this.context.moveTo(y.x,y.y),this.context.lineTo(x.x,x.y),this.context.stroke(),this.context.beginPath(),this.context.moveTo(p.x,p.y),this.context.lineTo(g.x,g.y),this.context.stroke();var f={x:(r.x+l.x)/2,y:(r.y+l.y)/2},m=c.getVerticalLine(u,f);d=c.getParallelLineForDistance(m,22*le.ratio);var v=c.getIntersectionPoint(u,d.line1),S=c.getIntersectionPoint(u,d.line2);if(c.getDistance(r,v)<c.getDistance(r,f)){var P=c.getDistance(t[s],t[s+1]);P="ft"==de.unit?" "+me.convert(P,"distance",void 0,"imperial",.01,!0)+" ":c.getFixed(P,2)+"m",c.getDistance(r,l)>this.context.measureText(P).width?(this.context.beginPath(),this.context.moveTo(r.x,r.y),this.context.lineTo(v.x,v.y),this.context.stroke(),this.context.beginPath(),this.context.moveTo(S.x,S.y),this.context.lineTo(l.x,l.y),this.context.stroke(),this.context.save(),le.ratio==a.ratio?this.context.font="36px Microsoft YaHei":this.context.font="12px Microsoft YaHei","style-1"==o||"style-3"==o?(this.context.fillStyle="#000000",this.context.strokeStyle="#000000"):(this.context.fillStyle="#FFFFFF",this.context.strokeStyle="#FFFFFF"),this.context.textAlign="center",this.context.textBaseline="middle",this.context.miterLimit=10,this.context.direction="ltr",h?(this.context.translate(f.x,f.y),this.context.rotate(h),this.context.fillText(P,0,0)):this.context.fillText(P,f.x,f.y),this.context.restore()):(this.context.beginPath(),this.context.moveTo(r.x,r.y),this.context.lineTo(l.x,l.y),this.context.stroke())}else{var b=c.getDistance(t[s],t[s+1]);b="ft"==de.unit?" "+me.convert(b,"distance",void 0,"imperial",.01,!0)+" ":c.getFixed(b,2)+"m",c.getDistance(r,l)>this.context.measureText(b).width?(this.context.beginPath(),this.context.moveTo(r.x,r.y),this.context.lineTo(S.x,S.y),this.context.stroke(),this.context.beginPath(),this.context.moveTo(v.x,v.y),this.context.lineTo(l.x,l.y),this.context.stroke(),this.context.save(),le.ratio==a.ratio?this.context.font="36px Microsoft YaHei":this.context.font="12px Microsoft YaHei","style-1"==o||"style-3"==o?(this.context.fillStyle="#000000",this.context.strokeStyle="#000000"):(this.context.fillStyle="#FFFFFF",this.context.strokeStyle="#FFFFFF"),this.context.textAlign="center",this.context.textBaseline="middle",this.context.miterLimit=10,this.context.direction="ltr",h?(this.context.translate(f.x,f.y),this.context.rotate(h),this.context.fillText(b,0,0)):this.context.fillText(b,f.x,f.y),this.context.restore()):(this.context.beginPath(),this.context.moveTo(r.x,r.y),this.context.lineTo(l.x,l.y),this.context.stroke())}}}this.context.restore()},Eo.prototype.drawMeasureTxt=function(t,e){var o=le.getScreenXY(t),i=le.getScreenXY(e),n=c.createLine1(o,i);if(null!=n){var s={x:(o.x+i.x)/2,y:(o.y+i.y)/2},r=c.getParallelLineForDistance(n,10),l=null,a=c.getJoinLinePoint(s,r.line1),h=c.getJoinLinePoint(s,r.line2);s.y<a.y?(c.clonePoint(s,h),l=r.line2):(c.clonePoint(s,a),l=r.line1);var u=c.getDistance(t,e);u="ft"==de.unit?" "+me.convert(u,"distance",void 0,"imperial",.01,!0)+" ":c.getFixed(u,2)+"m";var d=this.context.measureText(u).width,y=c.getLineForPoint(n,s),p=c.getParallelLineForDistance(y,d/2),x=c.getIntersectionPoint(p.line1,l);x={x:Math.round(x.x),y:Math.round(x.y)};var g=c.getIntersectionPoint(p.line2,l);g={x:Math.round(g.x),y:Math.round(g.y)},x.x<g.x?c.clonePoint(s,x):x.x>g.x?c.clonePoint(s,g):x.y<g.y?c.clonePoint(s,x):c.clonePoint(s,g);var f=null;f=void 0!==n.a?Math.atan(n.a):n.hasOwnProperty("x")?Math.PI/2:0,this.context.save(),this.context.fillStyle=Mo.txt,this.context.translate(s.x,s.y),this.context.rotate(f),this.context.fillText(u,0,0),this.context.restore()}},Eo.prototype.drawEntranceDoor=function(t){this.context.save();var e,o,i=se.getEnterImg(),n={x:(t.startPoint.x+t.endPoint.x)/2,y:(t.startPoint.y+t.endPoint.y)/2},s=c.createLine1(t.startPoint,t.endPoint),r=c.getLineForPoint(s,n),l=null,h=null;"default"==t.enter?l=c.getParallelLineForDistance(s,.02):"reverse"==t.enter&&(l=c.getParallelLineForDistance(s,.02+c.getDistance(t.startPoint,t.endPoint))),e=c.getIntersectionPoint(l.line1,r),o=c.getIntersectionPoint(l.line2,r);var u=c.Angle(t.startPoint,{x:t.startPoint.x+1,y:t.startPoint.y},t.endPoint);c.isClockwise([t.startPoint,t.endPoint,o])?h="LEFT"==t.openSide?"default"==t.enter?e:o:"default"==t.enter?o:e:c.isClockwise([t.startPoint,t.endPoint,e])&&(h="LEFT"==t.openSide?"default"==t.enter?o:e:"default"==t.enter?e:o),c.isClockwise([t.startPoint,t.endPoint,h])||(u=Math.PI+u),h=le.getScreenXY(h),this.context.translate(h.x,h.y),t.startPoint.y<=t.endPoint.y?this.context.rotate(-u):this.context.rotate(u);var d=c.getDistance(t.startPoint,t.endPoint)*le.res*1.5;this.context.scale(le.zoom/a.defaultZoom*le.ratio*d/i.height,le.zoom/a.defaultZoom*le.ratio*d/i.height),this.context.drawImage(i,-i.width/2,-i.height-10),this.context.restore()},Eo.prototype.drawRoomBackGround=function(t,e){this.context.save();var o=!1;if(e){this.context.fillStyle=this.context.createPattern(e,"repeat"),o=!0;for(var i=[],n=0;n<t.wallPointIDs.length;++n){var s=he.getPoint(t.wallPointIDs[n]);s=le.getScreenXY(s),i.push(s)}this.context.beginPath(),this.context.moveTo(i[0].x,i[0].y);for(var r=0;r<i.length;++r)this.context.lineTo(i[r].x,i[r].y);this.context.closePath(),o&&this.context.fill(),this.context.restore()}},Eo.prototype.drawCompass=function(t){var e=null;e="style-1"==t||"style-3"==t?Ao.getWhiteImg():Ao.getBlackImg();var o=he.getCompass();this.context.save(),this.context.translate((le.width-310)*le.ratio,160*le.ratio),this.context.rotate(o/180*Math.PI),this.context.scale(le.ratio/2,le.ratio/2),this.context.drawImage(e,-e.width/2,-e.height/2),this.context.restore()},Eo.prototype.setCanvasStyle=function(t){for(var e in t)"isFill"!=e&&"isStroke"!=e&&(this.context[e]=t[e])},Eo.prototype.drawFurniture=function(t,e){t.geoType==F?(this.drawTV(t,e),this.drawTestRec(t)):t.geoType==w?(this.drawCombinationSofa(t,e),this.drawTestRec(t)):t.geoType==C?(this.drawSingleSofa(t,e),this.drawTestRec(t)):t.geoType==W?(this.drawTeaTable(t,e),this.drawTestRec(t)):t.geoType==D?(this.drawCarpet(t,e),this.drawTestRec(t)):t.geoType==z?(this.drawPlant(t,e),this.drawTestRec(t)):t.geoType==L?(this.drawDiningTable(t,e),this.drawTestRec(t)):t.geoType==M?(this.drawDoubleBed(t,e),this.drawTestRec(t)):t.geoType==R?(this.drawSingleBed(t,e),this.drawTestRec(t)):t.geoType==O?(this.drawWardrobe(t,e),this.drawTestRec(t)):t.geoType==A?(this.drawDresser(t,e),this.drawTestRec(t)):t.geoType==E?(this.drawBedsideCupboard(t,e),this.drawTestRec(t)):t.geoType==B?(this.drawPillow(t,e),this.drawTestRec(t)):t.geoType==_?(this.drawGasStove(t,e),this.drawTestRec(t)):t.geoType==Y?(this.drawCupboard(t,e),this.drawTestRec(t)):t.geoType==N?(this.drawBathtub(t,e),this.drawTestRec(t)):t.geoType==X?(this.drawClosestool(t,e),this.drawTestRec(t)):t.geoType==j?(this.drawWashstand(t,e),this.drawTestRec(t)):t.geoType==U?(this.drawDesk(t,e),this.drawTestRec(t)):t.geoType==J?(this.drawBalconyChair(t,e),this.drawTestRec(t)):t.geoType==V&&(this.drawElevator(t,e),this.drawTestRec(t))},Eo.prototype.drawTestRec=function(t){},Eo.prototype.drawRec=function(t){},Eo.prototype.drawTV=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==F?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==F?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==F&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.beginPath(),this.context.moveTo(.5,11.5),this.context.lineTo(31.5,11.5),this.context.lineTo(31.5,20.5),this.context.lineTo(.5,20.5),this.context.lineTo(.5,11.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(7.5,15.5),this.context.lineTo(24.5,15.5),this.context.lineTo(24.5,17.5),this.context.lineTo(7.5,17.5),this.context.lineTo(7.5,15.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(22,15.5),this.context.lineTo(21,13.5),this.context.lineTo(11,13.5),this.context.lineTo(10,15.5),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawCombinationSofa=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==w?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==w?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==w&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.beginPath(),this.context.moveTo(3.5,15.5),this.context.lineTo(18.5,15.5),this.context.lineTo(18.5,24.5),this.context.lineTo(3.5,24.5),this.context.lineTo(3.5,15.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(30.5,17.5),this.context.lineTo(30.5,15.5),this.context.bezierCurveTo(30.5008,15.3684,30.4755,15.2379,30.4258,15.1161),this.context.bezierCurveTo(30.376,14.9943,30.3026,14.8834,30.21,14.79),this.context.bezierCurveTo(30.1165,14.6973,30.0057,14.624,29.8839,14.5742),this.context.bezierCurveTo(29.7621,14.5245,29.6316,14.4992,29.5,14.5),this.context.lineTo(26.5,14.5),this.context.lineTo(26.5,7.5),this.context.lineTo(21.5,7.5),this.context.lineTo(21.5,5.5),this.context.bezierCurveTo(21.5008,5.36839,21.4755,5.23793,21.4258,5.11609),this.context.bezierCurveTo(21.376,4.99425,21.3026,4.88343,21.21,4.78999),this.context.bezierCurveTo(21.1165,4.69731,21.0057,4.624,20.8839,4.57423),this.context.bezierCurveTo(20.7621,4.52447,20.6316,4.49924,20.5,4.5),this.context.lineTo(18.5,4.5),this.context.lineTo(18.5,3.5),this.context.bezierCurveTo(18.5008,3.36839,18.4755,3.23793,18.4258,3.11609),this.context.bezierCurveTo(18.376,2.99425,18.3026,2.88343,18.21,2.78999),this.context.bezierCurveTo(18.1165,2.69731,18.0057,2.624,17.8839,2.57423),this.context.bezierCurveTo(17.7621,2.52447,17.6316,2.49924,17.5,2.5),this.context.lineTo(4.5,2.5),this.context.bezierCurveTo(4.36839,2.49924,4.23793,2.52447,4.11609,2.57423),this.context.bezierCurveTo(3.99425,2.624,3.88348,2.69731,3.79004,2.78999),this.context.bezierCurveTo(3.69736,2.88343,3.62398,2.99425,3.57422,3.11609),this.context.bezierCurveTo(3.52445,3.23793,3.49924,3.36839,3.5,3.5),this.context.lineTo(3.5,4.5),this.context.lineTo(1.5,4.5),this.context.bezierCurveTo(1.36839,4.49924,1.23793,4.52447,1.11609,4.57423),this.context.bezierCurveTo(.994251,4.624,.883479,4.69731,.790039,4.78999),this.context.bezierCurveTo(.697358,4.88343,.623983,4.99425,.574219,5.11609),this.context.bezierCurveTo(.524454,5.23793,.499239,5.36839,.5,5.5),this.context.lineTo(.5,29.5),this.context.lineTo(26.5,29.5),this.context.lineTo(26.5,27.5),this.context.lineTo(29.5,27.5),this.context.bezierCurveTo(29.6316,27.5008,29.7621,27.4755,29.8839,27.4258),this.context.bezierCurveTo(30.0057,27.376,30.1165,27.3027,30.21,27.21),this.context.bezierCurveTo(30.3026,27.1166,30.376,27.0057,30.4258,26.8839),this.context.bezierCurveTo(30.4755,26.7621,30.5008,26.6316,30.5,26.5),this.context.lineTo(30.5,24.5),this.context.bezierCurveTo(30.6316,24.5008,30.7621,24.4755,30.8839,24.4258),this.context.bezierCurveTo(31.0057,24.376,31.1165,24.3027,31.21,24.21),this.context.bezierCurveTo(31.3026,24.1166,31.376,24.0057,31.4258,23.8839),this.context.bezierCurveTo(31.4755,23.7621,31.5008,23.6316,31.5,23.5),this.context.lineTo(31.5,18.5),this.context.bezierCurveTo(31.5008,18.3684,31.4755,18.2379,31.4258,18.1161),this.context.bezierCurveTo(31.376,17.9943,31.3026,17.8834,31.21,17.79),this.context.bezierCurveTo(31.1165,17.6973,31.0057,17.624,30.8839,17.5742),this.context.bezierCurveTo(30.7621,17.5245,30.6316,17.4992,30.5,17.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(21.5,18.5),this.context.bezierCurveTo(21.5,18.2348,21.6054,17.9804,21.7929,17.7929),this.context.bezierCurveTo(21.9804,17.6054,22.2348,17.5,22.5,17.5),this.context.lineTo(30.5,17.5),this.context.bezierCurveTo(30.7652,17.5,31.0196,17.6054,31.2071,17.7929),this.context.bezierCurveTo(31.3946,17.9804,31.5,18.2348,31.5,18.5),this.context.lineTo(31.5,23.5),this.context.bezierCurveTo(31.5,23.7652,31.3946,24.0196,31.2071,24.2071),this.context.bezierCurveTo(31.0196,24.3946,30.7652,24.5,30.5,24.5),this.context.lineTo(22.5,24.5),this.context.bezierCurveTo(22.2348,24.5,21.9804,24.3946,21.7929,24.2071),this.context.bezierCurveTo(21.6054,24.0196,21.5,23.7652,21.5,23.5),this.context.lineTo(21.5,18.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(3.5,3.5),this.context.bezierCurveTo(3.5,3.23478,3.60537,2.98043,3.79291,2.79289),this.context.bezierCurveTo(3.98044,2.60536,4.23478,2.5,4.5,2.5),this.context.lineTo(17.5,2.5),this.context.bezierCurveTo(17.7652,2.5,18.0196,2.60536,18.2071,2.79289),this.context.bezierCurveTo(18.3946,2.98043,18.5,3.23478,18.5,3.5),this.context.lineTo(18.5,10.5),this.context.bezierCurveTo(18.5,10.7652,18.3946,11.0196,18.2071,11.2071),this.context.bezierCurveTo(18.0196,11.3946,17.7652,11.5,17.5,11.5),this.context.lineTo(4.5,11.5),this.context.bezierCurveTo(4.23478,11.5,3.98044,11.3946,3.79291,11.2071),this.context.bezierCurveTo(3.60537,11.0196,3.5,10.7652,3.5,10.5),this.context.lineTo(3.5,3.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(3.5,4.5),this.context.lineTo(1.5,4.5),this.context.bezierCurveTo(1.23478,4.5,.980444,4.60536,.792908,4.79289),this.context.bezierCurveTo(.605371,4.98043,.5,5.23478,.5,5.5),this.context.lineTo(.5,9.5),this.context.bezierCurveTo(.5,9.76522,.605371,10.0196,.792908,10.2071),this.context.bezierCurveTo(.980444,10.3946,1.23478,10.5,1.5,10.5),this.context.lineTo(3.5,10.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(18.5,4.5),this.context.lineTo(20.5,4.5),this.context.bezierCurveTo(20.7652,4.5,21.0196,4.60536,21.2071,4.79289),this.context.bezierCurveTo(21.3946,4.98043,21.5,5.23478,21.5,5.5),this.context.lineTo(21.5,9.5),this.context.bezierCurveTo(21.5,9.76522,21.3946,10.0196,21.2071,10.2071),this.context.bezierCurveTo(21.0196,10.3946,20.7652,10.5,20.5,10.5),this.context.lineTo(18.5,10.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(3.5,5.5),this.context.lineTo(18.5,5.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(22.5,24.5),this.context.lineTo(22.5,26.5),this.context.bezierCurveTo(22.5,26.7652,22.6054,27.0196,22.7929,27.2071),this.context.bezierCurveTo(22.9804,27.3946,23.2348,27.5,23.5,27.5),this.context.lineTo(29.5,27.5),this.context.bezierCurveTo(29.7652,27.5,30.0196,27.3946,30.2071,27.2071),this.context.bezierCurveTo(30.3946,27.0196,30.5,26.7652,30.5,26.5),this.context.lineTo(30.5,24.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(22.5,17.5),this.context.lineTo(22.5,15.5),this.context.bezierCurveTo(22.5,15.2348,22.6054,14.9804,22.7929,14.7929),this.context.bezierCurveTo(22.9804,14.6054,23.2348,14.5,23.5,14.5),this.context.lineTo(29.5,14.5),this.context.bezierCurveTo(29.7652,14.5,30.0196,14.6054,30.2071,14.7929),this.context.bezierCurveTo(30.3946,14.9804,30.5,15.2348,30.5,15.5),this.context.lineTo(30.5,17.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(28.5,17.5),this.context.lineTo(28.5,24.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(8.5,2.5),this.context.lineTo(8.5,11.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(13.5,2.5),this.context.lineTo(13.5,11.5),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawSingleSofa=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==C?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==C?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==C&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.font="15px ''",this.context.beginPath(),this.context.moveTo(23,8.5),this.context.lineTo(27.5,8.5),this.context.bezierCurveTo(28.0523,8.5,28.5,8.94772,28.5,9.5),this.context.lineTo(28.5,22.5),this.context.bezierCurveTo(28.5,23.0523,28.0523,23.5,27.5,23.5),this.context.lineTo(23,23.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(9,8.5),this.context.lineTo(4.5,8.5),this.context.bezierCurveTo(3.94772,8.5,3.5,8.94772,3.5,9.5),this.context.lineTo(3.5,22.5),this.context.bezierCurveTo(3.5,23.0523,3.94772,23.5,4.5,23.5),this.context.lineTo(9,23.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(9.5,7.5),this.context.bezierCurveTo(9.5,6.94771,9.94772,6.5,10.5,6.5),this.context.lineTo(21.5,6.5),this.context.bezierCurveTo(22.0523,6.5,22.5,6.94772,22.5,7.5),this.context.lineTo(22.5,24.5),this.context.bezierCurveTo(22.5,25.0523,22.0523,25.5,21.5,25.5),this.context.lineTo(10.5,25.5),this.context.bezierCurveTo(9.94772,25.5,9.5,25.0523,9.5,24.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(10,12.5),this.context.lineTo(22,12.5),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawTeaTable=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==W?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==W?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==W&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.font="15px ''",this.context.beginPath(),this.context.moveTo(1.5,8.5),this.context.lineTo(30.5,8.5),this.context.lineTo(30.5,23.5),this.context.lineTo(1.5,23.5),this.context.lineTo(1.5,8.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(3.5,10.5),this.context.lineTo(28.5,10.5),this.context.lineTo(28.5,21.5),this.context.lineTo(3.5,21.5),this.context.lineTo(3.5,10.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(3.5,21.5),this.context.lineTo(14.5,10.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(28.5,13.5),this.context.lineTo(22.5,19.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(16.5,21.5),this.context.lineTo(23,15),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(28.5,17),this.context.lineTo(24,21.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(16.5,21.5),this.context.lineTo(23,15),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(7.5,21.5),this.context.lineTo(18.5,10.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(3.5,15.5),this.context.lineTo(8.5,10.5),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawCarpet=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==D?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==D?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==D&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.font="15px ''",this.context.beginPath(),this.context.moveTo(31.5,16),this.context.bezierCurveTo(31.5,21.5228,24.8366,25.5,16,25.5),this.context.bezierCurveTo(7.16344,25.5,.5,21.5228,.5,16),this.context.bezierCurveTo(.5,10.4772,7.16344,6.5,16,6.5),this.context.bezierCurveTo(24.8366,6.5,31.5,10.4772,31.5,16),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(.5,16),this.context.lineTo(4.5,16.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(5,9.5),this.context.lineTo(6.5,12.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(9,7.5),this.context.lineTo(10,10.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(16,9.5),this.context.lineTo(18.5,6.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(27.5,16),this.context.bezierCurveTo(27.5,20.0695,22.2711,22.5,16,22.5),this.context.bezierCurveTo(9.7289,22.5,4.5,20.0695,4.5,16),this.context.bezierCurveTo(4.5,11.9305,9.7289,9.5,16,9.5),this.context.bezierCurveTo(22.2711,9.5,27.5,11.9305,27.5,16),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(27,17.5),this.context.lineTo(30.5,19.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(10,21.5),this.context.lineTo(8.5,24.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(21.5,7),this.context.bezierCurveTo(21.5,7,20.5,7.5,20.5,8.5),this.context.bezierCurveTo(20.5,9.5,21,10,21,10),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(12.5,22.5),this.context.lineTo(11.5,25),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(20.5001,22),this.context.bezierCurveTo(20.5001,22,19.3705,22.759,19,23.5),this.context.bezierCurveTo(18.5,24.5,19.0001,25.5,19.0001,25.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(24.5,20.5),this.context.lineTo(25.5,23.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(27.5,15),this.context.lineTo(31,14),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawPlant=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==z?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==z?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==z&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.font="15px ''",this.context.beginPath(),this.context.moveTo(16.0702,14.54),this.context.bezierCurveTo(15.9302,14.31,15.7701,14.05,15.6201,13.76),this.context.bezierCurveTo(14.8408,12.4391,14.4298,10.9336,14.4298,9.39999),this.context.bezierCurveTo(14.4298,7.8664,14.8408,6.36081,15.6201,5.03998),this.context.bezierCurveTo(15.8611,4.58601,16.1317,4.1484,16.4302,3.72998),this.context.bezierCurveTo(16.7286,4.1484,16.9992,4.58601,17.2401,5.03998),this.context.bezierCurveTo(17.9803,6.37702,18.3885,7.87232,18.4302,9.39999),this.context.bezierCurveTo(18.4354,9.47657,18.4354,9.5534,18.4302,9.62997),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(7.9801,15.98),this.context.bezierCurveTo(6.6152,15.993,5.25947,15.7557,3.9801,15.28),this.context.bezierCurveTo(3.60847,15.1397,3.24756,14.9726,2.90015,14.78),this.context.bezierCurveTo(3.21211,14.5116,3.54669,14.2707,3.90015,14.06),this.context.bezierCurveTo(5.22554,13.2482,6.73712,12.7903,8.29016,12.73),this.context.bezierCurveTo(9.15355,12.6749,10.0202,12.7525,10.8601,12.96),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(23.4602,22.59),this.context.bezierCurveTo(23.9779,23.4363,24.3718,24.3522,24.6302,25.31),this.context.bezierCurveTo(24.7381,25.6898,24.815,26.0777,24.8602,26.47),this.context.bezierCurveTo(24.464,26.3786,24.0761,26.2548,23.7002,26.1),this.context.bezierCurveTo(22.2631,25.4958,21.0035,24.5356,20.0402,23.31),this.context.bezierCurveTo(19.0654,22.1493,18.4441,20.7332,18.2502,19.23),this.context.bezierCurveTo(18.2452,19.1935,18.2452,19.1565,18.2502,19.12),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(18.0201,18.79),this.context.bezierCurveTo(18.289,19.8049,18.4268,20.8501,18.4302,21.9),this.context.bezierCurveTo(18.3982,23.7828,17.9865,25.6399,17.2201,27.36),this.context.bezierCurveTo(16.9871,27.9045,16.7234,28.4354,16.4302,28.95),this.context.bezierCurveTo(16.1369,28.4354,15.8731,27.9045,15.6401,27.36),this.context.bezierCurveTo(14.8737,25.6399,14.4622,23.7828,14.4302,21.9),this.context.lineTo(14.4302,21.9),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(15.7802,14.98),this.context.bezierCurveTo(15.7769,14.9568,15.7769,14.9332,15.7802,14.91),this.context.lineTo(16.0302,14.53),this.context.bezierCurveTo(16.1729,14.3156,16.3264,14.1087,16.4901,13.91),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(17.2201,17.35),this.context.bezierCurveTo(16.8106,17.2814,16.4063,17.1845,16.0101,17.06),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(23.9001,9.38),this.context.bezierCurveTo(24.8831,9.14548,25.8897,9.02471,26.9001,9.02002),this.context.bezierCurveTo(27.5704,9.02021,28.2395,9.07706,28.9001,9.19),this.context.lineTo(29.1702,9.24002),this.context.bezierCurveTo(29.1702,9.34002,29.1701,9.44,29.0901,9.56),this.context.bezierCurveTo(28.6759,10.9776,27.9845,12.2989,27.0558,13.4473),this.context.bezierCurveTo(26.1271,14.5957,24.9797,15.5483,23.6802,16.25),this.context.lineTo(23.5502,16.31),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(16.2902,15.19),this.context.bezierCurveTo(16.2902,15.19,16.2902,15.12,16.2902,15.08),this.context.lineTo(16.2902,14.94),this.context.bezierCurveTo(16.3291,14.6435,16.3859,14.3496,16.4602,14.06),this.context.lineTo(16.4602,13.93),this.context.bezierCurveTo(16.8635,12.4153,17.4975,10.9717,18.3401,9.64999),this.context.bezierCurveTo(18.6001,9.23999,18.8802,8.81,19.2002,8.37),this.context.bezierCurveTo(20.5088,6.52287,22.1501,4.93576,24.0402,3.68997),this.context.bezierCurveTo(24.573,3.35365,25.1276,3.053,25.7002,2.78998),this.context.bezierCurveTo(25.7076,3.42365,25.654,4.05658,25.5402,4.67999),this.context.bezierCurveTo(25.2507,6.33791,24.6647,7.93003,23.8102,9.37997),this.context.bezierCurveTo(23.5307,9.86497,23.227,10.3356,22.9001,10.79),this.context.bezierCurveTo(21.6488,12.5924,19.9543,14.0423,17.9801,15),this.context.bezierCurveTo(17.5625,15.1915,17.1314,15.3519,16.6902,15.48),this.context.lineTo(16.3102,15.59),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(12.9901,14.58),this.context.bezierCurveTo(12.2143,14.1057,11.4845,13.56,10.8102,12.95),this.context.bezierCurveTo(10.5402,12.72,10.2701,12.47,10.0001,12.19),this.context.bezierCurveTo(8.5657,10.7859,7.41477,9.11892,6.61011,7.28),this.context.bezierCurveTo(6.39455,6.78774,6.21745,6.27957,6.0802,5.76001),this.context.bezierCurveTo(6.61731,5.84803,7.14586,5.98184,7.66016,6.16),this.context.bezierCurveTo(9.55116,6.80258,11.2641,7.88174,12.6602,9.31),this.context.bezierCurveTo(14.0736,10.6511,15.1084,12.3413,15.6602,14.21),this.context.bezierCurveTo(15.7402,14.49,15.7901,14.76,15.8401,14.99),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(11.1301,22.84),this.context.bezierCurveTo(9.47432,23.8584,7.59868,24.4653,5.66016,24.61),this.context.bezierCurveTo(4.9583,24.6744,4.25203,24.6744,3.55017,24.61),this.context.lineTo(3.16016,24.61),this.context.bezierCurveTo(3.16016,24.49,3.16016,24.33,3.16016,24.15),this.context.bezierCurveTo(3.22801,23.4121,3.36532,22.6821,3.57019,21.97),this.context.bezierCurveTo(4.18103,19.7501,5.52348,17.8015,7.38013,16.44),this.context.bezierCurveTo(7.56306,16.303,7.75341,16.1761,7.9502,16.06),this.context.bezierCurveTo(9.44614,15.1201,11.1838,14.637,12.9502,14.67),this.context.lineTo(13.2701,14.67),this.context.lineTo(13.7201,14.67),this.context.bezierCurveTo(14.3987,14.7284,15.0692,14.8591,15.7201,15.06),this.context.lineTo(15.7201,15.06),this.context.lineTo(15.8701,15.06),this.context.lineTo(16.1902,15.16),this.context.lineTo(16.3302,15.21),this.context.bezierCurveTo(16.3302,15.3,16.3302,15.41,16.3302,15.54),this.context.bezierCurveTo(16.2457,16.0399,16.1186,16.5317,15.9502,17.01),this.context.bezierCurveTo(15.9502,17.08,15.9501,17.16,15.8701,17.24),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(23.5802,16.31),this.context.bezierCurveTo(23.6966,16.364,23.8101,16.4241,23.9202,16.49),this.context.bezierCurveTo(25.4558,17.4575,26.6812,18.8459,27.4502,20.49),this.context.bezierCurveTo(27.7426,21.0659,27.9965,21.6605,28.2102,22.27),this.context.lineTo(28.2902,22.51),this.context.lineTo(28.0402,22.56),this.context.bezierCurveTo(27.4061,22.6801,26.7646,22.757,26.1201,22.79),this.context.bezierCurveTo(25.2303,22.8383,24.3379,22.7846,23.4602,22.63),this.context.bezierCurveTo(22.5677,22.4742,21.7086,22.1664,20.9202,21.72),this.context.bezierCurveTo(19.8482,21.0758,18.9327,20.2014,18.2401,19.16),this.context.lineTo(18.0201,18.83),this.context.bezierCurveTo(17.7901,18.47,17.5801,18.11,17.4001,17.76),this.context.lineTo(17.2201,17.39),this.context.bezierCurveTo(16.9992,16.9318,16.8056,16.461,16.6401,15.98),this.context.lineTo(16.5602,15.74),this.context.lineTo(16.8102,15.69),this.context.bezierCurveTo(17.4312,15.5743,18.0593,15.5008,18.6902,15.47),this.context.bezierCurveTo(20.3653,15.3236,22.0499,15.613,23.5802,16.31),this.context.lineTo(23.5802,16.31),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(11.1301,22.84),this.context.bezierCurveTo(11.2192,21.7269,11.5001,20.6375,11.9602,19.62),this.context.bezierCurveTo(12.5529,18.2225,13.5309,17.0224,14.7802,16.16),this.context.bezierCurveTo(14.9538,16.04,15.1341,15.9298,15.3202,15.83),this.context.lineTo(15.5302,15.73),this.context.bezierCurveTo(15.636,15.6714,15.7463,15.6213,15.8601,15.58),this.context.bezierCurveTo(15.8601,15.66,15.8601,15.74,15.8601,15.84),this.context.bezierCurveTo(15.8723,16.0832,15.8723,16.3268,15.8601,16.57),this.context.bezierCurveTo(15.8601,16.72,15.8601,16.88,15.8601,17.05),this.context.bezierCurveTo(15.8601,17.22,15.8601,17.21,15.8601,17.3),this.context.bezierCurveTo(15.7267,18.5244,15.3887,19.7176,14.8601,20.83),this.context.bezierCurveTo(14.7044,21.192,14.5241,21.5428,14.3202,21.88),this.context.bezierCurveTo(13.759,22.908,13.0288,23.8343,12.1602,24.62),this.context.bezierCurveTo(11.8633,24.887,11.5493,25.1341,11.2201,25.36),this.context.bezierCurveTo(11.1265,24.962,11.063,24.5576,11.0302,24.15),this.context.bezierCurveTo(11.0324,23.7115,11.0658,23.2737,11.1301,22.84),this.context.lineTo(11.1301,22.84),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawDiningTable=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==L?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==L?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==L&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.font="15px ''",this.context.beginPath(),this.context.moveTo(2.5,10.5),this.context.lineTo(29.5,10.5),this.context.lineTo(29.5,21.5),this.context.lineTo(2.5,21.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(14.5,10),this.context.lineTo(14.5,3.5),this.context.lineTo(5.5,3.5),this.context.lineTo(5.5,10),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(14.5,22),this.context.lineTo(14.5,28.5),this.context.lineTo(5.5,28.5),this.context.lineTo(5.5,22),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(26.5,10),this.context.lineTo(26.5,3.5),this.context.lineTo(17.5,3.5),this.context.lineTo(17.5,10),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(26.5,22),this.context.lineTo(26.5,28.5),this.context.lineTo(17.5,28.5),this.context.lineTo(17.5,22),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(6,5.5),this.context.lineTo(14,5.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(6,26.5),this.context.lineTo(14,26.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(18,5.5),this.context.lineTo(26,5.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(18,26.5),this.context.lineTo(26,26.5),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawDoubleBed=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==M?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==M?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==M&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.beginPath(),this.context.moveTo(4.5,3.5),this.context.lineTo(27.5,3.5),this.context.lineTo(27.5,28.5),this.context.lineTo(4.5,28.5),this.context.lineTo(4.5,3.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(4.5,9.5),this.context.lineTo(27.5,9.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(14.5,9.5),this.context.lineTo(14.5,7.5),this.context.bezierCurveTo(14.5,6.39543,13.6046,5.5,12.5,5.5),this.context.lineTo(8.5,5.5),this.context.bezierCurveTo(7.39543,5.5,6.5,6.39543,6.5,7.5),this.context.lineTo(6.5,9.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(25.5,9.5),this.context.lineTo(25.5,7.5),this.context.bezierCurveTo(25.5,6.39543,24.6046,5.5,23.5,5.5),this.context.lineTo(19.5,5.5),this.context.bezierCurveTo(18.3954,5.5,17.5,6.39543,17.5,7.5),this.context.lineTo(17.5,9.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(4.5,12.5),this.context.lineTo(27.5,12.5),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawSingleBed=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==R?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==R?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==R&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.beginPath(),this.context.moveTo(7.5,3.5),this.context.lineTo(24.5,3.5),this.context.lineTo(24.5,28.5),this.context.lineTo(7.5,28.5),this.context.lineTo(7.5,3.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(7.5,9.5),this.context.lineTo(24.5,9.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(7.5,12.5),this.context.lineTo(24.5,12.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(20.5,9.5),this.context.lineTo(20.5,7.5),this.context.bezierCurveTo(20.5,6.39543,19.6046,5.5,18.5,5.5),this.context.lineTo(13.5,5.5),this.context.bezierCurveTo(12.3954,5.5,11.5,6.39543,11.5,7.5),this.context.lineTo(11.5,9.5),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawWardrobe=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==O?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==O?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==O&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.beginPath(),this.context.moveTo(1.5,7.5),this.context.lineTo(30.5,7.5),this.context.lineTo(30.5,24.5),this.context.lineTo(1.5,24.5),this.context.lineTo(1.5,7.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(3.5,9.5),this.context.lineTo(28.5,9.5),this.context.lineTo(28.5,22.5),this.context.lineTo(3.5,22.5),this.context.lineTo(3.5,9.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(4,15.5),this.context.lineTo(28,15.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(6.5,12),this.context.lineTo(7.5,19),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(10.5,12),this.context.lineTo(10.5,19),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(15.5,12),this.context.lineTo(15.5,19),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(19.5,12),this.context.lineTo(21.5,19),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(25.5,12),this.context.lineTo(25.5,19),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawDresser=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==A?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==A?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==A&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.beginPath(),this.context.moveTo(2.5,3.5),this.context.lineTo(29.5,3.5),this.context.lineTo(29.5,15.5),this.context.bezierCurveTo(29.5,16.6046,28.6046,17.5,27.5,17.5),this.context.lineTo(4.5,17.5),this.context.bezierCurveTo(3.39543,17.5,2.5,16.6046,2.5,15.5),this.context.lineTo(2.5,3.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(7.5,5.5),this.context.lineTo(24.5,5.5),this.context.lineTo(24.5,7.5),this.context.lineTo(7.5,7.5),this.context.lineTo(7.5,5.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(9.5,25),this.context.bezierCurveTo(9.5,23.067,11.067,21.5,13,21.5),this.context.lineTo(19,21.5),this.context.bezierCurveTo(20.933,21.5,22.5,23.067,22.5,25),this.context.lineTo(22.5,25),this.context.bezierCurveTo(22.5,26.933,20.933,28.5,19,28.5),this.context.lineTo(13,28.5),this.context.bezierCurveTo(11.067,28.5,9.5,26.933,9.5,25),this.context.lineTo(9.5,25),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawBedsideCupboard=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==E?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==E?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==E&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.font="15px ''",this.context.beginPath(),this.context.moveTo(2.5,3.5),this.context.lineTo(28.5,3.5),this.context.lineTo(28.5,29.5),this.context.lineTo(2.5,29.5),this.context.lineTo(2.5,3.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(4.5,5.5),this.context.lineTo(26.5,5.5),this.context.lineTo(26.5,27.5),this.context.lineTo(4.5,27.5),this.context.lineTo(4.5,5.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(23.5,16.5),this.context.bezierCurveTo(23.5,20.9183,19.9183,24.5,15.5,24.5),this.context.bezierCurveTo(11.0817,24.5,7.5,20.9183,7.5,16.5),this.context.bezierCurveTo(7.5,12.0817,11.0817,8.5,15.5,8.5),this.context.bezierCurveTo(19.9183,8.5,23.5,12.0817,23.5,16.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(20.5,16.5),this.context.bezierCurveTo(20.5,19.2614,18.2614,21.5,15.5,21.5),this.context.bezierCurveTo(12.7386,21.5,10.5,19.2614,10.5,16.5),this.context.bezierCurveTo(10.5,13.7386,12.7386,11.5,15.5,11.5),this.context.bezierCurveTo(18.2614,11.5,20.5,13.7386,20.5,16.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(20.5,16.5),this.context.bezierCurveTo(20.5,19.2614,18.2614,21.5,15.5,21.5),this.context.bezierCurveTo(12.7386,21.5,10.5,19.2614,10.5,16.5),this.context.bezierCurveTo(10.5,13.7386,12.7386,11.5,15.5,11.5),this.context.bezierCurveTo(18.2614,11.5,20.5,13.7386,20.5,16.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(16.5,16.5),this.context.bezierCurveTo(16.5,17.0523,16.0523,17.5,15.5,17.5),this.context.bezierCurveTo(14.9477,17.5,14.5,17.0523,14.5,16.5),this.context.bezierCurveTo(14.5,15.9477,14.9477,15.5,15.5,15.5),this.context.bezierCurveTo(16.0523,15.5,16.5,15.9477,16.5,16.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(11,18.5),this.context.lineTo(14.5,17),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(16.5,17),this.context.lineTo(20,18.5),this.context.moveTo(15.5,11.5),this.context.lineTo(15.5,15.5),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawPillow=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==B?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==B?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==B&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.beginPath(),this.context.moveTo(18.0747,9),this.context.bezierCurveTo(16.2223,9.05191,14.3762,9.23862,12.5513,9.55861),this.context.bezierCurveTo(11.8131,9.80487,11.014,9.80487,10.2758,9.55861),this.context.bezierCurveTo(8.86176,9.28479,8.69606,10.8291,9.17107,11.7492),this.context.bezierCurveTo(9.01642,12.3187,8.78433,13.2716,8.65177,13.8631),this.context.bezierCurveTo(7.54709,17.9485,8.14367,21.3439,8.98323,25.3198),this.context.bezierCurveTo(9.16793,25.9353,9.14078,26.5943,8.90596,27.1928),this.context.bezierCurveTo(8.62979,28.6276,10.2315,28.7262,11.1815,28.2881),this.context.bezierCurveTo(15.52,29.157,19.9815,29.2386,24.3494,28.529),this.context.bezierCurveTo(24.7471,28.529,25.454,28.3538,25.7964,28.3428),this.context.bezierCurveTo(26.7354,28.6057,28.3593,28.6824,28.1826,27.2475),this.context.bezierCurveTo(27.8733,26.4132,27.8733,25.497,28.1826,24.6626),this.context.bezierCurveTo(28.4367,23.414,28.6686,22.0449,28.8343,20.7744),this.context.bezierCurveTo(29.6297,17.4885,27.8512,14.2026,28.0611,10.9168),this.context.bezierCurveTo(28.1106,10.7308,28.1099,10.5352,28.0589,10.3496),this.context.bezierCurveTo(28.008,10.164,27.9086,9.99502,27.7709,9.85957),this.context.bezierCurveTo(27.6332,9.72413,27.462,9.62701,27.2744,9.57803),this.context.bezierCurveTo(27.0868,9.52904,26.8895,9.5299,26.7024,9.5805),this.context.bezierCurveTo(26.3084,9.74462,25.8765,9.7977,25.4541,9.73386),this.context.bezierCurveTo(23.013,9.33025,20.548,9.0851,18.0747,9),this.context.lineTo(18.0747,9),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(23.4453,9.5),this.context.bezierCurveTo(23.2025,8.27344,22.9884,7.04688,23.067,5.82031),this.context.bezierCurveTo(23.1141,5.64371,23.1134,5.45793,23.0649,5.28169),this.context.bezierCurveTo(23.0164,5.10544,22.9217,4.94495,22.7905,4.81632),this.context.bezierCurveTo(22.6593,4.68769,22.4961,4.59547,22.3174,4.54894),this.context.bezierCurveTo(22.1387,4.50242,21.9507,4.50323,21.7724,4.55129),this.context.bezierCurveTo(21.3971,4.70716,20.9855,4.75756,20.5831,4.69693),this.context.bezierCurveTo(18.2573,4.31363,15.9087,4.08082,13.5522,4),this.context.bezierCurveTo(11.7872,4.0493,10.0283,4.22661,8.28964,4.5305),this.context.bezierCurveTo(7.58628,4.76437,6.82488,4.76437,6.12153,4.5305),this.context.bezierCurveTo(4.77431,4.27046,4.61643,5.73711,5.06901,6.61086),this.context.bezierCurveTo(4.92166,7.15175,4.70054,8.0567,4.57423,8.6184),this.context.bezierCurveTo(3.52172,12.4983,4.09013,15.7228,4.89004,19.4987),this.context.bezierCurveTo(5.06602,20.0832,5.04015,20.709,4.81642,21.2774),this.context.bezierCurveTo(4.55329,22.64,6.07937,22.7337,6.98453,22.3176),this.context.bezierCurveTo(7.41836,22.4042,7.85347,22.4826,8.28964,22.5527),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawGasStove=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==_?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==_?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==_&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.beginPath(),this.context.moveTo(.5,7.5),this.context.bezierCurveTo(.5,6.94771,.947715,6.5,1.5,6.5),this.context.lineTo(30.5,6.5),this.context.bezierCurveTo(31.0523,6.5,31.5,6.94772,31.5,7.5),this.context.lineTo(31.5,24.5),this.context.bezierCurveTo(31.5,25.0523,31.0523,25.5,30.5,25.5),this.context.lineTo(1.5,25.5),this.context.bezierCurveTo(.947716,25.5,.5,25.0523,.5,24.5),this.context.lineTo(.5,7.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(1,19.5),this.context.lineTo(31,19.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(13.5,13),this.context.bezierCurveTo(13.5,15.4853,11.4853,17.5,9,17.5),this.context.bezierCurveTo(6.51472,17.5,4.5,15.4853,4.5,13),this.context.bezierCurveTo(4.5,10.5147,6.51472,8.5,9,8.5),this.context.bezierCurveTo(11.4853,8.5,13.5,10.5147,13.5,13),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(13.5,22),this.context.bezierCurveTo(13.5,22.2761,13.2761,22.5,13,22.5),this.context.bezierCurveTo(12.7239,22.5,12.5,22.2761,12.5,22),this.context.bezierCurveTo(12.5,21.7239,12.7239,21.5,13,21.5),this.context.bezierCurveTo(13.2761,21.5,13.5,21.7239,13.5,22),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(19.5,22),this.context.bezierCurveTo(19.5,22.2761,19.2761,22.5,19,22.5),this.context.bezierCurveTo(18.7239,22.5,18.5,22.2761,18.5,22),this.context.bezierCurveTo(18.5,21.7239,18.7239,21.5,19,21.5),this.context.bezierCurveTo(19.2761,21.5,19.5,21.7239,19.5,22),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(10.5,13),this.context.bezierCurveTo(10.5,13.8284,9.82843,14.5,9,14.5),this.context.bezierCurveTo(8.17157,14.5,7.5,13.8284,7.5,13),this.context.bezierCurveTo(7.5,12.1716,8.17157,11.5,9,11.5),this.context.bezierCurveTo(9.82843,11.5,10.5,12.1716,10.5,13),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(4.5,8.5),this.context.lineTo(6.5,10.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(11.5,15.5),this.context.lineTo(13.5,17.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(6.5,15.5),this.context.lineTo(4.5,17.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(27.5,13),this.context.bezierCurveTo(27.5,15.4853,25.4853,17.5,23,17.5),this.context.bezierCurveTo(20.5147,17.5,18.5,15.4853,18.5,13),this.context.bezierCurveTo(18.5,10.5147,20.5147,8.5,23,8.5),this.context.bezierCurveTo(25.4853,8.5,27.5,10.5147,27.5,13),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(24.5,13),this.context.bezierCurveTo(24.5,13.8284,23.8284,14.5,23,14.5),this.context.bezierCurveTo(22.1716,14.5,21.5,13.8284,21.5,13),this.context.bezierCurveTo(21.5,12.1716,22.1716,11.5,23,11.5),this.context.bezierCurveTo(23.8284,11.5,24.5,12.1716,24.5,13),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(18.5,8.5),this.context.lineTo(20.5,10.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(25.5,15.5),this.context.lineTo(27.5,17.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(20.5,15.5),this.context.lineTo(18.5,17.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(13.5,8.5),this.context.lineTo(11.5,10.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(27.5,8.5),this.context.lineTo(25.5,10.5),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawCupboard=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==Y?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==Y?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==Y&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.beginPath(),this.context.moveTo(20,7.5),this.context.bezierCurveTo(20.8284,7.5,21.5,6.82843,21.5,6),this.context.bezierCurveTo(21.5,5.17157,20.8284,4.5,20,4.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(20,27.5),this.context.bezierCurveTo(20.8284,27.5,21.5,26.8284,21.5,26),this.context.bezierCurveTo(21.5,25.1716,20.8284,24.5,20,24.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(20,17.5),this.context.bezierCurveTo(20.8284,17.5,21.5,16.8284,21.5,16),this.context.bezierCurveTo(21.5,15.1716,20.8284,14.5,20,14.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(10.5,.5),this.context.lineTo(19.5,.5),this.context.lineTo(19.5,31.5),this.context.lineTo(10.5,31.5),this.context.lineTo(10.5,.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(17.5,1),this.context.lineTo(17.5,31),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(11,21.5),this.context.lineTo(19,21.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(11.5,10.5),this.context.lineTo(19,10.5),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawBathtub=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==N?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==N?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==N&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.beginPath(),this.context.moveTo(.5,7.5),this.context.lineTo(31.5,7.5),this.context.lineTo(31.5,24.5),this.context.lineTo(.5,24.5),this.context.lineTo(.5,7.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(2.5,16),this.context.bezierCurveTo(2.5,12.4101,5.41015,9.5,9,9.5),this.context.lineTo(23,9.5),this.context.bezierCurveTo(26.5899,9.5,29.5,12.4101,29.5,16),this.context.lineTo(29.5,16),this.context.bezierCurveTo(29.5,19.5899,26.5899,22.5,23,22.5),this.context.lineTo(9,22.5),this.context.bezierCurveTo(5.41015,22.5,2.5,19.5899,2.5,16),this.context.lineTo(2.5,16),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(1,15.5),this.context.lineTo(5.5,15.5),this.context.lineTo(5.5,16.5),this.context.lineTo(1,16.5),this.context.lineTo(1,15.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(26.5,16),this.context.bezierCurveTo(26.5,16.2761,26.2761,16.5,26,16.5),this.context.bezierCurveTo(25.7239,16.5,25.5,16.2761,25.5,16),this.context.bezierCurveTo(25.5,15.7239,25.7239,15.5,26,15.5),this.context.bezierCurveTo(26.2761,15.5,26.5,15.7239,26.5,16),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(11.5,20.5),this.context.lineTo(20.5,20.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(13.5,20.5),this.context.lineTo(13.5,22.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(18.5,20.5),this.context.lineTo(18.5,22.5),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawClosestool=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==X?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==X?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==X&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.beginPath(),this.context.moveTo(5.5,3.5),this.context.bezierCurveTo(5.5,2.94772,5.94772,2.5,6.5,2.5),this.context.lineTo(25.5,2.5),this.context.bezierCurveTo(26.0523,2.5,26.5,2.94772,26.5,3.5),this.context.lineTo(26.5,9.5),this.context.bezierCurveTo(26.5,10.0523,26.0523,10.5,25.5,10.5),this.context.lineTo(6.5,10.5),this.context.bezierCurveTo(5.94772,10.5,5.5,10.0523,5.5,9.5),this.context.lineTo(5.5,3.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(9.5,12.6485),this.context.bezierCurveTo(9.5,12.5665,9.56649,12.5,9.64851,12.5),this.context.lineTo(22.3515,12.5),this.context.bezierCurveTo(22.4335,12.5,22.5,12.5665,22.5,12.6485),this.context.lineTo(22.5,21),this.context.bezierCurveTo(22.5,24.5899,19.5899,27.5,16,27.5),this.context.lineTo(16,27.5),this.context.bezierCurveTo(12.4101,27.5,9.5,24.5899,9.5,21),this.context.lineTo(9.5,12.6485),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(7.5,10.5),this.context.lineTo(7.5,21),this.context.bezierCurveTo(7.5,25.6944,11.3056,29.5,16,29.5),this.context.lineTo(16,29.5),this.context.bezierCurveTo(20.6944,29.5,24.5,25.6944,24.5,21),this.context.lineTo(24.5,10.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(17.5,6),this.context.bezierCurveTo(17.5,6.82843,16.8284,7.5,16,7.5),this.context.bezierCurveTo(15.1716,7.5,14.5,6.82843,14.5,6),this.context.bezierCurveTo(14.5,5.17157,15.1716,4.5,16,4.5),this.context.bezierCurveTo(16.8284,4.5,17.5,5.17157,17.5,6),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawWashstand=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==j?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==j?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==j&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.font="15px ''",this.context.beginPath(),this.context.moveTo(13.5,9),this.context.bezierCurveTo(13.5,9.27614,13.2761,9.5,13,9.5),this.context.bezierCurveTo(12.7239,9.5,12.5,9.27614,12.5,9),this.context.bezierCurveTo(12.5,8.72386,12.7239,8.5,13,8.5),this.context.bezierCurveTo(13.2761,8.5,13.5,8.72386,13.5,9),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(19.5,9),this.context.bezierCurveTo(19.5,9.27614,19.2761,9.5,19,9.5),this.context.bezierCurveTo(18.7239,9.5,18.5,9.27614,18.5,9),this.context.bezierCurveTo(18.5,8.72386,18.7239,8.5,19,8.5),this.context.bezierCurveTo(19.2761,8.5,19.5,8.72386,19.5,9),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(16.5,17),this.context.bezierCurveTo(16.5,17.2761,16.2761,17.5,16,17.5),this.context.bezierCurveTo(15.7239,17.5,15.5,17.2761,15.5,17),this.context.bezierCurveTo(15.5,16.7239,15.7239,16.5,16,16.5),this.context.bezierCurveTo(16.2761,16.5,16.5,16.7239,16.5,17),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(26.5,17),this.context.bezierCurveTo(26.5,20.0376,21.799,22.5,16,22.5),this.context.bezierCurveTo(10.201,22.5,5.5,20.0376,5.5,17),this.context.bezierCurveTo(5.5,13.9624,10.201,11.5,16,11.5),this.context.bezierCurveTo(21.799,11.5,26.5,13.9624,26.5,17),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(2.5,6.5),this.context.lineTo(29.5,6.5),this.context.lineTo(29.5,25.5),this.context.lineTo(2.5,25.5),this.context.lineTo(2.5,6.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(15.5,9),this.context.bezierCurveTo(15.5,8.72386,15.7239,8.5,16,8.5),this.context.lineTo(16,8.5),this.context.bezierCurveTo(16.2761,8.5,16.5,8.72386,16.5,9),this.context.lineTo(16.5,14),this.context.bezierCurveTo(16.5,14.2761,16.2761,14.5,16,14.5),this.context.lineTo(16,14.5),this.context.bezierCurveTo(15.7239,14.5,15.5,14.2761,15.5,14),this.context.lineTo(15.5,9),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawDesk=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==U?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==U?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==U&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.beginPath(),this.context.moveTo(3.5,6.5),this.context.lineTo(28.5,6.5),this.context.lineTo(28.5,18.5),this.context.lineTo(3.5,18.5),this.context.lineTo(3.5,6.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(11.5,19),this.context.lineTo(11.5,21),this.context.bezierCurveTo(11.5,23.4853,13.5147,25.5,16,25.5),this.context.lineTo(16,25.5),this.context.bezierCurveTo(18.4853,25.5,20.5,23.4853,20.5,21),this.context.lineTo(20.5,19),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(15.5,9.5),this.context.lineTo(25.5,9.5),this.context.lineTo(25.5,15.5),this.context.lineTo(15.5,15.5),this.context.lineTo(15.5,9.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(20.5,10),this.context.lineTo(20.5,15),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(17.5,11.5),this.context.lineTo(18.5,11.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(22.5,11.5),this.context.lineTo(23.5,11.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(17.5,13.5),this.context.lineTo(18.5,13.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(22.5,13.5),this.context.lineTo(23.5,13.5),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawBalconyChair=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==J?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==J?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==J&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.beginPath(),this.context.arc(16,16,4.5,0,6.283185307179586,!1),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(.5,12.3182),this.context.bezierCurveTo(.5,11.8663,.866313,11.5,1.31818,11.5),this.context.lineTo(8.68182,11.5),this.context.bezierCurveTo(9.13369,11.5,9.5,11.8663,9.5,12.3182),this.context.lineTo(9.5,16),this.context.bezierCurveTo(9.5,18.4853,7.48528,20.5,5,20.5),this.context.lineTo(5,20.5),this.context.bezierCurveTo(2.51472,20.5,.5,18.4853,.5,16),this.context.lineTo(.5,12.3182),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(22.5,12.3182),this.context.bezierCurveTo(22.5,11.8663,22.8663,11.5,23.3182,11.5),this.context.lineTo(30.6818,11.5),this.context.bezierCurveTo(31.1337,11.5,31.5,11.8663,31.5,12.3182),this.context.lineTo(31.5,16),this.context.bezierCurveTo(31.5,18.4853,29.4853,20.5,27,20.5),this.context.lineTo(27,20.5),this.context.bezierCurveTo(24.5147,20.5,22.5,18.4853,22.5,16),this.context.lineTo(22.5,12.3182),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(.5,13.5),this.context.lineTo(.5,13.5),this.context.bezierCurveTo(.5,15.9853,2.51472,18,5,18),this.context.lineTo(5,18),this.context.bezierCurveTo(7.48528,18,9.5,15.9853,9.5,13.5),this.context.lineTo(9.5,13.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(22.5,13.5),this.context.lineTo(22.5,13.5),this.context.bezierCurveTo(22.5,15.9853,24.5147,18,27,18),this.context.lineTo(27,18),this.context.bezierCurveTo(29.4853,18,31.5,15.9853,31.5,13.5),this.context.lineTo(31.5,13.5),this.context.fill(),this.context.stroke(),this.context.restore()},Eo.prototype.drawElevator=function(t,e){var o=ee.getSelectItem(),i=ee.getDraggingItem(),n=ee.getFocusItem();this.context.save(),this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Ro.style1.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Ro.style2.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Ro.style3.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Ro.style4.Furniture.lineWidth*le.ratio,this.context.strokeStyle=Ro.style4.Furniture.strokeStyle):o&&o.type==V?t.vectorId==o.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):i&&i.type==V?t.vectorId==i.vectorId&&(this.context.strokeStyle=Co.Furniture.strokeStyle,this.context.fillStyle=Co.Furniture.fillStyle,this.drawRec(t)):n&&n.type==V&&t.vectorId==n.vectorId&&(this.context.strokeStyle=Wo.Furniture.strokeStyle,this.context.fillStyle=Wo.Furniture.fillStyle,this.drawRec(t));var s=le.getScreenXY({x:t.center.x,y:t.center.y}),r=le.getScreenXY({x:t.center.x-t.getScale()*t.zoom/2,y:t.center.y+t.getScale()*t.zoom/2});this.context.translate(s.x,s.y),this.context.rotate(t.angle/180*Math.PI),this.context.translate(r.x-s.x,r.y-s.y),this.context.scale(t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom,t.getScale()*t.zoom*le.res/a.furnitureWidth*le.ratio*le.zoom/a.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*le.res*le.zoom/a.defaultZoom/a.furnitureWidth),this.context.miterLimit=4,this.context.font="15px ''",this.context.beginPath(),this.context.moveTo(2.5,29.5),this.context.lineTo(10.5,29.5),this.context.lineTo(10.5,27.5),this.context.lineTo(4.5,27.5),this.context.lineTo(4.5,4.5),this.context.lineTo(27.5,4.5),this.context.lineTo(27.5,27.5),this.context.lineTo(20.5,27.5),this.context.lineTo(20.5,29.5),this.context.lineTo(29.5,29.5),this.context.lineTo(29.5,2.5),this.context.lineTo(2.5,2.5),this.context.lineTo(2.5,29.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(11,28.5),this.context.lineTo(20,28.5),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(8.5,9.5),this.context.lineTo(8.5,7.5),this.context.lineTo(23.5,7.5),this.context.lineTo(23.5,9.5),this.context.lineTo(8.5,9.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(24.5,12.5),this.context.lineTo(7.5,12.5),this.context.lineTo(7.5,24.5),this.context.lineTo(24.5,24.5),this.context.lineTo(24.5,12.5),this.context.closePath(),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(8,13),this.context.lineTo(24,24),this.context.fill(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(24,13),this.context.lineTo(8,24),this.context.fill(),this.context.stroke(),this.context.restore()};var Bo=new Eo,_o=function(){this.start=null,this.startCenter=null,this.dx=null,this.dy=null,this.reset=!1,this.screenPoints=null};_o.prototype.setStart=function(t,e,o){if(null==this.start){this.start={x:t.x,y:t.y};var i=null;xt.isComponent(o)?i=he.getComponent(e):Qt.isFurniture(o)&&(i=he.getFurniture(e)),this.reset||(this.reset=!0,c.clonePoint(i.center,t)),this.dx=0,this.dy=0,this.startCenter={x:i.center.x,y:i.center.y}}else this.dx=t.x-this.start.x,this.dy=t.y-this.start.y},_o.prototype.moveFull=function(t,e,o){var i=null,n=null,s=null;this.setAdsorbRec(),Be.hideSignLine1(),Be.hideSignLine2(),xt.isComponent(o)?(i=he.getComponent(e),s={x:this.startCenter.x+this.dx,y:this.startCenter.y+this.dy},n=xt.getBoundingVertexs(e,s)):Qt.isFurniture(o)&&(i=he.getFurniture(e),s={x:this.startCenter.x+this.dx,y:this.startCenter.y+this.dy},n=i.getBoundingVertexs(s),i.points2d=i.getBoundingVertexs(i.center));var r=this.getNearComponentsFurnitures(e,n);if(r.length>0&&(s=r[0].side?this.updateCenterForComponentFurniture2(r[0].vectorId,r[0].type,r[0].side,s):this.updateCenterForComponentFurniture(r[0].vectorId,r[0].type,r[0].sideIndex,r[0].selfSideIndex,s,n,r[0].distance),xt.isComponent(o)?n=xt.getBoundingVertexs(e,s):Qt.isFurniture(o)&&(n=i.getBoundingVertexs(s)),r.length>1&&(s=r[1].side?this.updateCenterForComponentFurniture2(r[1].vectorId,r[1].type,r[1].side,s):this.updateCenterForComponentFurniture(r[1].vectorId,r[1].type,r[1].sideIndex,r[1].selfSideIndex,s,n,r[1].distance))),r.length<2){var l=this.getNearWalls(n);l.length>0&&(s=this.updateCenterForWall(l[0].vectorId,l[0].selfSideIndex,s,n,l[0].distance),xt.isComponent(o)?n=xt.getBoundingVertexs(e,s):Qt.isFurniture(o)&&(n=i.getBoundingVertexs(s)),0==r.length&&l.length>1&&(s=this.updateCenterForWall(l[1].vectorId,l[1].selfSideIndex,s,n,l[1].distance)))}return s.x=c.getFixed(s.x),s.y=c.getFixed(s.y),c.clonePoint(i.center,s),xt.isComponent(o)&&i.setPoints2d(),null},_o.prototype.isInScreen=function(t){return t.x>this.screenPoints[0].x&&t.x<this.screenPoints[1].x&&t.y<this.screenPoints[0].y&&t.y>this.screenPoints[3].y},_o.prototype.getNearWalls=function(t){var e=[],o=c.createLine1(t[0],t[1]),i=c.createLine1(t[1],t[2]),n=c.createLine1(t[2],t[3]),s=c.createLine1(t[3],t[0]),r=he.getWalls(),l=null,h=null,u=null,d=null,p=null,x=null;for(var g in r){var f=r[g],m=null;m=f.out?bo.lineWidth_out/le.res/2*a.defaultZoom/le.zoom:bo.lineWidth/le.res/2*a.defaultZoom/le.zoom;var v=he.getPoint(f.start),S=he.getPoint(f.end),P=c.createLine1(v,S),b=null,I=null,k=null,T=null;if(this.isParallel(o,P)&&this.isCloseForTwoSegments(t[0],t[1],v,S)?(b=c.getDisForPoinLine(t[0],P),b-=m,I=[0,1],this.isAdsorb(b)||(b=null,I=null)):this.isParallel(i,P)&&this.isCloseForTwoSegments(t[1],t[2],v,S)&&(k=c.getDisForPoinLine(t[1],P),k-=m,T=[1,2],this.isAdsorb(k)||(k=null,T=null)),this.isParallel(n,P)&&this.isCloseForTwoSegments(t[2],t[3],v,S)){var F=c.getDisForPoinLine(t[2],P);F-=m,this.isAdsorb(F)&&(null==b||F<b)&&(b=F,I=[2,3])}else if(this.isParallel(s,P)&&this.isCloseForTwoSegments(t[3],t[0],v,S)){var w=c.getDisForPoinLine(t[3],P);w-=m,this.isAdsorb(w)&&(null==k||w<k)&&(k=w,T=[0,3])}null==b&&null==k||(null!=b?(null==l||l>b)&&(l=b,h=I,u=g):null!=k&&(null==d||d>k)&&(d=k,p=T,x=g))}return null!=l&&e.push({vectorId:u,type:y,distance:l,selfSideIndex:h}),null!=d&&e.push({vectorId:x,type:y,distance:d,selfSideIndex:p}),e},_o.prototype.getNearComponentsFurnitures=function(t,e){var o=c.createLine1(e[0],e[1]),i=c.createLine1(e[1],e[2]),n=[],s=he.getComponents(),r=he.getFurnitures(),l=(e[0].x+e[1].x+e[2].x+e[3].x)/4,a=(e[0].y+e[1].y+e[2].y+e[3].y)/4,h=null,u=null,d=null,y=null,p=null,x=null,g=null,f=null,m=null,v=null,S=null,P=null,b=null,I=null,k=null,T=null;for(var F in s)if(F!=t){var w=s[F];if(this.isInScreen(w.center)){var C=c.createLine1(w.points2d[0],w.points2d[1]),W=c.createLine1(w.points2d[1],w.points2d[2]),D=c.createLine1(w.points2d[2],w.points2d[3]),z=c.createLine1(w.points2d[3],w.points2d[0]),L=null,M=null,R=null,O=null;if(this.isParallel(o,C)&&this.isCloseForTwoSegments(e[0],e[1],w.points2d[0],w.points2d[1])){L=c.getDisForPoinLine(e[0],C),M=c.getDisForPoinLine(e[0],D),R=c.getDisForPoinLine(e[3],C),O=c.getDisForPoinLine(e[3],D);var A=Math.min(L,M,R,O);this.isAdsorb(A)&&(null==y||y>A)&&(A==L?(h=F,p=w.geoType,u=[0,1],d=[0,1],y=A):A==M?(h=F,p=w.geoType,u=[2,3],d=[0,1],y=A):A==R?(h=F,p=w.geoType,u=[0,1],d=[2,3],y=A):A==O&&(h=F,p=w.geoType,u=[2,3],d=[2,3],y=A))}if(this.isParallel(i,W)&&this.isCloseForTwoSegments(e[1],e[2],w.points2d[1],w.points2d[2])){L=c.getDisForPoinLine(e[1],W),M=c.getDisForPoinLine(e[1],z),R=c.getDisForPoinLine(e[0],W),O=c.getDisForPoinLine(e[0],z);var E=Math.min(L,M,R,O);this.isAdsorb(E)&&(null==m||m>E)&&(E==L?(x=F,v=w.geoType,g=[1,2],f=[1,2],m=E):E==M?(x=F,v=w.geoType,g=[0,3],f=[1,2],m=E):E==R?(x=F,v=w.geoType,g=[1,2],f=[0,3],m=E):E==O&&(x=F,v=w.geoType,g=[0,3],f=[0,3],m=E))}this.isAdsorb(Math.abs(w.center.x-l))&&(null==P||P>Math.abs(w.center.x-l))&&(S=F,b=w.geoType,P=Math.abs(w.center.x-l)),this.isAdsorb(Math.abs(w.center.y-a))&&(null==k||k>Math.abs(w.center.y-a))&&(I=F,T=w.geoType,k=Math.abs(w.center.y-a))}}for(var B in r)if(B!=t){var _=r[B];if(this.isInScreen(_.center)){_.points2d=_.getBoundingVertexs(_.center);var Y=c.createLine1(_.points2d[0],_.points2d[1]),N=c.createLine1(_.points2d[1],_.points2d[2]),X=c.createLine1(_.points2d[2],_.points2d[3]),j=c.createLine1(_.points2d[3],_.points2d[0]),U=null,J=null,V=null,H=null;if(this.isParallel(o,Y)&&this.isCloseForTwoSegments(e[0],e[1],_.points2d[0],_.points2d[1])){U=c.getDisForPoinLine(e[0],Y),J=c.getDisForPoinLine(e[0],X),V=c.getDisForPoinLine(e[3],Y),H=c.getDisForPoinLine(e[3],X);var $=Math.min(U,J,V,H);this.isAdsorb($)&&(null==y||y>$)&&($==U?(h=B,p=_.geoType,u=[0,1],d=[0,1],y=$):$==J?(h=B,p=_.geoType,u=[2,3],d=[0,1],y=$):$==V?(h=B,p=_.geoType,u=[0,1],d=[2,3],y=$):$==H&&(h=B,p=_.geoType,u=[2,3],d=[2,3],y=$))}if(this.isParallel(i,N)&&this.isCloseForTwoSegments(e[1],e[2],_.points2d[1],_.points2d[2])){U=c.getDisForPoinLine(e[1],N),J=c.getDisForPoinLine(e[1],j),V=c.getDisForPoinLine(e[0],N),H=c.getDisForPoinLine(e[0],j);var Z=Math.min(U,J,V,H);this.isAdsorb(Z)&&(null==m||m>Z)&&(Z==U?(x=B,v=_.geoType,g=[1,2],f=[1,2],m=Z):Z==J?(x=B,v=_.geoType,g=[0,3],f=[1,2],m=Z):Z==V?(x=B,v=_.geoType,g=[1,2],f=[0,3],m=Z):Z==H&&(x=B,v=_.geoType,g=[0,3],f=[0,3],m=Z))}this.isAdsorb(Math.abs(_.center.x-l))&&(null==P||P>Math.abs(_.center.x-l))&&(S=B,b=_.geoType,P=Math.abs(_.center.x-l)),this.isAdsorb(Math.abs(_.center.y-a))&&(null==k||k>Math.abs(_.center.y-a))&&(I=B,T=_.geoType,k=Math.abs(_.center.y-a))}}return null!=y&&(o.hasOwnProperty("x")&&null!=P?(y>=P&&(n.push({vectorId:S,type:b,distance:P,side:"x"}),y=null),P=null):o.hasOwnProperty("y")&&null!=k&&(y>=k&&(n.push({vectorId:I,type:T,distance:k,side:"y"}),y=null),k=null),null!=y&&n.push({vectorId:h,type:p,distance:y,sideIndex:u,selfSideIndex:d})),null!=m&&(i.hasOwnProperty("x")&&null!=P?(m>=P&&(n.push({vectorId:S,type:b,distance:P,side:"x"}),m=null),P=null):i.hasOwnProperty("y")&&null!=k&&(m>=k&&(n.push({vectorId:I,type:T,distance:k,side:"y"}),m=null),k=null),null!=m&&n.push({vectorId:x,type:v,distance:m,sideIndex:g,selfSideIndex:f})),0==n.length?(null!=P&&n.push({vectorId:S,type:b,distance:P,side:"x"}),null!=k&&n.push({vectorId:I,type:T,distance:k,side:"y"})):1==n.length&&(null!=P?n.push({vectorId:S,type:b,distance:P,side:"x"}):null!=k&&n.push({vectorId:I,type:T,distance:k,side:"y"})),n},_o.prototype.isAdsorb=function(t){return t<a.minAdsorbRec/le.res},_o.prototype.showSignLine=function(t,e,o,i,n,s){var r={x:(i[n[0]].x+i[n[1]].x)/2,y:(i[n[0]].y+i[n[1]].y)/2};r=c.translate(r,t,r,e);var l=c.createLine3(o,r),a=le.getXYFromScreen({x:0,y:0});null==(a=c.getIntersectionPoint(l,{x:a.x}))&&(a=le.getXYFromScreen({x:0,y:0}),a=c.getIntersectionPoint(l,{y:a.y}));var h=le.getXYFromScreen({x:le.width,y:le.height});null==(h=c.getIntersectionPoint(l,{x:h.x}))&&(h=le.getXYFromScreen({x:le.width,y:le.height}),h=c.getIntersectionPoint(l,{y:h.y})),0==s?(Be.setSignLine1(a,h),Be.showSignLine1()):1==s&&(Be.setSignLine2(a,h),Be.showSignLine2())},_o.prototype.showSignLine2=function(t,e,o){var i={x:t.x,y:t.y},n=null;"x"==o?n={x:t.x,y:e.y}:"y"==o&&(n={x:e.x,y:t.y}),null!=n&&("x"==o?(Be.setSignLine1(i,n),Be.showSignLine1()):"y"==o&&(Be.setSignLine2(i,n),Be.showSignLine2()))},_o.prototype.updateCenterForWall=function(t,e,o,i,n){var s=he.getWall(t),r=this.getLineForWall(i,t,e),l=c.createLine3(r,o),a=ct.getLine(s),h=c.getIntersectionPoint(l,a),u=c.translate({x:(i[e[0]].x+i[e[1]].x)/2,y:(i[e[0]].y+i[e[1]].y)/2},h,o,n),d=0;return(1==e[0]&&2==e[1]||0==e[0]&&3==e[1])&&(d=1),this.showSignLine(h,n,a,i,e,d),u},_o.prototype.updateCenterForComponentFurniture=function(t,e,o,i,n,s,r){var l=null,a=null;xt.isComponent(e)?(l=he.getComponent(t),a=xt.getBoundingVertexs(t,l.center)):Qt.isFurniture(e)&&(a=(l=he.getFurniture(t)).getBoundingVertexs(l.center));var h=this.getLineForComponentFurniture(s,t,e,o,i),u=c.createLine3(h,n),d=c.createLine1(a[o[0]],a[o[1]]),y=c.getIntersectionPoint(u,d),p=c.translate({x:(s[i[0]].x+s[i[1]].x)/2,y:(s[i[0]].y+s[i[1]].y)/2},y,n,r),x=0;return(1==i[0]&&2==i[1]||0==i[0]&&3==i[1])&&(x=1),this.showSignLine(y,r,d,s,i,x),p},_o.prototype.updateCenterForComponentFurniture2=function(t,e,o,i){var n=null;return xt.isComponent(e)?n=he.getComponent(t):Qt.isFurniture(e)&&(n=he.getFurniture(t)),"x"==o?(this.showSignLine2(n.center,i,o),{x:n.center.x,y:i.y}):"y"==o?(this.showSignLine2(n.center,i,o),{x:i.x,y:n.center.y}):void 0},_o.prototype.getLineForWall=function(t,e,o){var i={x:(t[o[0]].x+t[o[1]].x)/2,y:(t[o[0]].y+t[o[1]].y)/2},n=he.getWall(e),s=ct.getLine(n);return c.getVerticalLine(s,i)},_o.prototype.getLineForComponentFurniture=function(t,e,o,i,n){var s={x:(t[n[0]].x+t[n[1]].x)/2,y:(t[n[0]].y+t[n[1]].y)/2},r=null,l=null;xt.isComponent(o)?(r=he.getComponent(e),l=xt.getBoundingVertexs(e,r.center)):Qt.isFurniture(o)&&(l=(r=he.getFurniture(e)).getBoundingVertexs(r.center));var a=c.createLine1(l[i[0]],l[i[1]]);return c.getVerticalLine(a,s)},_o.prototype.isParallel=function(t,e){return void 0===t.a&&void 0===e.a?!(!t.hasOwnProperty("x")||!e.hasOwnProperty("x"))||!(!t.hasOwnProperty("y")||!e.hasOwnProperty("y")):Math.abs(t.a-e.a)<.08},_o.prototype.clear=function(){this.start=null,this.startCenter=null,this.dx=null,this.dy=null,this.reset=!1},_o.prototype.isCloseForTwoSegments=function(t,e,o,i){var n=c.getDistance(t,e),s={x:(t.x+e.x)/2,y:(t.y+e.y)/2},r=c.getDistance(o,i),l={x:(o.x+i.x)/2,y:(o.y+i.y)/2},a=c.createLine1(t,e),h=c.getJoinLinePoint(l,a);return c.getDistance(s,h)<n/2+r/2+10/le.res},_o.prototype.setAdsorbRec=function(){var t={x:0,y:le.height},e={x:le.width,y:le.height},o={x:le.width,y:0};return this.screenPoints=[],this.screenPoints.push(le.getXYFromScreen({x:0,y:0})),this.screenPoints.push(le.getXYFromScreen(o)),this.screenPoints.push(le.getXYFromScreen(e)),this.screenPoints.push(le.getXYFromScreen(t)),this.screenPoints};var Yo=new _o,No=function(){};No.prototype.moveFullTag=function(t,e){var o=he.getTag(e);c.clonePoint(o.center,t),o.setPoints2d()};var Xo=new No,jo=function(){this.needUpdateRoom=!1,this.startMoving=!1,this.moveFlag=!1,this.adsorbPointWalls={},this.splitWallId=null};jo.prototype.setStartMoving=function(t){this.startMoving=t},jo.prototype.movePoint=function(t,e,o){var i=he.getPoint(t),n=null,s=null;null!=o&&(e={x:o.x,y:o.y},n=o.linkedPointId,s=o.linkedWallId),this.needUpdateRoom=!1,this.adsorbPointWalls={},this.splitWallId=null;var r=this.canMoveForPoint(t,e,n,s);if(!r){if(null==this.splitWallId&&Object.keys(this.adsorbPointWalls).length>0){var l=Object.keys(this.adsorbPointWalls)[0],h=he.getWall(this.adsorbPointWalls[l]).getOtherPointId(t),u=he.getPoint(h),d=he.getPoint(l),y=c.createLine1(u,d);e=c.getJoinLinePoint(e,y),i.setPosition(e)}return!1}var p=null;if(null==o){var x=ct.getNeighPoints(t);if(1==x.length?p=Be.checkAngle(e,x[0].vectorId,t):2==x.length&&((p=Be.checkAngle(e,x[0].vectorId,t))||(p=Be.checkAngle(e,x[1].vectorId,t))),p){if(!(r=this.canMoveForPoint(t,p,n,s)))return!1;c.clonePoint(e,p)}i.setPosition(e)}else if(o.hasOwnProperty("linkedPointId")&&null!=o.linkedPointId){if(null!=ct.getWallId(t,o.linkedPointId))return!1;i.setPosition(o),this.needUpdateRoom=!0}else if(o.hasOwnProperty("linkedWallId")){var g=he.getWall(o.linkedWallId),f=he.getPoint(g.start),m=he.getPoint(g.end);if(c.getDistance(f,e)<a.minRealDis||c.getDistance(m,e)<a.minRealDis)return!1;i.setPosition(o),this.needUpdateRoom=!0}else o.hasOwnProperty("linkedPointIdX")&&o.linkedPointIdX&&i.setPosition(e),o.hasOwnProperty("linkedPointIdY")&&o.linkedPointIdY&&i.setPosition(e);return se.updateSymbolsPositionsForWallCorner(t),!0},jo.prototype.moveWallPlane=function(t,e,o){var i=1,n=he.getWall(t),s=n.start,r=n.end,l=he.getPoint(n.start),h=he.getPoint(n.end),u=this.getNewPointsForMoveWall(t,e,o),d=c.createLine1(u.point1,u.point2),y=this.getTwoLimitInfos(t,d);this.needUpdateRoom=!1;var p=c.getIntersectionPoint(d,y.startLimitLine),x=c.getIntersectionPoint(d,y.endLimitLine);if(!this.startMoving&&(c.getDistance(l,p)<a.minRealDis||c.getDistance(h,x)<a.minRealDis))return this.moveFlag=!1,i=2;this.setStartMoving(!0);var g=this.updateVirtualPosition(n.start,p,y.startWallId,y.newStartWallId),f=this.updateVirtualPosition(n.end,x,y.endWallId,y.newEndWallId);if(null==g||null==f)return this.moveFlag=!1,i=2,this.setStartMoving(!1),i;var m=!1,v=null;if(g.adsorb&&!f.adsorb){if(d=c.createLine3(d,g.virtualPosition),!this.isOKForTwoSegmentsAngle(g.adsorbPointId,n.start,n.end))return this.moveFlag=!1,i=5;x=c.getIntersectionPoint(d,y.endLimitLine),null==(f=this.updateVirtualPosition(n.end,x,y.endWallId,y.newEndWallId))&&(f={adsorb:!1,adsorbPointId:null,virtualPosition:x}),m=this.isCoincideForAdsorbOne(n.start,g.adsorbPointId,t),v=c.getDistance(g.virtualPosition,x),i=4,this.needUpdateRoom=!0,this.setStartMoving(!1)}else if(!g.adsorb&&f.adsorb){if(d=c.createLine3(d,f.virtualPosition),!this.isOKForTwoSegmentsAngle(f.adsorbPointId,n.end,n.start))return this.moveFlag=!1,i=5;p=c.getIntersectionPoint(d,y.startLimitLine),null==(g=this.updateVirtualPosition(n.start,p,y.startWallId,y.newStartWallId))&&(g={adsorb:!1,adsorbPointId:null,virtualPosition:p}),m=this.isCoincideForAdsorbOne(n.end,f.adsorbPointId,t),v=c.getDistance(f.virtualPosition,p),i=4,this.needUpdateRoom=!0,this.setStartMoving(!1)}if(g&&f&&g.adsorb&&f.adsorb){if(m=this.isCoincideForAdsorbOne2(t,g.adsorbPointId,f.adsorbPointId),v=c.getDistance(g.virtualPosition,f.virtualPosition),this.setStartMoving(!1),m)return this.moveFlag=!1,i=5;i=4,this.needUpdateRoom=!0}else if((v=c.getDistance(p,x))<a.minRealDis)return this.deleteWallForLinked(t),l=he.getPoint(s),h=he.getPoint(r),l&&h?(Object.keys(l.parent).length>1&&1==Object.keys(h.parent).length||1==Object.keys(l.parent).length&&1==Object.keys(h.parent).length?ct.moveTo(r,s):1==Object.keys(l.parent).length&&Object.keys(h.parent).length>1&&ct.moveTo(s,r),this.moveFlag=!1,i=3,this.needUpdateRoom=!0,i):(this.moveFlag=!1,i=3,this.needUpdateRoom=!0,i);if(s=n.start,r=n.end,!this.isOKForCrossForMoveWall(p,x,t,s,r,g.adsorbPointId,f.adsorbPointId))return i=2,this.moveFlag=!1,this.setStartMoving(!1),i;if(m||null!=v&&v<a.minRealDis)return this.deleteWallForLinked(t),i=3,ct.mergeWallForPoint(s),ct.mergeWallForPoint(r),this.moveFlag=!1,this.needUpdateRoom=!0,i;var S=c.getIntersectionPoint3(l,p,h,x);if(null!=S)return l.setPosition(S),h.setPosition(S),ct.moveTo(s,r),i=3,this.moveFlag=!1,this.needUpdateRoom=!0,i;var P=!1;if(!y.newStartWallId&&g.adsorbPointId?P=ct.isOverlapForMergePoint(s,g.adsorbPointId):!y.newEndWallId&&f.adsorbPointId&&(P=ct.isOverlapForMergePoint(r,f.adsorbPointId)),P)return this.moveFlag=!1,i=5;if(this.updatePointForMoveWall(t,s,g,y.startWallId,y.newStartWallId),this.updatePointForMoveWall(t,r,f,y.endWallId,y.newEndWallId),null==(n=he.getWall(t)))return i=3,this.moveFlag=!1,this.needUpdateRoom=!0,i;for(var b in se.updateSymbolsPositionsForWall(t),l=he.getPoint(n.start),h=he.getPoint(n.end),l.parent)se.updateSymbolsPositionsForNeighWall(b);for(var I in h.parent)se.updateSymbolsPositionsForNeighWall(I);return this.moveFlag=1==i,i},jo.prototype.updateForAbsorbWallPoints=function(){if(0!=Object.keys(this.adsorbPointWalls).length){Object.keys(this.adsorbPointWalls).length;var t=[],e=null;for(var o in this.adsorbPointWalls){var i=he.getPoint(o);t.push({join:i,pointId:o}),e=this.adsorbPointWalls[o]}var n=he.getWall(e),s=he.getPoint(n.start);t=t.sort(function(t,e){return c.getDistance(s,t.join)-c.getDistance(s,e.join)}.bind(this));for(var r=0;r<t.length;++r){var l=t[r];l.join;var a=l.pointId;ct.splitWall(e,a,"end")}}},jo.prototype.getNewPointsForMoveWall=function(t,e,o){e/=le.res,o=-o/le.res;var i=he.getWall(t),n=he.getPoint(i.start),s=he.getPoint(i.end);return{point1:{x:n.x+e,y:n.y+o},point2:{x:s.x+e,y:s.y+o}}},jo.prototype.getTwoLimitInfos=function(t,e){var o,i,n,s=he.getWall(t),r=he.getPoint(s.start),l=he.getPoint(s.end),h=c.createLine1(r,l),u={newStartWallId:!1,newEndWallId:!1};if(1==Object.keys(r.parent).length)o=c.getVerticalLine(h,r),u.startWallId=null;else if(2==Object.keys(r.parent).length){var d;Object.keys(r.parent)[0]==t?d=he.getWall(Object.keys(r.parent)[1]):Object.keys(r.parent)[1]==t&&(d=he.getWall(Object.keys(r.parent)[0])),d||console.error(352);var y=ct.AngleForWall(d.vectorId,t);o=ct.getLine(d),u.startWallId=d.vectorId,y>a.maxAngle/180*Math.PI&&(o=c.getVerticalLine(h,r),u.startWallId=null,u.newStartWallId=!0)}else{var p,x;n=ct.wallIdForMinAngle(s.start,t);var g=he.getWall(n.min0.wallId),f=he.getPoint(g.start),m=he.getPoint(g.end),v=he.getWall(n.min1.wallId),S=he.getPoint(v.start),P=he.getPoint(v.end),b=c.getIntersectionPoint4(f,m,e),I=c.getIntersectionPoint4(S,P,e);if(null==b&&null==I){var k=ct.AngleForWall(t,n.min0.wallId),T=ct.AngleForWall(t,n.min1.wallId);k>Math.PI&&(k=Math.PI-k),T>Math.PI&&(T=Math.PI-T),x=k<T?n.min0.wallId:n.min1.wallId,u.newStartWallId=!0}else null!=b&&null!=I?x=n.min0.angle<n.min1.angle?n.min0.wallId:n.min1.wallId:null==b&&null!=I?x=n.min1.wallId:null!=b&&null==I&&(x=n.min0.wallId);u.startWallId=x,p=he.getWall(x);var F=ct.AngleForWall(x,t);o=ct.getLine(p);var w=c.getIntersectionPoint(o,e),C=he.getPoint(p.start),W=he.getPoint(p.end);(F>a.maxAngle/180*Math.PI||!c.isPointOnSegment(w,C,W))&&(o=c.getVerticalLine(h,r),u.startWallId=null,u.newStartWallId=!0)}if(1==Object.keys(l.parent).length)i=c.getVerticalLine(h,l),u.endWallId=null;else if(2==Object.keys(l.parent).length){var D;Object.keys(l.parent)[0]==t?D=he.getWall(Object.keys(l.parent)[1]):Object.keys(l.parent)[1]==t&&(D=he.getWall(Object.keys(l.parent)[0]));var z=ct.AngleForWall(D.vectorId,t);i=ct.getLine(D),u.endWallId=D.vectorId,z>a.maxAngle/180*Math.PI&&(i=c.getVerticalLine(h,l),u.endWallId=null,u.newEndWallId=!0)}else{var L,M;n=ct.wallIdForMinAngle(s.end,t);var R=he.getWall(n.min0.wallId),O=he.getPoint(R.start),A=he.getPoint(R.end),E=he.getWall(n.min1.wallId),B=he.getPoint(E.start),_=he.getPoint(E.end),Y=c.getIntersectionPoint4(O,A,e),N=c.getIntersectionPoint4(B,_,e);if(null==Y&&null==N){var X=ct.AngleForWall(t,n.min0.wallId),j=ct.AngleForWall(t,n.min1.wallId);X>Math.PI&&(X=Math.PI-X),j>Math.PI&&(j=Math.PI-j),M=X<j?n.min0.wallId:n.min1.wallId,u.newEndWallId=!0}else null!=Y&&null!=N?M=n.min0.angle<n.min1.angle?n.min0.wallId:n.min1.wallId:null==Y&&null!=N?M=n.min1.wallId:null!=Y&&null==N&&(M=n.min0.wallId);u.endWallId=M,L=he.getWall(M);var U=ct.AngleForWall(M,t);i=ct.getLine(L);var J=c.getIntersectionPoint(i,e),V=he.getPoint(L.start),H=he.getPoint(L.end);(U>a.maxAngle/180*Math.PI||!c.isPointOnSegment(J,V,H))&&(i=c.getVerticalLine(h,l),u.endWallId=null,u.newEndWallId=!0)}return u.startLimitLine=o,u.endLimitLine=i,u},jo.prototype.canMoveForPoint=function(t,e,o,i){var n=he.getPoint(t),s=this.isOKForMinAngleWall(t,e);return s&&(s=this.isOKForCross(t,e,n.parent,o,i)),s},jo.prototype.isOKForMinAngleWall=function(t,e){var o=he.getPoint(t).parent,i=this.getMinAngle(t,e);if(Math.abs(i)<a.minAngle/180*Math.PI)return!1;for(var n in o){var s=he.getWall(n).getOtherPointId(t),r=this.getNeighMinAngle(s,n,e);if(r&&Math.abs(r.angle)<a.minAngle/180*Math.PI)return!1;var l=he.getPoint(s);if(c.getDistance(e,l)<a.minRealDis)return!1}return!0},jo.prototype.getMinAngle=function(t,e){var o=he.getPoint(t).parent;if(1==Object.keys(o).length)return 2*Math.PI;if(2==Object.keys(o).length){var i=he.getWall(Object.keys(o)[0]),n=he.getWall(Object.keys(o)[1]),s=i.getOtherPointId(t),r=he.getPoint(s),l=n.getOtherPointId(t),a=he.getPoint(l);return c.Angle(e,r,a)}var h={x:e.x+1,y:e.y},u=[];for(var d in o){var y=he.getWall(d).getOtherPointId(t),p=he.getPoint(y);if(c.equalPoint(h,p))u.push(0);else{var x=c.Angle(e,h,p);p.y<e.y&&(x=2*Math.PI-x),u.push(x)}}u=u.sort((function(t,e){return t-e}));for(var g=2*Math.PI,f=0;f<u.length-1;++f)for(var m=f+1;m<u.length;++m){var v=u[m]-u[f];v<g&&(g=v)}var S=u[0],P=u[u.length-1];if(S<Math.PI&&P>Math.PI){var b=2*Math.PI+S-P;b<g&&(g=b)}return g},jo.prototype.getNeighMinAngle=function(t,e,o){var i=he.getPoint(t),n={x:o.x,y:o.y},s=null,r=null,l=null,a=null;for(var h in i.parent)if(h!=e){s=he.getWall(h).getOtherPointId(t),r=he.getPoint(s);var u=c.Angle(i,n,r);(null==l||l>u)&&(a={angle:l=u,pointId:s})}return a},jo.prototype.isOKForCross=function(t,e,o,i,n){var s=he.getWalls();for(var r in s)if(!o.hasOwnProperty(r)&&n!=r)for(var l in o)if(!ct.isWallLink(r,l)){var a=he.getWall(l),h=a.getOtherPointId(t),c=he.getPoint(h);if(!this.isOKForCrossTwoWall(e,c,r,i,n,a.vectorId))return this.adsorbPointWalls={},!1}return!(Object.keys(this.adsorbPointWalls).length>0)&&null==this.splitWallId},jo.prototype.isOKForCrossTwoWall=function(t,e,o,i,n,s){var r=he.getWall(o),l=he.getPoint(r.start),h=he.getPoint(r.end);if(c.getIntersectionPoint3(t,e,l,h)&&r.start!=i&&r.end!=i)return this.splitWallId=o,!0;if(c.equalPoint(t,e))return!0;var u=c.createLine1(t,e),d=c.getJoinLinePoint(l,u),y=c.getJoinLinePoint(h,u);if(c.getDistance(d,l)<a.minRealDis&&c.PointInSegment(d,t,e)){if(r.start!=i)return this.adsorbPointWalls[l.vectorId]=s,!0}else if(c.getDistance(y,h)<a.minRealDis&&c.PointInSegment(y,t,e)&&r.end!=i)return this.adsorbPointWalls[h.vectorId]=s,!0;if(u=c.createLine1(l,h),d=c.getJoinLinePoint(t,u),y=c.getJoinLinePoint(e,u),c.getDistance(d,t)<a.minRealDis&&c.PointInSegment(d,l,h)){if(r.start!=i&&r.end!=i&&o!=n)return!0}else if(c.getDistance(y,e)<a.minRealDis&&c.PointInSegment(y,l,h)&&r.start!=i&&r.end!=i&&o!=n)return!0;return!0},jo.prototype.isOKForCrossTwoWall2=function(t,e,o){var i=he.getWall(o),n=he.getPoint(i.start),s=he.getPoint(i.end),r=c.crossTwoLines(t,e,n,s,.01);return!r&&(!!c.equalPoint(t,e)||!!(r=this.isCoincide(t,e,o)))},jo.prototype.isOKForCrossTwoWall3=function(t,e,o){var i=he.getWall(o),n=he.getPoint(i.start),s=he.getPoint(i.end);if(c.crossTwoLines(t,e,n,s,.01))return!1;if(c.equalPoint(t,e))return!0;var r=c.createLine1(t,e),l=c.getJoinLinePoint(n,r),h=c.getJoinLinePoint(s,r);return!(c.getDistance(l,n)<a.minRealDis&&c.isPointOnSegment(l,t,e))&&(!(c.getDistance(h,s)<a.minRealDis&&c.isPointOnSegment(h,t,e))&&(r=c.createLine1(n,s),l=c.getJoinLinePoint(t,r),!(c.getDistance(l,t)<a.minRealDis&&ct.isContain(i,l))))},jo.prototype.isCoincide=function(t,e,o){var i=he.getWall(o),n=he.getPoint(i.start),s=he.getPoint(i.end),r=c.createLine1(t,e),l=c.getJoinLinePoint(n,r),h=c.getJoinLinePoint(s,r);return!(c.getDistance(l,n)<a.minRealDis&&c.PointInSegment(l,t,e))&&(!(c.getDistance(h,s)<a.minRealDis&&c.PointInSegment(h,t,e))&&(r=c.createLine1(n,s),l=c.getJoinLinePoint(t,r),h=c.getJoinLinePoint(e,r),!(c.getDistance(l,t)<a.minRealDis&&ct.isContain(i,l))&&!(c.getDistance(h,e)<a.minRealDis&&ct.isContain(i,h))))},jo.prototype.updateVirtualPosition=function(t,e,o,i){var n,s,r=he.getWall(o),l=he.getPoint(t),h=!1;if(i){if(c.getDistance(l,e)<a.minRealDis)return null}else null!=r&&(n=r.getOtherPointId(t),s=he.getPoint(n),(c.getDistance(e,s)<a.minRealDis||!ct.isContain(r,e)&&c.getDistance(e,s)<c.getDistance(e,l))&&(c.clonePoint(e,s),h=!0));return{adsorb:h,adsorbPointId:h?n:null,virtualPosition:e}},jo.prototype.isOKForTwoSegmentsAngle=function(t,e,o){var i=he.getPoint(t),n=he.getPoint(e),s=he.getPoint(o),r=i.x-n.x,l=i.y-n.y,h={x:r+s.x,y:l+s.y};for(var u in i.parent){var d=he.getWall(u).getOtherPointId(t),y=he.getPoint(d),p=c.Angle(i,y,h);if(Math.abs(p)<a.minAngle/180*Math.PI)return!1}return!0},jo.prototype.isCoincideForAdsorbOne=function(t,e,o){if(t&&e){var i=he.getWall(o).getOtherPointId(t);if(null!=ct.getWallId(i,e))return!0}return!1},jo.prototype.isCoincideForAdsorbOne2=function(t,e,o){if(e&&o){if(null!=ct.getWallId(e,o))return!0;var i=he.getPoint(e),n=i.parent;for(var s in n){var r=ct.AngleForWall3(t,s);if(Math.abs(r)<a.minAngle/180*Math.PI)return!0}for(var l in n=(i=he.getPoint(o)).parent){var h=ct.AngleForWall3(t,l);if(Math.abs(h)<a.minAngle/180*Math.PI)return!0}}return!1},jo.prototype.isOKForCrossForMoveWall=function(t,e,o,i,n,s,r){var l=he.getPoint(i),a=he.getPoint(n),h=!0,c=he.getWalls();for(var u in c)if(u!=o){var d=!0,y=!0,p=he.getWall(u);if(!s||s!=p.start&&s!=p.end||(d=!1),!r||r!=p.start&&r!=p.end||(y=!1),p.start!=i&&p.end!=i||(d=!1),p.start!=n&&p.end!=n||(y=!1),d&&y&&(h=this.isOKForCrossTwoWall2(t,e,u)),!h)return!1;if(d&&p.start!=i&&p.end!=i&&(h=this.isOKForCrossTwoWall3(t,l,u)),!h)return!1;if(y&&p.start!=n&&p.end!=n&&(h=this.isOKForCrossTwoWall3(e,a,u)),!h)return!1}return h},jo.prototype.updatePointForMoveWall=function(t,e,o,i,n){var s=he.getPoint(e),r=he.getWall(t);if(null==i)n?(this.createWallForMoveWall(e,t,o.virtualPosition),this.needUpdateRoom=!0):s.setPosition(o.virtualPosition);else if(n)this.createWallForMoveWall(e,t,o.virtualPosition),this.needUpdateRoom=!0;else if(o.adsorb)ct.moveTo(e,o.adsorbPointId),this.needUpdateRoom=!0;else if(2==Object.keys(s.parent).length)s.setPosition(o.virtualPosition);else{var l=ct.wallIdForMinAngle(e,t),h=ct.AngleForWall(l.min0.wallId,l.min1.wallId);if(3==Object.keys(s.parent).length&&h>a.maxAngle/180*Math.PI)s.setPosition(o.virtualPosition);else{var c=ct.getDirction(e,t);ct.subtraWallFromIntersect(e,t);var u=r.getPointId(c);he.getPoint(u).setPosition(o.virtualPosition),ct.splitWall(i,u,c),this.needUpdateRoom=!0}}},jo.prototype.createWallForMoveWall=function(t,e,o){var i=he.getWall(e),n=ct.getDirction(t,e);ct.subtraWallFromIntersect(t,e);var s=i.getPointId(n);he.getPoint(s).setPosition(o),ct.createWall(t,s)},jo.prototype.deleteWallForLinked=function(t){var e=he.getWall(t);ct.subtraWallFromIntersect(e.start,t),ct.subtraWallFromIntersect(e.end,t),he.deleteWall(t)};var Uo=new jo,Jo=function(t){this.layer=t,this.displayPanos=!1};Jo.prototype.drawGeometry=function(t,e,o){if(null!=Bo.context){switch(t.geoType){case y:return void Bo.drawWall(t,e);case u:return void Bo.drawPoint(t);case p:return void Bo.drawSingleDoor(t,e,o);case x:return void Bo.drawDoubleDoor(t,e,o);case g:return void Bo.drawSlideDoor(t,e,o);case f:return void Bo.drawSingleWindow(t,e);case v:return void Bo.drawFrenchWindow(t,e);case m:return void Bo.drawBayWindow(t,e);case S:return void Bo.drawPass(t,e);case P:return void Bo.drawBeam(t,e);case b:return void Bo.drawFlue(t,e);case I:return void Bo.drawCorridor(t,e);case T:return void Bo.drawTag(t,e,o)}Qt.isFurniture(t.geoType)&&Bo.drawFurniture(t,e)}},Jo.prototype.drawElement=function(t){if(null!=Bo.context)switch(t.geoType){case u:Bo.drawCircle(t);break;case k:Bo.drawLine(t)}},Jo.prototype.drawPanos=function(t){for(var e=0;e<t.length;++e)Bo.drawCircle(t[e])},Jo.prototype.redrawElements=function(){Be.vCheckLines.X&&Be.vCheckLines.X.display&&this.drawElement(Be.vCheckLines.X),Be.vCheckLines.Y&&Be.vCheckLines.Y.display&&this.drawElement(Be.vCheckLines.Y),Be.startAddWall&&Be.startAddWall.display&&this.drawElement(Be.startAddWall),Be.newWall&&Be.newWall.display&&this.drawElement(Be.newWall),Be.symbolPoints.Start&&Be.symbolPoints.Start.display&&this.drawElement(Be.symbolPoints.Start),Be.symbolPoints.End&&Be.symbolPoints.End.display&&this.drawElement(Be.symbolPoints.End),Be.checkLines.X&&Be.checkLines.X.display&&this.drawElement(Be.checkLines.X),Be.checkLines.Y&&Be.checkLines.Y.display&&this.drawElement(Be.checkLines.Y),Be.signLine1&&Be.signLine1.display&&this.drawElement(Be.signLine1),Be.signLine2&&Be.signLine2.display&&this.drawElement(Be.signLine2)},Jo.prototype.redrawMeasures=function(t,e){Bo.drawMeasure(de.measureLines.top,"top",t,e),Bo.drawMeasure(de.measureLines.bottom,"bottom",t,e),Bo.drawMeasure(de.measureLines.left,"left",t,e),Bo.drawMeasure(de.measureLines.right,"right",t,e)},Jo.prototype.redrawRooms=function(t,e){for(var o=lo.getRooms(t),i=0;i<o.length;++i){for(var n=null,s=0;s<this.layer.app.CadManager.labels.length;++s)if(null!=o[i].tagName&&o[i].tagName.trim()==this.layer.app.CadManager.labels[s].text){"hall"==this.layer.app.CadManager.labels[s].type?(n=lo.getHallImg(),Bo.drawRoomBackGround(o[i],n)):"room"==this.layer.app.CadManager.labels[s].type?(n=lo.getDefaultImg(),Bo.drawRoomBackGround(o[i],n)):"other"==this.layer.app.CadManager.labels[s].type&&(n="style-1"==e?lo.getOtherWhiteImg():lo.getOtherBlackImg(),Bo.drawRoomBackGround(o[i],n));break}null==n&&(n="style-1"==e?lo.getOtherWhiteImg():lo.getOtherBlackImg(),Bo.drawRoomBackGround(o[i],n))}},Jo.prototype.autoRedraw=function(){Bo.clear(),this.displayPanos&&this.drawPanos(l.panos);var t=he.getFloorData();if(t){var e=t.walls;for(var o in e)this.drawGeometry(e[o]);var i=t.points;for(var n in i)this.drawGeometry(i[n]);Bo.drawSpecialPoint();var s=t.symbols;for(var r in s)this.drawGeometry(s[r]),Bo.drawSymbolPoint(s[r]);Bo.drawSelectSymbolPoint();var a=t.components;for(var h in a)this.drawGeometry(a[h]);var c=t.furnitures;for(var u in c)this.drawGeometry(c[u]);var d=t.tags;for(var y in d)this.drawGeometry(d[y]);this.redrawElements(),this.redrawMeasures()}},Jo.prototype.autoRedrawForImg=function(){Bo.clear();var t=he.getFloorData();if(t){var e=t.walls;for(var o in e)this.drawGeometry(e[o]);var i=t.symbols;for(var n in i)this.drawGeometry(i[n],null,true);var s=t.components;for(var r in s)this.drawGeometry(s[r]);var l=t.furnitures;for(var a in l)this.drawGeometry(l[a]);var h=t.tags;for(var c in h)this.drawGeometry(h[c],null,!0)}},Jo.prototype.autoRedrawForDownLoadImg=function(t){Bo.clear(),"style-1"==t?(Bo.drawBackGround("#FFFFFF"),this.redrawRooms(he.getCurrentFloor(),t)):"style-2"==t?(Bo.drawBackGround("#000000"),this.redrawRooms(he.getCurrentFloor(),t)):"style-3"==t?Bo.drawBackGround("#FFFFFF"):"style-4"==t&&Bo.drawBackGround("#000000");var e=he.getFloorData();if(e){var o=e.walls;for(var i in o)this.drawGeometry(o[i],t);var n=e.symbols;for(var s in n)this.drawGeometry(n[s],t,false);var r=e.components;for(var l in r)this.drawGeometry(r[l],t);var a=e.furnitures;for(var h in a)this.drawGeometry(a[h],t);var c=e.tags;for(var u in c)this.drawGeometry(c[u],t);this.redrawMeasures(t,!0),Bo.drawCompass(t)}},Jo.prototype.redrawCore=function(){console.log("重绘!"),Bo.clear();var t=he.getFloorData();if(t){var e=t.walls;for(var o in e)this.drawGeometry(e[o]);var i=t.points;for(var n in i)this.drawGeometry(i[n]);var s=t.symbols;for(var r in s)this.drawGeometry(s[r]);var l=t.components;for(var a in l)this.drawGeometry(l[a]);var h=t.furnitures;for(var c in h)this.drawGeometry(h[c])}},Jo.prototype.clear=function(){Bo.clear()},Jo.prototype.getContext=function(){return Bo.context};var Vo=function(){};Vo.prototype.isDifferentForWalls=function(t,e){return t.start!=e.start||t.end!=e.end||t.out!=e.out||t.important!=e.important},Vo.prototype.isDifferentForSymbols=function(t,e){return!c.equalPoint(t.startPoint,e.startPoint)||!c.equalPoint(t.endPoint,e.endPoint)||t.openSide!=e.openSide||t.parent!=e.parent||t.enter!=e.enter},Vo.prototype.isDifferentForComponents=function(t,e){return JSON.stringify(t.points2d)!=JSON.stringify(e.points)||t.angle!=e.angle},Vo.prototype.isDifferentForTags=function(t,e){return!c.equalPoint(t.center,e.center)||t.title!=e.title||t.des!=e.des||t.unit!=e.unit},Vo.prototype.isDifferentForFurnitures=function(t,e){return t.zoom!=e.zoom||JSON.stringify(t.center)!=JSON.stringify(e.center)||t.angle!=e.angle},Vo.prototype.isDifferentForAngle=function(t,e){return t!=e},Vo.prototype.assignWallFromWall=function(t,e){var o={};o.vectorId=t.vectorId,o.children=JSON.parse(JSON.stringify(e.children)),o.out=e.out,o.important=e.important,o.start=e.start,o.end=e.end,ct.setWallInfo(o)},Vo.prototype.assignPointFromPoint=function(t,e){var o={};o.vectorId=t.vectorId,o.position={x:e.x,y:e.y},o.parent=JSON.parse(JSON.stringify(e.parent)),ct.setPointInfo(o)},Vo.prototype.assignSymbolFromSymbol=function(t,e){var o={};o.vectorId=t.vectorId,o.openSide=e.openSide,o.start=JSON.parse(JSON.stringify(e.start)),o.end=JSON.parse(JSON.stringify(e.end)),o.points2d=JSON.parse(JSON.stringify(e.points)),e.position3d&&(o.position3d=JSON.parse(JSON.stringify(e.position3d))),o.enter=e.enter,o.parent=e.parent,se.setSymbolInfo(o)},Vo.prototype.assignComponentFromComponent=function(t,e){var o={};o.vectorId=t.vectorId,o.angle=e.angle,o.center=JSON.parse(JSON.stringify(e.center)),o.points2d=JSON.parse(JSON.stringify(e.points)),xt.setComponentInfo(o)},Vo.prototype.assignTagFromTag=function(t,e){var o={};o.vectorId=t.vectorId,o.title=e.title,o.des=e.des,o.unit=e.unit,o.center=JSON.parse(JSON.stringify(e.center)),o.points2d=JSON.parse(JSON.stringify(e.points)),o.adding=!1,Se.setTagInfo(o)},Vo.prototype.assignFurnitureFromFurniture=function(t,e){var o={};o.vectorId=t.vectorId,o.angle=e.angle,o.center=JSON.parse(JSON.stringify(e.center)),o.zoom=e.zoom,Qt.setFurnitureInfo(o)},Vo.prototype.deletePoint=function(t){var e=he.getPoint(t).parent;for(var o in e)he.deletePoint(t,o)},Vo.prototype.getDataForPoint=function(t){var e={};return e.id=t.vectorId,c.clonePoint(e,t),e.parent=JSON.parse(JSON.stringify(t.parent)),e.type=t.geoType,e},Vo.prototype.getDataForWall=function(t){var e={};return e.id=t.vectorId,e.start=t.start,e.end=t.end,e.out=t.out,e.important=t.important,e.children=JSON.parse(JSON.stringify(t.children)),e.type=t.geoType,e},Vo.prototype.getDataForSymbol=function(t){var e={};return e.id=t.vectorId,e.start=JSON.parse(JSON.stringify(t.startPoint)),e.end=JSON.parse(JSON.stringify(t.endPoint)),e.openSide=t.openSide,e.enter=t.enter,e.points=JSON.parse(JSON.stringify(t.points2d)),e.position3d=JSON.parse(JSON.stringify(t.position3d)),e.parent=t.parent,e.type=t.geoType,e},Vo.prototype.getDataForComponent=function(t){var e={};return e.id=t.vectorId,e.type=t.geoType,e.center=JSON.parse(JSON.stringify(t.center)),e.angle=t.angle,e.points=[].concat(t.points2d),e},Vo.prototype.getDataForFurniture=function(t){var e={};return e.id=t.vectorId,e.type=t.geoType,e.center=JSON.parse(JSON.stringify(t.center)),e.zoom=t.zoom,e.angle=t.angle,e},Vo.prototype.getDataForTag=function(t){var e={};return e.id=t.vectorId,e.type=t.geoType,e.center={},c.clonePoint(e.center,t.center),e.points=[].concat(t.points2d),e.title=t.title,e.des=t.des,e.unit=t.unit,e},Vo.prototype.getDataForAngle=function(t){return t},Vo.prototype.getDataForRes=function(t){return t};var Ho=new Vo,$o="addPoint",Zo="deletePoint",Go="modifyPoint",Ko="addWall",qo="deleteWall",Qo="modifyWall",ti="addSymbol",ei="deleteSymbol",oi="modifySymbol",ii="addComponent",ni="deleteComponent",si="modifyComponent",ri="addTag",li="deleteTag",ai="modifyTag",hi="addFurniture",ci="deleteFurniture",ui="modifyFurniture",di="modifyAngle",yi=function(){this.lastData={},this.elements={}};yi.prototype.saveCurrentInfo=function(){this.lastData.currentFloor=he.getCurrentFloor(),this.lastData.points=JSON.parse(JSON.stringify(he.getPoints())),this.lastData.walls=JSON.parse(JSON.stringify(he.getWalls())),this.lastData.symbols=JSON.parse(JSON.stringify(he.getSymbols())),this.lastData.components=JSON.parse(JSON.stringify(he.getComponents())),this.lastData.furnitures=JSON.parse(JSON.stringify(he.getFurnitures())),this.lastData.tags=JSON.parse(JSON.stringify(he.getTags())),this.lastData.angle=he.getAngle(),this.lastData.res=le.res},yi.prototype.operate=function(){return this.elements={},this.compareAngle()?(this.lastData={},!0):(this.comparePoints(),this.compareSymbols(),this.compareWalls(),this.compareComponents(),this.compareTags(),this.compareFurnitures(),0==this.elements.points.length&&0==this.elements.walls.length&&0==this.elements.symbols.length&&0==this.elements.components.length&&0==this.elements.tags.length&&0==this.elements.furnitures.length?(this.saveCurrentInfo(),!1):(this.lastData={},!0))},yi.prototype.comparePoints=function(){var t=he.getPoints();for(var e in this.elements.points=[],t){var o=t[e];if(this.lastData.points[e]){var i=this.lastData.points[e];if(o.x==i.x&&o.y==i.y&&JSON.stringify(o.parent)==JSON.stringify(i.parent)){delete this.lastData.points[e];continue}var n={handle:Go,prePoint:Ho.getDataForPoint(i),curPoint:Ho.getDataForPoint(o)};this.elements.points.push(n)}else{var s={handle:$o,point:Ho.getDataForPoint(o)};this.elements.points.push(s)}delete this.lastData.points[e]}for(var r in this.lastData.points){var l={handle:Zo,point:Ho.getDataForPoint(this.lastData.points[r])};this.elements.points.push(l)}},yi.prototype.compareWalls=function(){this.elements.walls=[];var t=he.getWalls();for(var e in t){var o=t[e],i=this.lastData.walls[e];if(i){if(!Ho.isDifferentForWalls(o,i)){delete this.lastData.walls[e];continue}var n={handle:Qo,preWall:Ho.getDataForWall(i),curWall:Ho.getDataForWall(o)};this.elements.walls.push(n)}else{var s={handle:Ko,wall:Ho.getDataForWall(o)};this.elements.walls.push(s)}delete this.lastData.walls[e]}for(var r in this.lastData.walls){var l={handle:qo,wall:Ho.getDataForWall(this.lastData.walls[r])};this.elements.walls.push(l)}},yi.prototype.compareSymbols=function(){this.elements.symbols=[];var t=he.getSymbols();for(var e in t){var o=t[e],i=this.lastData.symbols[e];if(i){if(!Ho.isDifferentForSymbols(o,i)){delete this.lastData.symbols[e];continue}var n={handle:oi,preSymbol:Ho.getDataForSymbol(i),curSymbol:Ho.getDataForSymbol(o)};this.elements.symbols.push(n)}else{var s={handle:ti,symbol:Ho.getDataForSymbol(o)};this.elements.symbols.push(s)}delete this.lastData.symbols[e]}for(var r in this.lastData.symbols){var l={handle:ei,symbol:Ho.getDataForSymbol(this.lastData.symbols[r])};this.elements.symbols.push(l)}},yi.prototype.compareComponents=function(){this.elements.components=[];var t=he.getComponents();for(var e in t){var o=t[e],i=this.lastData.components[e];if(i){if(!Ho.isDifferentForComponents(o,i)){delete this.lastData.components[e];continue}var n={handle:si,preComponent:Ho.getDataForComponent(i),curComponent:Ho.getDataForComponent(o)};this.elements.components.push(n)}else{var s={handle:ii,component:Ho.getDataForComponent(o)};this.elements.components.push(s)}delete this.lastData.components[e]}for(var r in this.lastData.components){var l={handle:ni,component:Ho.getDataForComponent(this.lastData.components[r])};this.elements.components.push(l)}},yi.prototype.compareTags=function(){this.elements.tags=[];var t=he.getTags();for(var e in t){var o=t[e],i=this.lastData.tags[e];if(i){if(!Ho.isDifferentForTags(o,i)){delete this.lastData.tags[e];continue}var n={handle:ai,preTag:Ho.getDataForTag(i),curTag:Ho.getDataForTag(o)};this.elements.tags.push(n)}else{var s={handle:ri,tag:Ho.getDataForTag(o)};this.elements.tags.push(s)}delete this.lastData.tags[e]}for(var r in this.lastData.tags){var l={handle:li,tag:Ho.getDataForTag(this.lastData.tags[r])};this.elements.tags.push(l)}},yi.prototype.compareFurnitures=function(){this.elements.furnitures=[];var t=he.getFurnitures();for(var e in t){var o=t[e],i=this.lastData.furnitures[e];if(i){if(!Ho.isDifferentForFurnitures(o,i)){delete this.lastData.furnitures[e];continue}var n={handle:ui,preFurniture:Ho.getDataForFurniture(i),curFurniture:Ho.getDataForFurniture(o)};this.elements.furnitures.push(n)}else{var s={handle:hi,furniture:Ho.getDataForFurniture(o)};this.elements.furnitures.push(s)}delete this.lastData.furnitures[e]}for(var r in this.lastData.furnitures){var l={handle:ci,furniture:Ho.getDataForFurniture(this.lastData.furnitures[r])};this.elements.furnitures.push(l)}},yi.prototype.compareAngle=function(){var t=he.getAngle(),e=this.lastData.angle,o=this.lastData.res;if(Ho.isDifferentForAngle(t,e)){var i={handle:di,preState:{angle:Ho.getDataForAngle(e),res:Ho.getDataForRes(o)},curState:{angle:Ho.getDataForAngle(t),res:Ho.getDataForRes(le.res)}};return this.elements.rotate=i,!0}return!1};var pi=new yi,xi=function(t){this.layer=t};xi.prototype.init=function(){pi.saveCurrentInfo();var t=he.getPoints();Object.keys(t).length>0?(this.layer.$xui.toolbar.clear=!0,this.layer.$xui.toolbar.download=!0):(this.layer.$xui.toolbar.clear=!1,this.layer.$xui.toolbar.download=!1)},xi.prototype.save=function(){if(pi.operate()){de.update(!1),Ye.addHistoryRecord(pi.elements),pi.saveCurrentInfo(),this.setState(),Ye.getHistoryState().pre&&(this.layer.$xui.toolbar.recall=!0),this.layer.$xui.toolbar.recover=!1;var t=he.getPoints();return Object.keys(t).length>0?(this.layer.$xui.toolbar.clear=!0,this.layer.$xui.toolbar.download=!0):(this.layer.$xui.toolbar.clear=!1,this.layer.$xui.toolbar.download=!1),this.layer.emit("change"),pi.elements}},xi.prototype.setState=function(){var t={pre:0,next:0},e=Ye.getCurrentRecordIndex(),o=Ye.getHistoryRecords();e>-1&&(t.pre=1),e<o.length-1&&(t.next=1);var i=Ye.getHistoryState();i.pre==t.pre&&i.next==t.next||Ye.setHistoryState(t.pre,t.next)},xi.prototype.canUndo=function(){return 0!=this.setState().pre},xi.prototype.canRedo=function(){return 0!=this.setState().next},xi.prototype.handleUndo=function(){this.goPreState()},xi.prototype.handleRedo=function(){this.goNextState()},xi.prototype.goPreState=function(){var t=Ye.getHistoryRecord();if(t){ee.clearFocusItem(),ee.clearEventName(),this.layer.uiControl.currentUI=null,t.type="pre";null!=t.rotate&&this.goPreForAngle(t.rotate)||(this.goPreForPoints(t.points),this.goPreForWalls(t.walls),this.goPreForSymbols(t.symbols),this.goPreForComponents(t.components),this.goPreForTags(t.tags),this.goPreForFurnitures(t.furnitures)),de.update(!1),Ye.undoHistoryRecord(),pi.saveCurrentInfo(),this.setState();var e=he.getPoints();Object.keys(e).length>0?(this.layer.$xui.toolbar.clear=!0,this.layer.$xui.toolbar.download=!0):(this.layer.$xui.toolbar.clear=!1,this.layer.$xui.toolbar.download=!1)}else console.error("goPreState超出范围!")},xi.prototype.goPreForPoints=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==$o)Ho.deletePoint(o.point.id);else if(o.handle==Zo){ct.createPoint(o.point.x,o.point.y,o.point.id).parent=JSON.parse(JSON.stringify(o.point.parent))}else if(o.handle==Go){var i=o.prePoint,n=he.getPoint(o.curPoint.id);Ho.assignPointFromPoint(n,i)}}},xi.prototype.goPreForWalls=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==Ko)he.deleteWallNoSymbol(o.wall.id);else if(o.handle==qo){var i=o.wall,n=ct.createWall(i.start,i.end,i.id);Ho.assignWallFromWall(n,i)}else if(o.handle==Qo){var s=o.preWall,r=he.getWall(o.curWall.id);Ho.assignWallFromWall(r,s)}}},xi.prototype.goPreForSymbols=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==ti)se.deleteSymbol(o.symbol.id);else if(o.handle==ei){var i=se.createSymbol(o.symbol.start,o.symbol.end,o.symbol.type,o.symbol.parent,o.symbol.id);Ho.assignSymbolFromSymbol(i,o.symbol)}else if(o.handle==oi){var n=o.preSymbol,s=he.getSymbol(o.curSymbol.id);Ho.assignSymbolFromSymbol(s,n)}}},xi.prototype.goPreForComponents=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==ii)he.deleteComponent(o.component.id);else if(o.handle==ni){var i=xt.createComponent(o.component.center,o.component.type,o.component.id);Ho.assignComponentFromComponent(i,o.component)}else if(o.handle==si){var n=o.preComponent,s=he.getComponent(o.curComponent.id);Ho.assignComponentFromComponent(s,n)}}},xi.prototype.goPreForFurnitures=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==hi)he.deleteFurniture(o.furniture.id);else if(o.handle==ci){var i=Qt.createFurniture(o.furniture.center,o.furniture.type,o.furniture.id);Ho.assignFurnitureFromFurniture(i,o.furniture)}else if(o.handle==ui){var n=o.preFurniture,s=he.getFurniture(o.curFurniture.id);Ho.assignFurnitureFromFurniture(s,n)}}},xi.prototype.goPreForTags=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==ri)Se.deleteTag(o.tag.id);else if(o.handle==li){var i=Se.createTag(o.tag.center,o.tag.id);Ho.assignTagFromTag(i,o.tag)}else if(o.handle==ai){var n=o.preTag,s=he.getTag(o.curTag.id);Ho.assignTagFromTag(s,n)}}},xi.prototype.goPreForAngle=function(t){if(t.handle==di){le.reSet(),le._setRes(t.preState.res),he.setAngle(t.preState.angle),le.updateForRotate(t.preState.angle-t.curState.angle);var e=le.getScreenInfoForCAD();return e.floorPlanAngle=t.preState.angle,this.layer.app.core.get("CameraControls").emit("syncCadAnd3DForRotate",e),this.layer.app.store.getValue("metadata").floorPlanAngle=t.preState.angle,this.layer.initPanos(he.getCurrentFloor()),!0}return!1},xi.prototype.goNextForPoints=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==$o){var i=ct.createPoint(o.point.x,o.point.y,o.point.id);Ho.assignPointFromPoint(i,o.point)}else if(o.handle==Zo)Ho.deletePoint(o.point.id);else if(o.handle==Go){var n=o.curPoint,s=he.getPoint(o.curPoint.id);Ho.assignPointFromPoint(s,n)}}},xi.prototype.goNextForWalls=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==Ko){var i=o.wall,n=ct.createWall(i.start,i.end,i.id);Ho.assignWallFromWall(n,i)}else if(o.handle==qo)he.deleteWallNoSymbol(o.wall.id);else if(o.handle==Qo){var s=o.curWall,r=he.getWall(o.preWall.id);Ho.assignWallFromWall(r,s)}}},xi.prototype.goNextForSymbols=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==ti){var i=se.createSymbol(o.symbol.start,o.symbol.end,o.symbol.type,o.symbol.parent,o.symbol.id);Ho.assignSymbolFromSymbol(i,o.symbol)}else if(o.handle==ei)se.deleteSymbol(o.symbol.id);else if(o.handle==oi){var n=o.curSymbol,s=he.getSymbol(o.curSymbol.id);Ho.assignSymbolFromSymbol(s,n)}}},xi.prototype.goNextForComponents=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==ii){var i=xt.createComponent(o.component.center,o.component.type,o.component.id);Ho.assignComponentFromComponent(i,o.component)}else if(o.handle==ni)he.deleteComponent(o.component.id);else if(o.handle==si){var n=o.curComponent,s=he.getComponent(o.curComponent.id);Ho.assignComponentFromComponent(s,n)}}},xi.prototype.goNextForTags=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==ri){var i=Se.createTag(o.tag.center,o.tag.id);Ho.assignTagFromTag(i,o.tag)}else if(o.handle==li)he.deleteTag(o.tag.id);else if(o.handle==ai){var n=o.curTag,s=he.getTag(o.curTag.id);Ho.assignTagFromTag(s,n)}}},xi.prototype.goNextForFurnitures=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==hi){var i=Qt.createFurniture(o.furniture.center,o.furniture.type,o.furniture.id);Ho.assignFurnitureFromFurniture(i,o.furniture)}else if(o.handle==ci)he.deleteFurniture(o.furniture.id);else if(o.handle==ui){var n=o.curFurniture,s=he.getFurniture(o.curFurniture.id);Ho.assignFurnitureFromFurniture(s,n)}}},xi.prototype.goNextForAngle=function(t){if(t.handle==di){le.reSet(),le._setRes(t.curState.res),he.setAngle(t.curState.angle),le.updateForRotate(t.curState.angle-t.preState.angle);var e=le.getScreenInfoForCAD();return e.floorPlanAngle=t.curState.angle,this.layer.app.core.get("CameraControls").emit("syncCadAnd3DForRotate",e),this.layer.app.store.getValue("metadata").floorPlanAngle=t.curState.angle,this.layer.initPanos(he.getCurrentFloor()),!0}return!1},xi.prototype.goNextState=function(){Ye.redoHistoryRecord();var t=Ye.getHistoryRecord();if(t){ee.clearFocusItem(),ee.clearEventName(),this.layer.uiControl.currentUI=null;null!=t.rotate&&this.goNextForAngle(t.rotate)||(this.goNextForPoints(t.points),this.goNextForWalls(t.walls),this.goNextForSymbols(t.symbols),this.goNextForComponents(t.components),this.goNextForTags(t.tags),this.goNextForFurnitures(t.furnitures)),de.update(!1),pi.saveCurrentInfo(),this.setState();var e=he.getPoints();Object.keys(e).length>0?(this.layer.$xui.toolbar.clear=!0,this.layer.$xui.toolbar.download=!0):(this.layer.$xui.toolbar.clear=!1,this.layer.$xui.toolbar.download=!1)}else Ye.undoHistoryRecord(),console.error("goNextState超出范围!")};var gi={export:{Wall:{strokeStyle:"#70707a",fillStyle:"#70707a",lineWidth:7,lineWidth_out:10},Symbol:{strokeStyle:"rgba(37,40,40,0.5)",fillStyle:"rgba(0,0,0,0.1)",lineWidth:1},Component:{strokeStyle:"rgba(37,40,40,0.5)",fillStyle:"rgba(0,0,0,0.1)",lineWidth:1},Font:[{font:"bold 14px Microsoft YaHei",fillStyle:"rgb(65,65,65)",screen:{x:520,y:856},text:"© "},{font:"bold 14px Microsoft YaHei",fillStyle:"#70707a",screen:{x:538,y:855},text:"版权归58同城、赶集网、安居客、四维时代、正顺所有"},{font:"bold 14px Microsoft YaHei",fillStyle:"rgb(65,65,65)",screen:{x:30,y:840},text:["单位:毫米(mm)","提示:户型图中所有室内装饰、设计、摆设、间隔、尺寸、设备仅供参考。","具体房源标准以室内查勘和测量为准。"]}],compass:{screen:{x:66,y:88}},BackGround:{fillStyle:"#FFFFFF"}},cover:{Wall:{strokeStyle:"#70707a",fillStyle:"#70707a"},Symbol:{strokeStyle:"rgba(37,40,40,0.5)",fillStyle:"rgba(0,0,0,0.1)",lineWidth:1},Component:{strokeStyle:"rgba(37,40,40,0.5)",fillStyle:"rgba(0,0,0,0.1)",lineWidth:1}},default:{Wall:{strokeStyle:"#70707a",fillStyle:"#70707a"},Symbol:{strokeStyle:"rgba(37,40,40,0.5)",fillStyle:"rgba(0,0,0,0.1)",lineWidth:1},Component:{strokeStyle:"rgba(37,40,40,0.5)",fillStyle:"rgba(0,0,0,0.1)",lineWidth:1}},Font:{font:"12px Microsoft YaHei",fillStyle:"rgba(0,0,0,1)",textAlign:"center",textBaseline:"middle",miterLimit:10,direction:"ltr"},Measure:{strokeStyle:"#70707a"}},fi=function(){this.context=null};fi.prototype.initContext=function(t){this.context=t},fi.prototype.clear=function(){this.context.clearRect(0,0,this.context.canvas.width,this.context.canvas.height)},fi.prototype.drawWall=function(t,e){var o=he.getPoint(t.start),i=he.getPoint(t.end),n=[];n.push(o);for(var s=0;s<t.children.length;++s){var r=he.getSymbol(t.children[s]);n.push(r.startPoint),n.push(r.endPoint)}n.push(i),n=n.sort(function(t,e){return c.getDistance(o,t)-c.getDistance(o,e)}.bind(this)),this.context.save(),this.context.beginPath(),"export"==e?(t.out||t.important?this.context.lineWidth=gi.export.Wall.lineWidth_out:this.context.lineWidth=gi.export.Wall.lineWidth,this.context.strokeStyle=gi.export.Wall.strokeStyle,this.context.fillStyle=gi.export.Wall.fillStyle):"cover"==e?(t.out||t.important?this.context.lineWidth=gi.cover.Wall.lineWidth_out:this.context.lineWidth=gi.cover.Wall.lineWidth,this.context.strokeStyle=gi.cover.Wall.strokeStyle,this.context.fillStyle=gi.cover.Wall.fillStyle):"default"==e&&(t.out||t.important?this.context.lineWidth=gi.default.Wall.lineWidth_out:this.context.lineWidth=gi.default.Wall.lineWidth,this.context.strokeStyle=gi.default.Wall.strokeStyle,this.context.fillStyle=gi.default.Wall.fillStyle),this.context.lineCap="butt";for(var l=0;l<n.length-1;l+=2){var a=le.getScreenXY(n[l]),h=le.getScreenXY(n[l+1]);this.context.moveTo(a.x,a.y),this.context.lineTo(h.x,h.y)}this.context.stroke(),this.context.restore(),o.x,i.x,o.y,i.y},fi.prototype.drawPoint=function(t,e){this.context.save(),this.context.beginPath();var o="thin";for(var i in t.parent){var n=he.getWall(i);if(n.out&&n.important){o="fat";break}}var s=null;"export"==e?(s="thin"==o?gi.export.Wall.lineWidth:gi.export.Wall.lineWidth_out,this.context.strokeStyle=gi.export.Wall.strokeStyle,this.context.fillStyle=gi.export.Wall.fillStyle):"cover"==e?(s="thin"==o?gi.cover.Wall.lineWidth:gi.cover.Wall.lineWidth_out,this.context.strokeStyle=gi.cover.Wall.strokeStyle,this.context.fillStyle=gi.cover.Wall.fillStyle):"default"==e&&(s="thin"==o?gi.default.Wall.lineWidth:gi.default.Wall.lineWidth_out,this.context.strokeStyle=gi.default.Wall.strokeStyle,this.context.fillStyle=gi.default.Wall.fillStyle),this.context.lineCap="butt";var r=le.getScreenXY(t);this.context.rect(r.x-s/2,r.y-s/2,s,s),this.context.fill(),this.context.restore()},fi.prototype.drawText=function(t,e,o,i){this.context.save(),this.setCanvasStyle(gi.Font),le.ratio==a.ratio?this.context.font="36px Microsoft YaHei":this.context.font="12px Microsoft YaHei";var n={x:t.x,y:t.y};o||(n=le.getScreenXY({x:t.x,y:t.y})),i?(this.context.translate(n.x,n.y),this.context.rotate(i),this.context.strokeText(e,0,0),this.context.fillText(e,0,0)):(this.context.strokeText(e,n.x,n.y),this.context.fillText(e,n.x,n.y)),this.context.restore()},fi.prototype.drawSingleDoor=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=le.getScreenXY({x:o[n].x,y:o[n].y});var s=c.getDistance(i[0],i[1]);this.context.save(),this.context.lineCap="butt",this.context.lineWidth=1,"export"==e?(this.context.strokeStyle=gi.export.strokeStyle,this.context.fillStyle=gi.export.fillStyle):"cover"==e?(this.context.strokeStyle=gi.cover.strokeStyle,this.context.fillStyle=gi.export.fillStyle):"default"==e&&(this.context.strokeStyle=gi.default.strokeStyle,this.context.fillStyle=gi.export.fillStyle),this.context.beginPath(),this.context.moveTo(i[0].x,i[0].y),this.context.lineTo(i[1].x,i[1].y),this.context.arcTo(i[2].x,i[2].y,i[3].x,i[3].y,s),this.context.closePath(),this.context.stroke(),this.context.restore(),null!=t.enter&&this.drawEntranceDoor(t)},fi.prototype.drawDoubleDoor=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=le.getScreenXY({x:o[n].x,y:o[n].y});var s=c.getDistance(i[0],i[1]);this.context.save(),this.context.lineWidth=1,this.context.lineCap="butt","export"==e?(this.context.strokeStyle=gi.export.strokeStyle,this.context.fillStyle=gi.export.fillStyle):"cover"==e?(this.context.strokeStyle=gi.cover.strokeStyle,this.context.fillStyle=gi.export.fillStyle):"default"==e&&(this.context.strokeStyle=gi.default.strokeStyle,this.context.fillStyle=gi.export.fillStyle),this.context.beginPath(),this.context.moveTo(i[0].x,i[0].y),this.context.lineTo(i[1].x,i[1].y),this.context.arcTo(i[4].x,i[4].y,i[5].x,i[5].y,s),this.context.closePath(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(i[2].x,i[2].y),this.context.lineTo(i[1].x,i[1].y),this.context.arcTo(i[4].x,i[4].y,i[3].x,i[3].y,s),this.context.closePath(),this.context.stroke(),this.context.restore(),null!=t.enter&&this.drawEntranceDoor(t)},fi.prototype.drawSlideDoor=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=le.getScreenXY({x:o[n].x,y:o[n].y});this.context.save(),this.context.lineWidth=1,this.context.lineCap="butt","export"==e?(this.context.strokeStyle=gi.export.strokeStyle,this.context.fillStyle=gi.export.fillStyle):"cover"==e?(this.context.strokeStyle=gi.cover.strokeStyle,this.context.fillStyle=gi.export.fillStyle):"default"==e&&(this.context.strokeStyle=gi.default.strokeStyle,this.context.fillStyle=gi.export.fillStyle),this.context.beginPath(),this.context.moveTo(i[0].x,i[0].y),this.context.lineTo(i[1].x,i[1].y),this.context.lineTo(i[2].x,i[2].y),this.context.lineTo(i[3].x,i[3].y),this.context.closePath(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(i[4].x,i[4].y),this.context.lineTo(i[5].x,i[5].y),this.context.lineTo(i[6].x,i[6].y),this.context.lineTo(i[7].x,i[7].y),this.context.closePath(),this.context.stroke(),this.context.restore(),null!=t.enter&&this.drawEntranceDoor(t)},fi.prototype.drawSingleWindow=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=le.getScreenXY({x:o[n].x,y:o[n].y});this.context.save(),this.context.lineWidth=1,this.context.lineCap="butt","export"==e?(this.context.strokeStyle=gi.export.strokeStyle,this.context.fillStyle=gi.export.fillStyle):"cover"==e?(this.context.strokeStyle=gi.cover.strokeStyle,this.context.fillStyle=gi.export.fillStyle):"default"==e&&(this.context.strokeStyle=gi.default.strokeStyle,this.context.fillStyle=gi.export.fillStyle),this.context.beginPath(),this.context.moveTo(i[0].x,i[0].y),this.context.lineTo(i[1].x,i[1].y),this.context.stroke(),this.context.beginPath(),this.context.moveTo(i[2].x,i[2].y),this.context.lineTo(i[3].x,i[3].y),this.context.lineTo(i[4].x,i[4].y),this.context.lineTo(i[5].x,i[5].y),this.context.closePath(),this.context.stroke(),this.context.restore()},fi.prototype.drawBayWindow=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=le.getScreenXY({x:o[n].x,y:o[n].y});this.context.save(),this.context.lineWidth=1,this.context.lineCap="butt","export"==e?(this.context.strokeStyle=gi.export.strokeStyle,this.context.fillStyle=gi.export.fillStyle):"cover"==e?(this.context.strokeStyle=gi.cover.strokeStyle,this.context.fillStyle=gi.export.fillStyle):"default"==e&&(this.context.strokeStyle=gi.default.strokeStyle,this.context.fillStyle=gi.export.fillStyle),this.context.beginPath(),this.context.moveTo(i[0].x,i[0].y),this.context.lineTo(i[1].x,i[1].y),this.context.lineTo(i[2].x,i[2].y),this.context.lineTo(i[3].x,i[3].y),this.context.closePath(),this.context.stroke(),this.context.beginPath(),this.context.moveTo(i[4].x,i[4].y),this.context.lineTo(i[5].x,i[5].y),this.context.lineTo(i[6].x,i[6].y),this.context.lineTo(i[7].x,i[7].y),this.context.closePath(),this.context.stroke(),this.context.restore()},fi.prototype.drawFrenchWindow=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=le.getScreenXY({x:o[n].x,y:o[n].y});this.context.save(),this.context.lineWidth=1,this.context.lineCap="butt","export"==e?(this.context.strokeStyle=gi.export.strokeStyle,this.context.fillStyle=gi.export.fillStyle):"cover"==e?(this.context.strokeStyle=gi.cover.strokeStyle,this.context.fillStyle=gi.export.fillStyle):"default"==e&&(this.context.strokeStyle=gi.default.strokeStyle,this.context.fillStyle=gi.export.fillStyle),this.context.beginPath(),this.context.moveTo(i[0].x,i[0].y),this.context.lineTo(i[1].x,i[1].y),this.context.moveTo(i[2].x,i[2].y),this.context.lineTo(i[3].x,i[3].y),this.context.moveTo(i[4].x,i[4].y),this.context.lineTo(i[5].x,i[5].y),this.context.moveTo(i[2].x,i[2].y),this.context.lineTo(i[4].x,i[4].y),this.context.moveTo(i[3].x,i[3].y),this.context.lineTo(i[5].x,i[5].y),this.context.moveTo(i[6].x,i[6].y),this.context.lineTo(i[7].x,i[7].y),this.context.stroke(),this.context.restore()},fi.prototype.drawMeasure=function(t,e){this.context.save(),this.context.strokeStyle=gi.Measure.strokeStyle,this.context.beginPath();for(var o=0;o<t.length-1;++o){var i=le.getScreenXY(t[o]),n=le.getScreenXY(t[o+1]),s=0;"top"==e?(i.y=de.region.top*le.ratio,n.y=de.region.top*le.ratio):"bottom"==e?(i.y=de.region.bottom*le.ratio,n.y=de.region.bottom*le.ratio):"left"==e?(i.x=de.region.left*le.ratio,n.x=de.region.left*le.ratio,s=-.5*Math.PI):"right"==e&&(i.x=de.region.right*le.ratio,n.x=de.region.right*le.ratio,s=.5*Math.PI);var r=c.createLine1(i,n),l=c.getParallelLineForDistance(r,6),a=c.getJoinLinePoint(i,l.line1),h=c.getJoinLinePoint(n,l.line1),u=c.getJoinLinePoint(i,l.line2),d=c.getJoinLinePoint(n,l.line2);this.context.moveTo(a.x,a.y),this.context.lineTo(u.x,u.y),this.context.moveTo(h.x,h.y),this.context.lineTo(d.x,d.y),this.context.stroke();var y={x:(i.x+n.x)/2,y:(i.y+n.y)/2},p=c.getVerticalLine(r,y);l=c.getParallelLineForDistance(p,20);var x=c.getIntersectionPoint(r,l.line1),g=c.getIntersectionPoint(r,l.line2);if(c.getDistance(i,x)<c.getDistance(i,y)){this.context.moveTo(i.x,i.y),this.context.lineTo(x.x,x.y),this.context.moveTo(g.x,g.y),this.context.lineTo(n.x,n.y),this.context.stroke();var f=c.getDistance(t[o],t[o+1]);"ft"==de.unit&&(f=" "+me.convert(f,"distance",void 0,"imperial",.01,!0)+" "),this.drawText(y,c.getFixed(f,2),!0,s)}else{this.context.moveTo(i.x,i.y),this.context.lineTo(g.x,g.y),this.context.moveTo(x.x,x.y),this.context.lineTo(n.x,n.y),this.context.stroke();var m=c.getDistance(t[o],t[o+1]);"ft"==de.unit&&(m=" "+me.convert(m,"distance",void 0,"imperial",.01,!0)+" "),this.drawText(y,c.getFixed(m,2),!0,s)}}this.context.restore()},fi.prototype.drawExportTxt=function(){this.context.save(),this.context.font=gi.export.Font[0].font,this.context.fillStyle=gi.export.Font[0].fillStyle,this.context.fillText(gi.export.Font[0].text,gi.export.Font[0].screen.x,gi.export.Font[0].screen.y),this.context.restore(),this.context.save(),this.context.font=gi.export.Font[1].font,this.context.fillStyle=gi.export.Font[1].fillStyle,this.context.fillText(gi.export.Font[1].text,gi.export.Font[1].screen.x,gi.export.Font[1].screen.y),this.context.restore(),this.context.save(),this.context.font=gi.export.Font[2].font,this.context.fillStyle=gi.export.Font[2].fillStyle,this.context.fillText(gi.export.Font[2].text[0],gi.export.Font[2].screen.x,gi.export.Font[2].screen.y),this.context.fillText(gi.export.Font[2].text[1],gi.export.Font[2].screen.x,gi.export.Font[2].screen.y+14),this.context.fillText(gi.export.Font[2].text[2],gi.export.Font[2].screen.x,gi.export.Font[2].screen.y+28),this.context.restore()},fi.prototype.drawExportCompass=function(t,e){this.drawImg(t,e,!0)},fi.prototype.drawRoomBackGround=function(t,e){this.context.save(),this.context.fillStyle=e?this.context.createPattern(e,"repeat"):"#FFFFFF";for(var o=[],i=0;i<t.length;++i){var n=he.getPoint(t[i]);n=le.getScreenXY(n),o.push(n)}this.context.beginPath(),this.context.moveTo(o[0].x,o[0].y);for(var s=0;s<o.length;++s)this.context.lineTo(o[s].x,o[s].y);this.context.closePath(),e&&this.context.fill(),this.context.restore()},fi.prototype.drawImg=function(t,e,o){this.context.save(),o||(e=le.getScreenXY(e)),this.context.translate(e.x,e.y),this.context.drawImage(t,-t.width/2,-t.height/2),this.context.restore()},fi.prototype.drawBackGround=function(t,e,o){this.context.save(),this.context.fillStyle=o,this.context.fillRect(0,0,t,e),this.context.restore()},fi.prototype.drawEntranceDoor=function(t){this.context.save();var e,o,i=se.getEnterImg(),n={x:(t.startPoint.x+t.endPoint.x)/2,y:(t.startPoint.y+t.endPoint.y)/2},s=c.createLine1(t.startPoint,t.endPoint),r=c.getLineForPoint(s,n),l=null,a=null;"default"==t.enter?l=c.getParallelLineForDistance(s,i.height/2/le.res):"reverse"==t.enter&&(l=c.getParallelLineForDistance(s,i.height/2/le.res+c.getDistance(t.startPoint,t.endPoint))),e=c.getIntersectionPoint(l.line1,r),o=c.getIntersectionPoint(l.line2,r);var h=c.Angle(t.startPoint,{x:t.startPoint.x+1,y:t.startPoint.y},t.endPoint);c.isClockwise([t.startPoint,t.endPoint,o])?a="LEFT"==t.openSide?"default"==t.enter?e:o:"default"==t.enter?o:e:c.isClockwise([t.startPoint,t.endPoint,e])&&(a="LEFT"==t.openSide?"default"==t.enter?o:e:"default"==t.enter?e:o),c.isClockwise([t.startPoint,t.endPoint,a])||(h=Math.PI+h),a=le.getScreenXY(n),this.context.translate(a.x,a.y),console.log("截图:"+JSON.stringify(a)),t.startPoint.y<=t.endPoint.y?this.context.rotate(-h):this.context.rotate(h);var u=c.getDistance(t.startPoint,t.endPoint)*le.res*1.5;this.context.scale(le.ratio*u/i.height,le.ratio*u/i.height),this.context.drawImage(i,-i.width/2,-i.height-10),this.context.restore()},fi.prototype.setCanvasStyle=function(t){for(var e in t)"isFill"!=e&&"isStroke"!=e&&(this.context[e]=t[e])};var mi=new fi,vi=function(){this.cadBoundingBox=null,this.padding={export:165,cover:35,default:102},this.type=null,this.roomInfo1=null,this.roomInfo2=null,this.roomInfo3=null,this.rooms=[],this.imgCache={},this.anjuke_export=null,this.anjuke=null,this.anjuke_cover=null};vi.prototype.init=function(){this.cadBoundingBox=he.getBoundingBox()},vi.prototype.start=function(){this.layer.uiControl.menu_flex(),Se.clearDefaultTags(),this.layer.history.save(),de.unit="m",Se.convertUnit("m"),mi.context=this.layer.renderer.getContext(),this.setType("export"),this.screenshot(),this.setType("cover"),this.screenshot(),this.setType("default"),this.screenshot(),this.recovery()},vi.prototype.setType=function(t){this.type=t},vi.prototype.autoDraw=function(){for(var t=0;t<this.rooms.length;++t){null!=this.rooms[t].pointIds&&this.drawRoom(this.rooms[t])}var e=he.getFloorData(),o=e.walls;for(var i in o)this.drawGeometry(o[i]);var n=e.points;for(var s in n)this.drawGeometry(n[s]);var r=e.symbols;for(var l in r)this.drawGeometry(r[l])},vi.prototype.getSize=function(){if("export"==this.type)le.width=900,le.height=900,gi.export.Wall.lineWidth=Math.ceil(1*gi.export.Wall.lineWidth),gi.export.Wall.lineWidth_out=Math.ceil(1*gi.export.Wall.lineWidth_out);else if("cover"==this.type){var t=50*Math.abs(this.cadBoundingBox.maxX-this.cadBoundingBox.minX)*1.42+2*this.padding.cover,e=50*Math.abs(this.cadBoundingBox.maxY-this.cadBoundingBox.minY)*1.42+2*this.padding.cover;gi.cover.Wall.lineWidth=Math.ceil(.0055*Math.max(t,e)*2*1),gi.cover.Wall.lineWidth_out=Math.ceil(.0055*Math.max(t,e)*1.5*2*1),t=Math.ceil(t+gi.cover.Wall.lineWidth_out),e=Math.ceil(e+gi.cover.Wall.lineWidth_out),le.width=t,le.height=e}else if("default"==this.type){var o=50*Math.abs(this.cadBoundingBox.maxX-this.cadBoundingBox.minX)*2+2*this.padding.default,i=50*Math.abs(this.cadBoundingBox.maxY-this.cadBoundingBox.minY)*2+2*this.padding.default;gi.default.Wall.lineWidth=Math.ceil(.0055*Math.max(o,i)*2*1),gi.default.Wall.lineWidth_out=Math.ceil(.0055*Math.max(o,i)*1.5*2*1),o=Math.ceil(o+gi.default.Wall.lineWidth_out),i=Math.ceil(i+gi.default.Wall.lineWidth_out),le.width=o,le.height=i}},vi.prototype.screenshot=function(){var t,e,o=this.layer.canvas;if(this.getSize(),"export"==this.type){t=(le.width-this.padding.export-this.padding.export-gi.export.Wall.lineWidth_out)/Math.abs(this.cadBoundingBox.maxX-this.cadBoundingBox.minX),e=(le.height-this.padding.export-this.padding.export-gi.export.Wall.lineWidth_out)/Math.abs(this.cadBoundingBox.maxY-this.cadBoundingBox.minY),le.res=Math.min(t,e),o.width=le.width,o.height=le.height;var i=le.getScreenXY({x:this.cadBoundingBox.minX,y:this.cadBoundingBox.minY}),n=le.getScreenXY({x:this.cadBoundingBox.maxX,y:this.cadBoundingBox.maxY});de.updatePad({top:n.y-22,bottom:o.height-i.y-22,left:i.x-22,right:o.width-n.x-22}),de.updateRegion(!1),de.update(!1),mi.drawBackGround(le.width,le.height,gi.export.BackGround.fillStyle),mi.drawMeasure(de.measureLines.top,"top"),mi.drawMeasure(de.measureLines.bottom,"bottom"),mi.drawMeasure(de.measureLines.left,"left"),mi.drawMeasure(de.measureLines.right,"right"),mi.drawExportCompass(this.imgCache.compass,gi.export.compass.screen),mi.drawExportTxt(),this.autoDraw(),this.anjuke_export=this.exportImg(o,"image/jpeg")}else"cover"==this.type?(t=(le.width-this.padding.cover-this.padding.cover)/Math.abs(this.cadBoundingBox.maxX-this.cadBoundingBox.minX),e=(le.height-this.padding.cover-this.padding.cover)/Math.abs(this.cadBoundingBox.maxY-this.cadBoundingBox.minY),le.res=Math.min(t,e),o.width=le.width,o.height=le.height,this.autoDraw(),this.anjuke_cover=this.exportImg(o,"png")):"default"==this.type&&(t=(le.width-this.padding.default-this.padding.default)/Math.abs(this.cadBoundingBox.maxX-this.cadBoundingBox.minX),e=(le.height-this.padding.default-this.padding.default)/Math.abs(this.cadBoundingBox.maxY-this.cadBoundingBox.minY),le.res=Math.min(t,e),o.width=le.width,o.height=le.height,de.updatePad({top:50,bottom:50,left:50,right:50}),de.updateRegion(!1),de.update(!1),mi.drawMeasure(de.measureLines.top,"top"),mi.drawMeasure(de.measureLines.bottom,"bottom"),mi.drawMeasure(de.measureLines.left,"left"),mi.drawMeasure(de.measureLines.right,"right"),this.autoDraw(),this.anjuke=this.exportImg(o,"png"))},vi.prototype.recovery=function(){var t=this.layer.app.core.get("CameraControls").activeControl.camera;le.updateForCanvas(this.layer.canvas),le.setRes(t.left,t.right),de.updatePad(de.defalutMeasurePad),de.updateRegion(),this.layer.renderer.autoRedraw()},vi.prototype.exportImg=function(t,e){var o=t.toDataURL(e,3);return this.base64ToBlob(o)},vi.prototype.base64ToBlob=function(t){for(var e=t.split(","),o=e[0].match(/:(.*?);/)[1],i=atob(e[1]),n=i.length,s=new Uint8Array(n);n--;)s[n]=i.charCodeAt(n);return new Blob([s],{type:o})},vi.prototype.downloadCadImg=function(t,e){var o=e.substring(e.indexOf(".")+1),i=t.toDataURL(o,3);i=i.replace(this._fixType(o),"image/octet-stream"),this.saveFile(i,e)},vi.prototype.saveFile=function(t,e){var o=document.createElementNS("http://www.w3.org/1999/xhtml","a");o.href=t,o.download=e;var i=document.createEvent("MouseEvents");i.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),o.dispatchEvent(i)},vi.prototype._fixType=function(t){return"image/"+(t=t.toLowerCase().replace(/jpg/i,"jpeg")).match(/png|jpeg|bmp|gif/)[0]},vi.prototype.drawGeometry=function(t){switch(t.geoType){case y:mi.drawWall(t,this.type);break;case u:mi.drawPoint(t,this.type);break;case p:mi.drawSingleDoor(t,this.type);break;case x:mi.drawDoubleDoor(t,this.type);break;case g:mi.drawSlideDoor(t,this.type);break;case f:mi.drawSingleWindow(t,this.type);break;case v:mi.drawFrenchWindow(t,this.type);break;case m:mi.drawBayWindow(t,this.type);break;case P:mi.drawBeam(t,this.type);break;case b:mi.drawFlue(t,this.type);break;case I:mi.drawCorridor(t,this.type);break;case T:mi.drawTag(t,this.type)}},vi.prototype.drawRoom=function(t){this.roomInfo1.indexOf(t.name)>-1?mi.drawRoomBackGround(t.pointIds,this.imgCache.room1):this.roomInfo2.indexOf(t.name)>-1?mi.drawRoomBackGround(t.pointIds,this.imgCache.room2):(this.roomInfo3.indexOf(t.name),mi.drawRoomBackGround(t.pointIds,this.imgCache.room3)),"export"==this.type&&t.name&&(mi.drawText(t.center,t.name,!1,0),null!=t.area&&""!=t.area.trim()&&mi.drawText({x:t.center.x,y:t.center.y-16/le.res},t.area+"m²",!1,0))};var Si=new vi,Pi=function(t,e){this.app=t.app,this.layer=t,Si.layer=t,this.ajkJson={},this.cameraJson={},this.floorPlanJson={},this.getCameraJson(e),this.loadImg()};Pi.prototype.loadImg=function(){this.app.store.getAppImage("images/ajk/cad_compass_ajk.png").then((function(t){Si.imgCache.compass=t})),this.app.store.getAppImage("images/ajk/room1_ajk.png").then((function(t){Si.imgCache.room1=t})),this.app.store.getAppImage("images/ajk/room2_ajk.png").then((function(t){Si.imgCache.room2=t})),this.app.store.getAppImage("images/ajk/room3_ajk.png").then((function(t){Si.imgCache.room3=t})),Si.roomInfo1=["书房","厨房","卫生间","多功能室","阳台","储物间","步入式衣柜","外景","露台(无顶)","影视间","入房花园"],Si.roomInfo2=["主卧","儿童房","次卧","客卧","老人房","卧室"],Si.roomInfo3=["整套","客厅","走廊","餐厅","起居室","客餐厅","玄关","门厅"]},Pi.prototype.start=function(){var t=this;return new Promise((function(e,o){ho.start(),t.getFloorPlanJson().then((function(i){t.floor=i,he.updateBoundingBox(),Si.init();var n=he.getTags();if(0!=Object.keys(n).length)if(s=t.getAJKRooms(n)){var s=t.getEntrance();s?(t.getSceneName(),t.getPictureRotate(),t.getImgInfo(),t.layer.renderer.clear(),Si.start(),e({ajkJson:t.ajkJson,cameraJson:t.cameraJson,floorPlanJson:{floors:[t.floor.floors[0]]},files:{bgmgdCZp_anjuke:Si.anjuke,bgmgdCZp_anjuke_cover:Si.anjuke_cover,bgmgdCZp_anjuke_export:Si.anjuke_export}})):o({type:"toast",msg:"平面图至少包含要给入户门,且入户门应为单开门"})}else o({type:"toast",msg:"标注应包含房间名称、面积"});else o({type:"toast",msg:"平面图应至少包含一个标注"})}))}))},Pi.prototype.getAJKRooms=function(t){Si.rooms=[];var e=he.getRooms();this.ajkJson.rooms=this.createAjkRoomForTag(t);for(var o=[],i=0;i<this.ajkJson.rooms.length;++i){if(null==this.ajkJson.rooms[i].area||void 0===this.ajkJson.rooms[i].area)return!1;for(var n=Si.rooms.length,s=0;s<e.length;++s){if(!(o.indexOf(s)>-1))if(e[s].containPoint(this.ajkJson.rooms[i].labelPos)){o.push(s),console.log("匹配:"+this.ajkJson.rooms[i].name+"&"+e[s].tagName),Si.rooms.push({center:JSON.parse(JSON.stringify(this.ajkJson.rooms[i].labelPos)),pointIds:JSON.parse(JSON.stringify(e[s].wallPointIDs)),name:this.ajkJson.rooms[i].name,area:this.ajkJson.rooms[i].area});break}}n==Si.rooms.length&&(this.ajkJson.rooms.splice(i,1),--i)}return this.setRoomsGroup(),!0},Pi.prototype.getCameraJson=function(t){this.cameraJson={},this.cameraJson.sweepLocations=[];for(var e=0;e<t.sweepLocations.sweepLocations.length;++e){var o=t.sweepLocations.sweepLocations[e];o.uuid=o.uuid.toUTF8().replace(/-/g,""),this.cameraJson.sweepLocations.push(o)}},Pi.prototype.getFloorPlanJson=function(){return this.app.store.get("floor",(function(t){return t}))},Pi.prototype.getEntrance=function(t){null!=t&&void 0!==t||(t=he.getCurrentFloor());var e=he.getSymbols(t),o=null;for(var i in e)if((o=e[i]).enter)break;if(null!=o&&o.enter){var n=this.layer.app.core.get("Player").model.floors.list[t].boundingBox.min.y+.1,s=new THREE.Vector3(o.startPoint.x,n+.4*.2,-o.startPoint.y),r=new THREE.Vector3(o.endPoint.x,n+.4*.2,-o.endPoint.y),l=s.clone().add(r).multiplyScalar(.5),a=new THREE.Vector3(o.points2d[3].x,n+.4*.2,o.points2d[3].y);a.z*=-1;var h=this.getFootPoint(a,s,r),c=a.clone().sub(h).normalize();l.clone().negate().angleTo(c)>Math.PI/2&&(l.add(c.clone().multiplyScalar(s.distanceTo(r))),c.multiplyScalar(-1)),l.add(c.clone().multiplyScalar(-.5));var u={Position:new THREE.Vector3(l.x,-l.z,l.y),Direction:new THREE.Vector3(c.x,-c.z,c.y)};return this.ajkJson.Entrance=u,!0}return!1},Pi.prototype.getSceneName=function(){var t=this.app.store.getValue("metadata");this.ajkJson.scene_name=t.title},Pi.prototype.getPictureRotate=function(){var t=he.getAngle(),e=new THREE.Euler(0,t,0),o=new THREE.Vector3(0,0,-1);o.applyEuler(e),o=new THREE.Vector3(o.x,-o.z,o.y),this.ajkJson.picture_rotate=o},Pi.prototype.getFootPoint=function(t,e,o,i){var n=t.clone().sub(e),s=e.clone().sub(o),r=s.length(),l=n.dot(s)/r,a=e.clone().add(s.multiplyScalar(l/r));return i&&a.clone().sub(e).dot(a.clone().sub(o))>0&&(a=a.distanceTo(e)<a.distanceTo(o)?e.clone():o.clone()),a},Pi.prototype.getImgInfo=function(){var t=he.getCurrentFloor(),e=he.getCadInfo(this.layer.canvas)[t],o={};o.bound=e.bound,o.margin=51,o.marginReal=o.margin/le.res,o.width=Math.abs(e.bound.left-e.bound.right),o.center={x:(e.bound.left+e.bound.right)/2,y:(e.bound.top+e.bound.bottom)/2},this.ajkJson.img_info=o},Pi.prototype.createAjkRoomForTag=function(t){var e=[];for(var o in t){var i={},n={},s=t[o];n.area=s.des,n.name=s.title,n.tagId=s.vectorId,n.floor=he.getCurrentFloor(),i.x=s.center.x,i.y=s.center.y,i.z=0,n.labelPos=i,n.group=-1,e.push(n)}return e},Pi.prototype.setRoomsGroup=function(){for(var t=JSON.parse(JSON.stringify(Si.rooms)),e=[],o=he.getAngle(),i=0;i<this.ajkJson.rooms.length;++i){e=[];for(var n=[],s=0;s<t[i].pointIds.length;++s){var r=he.getPoint(t[i].pointIds[s]);n.push({x:r.x,y:r.y})}for(var l=0;l<this.cameraJson.sweepLocations.length;++l){var a=le.getVectorForRotate(this.cameraJson.sweepLocations[l].puck,o);c.isPointInPoly(a,n)&&(this.ajkJson.rooms[i].group=parseInt(this.ajkJson.rooms[i].tagId.replace("Tag","")),e.push(l))}if(void 0!==this.ajkJson.rooms[i].group&&0!=e.length){for(var h=null,u=0;u<e.length;++u){h=e[u]}this.cameraJson.sweepLocations[h].group=this.ajkJson.rooms[i].group,console.log("安居客图片生成成功:"+this.ajkJson.rooms[i].name)}else this.ajkJson.rooms.splice(i,1),t.splice(i,1),--i}};var bi=function(){};bi.prototype.init=function(t){return this.layer=t,this},bi.prototype.use=function(t,e){if(!this[t])return"DataAJK"==t&&(this[t]=new Pi(this.layer,e)),this},bi.prototype.start=function(t){return this[t]?this[t].start():Promise.reject()};var Ii=new bi,ki=function(){this.wallLineStyle=null,this.targetItem=null};ki.prototype.clearTargetItem=function(){this.targetItem=null},ki.prototype.copy=function(t,e){t&&t.type&&(this.targetItem={vectorId:t.vectorId,type:t.type}),this.paste(e),this.clearTargetItem()},ki.prototype.paste=function(t){var e=!1,o=le.getXYFromScreen(t);if(this.targetItem&&Qt.isFurniture(this.targetItem.type)){var i=he.getFurniture(this.targetItem.vectorId),n=Qt.createFurniture(o,this.targetItem.type);n.angle=i.angle,n.zoom=i.zoom,ee.setSelectItem(n.vectorId,this.targetItem.type,H),ee.setDraggingItem(ee.selectItem),ee.setEventName(eo),Yo.clear(),e=!0}return ee.clearFocusItem(),e};var Ti=new ki,Fi=function(t){function e(e,o){t.call(this),this.app=e,this.load=new Ie(this),this.analyService=new Ne(this),this.uiControl=new So(this),this.renderer=new Jo(this),this.history=new xi(this),this.sync=Ii.init(this),this.startX=null,this.startY=null,this.player=this.app.core.get("Player"),this.display=!1,this.mousePosition=null,he.$app=this.app,Qt.$app=this.app,o&&o.padding&&de.padding(o.padding),this.app.store.getAppImage("images/cad/cad_enter_dark.png").then((function(t){se.setEnterImg(t)})),this.app.store.getAppImage("images/cad/compass-white.png").then((function(t){Ao.setWhiteImg(t)})),this.app.store.getAppImage("images/cad/compass-black.png").then((function(t){Ao.setBlackImg(t)})),Promise.all([this.app.store.getAppImage("images/cad/hall.png"),this.app.store.getAppImage("images/cad/room.png"),this.app.store.getAppImage("images/cad/otherWhite.jpg"),this.app.store.getAppImage("images/cad/otherBlack.jpg")]).then((function(t){lo.setHallImg(t[0]),lo.setDefaultImg(t[1]),lo.setOtherWhiteImg(t[2]),lo.setOtherBlackImg(t[3])}))}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var o={isChanged:{configurable:!0},isCurrentFloorEmpty:{configurable:!0},floors:{configurable:!0}};return e.prototype.init=function(){this.canvas.width=this.canvas.clientWidth,this.canvas.height=this.canvas.clientHeight,Bo.initContext(this.canvas),this.bindEvents()},e.prototype.initCoordinate=function(){null==le.center&&(le.setDefaultCenter(this.app.core.get("Player").model.center),le.init(this.canvas)),this.initPanos(he.currentFloor);var t=this.app.core.get("CameraControls").activeControl.camera;le.setRes(t.left,t.right),le.setInitInfo(le.res,le.width,le.height)},e.prototype.initPanos=function(t){var e=this.app.core.get("Player").model.panos.list;l.panos=[];for(var o=0;o<e.length;++o){var i=e[o];i.panoType||i.floorIndex==t&&l.panos.push({vectorId:i.id,x:i.position.x,y:-1*i.position.z,name:"pano"})}var n=he.getAngle();le.updatePanosForRotate(n)},e.prototype.render=function(){var t=this;this.initCoordinate();var e=he.getAngle();e=parseFloat(e);var o=le.getScreenInfoForCAD();o.floorPlanAngle=e,de.updateRegion(),de.update(!1),this.app.core.get("CameraControls").emit("syncCadAnd3D",o),this.app.core.get("SceneRenderer").resizeListeners.push({setSize:function(o,i){if(t.display){le.updateForCanvas(t.canvas),le.updateResForReSize(o,i,e),de.updateRegion(),de.update(!1),t.renderer.autoRedraw();var n=le.getScreenInfoForCAD();n.floorPlanAngle=he.getAngle(),t.app.core.get("CameraControls").emit("syncCadAnd3D",n)}}}),this.history.init();var i=this.app.store.getValue("flooruser");i.unit&&(this.$xui.currentUnit=i.unit,de.unit=i.unit,Se.convertUnit(i.unit)),this.renderer.autoRedraw()},e.prototype.reRender=function(){le.setDefaultCenter(this.app.core.get("Player").model.center),le.init(this.canvas);var t=le.getScreenInfoForCAD();t.floorPlanAngle=he.getAngle(),this.app.core.get("CameraControls").emit("syncCadAnd3DForRotate",t);var e=this.app.core.get("CameraControls").activeControl.camera;le.setRes(e.left,e.right),le.setInitInfo(le.res,le.width,le.height),this.initPanos(he.getCurrentFloor()),de.updateRegion(),de.update(!1),this.history.init(),this.renderer.autoRedraw()},e.prototype.show=function(){var t=this;return Qt.fetchFurnitures(),this.player.model.floorplanCadImg.displayCadPlane(!1),new Promise((function(e){t.display=!0,t.app.MinMap.hide(),t.app.Camera.floorplan().then((function(){t.player.labelManager.hide(),t.app.Camera.setCompassDisplay(!1,!0),t.player.model.panos.forEach((function(t){return t.hasVideo&&(t.marker.material.opacity=0)})),t.app.dom.querySelector("[xui_edit_cad]").style.display="block",t.div?(t.canvas.width=t.canvas.clientWidth,t.canvas.height=t.canvas.clientHeight):(t.div=t.app.dom.querySelector("[xui_edit_cad]"),t.canvas=t.app.dom.querySelector("[xui_edit_cad] canvas"),t.init());var o=t.app.core.get("Player").model.currentFloor.floorIndex;he.setCurrentFloor(o),t.load.loadFloorJson().then((function(){var o=t.app.store.getValue("flooruser");t.uiControl.menu_flex(),t.app.core.get("Player").gotoFloor(he.currentFloor),"image"!=o.type||(t.initCoordinate(),t.player.model.floorplanCadImg.displayCadPlane(!0),t.player.model.floorplanCadImg.showCadPlane()),t.render(),t.uiControl.showTexture||(t.app.dom.querySelector('.player[name="main"]').style.visibility="hidden"),e(),t.emit("show")}))})),t.div||document.addEventListener("keydown",t.onKeydown.bind(t))}))},e.prototype.hide=function(){this.uiControl.showTexture||(this.app.dom.querySelector('.player[name="main"]').style.visibility="visible"),this.display=!1,this.$xui&&(this.$xui.selectName=null,this.$xui.currentName=null,this.$xui.currentAttributes={}),this.app.Camera.setCompassDisplay(!0,!1),this.player.model.currentFloor.panos.forEach((function(t){return t.hasVideo&&(t.marker.material.opacity=1)})),this.app.dom.querySelector("[xui_edit_cad]").style.display="none";var t=this.app.core.get("CameraControls").controls.floorplan;t.camera.position.copy(t.target),t.recoverToUpdate(),this.player.model.floorplanCadImg.displayCadPlane(!0),this.player.labelManager.hide(),this.app.MinMap.display=null,this.emit("hide")},e.prototype.padding=function(t){de.padding(t)},e.prototype.bindEvents=function(){this.div.addEventListener("contextmenu",(function(t){t.preventDefault()})),this.div.addEventListener("mousedown",this.onMouseDown.bind(this)),this.div.addEventListener("mousemove",this.onMouseMove.bind(this)),this.div.addEventListener("mouseup",this.onMouseUp.bind(this)),this.div.addEventListener("mousewheel",this.onWheel.bind(this)),this.div.addEventListener("DOMMouseScroll",this.onWheel.bind(this))},e.prototype.onMouseDown=function(t){if(null!=le.defaultCenter){if(this.app.core.get("CameraControls").onMouseDown(t),this.startX=t.offsetX||t.layerX,this.startY=t.offsetY||t.layerY,this.lastX=t.offsetX||t.layerX,this.lastY=t.offsetY||t.layerY,2==t.button)return this.stopAddVector(),this.uiControl.currentUI=null,void this.renderer.autoRedraw();var e=ee.getEventName();if(e==je){if(!this.setNewWallPoint("start",{x:this.startX,y:this.startY}))return}else if(e==Ue){if(!this.setNewWallPoint("end",le.getScreenXY(Be.newWall.end)))return;if(!uo.canAdd)return;uo.buildWall(this.uiControl.selectUI==mt),this.history.save()}else{var o=ee.getSelectItem();null==e&&o?(ee.setDraggingItem(o),ee.setFocusItem(o),this.uiControl.showAttributes(),this.uiControl.currentUI=o.type):null==e&&(this.uiControl.currentUI=null)}this.setEventName("mouseDown"),t.preventDefault(),t.stopPropagation()}},e.prototype.onMouseMove=function(t){if(null!=le.defaultCenter&&"image"!==this.app.store.getValue("flooruser").type){var e=t.offsetX||t.layerX,o=t.offsetY||t.layerY;this.mousePosition={x:e,y:o};var i=e-this.lastX,n=o-this.lastY,s=le.getXYFromScreen({x:e,y:o}),r=ee.getEventName(),l=!1,h=ee.getDraggingItem();switch(r){case null:l=Ae.start(s);break;case Xe:ee.clearItems(),le.center.x=le.center.x-i*a.defaultZoom/le.zoom/le.res,le.center.y=le.center.y+n*a.defaultZoom/le.zoom/le.res,this.lastX=e,this.lastY=o,l=!0;var u=he.getAngle(),d=le.getScreenInfoForCAD();d.floorPlanAngle=u,this.app.core.get("CameraControls").emit("syncCadAnd3D",d);break;case je:ee.clearDraggingItem(),ee.clearFocusItem(),l=!0,Ae.start(s),Ae.modifyPoint&&(s={x:Ae.modifyPoint.x,y:Ae.modifyPoint.y}),Be.execute(null,s),Be.setStartAddWall(s),Be.showStartAddWall();break;case Ue:ee.clearDraggingItem(),ee.clearFocusItem(),l=!0,Ae.start(s);var y={x:uo.startInfo.position.x,y:uo.startInfo.position.y};if(Ae.modifyPoint&&(s={x:Ae.modifyPoint.x,y:Ae.modifyPoint.y}),Be.execute(y,s),Be.setStartAddWall(s),Be.newWall.display){if(!Ae.modifyPoint&&uo.startInfo.linkedPointId){var p=Be.checkAngle(s,uo.startInfo.linkedPointId,null);p&&(c.clonePoint(s,p),Be.execute(y,s))}Be.setNewWallEndPosition(s)}else Be.setNewWall(y,s),Be.showNewWall();uo.canAdd=uo.canAddWallForEnd(s),uo.canAdd?this.uiControl.selectUI==mt?Be.setNewWallState("normal-out"):Be.setNewWallState("normal"):Be.setNewWallState("error");break;case Je:i=i*a.defaultZoom/le.zoom,n=n*a.defaultZoom/le.zoom;var x=Uo.moveWallPlane(h.vectorId,i,n);1==x?(this.lastX=e,this.lastY=o,l=!0):2==x||(3==x?(this.history.save(),ee.clearSelectItem(),ee.clearDraggingItem(),ee.clearEventName(),Ae.clear(),l=!0):4==x?(this.lastX=e,this.lastY=o,this.startX=e,this.startY=o,l=!0):5==x&&(this.lastX=e,this.lastY=o)),Uo.needUpdateRoom;break;case Ve:var g=he.getPoint(h.vectorId);if(Ae.start(s,h.vectorId,g.parent),Ae.modifyPoint&&(s={x:Ae.modifyPoint.x,y:Ae.modifyPoint.y}),Uo.movePoint(h.vectorId,s,Ae.modifyPoint)){g=he.getPoint(h.vectorId),Ae.start(g,h.vectorId,g.parent);var f=null;Ae.modifyPoint&&Ae.modifyPoint.linkedPointId?f=he.getPoint(Ae.modifyPoint.linkedPointId):Ae.modifyPoint&&Ae.modifyPoint.linkedPointIdX?f=he.getPoint(Ae.modifyPoint.linkedPointIdX):Ae.modifyPoint&&Ae.modifyPoint.linkedPointIdY&&(f=he.getPoint(Ae.modifyPoint.linkedPointIdY)),Be.execute(f,g)}else Be.hideAll();l=!0;break;case He:if(Ae.start(s),Ae.wallInfo.wallId)if(l=!0,null==h){var m=this.uiControl.getSymbolTypeForUI(),v=se.addSymbol(s,m,Ae.wallInfo.wallId);v&&(ee.setSelectItem(v,m,H),ee.setDraggingItem(ee.selectItem))}else ie.moveFullSymbol(s,h.vectorId,Ae.wallInfo.wallId);else l=!1;break;case $e:Ae.start(s),l=!0,null!=h&&se.isSymbol(h.type)&&ie.moveFullSymbol(s,h.vectorId,Ae.wallInfo.wallId);break;case Ze:l=!0,null!=h&&se.isSymbol(h.type)&&ie.moveSymbolPoint(s,h.vectorId,h.selectIndex);break;case Ge:if(l=!0,null==h){var S=this.uiControl.getComponentTypeForUI(),P=xt.createComponent(s,S);P.vectorId&&(ee.setSelectItem(P.vectorId,S,H),ee.setDraggingItem(ee.selectItem))}else Yo.setStart(s,h.vectorId,h.type),Yo.moveFull(s,h.vectorId,h.type);break;case Ke:l=!0,null!=h&&xt.isComponent(h.type)&&(Yo.setStart(s,h.vectorId,h.type),Yo.moveFull(s,h.vectorId,h.type));break;case qe:if(l=!0,null==h){var b=Se.createTag(s);b.vectorId&&(ee.setSelectItem(b.vectorId,T,H),ee.setDraggingItem(ee.selectItem))}else Xo.moveFullTag(s,h.vectorId);break;case Qe:l=!0,null!=h&&Xo.moveFullTag(s,h.vectorId);break;case to:if(l=!0,null==h){var I=this.uiControl.getFurnitureTypeForUI(),k=Qt.createFurniture(s,I);k.vectorId&&(ee.setSelectItem(k.vectorId,I,H),ee.setDraggingItem(ee.selectItem))}else Yo.setStart(s,h.vectorId,h.type),Yo.moveFull(s,h.vectorId,h.type);break;case eo:l=!0,null!=h&&Qt.isFurniture(h.type)&&(Yo.setStart(s,h.vectorId,h.type),Yo.moveFull(s,h.vectorId,h.type))}l&&this.renderer.autoRedraw()}},e.prototype.onMouseUp=function(t){if(null!=le.defaultCenter){var e=t.offsetX||t.layerX,o=t.offsetY||t.layerY;this.app.core.get("CameraControls").onMouseUp(t);var i=ee.getEventName(),n=ee.getDraggingItem(),s=null;n&&n.vectorId&&(s={vectorId:n.vectorId,type:n.type,cursor:{x:this.lastX,y:this.lastY}},ee.setFocusItem(s),this.uiControl.showAttributes()),le.getXYFromScreen({x:e,y:o});var r=null;switch(i){case null:return;case Xe:ee.clearFocusItem(),de.update(!1),this.uiControl.currentUI=null;break;case Ve:Be.hideAll();var l=he.getPoint(n.vectorId);l&&(Ae.start(l,n.vectorId,l.parent),Ae.modifyPoint&&Ae.modifyPoint.hasOwnProperty("linkedPointId")?ct.moveTo(n.vectorId,Ae.modifyPoint.linkedPointId):Ae.modifyPoint&&(Ae.modifyPoint.linkedPointIdX||Ae.modifyPoint.linkedPointIdY)?(c.clonePoint(l,Ae.modifyPoint),se.updateSymbolsPositionsForWallCorner(n.vectorId)):Ae.modifyPoint&&Ae.modifyPoint.hasOwnProperty("linkedWallId")?(l=ct.createPoint(Ae.modifyPoint.x,Ae.modifyPoint.y),ct.splitWall(Ae.modifyPoint.linkedWallId,l.vectorId,"start"),ct.moveTo(n.vectorId,l.vectorId)):null!=Uo.splitWallId&&ct.splitWall(Uo.splitWallId,n.vectorId,"start"),Uo.updateForAbsorbWallPoints(),this.history.save());break;case Ue:if(uo.startInfo&&uo.startInfo.linkedPointId){var a=he.getPoint(uo.startInfo.linkedPointId);uo.endInfo.position&&Object.keys(a.parent).length>1&&(ee.clearEventName(),uo.clear(),this.uiControl.clearUI(),Be.hideAll())}break;case Je:if(null!=s&&s.type==y){var h=he.getWall(s.vectorId);h.import||h.out?this.uiControl.currentUI="OutWall":this.uiControl.currentUI=s.type,this.history.save()}else this.history.save();Uo.setStartMoving(!1);break;case He:if(null==n)return void this.setEventName("mouseUp");s={vectorId:n.vectorId,type:n.type,cursor:{x:this.lastX,y:this.lastY}},ee.setFocusItem(s),this.uiControl.showAttributes(),this.uiControl.currentUI=s.type,this.history.save();break;case $e:r=he.getSymbol(n.vectorId),null!=s&&se.isSymbol(s.type)?(this.uiControl.currentUI=s.type,this.history.save()):r&&(r.len=null,this.history.save());break;case Ze:null!=s&&se.isSymbol(s.type)?(this.uiControl.currentUI=s.type,this.history.save()):this.history.save();break;case Ge:Be.hideSignLine1(),Be.hideSignLine2(),Yo.clear(),s={vectorId:n.vectorId,type:n.type,cursor:{x:this.lastX,y:this.lastY}},ee.setFocusItem(s),this.uiControl.showAttributes(),this.uiControl.currentUI=s.type,this.history.save();break;case Ke:Be.hideSignLine1(),Be.hideSignLine2(),Yo.clear(),null!=s&&xt.isComponent(s.type)?(this.uiControl.currentUI=s.type,this.history.save()):this.history.save(),Be.hideAll();break;case Qe:null!=s&&s.type==T?(this.uiControl.currentUI=s.type,this.history.save()):this.history.save();break;case qe:he.getTag(n.vectorId).setAdding(!1),s={vectorId:n.vectorId,type:n.type,cursor:{x:this.lastX,y:this.lastY}},ee.setFocusItem(s),this.history.save(),this.uiControl.currentUI=s.type;break;case to:Be.hideSignLine1(),Be.hideSignLine2(),Yo.clear(),s={vectorId:n.vectorId,type:n.type,cursor:{x:this.lastX,y:this.lastY}},ee.setFocusItem(s),this.uiControl.showAttributes(),this.uiControl.currentUI=s.type,this.history.save();break;case eo:Be.hideSignLine1(),Be.hideSignLine2(),Yo.clear(),null!=s&&Qt.isFurniture(s.type)?(this.uiControl.currentUI=s.type,this.history.save()):this.history.save()}this.setEventName("mouseUp"),ee.clearDraggingItem(),this.renderer.autoRedraw()}},e.prototype.onWheel=function(t){if(null!=le.defaultCenter){t.preventDefault();var e=t.type;if("DOMMouseScroll"==e||"mousewheel"==e){var o=t.wheelDelta?t.wheelDelta/120*20:-(t.detail||0)/3*20,i=le.zoom+o;if(i<14)return;le.updateZoom(i);var n=le.getScreenInfoForCAD();n.floorPlanAngle=he.getAngle(),this.app.core.get("CameraControls").emit("syncCadAnd3D",n),this.renderer.autoRedraw()}}},e.prototype.onKeydown=function(t){if(this.display)if(t.ctrlKey&&"KeyZ"==t.code){if(this.stopAddVector(),!this.$xui.toolbar.recall)return void this.renderer.autoRedraw();if("image"==this.app.store.getValue("flooruser").type)return void this.renderer.autoRedraw();this.revokeHistory(),console.log("ctrl+z")}else if(t.ctrlKey&&"KeyY"==t.code){if(!this.$xui.toolbar.recover)return;this.recoveryHistory(),console.log("ctrl+y")}else if("Delete"==t.code)this.deleteItem(),this.uiControl.currentUI=null,this.history.save(),this.renderer.autoRedraw(),console.log("Delete");else if("Escape"==t.code)this.stopAddVector(),this.renderer.autoRedraw(),console.log("Esc");else{var e=ee.getFocusItem(),o=ee.getDraggingItem();e&&!o&&t.ctrlKey&&"KeyC"==t.code&&(Ti.copy(e,this.mousePosition),this.renderer.autoRedraw(),this.history.save())}},e.prototype.updateEventNameForSelectUI=function(){if(Be.hideAll(),ee.getEventName()==qe){var t=ee.getDraggingItem();t&&t.type==T&&he.deleteTag(t.vectorId)}ee.clearItems(),this.uiControl.selectUI==ft||this.uiControl.selectUI==mt?ee.setEventName(je):this.uiControl.selectUI==vt||this.uiControl.selectUI==St||this.uiControl.selectUI==Pt||this.uiControl.selectUI==bt||this.uiControl.selectUI==It||this.uiControl.selectUI==kt||this.uiControl.selectUI==Tt?ee.setEventName(He):this.uiControl.selectUI==Ft||this.uiControl.selectUI==wt||this.uiControl.selectUI==Ct?ee.setEventName(Ge):this.uiControl.selectUI==Wt?ee.setEventName(qe):this.uiControl.selectUI!=Dt&&this.uiControl.selectUI!=zt&&this.uiControl.selectUI!=Lt&&this.uiControl.selectUI!=Mt&&this.uiControl.selectUI!=Rt&&this.uiControl.selectUI!=Ot&&this.uiControl.selectUI!=At&&this.uiControl.selectUI!=Et&&this.uiControl.selectUI!=Bt&&this.uiControl.selectUI!=_t&&this.uiControl.selectUI!=Yt&&this.uiControl.selectUI!=Nt&&this.uiControl.selectUI!=Xt&&this.uiControl.selectUI!=jt&&this.uiControl.selectUI!=Ut&&this.uiControl.selectUI!=Jt&&this.uiControl.selectUI!=Vt&&this.uiControl.selectUI!=Ht&&this.uiControl.selectUI!=$t&&this.uiControl.selectUI!=Zt&&this.uiControl.selectUI!=Gt||ee.setEventName(to)},e.prototype.setEventName=function(t){var e=ee.getEventName();if("mouseDown"==t)if(null==e){var o=ee.getSelectItem();if(null==o)ee.setEventName(Xe);else if(o.type==y)ee.setEventName(Je);else if(o.type==d)ee.setEventName(Ve);else if(se.isSymbol(o.type))if(o.selectIndex==H||o.selectIndex==G){ee.setEventName($e);var i=he.getSymbol(o.vectorId);i.len=c.getDistance(i.startPoint,i.endPoint)}else o.selectIndex!=$&&o.selectIndex!=Z||ee.setEventName(Ze);else xt.isComponent(o.type)?ee.setEventName(Ke):o.type==T?ee.setEventName(Qe):Qt.isFurniture(o.type)&&ee.setEventName(eo)}else e==je&&ee.setEventName(Ue);else"mouseUp"==t&&(e==qe||e!=je&&e!=Ue&&ee.clearEventName())},e.prototype.exit=function(){ee.clearItems(),ee.clearEventName(),this.uiControl.clearUI()},e.prototype.stopAddVector=function(){var t=ee.getEventName();if(t!=Ue){ee.clearEventName();var e=ee.getDraggingItem();t==He?e&&e.vectorId&&(se.deleteSymbol(e.vectorId),ee.clearDraggingItem()):t==Ge?e&&e.vectorId&&he.deleteComponent(e.vectorId):t==qe?e&&e.vectorId&&(Se.deleteTag(e.vectorId),this.uiControl.currentUI=null):t==to&&e&&e.vectorId&&he.deleteFurniture(e.vectorId)}else ee.setEventName(je);this.uiControl.clearUI(),Be.hideAll()},e.prototype.setNewWallPoint=function(t,e){return"select"!=Ae.symbolInfo.state&&(("start"==t||"end"==t)&&(Ae.modifyPoint?uo.setPointInfo(t,Ae.modifyPoint):uo.setPointInfo(t,le.getXYFromScreen(e)),!0))},e.prototype.reload=function(){var t=this;Ye.clearHistoryRecord(),this.$xui.toolbar.recall=!1,this.$xui.toolbar.recover=!1,he.clear(),le.clear(),ee.clearItems(),ee.clearEventName(),this.stopAddVector();var e=he.getCurrentFloor();return this.load.loadFloorJson(!0).then((function(){var o=t.app.store.getValue("flooruser");t.app.store.getValue("metadata").floorPlanAngle=o.angle||0,t.app.core.get("Player").model.floorplanCadImg.updateAllCadPlanes(),"image"==o.type?(t.initCoordinate(),t.player.model.floorplanCadImg.displayCadPlane(!0),t.player.model.floorplanCadImg.showCadPlane()):(t.app.core.get("Player").model.floorplanCadImg.hideCadPlane(),t.reRender()),he.setCurrentFloor(e),t.renderer.autoRedraw()}))},e.prototype.update=function(){var t=this;this.app.store.getValue("metadata").floorPlanUser=1,this.app.MinMap.reload().then((function(){"image"==t.app.store.getValue("flooruser").type?he.clear():(t.app.core.get("Player").model.floorplanCadImg.updateAllCadPlanes(),t.renderer.autoRedraw())})),this.div.style.visibility="visible"},e.prototype.exportImages=function(){this.div.style.visibility="hidden",this.stopAddVector();var t=he.getFloorData();return 0==Object.keys(t.points).length&&0==Object.keys(t.components).length&&0==Object.keys(t.tags).length&&0==Object.keys(t.furnitures).length?(this.div.style.visibility="visible",null):this.load.uploadCad()},e.prototype.exportJSON=function(t,e){if(e){var o=JSON.parse(JSON.stringify(l.floors));e.forEach((function(t,e){t.boundingBox=o[e].boundingBox}))}ho.start(),this.app.store.getValue("flooruser").cadInfo=t;var i=JSON.parse(JSON.stringify(e||l.floors));i.sort((function(t,e){return t.id-e.id}));var n={cadInfo:t,version:l.version,floors:i,unit:de.unit,angle:he.getAngle(),currentId:he.getCurrentId(),compass:he.getCompass()};return n.type=e?"image":"cad",n},e.prototype.exportHouseData=function(){return this.analyService.houseData},e.prototype.importJSON=function(){},o.isChanged.get=function(){return Ye.hasRecords()},o.isCurrentFloorEmpty.get=function(){return!1},e.prototype.revokeHistory=function(){this.history.goPreState(),this.renderer.autoRedraw(),Ye.getHistoryState().pre?this.$xui.toolbar.recall=!0:this.$xui.toolbar.recall=!1,this.$xui.toolbar.recover=!0},e.prototype.recoveryHistory=function(){this.history.goNextState(),this.renderer.autoRedraw(),Ye.getHistoryState().next?this.$xui.toolbar.recover=!0:this.$xui.toolbar.recover=!1,this.$xui.toolbar.recall=!0},e.prototype.deleteItem=function(){var t=ee.getFocusItem();t&&(t.type==y?he.deleteWall(t.vectorId):se.isSymbol(t.type)?se.deleteSymbol(t.vectorId):xt.isComponent(t.type)?he.deleteComponent(t.vectorId):t.type==T?he.deleteTag(t.vectorId):Qt.isFurniture(t.type)?he.deleteComponent(t.vectorId):t.type==d&&ct.deleteWallCorner(t.vectorId),this.history.save(),this.renderer.autoRedraw())},e.prototype.uploadCadImg=function(t,e,o,i){this.app.store.getValue("flooruser").type="image",this.player.model.floorplanCadImg.displayCadPlane(!0),this.uiControl.execute("clear",!0),this.uiControl.execute("panos",!1),this.uiControl.execute("texture",!0),this.$xui.toolbars.forEach((function(t){var e=t.list.find((function(t){return"viewSetting"==t.type}));e&&e.data.forEach((function(t){"panos"==t.type?t.checked=!1:"texture"==t.type&&(t.checked=!0)}))})),this.load.uploadCadImg(t,e,o,i)},e.prototype.deleteCadImg=function(t){this.player.model.floorplanCadImg.deleteCustomFloorTexture(t)},e.prototype.setCadImgVisible=function(t,e){this.player.model.floorplanCadImg.setCustomFloorVisible(t,e)},e.prototype.getBoundingBox2DPosition=function(t){return he.getBoundingBox2DPosition(this.player.model.floors.index[t].boundingBox)},e.prototype.recoverForCadImg=function(t,e){this.load.recoverForCadImg(t,e)},e.prototype.createSymbolFromPanorama=function(t,e,o){ee.clearEventName();var i=se.createSymbolFromPanorama(t,e,o);return this.history.save(),i},e.prototype.syncFloorplanAngel=function(t){var e=le.getScreenInfoForCAD();e.floorPlanAngle=null!=t?t:he.getAngle(),this.app.core.get("CameraControls").emit("syncCadAnd3DForRotate",e)},e.prototype.disable=function(){this.app.dom.querySelector("[xui_edit_cad]").style.pointerEvents="none"},e.prototype.enable=function(){this.app.dom.querySelector("[xui_edit_cad]").style.pointerEvents="all"},o.floors.get=function(){return l.floors},Object.defineProperties(e.prototype,o),e}(KanKan.MITT.Emiter);function wi(t){return{$template:"#kankan-xui-combox",expanded:!1,index:t.index||0,list:t.list||[],style:t.style||{},dropdown:function(){this.expanded=!this.expanded},selected:function(e){this.index!=e&&(this.index=e,t.change&&t.change(this.list[this.index]))}}}return document.querySelector("#kankan-xui-combox")||document.body.insertAdjacentHTML("beforeend",'<div xui-components v-scope :style="metadata.thumb && { backgroundImage:`url(${metadata.thumb})`}"> <div xui-components-loading v-show="!metadata.loaded"> <div class="lds-dual-ring"></div> </div> <div xui-components-info v-scope="UIInfo({metadata})" v-show="metadata.loaded"> <div class="title" :class="{collapse:collapse}" @click="dropdown=!dropdown"> <div class="pick" @click="collapse=!collapse"> <i class="iconfont sdk-back"></i> </div> <div class="text"> <div>{{ metadata.title }}</div> </div> <div class="drop" :class="{dropdown:dropdown}"> <i class="iconfont sdk-pull-down"></i> </div> </div> <div class="description" v-show="dropdown && !collapse" @click="dropdown=false"> <div class="text" v-html="metadata.description"></div> </div> </div> <div xui-components-floors v-scope="UIFloors({metadata})" v-show="metadata.loaded"> <ul v-show="metadata.floors && metadata.floors.length>1 && metadata.mode!=\'panorama\'"> <li :class="{active:\'all\' == metadata.floorIndex}" @click="setFloor(\'all\')" v-if="metadata.mode==\'dollhouse\'">全部</li> <li v-for="item in metadata.floors" :class="{active:item.subgroup == metadata.floorIndex}" @click="setFloor(item.subgroup)">{{item.name}}</li> </ul> </div> <div xui-components-controls v-scope="UIControls({metadata})" v-show="metadata.loaded"> <div class="buttons"> <div @click="setMode(\'panorama\')"><i class="iconfont" :class="[metadata.mode==\'panorama\'?\'sdk-panorama-active\':\'sdk-panorama\']"></i></div> <div @click="setMode(\'floorplan\')"><i class="iconfont" :class="[metadata.mode==\'floorplan\'?\'sdk-floorplan-active\':\'sdk-floorplan\']"></i></div> <div @click="setMode(\'dollhouse\')"><i class="iconfont" :class="[metadata.mode==\'dollhouse\'?\'sdk-dollhouse-active\':\'sdk-dollhouse\']"></i></div> </div> <div class="buttons"></div> </div> </div> \x3c!-- <template id="xui-components-loading">\n <div class="lds-dual-ring"></div>\n</template> --\x3e \x3c!-- <template id="xui-components-info">\n <div class="title" :class="{collapse:collapse}" @click="dropdown=!dropdown">\n <div class="pick" @click="collapse=!collapse">\n <i class="iconfont sdk-back"></i>\n </div>\n <div class="text">\n <div>{{ metadata.title }}</div>\n </div>\n <div class="drop" :class="{dropdown:dropdown}">\n <i class="iconfont sdk-pull-down"></i>\n </div>\n </div>\n <div class="description" v-show="dropdown && !collapse" @click="dropdown=false">\n <div class="text" v-html="metadata.description"></div>\n </div>\n</template>\n<template id="xui-components-floors">\n <ul v-show="metadata.floors && metadata.floors.length>1 && metadata.mode!=\'panorama\'">\n <li :class="{active:\'all\' == metadata.floorIndex}" @click="setFloor(\'all\')" v-if="metadata.mode==\'dollhouse\'">全部</li>\n <li v-for="item in metadata.floors" :class="{active:item.subgroup == metadata.floorIndex}" @click="setFloor(item.subgroup)">{{item.name}}</li>\n </ul>\n</template>\n<template id="xui-components-controls">\n <div class="buttons">\n <div @click="setMode(\'panorama\')"><i class="iconfont" :class="[metadata.mode==\'panorama\'?\'sdk-panorama-active\':\'sdk-panorama\']"></i></div>\n <div @click="setMode(\'floorplan\')"><i class="iconfont" :class="[metadata.mode==\'floorplan\'?\'sdk-floorplan-active\':\'sdk-floorplan\']"></i></div>\n <div @click="setMode(\'dollhouse\')"><i class="iconfont" :class="[metadata.mode==\'dollhouse\'?\'sdk-dollhouse-active\':\'sdk-dollhouse\']"></i></div>\n </div>\n <div class="buttons"></div>\n</template> --\x3e <style> html {\n box-sizing: border-box;\n -webkit-text-size-adjust: 100%;\n word-break: normal;\n -moz-tab-size: 4;\n tab-size: 4;\n }\n\n *,\n ::before,\n ::after {\n background-repeat: no-repeat;\n box-sizing: inherit;\n appearance: none;\n -webkit-tap-highlight-color: rgba(255, 255, 255, 0);\n text-rendering: optimizeLegibility !important;\n -webkit-font-smoothing: antialiased !important;\n }\n\n ::before,\n ::after {\n text-decoration: inherit;\n vertical-align: inherit;\n }\n\n * {\n padding: 0;\n margin: 0;\n }\n [xui-components] {\n width: 100%;\n height: 100%;\n pointer-events: none;\n font-size: 14px;\n user-select: none;\n background-repeat: no-repeat;\n background-position: center center;\n background-size: cover;\n }\n\n [xui_min_map] {\n top: 20px;\n right: 20px;\n } </style> <style> [xui-components-info] {\n position: absolute;\n left: 0;\n top: 20px;\n height: 34px;\n border-radius: 0 34px 34px 0;\n background: rgba(0, 0, 0, 0.3);\n pointer-events: all;\n color: rgba(255, 255, 255, 0.88);\n z-index: 100;\n }\n [xui-components-info] .title {\n display: flex;\n align-items: center;\n padding-right: 30px;\n width: 100%;\n height: 100%;\n cursor: pointer;\n transition: all 0.1s;\n position: relative;\n }\n [xui-components-info] .title .pick {\n width: 34px;\n height: 34px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n position: relative;\n transition: all 0.1s;\n }\n [xui-components-info] .title .pick::after {\n content: \'\';\n position: absolute;\n width: 1px;\n height: 65%;\n background: linear-gradient(transparent, #fff, transparent);\n top: 50%;\n transform: translateY(-50%);\n right: 0;\n }\n [xui-components-info] .title .text {\n width: 240px;\n padding-left: 20px;\n transition: width 0.3s;\n }\n [xui-components-info] .title .text div {\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n [xui-components-info] .title .drop {\n cursor: pointer;\n display: flex;\n position: absolute;\n right: 0;\n top: 0;\n bottom: 0;\n width: 24px;\n align-items: center;\n justify-content: flex-start;\n color: inherit;\n }\n [xui-components-info] .title .drop i {\n font-size: 14px;\n transition: transform 0.2s ease-in-out;\n }\n [xui-components-info] .title .drop.dropdown i {\n transform: rotate(180deg);\n }\n [xui-components-info] .title.collapse {\n padding-right: 0;\n }\n [xui-components-info] .title.collapse .pick i {\n transform: rotate(180deg);\n }\n [xui-components-info] .title.collapse .text,\n [xui-components-info] .title.collapse .drop,\n [xui-components-info] .title.collapse .pick::after {\n display: none;\n }\n [xui-components-info] .description {\n position: absolute;\n left: 10px;\n top: calc(100% + 10px);\n background: rgba(15, 15, 15, 0.3);\n border-radius: 10px;\n }\n [xui-components-info] .description .text {\n padding: 20px;\n width: 400px;\n letter-spacing: 1px;\n overflow: hidden;\n word-break: break-all;\n white-space: normal;\n line-height: 1.5;\n }\n [xui-components-info] a {\n color: rgba(14, 235, 168, 0.7);\n } </style> <style> [xui-components-floors] {\n pointer-events: all;\n position: absolute;\n left: 20px;\n top: 50%;\n transform: translateY(-50%);\n }\n [xui-components-floors] ul {\n margin: 0;\n padding: 0;\n list-style: none;\n width: 50px;\n border-radius: 6px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding: 20px 6px;\n background: rgba(0, 0, 0, 0.3);\n }\n [xui-components-floors] li {\n color: rgba(255, 255, 255, 0.7);\n margin-top: 20px;\n cursor: pointer;\n }\n [xui-components-floors] li:first-child {\n margin-top: 0px;\n }\n [xui-components-floors] li.active {\n color: rgba(14, 235, 168, 0.7);\n } </style> <style> [xui-components-controls] {\n width: 100%;\n position: absolute;\n left: 0;\n right: 0;\n bottom: 20px;\n height: 34px;\n display: flex;\n justify-content: space-between;\n transition: bottom 0.3s ease;\n z-index: 100;\n }\n [xui-components-controls] .buttons {\n pointer-events: all;\n display: flex;\n align-items: center;\n justify-content: space-around;\n height: 34px;\n border-radius: 17px;\n background-color: rgba(0, 0, 0, 0.3);\n }\n [xui-components-controls] .buttons i {\n font-size: 18px;\n color: #fff;\n }\n [xui-components-controls] .buttons:first-child {\n margin-left: 20px;\n }\n [xui-components-controls] .buttons:first-child > div {\n position: relative;\n margin-left: 20px;\n margin-right: 20px;\n cursor: pointer;\n }\n [xui-components-controls] .buttons:last-child {\n margin-right: 20px;\n } </style> <style> [xui-components-loading] {\n position: absolute;\n left: 50%;\n top: 50%;\n z-index: 100000;\n }\n .lds-dual-ring {\n display: inline-block;\n width: 70px;\n height: 70px;\n }\n .lds-dual-ring:after {\n content: \' \';\n display: block;\n width: 54px;\n height: 54px;\n margin: 8px;\n border-radius: 50%;\n border: 4px solid #fff;\n border-color: #fff transparent #fff transparent;\n animation: lds-dual-ring 1.2s linear infinite;\n }\n @keyframes lds-dual-ring {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n } </style> '),function(t){var e=KanKan.Deferred();return t.Scene.on("loaded",(function(){var o=new Fi(t);o.$load=function(){PetiteVue.createApp({compassURL:t.resource.getAppURL("images/cad_compass.png"),show:!1,props:{},floors:t.store.getValue("flooruser").floors.map((function(t){return{value:t.subgroup,text:t.name}})),selectName:null,currentName:null,currentAttributes:{},currentFloor:0,currentUnit:"m",compassRate:0,type:"draw",toolbar:{recall:!1,recover:!1,clear:!1,default:!0,rotate:!0,download:!0,flex:!0,panos:!0,texture:!0,unit:!0},values:{panos:!0,texture:!0},list:[{name:"wall",list:[{icon:"sdk-neiqiang",name:"Wall",text:"内墙"},{icon:"sdk-waiqiang",name:"OutWall",text:"外墙"}]},{name:"door",list:[{icon:"sdk-men",name:"SingleDoor",text:"门"},{icon:"sdk-shuangkaimen",name:"DoubleDoor",text:"双开门"},{icon:"sdk-yimen",name:"SlideDoor",text:"移门"},{icon:"sdk-yakou",name:"Pass",text:"垭口"}]},{name:"window",list:[{icon:"sdk-chuang",name:"SingleWindow",text:"窗"},{icon:"sdk-piaochuang",name:"BayWindow",text:"飘窗"},{icon:"sdk-luodichuang",name:"FrenchWindow",text:"落地窗"}]},{name:"structure",list:[{icon:"sdk-zhuzi",name:"Beam",text:"柱子"},{icon:"sdk-yandao",name:"Flue",text:"烟道"},{icon:"sdk-loudao",name:"Corridor",text:"楼道"}]},{name:"tag",list:[{icon:"sdk-dange",name:"Tag",text:"标注"}]}],create:function(){o.$xui=this},hide:function(){o.hide()},showProps:function(t){"compass"==t&&(o.uiControl.showAttributes("compass"),this.compassRate=this.currentAttributes.compass),this.currentName=t;for(var e=null,i=0;i<this.list.length;i++){var n=this.list[i].list.find((function(e){return e.name==t}));if(n){e=n;break}}this.props=null==e?{name:t}:e},hideProps:function(){this.currentName=null,this.selectName=null,this.props={},this.currentAttributes={}},menu:function(t){void 0!==this.values[t]?(this.values[t]=!this.values[t],o.uiControl.execute(t,this.values[t])):o.uiControl.execute(t)},selected:function(t){o.uiControl.selectUI=t},setType:function(t){this.type=t},setFloor:function(e){o.uiControl.currentFloor=this.currentFloor=e.value,t.Scene.gotoFloor(e.value)},setUnit:function(t){o.uiControl.currentUnit=this.currentUnit=t.value},setProps:function(t,e){void 0!==e&&(this.currentAttributes[t]=e,this.compassRate=e),"compass"==t&&(console.log(e),e>=360&&(console.log("超过了"),e=360,this.compassRate=0,this.currentAttributes.compass=360)),o.uiControl.setAttributes(this.props.name,t,e),-1!="split,default,remove".indexOf(t)&&this.hideProps()},$t:s,Combox:wi}).mount(t.dom.querySelector("[xui_design_cad]")),t.CadManager.install(o)},o.$html='<div v-cloak v-scope xui_edit_cad @vue:mounted="create"> <canvas></canvas> <div class="compass" :style="`background-image:url(${compassURL});transform:rotate(${compassRate}deg);`" @click="showProps(\'compass\')"></div> <div class="tool" @click.stop @mouseup.stop @mousemove.stop @mousedown.stop @mouseenter.stop> <ul> <li> <div class="title">{{$t(\'cad.floor\')}}<i class="iconfont sdk-close" @click="hide"></i></div> <div v-scope="Combox({index:0,list:floors,change:setFloor})"></div> </li> <li> \x3c!-- <div class="tabs">\n <div class="left" :class="{active:type == \'draw\'}" @click="setType(\'draw\')">绘制结构</div>\n <div class="right" :class="{active:type == \'gear\'}" @click="setType(\'gear\')">{{$t(\'cad.wall.s\')}}</div>\n </div> --\x3e <div class="cate" v-for="cate in list"> <span>{{$t(\'cad.classify.\'+cate.name)}}</span> <div class="item"> <div v-for="item in cate.list" :class="{active: item.name == selectName}" @click="selected(item.name,item.text)"> <i class="iconfont" :class="[item.icon]"></i> </div> </div> </div> </li> </ul> </div> <div class="prop kankan-app__slide-right" :class="[props.name?\'kankan-app__slide-right-enter\':\'kankan-app__slide-right-leave\']" @click.stop @mouseup.stop @mousemove.stop @mousedown.stop @mouseenter.stop> <ul> <li> <div class="title">{{$t(\'cad.items.\'+props.name)}}{{$t(\'cad.attribute\')}}<i class="iconfont sdk-close" @click="hideProps"></i></div> </li> <li v-show="[\'SingleDoor\',\'DoubleDoor\',\'SlideDoor\',\'Pass\'].indexOf(props.name)!=-1"> <div class="between" v-show="props.name!=\'Pass\'"> <span>翻转</span> <i class="iconfont sdk-fanzhuan" @click="setProps(\'rotate\')"></i> </div> <div class="between"> <span>宽度</span> <span><input type="text" :value="currentAttributes.width || 1.94" style="width: 40px; height: 24px; text-align: center" @change="setProps(\'width\',$event.target.value)"> {{currentUnit}}</span> </div> <div class="between" v-show="props.name == \'SingleDoor\'"> <span>入户门</span> <i class="iconfont" :class="[currentAttributes.enter?\'sdk-checked\':\'sdk-uncheck\']" style="color: #00c8af" @click="setProps(\'enter\',!currentAttributes.enter)"></i> </div> <div class="between" v-show="props.name == \'SingleDoor\'"> <span>进入方向</span> <i class="iconfont sdk-fanzhuan" :class="{disable:!currentAttributes.enter}" @click="setProps(\'direction\')"></i> </div> </li> <li v-show="[\'SingleWindow\',\'BayWindow\',\'FrenchWindow\'].indexOf(props.name)!=-1"> <div class="between" v-show="props.name == \'BayWindow\'"> <span>翻转</span> <i class="iconfont sdk-fanzhuan" @click="setProps(\'rotate\')"></i> </div> <div class="between"> <span>宽度</span> <span><input type="text" :value="currentAttributes.width || 0.8" style="width: 40px; height: 24px; text-align: center" @change="setProps(\'width\',$event.target.value)"> {{currentUnit}}</span> </div> </li> <li v-show="[\'Beam\',\'Flue\',\'Corridor\'].indexOf(props.name)!=-1"> <div class="between" v-show="[\'Beam\',\'Flue\'].indexOf(props.name)!=-1"> <span>翻转角度</span> <span> <i class="iconfont sdk-cad-turn" style="color: #00c8af" @click="setProps(\'rotate\')"></i> <input type="text" :value="currentAttributes.rotate || 0" style="width: 40px; height: 24px; text-align: center" @change="setProps(\'rotate\',$event.target.value)"> ° </span> </div> <div class="between"> <span>宽度</span> <span><input type="text" :value="currentAttributes.width || 0.65" style="width: 40px; height: 24px; text-align: center" @change="setProps(\'width\',$event.target.value)"> {{currentUnit}}</span> </div> <div class="between" v-show="[\'Beam\',\'Flue\'].indexOf(props.name)!=-1"> <span>厚度</span> <span><input type="text" :value="currentAttributes.thickness || 0.65" style="width: 40px; height: 24px; text-align: center" @change="setProps(\'thickness\',$event.target.value)"> {{currentUnit}}</span> </div> <div class="between" v-show="props.name == \'Corridor\'"> <span>高度</span> <span><input type="text" :value="currentAttributes.height || 0.65" style="width: 40px; height: 24px; text-align: center" @change="setProps(\'height\',$event.target.value)"> {{currentUnit}}</span> </div> </li> <li v-show="props.name==\'Tag\'"> <div> <input type="text" :value="currentAttributes.tag || \'\'" @input="setProps(\'tag\',$event.target.value)" placeholder="请输入名称"> </div> <div> <input type="text" :value="currentAttributes.area || \'\'" @input="setProps(\'area\',$event.target.value)" placeholder="输入面积,支持小数点后面两位"> <span style="position: absolute; right: 4px; top: 8px; font-size: 12px">{{currentUnit == \'ft\'?\'ft² \':\'m²\'}}</span> </div> </li> <li v-show="props.name==\'compass\'"> <div class="between"> <span>旋转角度</span> <div> <i class="iconfont sdk-cad-turn" style="color: #00c8af" @click="setProps(\'compass\',compassRate+=90)"></i> <span><input type="text" :value="currentAttributes.compass || 0" style="width: 40px; height: 24px; text-align: center" @input="setProps(\'compass\',$event.target.value)">°</span> </div> </div> </li> \x3c!-- <li v-show="props.name!=\'compass\'"> --\x3e <li> <div class="between"> <button @click="setProps(\'split\')" v-if="[\'Wall\',\'OutWall\'].indexOf(props.name)!=-1">{{$t(\'cad.split\')}}</button> <button @click="setProps(\'default\')" v-if="[\'Wall\',\'OutWall\',\'Tag\',\'WallCorner\'].indexOf(props.name)==-1">{{$t(\'cad.toolbar.default\')}}</button> <button v-if="[\'compass\'].indexOf(props.name)==-1" @click="setProps(\'remove\')">{{$t(\'cad.remove\')}}</button> </div> </li> </ul> </div> <div class="menu" @click.stop @mouseup.stop @mousemove.stop @mousedown.stop @mouseenter.stop> <ul> <li> <div @click="menu(\'recall\')" :class="{disable:!toolbar.recall}"><i class="iconfont sdk-repeal"></i>{{$t(\'cad.toolbar.recall\')}}</div> <div @click="menu(\'recover\')" :class="{disable:!toolbar.recover}"><i class="iconfont sdk-recover"></i>{{$t(\'cad.toolbar.recover\')}}</div> <div @click="menu(\'clear\')" :class="{disable:!toolbar.clear}"><i class="iconfont sdk-clear"></i>{{$t(\'cad.toolbar.clear\')}}</div> </li> <li> <div @click="menu(\'default\')" :class="{disable:!toolbar.default}"><i class="iconfont sdk-reset"></i>{{$t(\'cad.toolbar.default\')}}</div> <div @click="menu(\'rotate\')" :class="{disable:!toolbar.rotate}"><i class="iconfont sdk-rotate"></i>{{$t(\'cad.toolbar.rotate\')}}</div> </li> <li> <div @click="menu(\'download\')" :class="{disable:!toolbar.download}"><i class="iconfont sdk-download"></i>{{$t(\'cad.toolbar.download\')}}</div> </li> <li> <div @click="menu(\'flex\')" :class="{disable:!toolbar.flex}"><i class="iconfont sdk-adapt"></i>{{$t(\'cad.toolbar.flex\')}}</div> <div @click="menu(\'panos\')" :class="{disable:!toolbar.panos}"> <i class="iconfont" :class="[values.panos?\'sdk-checked\':\'sdk-uncheck\']" style="color: #00c8af"></i>{{$t(\'cad.toolbar.panos\')}} </div> <div @click="menu(\'texture\')" :class="{disable:!toolbar.texture}"> <i class="iconfont" :class="[values.texture?\'sdk-checked\':\'sdk-uncheck\']" style="color: #00c8af"></i>{{$t(\'cad.toolbar.texture\')}} </div> </li> <li> <div> <span>{{$t(\'cad.toolbar.unit\')}}:</span> <div style="margin-left: 10px" v-scope="Combox({change:setUnit,index:0,list:[{text:\'m\',value:\'m\'},{text:\'ft\',value:\'ft\'}],style:{height:\'24px\',width:\'60px\'}})"></div> </div> </li> </ul> </div> </div> <style> [xui_edit_cad] {\n display: none;\n position: absolute;\n pointer-events: all;\n width: 100%;\n height: 100%;\n }\n [xui_edit_cad] .compass {\n width: 64px;\n height: 64px;\n position: absolute;\n background-size: cover;\n background-repeat: no-repeat;\n right: 280px;\n top: 130px;\n cursor: pointer;\n }\n [xui_edit_cad] ul,\n [xui_edit_cad] li {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n [xui_edit_cad] canvas {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n }\n [xui_edit_cad] .prop,\n [xui_edit_cad] .tool {\n position: absolute;\n width: 240px;\n height: 100%;\n top: 0;\n right: 0;\n padding: 10px;\n background: rgba(27, 27, 28);\n z-index: 2;\n }\n [xui_edit_cad] .prop::after,\n [xui_edit_cad] .tool::after {\n position: absolute;\n content: \'\';\n top: 0;\n bottom: 0;\n left: 0;\n border-right: solid 1px rgba(255, 255, 255, 0.16);\n border-left: solid 1px #000;\n }\n [xui_edit_cad] .prop .sdk-close,\n [xui_edit_cad] .tool .sdk-close {\n /* position: absolute;\n right: 10px;\n top: 10px; */\n color: #999;\n cursor: pointer;\n }\n [xui_edit_cad] .prop .sdk-close:hover,\n [xui_edit_cad] .tool .sdk-close:hover {\n color: #fff;\n }\n [xui_edit_cad] .prop .title,\n [xui_edit_cad] .tool .title {\n font-size: 16px;\n font-weight: bold;\n margin-top: 10px;\n color: #999;\n display: flex;\n justify-content: space-between;\n }\n\n [xui_edit_cad] .tool .outline {\n height: 34px;\n border-radius: 4px;\n border: 1px solid rgba(255, 255, 255, 0.4);\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n [xui_edit_cad] .tool .tabs {\n margin-top: 30px;\n display: flex;\n width: 100%;\n }\n\n [xui_edit_cad] .tool .tabs > div {\n cursor: pointer;\n width: 100%;\n display: flex;\n height: 34px;\n border-radius: 4px;\n border: 1px solid rgba(255, 255, 255, 0.4);\n align-items: center;\n justify-content: center;\n }\n [xui_edit_cad] .tool .tabs .left {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n border-right: none;\n }\n [xui_edit_cad] .tool .tabs .right {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-left: none;\n }\n [xui_edit_cad] .tool .tabs .active {\n border: 1px solid #00c8af;\n color: #00c8af;\n }\n [xui_edit_cad] .tool .cate {\n color: #fff;\n margin-top: 20px;\n }\n [xui_edit_cad] .tool .item {\n display: flex;\n flex-wrap: wrap;\n color: #999;\n }\n [xui_edit_cad] .tool .item i {\n font-size: 32px;\n }\n [xui_edit_cad] .tool .item > div {\n cursor: pointer;\n width: 48px;\n height: 48px;\n background: rgba(255, 255, 255, 0.05);\n margin-right: 7px;\n margin-top: 10px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: solid 1px transparent;\n }\n [xui_edit_cad] .tool .item .active {\n color: #00c8af;\n border: solid 1px #00c8af;\n }\n\n [xui_edit_cad] .prop li,\n [xui_edit_cad] .tool li {\n color: #999;\n font-size: 14px;\n margin-bottom: 20px;\n padding-bottom: 20px;\n border-bottom: solid 1px rgba(255, 255, 255, 0.16);\n }\n\n [xui_edit_cad] .prop li:last-child,\n [xui_edit_cad] .tool li:last-child {\n border-bottom: none;\n }\n\n [xui_edit_cad] .tool input:focus {\n border: 1px solid #00c8af;\n }\n [xui_edit_cad] .tool li > div {\n margin-top: 10px;\n }\n\n [xui_edit_cad] .prop {\n position: absolute;\n width: 240px;\n height: 100%;\n top: 0;\n right: 0;\n padding: 10px;\n background: rgba(27, 27, 28);\n z-index: 2;\n }\n [xui_edit_cad] .prop i {\n cursor: pointer;\n }\n [xui_edit_cad] .prop .sdk-fanzhuan {\n color: var(--main-color);\n }\n [xui_edit_cad] .prop li > div {\n position: relative;\n color: #fff;\n margin-bottom: 15px;\n }\n [xui_edit_cad] .prop li > div:last-child {\n margin-bottom: 0px;\n }\n [xui_edit_cad] .prop li .between {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n [xui_edit_cad] .prop li .between button:nth-of-type {\n margin-right: 10px;\n }\n [xui_edit_cad] .prop li .between button:last-of-type {\n margin-right: 0px;\n }\n [xui_edit_cad] .menu {\n position: absolute;\n left: 0;\n top: 0;\n width: calc(100% - 240px);\n height: 40px;\n background: rgba(27, 27, 28);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 1;\n }\n [xui_edit_cad] .menu::after {\n position: absolute;\n content: \'\';\n bottom: 0;\n left: 0;\n right: 0;\n border-top: solid 1px rgba(255, 255, 255, 0.16);\n border-bottom: solid 1px #000;\n }\n [xui_edit_cad] .menu ul {\n color: #999;\n font-size: 14px;\n display: flex;\n }\n [xui_edit_cad] .menu li {\n display: flex;\n margin-left: 30px;\n border-right: solid 1px rgba(255, 255, 255, 0.16);\n }\n [xui_edit_cad] .menu li:last-child {\n border-right: none;\n }\n [xui_edit_cad] .menu li > div {\n cursor: pointer;\n margin-right: 30px;\n white-space: nowrap;\n display: flex;\n align-items: center;\n flex-wrap: nowrap;\n }\n [xui_edit_cad] .menu li > div > i {\n margin-right: 3px;\n font-size: 14px;\n }\n [xui_edit_cad] .disable {\n pointer-events: none;\n opacity: 0.5;\n } </style> ',o.$name="DesignCAD",e.resolve(o)})),e}}();
|