EditCAD.js 370 KB

1
  1. var EditCAD=function(){"use strict";var t=function(){this.version="v4.0",this.floors=[]};t.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 o=new t;window.floorplanData=o;var i={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},r=function(){};r.prototype.getFixed=function(t,e){return e||(e=5),parseFloat(t.toFixed(e))},r.prototype.getDistance=function(t,e){var o=t.x,i=t.y,n=e.x,r=e.y,s=Math.sqrt(Math.pow(o-n,2)+Math.pow(i-r,2));return this.getFixed(s)},r.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)}},r.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}},r.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},r.prototype.create2AngleLine=function(t,e,o){return{line1:this.createLine2(t,e-o/2),line2:this.createLine2(t,e+o/2)}},r.prototype.distanceForPoints=function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},r.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),r=Math.abs(e/Math.cos(n)),s=t.b;o.b=s+r,i.b=s-r}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}},r.prototype.getEndpoint=function(t,e,o){var i=this.create2AngleLine(t,e,o),n=this.createLine2(t,e);n=this.getLineForPoint(n,t);var r=this.getParallelLineForDistance(n,15),s=this.getIntersectionPoint(i.line1,r.line1),l=this.getIntersectionPoint(i.line1,r.line2),a=this.getIntersectionPoint(i.line2,r.line1),h=this.getIntersectionPoint(i.line2,r.line2),c=this.Angle(t,s,{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:s,p2:a}:{p1:l,p2:h}},r.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},r.prototype.reverse=function(t){for(var e=[],o=t.length-1;o>-1;--o)e.push(t[o]);return e},r.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)}},r.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}},r.prototype.getIntersectionPoint3=function(t,e,o,i){var n=this.getIntersectionPoint2(t,e,o,i);if(n){var r=n.x,s=n.y;return(r-t.x)*(r-e.x)<=.001&&(s-t.y)*(s-e.y)<=.001&&(r-o.x)*(r-i.x)<=.001&&(s-o.y)*(s-i.y)<=.001?{x:r,y:s}:null}return null},r.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},r.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)},r.prototype.Angle=function(t,e,o){var i,n,r=0,s=e.x-t.x,l=e.y-t.y,a=o.x-t.x,h=o.y-t.y;return r=s*a+l*h,n=(s*s+l*l)*(a*a+h*h),(r/=Math.sqrt(n))>=1?0:r<=-1?Math.PI:180*(i=Math.acos(r))/Math.PI<180?i:2*Math.PI-i},r.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},r.prototype.getJoinLinePoint=function(t,e){var o=this.getVerticalLine(e,t);return this.getIntersectionPoint(e,o)},r.prototype.getDisForPoinLine=function(t,e){var o=this.getJoinLinePoint(t,e);return this.getDistance(t,o)},r.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)},r.prototype.isContainForSegment=function(t,e,o,n){n||(n=i.minAdsorb);var r=this.getDistance(e,t)+this.getDistance(o,t),s=this.getDistance(e,o);return Math.abs(r-s)<n},r.prototype.isPointInPoly=function(t,e){for(var o=t.x,i=t.y,n=!1,r=0,s=e.length-1;r<e.length;s=r++){var l=e[r],a=e[s],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},r.prototype.getDisForPoinSegment=function(t,e,o,i){var n=this.createLine1(e,o),r=this.getJoinLinePoint(t,n),s=this.getDistance(e,o),l=this.getDistance(r,e),a=this.getDistance(r,o);return this.getDistance(r,e)>s||this.getDistance(r,o)>s?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,r)<i?{type:0,join:r}:void 0},r.prototype.PointInSegment=function(t,e,o,n){if(this.getDistance(t,e)<i.minAdsorb||this.getDistance(t,o)<i.minAdsorb)return!0;n||(n=.1),n/=2;var r=(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,l=t.x-Math.max(e.x,o.x),a=Math.min(e.y,o.y)-t.y,h=t.y-Math.max(e.y,o.y);return Math.abs(r)<n&&(s<=0||Math.abs(s)<n)&&(l<=0||Math.abs(l)<n)&&(a<=0||Math.abs(a)<n)&&(h<=0||Math.abs(h)<n)},r.prototype.isPointOnSegment=function(t,e,o){var i=t.x-e.x,n=t.y-e.y,r=t.x-o.x,s=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&&r*c+s*u<=0&&Math.abs(i*s-n*r)<=.001},r.prototype.clonePoint=function(t,e){t.x=e.x,t.y=e.y},r.prototype.equalPoint=function(t,e){return t.x==e.x&&t.y==e.y},r.prototype.crossTwoLines=function(t,e,o,n,r){void 0===r&&(r=i.minAdsorb);var s=this.getIntersectionPoint2(t,e,o,n);if(null!=s){if(this.getDistance(t,s)>r&&this.getDistance(e,s)>r&&this.getDistance(o,s)>r&&this.getDistance(n,s)>r)return this.getDistance(t,s)<this.getDistance(t,e)&&this.getDistance(e,s)<this.getDistance(t,e)&&this.getDistance(o,s)<this.getDistance(o,n)&&this.getDistance(n,s)<this.getDistance(o,n)}else if(this.PointInSegment(t,o,n)||this.PointInSegment(e,o,n))return!0;return!1},r.prototype.getDisPointsLine=function(t,e,o,i){var n={},r={},s={};if(t.hasOwnProperty("x"))n.x=t.x,n.y=e.y-o,r.x=t.x,r.y=e.y+i;else if(t.hasOwnProperty("y"))n.y=t.y,n.x=e.x-o,r.y=t.y,r.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),r.x=c.x+i*Math.cos(l),r.y=c.y+i*Math.sin(l)}return s.newpoint1=n,s.newpoint2=r,s},r.prototype.getBoundingBox=function(t){for(var e=t[0].x,o=t[0].x,i=t[0].y,n=t[0].y,r=1;r<t.length;++r){var s=t[r];e>s.x&&(e=s.x),i>s.y&&(i=s.y),o<s.x&&(o=s.x),n<s.y&&(n=s.y)}var l={};return l.minX=e,l.minY=i,l.maxX=o,l.maxY=n,l},r.prototype.getBoundingBox2=function(t){var e=null,o=null,i=null,n=null;for(var r in t){var s=t[r];(null==e||e>s.x)&&(e=s.x),(null==i||i>s.y)&&(i=s.y),(null==o||o<s.x)&&(o=s.x),(null==n||n<s.y)&&(n=s.y)}var l={};return l.minX=e,l.minY=i,l.maxX=o,l.maxY=n,l},r.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)},r.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,r=t[1],s=2;s<t.length;s++){var l=t[s],a=e(t[0],r,l);n+=a,o+=(t[0].x+r.x+l.x)*a,i+=(t[0].y+r.y+l.y)*a,r=l}return{x:o/n/3,y:i/n/3}},r.prototype.isPolyInPoly=function(t,e,o){for(var i=0;i<t.length;++i){for(var n=!1,r=0;r<e.length;++r)if(this.equalPoint(t[i],e[r])){n=!0;break}if(n){var s=i==t.length-1?0:i+1,l={x:(t[i].x+t[s].x)/2,y:(t[i].y+t[s].y)/2};if(!this.isPointInPoly(l,e,o))return!1}else if(!this.isPointInPoly(t[i],e,o))return!1}return!0},r.prototype.dotPoints=function(t,e,o,i){var n={},r={};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,r.start={},r.end={},r.start.x=0,r.start.y=0,r.end.x=i.x-o.x,r.end.y=i.y-o.y,n.end.x*r.end.x+n.end.y*r.end.y},r.prototype.translate=function(t,e,o,i){var n=e.x-t.x,r=e.y-t.y,s=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));return{x:o.x+n*i/s,y:o.y+r*i/s}},r.prototype.raySegmentIntersection=function(t,e,o,i){var n={x:t.x+e.x,y:t.y-e.z},r=this.createLine1(t,n),s=this.getIntersectionPoint4(o,i,r);return null==s||this.getDistance(n,s)-(this.getDistance(t,s)+this.getDistance(t,n))+.01>0?null:s};var s=new r,l="Point",a="WallCorner",h="Wall",c="SingleDoor",u="DoubleDoor",d="SlideDoor",y="SingleWindow",x="BayWindow",p="FrenchWindow",g="Pass",f="Beam",m="Flue",v="Corridor",S="Line",P="Tag",I="TV",b="CombinationSofa",k="SingleSofa",T="TeaTable",F="Carpet",C="Plant",w="DiningTable",W="DoubleBed",D="SingleBed",L="Wardrobe",z="Dresser",M="BedsideCupboard",R="Pillow",O="GasStove",A="Cupboard",E="Bathtub",B="Closestool",Y="Washstand",N="Desk",X="BalconyChair",j="Elevator",_="all",U="start",J="end",V="select",H="LEFT",Z="RIGHT",G=function(){this.len=null};G.prototype.setId=function(t){null==t||void 0===t?(t=re.getCurrentId(),re.updateCurrentId(),this.vectorId=this.geoType+t):this.vectorId=t},G.prototype.setSymbolPosition=function(t,e){"start"==e?s.clonePoint(this.startPoint,t):"end"==e&&s.clonePoint(this.endPoint,t)},G.prototype.setSymbolParent=function(t){this.parent=t},G.prototype.setPointParent=function(t,e){null==this.parent&&(this.parent={}),this.parent[t]=e},G.prototype.setOpenSide=function(t){var e=[];e.push(this.startPoint),e.push(this.endPoint),e.push(t);var o=null;o=s.isClockwise(e)?H:Z,this.openSide=o},G.prototype.rotatePoint=function(t,e,o){o*=-1;var i=e.x,n=e.y,r=t.x,s=t.y;return{x:i+(r-i)*Math.cos(o*Math.PI/180)-(s-n)*Math.sin(o*Math.PI/180),y:n+(r-i)*Math.sin(o*Math.PI/180)+(s-n)*Math.cos(o*Math.PI/180)}};var $=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=c,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=s.createLine1(this.startPoint,this.endPoint),e=s.getDistance(this.startPoint,this.endPoint),o=s.getParallelLineForDistance(t,e),i=s.getVerticalLine(t,this.startPoint),n=s.getVerticalLine(t,this.endPoint),r=s.getIntersectionPoint(o.line1,i),l=s.getIntersectionPoint(o.line2,i),a=s.getIntersectionPoint(o.line1,n),h=s.getIntersectionPoint(o.line2,n);if(this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(this.endPoint),this.points2d.push(a),this.points2d.push(r),this.openSide==H){if(s.isClockwise(this.points2d))return;this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(this.endPoint),this.points2d.push(h),this.points2d.push(l)}else if(this.openSide==Z){if(!s.isClockwise(this.points2d))return;this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(this.endPoint),this.points2d.push(h),this.points2d.push(l)}},e.prototype.isContain=function(t){var e=s.getDistance(t,this.startPoint),o=s.getDistance(t,this.endPoint);if(e<i.minAdsorb)return U;if(o<i.minAdsorb)return J;if(s.isContainForSegment(t,this.startPoint,this.endPoint))return V;var n=s.getDistance(this.points2d[0],this.points2d[1]);if(s.getDistance(t,this.points2d[0])>n)return null;var r=s.Angle(this.points2d[0],t,this.points2d[1]),l=s.Angle(this.points2d[0],t,this.points2d[3]);return r<Math.PI/2&&l<Math.PI/2?V:null},e}(G),K=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=u,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=s.createLine1(this.startPoint,this.endPoint),e=s.getDistance(this.startPoint,this.endPoint),o=s.getParallelLineForDistance(t,e/2),i=s.getVerticalLine(t,this.startPoint),n=s.getVerticalLine(t,this.endPoint),r={x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2},l=s.getVerticalLine(t,r),a=s.getIntersectionPoint(o.line1,i),h=s.getIntersectionPoint(o.line2,i),c=s.getIntersectionPoint(o.line1,n),u=s.getIntersectionPoint(o.line2,n),d=s.getIntersectionPoint(o.line1,l),y=s.getIntersectionPoint(o.line2,l);if(this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(r),this.points2d.push(this.endPoint),this.points2d.push(c),this.points2d.push(d),this.points2d.push(a),this.openSide==H){if(s.isClockwise(this.points2d))return;this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(r),this.points2d.push(this.endPoint),this.points2d.push(u),this.points2d.push(y),this.points2d.push(h)}else if(this.openSide==Z){if(!s.isClockwise(this.points2d))return;this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(r),this.points2d.push(this.endPoint),this.points2d.push(u),this.points2d.push(y),this.points2d.push(h)}},e.prototype.isContain=function(t){var e=s.getDistance(t,this.startPoint),o=s.getDistance(t,this.endPoint);if(e<i.minAdsorb)return U;if(o<i.minAdsorb)return J;if(s.isContainForSegment(t,this.startPoint,this.endPoint))return V;var n=[];if(n.push(this.startPoint),n.push(this.endPoint),n.push(t),this.openSide==H){if(!s.isClockwise(n))return null}else if(this.openSide==Z&&s.isClockwise(n))return null;var r={x:(this.points2d[0].x+this.points2d[1].x)/2,y:(this.points2d[0].y+this.points2d[1].y)/2},l=s.getDistance(this.points2d[1],this.points2d[2]),a=s.getDistance(t,this.points2d[0]);if(a<l){var h=s.Angle(this.points2d[0],t,this.points2d[5]),c=s.Angle(this.points2d[0],t,r);if(h<Math.PI/2&&c<Math.PI/2)return V}if((a=s.getDistance(t,this.points2d[2]))<l){var u=s.Angle(this.points2d[2],t,this.points2d[3]),d=s.Angle(this.points2d[2],t,r);if(u<Math.PI/2&&d<Math.PI/2)return V}return null},e}(G),q=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=d,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=s.createLine1(this.startPoint,this.endPoint),e=2/ie.res,o=s.getParallelLineForDistance(t,e);if(this.startPoint.x>this.endPoint.x){var i=o.line1;o.line1=o.line2,o.line2=i}var n=s.getVerticalLine(t,this.startPoint),r=s.getVerticalLine(t,this.endPoint),l=o.line1,a=o.line2,h=s.getIntersectionPoint(o.line1,n),c=s.getIntersectionPoint(o.line2,r);this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(this.endPoint),this.points2d.push(h),s.isClockwise(this.points2d)?null==this.openSide||"LEFT"==this.openSide||(l=o.line2,a=o.line1,h=s.getIntersectionPoint(l,n),c=s.getIntersectionPoint(a,r)):null!=this.openSide&&"LEFT"!=this.openSide||(l=o.line2,a=o.line1,h=s.getIntersectionPoint(l,n),c=s.getIntersectionPoint(a,r));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/ie.res,y=s.getVerticalLine(t,u),x=s.getParallelLineForDistance(y,d),p=s.getIntersectionPoint(l,x.line1),g=s.getIntersectionPoint(l,x.line2),f=s.getIntersectionPoint(a,x.line1),m=s.getIntersectionPoint(a,x.line2),v=s.getIntersectionPoint(t,x.line1),S=s.getIntersectionPoint(t,x.line2);s.getDistance(this.startPoint,v)<s.getDistance(this.startPoint,S)?(this.points2d.push(S),this.points2d.push(g),this.points2d.push(h),this.points2d.push(this.endPoint),this.points2d.push(v),this.points2d.push(f),this.points2d.push(c)):(this.points2d.push(v),this.points2d.push(p),this.points2d.push(h),this.points2d.push(this.endPoint),this.points2d.push(S),this.points2d.push(m),this.points2d.push(c))},e.prototype.isContain=function(t){var e=s.getDistance(t,this.startPoint),o=s.getDistance(t,this.endPoint);return e<i.minAdsorb?U:o<i.minAdsorb?J:s.isContainForSegment(t,this.startPoint,this.endPoint)?V:null},e}(G),Q=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=y,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/ie.res,e=s.createLine1(this.startPoint,this.endPoint),o=s.getParallelLineForDistance(e,t),i=s.getVerticalLine(e,this.startPoint),n=s.getVerticalLine(e,this.endPoint),r=s.getIntersectionPoint(i,o.line1),l=s.getIntersectionPoint(n,o.line1),a=s.getIntersectionPoint(n,o.line2),h=s.getIntersectionPoint(i,o.line2);this.points2d.push(r),this.points2d.push(l),this.points2d.push(a),this.points2d.push(h)},e.prototype.isContain=function(t){var e=s.getDistance(t,this.startPoint),o=s.getDistance(t,this.endPoint);return e<i.minAdsorb?U:o<i.minAdsorb?J:s.isContainForSegment(t,this.startPoint,this.endPoint)?V:null},e}(G),tt=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=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=4/ie.res,e=s.createLine1(this.startPoint,this.endPoint),o=s.getParallelLineForDistance(e,t),i=s.getVerticalLine(e,this.startPoint),n=s.getVerticalLine(e,this.endPoint);this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(this.endPoint);var r={x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2},l=s.getVerticalLine(e,r),a=s.getIntersectionPoint(i,o.line1),h=s.getIntersectionPoint(n,o.line1);this.points2d.push(a),this.points2d.push(h);var c=s.getIntersectionPoint(i,o.line2),u=s.getIntersectionPoint(n,o.line2);this.points2d.push(c),this.points2d.push(u);var d=s.getIntersectionPoint(l,o.line1),y=s.getIntersectionPoint(l,o.line2);this.points2d.push(d),this.points2d.push(y)},e.prototype.isContain=function(t){var e=s.getDistance(t,this.startPoint),o=s.getDistance(t,this.endPoint);return e<i.minAdsorb?U:o<i.minAdsorb?J:s.isContainForSegment(t,this.startPoint,this.endPoint)?V:null},e}(G),et=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=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,e,o,i,n=s.createLine1(this.startPoint,this.endPoint),r=s.getDistance(this.startPoint,this.endPoint)/2,l=4/ie.res+r,a={x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2},h=s.getVerticalLine(n,a),c=s.getParallelLineForDistance(h,r),u=s.getParallelLineForDistance(h,l);s.getDisForPoinLine(this.startPoint,c.line1)>s.getDisForPoinLine(this.startPoint,c.line2)?(t=c.line2,e=u.line2,o=c.line1,i=u.line1):(t=c.line1,e=u.line1,o=c.line2,i=u.line2);var d=s.getParallelLineForDistance(n,2/ie.res),y=s.getParallelLineForDistance(n,this.thickness-2/ie.res),x=s.getParallelLineForDistance(n,this.thickness),p=d.line1,g=d.line2,f=y.line2,m=x.line2,v=d.line2,S=d.line1,P=y.line1,I=x.line1,b=s.getIntersectionPoint(t,p),k=s.getIntersectionPoint(o,p),T=s.getIntersectionPoint(o,f),F=s.getIntersectionPoint(t,f),C=s.getIntersectionPoint(e,g),w=s.getIntersectionPoint(i,g),W=s.getIntersectionPoint(i,m),D=s.getIntersectionPoint(e,m),L=s.getIntersectionPoint(t,v),z=s.getIntersectionPoint(o,v),M=s.getIntersectionPoint(o,P),R=s.getIntersectionPoint(t,P),O=s.getIntersectionPoint(e,S),A=s.getIntersectionPoint(i,S),E=s.getIntersectionPoint(i,I),B=s.getIntersectionPoint(e,I);this.points2d=[],this.points2d.push(b),this.points2d.push(k),this.points2d.push(T),this.points2d.push(F),"LEFT"==this.openSide?s.isClockwise(this.points2d)?(this.points2d.push(C),this.points2d.push(w),this.points2d.push(W),this.points2d.push(D)):(this.points2d=[],this.points2d.push(L),this.points2d.push(z),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&&(s.isClockwise(this.points2d)?(this.points2d=[],this.points2d.push(L),this.points2d.push(z),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(C),this.points2d.push(w),this.points2d.push(W),this.points2d.push(D)))},e.prototype.isContain=function(t){var e=s.getDistance(t,this.startPoint),o=s.getDistance(t,this.endPoint);if(e<i.minAdsorb)return U;if(o<i.minAdsorb)return J;var n=s.isContainForSegment(t,this.startPoint,this.endPoint);if(n)return V;var r=[];return r[0]=this.points2d[4],r[1]=this.points2d[5],r[2]=this.points2d[6],r[3]=this.points2d[7],(n=s.isPointInPoly(t,r))?V:null},e}(G),ot=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=g,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/ie.res,e=s.createLine1(this.startPoint,this.endPoint),o=s.getParallelLineForDistance(e,t),i=s.getVerticalLine(e,this.startPoint),n=s.getVerticalLine(e,this.endPoint),r=s.getIntersectionPoint(i,o.line1),l=s.getIntersectionPoint(n,o.line1),a=s.getIntersectionPoint(n,o.line2),h=s.getIntersectionPoint(i,o.line2);this.points2d.push(r),this.points2d.push(l),this.points2d.push(a),this.points2d.push(h),t=2/ie.res,o=s.getParallelLineForDistance(e,t);var c=s.getIntersectionPoint(i,o.line1),u=s.getIntersectionPoint(n,o.line1),d=s.getIntersectionPoint(n,o.line2),y=s.getIntersectionPoint(i,o.line2);this.points2d.push(c),this.points2d.push(u),this.points2d.push(d),this.points2d.push(y)},e.prototype.isContain=function(t){var e=s.getDistance(t,this.startPoint),o=s.getDistance(t,this.endPoint);return e<i.minAdsorb?U:o<i.minAdsorb?J:s.isContainForSegment(t,this.startPoint,this.endPoint)?V:null},e}(G),it=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=l,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}(G),nt=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=h,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}(G),rt=function(){};rt.prototype.getLine=function(t){var e=re.getPoint(t.start),o=re.getPoint(t.end);return s.createLine1(e,o)},rt.prototype.isContain=function(t,e,o){var i=re.getPoint(t.start),n=re.getPoint(t.end);return s.isContainForSegment(e,i,n,o)},rt.prototype.addChildren=function(t,e){t.children.indexOf(e)<0&&t.children.push(e)},rt.prototype.createWall=function(t,e,o,i){var n=new nt(t,e,o,i);return null!=i&&void 0!==i||(i=re.currentFloor),re.addWall(n,i),this.setPointParent(n.vectorId,t,"start",i),this.setPointParent(n.vectorId,e,"end",i),n},rt.prototype.createPoint=function(t,e,o,i){var n=new it(t,e,o,i);return null!=i&&void 0!==i||(i=re.currentFloor),re.addPoint(n,i),n},rt.prototype.setPointParent=function(t,e,o,i){var n=re.getPoint(e,i),r=re.getWall(t,i);n.setPointParent(t,o),"start"==o?r.start=e:"end"==o&&(r.end=e)},rt.prototype.splitWall=function(t,e,o){var n=re.getWall(t),r=re.getPoint(n.start),l=re.getPoint(n.end),a=re.getPoint(e);s.getDistance(r,a)<i.minAdsorb||(s.getDistance(l,a),i.minAdsorb);var h=null;"start"==o?(delete l.parent[t],(h=this.createWall(e,n.end)).setOut(n.out),h.setImportant(n.important),this.setPointParent(t,e,"end"),l.setPointParent(h.vectorId,o)):"end"==o&&(delete r.parent[t],(h=this.createWall(n.start,e)).setOut(n.out),h.setImportant(n.important),this.setPointParent(t,e,"start"),r.setPointParent(h.vectorId,o));for(var c=0;c<n.children.length;++c){var u=n.children[c],d=re.getSymbol(u),y={x:(d.startPoint.x+d.endPoint.x)/2,y:(d.startPoint.y+d.endPoint.y)/2};this.isContain(h,y)&&(d.setSymbolParent(h.vectorId),n.children.splice(c,1),--c,h.children.push(u))}return h.vectorId},rt.prototype.getWallId=function(t,e){var o=re.getPoint(t),i=re.getPoint(e);if(!o||!i)return console.log("pointId1或者pointId2不存在"),null;if(t==e)return console.log("给的是同一个point"),null;var n=o.parent,r=i.parent;for(var s in n)if(r.hasOwnProperty(s))return s;return null},rt.prototype.isWallLink=function(t,e){var o=re.getWall(t),i=re.getWall(e);return o.start==i.start||o.start==i.end||o.end==i.start||o.end==i.end},rt.prototype.AngleForWall=function(t,e){var o=re.getWall(t),i=re.getWall(e);if(null==o||null==i||void 0===o||void 0===i)return null;var n=re.getPoint(o.start),r=re.getPoint(o.end),l=re.getPoint(i.start),a=re.getPoint(i.end),h=s.getDistance(n,l),c=s.getDistance(n,a),u=s.getDistance(r,l),d=s.getDistance(r,a),y=Math.min(h,c,u,d);return null==s.getIntersectionPoint2(n,r,l,a)?Math.PI:h==y?(r.x+=l.x-n.x,r.y+=l.y-n.y,s.Angle(l,r,a)):c==y?(r.x+=a.x-n.x,r.y+=a.y-n.y,s.Angle(a,r,l)):u==y?(n.x+=l.x-r.x,n.y+=l.y-r.y,s.Angle(l,n,a)):d==y?(n.x+=a.x-r.x,n.y+=a.y-r.y,s.Angle(a,n,l)):(console.error("AngleForWall**************************1"),null)},rt.prototype.AngleForWall2=function(t,e){var o=re.getWall(t),i=re.getWall(e);if(null==o||null==i||void 0===o||void 0===i)return null;var n=re.getPoint(o.start),r=re.getPoint(o.end),l=re.getPoint(i.start),a=re.getPoint(i.end),h=null,c=[];return c.push(n),c.push(r),o.start==i.start?(h=s.Angle(n,r,a),c.push(a)):o.start==i.end?(h=s.Angle(n,r,l),c.push(l)):o.end==i.start?(h=s.Angle(r,n,a),c[0]=r,c[1]=n,c.push(a)):o.end==i.end&&(h=s.Angle(r,n,l),c[0]=r,c[1]=n,c.push(l)),null==h?null:s.isClockwise(c)?{angle:h,clockwise:1}:{angle:h,clockwise:0}},rt.prototype.AngleForWall3=function(t,e){var o=re.getWall(t),i=re.getWall(e);if(null==o||null==i||void 0===o||void 0===i)return null;var n=re.getPoint(o.start),r=re.getPoint(o.end),l=re.getPoint(i.start),a=re.getPoint(i.end),h=s.getDistance(n,l),c=s.getDistance(n,a),u=s.getDistance(r,l),d=s.getDistance(r,a),y=Math.min(h,c,u,d),x={},p={};return h==y?(p.x=r.x+l.x-n.x,p.y=r.y+l.y-n.y,s.Angle(l,p,a)):c==y?(p.x=r.x+a.x-n.x,p.y=r.y+a.y-n.y,s.Angle(a,p,l)):u==y?(x.x=n.x+l.x-r.x,x.y=n.y+l.y-r.y,s.Angle(l,x,a)):d==y?(x.x=n.x+a.x-r.x,x.y=n.y+a.y-r.y,s.Angle(a,x,l)):(console.error("WallService.AngleForWall3************************************1"),null)},rt.prototype.wallIdForMinAngle=function(t,e){var o,i,n,r,s=re.getPoint(t).parent,l=null,a=null,h=null,c=null;if(Object.keys(s).length>2){for(var u in s)if(u!=e){var d=this.AngleForWall2(e,u);null==h&&1==d.clockwise?((i=d).wallId=u,h=d.angle,(r=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?((r=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=r,y.min0.angle=360-r.angle),y.min1||(y.min1=n,y.min1.angle=360-n.angle),y}return console.error("wallIdForMinAngle*********************************************************"),null},rt.prototype.mergeWall=function(t,e){var o=this.getLinkPointId(t,e),i=re.getWall(e).getOtherPointId(o),n=re.getPoint(i);if(this.changeSymbolsWallToWall(e,t),Object.keys(n.parent).length>1)this.moveTo(o,i);else{re.deleteWall(e);var r=re.getPoint(o);s.clonePoint(r,n)}return i},rt.prototype.changeSymbolsWallToWall=function(t,e,o){for(var i=re.getWall(t,o),n=re.getWall(e,o),r=0;r<i.children.length;++r){var s=i.children[r];re.getSymbol(s,o).setSymbolParent(e),this.addChildren(n,s)}i.clearChildren()},rt.prototype.mergeWallForPoint=function(t){var e=re.getPoint(t);if(null!=e&&2==Object.keys(e.parent).length&&this.AngleForWall(Object.keys(e.parent)[0],Object.keys(e.parent)[1])>i.maxAngle/180*Math.PI)return this.mergeWall(Object.keys(e.parent)[0],Object.keys(e.parent)[1]);return null},rt.prototype.getLinkPointId=function(t,e){var o=re.getWall(t),i=re.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},rt.prototype.moveTo=function(t,e){var o=this.getWallId(t,e),n=re.getPoint(t),r=re.getPoint(e);n.x,r.x,n.y,r.y;var l=n.parent,a=r.parent;for(var h in l)if(h!=o){var c=re.getWall(h).getOtherPointId(t),u=re.getPoint(c);for(var d in a)if(d!=o){var y=re.getWall(d).getOtherPointId(e),x=re.getPoint(y),p=s.Angle(r,u,x);if(Math.abs(p)<i.minAngle/180*Math.PI)return!1}}if(null!=o&&re.deleteWall(o),n=re.getPoint(t),r=re.getPoint(e),!n||!r)return!1;for(var g in l){var f=re.getWall(g),m=f.getOtherPointId(t);if(null!=this.getWallId(m,e))return!1;f.start==t?(re.deletePoint(f.start,g),f.start=e,r.setPointParent(g,"start")):f.end==t?(re.deletePoint(f.end,g),f.end=e,r.setPointParent(g,"end")):console.error("wallService.moveTo****************************************************")}return!0},rt.prototype.getDirction=function(t,e){var o=re.getWall(e);return o.start==t?"start":o.end==t?"end":(console.error("WallService.getDirction*******************************************************************************************"),null)},rt.prototype.isOverlapForMergePoint=function(t,e){var o=this.getWallId(t,e),n=re.getPoint(t),r=re.getPoint(e),l=n.x-r.x,a=n.y-r.y,h=n.parent,c=r.parent;for(var u in h)if(u!=o){var d=re.getWall(u).getOtherPointId(t),y=re.getPoint(d),x={x:y.x-l,y:y.y-a};for(var p in c)if(p!=o){var g=re.getWall(p).getOtherPointId(e),f=re.getPoint(g),m=s.Angle(r,x,f);if(Math.abs(m)<i.minAngle/180*Math.PI)return!0}}return!1},rt.prototype.subtraWallFromIntersect=function(t,e){var o=re.getPoint(t),i=o.parent,n=this.getDirction(t,e);if(1!=Object.keys(i).length){delete i[e];var r=this.createPoint(o.x,o.y);r.setPointParent(e,n);var s=re.getWall(e);"start"==n?s.start=r.vectorId:"end"==n&&(s.end=r.vectorId)}},rt.prototype.setWallInfo=function(t){var e=re.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},rt.prototype.setPointInfo=function(t){var e=re.getPoint(t.vectorId);return s.clonePoint(e,t.position),e.parent=JSON.parse(JSON.stringify(t.parent)),e},rt.prototype.getNeighPoints=function(t,e){var o=[],i=re.getPoint(t);for(var n in i.parent){var r=re.getWall(n).getOtherPointId(t);if(!e||e!=r){var s=re.getPoint(r);o.push(s)}}return o},rt.prototype.deleteWallCorner=function(t){var e=re.getPoint(t);if(1==Object.keys(e.parent).length)re.deleteWall(Object.keys(e.parent)[0]);else if(Object.keys(e.parent).length>2)for(var o in e.parent)re.deleteWall(o);else if(2==Object.keys(e.parent).length){this.AngleForWall(Object.keys(e.parent)[0],Object.keys(e.parent)[1])>i.maxAngle/180*Math.PI?this.mergeWall(Object.keys(e.parent)[0],Object.keys(e.parent)[1]):(re.deleteWall(Object.keys(e.parent)[0]),re.deleteWall(Object.keys(e.parent)[0]))}};var st=new rt,lt=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=f,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 s.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),r=this.rotatePoint({x:o,y:i},this.center,this.angle),s=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(r),this.points2d.push(s),this.points2d.push(l)},e}(G),at=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=m,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]),s.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),r=this.rotatePoint({x:o,y:i},this.center,this.angle),s=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(r),this.points2d.push(s),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}(G),ht=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=v,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]),s.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),r=this.rotatePoint({x:o,y:i},this.center,this.angle),s=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(r),this.points2d.push(s),this.points2d.push(l);var a=this.center.x-2/ie.res,h=this.center.x+2/ie.res,c=3/ie.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),x=this.rotatePoint({x:h,y:e},this.center,this.angle);this.points2d.push(y),this.points2d.push(x);for(var p=Math.floor(this.sideThickness*ie.res/3),g=0;g<p-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}(G),ct=function(){this.sideWidth=.65,this.sideThickness=.65};ct.prototype.createComponent=function(t,e,o){var i=null;switch(e){case f:i=new lt(t,o);break;case m:i=new at(t,o);break;case v:i=new ht(t,o)}return i.setPoints2d(),re.addComponent(i),i},ct.prototype.isComponent=function(t){switch(t){case f:case m:case v:return!0}return!1},ct.prototype.setComponentInfo=function(t){var e=re.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))},ct.prototype.getBoundingVertexs=function(t,e){var o=re.getComponent(t),i=e.x-o.sideWidth/2,n=e.y-o.sideThickness/2,r=e.x+o.sideWidth/2,s=e.y+o.sideThickness/2,l=o.rotatePoint({x:i,y:s},e,o.angle),a=o.rotatePoint({x:r,y:s},e,o.angle),h=o.rotatePoint({x:r,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 ut=new ct,dt=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 s.isPointInPoly(t,e)},e.prototype.getScale=function(){switch(this.geoType){case I:return 1.3;case b:return 3.4;case k:return 1;case T:return.8;case F:return 2;case C:return 1;case w:return 2.4;case W:case D:return 2;case L:return 1.2;case z:return.8;case M:return.4;case R:return.6;case O:return 1;case A:return 1.2;case E:return 1.6;case B:return.63;case Y:return.8;case N:return 1.2;case X:return 2;case j:return 1.5}},e.prototype.getLengthWidth=function(){switch(this.geoType){case I:return{length:32,width:10};case b:return{length:32,width:28};case k:return{length:26,width:20};case T:return{length:30,width:16};case F:return{length:32,width:20};case C:return{length:28,width:28};case w:return{length:28,width:26};case W:return{length:24,width:26};case D:return{length:18,width:26};case L:return{length:30,width:18};case z:return{length:28,width:26};case M:return{length:28,width:28};case R:return{length:26,width:26};case O:return{length:32,width:20};case A:return{length:12,width:32};case E:return{length:32,width:18};case B:return{length:22,width:28};case Y:return{length:28,width:20};case N:return{length:26,width:20};case X:return{length:32,width:10};case j:return{length:28,width:28}}},e.prototype.getBoundingVertexs=function(t){var e=[],o=this.getLengthWidth(),n=this.getScale()*o.length*this.zoom/i.furnitureWidth,r=this.getScale()*o.width*this.zoom/i.furnitureWidth,s=t.x-n/2,l=t.y-r/2,a=t.x+n/2,h=t.y+r/2,c=this.rotatePoint({x:s,y:h},t,this.angle),u=this.rotatePoint({x:a,y:h},t,this.angle),d=this.rotatePoint({x:a,y:l},t,this.angle),y=this.rotatePoint({x:s,y:l},t,this.angle);return e.push(c),e.push(u),e.push(d),e.push(y),e},e}(G),yt="Wall",xt="OutWall",pt="SingleDoor",gt="DoubleDoor",ft="SlideDoor",mt="SingleWindow",vt="BayWindow",St="FrenchWindow",Pt="Pass",It="Beam",bt="Flue",kt="Corridor",Tt="Tag",Ft="TV",Ct="CombinationSofa",wt="SingleSofa",Wt="TeaTable",Dt="Carpet",Lt="Plant",zt="DiningTable",Mt="DoubleBed",Rt="SingleBed",Ot="Wardrobe",At="Dresser",Et="BedsideCupboard",Bt="Pillow",Yt="GasStove",Nt="Cupboard",Xt="Bathtub",jt="Closestool",_t="Washstand",Ut="Desk",Jt="BalconyChair",Vt="Elevator",Ht={TV:Ft,CombinationSofa:Ct,SingleSofa:wt,TeaTable:Wt,Carpet:Dt,Plant:Lt,DiningTable:zt,DoubleBed:Mt,SingleBed:Rt,Wardrobe:Ot,Dresser:At,BedsideCupboard:Et,Pillow:Bt,GasStove:Yt,Cupboard:Nt,Bathtub:Xt,Closestool:jt,Washstand:_t,Desk:Ut,BalconyChair:Jt,Elevator:Vt},Zt=function(){this.$app=null,this.furnitures=null};Zt.prototype.fetchFurnitures=function(){var t=this;if(!this.furnitures){this.furnitures={};var e=function(e){e==Ht.TV&&t.$app.store.getAppImage("images/cad/furnitures/"+Ht[e]+".svg").then((function(o){t.furnitures[Ht[e]]=o,console.log(t.furnitures)})).catch((function(t){console.error(t)}))};for(var o in Ht)e(o)}},Zt.prototype.createFurniture=function(t,e,o){var i=null;switch(e){case I:i=new dt(t,o,I);break;case b:i=new dt(t,o,b);break;case k:i=new dt(t,o,k);break;case T:i=new dt(t,o,T);break;case F:i=new dt(t,o,F);break;case C:i=new dt(t,o,C);break;case w:i=new dt(t,o,w);break;case W:i=new dt(t,o,W);break;case D:i=new dt(t,o,D);break;case L:i=new dt(t,o,L);break;case z:i=new dt(t,o,z);break;case M:i=new dt(t,o,M);break;case R:i=new dt(t,o,R);break;case O:i=new dt(t,o,O);break;case A:i=new dt(t,o,A);break;case E:i=new dt(t,o,E);break;case B:i=new dt(t,o,B);break;case Y:i=new dt(t,o,Y);break;case N:i=new dt(t,o,N);break;case X:i=new dt(t,o,X);break;case j:i=new dt(t,o,j)}return re.addFurniture(i),i},Zt.prototype.isFurniture=function(t){switch(t){case I:case b:case k:case T:case F:case C:case w:case W:case D:case L:case z:case M:case R:case O:case A:case E:case B:case Y:case N:case X:case j:return!0}return!1},Zt.prototype.setFurnitureInfo=function(t){var e=re.getFurniture(t.vectorId);e.vectorId=t.vectorId,e.angle=t.angle,e.center=JSON.parse(JSON.stringify(t.center))},Zt.prototype.getFurniture=function(t){return this.furnitures[t]};var Gt=new Zt,$t=function(){this.eventName=null,this.selectItem=null,this.focusItem=null,this.draggingItem=null};$t.prototype.getEventName=function(){return this.eventName},$t.prototype.setEventName=function(t){this.eventName=t},$t.prototype.clearEventName=function(){this.eventName=null},$t.prototype.setSelectItem=function(t,e,o){this.selectItem={},this.selectItem.vectorId=t,this.selectItem.type=e,ee.isSymbol(e)?this.selectItem.selectIndex=o==V?_:o:ut.isComponent(e)?o==V&&(this.selectItem.selectIndex=_):e==P?this.selectItem.selectIndex=o==V?_:o:Gt.isFurniture(e)&&o==V&&(this.selectItem.selectIndex=_)},$t.prototype.getSelectItem=function(){return this.selectItem},$t.prototype.clearSelectItem=function(){this.selectItem=null},$t.prototype.getDraggingItem=function(){return this.draggingItem},$t.prototype.setDraggingItem=function(t){this.draggingItem=t},$t.prototype.clearDraggingItem=function(){this.draggingItem=null},$t.prototype.getFocusItem=function(){return this.focusItem},$t.prototype.setFocusItem=function(t){this.focusItem=t},$t.prototype.clearFocusItem=function(){this.focusItem=null},$t.prototype.clearItems=function(){this.selectItem=null,this.focusItem=null,this.draggingItem=null};var Kt=new $t,qt=function(){this.symbol=null};qt.prototype.moveFullSymbol=function(t,e,o){var i=re.getSymbol(e),n=re.getWall(o);if(!n)return null;var r=st.getLine(n),l=s.getVerticalLine(r,t),a=i.len;null==a&&(a=s.getDistance(i.startPoint,i.endPoint));var h=s.getIntersectionPoint(l,r),c=ee.getNewPosForSymbol(h,o,e);null!=c&&c.state&&(s.dotPoints(i.startPoint,i.endPoint,c.position1,c.position2)>0?(s.clonePoint(i.startPoint,c.position1),s.clonePoint(i.endPoint,c.position2)):(s.clonePoint(i.endPoint,c.position1),s.clonePoint(i.startPoint,c.position2)),i.parent!=o&&ee.changeSymbolForBelong(e,o),i.setOpenSide(t),i.setPoints2d(),ee.setPosition3d(i))},qt.prototype.moveSymbolPoint=function(t,e,o){var n=ee.moveSymbolSinglePoint(t,e,o);if(null==n)return null;var r=re.getSymbol(e),l={x:(r.startPoint.x+r.endPoint.x)/2,y:(r.startPoint.y+r.endPoint.y)/2},a=s.getDistance(l,n.position);if(a<i.minSymbolLen)return null;if(2*a>i.maxSymbolLen)return null;var h=re.getWall(r.parent),c=re.getPoint(h.start),u=re.getPoint(h.end);if(o==U){var d=ee.getNewForContainSymbols(r.endPoint,n.position,r.parent,e);if(null==d||d.collision)return null;st.isContain(h,n.position)?ee.setPosition(r,n.position,"start"):s.getDistance(r.startPoint,c)<s.getDistance(r.startPoint,u)?ee.setPosition(r,c,"start"):ee.setPosition(r,u,"start")}else{var y=ee.getNewForContainSymbols(r.startPoint,n.position,r.parent,e);if(null==y||y.collision)return null;st.isContain(h,n.position)?ee.setPosition(r,n.position,"end"):s.getDistance(r.endPoint,c)<s.getDistance(r.endPoint,u)?ee.setPosition(r,c,"end"):ee.setPosition(r,u,"end")}r.setPoints2d(),ee.setPosition3d(r)};var Qt=new qt,te=function(){this.enterImg=null};te.prototype.createSymbol=function(t,e,o,i,n){var r=null;switch(o){case x:r=new et(t,e,n);break;case p:r=new tt(t,e,n);break;case c:r=new $(t,e,n);break;case u:r=new K(t,e,n);break;case d:r=new q(t,e,n);break;case y:r=new Q(t,e,n);break;case g:r=new ot(t,e,n)}if(null!=r&&(r.setSymbolParent(i),r.setPoints2d(),this.setPosition3d(r),re.addSymbol(r)),i){var l=re.getWall(i);st.addChildren(l,r.vectorId)}return r.len=s.getDistance(t,e),r},te.prototype.addSymbol=function(t,e,o){var i=this.getDefaultSymbolLen(e),n=re.getWall(o),r=st.getLine(n);t=s.getJoinLinePoint(t,r);var l=this.getNewPosForSymbol(t,o,null,i);return l.state?this.createSymbol(l.position1,l.position2,e,o).vectorId:null},te.prototype.setPosition3d=function(t){var e={x:(t.startPoint.x+t.endPoint.x)/2,y:(t.startPoint.y+t.endPoint.y)/2},o=re.getFloorHeight();t.position3d={x:e.x,y:o,z:-1*e.y}},te.prototype.isSymbol=function(t){switch(t){case"BayWindow":case"FrenchWindow":case"SingleDoor":case"DoubleDoor":case"SlideDoor":case"SingleWindow":case"Pass":return!0}return!1},te.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},te.prototype.deleteSymbolForWall=function(t,e){if(t){var o=t.children.indexOf(e);o>-1&&t.children.splice(o,1),re.getSymbol(e).parent=null}},te.prototype.deleteSymbol=function(t){var e=re.getSymbol(t);if(e.parent){var o=re.getWall(e.parent);this.deleteSymbolForWall(o,t)}re.deleteSymbol(t)},te.prototype.changeSymbolForBelong=function(t,e){var o=re.getSymbol(t),i=o.parent,n=re.getWall(i);this.deleteSymbolForWall(n,t),o.setSymbolParent(e);var r=re.getWall(e);st.addChildren(r,t)},te.prototype.reBelongForSplitWall=function(t,e,o){for(var i=re.getWall(t),n=0;n<i.children.length;++n){var r=i.children[n];t!=e&&this.isContainSymbolForWall(r,e)?this.changeSymbolForBelong(r,e):t!=o&&this.isContainSymbolForWall(r,o)&&this.changeSymbolForBelong(r,o)}},te.prototype.isContainSymbolForWall=function(t,e){var o=re.getWall(e),i=re.getSymbol(t),n={x:(i.startPoint.x+i.endPoint.x)/2,y:(i.startPoint.y+i.endPoint.y)/2};if(st.isContain(o,n))return!0},te.prototype.changeSymbolForBelong=function(t,e){var o=re.getSymbol(t),i=o.parent,n=re.getWall(i);this.deleteSymbolForWall(n,t),o.setSymbolParent(e);var r=re.getWall(e);st.addChildren(r,t)},te.prototype.updateSymbolsPositionsForWallCorner=function(t){var e=re.getPoint(t).parent;for(var o in e)this.updateSymbolsPositionsForWall(o)},te.prototype.updateSymbolsPositionsForWall=function(t){for(var e=re.getWall(t).children,o=0;o<e.length;++o){var i=re.getSymbol(e[o]);this.updateSEForChangeWall(i)}},te.prototype.updateSEForChangeWall=function(t){var e=t.vectorId,o=re.getWall(t.parent),i=re.getPoint(o.start),n=re.getPoint(o.end),r=s.createLine1(i,n),l=s.getJoinLinePoint(t.startPoint,r),a=s.getJoinLinePoint(t.endPoint,r),h={x:0,y:0},c=!0;st.isContain(o,l)?st.isContain(o,a)||(s.getDistance(a,i)<s.getDistance(a,n)?(h.x=i.x-a.x,h.y=i.y-a.y):(h.x=n.x-a.x,h.y=n.y-a.y),a.x+=h.x,a.y+=h.y,st.isContain(o,{x:l.x+h.x,y:l.y+h.y})&&(l.x+=h.x,l.y+=h.y),c=!1):(s.getDistance(l,i)<s.getDistance(l,n)?(h.x=i.x-l.x,h.y=i.y-l.y):(h.x=n.x-l.x,h.y=n.y-l.y),l.x+=h.x,l.y+=h.y,st.isContain(o,{x:a.x+h.x,y:a.y+h.y})&&(a.x+=h.x,a.y+=h.y),c=!1),c?(this.setPosition(t,l,"start"),this.setPosition(t,a,"end"),t.setPoints2d()):this.updateSEForCollideSymbols(e,l,a)},te.prototype.updateSEForCollideSymbols=function(t,e,o){var n=re.getSymbol(t),r=this.getNewForContainSymbols(e,o,n.parent,t);null!=r&&(s.getDistance(r.position1,r.position2)<i.minSymbolLen?this.deleteSymbol(t):(this.setPosition(n,r.position1,"start"),this.setPosition(n,r.position2,"end"),n.setPoints2d()))},te.prototype.getNewForContainSymbols=function(t,e,o,n){for(var r=re.getWall(o),l=[],a=0;a<r.children.length;++a){var h=r.children[a];if(h!=n){var c=re.getSymbol(h);l.push({x:c.startPoint.x,y:c.startPoint.y,index:1,vectorId:h}),l.push({x:c.endPoint.x,y:c.endPoint.y,index:2,vectorId:h})}}l.push({x:t.x,y:t.y,index:1,vectorId:n}),l.push({x:e.x,y:e.y,index:2,vectorId:n});var u=re.getPoint(r.start);l=l.sort(function(t,e){return s.getDistance(u,t)-s.getDistance(u,e)}.bind(this));for(var d=0;d<l.length-1;++d)if(l[d].vectorId==n)if(0==d||d==l.length-2){if(s.getDistance(l[d],l[d+1])<i.minSymbolLen)return null;if(l[d+1].vectorId==n)return{position1:t,position2:{x:l[d+1].x,y:l[d+1].y}};if(l[d+1].vectorId!=n)return{position1:t,position2:{x:l[d+1].x,y:l[d+1].y},collision:!0}}else if(l[d+1].vectorId==n&&l[d-1].vectorId!=l[d+2].vectorId)return s.getDistance({x:l[d-1].x,y:l[d-1].y},{x:l[d+2].x,y:l[d+2].y})<i.minSymbolLen?null:{position1:{x:l[d-1].x,y:l[d-1].y},position2:{x:l[d+2].x,y:l[d+2].y}};return null},te.prototype.getNewPosForSymbol=function(t,e,o,n){var r=re.getWall(e),l=re.getPoint(r.start),a=re.getPoint(r.end),c=st.getLine(r),u=s.getVerticalLine(c,t),d=n;o&&(d=re.getSymbol(o).len);var y=s.getParallelLineForDistance(u,d/2),x=s.getIntersectionPoint(y.line1,c),p=s.getIntersectionPoint(y.line2,c);if(s.getDistance(l,a)<d)s.clonePoint(x,l),s.clonePoint(p,a);else{var g,f,m={},v={};st.isContain(r,x)?st.isContain(r,p)||(g=l.x-p.x,f=l.y-p.y,m.x=x.x+g,m.y=x.y+f,st.isContain(r,m)?(x.x+=g,x.y+=f,s.clonePoint(p,l)):(g=a.x-p.x,f=a.y-p.y,x.x+=g,x.y+=f,s.clonePoint(p,a))):(g=l.x-x.x,f=l.y-x.y,v.x=p.x+g,v.y=p.y+f,st.isContain(r,v)?(p.x+=g,p.y+=f,s.clonePoint(x,l)):(g=a.x-x.x,f=a.y-x.y,p.x+=g,p.y+=f,s.clonePoint(x,a)))}for(var S=[],P=0;P<r.children.length;++P){var I=r.children[P];if(I!=o){var b=re.getSymbol(I);S.push({x:b.startPoint.x,y:b.startPoint.y,index:1,vectorId:I}),S.push({x:b.endPoint.x,y:b.endPoint.y,index:2,vectorId:I})}}S.push({x:l.x,y:l.y,index:1,vectorId:e,type:h}),S.push({x:a.x,y:a.y,index:2,vectorId:e,type:h}),S=S.sort(function(t,e){return s.getDistance(l,t)-s.getDistance(l,e)}.bind(this));for(var k=0;k<S.length-1;++k)if(s.isContainForSegment(t,S[k],S[k+1])){if(s.getDistance(S[k],S[k+1])>d){if(S[k].vectorId==S[k+1].vectorId&&S[k].type!=h)return{position1:x,position2:p,collision:!0,state:!1};if(S[k].vectorId==S[k+1].vectorId&&S[k].type==h)return{position1:x,position2:p,collision:!0,state:!0};if(!s.isContainForSegment(x,S[k],S[k+1])||!s.isContainForSegment(p,S[k],S[k+1]))return{position1:x,position2:p,collision:!0,state:!1}}else{if(s.getDistance(S[k],S[k+1])<i.minSymbolLen)return{position1:x,position2:p,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!=h)return{position1:x,position2:p,collision:!0,state:!1};if(S[k].vectorId==S[k+1].vectorId&&S[k].type==h)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(s.getDistance(t,S[k])<i.minAdsorb)return{position1:x,position2:p,collision:!0,state:!1};return{position1:x,position2:p,collision:!1,state:!0}},te.prototype.setPosition=function(t,e,o){"start"==o?s.clonePoint(t.startPoint,e):"end"==o&&s.clonePoint(t.endPoint,e)},te.prototype.updateSymbolsPositionsForNeighWall=function(t){for(var e=re.getWall(t).children,o=0;o<e.length;++o)this.updateSEForWallSize(e[o])},te.prototype.updateSEForWallSize=function(t){var e=re.getSymbol(t),o=re.getWall(e.parent),i=re.getPoint(o.start),n=re.getPoint(o.end),r={x:e.startPoint.x,y:e.startPoint.y},l={x:e.endPoint.x,y:e.endPoint.y},a={x:0,y:0};if(st.isContain(o,r)){if(st.isContain(o,l))return null;s.getDistance(l,i)<s.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}else s.getDistance(r,i)<s.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;this.updateSEForCollideSymbols(t,r,l)},te.prototype.updateSymbolForLen=function(t,e){var o=re.getSymbol(t),i=o.startPoint,n=o.endPoint,r=s.createLine1(i,n),l={x:(i.x+n.x)/2,y:(i.y+n.y)/2},a=s.getVerticalLine(r,l),h=re.getWall(o.parent),c=re.getPoint(h.start),u=re.getPoint(h.end);if(null==e||void 0===e){e=s.getDistance(i,n);var d=s.getDistance(c,u);e>d&&(e=d)}var y=s.getParallelLineForDistance(a,e/2),x=s.getIntersectionPoint(y.line1,r),p=s.getIntersectionPoint(y.line2,r),g={};s.getDistance(i,x)<s.getDistance(i,p)?(g.start=x,g.end=p):(g.start=p,g.end=x);var f,m,v=!1,S=!1,P=this.getNearestPosition(o.parent,t,!0);return null!=P.startPosition&&s.PointInSegment(P.startPosition,g.start,g.end)&&(f=g.start.x-P.startPosition.x,m=g.start.y-P.startPosition.y,s.clonePoint(g.start,P.startPosition),g.end.x-=f,g.end.y-=m,v=!0),null!=P.endPosition&&s.PointInSegment(P.endPosition,g.start,g.end)&&(f=g.end.x-P.endPosition.x,m=g.end.y-P.endPosition.y,s.clonePoint(g.end,P.endPosition),v||(g.start.x-=f,g.start.y-=m,s.PointInSegment(P.startPosition,g.start,g.end)&&(s.clonePoint(g.start,P.startPosition),v=!0)),S=!0),g.vectorId=t,s.clonePoint(o.startPoint,g.start),s.clonePoint(o.endPoint,g.end),o.setPoints2d(),{block:v&S,start:g.start,end:g.end}},te.prototype.getNearestPosition=function(t,e,o,i,n){var r=re.getWall(t),l=re.getPoint(r.start),a=re.getPoint(r.end),h=r.children,c=re.getSymbol(e);c||e||(c={},(c={struct:{}}).startPoint=i,c.endPoint=n);for(var u=1e4,d=1e4,y=null,x=null,p=null,g=null,f=0;f<h.length;++f)if(h[f]!=e){var m=re.getSymbol(h[f]),v=s.getDistance(c.startPoint,m.startPoint),S=s.getDistance(c.startPoint,m.endPoint);u>Math.min(v,S)&&(v<S?(y=m.startPoint,p=m.endPoint):(y=m.endPoint,p=m.startPoint),s.getDistance(c.startPoint,y)>s.getDistance(c.endPoint,y)?(y=null,p=null):u=Math.min(v,S));var P=s.getDistance(c.endPoint,m.startPoint),I=s.getDistance(c.endPoint,m.endPoint);d>Math.min(P,I)&&(P<I?(x=m.startPoint,g=m.endPoint):(x=m.endPoint,g=m.startPoint),s.getDistance(c.endPoint,x)>s.getDistance(c.startPoint,x)?(x=null,g=null):d=Math.min(P,I))}return o&&(null==y&&(s.getDistance(l,c.startPoint)>s.getDistance(l,c.endPoint)?(y=a,p=a):(y=l,p=l)),null==x&&(s.getDistance(l,c.startPoint)>s.getDistance(l,c.endPoint)?(x=l,g=l):(x=a,g=a))),{startPosition:y,startPosition2:p,endPosition:x,endPosition2:g}},te.prototype.moveSymbolSinglePoint=function(t,e,o){var i=re.getSymbol(e),n=s.createLine1(i.startPoint,i.endPoint),r=s.getVerticalLine(n,t);t=s.getIntersectionPoint(r,n);var l={x:(i.startPoint.x+i.endPoint.x)/2,y:(i.startPoint.y+i.endPoint.y)/2},a=re.getWall(i.parent),h=re.getPoint(a.start),c=re.getPoint(a.end);if("start"==o){if(!s.PointInSegment(l,t,i.endPoint))return null;s.getDistance(i.startPoint,h)<s.getDistance(i.endPoint,h)?s.getDistance(t,l)>s.getDistance(h,l)&&s.clonePoint(t,h):s.getDistance(t,l)>s.getDistance(c,l)&&s.clonePoint(t,c)}else if("end"==o){if(!s.PointInSegment(l,t,i.startPoint))return null;s.getDistance(i.endPoint,c)<s.getDistance(i.startPoint,c)?s.getDistance(t,l)>s.getDistance(c,l)&&s.clonePoint(t,c):s.getDistance(t,l)>s.getDistance(h,l)&&s.clonePoint(t,h)}return{dir:o,position:t}},te.prototype.setSymbolInfo=function(t){var e=re.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},te.prototype.setEnterImg=function(t){this.enterImg=t},te.prototype.getEnterImg=function(){return this.enterImg},te.prototype.createSymbolFromPanorama=function(t,e,o){var i=[],n={x:t.ray.origin.x,y:-1*t.ray.origin.z},r=re.getWalls();for(var l in r){var a=re.getWall(l),h=re.getPoint(a.start),c=re.getPoint(a.end),u=s.raySegmentIntersection(n,t.ray.direction,h,c);null!=u&&i.push({wallId:l,join:u})}if(i.length>0){function t(t,e){return s.getDistance(n,t.join)-s.getDistance(n,e.join)}i=i.sort(t.bind(this));var d=this.addSymbol(i[0].join,e,i[0].wallId);return null!=d?(Qt.moveFullSymbol(i[0].join,d,i[0].wallId),re.getSymbol(d),d):(console.error("漫游模式下添加门/窗:门/窗区域太小,加不上"),null)}return console.error("漫游模式下添加门/窗:没有与任何墙相交"),null};var ee=new te,oe=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};oe.prototype.init=function(t){var e=re.getBoundingBox();this.setCenter(e),this.updateForCanvas(t)},oe.prototype.setInitInfo=function(t,e,o){null==this.initRes&&(this.initRes=t),null==this.initWidth&&(this.initWidth=e),null==this.initHeight&&(this.initHeight=o)},oe.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,i.minRealDis=i.minPixDistance/this.res*i.defaultZoom/this.zoom,i.minAdsorb=i.minPixLen/this.res*i.defaultZoom/this.zoom},oe.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}))},oe.prototype._setDefaultCenter=function(t){this.defaultCenter={x:t.x,y:t.y}},oe.prototype.setDefaultCenter=function(t){this.defaultCenter={x:t.x,y:-t.z}},oe.prototype._setRes=function(t){this.res=t,i.minRealDis=i.minPixDistance/this.res*i.defaultZoom/this.zoom,i.minAdsorb=i.minPixLen/this.res*i.defaultZoom/this.zoom},oe.prototype.setRes=function(t,e){this.res=this.width/Math.abs(e-t),i.minRealDis=i.minPixDistance/this.res*i.defaultZoom/this.zoom,i.minAdsorb=i.minPixLen/this.res*i.defaultZoom/this.zoom},oe.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)}},oe.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},oe.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},oe.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},oe.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}},oe.prototype.updateForCanvas=function(t){t&&(this.width=t.clientWidth,this.height=t.clientHeight,t.width=t.clientWidth,t.height=t.clientHeight)},oe.prototype.updateZoom=function(t){this.zoom=t,i.minRealDis=i.minPixDistance/this.res*i.defaultZoom/this.zoom,i.minAdsorb=i.minPixLen/this.res*i.defaultZoom/this.zoom},oe.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},oe.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},oe.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}},oe.prototype.getPixelRatio=function(t){var e=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/e},oe.prototype.reSet=function(){this.center={x:this.defaultCenter.x,y:this.defaultCenter.y},this.zoom=100},oe.prototype.updateForRotate=function(t){void 0===t&&(t=Math.PI/2);for(var e=0;e<o.floors.length;++e){var i=o.floors[e].points;for(var n in i)i[n]=this.getVectorForRotate(i[n],t);var r=o.floors[e].symbols;for(var l in r)r[l].startPoint=this.getVectorForRotate(r[l].startPoint,t),r[l].endPoint=this.getVectorForRotate(r[l].endPoint,t),r[l].setPoints2d(),ee.setPosition3d(r[l]);var a=o.floors[e].components;for(var h in a){var c=a[h];c.sideWidth=s.getDistance(c.points2d[0],c.points2d[1]),c.sideThickness=s.getDistance(c.points2d[1],c.points2d[2]),c.center=this.getVectorForRotate(c.center,t),c.angle=(c.angle+t/Math.PI*180)%360,c.setPoints2d()}var u=o.floors[e].tags;for(var d in u)u[d].center=this.getVectorForRotate(u[d].center,t),u[d].setPoints2d();var y=o.floors[e].furnitures;for(var x in y){var p=y[x];p.center=this.getVectorForRotate(p.center,t),p.angle=(p.angle+t/Math.PI*180)%360}}},oe.prototype.updatePanosForRotate=function(t){for(var e=o.panos,i=0;i<e.length;++i){var n=JSON.parse(JSON.stringify(e[i]));n=this.getVectorForRotate(n,t),e[i].x=n.x,e[i].y=n.y}},oe.prototype.setRadio=function(t){this.ratio=t,this.cadImg_Width=1920*t,this.cadImg_Height=937*t},oe.prototype.clear=function(){this.defaultCenter=null,this.center=null,this.zoom=100,this.res=80,this.ratio=1};var ie=new oe,ne=function(){this.currentId=0,this.currentFloor=0,this.angle=0,this.$app=null,this.cadBoundingBox=null};ne.prototype.setCurrentId=function(t){this.currentId=t},ne.prototype.getCurrentId=function(){return this.currentId},ne.prototype.updateCurrentId=function(){++this.currentId},ne.prototype.setCurrentFloor=function(t){1==o.floors.length?this.currentFloor=0:this.currentFloor=t},ne.prototype.getCurrentFloor=function(){return this.currentFloor},ne.prototype.getCompass=function(){return o.compass},ne.prototype.setCompass=function(t){o.compass=t},ne.prototype.getFloorNum=function(){return o.floors.length},ne.prototype.initFloor=function(t){o.initFloor(t)},ne.prototype.getFloors=function(){return o.floors},ne.prototype.getPoint=function(t,e){return null!=e&&void 0!==e||(e=this.currentFloor),o.floors[e].points[t]},ne.prototype.deletePoint=function(t,e,i){null!=i&&void 0!==i||(i=this.currentFloor);var n=this.getPoint(t);if(n)if(0==Object.keys(n.parent).length)n=null,delete o.floors[i].points[t];else if(1!=Object.keys(n.parent).length||e)if(1==Object.keys(n.parent).length&&n.parent[e])delete o.floors[i].points[t];else{if(1==Object.keys(n.parent).length&&!n.parent[e])return;delete n.parent[e]}else delete o.floors[i].points[t]},ne.prototype.getWall=function(t,e){return null!=e&&void 0!==e||(e=this.currentFloor),o.floors[e].walls[t]},ne.prototype.deleteWall=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor);for(var i=this.getWall(t,e),n=0;n<i.children.length;++n)this.deleteSymbol(i.children[n],e);this.deletePoint(i.start,t,e),this.deletePoint(i.end,t,e),delete o.floors[e].walls[t]},ne.prototype.deleteWallNoSymbol=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor);var i=this.getWall(t,e);this.deletePoint(i.start,t,e),this.deletePoint(i.end,t,e),delete o.floors[e].walls[t]},ne.prototype.getAngle=function(){return this.angle},ne.prototype.setAngle=function(t){this.angle=t},ne.prototype.setBoundingBox=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),o.floors[e].boundingBox=JSON.parse(JSON.stringify(t))},ne.prototype.getBoundingBox=function(t){if(null==t||void 0===t){for(var e=null,i=null,n=null,r=null,s=0;s<o.floors.length;++s)o.floors[s].boundingBox.hasOwnProperty("maxX")&&o.floors[s].boundingBox.hasOwnProperty("minX")&&o.floors[s].boundingBox.hasOwnProperty("maxY")&&o.floors[s].boundingBox.hasOwnProperty("minY")||this.updateBoundingBox(s),(null==e||e>o.floors[s].boundingBox.minX)&&(e=o.floors[s].boundingBox.minX),(null==i||i<o.floors[s].boundingBox.maxX)&&(i=o.floors[s].boundingBox.maxX),(null==n||n>o.floors[s].boundingBox.minY)&&(n=o.floors[s].boundingBox.minY),(null==r||r<o.floors[s].boundingBox.maxY)&&(r=o.floors[s].boundingBox.maxY);return{minX:e,maxX:i,minY:n,maxY:r}}return o.floors[t].boundingBox},ne.prototype.setCadBoundingBox=function(){for(var t=null,e=null,i=null,n=null,r=0;r<o.floors.length;++r){var s=o.floors[r].boundingBox;(null==t||t>s.minX)&&(t=s.minX),(null==e||e>s.minY)&&(e=s.minY),(null==i||i<s.maxX)&&(i=s.maxX),(null==n||n<s.maxY)&&(n=s.maxY)}this.cadBoundingBox={maxX:i,maxY:n,minX:t,minY:e}},ne.prototype.getCadBoundingBox=function(){return this.cadBoundingBox},ne.prototype.updateBoundingBox=function(t){var e=this.getPoints(t),o=null,i=null,n=null,r=null;for(var s in e){var l=e[s];(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==r||r<l.y)&&(r=l.y)}this.setBoundingBox({minX:o,maxX:i,minY:n,maxY:r},t)},ne.prototype.getFloorData=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),o.floors[t]},ne.prototype.getWalls=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),o.floors[t].walls},ne.prototype.getPoints=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),o.floors[t].points},ne.prototype.getSymbol=function(t,e){return null!=e&&void 0!==e||(e=this.currentFloor),o.floors[e].symbols[t]},ne.prototype.addWall=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),o.floors[e].walls[t.vectorId]=t},ne.prototype.addPoint=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),o.floors[e].points[t.vectorId]=t},ne.prototype.addSymbol=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),o.floors[e].symbols[t.vectorId]=t},ne.prototype.addComponent=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),o.floors[e].components[t.vectorId]=t},ne.prototype.addFurniture=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),o.floors[e].furnitures[t.vectorId]=t},ne.prototype.deleteSymbol=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),this.getSymbol(t,e),delete o.floors[e].symbols[t]},ne.prototype.getComponent=function(t,e){return null!=e&&void 0!==e||(e=this.currentFloor),o.floors[e].components[t]},ne.prototype.deleteComponent=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),this.getComponent(t,e),delete o.floors[e].components[t]},ne.prototype.getFurniture=function(t,e){return null!=e&&void 0!==e||(e=this.currentFloor),o.floors[e].furnitures[t]},ne.prototype.deleteFurniture=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),this.getFurniture(t,e),delete o.floors[e].furnitures[t]},ne.prototype.addTag=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),o.floors[e].tags[t.vectorId]=t},ne.prototype.getTag=function(t,e){return null!=e&&void 0!==e||(e=this.currentFloor),o.floors[e].tags[t]},ne.prototype.deleteTag=function(t,e){null!=e&&void 0!==e||(e=this.currentFloor),this.getTag(t,e),delete o.floors[e].tags[t]},ne.prototype.getSymbols=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),o.floors[t].symbols},ne.prototype.getComponents=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),o.floors[t].components},ne.prototype.getTags=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),o.floors[t].tags},ne.prototype.getFurnitures=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),o.floors[t].furnitures},ne.prototype.getAllBoundingBox=function(){for(var t=[],e=0;e<o.floors.length;++e){var i=void 0,n=void 0,r=void 0,s=void 0,l={};for(var a in o.floors[e].points){var h=o.floors[e].points[a].x,c=o.floors[e].points[a].y;(void 0===i||i>h)&&(i=h),(void 0===r||r<h)&&(r=h),(void 0===n||n>c)&&(n=c),(void 0===s||s<c)&&(s=c)}l.left=i,l.top=s,l.right=r,l.bottom=n,t.push(l)}return t},ne.prototype.getCadInfo=function(t){for(var e=[],o=this.getAllBoundingBox(),i=0;i<o.length;++i){var n={},r=ie.getScreenXY({x:o[i].left,y:o[i].top}),s=ie.getScreenXY({x:o[i].right,y:o[i].bottom}),l=r.x,a=r.y,h=t.width-s.x,c=t.height-s.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},ne.prototype.getRooms=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),o.floors[t].rooms},ne.prototype.clear=function(t){o.floors[this.currentFloor]&&(o.floors[this.currentFloor].points={},o.floors[this.currentFloor].walls={},o.floors[this.currentFloor].symbols={},o.floors[this.currentFloor].components={},o.floors[this.currentFloor].tags={},o.floors[this.currentFloor].furnitures={},t||(o.floors[this.currentFloor].boundingBox={}),o.floors[this.currentFloor].rooms=[])},ne.prototype.getBoundingBox2DPosition=function(t){var e=ie.getScreenXY({x:t.min.x,y:t.max.z}),o=ie.getScreenXY({x:t.max.x,y:t.min.z});return{top:e.y,bottom:o.y,left:e.x,right:o.x}},ne.prototype.deleteFloorData=function(){o.floors=[]},ne.prototype.setFloorName=function(t,e){o.floors[e].name=t},ne.prototype.setFloorId=function(t,e){o.floors[e].id=t},ne.prototype.setFloorSubgroup=function(t,e){o.floors[e].subgroup=t},ne.prototype.setFloorHeight=function(t,e){o.floors[t].height=e},ne.prototype.getFloorHeight=function(t){return null!=t&&void 0!==t||(t=this.currentFloor),o.floors[t].height};var re=new ne,se=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=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){var e=[];return e.push(this.points2d[0]),e.push(this.points2d[1]),e.push(this.points2d[2]),e.push(this.points2d[3]),s.isPointInPoly(t,e)},e.prototype.setPoints2d=function(){this.points2d=[];var t=this.center.x-this.sideWidth/ie.res*i.defaultZoom/ie.zoom/2,e=this.center.y-this.sideThickness/ie.res*i.defaultZoom/ie.zoom/2,o=this.center.x+this.sideWidth/ie.res*i.defaultZoom/ie.zoom/2,n=this.center.y+this.sideThickness/ie.res*i.defaultZoom/ie.zoom/2,r={x:t,y:n},s={x:o,y:n},l={x:o,y:e},a={x:t,y:e};this.points2d.push(r),this.points2d.push(s),this.points2d.push(l),this.points2d.push(a);var h=(r.x-this.center.x)/2,c=(r.y-this.center.y)/2;this.points2d.push({x:r.x-h,y:r.y-c}),this.points2d.push({x:s.x+h,y:r.y-c}),this.points2d.push({x:this.center.x,y:r.y-c}),this.points2d.push({x:this.center.x,y:l.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}(G),le=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}};le.prototype.padding=function(t){void 0===t&&(t={}),Object.assign(this.pad,t),Object.assign(this.defalutMeasurePad,t)},le.prototype.updatePad=function(t){Object.assign(this.pad,t)},le.prototype.updateRegion=function(t){this.region.top=this.pad.top,this.region.bottom=ie.height-this.pad.bottom,this.region.left=this.pad.left,this.region.right=ie.width-this.pad.right},le.prototype.updateNewRegion=function(t,e,o,i){var n=ie.getScreenXY({x:t,y:o}),r=ie.getScreenXY({x:e,y:i});this.region.top=r.y-this.margin.top*ie.ratio,this.region.bottom=n.y+this.margin.bottom*ie.ratio,this.region.left=n.x-this.margin.left*ie.ratio,this.region.right=r.x+this.margin.right*ie.ratio},le.prototype.update=function(t){null==this.minDis&&(this.minDis=100/ie.res);var e=[],o=[],i=[],n=[],r=[];if(re.getFloorData()){var s=re.getPoints();for(var l in s){var a=s[l];r.push({x:a.x,y:a.y})}e=[].concat(r).sort(C.bind(this)),(o=[].concat(e)).reverse(),i=[].concat(r).sort(w.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(w.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 x=this.measureLines.top.length;this.measureLines.top[x-1]=e[d];break}}this.measureLines.bottom=[];for(var p=0;p<o.length;++p)if(0==p)h=o[0].x,c=o[0].x,this.measureLines.bottom.push({x:o[0].x,y:this.region.bottom});else{if(o[p].x>=h&&o[p].x<=c)continue;(h=Math.min(h,o[p].x))!=(c=Math.max(c,o[p].x))&&this.measureLines.bottom.push({x:o[p].x,y:this.region.bottom})}o=this.measureLines.bottom.sort(w.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(C.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 I=this.measureLines.left.length;this.measureLines.left[I-1]=i[S];break}}this.measureLines.right=[];for(var b=0;b<n.length;++b)if(0==b)h=n[0].y,c=n[0].y,this.measureLines.right.push({x:this.region.right,y:n[0].y});else{if(n[b].y>=h&&n[b].y<=c)continue;(h=Math.min(h,n[b].y))!=(c=Math.max(c,n[b].y))&&this.measureLines.right.push({x:this.region.right,y:n[b].y})}n=this.measureLines.right.sort(C.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 C(t,e){return e.y-t.y}function w(t,e){return t.x-e.x}};var ae=new le,he=["","⅛","¼","⅜","½","⅝","¾","⅞"],ce=function(t,e,o,i){this.name=t,this.symbol=e,this.base=o,this.factor=i};ce.prototype.toBase=function(t){return t*this.factor},ce.prototype.fromBase=function(t){return t/this.factor};var ue={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,r,s,l,a,h,c,u=new ce(ue.METER[0],ue.METER[1],void 0,1),d=new ce(ue.SQUAREMETER[0],ue.SQUAREMETER[1],void 0,1),y=new ce(ue.CUBICMETER[0],ue.CUBICMETER[1],void 0,1),x=new ce(ue.BYTE[0],ue.BYTE[1],void 0,1);ue.DISTANCE=((t={}).metric=((e={})[ue.MILLIMETER[0]]=new ce(ue.MILLIMETER[0],ue.MILLIMETER[1],u,.001),e[ue.CENTIMETER[0]]=new ce(ue.CENTIMETER[0],ue.CENTIMETER[1],u,.01),e[ue.METER[0]]=u,e[ue.KILOMETER[0]]=new ce(ue.KILOMETER[0],ue.KILOMETER[1],u,1e3),e),t.imperial=((o={})[ue.INCH[0]]=new ce(ue.INCH[0],ue.INCH[1],u,.0254),o[ue.FOOT[0]]=new ce(ue.FOOT[0],ue.FOOT[1],u,.3048),o[ue.MILE[0]]=new ce(ue.MILE[0],ue.MILE[1],u,1609.344),o),t),ue.AREA=((i={}).metric=((n={})[ue.SQUAREMETER[0]]=d,n),i.imperial=((r={})[ue.SQUAREFOOT[0]]=new ce(ue.SQUAREFOOT[0],ue.SQUAREFOOT[1],d,.092903),r),i),ue.VOLUME=((s={}).metric=((l={})[ue.CUBICMETER[0]]=y,l),s.imperial=((a={})[ue.CUBICFOOT[0]]=new ce(ue.CUBICFOOT[0],ue.CUBICFOOT[1],y,.0283168),a),s);var p=((h={})[ue.BYTE[0]]=x,h[ue.KILOBYTE[0]]=new ce(ue.KILOBYTE[0],ue.KILOBYTE[1],x,1e3),h[ue.MEGABYTE[0]]=new ce(ue.MEGABYTE[0],ue.MEGABYTE[1],x,1e6),h[ue.GIGABYTE[0]]=new ce(ue.GIGABYTE[0],ue.GIGABYTE[1],x,1e9),h[ue.TERABYTE[0]]=new ce(ue.TERABYTE[0],ue.TERABYTE[1],x,1e12),h[ue.PETABYTE[0]]=new ce(ue.PETABYTE[0],ue.PETABYTE[1],x,1e15),h);ue.DATA=((c={}).metric=p,c.imperial=p,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.")}}},de=function(){this.LOCAL_STORAGE_KEY="iv_unit_key",ue.init(),this.unitSystems=["metric","imperial"],this.defaultSystem="metric"},ye=function(){this.UnitService=new de};ye.prototype.scopedConvert=function(t,o,i,n,r){return void 0===i&&(i=2),e.convert(t,o,i,n,r)},ye.prototype.convert=function(t,e,o,i,n,r){if(void 0===o&&(o=2),void 0===r&&(r=!1),!t)return"";var s=this.getMostRelevantMeasurement(e,i||this.UnitService.currentSystem,t,n);return this.getFormattedMeasurementString(s[0],s[1],o,r)},ye.prototype.getFormattedMeasurementString=function(t,e,o,i){return i&&e.name===ue.FOOT[0]?this.formatImperialDistance(12*t):i&&e.name===ue.INCH[0]?this.formatImperialDistance(t):t.toLocaleString(void 0,{minimumFractionDigits:o,maximumFractionDigits:o})+" "+e.symbol},ye.prototype.formatImperialDistance=function(t){var e=Math.round(8*t),o=Math.floor(e/8),i=Math.floor(o/12),n=o-12*i,r=he[e%8],s=0===n&&""!==r?"":n;return""!==s&&""!==r&&(r=" "+r),0!==i?i+"' "+s+r+'"':""+s+r+'"'},ye.prototype.getMostRelevantMeasurement=function(t,e,o,i){void 0===i&&(i=0);var n=[],r=ue.getUnitsOfMeasurementByDomainAndSystem(t,e);for(var s in r)n.push(r[s]);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},ye.prototype.getMostRelevantMeasurement2=function(t,e,o,i){void 0===i&&(i=0);var n=[],r=ue.getUnitsOfMeasurementByDomainAndSystem(t,e);for(var s in r)n.push(r[s]);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},ye.prototype.convertBack=function(t,e,o,i,n){if(void 0===o&&(o=2),!t)return"";t=t.trim().replace(",","");var r=ue.getDefaultUnitByDomainAndSystem(e,"metric"),s=this.getMostRelevantMeasurement2(e,i,t,n);return this.getFormattedMeasurementString(s[0],r,o)};var xe=new ye,pe=function(){};pe.prototype.createTag=function(t,e,o){var i=new se(t,e);return i.setPoints2d(),re.addTag(i,o),i},pe.prototype.setTagInfo=function(t){var e=re.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},pe.prototype.deleteTag=function(t,e){re.deleteTag(t,e)},pe.prototype.clearDefaultTags=function(){for(var t=0;t<o.floors.length;++t){var e=o.floors[t].tags;for(var i in e){var n=e[i];null!=n.title&&""!=n.title.trim()||null!=n.des&&""!=n.des||this.deleteTag(n.vectorId,t)}}},pe.prototype.convertUnit=function(t){for(var e=0;e<o.floors.length;++e){var i=o.floors[e].tags;for(var n in i){var r=i[n];r.unit!=t&&(r.des&&(r.unit=t,"m"==t?(r.des=xe.convertBack(r.des,"area",7,"imperial",.01,!1),r.des=parseFloat(r.des)):(r.des=xe.convert(r.des,"area",7,"imperial",.01,!1),r.des=r.des.replace("ft²",""))))}}},pe.prototype.getTags=function(t){return o.floors[t].tags};var ge=new pe,fe=function(){this.aspect=ie.cadImg_Width/ie.cadImg_Height,this.top=null,this.bottom=null,this.left=null,this.right=null};fe.prototype.getCurrentScale=function(t){var e=re.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(ie.cadImg_Width/ie.ratio,ie.cadImg_Height/ie.ratio);return o/2/10*Math.max(1.2*i/800,1.2)},fe.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 me=new fe,ve=function(t){this.layer=t,this.version="v1.1",this.vectorsJson=null,this.saveFloors=[],this.newVectorId=null,this.boundingBox=null,this.uploadData={}};ve.prototype.loadFloorJson=function(t){var e=this;return!t&&o.floors.length?Promise.resolve(o):this.layer.app.store.get("flooruser",t).then((function(t){return t.version?t.version==o.version&&(isNaN(t.angle)||void 0===t.angle||null==t.angle?re.setAngle(0):re.setAngle(t.angle),isNaN(t.compass)||void 0===t.compass||null==t.compass?re.setCompass(0):re.setCompass(t.compass),re.setCurrentId(t.currentId),e.load(t.floors)):(e.layer.analyService.initVectors(t),re.setAngle(0),e.layer.reRender()),t})).catch((function(t){return console.error(t)}))},ve.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),re.initFloor(i),re.setCurrentFloor(i),o.points)st.createPoint(o.points[n].x,o.points[n].y,o.points[n].vectorId,i);for(var r in o.walls){var l=st.createWall(o.walls[r].start,o.walls[r].end,o.walls[r].vectorId,i);l.setImportant(o.walls[r].important),l.setOut(o.walls[r].out),l.setChildren(o.walls[r].children)}for(var a in re.setFloorHeight(re.currentFloor,this.layer.player.model.floors.index[re.currentFloor].center.y),o.symbols){var h=ee.createSymbol(o.symbols[a].startPoint,o.symbols[a].endPoint,o.symbols[a].geoType,o.symbols[a].parent,o.symbols[a].vectorId);h.openSide=o.symbols[a].openSide,h.enter=o.symbols[a].enter,h.points2d=JSON.parse(JSON.stringify(o.symbols[a].points2d))}for(var c in o.components){var u=ut.createComponent(o.components[c].center,o.components[c].geoType,o.components[c].vectorId);u.angle=o.components[c].angle,u.sideThickness=o.components[c].sideThickness,u.sideWidth=o.components[c].sideWidth,u.points2d=JSON.parse(JSON.stringify(o.components[c].points2d))}for(var d in o.boundingBox||(o.boundingBox=s.getBoundingBox2(o.points)),re.setBoundingBox(o.boundingBox,i),o.tags){var y=ge.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 x in o.furnitures){var p=Gt.createFurniture(o.furnitures[x].center,o.furnitures[x].geoType,o.furnitures[x].vectorId);p.angle=o.furnitures[x].angle,o.furnitures[x].scale?p.zoom=o.furnitures[x].scale:p.zoom=o.furnitures[x].zoom}o.hasOwnProperty("name")&&re.setFloorName(o.name,i),o.hasOwnProperty("subgroup")&&re.setFloorSubgroup(o.subgroup,i),o.hasOwnProperty("id")&&re.setFloorId(o.id,i)}},ve.prototype.uploadCad=function(){return this.initCameraService(),this.uploadData.cadInfo=[],this.exportCadImgs()},ve.prototype.initCameraService=function(){var t=this.layer.app.core.get("Player").model.size,e=me.getCurrentScale(t);me.setCamera(e)},ve.prototype.base64ToBlob=function(t){for(var e=t.split(","),o=e[0].match(/:(.*?);/)[1],i=atob(e[1]),n=i.length,r=new Uint8Array(n);n--;)r[n]=i.charCodeAt(n);return new Blob([r],{type:o})},ve.prototype.exportImg=function(t){var e=t.toDataURL("png",3);return this.base64ToBlob(e)},ve.prototype.exportCadImgs=function(){var t=this;this.layer.uiControl.menu_flex(),ge.clearDefaultTags(),this.layer.history.save(),Kt.clearItems(),ae.updateRegion(!0),ae.update(!1);var e=this.layer.canvas;e.width=ie.cadImg_Width,e.height=ie.cadImg_Height,ie.width=ie.cadImg_Width/ie.ratio,ie.height=ie.cadImg_Height/ie.ratio,ie.res=Math.min(ie.cadImg_Width/ie.ratio/Math.abs(me.right-me.left),ie.cadImg_Height/ie.ratio/Math.abs(me.top-me.bottom)),this.layer.renderer.autoRedrawForImg();var o=window.KanKan.Deferred();return setTimeout((function(){var i=re.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 r=t.exportImg(e),s=re.getCurrentFloor(),l=0;l<i;++l)if(l!=s){t.layer.uiControl.currentFloor=l,t.layer.renderer.autoRedrawForImg();var a=t.exportImg(e);t.uploadData.files.push(a)}else t.uploadData.files.push(r);t.layer.uiControl.currentFloor=s}t.uploadData.cadInfo=re.getCadInfo(e),t.exportMiniMap(o),ie.updateForCanvas(e),ie.setRes(me.left,me.right),ie.ratio=1,t.layer.renderer.autoRedraw()}),100),o},ve.prototype.exportMiniMap=function(t){var e=this;t=t||window.KanKan.Deferred(),Kt.clearItems();var o=this.layer.canvas;return o.width=i.miniMap_Width,o.height=i.miniMap_Height,ie.width=i.miniMap_Width/i.ratio,ie.height=i.miniMap_Height/i.ratio,ie.ratio=i.ratio,ie.res=Math.min(i.miniMap_Width/i.ratio/Math.abs(me.right-me.left),i.miniMap_Height/i.ratio/Math.abs(me.top-me.bottom)),this.layer.renderer.redrawCore(),setTimeout((function(){var i=re.getFloorNum();if(e.uploadData.miniMaps=[],1==i){var n=e.exportImg(o);e.uploadData.miniMaps.push(n)}else{for(var r=e.exportImg(o),s=re.getCurrentFloor(),l=0;l<i;++l)if(l!=s){e.layer.uiControl.currentFloor=l;var a=e.exportImg(o);e.layer.renderer.redrawCore(),e.uploadData.miniMaps.push(a)}else e.uploadData.miniMaps.push(r);e.layer.uiControl.currentFloor=s}o.width=window.innerWidth,o.height=window.innerHeight,ie.updateForCanvas(o);var h=e.layer.app.core.get("CameraControls").activeControl.camera;ie.setRes(h.left,h.right),ie.ratio=1,e.layer.renderer.autoRedraw(),t.resolve(e.uploadData)}),100),t},ve.prototype.getCustomCadInfoItem=function(t,e,o){function i(t,i){var n=t.x,r=t.y,s=e/2+(n-ie.center.x)*i,l=o/2-(r-ie.center.y)*i;return s=.5+s<<0,l=.5+l<<0,{x:Math.floor(s),y:Math.floor(l)}}var n=re.getAllBoundingBox(),r=Math.min(e/Math.abs(me.right-me.left),o/Math.abs(me.top-me.bottom)),s={},l=i({x:n[t].left,y:n[t].top},r),a=i({x:n[t].right,y:n[t].bottom},r),h=l.x,c=l.y,u=e-a.x,d=o-a.y;return s.left=h,s.top=c,s.right=u,s.bottom=d,s.bound=n[t],s.bound.top=-1*s.bound.top,s.bound.bottom=-1*s.bound.bottom,s},ve.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)},ve.prototype.recoverForCadImg=function(t,e){this.layer.app.core.get("Player").model.floorplanCadImg.updateCustomFloorTexture(t,e)},ve.prototype.uploadCadImg2=function(t,e,o,i){this.layer.app.core.get("Player").model.floorplanCadImg.createCustomPlane(t,e,o,i)};var Se=function(t){function e(e,o,i){t.call(this),this.start=e,this.end=o,this.name=null,this.display=!1,this.geoType=S,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}(G),Pe="StartAddWall",Ie="NewWall",be="StartSymbolPoints",ke="EndSymbolPoints",Te="CheckLinesX",Fe="CheckLinesY",Ce="vCheckLinesX",we="vCheckLinesY",We="SignLine1",De="SignLine2",Le=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};Le.prototype.start=function(t,e,o){var n=this.getNearForVectors(t,e,o);n.modifyPoint&&(n.modifyPoint.hasOwnProperty("linkedPointId")||n.modifyPoint.hasOwnProperty("linkedPointIdX")||n.modifyPoint.hasOwnProperty("linkedPointIdY")||n.modifyPoint.hasOwnProperty("linkedWallId"))?(this.modifyPoint={x:n.modifyPoint.x,y:n.modifyPoint.y},n.modifyPoint.hasOwnProperty("linkedPointId")&&null!=n.modifyPoint.linkedPointId?this.modifyPoint.linkedPointId=n.modifyPoint.linkedPointId:n.modifyPoint.hasOwnProperty("linkedWallId")&&null!=n.modifyPoint.linkedWallId?this.modifyPoint.linkedWallId=n.modifyPoint.linkedWallId:(n.modifyPoint.hasOwnProperty("linkedPointIdX")&&null!=n.modifyPoint.linkedPointIdX&&(this.modifyPoint.linkedPointIdX=n.modifyPoint.linkedPointIdX),n.modifyPoint.hasOwnProperty("linkedPointIdY")&&null!=n.modifyPoint.linkedPointIdY&&(this.modifyPoint.linkedPointIdY=n.modifyPoint.linkedPointIdY))):this.modifyPoint=null;var r=this.updateSelectInfos(n,i.minAdsorb);return this.updateSelectItem(),r},Le.prototype.getNearForVectors=function(t,e,o){var n=null,r=null,l={},a=null,h=[];e&&h.push(e);var c=re.getWalls();for(var u in c)if(!o||!o.hasOwnProperty(u)){var d=re.getWall(u),y=re.getPoint(d.start),x=re.getPoint(d.end),p=null,g=st.getLine(d);if(g){var f=s.getJoinLinePoint(t,g);if(-1==h.indexOf(d.start)){if(h.push(d.start),p=s.getDistance(t,y),(null==n||n.distance>p)&&(n={distance:p,pointId:d.start},s.getDistance(f,t)<i.minAdsorb&&s.getDistance(f,y)<i.minAdsorb||n.distance<i.minAdsorb)){l.linkedPointId=d.start,l.x=y.x,l.y=y.y,delete l.linkedPointIdX,delete l.linkedPointIdY;break}if(Math.abs(t.x-y.x)<i.minAdsorb)if(l.linkedPointIdX){var m=re.getPoint(l.linkedPointIdX);s.getDistance(t,m)>s.getDistance(t,y)&&(l.x=y.x,l.linkedPointIdX=d.start)}else l.x=y.x,l.linkedPointIdX=d.start;if(Math.abs(t.y-y.y)<i.minAdsorb)if(l.linkedPointIdY){var v=re.getPoint(l.linkedPointIdY);s.getDistance(t,v)>s.getDistance(t,y)&&(l.y=y.y,l.linkedPointIdY=d.start)}else l.y=y.y,l.linkedPointIdY=d.start}if(-1==h.indexOf(d.end)){if(h.push(d.end),p=s.getDistance(t,x),(null==n||n.distance>p)&&(n={distance:p,pointId:d.end},s.getDistance(f,t)<i.minAdsorb&&s.getDistance(f,x)<i.minAdsorb||n.distance<i.minAdsorb)){l.linkedPointId=d.end,l.x=x.x,l.y=x.y,delete l.linkedPointIdX,delete l.linkedPointIdY;break}if(Math.abs(t.x-x.x)<i.minAdsorb)if(l.linkedPointIdX){var S=re.getPoint(l.linkedPointIdX);s.getDistance(t,S)>s.getDistance(t,x)&&(l.x=x.x,l.linkedPointIdX=d.end)}else l.x=x.x,l.linkedPointIdX=d.end;if(Math.abs(t.y-x.y)<i.minAdsorb)if(l.linkedPointIdY){var P=re.getPoint(l.linkedPointIdY);s.getDistance(t,P)>s.getDistance(t,x)&&(l.y=x.y,l.linkedPointIdY=d.end)}else l.y=x.y,l.linkedPointIdY=d.end}p=s.getDistance(t,f);var I=st.isContain(d,f);I&&(null==r||r.distance>p)&&(r={distance:p,wallId:u}),I&&s.getDistance(t,f)<i.minAdsorb&&((a=f).linkedWallId=u)}else re.deleteWall(u)}var b={minPoint:n,minWall:r,symbolInfo:{},componentInfo:{},tagInfo:{},furnitureInfo:{}};null!=a?b.modifyPoint=JSON.parse(JSON.stringify(a)):l.hasOwnProperty("x")&&l.hasOwnProperty("y")?b.modifyPoint=JSON.parse(JSON.stringify(l)):l.hasOwnProperty("x")?(b.modifyPoint=JSON.parse(JSON.stringify(l)),b.modifyPoint.x=l.x,b.modifyPoint.y=t.y):l.hasOwnProperty("y")&&(b.modifyPoint=JSON.parse(JSON.stringify(l)),b.modifyPoint.x=t.x,b.modifyPoint.y=l.y);var k=re.getSymbols();for(var T in k){var F=re.getSymbol(T).isContain(t);if(null!=F){b.symbolInfo={symbolId:T,state:F};break}}var C=re.getComponents();for(var w in C){if(re.getComponent(w).isContain(t)){b.componentInfo={componentId:w,state:"all"};break}}var W=re.getTags();for(var D in W){if(re.getTag(D).isContain(t)){b.tagInfo={tagId:D,state:"all"};break}}var L=re.getFurnitures();for(var z in L){if(re.getFurniture(z).isContain(t)){b.furnitureInfo={furnitureId:z,state:"all"};break}}return b},Le.prototype.updateSelectInfos=function(t,e){var o=!1;null!=t.minPoint?t.minPoint.distance<e?(o=this.isChanged(t.minPoint.pointId,V,1),this.pointInfo={pointId:t.minPoint.pointId,state:V}):(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,V,2),this.wallInfo={wallId:t.minWall.wallId,state:V}):(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 r=this.isChanged(t.componentInfo.componentId,t.componentInfo.state,4);this.componentInfo={componentId:t.componentInfo.componentId,state:t.componentInfo.state};var s=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||r||s||l},Le.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},Le.prototype.updateSelectItem=function(){if(null!=this.tagInfo.tagId&&null!=this.tagInfo.state){var t=re.getTag(this.tagInfo.tagId);Kt.setSelectItem(this.tagInfo.tagId,t.geoType,this.tagInfo.state)}else if(null!=this.componentInfo.componentId&&null!=this.componentInfo.state){var e=re.getComponent(this.componentInfo.componentId);Kt.setSelectItem(this.componentInfo.componentId,e.geoType,this.componentInfo.state)}else if(null!=this.furnitureInfo.furnitureId&&null!=this.furnitureInfo.state){var o=re.getFurniture(this.furnitureInfo.furnitureId);Kt.setSelectItem(this.furnitureInfo.furnitureId,o.geoType,this.furnitureInfo.state)}else if(null!=this.symbolInfo.symbolId&&null!=this.symbolInfo.state){var i=re.getSymbol(this.symbolInfo.symbolId);Kt.setSelectItem(this.symbolInfo.symbolId,i.geoType,this.symbolInfo.state)}else null!=this.pointInfo.pointId&&null!=this.pointInfo.state?Kt.setSelectItem(this.pointInfo.pointId,a,V):null!=this.wallInfo.wallId&&null!=this.wallInfo.state?Kt.setSelectItem(this.wallInfo.wallId,h,V):Kt.clearSelectItem()},Le.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 ze=new Le,Me=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()};Me.prototype.init=function(){this.startAddWall=new it(0,0),this.startAddWall.name=Pe,this.newWall=new Se({x:0,y:0},{x:1,y:1}),this.newWall.name=Ie,this.symbolPoints.Start=new it(0,0),this.symbolPoints.Start.name=be,this.symbolPoints.End=new it(0,0),this.symbolPoints.End.name=ke,this.checkLines.X=new Se({x:0,y:0},{x:1,y:1}),this.checkLines.X.name=Te,this.checkLines.Y=new Se({x:0,y:0},{x:1,y:1}),this.checkLines.Y.name=Fe,this.vCheckLines.X=new Se({x:0,y:0},{x:1,y:1}),this.vCheckLines.X.name=Ce,this.vCheckLines.Y=new Se({x:0,y:0},{x:1,y:1}),this.vCheckLines.Y.name=we,this.signLine1=new Se({x:0,y:0},{x:1,y:1}),this.signLine1.name=We,this.signLine2=new Se({x:0,y:0},{x:1,y:1}),this.signLine2.name=De},Me.prototype.showStartAddWall=function(){this.startAddWall.display=!0},Me.prototype.hideStartAddWall=function(){this.startAddWall.display=!1},Me.prototype.setStartAddWall=function(t){this.startAddWall.setPosition(t)},Me.prototype.showSymbolPoints=function(){this.symbolPoints.Start.display=!0,this.symbolPoints.End.display=!0},Me.prototype.hideSymbolPoints=function(){this.symbolPoints.Start.display=!1,this.symbolPoints.End.display=!1},Me.prototype.setSymbolPoints=function(t,e){this.symbolPoints.Start.setPosition(t),this.symbolPoints.End.setPosition(e)},Me.prototype.showNewWall=function(){this.newWall.display=!0},Me.prototype.hideNewWall=function(){this.newWall.display=!1},Me.prototype.setNewWall=function(t,e){this.newWall.setPositions(t,e)},Me.prototype.setNewWallStartPosition=function(t){this.newWall.start.x=t.x,this.newWall.start.y=t.y},Me.prototype.setNewWallEndPosition=function(t){this.newWall.end.x=t.x,this.newWall.end.y=t.y},Me.prototype.setNewWallState=function(t){this.newWall.state=t},Me.prototype.showCheckLinesX=function(){this.checkLines.X.display=!0},Me.prototype.hideCheckLinesX=function(){this.checkLines.X.display=!1},Me.prototype.setCheckLinesX=function(t,e){this.checkLines.X.setPositions(t,e)},Me.prototype.showCheckLinesY=function(){this.checkLines.Y.display=!0},Me.prototype.hideCheckLinesY=function(){this.checkLines.Y.display=!1},Me.prototype.setCheckLinesY=function(t,e){this.checkLines.Y.setPositions(t,e)},Me.prototype.showVCheckLinesX=function(){this.vCheckLines.X.display=!0},Me.prototype.hideVCheckLinesX=function(){this.vCheckLines.X.display=!1},Me.prototype.setVCheckLinesX=function(t,e){this.vCheckLines.X.setPositions(t,e)},Me.prototype.showVCheckLinesY=function(){this.vCheckLines.Y.display=!0},Me.prototype.hideVCheckLinesY=function(){this.vCheckLines.Y.display=!1},Me.prototype.setVCheckLinesY=function(t,e){this.vCheckLines.Y.setPositions(t,e)},Me.prototype.setSignLine1=function(t,e){this.signLine1.setPositions(t,e)},Me.prototype.showSignLine1=function(){this.signLine1.display=!0},Me.prototype.hideSignLine1=function(){this.signLine1.display=!1},Me.prototype.setSignLine2=function(t,e){this.signLine2.setPositions(t,e)},Me.prototype.showSignLine2=function(){this.signLine2.display=!0},Me.prototype.hideSignLine2=function(){this.signLine2.display=!1},Me.prototype.hideAll=function(){this.hideCheckLinesX(),this.hideCheckLinesY(),this.hideStartAddWall(),this.hideNewWall(),this.hideSymbolPoints(),this.hideVCheckLinesX(),this.hideVCheckLinesY(),this.hideSignLine1(),this.hideSignLine2()},Me.prototype.execute=function(t,e){if(this.hideVCheckLinesX(),this.hideVCheckLinesY(),this.hideCheckLinesX(),this.hideCheckLinesY(),t){var o=ie.getXYFromScreen({x:0,y:0}),n=ie.getXYFromScreen({x:ie.width,y:ie.height});Math.abs(e.x-t.x)<i.minAdsorb&&(e.x=t.x,o.x=e.x,n.x=e.x,this.setVCheckLinesX(o,n),this.showVCheckLinesX()),Math.abs(e.y-t.y)<i.minAdsorb&&(e.y=t.y,o.y=e.y,n.y=e.y,this.setVCheckLinesY(o,n),this.showVCheckLinesY()),s.equalPoint(e,t)&&(this.hideVCheckLinesX(),this.hideVCheckLinesY())}if(!this.vCheckLines.Y.display&&!this.vCheckLines.Y.display&&ze.modifyPoint){if(ze.modifyPoint.linkedPointIdX){var r=re.getPoint(ze.modifyPoint.linkedPointIdX);this.setCheckLinesX(r,e),this.showCheckLinesX()}if(ze.modifyPoint.linkedPointIdY){var l=re.getPoint(ze.modifyPoint.linkedPointIdY);this.setCheckLinesY(l,e),this.showCheckLinesY()}}},Me.prototype.checkAngle=function(t,e,o){function i(t,e,o,i){var n=s.createLine1(e,o),r=null;if(1==i){var l=s.getVerticalLine(n,e);r=s.getJoinLinePoint(t,l)}else 2==i&&(r=s.getJoinLinePoint(t,n));return r}for(var n=st.getNeighPoints(e,o),r=re.getPoint(e),l=null,a=0;a<n.length;++a){var h=s.Angle(r,t,n[a]);if(Math.abs(h/Math.PI*180-90)<5?l=i(t,r,n[a],1):(Math.abs(h/Math.PI*180)<5||Math.abs(h/Math.PI*180-180)<5)&&(l=i(t,r,n[a],2)),null!=l)return l}return l};var Re=new Me,Oe=function(){this.history={records:[],currentRecordIndex:-1,state:{pre:0,next:0}}};Oe.prototype.getCurrentRecordIndex=function(){return this.history.currentRecordIndex},Oe.prototype.getHistoryRecord=function(){return null==this.history.currentRecordIndex||0==this.history.records.length?null:this.history.records[this.history.currentRecordIndex]},Oe.prototype.getHistoryRecords=function(){return this.history.records},Oe.prototype.getHistoryState=function(){return this.history.state},Oe.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}},Oe.prototype.setHistoryState=function(t,e){this.history.state.pre=t,this.history.state.next=e},Oe.prototype.undoHistoryRecord=function(){--this.history.currentRecordIndex},Oe.prototype.redoHistoryRecord=function(){++this.history.currentRecordIndex},Oe.prototype.clearHistoryRecord=function(){this.history.records=[],this.setHistoryState(0,0)},Oe.prototype.hasRecords=function(){return this.history.records.length>0};var Ae=new Oe;window.historyService=Ae;var Ee=function(t){this.layer=t,this.app=this.layer.app,this.houseData=null};Ee.prototype.initVectors=function(t){for(var e=t.floors,i=-1,n=0,r=0,s=0;s<e.length;++s){var a=e[s].subgroup,c=e[s];o.floors[a]={},o.floors[a].points={},o.floors[a].walls={},o.floors[a].symbols={},o.floors[a].components={},o.floors[a].tags={},o.floors[a].furnitures={},o.floors[a].boundingBox={},o.floors[a].rooms=[];for(var u=null,d=null,y=null,x=null,p=0;p<c["vertex-xy"].length;++p){var g=c["vertex-xy"][p].id+r;i<g&&(i=g),g=l+g;var f={x:c["vertex-xy"][p].x,y:c["vertex-xy"][p].y};st.createPoint(f.x,f.y,g,a),(null==u||u>f.x)&&(u=f.x),(null==d||d>f.y)&&(d=f.y),(null==y||y<f.x)&&(y=f.x),(null==x||x<f.y)&&(x=f.y)}n=i+1,o.floors[a].boundingBox.minX=u,o.floors[a].boundingBox.minY=d,o.floors[a].boundingBox.maxX=y,o.floors[a].boundingBox.maxY=x;for(var m=0;m<c.segment.length;++m){var v=c.segment[m].id+n;i<v&&(i=v),v=h+v;var S=l+(c.segment[m].a+r),P=l+(c.segment[m].b+r);st.createWall(S,P,v,a)}n=i+1,r=i+1}re.setCurrentId(i+1);var I=this.app.core.get("Player").model.currentFloor.floorIndex;re.setCurrentFloor(I)},Ee.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 r={};r.x=t.floors[o].points[n].x,r.y=t.floors[o].points[n].y,r.parent=t.floors[o].points[n].parent,r.vectorId=t.floors[o].points[n].vectorId,i.points.push(r)}for(var s in t.floors[o].walls){var l={};l.start=t.floors[o].walls[s].start,l.end=t.floors[o].walls[s].end,l.children=[],l.vectorId=t.floors[o].walls[s].vectorId,l.width=.2,i.walls.push(l)}e.floors.push(i)}return e};var Be="panBackGround",Ye="addWall",Ne="addingWall",Xe="moveWall",je="moveWallPoint",_e="addSymbol",Ue="moveSymbol",Je="moveSymbolPoint",Ve="addComponent",He="moveComponent",Ze="addTag",Ge="moveTag",$e="addFurniture",Ke="moveFurniture",qe=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={}};qe.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},qe.prototype.containPoint=function(t){for(var e=[],o=0;o<this.wallPointIDs.length;++o){var i=re.getPoint(this.wallPointIDs[o],this.floor);e.push({x:i.x,y:i.y})}return s.isPointInPoly(t,e)};var Qe=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"},to=function(){this.segments={},this.points={},this.polygons=[],this.matrix={},this.maxPolygons=[],this.pre="",this.currentId=1};to.prototype.init=function(){this.segments={},this.points={},this.polygons=[],this.matrix={},this.maxPolygons=[]},to.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)},to.prototype.getStartPoint=function(t,e){var o=null,i=null;for(var n in t)if(n!==e){var r=t[n];(null===o||o.x>r.x||o.x===r.x&&o.y>r.y)&&(o={x:r.x,y:r.y},i=n)}return i},to.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 r=this.getNextForMinAngleX(t,o,e);if(null!==r){i.push(r);var s=this.getMaxPolygon(i,o,e);this.checkPolygonSegmentIds(s,o,e);var l=this.splitPolygon(s);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(s),this.updateMartix(s,o,e),o[t]||(t=this.getStartPoint(o),r=this.getNextForMinAngleX(t,o,e));var u=[];u.push(t),u.push(r);var d=this.getMinPolygon(u,o,e);if(this.checkPolygonSegmentIds(d,o,e),l=this.splitPolygon(d)){var y=this.getPolygonData(l,o,e),x=Object.keys(y.points),p=Object.keys(y.segments);if(this.createPolygon(l[0],y.segments,y.points),this.updateMartix2(x,p,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!==s.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(s,o,e);var f=s.slice(0);if(f.push(s[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——————————————————————————————————————————————————————————————出错!")}}}}},to.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},to.prototype.getPolygonData=function(t,e,o){for(var i={},n={},r=[],l=0;l<t.length;++l)i[t[l]]=e[t[l]],r.push(e[t[l]]);for(var a=this.checkPolygonSegmentIds(t,e,o),h=0;h<a.length;++h)n[a[h]]=o[a[h]];var c=[],u=[];for(var d in e)if(!(t.indexOf(d)>-1||c.indexOf(d)>-1)){var y=e[d];if(s.isPointInPoly(y,r)){c.push(d);var x=y.parent;for(var p in x)if(o[p]&&!n[p]&&-1===u.indexOf(p)){var g=null;o[p].start===d?g=o[p].end:o[p].end===d&&(g=o[p].start);var f=e[g];t.indexOf(g)>-1||c.indexOf(g)>-1?u.push(p):s.isPointInPoly(f,r)&&(u.push(p),c.push(g))}}}for(var m=0;m<c.length;++m)i[c[m]]||(i[c[m]]=e[c[m]]);for(var v=0;v<u.length;++v)n[u[v]]||(n[u[v]]=o[u[v]]);return{points:i,segments:n}},to.prototype.getChildSegments=function(t,e,o){var i=[];for(var n in t)i.push(n);for(var r=0;r<i.length-1;++r)for(var s=r+1;s<i.length;++s){var l=this.getSegmentId2(t[i[r]],t[i[s]]);null==l||e[l]||(e[l]=o[l])}return e},to.prototype.updateMartix2=function(t,e,o,i){for(var n=0;n<e.length;++n){var r=e[n];delete this.matrix[r],delete i[r],this.deleteSegment(r,i,o)}for(var s=0;s<t.length;++s){var l=t[s],a=o[l];a&&0!==Object.keys(a.parent).length||delete o[l]}},to.prototype.addPolygon=function(t,e,o){var i=[],n=[];i[0]=this.getPoint(t[0],e);for(var r=0;r<t.length-1;++r){var l=t[r],a=t[r+1],h=this.getSegmentId(l,a,e,o);n.push(h);var c=this.getPoint(a,e);i.push(c)}var u=this.getId();t.pop();var d=new Qe(n,t,u);return d.area=this.getArea(d),d.center=this.getCenter(d),d.boundingBox=s.getBoundingBox(i),this.polygons.push(d),!0},to.prototype.getMaxPolygon=function(t,e,o){var i=t[t.length-2],n=t[t.length-1],r=this.getNextForMaxMinAngle(i,n,e,o);return t[0]===r.min?(t.push(r.min),t):(t.push(r.min),this.getMaxPolygon(t,e,o))},to.prototype.getMinPolygon=function(t,e,o){var i=t[t.length-2],n=t[t.length-1],r=this.getNextForMaxMinAngle(i,n,e,o);return t[0]===r.max?(t.push(r.max),t):(t.push(r.max),this.getMinPolygon(t,e,o))},to.prototype.getNextForMinAngleX=function(t,e,o){for(var i=e[t],n=this.getAllLinkedPoint(t,e,o),r=null,l=null,a=0;a<n.length;++a){var h=e[n[a]];if(h){var c=s.Angle(i,{x:i.x+1,y:i.y},h);h.y-i.y<0&&(c*=-1),(null===r||r>c)&&(r=c,l=n[a])}}return l},to.prototype.getNextForMaxMinAngle=function(t,e,o,i){var n=o[t],r=o[e];n&&r||console.error("getNextForMaxMinAngle******************************************");for(var l=r.x-n.x,a=r.y-n.y,h={x:r.x+l,y:r.y+a},c=this.getAllLinkedPoint(e,o,i),u=null,d=null,y=null,x=null,p=0;p<c.length;++p)if(c[p]!==t){var g=o[c[p]];if(g){var f=s.Angle(r,h,g);l*(g.y-r.y)-(g.x-r.x)*a<0&&(f*=-1),(null===u||u<f)&&(u=f,d=c[p]),(null===y||y>f)&&(y=f,x=c[p])}}return{max:d,min:x}},to.prototype.updateMartix=function(t,e,o){for(var i=0;i<t.length-1;++i){var n=i===t.length-1?0:i+1,r=this.getSegmentId(t[i],t[n],e,o);this.matrix[r]?(delete this.matrix[r],this.deleteSegment(r,o,e)):this.matrix[r]=1}},to.prototype.getSegmentId=function(t,e,o,i){var n=o[t];if(!n)return null;var r=n.parent;for(var s in r){var l=i[s];if(l&&(l.start===e||l.end===e))return s}return null},to.prototype.getSegmentId2=function(t,e){var o=t.parent,i=e.parent;for(var n in o)if(i[n])return n;return null},to.prototype.getAllLinkedPoint=function(t,e,o){var i=[],n=e[t];n||console.error("getAllLinkedPoint");var r=n.parent;for(var s in r){var l=o[s];l&&(l.start===t?i.push(l.end):l.end===t&&i.push(l.start))}return i},to.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 r=e[n];r&&Object.keys(r.parent).length<2&&this.deleteLinksSegment(n,e,o)}},to.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]}},to.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]}},to.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**********************************************************************")},to.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 r=0;for(var s in n.parent)e[s]&&++r;if(r>1)continue;delete t[i]}}return o},to.prototype.getPoint=function(t,e){return e[t]},to.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 s.isClockwise(o)},to.prototype.getId=function(){var t=this.currentId;return++this.currentId,"Polygon"+t},to.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 s.ComputePolygonArea(e)},to.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 s.getPolygonCore(e)},to.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)}},to.prototype.updateChildrenSegmentIds=function(t,e,o){for(var i=[],n=0;n<o.length;++n){var r=o[n];i=i.concat(r.segmentIds)}for(var s in t)if(!(i.indexOf(s)>-1))for(var l=t[s],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(s)}},to.prototype.isContain=function(t,e){for(var o=[],i=[],n=0;n<t.pointIds.length;++n){var r=this.points[t.pointIds[n]];o.push(r)}for(var l=0;l<e.pointIds.length;++l){var a=this.points[e.pointIds[l]];i.push(a)}return s.isPolyInPoly(o,i,.01)},to.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 s.isPointInPoly(e,o)},to.prototype.checkPolygonSegmentIds=function(t,e,o){for(var i=[],n=0;n<t.length;++n){var r=n===t.length-1?0:n+1;if(t[n]!==t[r]){if(!t[n]||!t[r])return;var s=this.getSegmentId(t[n],t[r],e,o);if(!s)return;i.push(s)}}return i},to.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)}},to.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 r={},s={},l=0;l<e.length;++l)r[e[l]]=this.points[e[l]];for(var a=0;a<o.length;++a)s[o[a]]=this.segments[o[a]];return{points:r,segments:s}},to.prototype.getChildMaxPolygons=function(t,e){var o=this.getChildPolygonInfo(e);if(null!=o){var i=this.getStartPoint(o.points),n=[];n.push(i);var r=this.getNextForMinAngleX(i,o.points,o.segments);n.push(r);var s=this.getMaxPolygon(n,o.points,o.segments);s.pop(),t.caves.push(s);for(var l=0;l<e.length;++l)for(var a=this.getPolygon(e[l]),h=0;h<a.pointIds.length;++h)if(s.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)}},to.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 eo=new to,oo=function(){this.room_hallImg=null,this.room_defaultImg=null,this.room_other_White_Img=null,this.room_other_Black_Img=null};oo.prototype.addRoom=function(t,e){o.floors[e].rooms.push(t)},oo.prototype.getRoom=function(t,e){return o.floors[e].rooms[t]},oo.prototype.getRooms=function(t){return o.floors[t].rooms},oo.prototype.clearRooms=function(t){o.floors[t].rooms=[]},oo.prototype.setHallImg=function(t){this.room_hallImg=t},oo.prototype.getHallImg=function(){return this.room_hallImg},oo.prototype.setDefaultImg=function(t){this.room_defaultImg=t},oo.prototype.getDefaultImg=function(){return this.room_defaultImg},oo.prototype.setOtherWhiteImg=function(t){this.room_other_White_Img=t},oo.prototype.getOtherWhiteImg=function(){return this.room_other_White_Img},oo.prototype.setOtherBlackImg=function(t){this.room_other_Black_Img=t},oo.prototype.getOtherBlackImg=function(){return this.room_other_Black_Img};var io=new oo,no=function(){this.points={},this.segments={},this.polygons=[],this.tempRooms=[]};no.prototype.start=function(){var t=o.floors;console.log("从头开始分房间!");for(var e=0;e<t.length;++e){var i=t[e].walls,n=t[e].points;io.clearRooms(e),this.getRoomForSingleFloor(i,n,e)}this.updateRoomsTagName()},no.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 r=new qe(n.roomId,n.floor);r.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}),io.addRoom(r,o)}this.tempRooms=[]},no.prototype.getRooms=function(t,e,o){this.convertToSegments(t,o),this.convertToPoints(e,o),eo.start(this.segments,this.points),this.convertToRoomForPolygon(o),this.points={},this.segments={},this.polygons=[]},no.prototype.convertToPoints=function(t,e){for(var o in t){var i=re.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}},no.prototype.convertToSegments=function(t,e){for(var o in t){var i=re.getWall(o,e),n={segmentId:i.vectorId,start:i.start,end:i.end};this.segments[i.vectorId]=n}},no.prototype.convertToRoomForPolygon=function(){for(var t=0;t<eo.polygons.length;++t){var e=eo.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)}eo.polygons=[]},no.prototype.updateRoomsName=function(){for(var t=0;t<o.floors.length;++t){var e=io.getRooms(t),i=ge.getTags(t);i=JSON.parse(JSON.stringify(i));for(var n=0;n<e.length;++n)e[n]}},no.prototype.updateRoomsTagName=function(){function t(t,e){return t.area-e.area}for(var e=0;e<o.floors.length;++e){var i=io.getRooms(e),n=ge.getTags(e);n=JSON.parse(JSON.stringify(n)),i=i.sort(t);for(var r=0;r<i.length;++r){for(var l=i[r],a=[],h=0;h<l.wallPointIDs.length;++h){var c=re.getPoint(l.wallPointIDs[h],e);a.push(c)}for(var u in n)if(s.isPointInPoly(n[u].center,a)){l.tagName=n[u].title,delete n[u];break}}}};var ro=new no,so=function(){this.startInfo={},this.endInfo={},this.canAdd=!1};so.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})},so.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]),ze.clear()},so.prototype.creatNewWalls=function(t,e){for(var o=0;o<t.length-1;++o){var i=t[o],n=t[o+1];if(!st.getWallId(i,n))st.createWall(i,n).setOut(e)}},so.prototype.canAddWallForEnd=function(t){if(ze.modifyPoint){if(s.getDistance(this.startInfo.position,ze.modifyPoint)<i.minAdsorb)return!1}else if(s.getDistance(this.startInfo.position,t)<i.minAdsorb)return!1;if(ze.symbolInfo.symbolId)return!1;var e=re.getSymbols();for(var o in e){var n=e[o];if(n.geoType!=g)if(null!=s.getIntersectionPoint3(n.startPoint,n.endPoint,this.startInfo.position,t))return!1}return!0},so.prototype.getJoinsForWalls=function(){var t=[],e=re.getWalls(),o=[],n=[];this.startInfo.linkedPointId?(o.push(this.startInfo.linkedPointId),n.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),n.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 r=s.createLine1(this.startInfo.position,this.endInfo.position);for(var l in e)if(!(this.startInfo.linkedWallId&&this.startInfo.linkedWallId==l||this.endInfo.linkedWallId&&this.endInfo.linkedWallId==l)){var a=e[l];if(!(n.indexOf(a.start)>-1||n.indexOf(a.end)>-1)){var h=re.getPoint(a.start),c=re.getPoint(a.end),u=!1;if(o.indexOf(a.start)<0){o.push(a.start);var d=s.getJoinLinePoint(h,r);s.PointInSegment(d,this.startInfo.position,this.endInfo.position,i.minAdsorb)&&s.getDistance(h,d)<i.minAdsorb&&(t.push({join:{x:d.x,y:d.y},pointId:a.start}),u=!0,n.push(a.start))}if(o.indexOf(a.end)<0){o.push(a.end);var y=s.getJoinLinePoint(c,r);s.PointInSegment(y,this.startInfo.position,this.endInfo.position,i.minAdsorb)&&s.getDistance(c,y)<i.minAdsorb&&(t.push({join:{x:y.x,y:y.y},pointId:a.end}),u=!0,n.push(a.end))}if(!u&&n.indexOf(a.start)<0&&n.indexOf(a.end)<0){var x=s.getIntersectionPoint3(h,c,this.startInfo.position,this.endInfo.position);x&&t.push({join:{x:x.x,y:x.y},wallId:l})}}}return t},so.prototype.splitAllJoins=function(t){t=t.sort(function(t,e){return s.getDistance(this.startInfo.position,t.join)-s.getDistance(this.startInfo.position,e.join)}.bind(this));for(var e=[],o=0;o<t.length;++o){var i=t[o],n=i.join,r=i.wallId,l=i.pointId;if(l)e.push(l);else if(r){var a=st.createPoint(n.x,n.y).vectorId,h=null;if(t[o+1]&&t[o].wallId==t[o+1].wallId){var c=re.getWall(r),u=re.getPoint(c.start);h=s.getDistance(u,t[o].join)<s.getDistance(u,t[o+1].join)?st.splitWall(r,a,"end"):st.splitWall(r,a,"start")}else h=st.splitWall(r,a,"start");if(null==h){re.deletePoint(a);continue}ee.reBelongForSplitWall(r,r,h),e.push(a)}else{var d=st.createPoint(n.x,n.y);e.push(d.vectorId)}}return e},so.prototype.updateStart=function(t,e){s.clonePoint(this.startInfo.position,t),this.startInfo.linkedPointId=e,Re.setNewWallStartPosition(this.startInfo.position)},so.prototype.clear=function(){this.startInfo={},this.endInfo={},this.canAdd=!1,Re.hideNewWall(),Re.hideStartAddWall()};var lo=new so,ao=function(){this.lastInfo=null};ao.prototype.save=function(t,e,o,i){this.lastInfo={res:t,center:JSON.stringify(e),defaultCenter:JSON.stringify(o),floor:i},re.setCadBoundingBox()},ao.prototype.setTransform=function(t){var e=re.getCadBoundingBox(),o=re.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)),r=Math.min(i,n);ie._setRes(r);var s={x:1*(o.maxX+o.minX)/2,y:(o.maxY+o.minY)/2};ie._setDefaultCenter(s),ie.setCenter(s)},ao.prototype.recover=function(){ie._setRes(this.lastInfo.res),ie._setDefaultCenter(JSON.parse(this.lastInfo.defaultCenter)),ie.setCenter(JSON.parse(this.lastInfo.center)),this.lastInfo=null};var ho,co=new ao,uo=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 r=0;r<o.length;r++){if(o[r].split("=")[0]==t)return!0}return!1},yo={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 r=e?t[n][e]:t[n];o.add(r),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?yo.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 r in n)n.hasOwnProperty(r)&&("object"==typeof n[r]?e[r]=t(e[r],n[r]):e[r]=n[r])}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]=xo(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,r=Date.now();r-lastCallTime>=e&&(t.apply(n,o),lastCallTime=r)}:function(){for(var o=[],n=arguments.length;n--;)o[n]=arguments[n];i&&clearTimeout(i);var r=this;i=setTimeout((function(){t.apply(r,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}}},xo=((ho=new THREE.TextureLoader).setCrossOrigin("Anonymous"),ho.crossOrigin=!0,function(t,e,o,i){var n=ho.load(t,e,o,i);return n.magFilter=n.minFilter=THREE.LinearFilter,n.needsUpadte=!0,n});yo.dataURLtoBlob=function(t){for(var e=t.split(","),o=e[0].match(/:(.*?);/)[1],i=atob(e[1]),n=i.length,r=new Uint8Array(n);n--;)r[n]=i.charCodeAt(n);return new Blob([r],{type:o})},yo.dataURLtoFile=function(t,e){for(var o=t.split(","),i=o[0].match(/:(.*?);/)[1],n=atob(o[1]),r=n.length,s=new Uint8Array(r);r--;)s[r]=n.charCodeAt(r);return new File([s],e,{type:i})},yo.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()},yo.PrefixPng="data:image/png;base64,",yo.getBlobSrc=function(t,e){var o=yo.dataURLtoBlob((e?yo.PrefixPng:"")+t);return window.URL.createObjectURL(o)},yo.replaceAll=function(t,e,o){var i=new RegExp(e,"g");return t.replace(i,o)},yo.randomWord=function(t,e,o){var i="",n=e,r=["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 s=0;s<n;s++){i+=r[Math.round(Math.random()*(r.length-1))]}return i},yo.getRandomSid=function(){var t=yo.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))},yo.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},yo.CloneJson=function(t){var e=JSON.stringify(t);return JSON.parse(e)},yo.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 r in t)t[r]instanceof Object&&!o?e[r]=this.CloneObject(t[r]):e[r]=t[r];return e},yo.CloneClassObject=function(t){var e=new t.constructor;return this.CopyClassObject(e,t),e},yo.CopyClassObject=function(t,e){for(var o in e){if(o in e.__proto__)break;t[o]=this.CloneObject(e[o],null)}},yo.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 r=i(n);if(r)return r.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 s=Object.keys(t),l=Object.keys(e);if(!ifSame(s,l))return!1;for(var a in t){if(!ifSame(t[a],e[a]))return!1}return!0}console.log("isSame出现例外")},yo.canvasToImg=function(t,e,o,i,n){void 0===e&&(e=1),void 0===i&&(i="image/jpeg");var r=t.toDataURL(i,e);return o&&this.saveTex(r,i,n),r};var po;yo.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");yo.saveFile(t,o)},yo.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 r=t.width*o.widthRatioToImg,s=r*e.height/e.width;!o.leftRatioToImg&&o.rightRatioToImg&&(o.leftRatioToImg=1-o.rightRatioToImg-o.widthRatioToImg),!o.topRatioToImg&&o.bottomRatioToImg&&(o.topRatioToImg=1-o.bottomRatioToImg-s/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,r,s),yo.canvasToImg(i)},yo.pixelsArrayToDataUrl=function(t,e,o,i){void 0===i&&(i=.7);var n=document.createElement("canvas");n.width=e,n.height=o;var r=n.getContext("2d");t=new t.constructor(t);for(var s=4*e,l=0;l<parseInt(o/2);l++){var a=o-l-1,h=t.slice(l*s,l*s+s),c=t.slice(a*s,a*s+s);t.set(c,l*s),t.set(h,a*s)}var u=r.createImageData(e,o);return u.data.set(t),r.putImageData(u,0,0),n.toDataURL(i)},yo.renderTargetToDataUrl=function(t,e,o,i,n){void 0===n&&(n=.7);var r=new Uint8Array(4*(e*o));return i.readRenderTargetPixels(t,0,0,e,o,r),this.pixelsArrayToDataUrl(r,e,o,n)},yo.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)}}},yo.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},yo.updateVisible=function(t,e,o,i,n){void 0===i&&(i=0),t.unvisibleReasons||(t.unvisibleReasons=[]),t.visibleReasons||(t.visibleReasons=[]);var r;o?((r=t.unvisibleReasons.findIndex((function(t){return t.reason==e})))>-1&&(n="cancel",t.unvisibleReasons.splice(r,1)),"add"==n&&(t.visibleReasons.some((function(t){return t.reason==e}))||t.visibleReasons.push({reason:e,level:i}))):((r=t.visibleReasons.findIndex((function(t){return t.reason==e})))>-1&&(n="cancel",t.visibleReasons.splice(r,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}))}()},yo.getObjVisiByReason=function(t,e){return!!t.visible||(!t.unvisibleReasons||!t.unvisibleReasons.some((function(t){return t.reason==e})))},yo.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!")}))},yo.setObjectLayers=function(t,e){var o=Potree.config.renderLayers[e];null!=o?t.traverse((function(t){t.layers.set(o)})):console.error("setCameraLayer没找到layer!")},yo.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 r=e();n={name:t},this.list.push(n),setTimeout((function(){var s=i.list.indexOf(n);i.list.splice(s,1),(n.requestUpdate||r)&&i.isWaiting(t,e,o)}),o)}}},yo.batchHandling={lists:[],getSlice:function(t,e,o){var i=o.stopWhenAllUsed,n=o.minCount;void 0===n&&(n=5);var r=o.maxCount;void 0===r&&(r=100);var s=o.durBound1,l=o.durBound2,a=o.maxUseCount;if(0==e.length||!(a=null==a?yo.getBestCount({name:t,minCount:n,maxCount:r,durBound1:s,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 r,s,l=t.player;l.on("update",(function(t){if(!l.flying){var a,h=e(),c=!l.lastFrameChanged,u=l.lastFrameChanged||!s;u?(a=h,r=null):(r||(r=yo.getDifferenceSet(h,s)),a=r);var d=yo.batchHandling.getSlice("ifVideoInsight",a,{stopWhenAllUsed:c,minCount:i,maxCount:n,durBound1:3,durBound2:13,maxHistory:3}).list;d.forEach(o),u||(r=yo.getDifferenceSet(r,d)),s=d}}))}},yo.getBestCount=(po={},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 r=t.durBound2;void 0===r&&(r=4);var s,l=t.ifLog,a=t.maxHistory,h=performance.getEntriesByName("loop-start");if(h.length){var c=performance.now()-h[h.length-1].startTime;s=Math.round(math.linearClamp(c,n,r,i,o)),a&&(po[e]||(po[e]=[]),0==s&&po[e].length>a-1&&!po[e].some((function(t){return t>0}))&&(s=1),po[e].push(s),po[e].length>a&&po[e].splice(0,1)),l&&console.log(e,s," ,dur:",c.toFixed(3))}else s=i;return s}),yo.getPos2d=function(t,e,o,i){o=o||e.camera,i=i||e.domElement;var n,r,s=t.clone().project(o);n=(s.x+1)/2*i.clientWidth,r=(1-(s.y+1)/2)*i.clientHeight;var l=n<=i.clientWidth&&n>=0&&r<=i.clientHeight&&r>=0;return{pos:new THREE.Vector2(n,r),vector:s,trueSide:s.z<1,inSight:l}},yo.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 go=function(t){this.layer=t,this.showTexture=!0},fo={selectUI:{configurable:!0},currentUI:{configurable:!0},currentFloor:{configurable:!0},currentUnit:{configurable:!0}};fo.selectUI.get=function(){return this.layer.$xui.selectName},fo.selectUI.set=function(t){this.layer.$xui.selectName=t,this.layer.updateEventNameForSelectUI()},fo.currentUI.get=function(){return this.layer.$xui.currentName},fo.currentUI.set=function(t){null===t?this.layer.$xui.hideProps():this.layer.$xui.showProps(t)},fo.currentFloor.get=function(){return this.layer.$xui.currentFloor},fo.currentFloor.set=function(t){this.layer.display&&("image"==this.layer.app.store.getValue("flooruser").type?re.setCurrentFloor(t):(re.setCurrentFloor(t),this.layer.initPanos(re.currentFloor),ae.update(!1),Ae.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)))},fo.currentUnit.get=function(){return this.layer.$xui.currentUnit},fo.currentUnit.set=function(t){this.layer.uiControl.currentUI=null,ae.unit=t,ge.convertUnit(t),this.layer.history.save(),this.layer.renderer.autoRedraw()},go.prototype.setAttributes=function(t,e,o){console.log(e);var i=Kt.getFocusItem();switch(e){case"remove":if(t==h||"OutWall"==t)re.deleteWall(i.vectorId);else if(ee.isSymbol(t))ee.deleteSymbol(i.vectorId);else if(ut.isComponent(t))re.deleteComponent(i.vectorId);else if(t==P){re.deleteTag(i.vectorId);var n=Kt.getDraggingItem();n&&n.vectorId!=i.vectorId&&re.deleteTag(n.vectorId)}else t==a?st.deleteWallCorner(i.vectorId):Gt.isFurniture(t)&&re.deleteFurniture(i.vectorId);Kt.clearItems(),Kt.clearEventName(),this.layer.renderer.autoRedraw();break;case"rotate":if(ee.isSymbol(t)){var r=re.getSymbol(i.vectorId);if(t==c){if(r.openSide==H)if(s.isClockwise(r.points2d))r.openSide=Z;else{var l=r.endPoint;r.endPoint=r.startPoint,r.startPoint=l,r.openSide=Z}else if(r.openSide==Z)if(s.isClockwise(r.points2d))r.openSide=H;else{var y=r.endPoint;r.endPoint=r.startPoint,r.startPoint=y,r.openSide=H}}else if(t==d||t==u||t==x)r.openSide==H?r.openSide=Z:r.openSide==Z&&(r.openSide=H);else{var p=r.endPoint;r.endPoint=r.startPoint,r.startPoint=p}r.setPoints2d(),this.layer.renderer.autoRedraw()}break;case"angle":if(ut.isComponent(t)){var g=re.getComponent(i.vectorId);g.angle=o,g.setPoints2d(),this.layer.renderer.autoRedraw()}else if(Gt.isFurniture(t)){re.getFurniture(i.vectorId).angle=o,this.layer.renderer.autoRedraw()}break;case"width":if(ee.isSymbol(t)){if(ee.updateSymbolForLen(i.vectorId,o).block){var f=re.getSymbol(i.vectorId);console.log("长度阻止:"+s.getDistance(f.startPoint,f.endPoint)),this.layer.$xui.currentAttributes={limit:s.getDistance(f.startPoint,f.endPoint),type:i.type,name:"width",width:s.getDistance(f.startPoint,f.endPoint),thickness:f.thickness}}}else if(ut.isComponent(t)){var m=re.getComponent(i.vectorId);m.sideWidth=o,m.setPoints2d()}this.layer.renderer.autoRedraw();break;case"scale":if(Gt.isFurniture(t))re.getFurniture(i.vectorId).zoom=o,this.layer.renderer.autoRedraw();break;case"thickness":if(ut.isComponent(t)){var v=re.getComponent(i.vectorId);v.sideThickness=o,v.setPoints2d(),this.layer.renderer.autoRedraw()}else if(t==x){var S=re.getSymbol(i.vectorId);S.thickness=o,S.setPoints2d(),this.layer.renderer.autoRedraw()}break;case"split":if(t==h||"OutWall"==t){var I=re.getWall(i.vectorId),b=re.getPoint(I.start),k=re.getPoint(I.end),T={x:(b.x+k.x)/2,y:(b.y+k.y)/2},F=st.createPoint(T.x,T.y),C=st.splitWall(i.vectorId,F.vectorId,"start");I=re.getWall(i.vectorId),b=re.getPoint(I.start),k=re.getPoint(I.end);var w={x:(b.x+k.x)/2,y:(b.y+k.y)/2},W={vectorId:C,type:t};(T.x<w.x||T.x==w.x&&T.y>w.y)&&Kt.setFocusItem(W),this.layer.renderer.autoRedraw()}break;case"tag":if(t==P){var D=re.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==P){var L=re.getTag(i.vectorId);L.setDes(o),L.setUnit(ae.unit),this.layer.renderer.autoRedraw()}break;case"default":if("compass"==t)return void re.setCompass(0);if(ee.isSymbol(t)){var z=ee.getDefaultSymbolLen(t),M=ee.updateSymbolForLen(i.vectorId,z);re.getSymbol(i.vectorId).enter=null,M.block||(this.layer.$xui.currentAttributes={type:i.type,name:"width",width:s.getFixed(s.getDistance(M.start,M.end),2)})}else if(ut.isComponent(t)){var R=re.getComponent(i.vectorId);R.sideWidth=ut.sideWidth,R.sideThickness=ut.sideThickness,R.angle=0,R.setPoints2d(),this.layer.$xui.currentAttributes={name:i.type,width:s.getFixed(R.sideWidth,2),thickness:s.getFixed(R.sideThickness,2),angle:0}}this.layer.renderer.autoRedraw();break;case"enter":if(t==c||t==u||t==d){var O=re.getSymbol(i.vectorId);O.enter=o?"default":null,this.layer.renderer.autoRedraw()}break;case"enterRotate":if(t==c||t==u||t==d){var A=re.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==h)re.getWall(i.vectorId).setImportant(o),this.layer.renderer.autoRedraw();break;case"wallType":if(t==h){var E=re.getWall(i.vectorId);"OutWall"==o?E.setOut(!0):E.setOut(!1),this.layer.renderer.autoRedraw()}break;case"compass":re.setCompass(parseFloat(o))}},go.prototype.saveAttributes=function(t,e){"compass"==e||"compass"==t&&"default"==e||this.layer.history.save()},go.prototype.showAttributes=function(t){if("compass"!=t){var e=Kt.getFocusItem();if(null==e&&(e=Kt.getDraggingItem()),ee.isSymbol(e.type)){var o=re.getSymbol(e.vectorId),i=s.getDistance(o.startPoint,o.endPoint);i=s.getFixed(i,2),e.type==c||e.type==u||e.type==d?this.layer.$xui.currentAttributes={name:e.type,width:i,enter:o.enter?o.enter:null}:e.type==x?this.layer.$xui.currentAttributes={name:e.type,width:i,thickness:s.getFixed(o.thickness,2)}:this.layer.$xui.currentAttributes={name:e.type,width:i}}else if(ut.isComponent(e.type)){var n=re.getComponent(e.vectorId),r=n.sideWidth,l=n.sideThickness;this.layer.$xui.currentAttributes={name:e.type,width:s.getFixed(r,2),thickness:s.getFixed(l,2),angle:n.angle}}else if(e.type==P){var a=re.getTag(e.vectorId);this.layer.$xui.currentAttributes={name:e.type,tag:a.title,area:a.des}}else if(e.type==h){var y=re.getWall(e.vectorId);this.layer.$xui.currentAttributes={name:y.out?"OutWall":e.type,important:y.important||y.out,wallType:y.out?"OutWall":e.type}}else if(Gt.isFurniture(e.type)){var p=re.getFurniture(e.vectorId),g=p.zoom;this.layer.$xui.currentAttributes={name:e.type,scale:g,angle:p.angle}}}else this.layer.$xui.currentAttributes={name:"compass",compass:re.getCompass()}},go.prototype.clearUI=function(){this.selectUI=null},go.prototype.getSymbolTypeForUI=function(){return this.selectUI==pt?c:this.selectUI==gt?u:this.selectUI==ft?d:this.selectUI==mt?y:this.selectUI==vt?x:this.selectUI==St?p:this.selectUI==Pt?g:void 0},go.prototype.getComponentTypeForUI=function(){return this.selectUI==It?f:this.selectUI==bt?m:this.selectUI==kt?v:void 0},go.prototype.getFurnitureTypeForUI=function(){return this.selectUI==Ft?I:this.selectUI==Ct?b:this.selectUI==wt?k:this.selectUI==Wt?T:this.selectUI==Dt?F:this.selectUI==Lt?C:this.selectUI==zt?w:this.selectUI==Mt?W:this.selectUI==Rt?D:this.selectUI==Ot?L:this.selectUI==At?z:this.selectUI==Et?M:this.selectUI==Bt?R:this.selectUI==Yt?O:this.selectUI==Nt?A:this.selectUI==Xt?E:this.selectUI==jt?B:this.selectUI==_t?Y:this.selectUI==Ut?N:this.selectUI==Jt?X:this.selectUI==Vt?j:void 0},go.prototype.screenShot=function(t){var e=this;return new Promise((function(o){e.menu_flex(),Kt.clearItems(),ro.start();var n=e.layer.canvas;ie.setRadio(i.ratio),n.width=window.innerWidth*ie.ratio,n.height=window.innerHeight*ie.ratio,ie.width=window.innerWidth,ie.height=window.innerHeight;var r=e.layer.app.core.get("CameraControls").activeControl.camera;ie.res=Math.min(window.innerWidth/Math.abs(r.right-r.left),window.innerHeight/Math.abs(r.top-r.bottom)),setTimeout(function(){var e=this;if(1==re.getFloorNum())ae.update(!0),this.layer.renderer.autoRedrawForDownLoadImg(t),this.downloadCadImg(n,"floorPlan.jpg");else{var i=re.getCurrentFloor();co.save(ie.res,ie.center,ie.defaultCenter,i),this.layer.app.store.getValue("flooruser").floors.forEach((function(o,i){e.currentFloor=o.subgroup,co.setTransform(o.subgroup),ae.update(!0),e.layer.renderer.autoRedrawForDownLoadImg(t),yo.canvasToImg(n,3,!0,"image/jpeg",o.name+".jpg")})),this.currentFloor=i,co.recover()}ie.updateForCanvas(n),ie.setRes(r.left,r.right),ie.ratio=1,ae.updateRegion(!0),ae.update(!1),this.layer.renderer.autoRedraw(),o()}.bind(e),100)}))},go.prototype.downloadPanosImg=function(){var t=this;return new Promise((function(e){var o=__sdk.core.get("Player"),i=uo("panoImgcolor",!0)?"#"+uo("panoImgcolor",!0):"#fff",n=o.domElement.clientWidth,r=o.domElement.clientHeight,s=t.layer.app.store.getValue("metadata").floorPlanAngle;s=parseFloat(s);var l=o.model.size.clone().applyEuler(new THREE.Euler(0,s,0));l.x=Math.abs(l.x),l.z=Math.abs(l.z),r=Math.round(l.z/l.x*n),o.domElement.clientHeight,o.cameraControls.controls.floorplan.screenshot=!0,o.flyToMode("floorplan",(function(){o.domElement.style.height=r+"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,r);n=Math.round(1024/t*n),r=Math.round(1024/t*r);for(var s,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,s=[h[c].id,h[d].id])}s&&console.log("最小距离:"+a+", panos: "+s[0]+", "+s[1]);var x=35*Math.max(l.x,l.z)/a*1.2;x>Math.max(n,r)&&(x=Math.min(8192,Math.round(x)),console.log(x),n>r?(r=Math.round(r/n*x),n=x):(n=Math.round(n/r*x),r=x)),o.$app.Camera.screenshot([{width:n,height:r}],!1).done((function(t){var s=document.createElement("canvas");s.width=n,s.height=r;var l=s.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=yo.getPos2d(e.position,o,t.o.camera),s=(i.vector.x+1)/2*n,a=(1-(i.vector.y+1)/2)*r;l.fillText(e.id+"",s,a-10),l.beginPath(),l.arc(s,a,1,0,2*Math.PI),l.stroke()})),yo.canvasToImg(s,.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}))}))}))},go.prototype.downloadCadImg=function(t,e){var o=t.toDataURL("jpg",3);o=o.replace(this._fixType("jpg"),"image/octet-stream"),this.saveFile(o,e)},go.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)},go.prototype._fixType=function(t){return"image/"+(t=t.toLowerCase().replace(/jpg/i,"jpeg")).match(/png|jpeg|bmp|gif/)[0]},go.prototype.execute=function(t,e){var o=this;switch(Kt.clearFocusItem(),Kt.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()}},go.prototype.menu_revoke=function(){this.layer.stopAddVector(),this.layer.revokeHistory()},go.prototype.menu_recovery=function(){this.layer.recoveryHistory()},go.prototype.menu_default=function(){var t=this;Ae.clearHistoryRecord();var e=re.angle;re.setAngle(0),this.layer.app.store.getValue("metadata").floorPlanUser=0,this.layer.app.store.getValue("metadata").floorPlanAngle=0,this.menu_flex(!0);var o=ie.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;ie.setRes(i.left,i.right)}var n=re.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),re.setCurrentFloor(n),t.layer.render(),t.layer.app.MinMap.reload(),t.layer.app.core.get("Player").labelManager.reset()}))},go.prototype.menu_screenShot=function(t){return this.layer.stopAddVector(),this.screenShot(t)},go.prototype.menu_clear=function(t){re.clear(t),Kt.clearEventName(),lo.clear(),Re.hideAll(),this.layer.history.save(),this.layer.renderer.autoRedraw()},go.prototype.menu_panos=function(t){this.layer.renderer.displayPanos=t,this.layer.renderer.autoRedraw()},go.prototype.menu_rotate=function(){ie.reSet();var t=re.getAngle();t=parseFloat(t)+Math.PI/2,Math.abs(t-2*Math.PI)<.1&&(t=0),t%=360,re.setAngle(t);var e=ie.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;ie.setRes(o.left,o.right),ie.updateForRotate(),this.layer.initPanos(re.getCurrentFloor()),ae.update(!1),this.layer.history.save(),this.layer.renderer.autoRedraw()},go.prototype.menu_flex=function(t){if(ie.center){ie.reSet(),this.layer.renderer.autoRedraw();var e=ie.getScreenInfoForCAD();if(e.floorPlanAngle=re.getAngle(),this.layer.app.core.get("CameraControls").emit("syncCadAnd3D",e),t){var o=this.layer.app.core.get("CameraControls").activeControl.camera;ie.setRes(o.left,o.right)}}},Object.defineProperties(go.prototype,fo);var mo={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)"}},vo={strokeStyle:"green",fillStyle:"rgb(0, 200, 175)",radius:4},So={strokeStyle:"rgba(255,255,255,1)",fillStyle:"rgba(255,255,255,0)",lineWidth:1,Pass:{}},Po={strokeStyle:"rgba(255,255,255,1)",fillStyle:"rgba(255,255,255,0)",lineWidth:1},Io={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},bo={strokeStyle:"rgb(255,255,255,1)",fillStyle:"rgba(0,0,0,0)",lineWidth:1},ko={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)"}},To={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)"}},Fo={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"}},Co={font:"14px Microsoft YaHei",fillStyle:"#FFFFFF",strokeStyle:"#FFFFFF",textAlign:"center",textBaseline:"middle",miterLimit:10,direction:"ltr"},wo={radius:10,lineWidth:2,strokeStyle:"rgba(255,255,255,0.4)",fillStyle:"rgba(255,255,255,0.1)"},Wo={txt:"rgba(255,255,255,1)",strokeStyle:"rgba(255,255,255,1)",lineWidth:1},Do={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"}}},Lo=function(){this.whiteImg=null,this.blackImg=null};Lo.prototype.setWhiteImg=function(t){this.whiteImg=t},Lo.prototype.setBlackImg=function(t){this.blackImg=t},Lo.prototype.getWhiteImg=function(){return this.whiteImg},Lo.prototype.getBlackImg=function(){return this.blackImg};var zo=new Lo,Mo=function(){this.context=null};Mo.prototype.initContext=function(t){this.context=t?t.getContext("2d"):null},Mo.prototype.clear=function(){this.context.clearRect(0,0,this.context.canvas.width,this.context.canvas.height)},Mo.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()},Mo.prototype.drawWall=function(t,e){var o=re.getPoint(t.start),i=re.getPoint(t.end),n=[];n.push(o);for(var r=0;r<t.children.length;++r){var l=re.getSymbol(t.children[r]);n.push(l.startPoint),n.push(l.endPoint)}n.push(i),n=n.sort(function(t,e){return s.getDistance(o,t)-s.getDistance(o,e)}.bind(this)),this.context.save(),this.context.beginPath(),this.context.lineCap="round",this.context.strokeStyle=mo.strokeStyle,t.out||t.important?(this.context.lineWidth=mo.important.lineWidth*ie.ratio,this.context.strokeStyle=mo.important.strokeStyle):(this.context.lineWidth=mo.lineWidth*ie.ratio,this.context.strokeStyle=mo.strokeStyle);var a=Kt.getSelectItem(),c=Kt.getDraggingItem(),u=Kt.getFocusItem();e?"style-1"==e?t.out||t.important?(this.context.lineWidth=Do.style1.Wall.important.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Wall.important.strokeStyle):(this.context.lineWidth=Do.style1.Wall.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Wall.strokeStyle):"style-2"==e?t.out||t.important?(this.context.lineWidth=Do.style2.Wall.important.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Wall.important.strokeStyle):(this.context.lineWidth=Do.style2.Wall.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Wall.strokeStyle):"style-3"==e?t.out||t.important?(this.context.lineWidth=Do.style3.Wall.important.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Wall.important.strokeStyle):(this.context.lineWidth=Do.style3.Wall.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Wall.strokeStyle):"style-4"==e&&(t.out||t.important?(this.context.lineWidth=Do.style4.Wall.important.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Wall.important.strokeStyle):(this.context.lineWidth=Do.style4.Wall.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Wall.strokeStyle)):(a&&a.type==h?t.vectorId==a.vectorId&&(t.out||t.important?this.context.strokeStyle=ko.Wall_out.strokeStyle:this.context.strokeStyle=ko.Wall.strokeStyle):c&&c.type==h&&t.vectorId==c.vectorId&&(t.out||t.important?this.context.strokeStyle=ko.Wall_out.strokeStyle:this.context.strokeStyle=ko.Wall.strokeStyle),u&&u.type==h&&t.vectorId==u.vectorId&&(this.context.strokeStyle=To.Wall.strokeStyle));for(var d=0;d<n.length-1;d+=2){var y=ie.getScreenXY(n[d]),x=ie.getScreenXY(n[d+1]);this.context.moveTo(y.x,y.y),this.context.lineTo(x.x,x.y)}this.context.stroke(),this.context.restore(),(a&&a.type==h&&t.vectorId==a.vectorId||c&&c.type==h&&t.vectorId==c.vectorId||u&&u.type==h&&t.vectorId==u.vectorId)&&this.drawMeasureTxt(o,i)},Mo.prototype.drawSpecialPoint=function(){var t=Kt.getSelectItem(),e=Kt.getDraggingItem(),o=Kt.getFocusItem(),i=null;if(this.context.save(),t&&(i=re.getPoint(t.vectorId),this.context.lineWidth=ko.Point.lineWidth*ie.ratio,this.context.strokeStyle=ko.Point.strokeStyle,this.context.fillStyle=ko.Point.fillStyle),e&&(i=re.getPoint(e.vectorId),this.context.lineWidth=ko.Point.lineWidth*ie.ratio,this.context.strokeStyle=ko.Point.strokeStyle,this.context.fillStyle=ko.Point.fillStyle),o&&(i=re.getPoint(o.vectorId),this.context.lineWidth=To.Point.lineWidth*ie.ratio,this.context.strokeStyle=To.Point.strokeStyle,this.context.fillStyle=To.Point.fillStyle),null!=i){var n=ie.getScreenXY({x:i.x,y:i.y}),r=vo.radius;this.context.beginPath(),this.context.arc(n.x,n.y,r*ie.ratio,0,2*Math.PI,!0),this.context.stroke(),this.context.fill(),this.context.restore()}else this.context.restore()},Mo.prototype.drawPoint=function(t){var e=ie.getScreenXY({x:t.x,y:t.y}),o=Kt.getSelectItem(),i=Kt.getDraggingItem(),n=Kt.getFocusItem(),r=vo.radius;if(i&&i.type==a&&t.vectorId==i.vectorId||o&&o.type==a&&t.vectorId==o.vectorId)this.context.save(),this.context.lineWidth=ko.Point.lineWidth*ie.ratio,this.context.strokeStyle=ko.Point.strokeStyle,this.context.fillStyle=ko.Point.fillStyle,r=ko.Point.radius;else{if(!n||n.type!=a||t.vectorId!=n.vectorId)return;this.context.save(),this.context.lineWidth=To.Point.lineWidth*ie.ratio,this.context.strokeStyle=To.Point.strokeStyle,this.context.fillStyle=To.Point.fillStyle,r=To.Point.radius}this.context.beginPath(),this.context.arc(e.x,e.y,r*ie.ratio,0,2*Math.PI,!0),this.context.stroke(),this.context.fill(),this.context.restore()},Mo.prototype.drawSelectSymbolPoint=function(){var t=Kt.getSelectItem(),e=Kt.getDraggingItem(),o=Kt.getFocusItem(),i=null,n=null,r=null;this.context.save(),t&&t.selectIndex&&t.selectIndex!=_&&ee.isSymbol(t.type)?(i=re.getSymbol(t.vectorId),t.selectIndex==U?n=ie.getScreenXY({x:i.startPoint.x,y:i.startPoint.y}):t.selectIndex==J&&(n=ie.getScreenXY({x:i.endPoint.x,y:i.endPoint.y})),this.context.lineWidth=ko.Point.lineWidth*ie.ratio,this.context.strokeStyle=ko.Point.strokeStyle,this.context.fillStyle=ko.Point.fillStyle,r=ko.Point.radius):e&&e.selectIndex&&e.selectIndex!=_&&ee.isSymbol(e.type)&&(i=re.getSymbol(e.vectorId),e.selectIndex==U?n=ie.getScreenXY({x:i.startPoint.x,y:i.startPoint.y}):e.selectIndex==J&&(n=ie.getScreenXY({x:i.endPoint.x,y:i.endPoint.y})),this.context.lineWidth=ko.Point.lineWidth*ie.ratio,this.context.strokeStyle=ko.Point.strokeStyle,this.context.fillStyle=ko.Point.fillStyle,r=ko.Point.radius),o&&o.selectIndex&&o.selectIndex!=_&&ee.isSymbol(o.type)&&(i=re.getSymbol(o.vectorId),o.selectIndex==U?n=ie.getScreenXY({x:i.startPoint.x,y:i.startPoint.y}):o.selectIndex==J&&(n=ie.getScreenXY({x:i.endPoint.x,y:i.endPoint.y})),this.context.lineWidth=To.Point.lineWidth*ie.ratio,this.context.strokeStyle=To.Point.strokeStyle,this.context.fillStyle=To.Point.fillStyle,r=To.Point.radius),null!=n&&null!=r&&(this.context.beginPath(),this.context.arc(n.x,n.y,r*ie.ratio,0,2*Math.PI,!0),this.context.stroke(),this.context.fill()),this.context.restore()},Mo.prototype.drawSymbolPoint=function(t){var e=ie.getScreenXY({x:t.startPoint.x,y:t.startPoint.y}),o=ie.getScreenXY({x:t.endPoint.x,y:t.endPoint.y}),i=vo.radius;this.context.save(),this.context.lineWidth=vo.lineWidth*ie.ratio,this.context.strokeStyle=vo.strokeStyle,this.context.fillStyle=vo.fillStyle,this.context.beginPath(),this.context.arc(e.x,e.y,i*ie.ratio,0,2*Math.PI,!0),this.context.stroke(),this.context.fill(),this.context.beginPath(),this.context.arc(o.x,o.y,i*ie.ratio,0,2*Math.PI,!0),this.context.stroke(),this.context.fill(),this.context.restore()},Mo.prototype.drawText=function(t,e,o,n){this.context.save(),this.setCanvasStyle(Co),ie.ratio==i.ratio?this.context.font="36px Microsoft YaHei":this.context.font="12px Microsoft YaHei";var r={x:t.x,y:t.y};o||(r=ie.getScreenXY({x:t.x,y:t.y})),n?(this.context.translate(r.x,r.y),this.context.rotate(n),this.context.fillText(e,0,0)):this.context.fillText(e,r.x,r.y),this.context.restore()},Mo.prototype.drawSingleDoor=function(t,e,o){for(var i=t.points2d,n=[],r=0;r<i.length;++r)n[r]=ie.getScreenXY({x:i[r].x,y:i[r].y});var l=s.getDistance(n[0],n[1]);this.context.save(),this.context.lineWidth=So.lineWidth*ie.ratio,this.context.lineCap="square",this.context.strokeStyle=So.strokeStyle;var a=!1;if(e)"style-1"==e?(this.context.lineWidth=Do.style1.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Symbol.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Symbol.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Symbol.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Symbol.strokeStyle);else{var h=Kt.getSelectItem(),u=Kt.getDraggingItem(),d=Kt.getFocusItem();h&&h.type==c&&h.selectIndex==_?t.vectorId==h.vectorId&&(this.context.strokeStyle=ko.Symbol.strokeStyle,this.context.fillStyle=ko.Symbol.fillStyle,a=!0):u&&u.type==c&&u.selectIndex==_&&t.vectorId==u.vectorId&&(this.context.strokeStyle=ko.Symbol.strokeStyle,this.context.fillStyle=ko.Symbol.fillStyle,a=!0),d&&d.type==c&&t.vectorId==d.vectorId&&(this.context.strokeStyle=To.Symbol.strokeStyle,this.context.fillStyle=To.Symbol.fillStyle,a=!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,l),this.context.closePath(),this.context.stroke(),a&&this.context.fill(),this.context.restore(),o||null==t.enter||this.drawEntranceDoor(t)},Mo.prototype.drawDoubleDoor=function(t,e,o){for(var i=t.points2d,n=[],r=0;r<i.length;++r)n[r]=ie.getScreenXY({x:i[r].x,y:i[r].y});var l=s.getDistance(n[0],n[1]);this.context.save(),this.context.lineWidth=So.lineWidth*ie.ratio,this.context.lineCap="square",this.context.strokeStyle=So.strokeStyle;var a=!1;if(e)"style-1"==e?(this.context.lineWidth=Do.style1.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Symbol.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Symbol.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Symbol.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Symbol.strokeStyle);else{var h=Kt.getSelectItem(),c=Kt.getDraggingItem(),d=Kt.getFocusItem();h&&h.type==u&&h.selectIndex==_?t.vectorId==h.vectorId&&(this.context.strokeStyle=ko.Symbol.strokeStyle,this.context.fillStyle=ko.Symbol.fillStyle,a=!0):c&&c.type==u&&c.selectIndex==_&&t.vectorId==c.vectorId&&(this.context.strokeStyle=ko.Symbol.strokeStyle,this.context.fillStyle=ko.Symbol.fillStyle,a=!0),d&&d.type==u&&t.vectorId==d.vectorId&&(this.context.strokeStyle=To.Symbol.strokeStyle,this.context.fillStyle=To.Symbol.fillStyle,a=!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,l),this.context.closePath(),this.context.stroke(),a&&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,l),this.context.closePath(),this.context.stroke(),a&&this.context.fill(),this.context.restore(),o||null==t.enter||this.drawEntranceDoor(t)},Mo.prototype.drawSlideDoor=function(t,e,o){for(var i=t.points2d,n=[],r=0;r<i.length;++r)n[r]=ie.getScreenXY({x:i[r].x,y:i[r].y});if(this.context.save(),this.context.lineWidth=So.lineWidth*ie.ratio,this.context.strokeStyle=So.strokeStyle,e)"style-1"==e?(this.context.lineWidth=Do.style1.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Symbol.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Symbol.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Symbol.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Symbol.strokeStyle);else{var s=Kt.getSelectItem(),l=Kt.getDraggingItem(),a=Kt.getFocusItem();s&&s.type==d&&s.selectIndex==_?t.vectorId==s.vectorId&&(this.context.strokeStyle=ko.Symbol.strokeStyle):l&&l.type==d&&l.selectIndex==_&&t.vectorId==l.vectorId&&(this.context.strokeStyle=ko.Symbol.strokeStyle),a&&a.type==d&&t.vectorId==a.vectorId&&(this.context.strokeStyle=To.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)},Mo.prototype.drawSingleWindow=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=ie.getScreenXY({x:o[n].x,y:o[n].y});if(this.context.save(),this.context.lineWidth=So.lineWidth*ie.ratio,this.context.strokeStyle=So.strokeStyle,e)"style-1"==e?(this.context.lineWidth=Do.style1.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Symbol.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Symbol.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Symbol.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Symbol.strokeStyle);else{var r=Kt.getSelectItem(),s=Kt.getDraggingItem(),l=Kt.getFocusItem();r&&r.type==y&&r.selectIndex==_?t.vectorId==r.vectorId&&(this.context.strokeStyle=ko.Symbol.strokeStyle):s&&s.type==y&&s.selectIndex==_&&t.vectorId==s.vectorId&&(this.context.strokeStyle=ko.Symbol.strokeStyle),l&&l.type==y&&t.vectorId==l.vectorId&&(this.context.strokeStyle=To.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()},Mo.prototype.drawBayWindow=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=ie.getScreenXY({x:o[n].x,y:o[n].y});this.context.save(),this.context.lineWidth=So.lineWidth*ie.ratio,this.context.strokeStyle=So.strokeStyle;var r=!1;if(e)"style-1"==e?(this.context.lineWidth=Do.style1.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Symbol.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Symbol.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Symbol.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Symbol.strokeStyle);else{var s=Kt.getSelectItem(),l=Kt.getDraggingItem(),a=Kt.getFocusItem();s&&s.type==x&&s.selectIndex==_?t.vectorId==s.vectorId&&(this.context.strokeStyle=ko.Symbol.strokeStyle,this.context.fillStyle=ko.Symbol.fillStyle,r=!0):l&&l.type==x&&l.selectIndex==_&&t.vectorId==l.vectorId&&(this.context.strokeStyle=ko.Symbol.strokeStyle,this.context.fillStyle=ko.Symbol.fillStyle,r=!0),a&&a.type==x&&t.vectorId==a.vectorId&&(this.context.strokeStyle=To.Symbol.strokeStyle,this.context.fillStyle=To.Symbol.fillStyle,r=!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(),r&&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()},Mo.prototype.drawFrenchWindow=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=ie.getScreenXY({x:o[n].x,y:o[n].y});if(this.context.save(),this.context.lineWidth=So.lineWidth*ie.ratio,this.context.strokeStyle=So.strokeStyle,e)"style-1"==e?(this.context.lineWidth=Do.style1.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Symbol.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Symbol.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Symbol.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Symbol.strokeStyle);else{var r=Kt.getSelectItem(),s=Kt.getDraggingItem(),l=Kt.getFocusItem();r&&r.type==p&&r.selectIndex==_?t.vectorId==r.vectorId&&(this.context.strokeStyle=ko.Symbol.strokeStyle):s&&s.type==p&&s.selectIndex==_&&t.vectorId==s.vectorId&&(this.context.strokeStyle=ko.Symbol.strokeStyle),l&&l.type==p&&t.vectorId==l.vectorId&&(this.context.strokeStyle=To.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()},Mo.prototype.drawPass=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=ie.getScreenXY({x:o[n].x,y:o[n].y});if(this.context.save(),this.context.lineWidth=So.lineWidth*ie.ratio,this.context.strokeStyle=So.strokeStyle,e)"style-1"==e?(this.context.lineWidth=Do.style1.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Symbol.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Symbol.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Symbol.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Symbol.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Symbol.strokeStyle);else{var r=Kt.getSelectItem(),s=Kt.getDraggingItem(),l=Kt.getFocusItem();r&&r.type==g&&r.selectIndex==_?t.vectorId==r.vectorId&&(this.context.strokeStyle=ko.Symbol.strokeStyle):s&&s.type==g&&s.selectIndex==_&&t.vectorId==s.vectorId&&(this.context.strokeStyle=ko.Symbol.strokeStyle),l&&l.type==g&&t.vectorId==l.vectorId&&(this.context.strokeStyle=To.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()},Mo.prototype.drawBeam=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=ie.getScreenXY({x:o[n].x,y:o[n].y});this.context.save(),this.context.lineWidth=Po.lineWidth*ie.ratio,this.context.strokeStyle=Po.strokeStyle;var r=!1;if(e)"style-1"==e?(this.context.lineWidth=Do.style1.Component.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Component.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Component.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Component.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Component.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Component.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Component.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Component.strokeStyle);else{var s=Kt.getSelectItem(),l=Kt.getDraggingItem(),a=Kt.getFocusItem();s&&s.type==f?t.vectorId==s.vectorId&&(this.context.strokeStyle=ko.Component.strokeStyle,this.context.fillStyle=ko.Component.fillStyle,r=!0):l&&l.type==f&&t.vectorId==l.vectorId&&(this.context.strokeStyle=ko.Component.strokeStyle,this.context.fillStyle=ko.Component.fillStyle,r=!0),a&&a.type==f&&t.vectorId==a.vectorId&&(this.context.strokeStyle=To.Component.strokeStyle,this.context.fillStyle=To.Component.fillStyle,r=!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(),r&&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()},Mo.prototype.drawFlue=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=ie.getScreenXY({x:o[n].x,y:o[n].y});this.context.save(),this.context.lineWidth=Po.lineWidth*ie.ratio,this.context.strokeStyle=Po.strokeStyle;var r=!1;if(e)"style-1"==e?(this.context.lineWidth=Do.style1.Component.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Component.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Component.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Component.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Component.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Component.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Component.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Component.strokeStyle);else{var s=Kt.getSelectItem(),l=Kt.getDraggingItem(),a=Kt.getFocusItem();s&&s.type==m?t.vectorId==s.vectorId&&(this.context.strokeStyle=ko.Component.strokeStyle,this.context.fillStyle=ko.Component.fillStyle,r=!0):l&&l.type==m&&t.vectorId==l.vectorId&&(this.context.strokeStyle=ko.Component.strokeStyle,this.context.fillStyle=ko.Component.fillStyle,r=!0),a&&a.type==m&&t.vectorId==a.vectorId&&(this.context.strokeStyle=To.Component.strokeStyle,this.context.fillStyle=To.Component.fillStyle,r=!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(),r&&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()},Mo.prototype.drawCorridor=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=ie.getScreenXY({x:o[n].x,y:o[n].y});if(this.context.save(),this.context.lineWidth=Po.lineWidth*ie.ratio,this.context.strokeStyle=Po.strokeStyle,e)"style-1"==e?(this.context.lineWidth=Do.style1.Component.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Component.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Component.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Component.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Component.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Component.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Component.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Component.strokeStyle);else{var r=Kt.getSelectItem(),s=Kt.getDraggingItem(),l=Kt.getFocusItem();r&&r.type==v?t.vectorId==r.vectorId&&(this.context.strokeStyle=ko.Component.strokeStyle):s&&s.type==v&&t.vectorId==s.vectorId&&(this.context.strokeStyle=ko.Component.strokeStyle),l&&l.type==v&&t.vectorId==l.vectorId&&(this.context.strokeStyle=To.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()},Mo.prototype.drawTag=function(t,e,o){if(this.context.save(),this.context.lineWidth=Io.lineWidth*ie.ratio,this.context.strokeStyle=Io.strokeStyle,this.context.fillStyle=Io.fillStyle,e)"style-1"==e?(this.context.lineWidth=Do.style1.Tag.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Tag.strokeStyle,this.context.fillStyle=Do.style1.Tag.fillStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Tag.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Tag.strokeStyle,this.context.fillStyle=Do.style2.Tag.fillStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Tag.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Tag.strokeStyle,this.context.fillStyle=Do.style3.Tag.fillStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Tag.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Tag.strokeStyle,this.context.fillStyle=Do.style4.Tag.fillStyle);else{var n=Kt.getSelectItem(),r=Kt.getDraggingItem(),l=Kt.getFocusItem();n&&n.type==P?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Tag.strokeStyle,this.context.fillStyle=ko.Tag.fillStyle):r&&r.type==P&&t.vectorId==r.vectorId&&(this.context.strokeStyle=ko.Tag.strokeStyle,this.context.fillStyle=ko.Tag.fillStyle),l&&l.type==P&&t.vectorId==l.vectorId&&(this.context.strokeStyle=To.Tag.strokeStyle,this.context.fillStyle=To.Tag.fillStyle)}if(t.adding){for(var a=t.points2d,h=[],c=0;c<a.length;++c)h[c]=ie.getScreenXY({x:a[c].x,y:a[c].y});this.context.strokeStyle=Io.strokeStyle_adding,this.context.fillStyle=Io.fillStyle_adding,this.context.beginPath(),this.context.moveTo(h[0].x,h[0].y),this.context.lineTo(h[1].x,h[1].y),this.context.lineTo(h[2].x,h[2].y),this.context.lineTo(h[3].x,h[3].y),this.context.closePath(),this.context.stroke();for(var u=4;u<h.length-1;u+=2)this.context.moveTo(h[u].x,h[u].y),this.context.lineTo(h[u+1].x,h[u+1].y);this.context.stroke()}else{var d=ie.ratio==i.ratio?36:12;this.context.font="400 "+d+"px Microsoft YaHei";var y=t.title;o||null!=y&&""!=y.trim()||(console.log(re.$app.config),y=re.$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 x=t.points2d,p=[],g=0;g<x.length;++g)p[g]=ie.getScreenXY({x:x[g].x,y:x[g].y});var f=(t.center.x,t.center.y);f=ie.getScreenXY({x:t.center.x,y:t.center.y});var m=this.context.measureText(y).width,v=(s.createLine1({x:(p[0].x+p[3].x)/2,y:(p[0].y+p[3].y)/2},{x:(p[2].x+p[1].x)/2,y:(p[2].y+p[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,I;s.createLine1(p[2],p[3]);if(S=s.getDisPointsLine({y:(p[0].y+p[3].y)/2},f,m/2,m/2),I=s.getDisPointsLine({y:p[3].y},{x:(p[2].x+p[3].x)/2,y:(p[2].y+p[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"==ae.unit&&"m"==t.unit){var b=xe.convert(t.des,"area",void 0,"imperial",.01,!1);this.context.fillText(parseFloat(b.replace(",","")).toFixed(2),I.newpoint1.x+d/1.5,I.newpoint1.y)}else if("m"==ae.unit&&"ft"==t.unit){var k=xe.convertBack(t.des,"area",7,"imperial",.01,!1);this.context.fillText(parseFloat(k.replace(",","")).toFixed(2),I.newpoint1.x+d/1.5,I.newpoint1.y)}else"m"==t.unit?this.context.fillText(parseFloat(t.des).toFixed(2)+"m²",I.newpoint1.x,I.newpoint1.y):"ft"==t.unit&&this.context.fillText(parseFloat(t.des.replace(",","")).toFixed(2)+"ft²",I.newpoint1.x,I.newpoint1.y)}else if(this.context.fillText(y,S.newpoint2.x,S.newpoint2.y),t.des)if("ft"==ae.unit&&"m"==t.unit){var T=xe.convert(t.des,"area",void 0,"imperial",.01,!1);this.context.fillText(parseFloat(T.replace(",","")).toFixed(2),I.newpoint2.x+d/1.5,I.newpoint2.y)}else if("m"==ae.unit&&"ft"==t.unit){var F=xe.convertBack(t.des,"area",7,"imperial",.01,!1);this.context.fillText(parseFloat(F.replace(",","")).toFixed(2),I.newpoint2.x+d/1.5,I.newpoint2.y)}else"m"==t.unit?this.context.fillText(parseFloat(t.des).toFixed(2)+"m²",I.newpoint2.x,I.newpoint2.y):"ft"==t.unit&&this.context.fillText(parseFloat(t.des.replace(",","")).toFixed(2)+"ft²",I.newpoint2.x,I.newpoint2.y)}this.context.restore()},Mo.prototype.drawCircle=function(t){var e=null,o=2*Math.PI,i=ie.getScreenXY(t);this.context.save(),t.name==Pe?(e=Fo.StartAddWall.radius*ie.ratio,this.context.strokeStyle=Fo.StartAddWall.strokeStyle,this.context.fillStyle=Fo.StartAddWall.fillStyle):t.name==be?(e=Fo.StartSymbolPoints.radius*ie.ratio,this.context.strokeStyle=Fo.StartSymbolPoints.strokeStyle,this.context.fillStyle=Fo.StartSymbolPoints.fillStyle):t.name==ke?(e=Fo.EndSymbolPoints.radius*ie.ratio,this.context.strokeStyle=Fo.EndSymbolPoints.strokeStyle,this.context.fillStyle=Fo.EndSymbolPoints.fillStyle):"pano"==t.name&&(e=wo.radius*ie.ratio,this.context.strokeStyle=wo.strokeStyle,this.context.fillStyle=wo.fillStyle,this.context.lineWidth=wo.lineWidth),this.context.beginPath(),this.context.arc(i.x,i.y,e,0,o,!0),this.context.stroke(),this.context.fill(),this.context.restore()},Mo.prototype.drawLine=function(t){var e=ie.getScreenXY(t.start),o=ie.getScreenXY(t.end);this.context.save(),t.name==Ce?(this.context.lineWidth=Fo.VCheckLinesX.lineWidth*ie.ratio,this.context.strokeStyle=Fo.VCheckLinesX.strokeStyle,this.context.setLineDash([3,2,2]),e.y=0,o.y=this.context.canvas.clientHeight):t.name==we?(this.context.lineWidth=Fo.VCheckLinesY.lineWidth*ie.ratio,this.context.strokeStyle=Fo.VCheckLinesY.strokeStyle,this.context.setLineDash([3,2,2]),e.x=0,o.x=this.context.canvas.clientWidth):t.name==Ie?(this.context.lineWidth=Fo.NewWall.lineWidth*ie.ratio,this.context.strokeStyle=Fo.NewWall.strokeStyle,"error"==t.state?this.context.strokeStyle=Fo.NewWall.errorStrokeStyle:"normal-out"==t.state&&(this.context.strokeStyle=Fo.NewWall.strokeStyle_out,this.context.lineWidth=Fo.NewWall.lineWidth_out*ie.ratio)):t.name==Te?(this.context.lineWidth=Fo.CheckLinesX.lineWidth*ie.ratio,this.context.strokeStyle=Fo.CheckLinesX.strokeStyle,this.context.setLineDash([3,2,2])):t.name==Fe?(this.context.lineWidth=Fo.CheckLinesY.lineWidth*ie.ratio,this.context.strokeStyle=Fo.CheckLinesY.strokeStyle,this.context.setLineDash([3,2,2])):t.name==We?(this.context.lineWidth=Fo.SignLine1.lineWidth*ie.ratio,this.context.strokeStyle=Fo.SignLine1.strokeStyle,this.context.setLineDash([3,2,2])):t.name==De&&(this.context.lineWidth=Fo.SignLine2.lineWidth*ie.ratio,this.context.strokeStyle=Fo.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==Ie&&this.drawMeasureTxt(t.start,t.end),this.context.save(),this.context.lineWidth=vo.lineWidth*ie.ratio,this.context.strokeStyle=vo.strokeStyle,this.context.fillStyle=vo.fillStyle;var i=vo.radius;this.context.beginPath(),this.context.arc(e.x,e.y,i*ie.ratio,0,2*Math.PI,!0),this.context.stroke(),this.context.fill(),this.context.restore()},Mo.prototype.drawMeasure=function(t,e,o,n){this.context.save(),this.context.strokeStyle=Wo.strokeStyle,this.context.lineWidth=Wo.lineWidth*ie.ratio,o&&("style-1"==o||"style-2"==o||"style-3"==o||"style-4"==o)&&(this.context.lineWidth=Do.style1.Measure.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Measure.strokeStyle);for(var r=n?1:ie.ratio,l=0;l<t.length-1;++l){var a=ie.getScreenXY(t[l]),h=ie.getScreenXY(t[l+1]),c=0;"top"==e?(a.y=ae.region.top*r,h.y=ae.region.top*r):"bottom"==e?(a.y=ae.region.bottom*r,h.y=ae.region.bottom*r):"left"==e?(a.x=ae.region.left*r,h.x=ae.region.left*r,c=-.5*Math.PI):"right"==e&&(a.x=ae.region.right*r,h.x=ae.region.right*r,c=.5*Math.PI);var u=s.createLine1(a,h);if(null!=u){var d=s.getParallelLineForDistance(u,6*ie.ratio),y=s.getJoinLinePoint(a,d.line1),x=s.getJoinLinePoint(h,d.line1),p=s.getJoinLinePoint(a,d.line2),g=s.getJoinLinePoint(h,d.line2);this.context.beginPath(),this.context.moveTo(y.x,y.y),this.context.lineTo(p.x,p.y),this.context.stroke(),this.context.beginPath(),this.context.moveTo(x.x,x.y),this.context.lineTo(g.x,g.y),this.context.stroke();var f={x:(a.x+h.x)/2,y:(a.y+h.y)/2},m=s.getVerticalLine(u,f);d=s.getParallelLineForDistance(m,22*ie.ratio);var v=s.getIntersectionPoint(u,d.line1),S=s.getIntersectionPoint(u,d.line2);if(s.getDistance(a,v)<s.getDistance(a,f)){var P=s.getDistance(t[l],t[l+1]);P="ft"==ae.unit?" "+xe.convert(P,"distance",void 0,"imperial",.01,!0)+" ":s.getFixed(P,2)+"m",s.getDistance(a,h)>this.context.measureText(P).width?(this.context.beginPath(),this.context.moveTo(a.x,a.y),this.context.lineTo(v.x,v.y),this.context.stroke(),this.context.beginPath(),this.context.moveTo(S.x,S.y),this.context.lineTo(h.x,h.y),this.context.stroke(),this.context.save(),ie.ratio==i.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",c?(this.context.translate(f.x,f.y),this.context.rotate(c),this.context.fillText(P,0,0)):this.context.fillText(P,f.x,f.y),this.context.restore()):(this.context.beginPath(),this.context.moveTo(a.x,a.y),this.context.lineTo(h.x,h.y),this.context.stroke())}else{var I=s.getDistance(t[l],t[l+1]);I="ft"==ae.unit?" "+xe.convert(I,"distance",void 0,"imperial",.01,!0)+" ":s.getFixed(I,2)+"m",s.getDistance(a,h)>this.context.measureText(I).width?(this.context.beginPath(),this.context.moveTo(a.x,a.y),this.context.lineTo(S.x,S.y),this.context.stroke(),this.context.beginPath(),this.context.moveTo(v.x,v.y),this.context.lineTo(h.x,h.y),this.context.stroke(),this.context.save(),ie.ratio==i.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",c?(this.context.translate(f.x,f.y),this.context.rotate(c),this.context.fillText(I,0,0)):this.context.fillText(I,f.x,f.y),this.context.restore()):(this.context.beginPath(),this.context.moveTo(a.x,a.y),this.context.lineTo(h.x,h.y),this.context.stroke())}}}this.context.restore()},Mo.prototype.drawMeasureTxt=function(t,e){var o=ie.getScreenXY(t),i=ie.getScreenXY(e),n=s.createLine1(o,i);if(null!=n){var r={x:(o.x+i.x)/2,y:(o.y+i.y)/2},l=s.getParallelLineForDistance(n,10),a=null,h=s.getJoinLinePoint(r,l.line1),c=s.getJoinLinePoint(r,l.line2);r.y<h.y?(s.clonePoint(r,c),a=l.line2):(s.clonePoint(r,h),a=l.line1);var u=s.getDistance(t,e);u="ft"==ae.unit?" "+xe.convert(u,"distance",void 0,"imperial",.01,!0)+" ":s.getFixed(u,2)+"m";var d=this.context.measureText(u).width,y=s.getLineForPoint(n,r),x=s.getParallelLineForDistance(y,d/2),p=s.getIntersectionPoint(x.line1,a);p={x:Math.round(p.x),y:Math.round(p.y)};var g=s.getIntersectionPoint(x.line2,a);g={x:Math.round(g.x),y:Math.round(g.y)},p.x<g.x?s.clonePoint(r,p):p.x>g.x?s.clonePoint(r,g):p.y<g.y?s.clonePoint(r,p):s.clonePoint(r,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=Wo.txt,this.context.translate(r.x,r.y),this.context.rotate(f),this.context.fillText(u,0,0),this.context.restore()}},Mo.prototype.drawEntranceDoor=function(t){this.context.save();var e,o,n=ee.getEnterImg(),r={x:(t.startPoint.x+t.endPoint.x)/2,y:(t.startPoint.y+t.endPoint.y)/2},l=s.createLine1(t.startPoint,t.endPoint),a=s.getLineForPoint(l,r),h=null,c=null;"default"==t.enter?h=s.getParallelLineForDistance(l,.02):"reverse"==t.enter&&(h=s.getParallelLineForDistance(l,.02+s.getDistance(t.startPoint,t.endPoint))),e=s.getIntersectionPoint(h.line1,a),o=s.getIntersectionPoint(h.line2,a);var u=s.Angle(t.startPoint,{x:t.startPoint.x+1,y:t.startPoint.y},t.endPoint);s.isClockwise([t.startPoint,t.endPoint,o])?c="LEFT"==t.openSide?"default"==t.enter?e:o:"default"==t.enter?o:e:s.isClockwise([t.startPoint,t.endPoint,e])&&(c="LEFT"==t.openSide?"default"==t.enter?o:e:"default"==t.enter?e:o),s.isClockwise([t.startPoint,t.endPoint,c])||(u=Math.PI+u),c=ie.getScreenXY(c),this.context.translate(c.x,c.y),t.startPoint.y<=t.endPoint.y?this.context.rotate(-u):this.context.rotate(u);var d=s.getDistance(t.startPoint,t.endPoint)*ie.res*1.5;this.context.scale(ie.zoom/i.defaultZoom*ie.ratio*d/n.height,ie.zoom/i.defaultZoom*ie.ratio*d/n.height),this.context.drawImage(n,-n.width/2,-n.height-10),this.context.restore()},Mo.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 r=re.getPoint(t.wallPointIDs[n]);r=ie.getScreenXY(r),i.push(r)}this.context.beginPath(),this.context.moveTo(i[0].x,i[0].y);for(var s=0;s<i.length;++s)this.context.lineTo(i[s].x,i[s].y);this.context.closePath(),o&&this.context.fill(),this.context.restore()}},Mo.prototype.drawCompass=function(t){var e=null;e="style-1"==t||"style-3"==t?zo.getWhiteImg():zo.getBlackImg();var o=re.getCompass();this.context.save(),this.context.translate((ie.width-310)*ie.ratio,160*ie.ratio),this.context.rotate(o/180*Math.PI),this.context.scale(ie.ratio/2,ie.ratio/2),this.context.drawImage(e,-e.width/2,-e.height/2),this.context.restore()},Mo.prototype.setCanvasStyle=function(t){for(var e in t)"isFill"!=e&&"isStroke"!=e&&(this.context[e]=t[e])},Mo.prototype.drawFurniture=function(t,e){t.geoType==I?(this.drawTV(t,e),this.drawTestRec(t)):t.geoType==b?(this.drawCombinationSofa(t,e),this.drawTestRec(t)):t.geoType==k?(this.drawSingleSofa(t,e),this.drawTestRec(t)):t.geoType==T?(this.drawTeaTable(t,e),this.drawTestRec(t)):t.geoType==F?(this.drawCarpet(t,e),this.drawTestRec(t)):t.geoType==C?(this.drawPlant(t,e),this.drawTestRec(t)):t.geoType==w?(this.drawDiningTable(t,e),this.drawTestRec(t)):t.geoType==W?(this.drawDoubleBed(t,e),this.drawTestRec(t)):t.geoType==D?(this.drawSingleBed(t,e),this.drawTestRec(t)):t.geoType==L?(this.drawWardrobe(t,e),this.drawTestRec(t)):t.geoType==z?(this.drawDresser(t,e),this.drawTestRec(t)):t.geoType==M?(this.drawBedsideCupboard(t,e),this.drawTestRec(t)):t.geoType==R?(this.drawPillow(t,e),this.drawTestRec(t)):t.geoType==O?(this.drawGasStove(t,e),this.drawTestRec(t)):t.geoType==A?(this.drawCupboard(t,e),this.drawTestRec(t)):t.geoType==E?(this.drawBathtub(t,e),this.drawTestRec(t)):t.geoType==B?(this.drawClosestool(t,e),this.drawTestRec(t)):t.geoType==Y?(this.drawWashstand(t,e),this.drawTestRec(t)):t.geoType==N?(this.drawDesk(t,e),this.drawTestRec(t)):t.geoType==X?(this.drawBalconyChair(t,e),this.drawTestRec(t)):t.geoType==j&&(this.drawElevator(t,e),this.drawTestRec(t))},Mo.prototype.drawTestRec=function(t){},Mo.prototype.drawRec=function(t){},Mo.prototype.drawTV=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==I?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==I?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==I&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawCombinationSofa=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==b?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==b?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==b&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawSingleSofa=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==k?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==k?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==k&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawTeaTable=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==T?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==T?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==T&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawCarpet=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==F?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==F?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==F&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawPlant=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==C?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==C?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==C&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawDiningTable=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==w?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==w?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==w&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawDoubleBed=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==W?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==W?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==W&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawSingleBed=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==D?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==D?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==D&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawWardrobe=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==L?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==L?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==L&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawDresser=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==z?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==z?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==z&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawBedsideCupboard=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==M?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==M?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==M&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawPillow=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==R?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==R?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==R&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawGasStove=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==O?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==O?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==O&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawCupboard=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==A?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==A?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==A&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawBathtub=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==E?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==E?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==E&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawClosestool=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==B?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==B?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==B&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawWashstand=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==Y?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==Y?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==Y&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawDesk=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==N?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==N?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==N&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawBalconyChair=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==X?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==X?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==X&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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()},Mo.prototype.drawElevator=function(t,e){var o=Kt.getSelectItem(),n=Kt.getDraggingItem(),r=Kt.getFocusItem();this.context.save(),this.context.strokeStyle=bo.strokeStyle,this.context.fillStyle=bo.fillStyle,e?"style-1"==e?(this.context.lineWidth=Do.style1.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style1.Furniture.strokeStyle):"style-2"==e?(this.context.lineWidth=Do.style2.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style2.Furniture.strokeStyle):"style-3"==e?(this.context.lineWidth=Do.style3.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style3.Furniture.strokeStyle):"style-4"==e&&(this.context.lineWidth=Do.style4.Furniture.lineWidth*ie.ratio,this.context.strokeStyle=Do.style4.Furniture.strokeStyle):o&&o.type==j?t.vectorId==o.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):n&&n.type==j?t.vectorId==n.vectorId&&(this.context.strokeStyle=ko.Furniture.strokeStyle,this.context.fillStyle=ko.Furniture.fillStyle,this.drawRec(t)):r&&r.type==j&&t.vectorId==r.vectorId&&(this.context.strokeStyle=To.Furniture.strokeStyle,this.context.fillStyle=To.Furniture.fillStyle,this.drawRec(t));var s=ie.getScreenXY({x:t.center.x,y:t.center.y}),l=ie.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(l.x-s.x,l.y-s.y),this.context.scale(t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom,t.getScale()*t.zoom*ie.res/i.furnitureWidth*ie.ratio*ie.zoom/i.defaultZoom),this.context.lineWidth=1/(t.getScale()*t.zoom*ie.res*ie.zoom/i.defaultZoom/i.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 Ro=new Mo,Oo=function(){this.start=null,this.startCenter=null,this.dx=null,this.dy=null,this.reset=!1,this.screenPoints=null};Oo.prototype.setStart=function(t,e,o){if(null==this.start){this.start={x:t.x,y:t.y};var i=null;ut.isComponent(o)?i=re.getComponent(e):Gt.isFurniture(o)&&(i=re.getFurniture(e)),this.reset||(this.reset=!0,s.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},Oo.prototype.moveFull=function(t,e,o){var i=null,n=null,r=null;this.setAdsorbRec(),Re.hideSignLine1(),Re.hideSignLine2(),ut.isComponent(o)?(i=re.getComponent(e),r={x:this.startCenter.x+this.dx,y:this.startCenter.y+this.dy},n=ut.getBoundingVertexs(e,r)):Gt.isFurniture(o)&&(i=re.getFurniture(e),r={x:this.startCenter.x+this.dx,y:this.startCenter.y+this.dy},n=i.getBoundingVertexs(r),i.points2d=i.getBoundingVertexs(i.center));var l=this.getNearComponentsFurnitures(e,n);if(l.length>0&&(r=l[0].side?this.updateCenterForComponentFurniture2(l[0].vectorId,l[0].type,l[0].side,r):this.updateCenterForComponentFurniture(l[0].vectorId,l[0].type,l[0].sideIndex,l[0].selfSideIndex,r,n,l[0].distance),ut.isComponent(o)?n=ut.getBoundingVertexs(e,r):Gt.isFurniture(o)&&(n=i.getBoundingVertexs(r)),l.length>1&&(r=l[1].side?this.updateCenterForComponentFurniture2(l[1].vectorId,l[1].type,l[1].side,r):this.updateCenterForComponentFurniture(l[1].vectorId,l[1].type,l[1].sideIndex,l[1].selfSideIndex,r,n,l[1].distance))),l.length<2){var a=this.getNearWalls(n);a.length>0&&(r=this.updateCenterForWall(a[0].vectorId,a[0].selfSideIndex,r,n,a[0].distance),ut.isComponent(o)?n=ut.getBoundingVertexs(e,r):Gt.isFurniture(o)&&(n=i.getBoundingVertexs(r)),0==l.length&&a.length>1&&(r=this.updateCenterForWall(a[1].vectorId,a[1].selfSideIndex,r,n,a[1].distance)))}return r.x=s.getFixed(r.x),r.y=s.getFixed(r.y),s.clonePoint(i.center,r),ut.isComponent(o)&&i.setPoints2d(),null},Oo.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},Oo.prototype.getNearWalls=function(t){var e=[],o=s.createLine1(t[0],t[1]),n=s.createLine1(t[1],t[2]),r=s.createLine1(t[2],t[3]),l=s.createLine1(t[3],t[0]),a=re.getWalls(),c=null,u=null,d=null,y=null,x=null,p=null;for(var g in a){var f=a[g],m=null;m=f.out?mo.lineWidth_out/ie.res/2*i.defaultZoom/ie.zoom:mo.lineWidth/ie.res/2*i.defaultZoom/ie.zoom;var v=re.getPoint(f.start),S=re.getPoint(f.end),P=s.createLine1(v,S),I=null,b=null,k=null,T=null;if(this.isParallel(o,P)&&this.isCloseForTwoSegments(t[0],t[1],v,S)?(I=s.getDisForPoinLine(t[0],P),I-=m,b=[0,1],this.isAdsorb(I)||(I=null,b=null)):this.isParallel(n,P)&&this.isCloseForTwoSegments(t[1],t[2],v,S)&&(k=s.getDisForPoinLine(t[1],P),k-=m,T=[1,2],this.isAdsorb(k)||(k=null,T=null)),this.isParallel(r,P)&&this.isCloseForTwoSegments(t[2],t[3],v,S)){var F=s.getDisForPoinLine(t[2],P);F-=m,this.isAdsorb(F)&&(null==I||F<I)&&(I=F,b=[2,3])}else if(this.isParallel(l,P)&&this.isCloseForTwoSegments(t[3],t[0],v,S)){var C=s.getDisForPoinLine(t[3],P);C-=m,this.isAdsorb(C)&&(null==k||C<k)&&(k=C,T=[0,3])}null==I&&null==k||(null!=I?(null==c||c>I)&&(c=I,u=b,d=g):null!=k&&(null==y||y>k)&&(y=k,x=T,p=g))}return null!=c&&e.push({vectorId:d,type:h,distance:c,selfSideIndex:u}),null!=y&&e.push({vectorId:p,type:h,distance:y,selfSideIndex:x}),e},Oo.prototype.getNearComponentsFurnitures=function(t,e){var o=s.createLine1(e[0],e[1]),i=s.createLine1(e[1],e[2]),n=[],r=re.getComponents(),l=re.getFurnitures(),a=(e[0].x+e[1].x+e[2].x+e[3].x)/4,h=(e[0].y+e[1].y+e[2].y+e[3].y)/4,c=null,u=null,d=null,y=null,x=null,p=null,g=null,f=null,m=null,v=null,S=null,P=null,I=null,b=null,k=null,T=null;for(var F in r)if(F!=t){var C=r[F];if(this.isInScreen(C.center)){var w=s.createLine1(C.points2d[0],C.points2d[1]),W=s.createLine1(C.points2d[1],C.points2d[2]),D=s.createLine1(C.points2d[2],C.points2d[3]),L=s.createLine1(C.points2d[3],C.points2d[0]),z=null,M=null,R=null,O=null;if(this.isParallel(o,w)&&this.isCloseForTwoSegments(e[0],e[1],C.points2d[0],C.points2d[1])){z=s.getDisForPoinLine(e[0],w),M=s.getDisForPoinLine(e[0],D),R=s.getDisForPoinLine(e[3],w),O=s.getDisForPoinLine(e[3],D);var A=Math.min(z,M,R,O);this.isAdsorb(A)&&(null==y||y>A)&&(A==z?(c=F,x=C.geoType,u=[0,1],d=[0,1],y=A):A==M?(c=F,x=C.geoType,u=[2,3],d=[0,1],y=A):A==R?(c=F,x=C.geoType,u=[0,1],d=[2,3],y=A):A==O&&(c=F,x=C.geoType,u=[2,3],d=[2,3],y=A))}if(this.isParallel(i,W)&&this.isCloseForTwoSegments(e[1],e[2],C.points2d[1],C.points2d[2])){z=s.getDisForPoinLine(e[1],W),M=s.getDisForPoinLine(e[1],L),R=s.getDisForPoinLine(e[0],W),O=s.getDisForPoinLine(e[0],L);var E=Math.min(z,M,R,O);this.isAdsorb(E)&&(null==m||m>E)&&(E==z?(p=F,v=C.geoType,g=[1,2],f=[1,2],m=E):E==M?(p=F,v=C.geoType,g=[0,3],f=[1,2],m=E):E==R?(p=F,v=C.geoType,g=[1,2],f=[0,3],m=E):E==O&&(p=F,v=C.geoType,g=[0,3],f=[0,3],m=E))}this.isAdsorb(Math.abs(C.center.x-a))&&(null==P||P>Math.abs(C.center.x-a))&&(S=F,I=C.geoType,P=Math.abs(C.center.x-a)),this.isAdsorb(Math.abs(C.center.y-h))&&(null==k||k>Math.abs(C.center.y-h))&&(b=F,T=C.geoType,k=Math.abs(C.center.y-h))}}for(var B in l)if(B!=t){var Y=l[B];if(this.isInScreen(Y.center)){Y.points2d=Y.getBoundingVertexs(Y.center);var N=s.createLine1(Y.points2d[0],Y.points2d[1]),X=s.createLine1(Y.points2d[1],Y.points2d[2]),j=s.createLine1(Y.points2d[2],Y.points2d[3]),_=s.createLine1(Y.points2d[3],Y.points2d[0]),U=null,J=null,V=null,H=null;if(this.isParallel(o,N)&&this.isCloseForTwoSegments(e[0],e[1],Y.points2d[0],Y.points2d[1])){U=s.getDisForPoinLine(e[0],N),J=s.getDisForPoinLine(e[0],j),V=s.getDisForPoinLine(e[3],N),H=s.getDisForPoinLine(e[3],j);var Z=Math.min(U,J,V,H);this.isAdsorb(Z)&&(null==y||y>Z)&&(Z==U?(c=B,x=Y.geoType,u=[0,1],d=[0,1],y=Z):Z==J?(c=B,x=Y.geoType,u=[2,3],d=[0,1],y=Z):Z==V?(c=B,x=Y.geoType,u=[0,1],d=[2,3],y=Z):Z==H&&(c=B,x=Y.geoType,u=[2,3],d=[2,3],y=Z))}if(this.isParallel(i,X)&&this.isCloseForTwoSegments(e[1],e[2],Y.points2d[1],Y.points2d[2])){U=s.getDisForPoinLine(e[1],X),J=s.getDisForPoinLine(e[1],_),V=s.getDisForPoinLine(e[0],X),H=s.getDisForPoinLine(e[0],_);var G=Math.min(U,J,V,H);this.isAdsorb(G)&&(null==m||m>G)&&(G==U?(p=B,v=Y.geoType,g=[1,2],f=[1,2],m=G):G==J?(p=B,v=Y.geoType,g=[0,3],f=[1,2],m=G):G==V?(p=B,v=Y.geoType,g=[1,2],f=[0,3],m=G):G==H&&(p=B,v=Y.geoType,g=[0,3],f=[0,3],m=G))}this.isAdsorb(Math.abs(Y.center.x-a))&&(null==P||P>Math.abs(Y.center.x-a))&&(S=B,I=Y.geoType,P=Math.abs(Y.center.x-a)),this.isAdsorb(Math.abs(Y.center.y-h))&&(null==k||k>Math.abs(Y.center.y-h))&&(b=B,T=Y.geoType,k=Math.abs(Y.center.y-h))}}return null!=y&&(o.hasOwnProperty("x")&&null!=P?(y>=P&&(n.push({vectorId:S,type:I,distance:P,side:"x"}),y=null),P=null):o.hasOwnProperty("y")&&null!=k&&(y>=k&&(n.push({vectorId:b,type:T,distance:k,side:"y"}),y=null),k=null),null!=y&&n.push({vectorId:c,type:x,distance:y,sideIndex:u,selfSideIndex:d})),null!=m&&(i.hasOwnProperty("x")&&null!=P?(m>=P&&(n.push({vectorId:S,type:I,distance:P,side:"x"}),m=null),P=null):i.hasOwnProperty("y")&&null!=k&&(m>=k&&(n.push({vectorId:b,type:T,distance:k,side:"y"}),m=null),k=null),null!=m&&n.push({vectorId:p,type:v,distance:m,sideIndex:g,selfSideIndex:f})),0==n.length?(null!=P&&n.push({vectorId:S,type:I,distance:P,side:"x"}),null!=k&&n.push({vectorId:b,type:T,distance:k,side:"y"})):1==n.length&&(null!=P?n.push({vectorId:S,type:I,distance:P,side:"x"}):null!=k&&n.push({vectorId:b,type:T,distance:k,side:"y"})),n},Oo.prototype.isAdsorb=function(t){return t<i.minAdsorbRec/ie.res},Oo.prototype.showSignLine=function(t,e,o,i,n,r){var l={x:(i[n[0]].x+i[n[1]].x)/2,y:(i[n[0]].y+i[n[1]].y)/2};l=s.translate(l,t,l,e);var a=s.createLine3(o,l),h=ie.getXYFromScreen({x:0,y:0});null==(h=s.getIntersectionPoint(a,{x:h.x}))&&(h=ie.getXYFromScreen({x:0,y:0}),h=s.getIntersectionPoint(a,{y:h.y}));var c=ie.getXYFromScreen({x:ie.width,y:ie.height});null==(c=s.getIntersectionPoint(a,{x:c.x}))&&(c=ie.getXYFromScreen({x:ie.width,y:ie.height}),c=s.getIntersectionPoint(a,{y:c.y})),0==r?(Re.setSignLine1(h,c),Re.showSignLine1()):1==r&&(Re.setSignLine2(h,c),Re.showSignLine2())},Oo.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?(Re.setSignLine1(i,n),Re.showSignLine1()):"y"==o&&(Re.setSignLine2(i,n),Re.showSignLine2()))},Oo.prototype.updateCenterForWall=function(t,e,o,i,n){var r=re.getWall(t),l=this.getLineForWall(i,t,e),a=s.createLine3(l,o),h=st.getLine(r),c=s.getIntersectionPoint(a,h),u=s.translate({x:(i[e[0]].x+i[e[1]].x)/2,y:(i[e[0]].y+i[e[1]].y)/2},c,o,n),d=0;return(1==e[0]&&2==e[1]||0==e[0]&&3==e[1])&&(d=1),this.showSignLine(c,n,h,i,e,d),u},Oo.prototype.updateCenterForComponentFurniture=function(t,e,o,i,n,r,l){var a=null,h=null;ut.isComponent(e)?(a=re.getComponent(t),h=ut.getBoundingVertexs(t,a.center)):Gt.isFurniture(e)&&(h=(a=re.getFurniture(t)).getBoundingVertexs(a.center));var c=this.getLineForComponentFurniture(r,t,e,o,i),u=s.createLine3(c,n),d=s.createLine1(h[o[0]],h[o[1]]),y=s.getIntersectionPoint(u,d),x=s.translate({x:(r[i[0]].x+r[i[1]].x)/2,y:(r[i[0]].y+r[i[1]].y)/2},y,n,l),p=0;return(1==i[0]&&2==i[1]||0==i[0]&&3==i[1])&&(p=1),this.showSignLine(y,l,d,r,i,p),x},Oo.prototype.updateCenterForComponentFurniture2=function(t,e,o,i){var n=null;return ut.isComponent(e)?n=re.getComponent(t):Gt.isFurniture(e)&&(n=re.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},Oo.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=re.getWall(e),r=st.getLine(n);return s.getVerticalLine(r,i)},Oo.prototype.getLineForComponentFurniture=function(t,e,o,i,n){var r={x:(t[n[0]].x+t[n[1]].x)/2,y:(t[n[0]].y+t[n[1]].y)/2},l=null,a=null;ut.isComponent(o)?(l=re.getComponent(e),a=ut.getBoundingVertexs(e,l.center)):Gt.isFurniture(o)&&(a=(l=re.getFurniture(e)).getBoundingVertexs(l.center));var h=s.createLine1(a[i[0]],a[i[1]]);return s.getVerticalLine(h,r)},Oo.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},Oo.prototype.clear=function(){this.start=null,this.startCenter=null,this.dx=null,this.dy=null,this.reset=!1},Oo.prototype.isCloseForTwoSegments=function(t,e,o,i){var n=s.getDistance(t,e),r={x:(t.x+e.x)/2,y:(t.y+e.y)/2},l=s.getDistance(o,i),a={x:(o.x+i.x)/2,y:(o.y+i.y)/2},h=s.createLine1(t,e),c=s.getJoinLinePoint(a,h);return s.getDistance(r,c)<n/2+l/2+10/ie.res},Oo.prototype.setAdsorbRec=function(){var t={x:0,y:ie.height},e={x:ie.width,y:ie.height},o={x:ie.width,y:0};return this.screenPoints=[],this.screenPoints.push(ie.getXYFromScreen({x:0,y:0})),this.screenPoints.push(ie.getXYFromScreen(o)),this.screenPoints.push(ie.getXYFromScreen(e)),this.screenPoints.push(ie.getXYFromScreen(t)),this.screenPoints};var Ao=new Oo,Eo=function(){};Eo.prototype.moveFullTag=function(t,e){var o=re.getTag(e);s.clonePoint(o.center,t),o.setPoints2d()};var Bo=new Eo,Yo=function(){this.needUpdateRoom=!1,this.startMoving=!1,this.moveFlag=!1,this.adsorbPointWalls={},this.splitWallId=null};Yo.prototype.setStartMoving=function(t){this.startMoving=t},Yo.prototype.movePoint=function(t,e,o){var n=re.getPoint(t),r=null,l=null;null!=o&&(e={x:o.x,y:o.y},r=o.linkedPointId,l=o.linkedWallId),this.needUpdateRoom=!1,this.adsorbPointWalls={},this.splitWallId=null;var a=this.canMoveForPoint(t,e,r,l);if(!a){if(null==this.splitWallId&&Object.keys(this.adsorbPointWalls).length>0){var h=Object.keys(this.adsorbPointWalls)[0],c=re.getWall(this.adsorbPointWalls[h]).getOtherPointId(t),u=re.getPoint(c),d=re.getPoint(h),y=s.createLine1(u,d);e=s.getJoinLinePoint(e,y),n.setPosition(e)}return!1}var x=null;if(null==o){var p=st.getNeighPoints(t);if(1==p.length?x=Re.checkAngle(e,p[0].vectorId,t):2==p.length&&((x=Re.checkAngle(e,p[0].vectorId,t))||(x=Re.checkAngle(e,p[1].vectorId,t))),x){if(!(a=this.canMoveForPoint(t,x,r,l)))return!1;s.clonePoint(e,x)}n.setPosition(e)}else if(o.hasOwnProperty("linkedPointId")&&null!=o.linkedPointId){if(null!=st.getWallId(t,o.linkedPointId))return!1;n.setPosition(o),this.needUpdateRoom=!0}else if(o.hasOwnProperty("linkedWallId")){var g=re.getWall(o.linkedWallId),f=re.getPoint(g.start),m=re.getPoint(g.end);if(s.getDistance(f,e)<i.minRealDis||s.getDistance(m,e)<i.minRealDis)return!1;n.setPosition(o),this.needUpdateRoom=!0}else o.hasOwnProperty("linkedPointIdX")&&o.linkedPointIdX&&n.setPosition(e),o.hasOwnProperty("linkedPointIdY")&&o.linkedPointIdY&&n.setPosition(e);return ee.updateSymbolsPositionsForWallCorner(t),!0},Yo.prototype.moveWallPlane=function(t,e,o){var n=1,r=re.getWall(t),l=r.start,a=r.end,h=re.getPoint(r.start),c=re.getPoint(r.end),u=this.getNewPointsForMoveWall(t,e,o),d=s.createLine1(u.point1,u.point2),y=this.getTwoLimitInfos(t,d);this.needUpdateRoom=!1;var x=s.getIntersectionPoint(d,y.startLimitLine),p=s.getIntersectionPoint(d,y.endLimitLine);if(!this.startMoving&&(s.getDistance(h,x)<i.minRealDis||s.getDistance(c,p)<i.minRealDis))return this.moveFlag=!1,n=2;this.setStartMoving(!0);var g=this.updateVirtualPosition(r.start,x,y.startWallId,y.newStartWallId),f=this.updateVirtualPosition(r.end,p,y.endWallId,y.newEndWallId);if(null==g||null==f)return this.moveFlag=!1,n=2,this.setStartMoving(!1),n;var m=!1,v=null;if(g.adsorb&&!f.adsorb){if(d=s.createLine3(d,g.virtualPosition),!this.isOKForTwoSegmentsAngle(g.adsorbPointId,r.start,r.end))return this.moveFlag=!1,n=5;p=s.getIntersectionPoint(d,y.endLimitLine),null==(f=this.updateVirtualPosition(r.end,p,y.endWallId,y.newEndWallId))&&(f={adsorb:!1,adsorbPointId:null,virtualPosition:p}),m=this.isCoincideForAdsorbOne(r.start,g.adsorbPointId,t),v=s.getDistance(g.virtualPosition,p),n=4,this.needUpdateRoom=!0,this.setStartMoving(!1)}else if(!g.adsorb&&f.adsorb){if(d=s.createLine3(d,f.virtualPosition),!this.isOKForTwoSegmentsAngle(f.adsorbPointId,r.end,r.start))return this.moveFlag=!1,n=5;x=s.getIntersectionPoint(d,y.startLimitLine),null==(g=this.updateVirtualPosition(r.start,x,y.startWallId,y.newStartWallId))&&(g={adsorb:!1,adsorbPointId:null,virtualPosition:x}),m=this.isCoincideForAdsorbOne(r.end,f.adsorbPointId,t),v=s.getDistance(f.virtualPosition,x),n=4,this.needUpdateRoom=!0,this.setStartMoving(!1)}if(g&&f&&g.adsorb&&f.adsorb){if(m=this.isCoincideForAdsorbOne2(t,g.adsorbPointId,f.adsorbPointId),v=s.getDistance(g.virtualPosition,f.virtualPosition),this.setStartMoving(!1),m)return this.moveFlag=!1,n=5;n=4,this.needUpdateRoom=!0}else if((v=s.getDistance(x,p))<i.minRealDis)return this.deleteWallForLinked(t),h=re.getPoint(l),c=re.getPoint(a),h&&c?(Object.keys(h.parent).length>1&&1==Object.keys(c.parent).length||1==Object.keys(h.parent).length&&1==Object.keys(c.parent).length?st.moveTo(a,l):1==Object.keys(h.parent).length&&Object.keys(c.parent).length>1&&st.moveTo(l,a),this.moveFlag=!1,n=3,this.needUpdateRoom=!0,n):(this.moveFlag=!1,n=3,this.needUpdateRoom=!0,n);if(l=r.start,a=r.end,!this.isOKForCrossForMoveWall(x,p,t,l,a,g.adsorbPointId,f.adsorbPointId))return n=2,this.moveFlag=!1,this.setStartMoving(!1),n;if(m||null!=v&&v<i.minRealDis)return this.deleteWallForLinked(t),n=3,st.mergeWallForPoint(l),st.mergeWallForPoint(a),this.moveFlag=!1,this.needUpdateRoom=!0,n;var S=s.getIntersectionPoint3(h,x,c,p);if(null!=S)return h.setPosition(S),c.setPosition(S),st.moveTo(l,a),n=3,this.moveFlag=!1,this.needUpdateRoom=!0,n;var P=!1;if(!y.newStartWallId&&g.adsorbPointId?P=st.isOverlapForMergePoint(l,g.adsorbPointId):!y.newEndWallId&&f.adsorbPointId&&(P=st.isOverlapForMergePoint(a,f.adsorbPointId)),P)return this.moveFlag=!1,n=5;if(this.updatePointForMoveWall(t,l,g,y.startWallId,y.newStartWallId),this.updatePointForMoveWall(t,a,f,y.endWallId,y.newEndWallId),null==(r=re.getWall(t)))return n=3,this.moveFlag=!1,this.needUpdateRoom=!0,n;for(var I in ee.updateSymbolsPositionsForWall(t),h=re.getPoint(r.start),c=re.getPoint(r.end),h.parent)ee.updateSymbolsPositionsForNeighWall(I);for(var b in c.parent)ee.updateSymbolsPositionsForNeighWall(b);return this.moveFlag=1==n,n},Yo.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=re.getPoint(o);t.push({join:i,pointId:o}),e=this.adsorbPointWalls[o]}var n=re.getWall(e),r=re.getPoint(n.start);t=t.sort(function(t,e){return s.getDistance(r,t.join)-s.getDistance(r,e.join)}.bind(this));for(var l=0;l<t.length;++l){var a=t[l];a.join;var h=a.pointId;st.splitWall(e,h,"end")}}},Yo.prototype.getNewPointsForMoveWall=function(t,e,o){e/=ie.res,o=-o/ie.res;var i=re.getWall(t),n=re.getPoint(i.start),r=re.getPoint(i.end);return{point1:{x:n.x+e,y:n.y+o},point2:{x:r.x+e,y:r.y+o}}},Yo.prototype.getTwoLimitInfos=function(t,e){var o,n,r,l=re.getWall(t),a=re.getPoint(l.start),h=re.getPoint(l.end),c=s.createLine1(a,h),u={newStartWallId:!1,newEndWallId:!1};if(1==Object.keys(a.parent).length)o=s.getVerticalLine(c,a),u.startWallId=null;else if(2==Object.keys(a.parent).length){var d;Object.keys(a.parent)[0]==t?d=re.getWall(Object.keys(a.parent)[1]):Object.keys(a.parent)[1]==t&&(d=re.getWall(Object.keys(a.parent)[0])),d||console.error(352);var y=st.AngleForWall(d.vectorId,t);o=st.getLine(d),u.startWallId=d.vectorId,y>i.maxAngle/180*Math.PI&&(o=s.getVerticalLine(c,a),u.startWallId=null,u.newStartWallId=!0)}else{var x,p;r=st.wallIdForMinAngle(l.start,t);var g=re.getWall(r.min0.wallId),f=re.getPoint(g.start),m=re.getPoint(g.end),v=re.getWall(r.min1.wallId),S=re.getPoint(v.start),P=re.getPoint(v.end),I=s.getIntersectionPoint4(f,m,e),b=s.getIntersectionPoint4(S,P,e);if(null==I&&null==b){var k=st.AngleForWall(t,r.min0.wallId),T=st.AngleForWall(t,r.min1.wallId);k>Math.PI&&(k=Math.PI-k),T>Math.PI&&(T=Math.PI-T),p=k<T?r.min0.wallId:r.min1.wallId,u.newStartWallId=!0}else null!=I&&null!=b?p=r.min0.angle<r.min1.angle?r.min0.wallId:r.min1.wallId:null==I&&null!=b?p=r.min1.wallId:null!=I&&null==b&&(p=r.min0.wallId);u.startWallId=p,x=re.getWall(p);var F=st.AngleForWall(p,t);o=st.getLine(x);var C=s.getIntersectionPoint(o,e),w=re.getPoint(x.start),W=re.getPoint(x.end);(F>i.maxAngle/180*Math.PI||!s.isPointOnSegment(C,w,W))&&(o=s.getVerticalLine(c,a),u.startWallId=null,u.newStartWallId=!0)}if(1==Object.keys(h.parent).length)n=s.getVerticalLine(c,h),u.endWallId=null;else if(2==Object.keys(h.parent).length){var D;Object.keys(h.parent)[0]==t?D=re.getWall(Object.keys(h.parent)[1]):Object.keys(h.parent)[1]==t&&(D=re.getWall(Object.keys(h.parent)[0]));var L=st.AngleForWall(D.vectorId,t);n=st.getLine(D),u.endWallId=D.vectorId,L>i.maxAngle/180*Math.PI&&(n=s.getVerticalLine(c,h),u.endWallId=null,u.newEndWallId=!0)}else{var z,M;r=st.wallIdForMinAngle(l.end,t);var R=re.getWall(r.min0.wallId),O=re.getPoint(R.start),A=re.getPoint(R.end),E=re.getWall(r.min1.wallId),B=re.getPoint(E.start),Y=re.getPoint(E.end),N=s.getIntersectionPoint4(O,A,e),X=s.getIntersectionPoint4(B,Y,e);if(null==N&&null==X){var j=st.AngleForWall(t,r.min0.wallId),_=st.AngleForWall(t,r.min1.wallId);j>Math.PI&&(j=Math.PI-j),_>Math.PI&&(_=Math.PI-_),M=j<_?r.min0.wallId:r.min1.wallId,u.newEndWallId=!0}else null!=N&&null!=X?M=r.min0.angle<r.min1.angle?r.min0.wallId:r.min1.wallId:null==N&&null!=X?M=r.min1.wallId:null!=N&&null==X&&(M=r.min0.wallId);u.endWallId=M,z=re.getWall(M);var U=st.AngleForWall(M,t);n=st.getLine(z);var J=s.getIntersectionPoint(n,e),V=re.getPoint(z.start),H=re.getPoint(z.end);(U>i.maxAngle/180*Math.PI||!s.isPointOnSegment(J,V,H))&&(n=s.getVerticalLine(c,h),u.endWallId=null,u.newEndWallId=!0)}return u.startLimitLine=o,u.endLimitLine=n,u},Yo.prototype.canMoveForPoint=function(t,e,o,i){var n=re.getPoint(t),r=this.isOKForMinAngleWall(t,e);return r&&(r=this.isOKForCross(t,e,n.parent,o,i)),r},Yo.prototype.isOKForMinAngleWall=function(t,e){var o=re.getPoint(t).parent,n=this.getMinAngle(t,e);if(Math.abs(n)<i.minAngle/180*Math.PI)return!1;for(var r in o){var l=re.getWall(r).getOtherPointId(t),a=this.getNeighMinAngle(l,r,e);if(a&&Math.abs(a.angle)<i.minAngle/180*Math.PI)return!1;var h=re.getPoint(l);if(s.getDistance(e,h)<i.minRealDis)return!1}return!0},Yo.prototype.getMinAngle=function(t,e){var o=re.getPoint(t).parent;if(1==Object.keys(o).length)return 2*Math.PI;if(2==Object.keys(o).length){var i=re.getWall(Object.keys(o)[0]),n=re.getWall(Object.keys(o)[1]),r=i.getOtherPointId(t),l=re.getPoint(r),a=n.getOtherPointId(t),h=re.getPoint(a);return s.Angle(e,l,h)}var c={x:e.x+1,y:e.y},u=[];for(var d in o){var y=re.getWall(d).getOtherPointId(t),x=re.getPoint(y);if(s.equalPoint(c,x))u.push(0);else{var p=s.Angle(e,c,x);x.y<e.y&&(p=2*Math.PI-p),u.push(p)}}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 I=2*Math.PI+S-P;I<g&&(g=I)}return g},Yo.prototype.getNeighMinAngle=function(t,e,o){var i=re.getPoint(t),n={x:o.x,y:o.y},r=null,l=null,a=null,h=null;for(var c in i.parent)if(c!=e){r=re.getWall(c).getOtherPointId(t),l=re.getPoint(r);var u=s.Angle(i,n,l);(null==a||a>u)&&(h={angle:a=u,pointId:r})}return h},Yo.prototype.isOKForCross=function(t,e,o,i,n){var r=re.getWalls();for(var s in r)if(!o.hasOwnProperty(s)&&n!=s)for(var l in o)if(!st.isWallLink(s,l)){var a=re.getWall(l),h=a.getOtherPointId(t),c=re.getPoint(h);if(!this.isOKForCrossTwoWall(e,c,s,i,n,a.vectorId))return this.adsorbPointWalls={},!1}return!(Object.keys(this.adsorbPointWalls).length>0)&&null==this.splitWallId},Yo.prototype.isOKForCrossTwoWall=function(t,e,o,n,r,l){var a=re.getWall(o),h=re.getPoint(a.start),c=re.getPoint(a.end);if(s.getIntersectionPoint3(t,e,h,c)&&a.start!=n&&a.end!=n)return this.splitWallId=o,!0;if(s.equalPoint(t,e))return!0;var u=s.createLine1(t,e),d=s.getJoinLinePoint(h,u),y=s.getJoinLinePoint(c,u);if(s.getDistance(d,h)<i.minRealDis&&s.PointInSegment(d,t,e)){if(a.start!=n)return this.adsorbPointWalls[h.vectorId]=l,!0}else if(s.getDistance(y,c)<i.minRealDis&&s.PointInSegment(y,t,e)&&a.end!=n)return this.adsorbPointWalls[c.vectorId]=l,!0;if(u=s.createLine1(h,c),d=s.getJoinLinePoint(t,u),y=s.getJoinLinePoint(e,u),s.getDistance(d,t)<i.minRealDis&&s.PointInSegment(d,h,c)){if(a.start!=n&&a.end!=n&&o!=r)return!0}else if(s.getDistance(y,e)<i.minRealDis&&s.PointInSegment(y,h,c)&&a.start!=n&&a.end!=n&&o!=r)return!0;return!0},Yo.prototype.isOKForCrossTwoWall2=function(t,e,o){var i=re.getWall(o),n=re.getPoint(i.start),r=re.getPoint(i.end),l=s.crossTwoLines(t,e,n,r,.01);return!l&&(!!s.equalPoint(t,e)||!!(l=this.isCoincide(t,e,o)))},Yo.prototype.isOKForCrossTwoWall3=function(t,e,o){var n=re.getWall(o),r=re.getPoint(n.start),l=re.getPoint(n.end);if(s.crossTwoLines(t,e,r,l,.01))return!1;if(s.equalPoint(t,e))return!0;var a=s.createLine1(t,e),h=s.getJoinLinePoint(r,a),c=s.getJoinLinePoint(l,a);return!(s.getDistance(h,r)<i.minRealDis&&s.isPointOnSegment(h,t,e))&&(!(s.getDistance(c,l)<i.minRealDis&&s.isPointOnSegment(c,t,e))&&(a=s.createLine1(r,l),h=s.getJoinLinePoint(t,a),!(s.getDistance(h,t)<i.minRealDis&&st.isContain(n,h))))},Yo.prototype.isCoincide=function(t,e,o){var n=re.getWall(o),r=re.getPoint(n.start),l=re.getPoint(n.end),a=s.createLine1(t,e),h=s.getJoinLinePoint(r,a),c=s.getJoinLinePoint(l,a);return!(s.getDistance(h,r)<i.minRealDis&&s.PointInSegment(h,t,e))&&(!(s.getDistance(c,l)<i.minRealDis&&s.PointInSegment(c,t,e))&&(a=s.createLine1(r,l),h=s.getJoinLinePoint(t,a),c=s.getJoinLinePoint(e,a),!(s.getDistance(h,t)<i.minRealDis&&st.isContain(n,h))&&!(s.getDistance(c,e)<i.minRealDis&&st.isContain(n,c))))},Yo.prototype.updateVirtualPosition=function(t,e,o,n){var r,l,a=re.getWall(o),h=re.getPoint(t),c=!1;if(n){if(s.getDistance(h,e)<i.minRealDis)return null}else null!=a&&(r=a.getOtherPointId(t),l=re.getPoint(r),(s.getDistance(e,l)<i.minRealDis||!st.isContain(a,e)&&s.getDistance(e,l)<s.getDistance(e,h))&&(s.clonePoint(e,l),c=!0));return{adsorb:c,adsorbPointId:c?r:null,virtualPosition:e}},Yo.prototype.isOKForTwoSegmentsAngle=function(t,e,o){var n=re.getPoint(t),r=re.getPoint(e),l=re.getPoint(o),a=n.x-r.x,h=n.y-r.y,c={x:a+l.x,y:h+l.y};for(var u in n.parent){var d=re.getWall(u).getOtherPointId(t),y=re.getPoint(d),x=s.Angle(n,y,c);if(Math.abs(x)<i.minAngle/180*Math.PI)return!1}return!0},Yo.prototype.isCoincideForAdsorbOne=function(t,e,o){if(t&&e){var i=re.getWall(o).getOtherPointId(t);if(null!=st.getWallId(i,e))return!0}return!1},Yo.prototype.isCoincideForAdsorbOne2=function(t,e,o){if(e&&o){if(null!=st.getWallId(e,o))return!0;var n=re.getPoint(e),r=n.parent;for(var s in r){var l=st.AngleForWall3(t,s);if(Math.abs(l)<i.minAngle/180*Math.PI)return!0}for(var a in r=(n=re.getPoint(o)).parent){var h=st.AngleForWall3(t,a);if(Math.abs(h)<i.minAngle/180*Math.PI)return!0}}return!1},Yo.prototype.isOKForCrossForMoveWall=function(t,e,o,i,n,r,s){var l=re.getPoint(i),a=re.getPoint(n),h=!0,c=re.getWalls();for(var u in c)if(u!=o){var d=!0,y=!0,x=re.getWall(u);if(!r||r!=x.start&&r!=x.end||(d=!1),!s||s!=x.start&&s!=x.end||(y=!1),x.start!=i&&x.end!=i||(d=!1),x.start!=n&&x.end!=n||(y=!1),d&&y&&(h=this.isOKForCrossTwoWall2(t,e,u)),!h)return!1;if(d&&x.start!=i&&x.end!=i&&(h=this.isOKForCrossTwoWall3(t,l,u)),!h)return!1;if(y&&x.start!=n&&x.end!=n&&(h=this.isOKForCrossTwoWall3(e,a,u)),!h)return!1}return h},Yo.prototype.updatePointForMoveWall=function(t,e,o,n,r){var s=re.getPoint(e),l=re.getWall(t);if(null==n)r?(this.createWallForMoveWall(e,t,o.virtualPosition),this.needUpdateRoom=!0):s.setPosition(o.virtualPosition);else if(r)this.createWallForMoveWall(e,t,o.virtualPosition),this.needUpdateRoom=!0;else if(o.adsorb)st.moveTo(e,o.adsorbPointId),this.needUpdateRoom=!0;else if(2==Object.keys(s.parent).length)s.setPosition(o.virtualPosition);else{var a=st.wallIdForMinAngle(e,t),h=st.AngleForWall(a.min0.wallId,a.min1.wallId);if(3==Object.keys(s.parent).length&&h>i.maxAngle/180*Math.PI)s.setPosition(o.virtualPosition);else{var c=st.getDirction(e,t);st.subtraWallFromIntersect(e,t);var u=l.getPointId(c);re.getPoint(u).setPosition(o.virtualPosition),st.splitWall(n,u,c),this.needUpdateRoom=!0}}},Yo.prototype.createWallForMoveWall=function(t,e,o){var i=re.getWall(e),n=st.getDirction(t,e);st.subtraWallFromIntersect(t,e);var r=i.getPointId(n);re.getPoint(r).setPosition(o),st.createWall(t,r)},Yo.prototype.deleteWallForLinked=function(t){var e=re.getWall(t);st.subtraWallFromIntersect(e.start,t),st.subtraWallFromIntersect(e.end,t),re.deleteWall(t)};var No=new Yo,Xo=function(t){this.layer=t,this.displayPanos=!1};Xo.prototype.drawGeometry=function(t,e,o){if(null!=Ro.context){switch(t.geoType){case h:return void Ro.drawWall(t,e);case l:return void Ro.drawPoint(t);case c:return void Ro.drawSingleDoor(t,e,o);case u:return void Ro.drawDoubleDoor(t,e,o);case d:return void Ro.drawSlideDoor(t,e,o);case y:return void Ro.drawSingleWindow(t,e);case p:return void Ro.drawFrenchWindow(t,e);case x:return void Ro.drawBayWindow(t,e);case g:return void Ro.drawPass(t,e);case f:return void Ro.drawBeam(t,e);case m:return void Ro.drawFlue(t,e);case v:return void Ro.drawCorridor(t,e);case P:return void Ro.drawTag(t,e,o)}Gt.isFurniture(t.geoType)&&Ro.drawFurniture(t,e)}},Xo.prototype.drawElement=function(t){if(null!=Ro.context)switch(t.geoType){case l:Ro.drawCircle(t);break;case S:Ro.drawLine(t)}},Xo.prototype.drawPanos=function(t){for(var e=0;e<t.length;++e)Ro.drawCircle(t[e])},Xo.prototype.redrawElements=function(){Re.vCheckLines.X&&Re.vCheckLines.X.display&&this.drawElement(Re.vCheckLines.X),Re.vCheckLines.Y&&Re.vCheckLines.Y.display&&this.drawElement(Re.vCheckLines.Y),Re.startAddWall&&Re.startAddWall.display&&this.drawElement(Re.startAddWall),Re.newWall&&Re.newWall.display&&this.drawElement(Re.newWall),Re.symbolPoints.Start&&Re.symbolPoints.Start.display&&this.drawElement(Re.symbolPoints.Start),Re.symbolPoints.End&&Re.symbolPoints.End.display&&this.drawElement(Re.symbolPoints.End),Re.checkLines.X&&Re.checkLines.X.display&&this.drawElement(Re.checkLines.X),Re.checkLines.Y&&Re.checkLines.Y.display&&this.drawElement(Re.checkLines.Y),Re.signLine1&&Re.signLine1.display&&this.drawElement(Re.signLine1),Re.signLine2&&Re.signLine2.display&&this.drawElement(Re.signLine2)},Xo.prototype.redrawMeasures=function(t,e){Ro.drawMeasure(ae.measureLines.top,"top",t,e),Ro.drawMeasure(ae.measureLines.bottom,"bottom",t,e),Ro.drawMeasure(ae.measureLines.left,"left",t,e),Ro.drawMeasure(ae.measureLines.right,"right",t,e)},Xo.prototype.redrawRooms=function(t,e){for(var o=io.getRooms(t),i=0;i<o.length;++i){for(var n=null,r=0;r<this.layer.app.CadManager.labels.length;++r)if(null!=o[i].tagName&&o[i].tagName.trim()==this.layer.app.CadManager.labels[r].text){"hall"==this.layer.app.CadManager.labels[r].type?(n=io.getHallImg(),Ro.drawRoomBackGround(o[i],n)):"room"==this.layer.app.CadManager.labels[r].type?(n=io.getDefaultImg(),Ro.drawRoomBackGround(o[i],n)):"other"==this.layer.app.CadManager.labels[r].type&&(n="style-1"==e?io.getOtherWhiteImg():io.getOtherBlackImg(),Ro.drawRoomBackGround(o[i],n));break}null==n&&(n="style-1"==e?io.getOtherWhiteImg():io.getOtherBlackImg(),Ro.drawRoomBackGround(o[i],n))}},Xo.prototype.autoRedraw=function(){Ro.clear(),this.displayPanos&&this.drawPanos(o.panos);var t=re.getFloorData();if(t){var e=t.walls;for(var i in e)this.drawGeometry(e[i]);var n=t.points;for(var r in n)this.drawGeometry(n[r]);Ro.drawSpecialPoint();var s=t.symbols;for(var l in s)this.drawGeometry(s[l]),Ro.drawSymbolPoint(s[l]);Ro.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()}},Xo.prototype.autoRedrawForImg=function(){Ro.clear();var t=re.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 r=t.components;for(var s in r)this.drawGeometry(r[s]);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)}},Xo.prototype.autoRedrawForDownLoadImg=function(t){Ro.clear(),"style-1"==t?(Ro.drawBackGround("#FFFFFF"),this.redrawRooms(re.getCurrentFloor(),t)):"style-2"==t?(Ro.drawBackGround("#000000"),this.redrawRooms(re.getCurrentFloor(),t)):"style-3"==t?Ro.drawBackGround("#FFFFFF"):"style-4"==t&&Ro.drawBackGround("#000000");var e=re.getFloorData();if(e){var o=e.walls;for(var i in o)this.drawGeometry(o[i],t);var n=e.symbols;for(var r in n)this.drawGeometry(n[r],t,false);var s=e.components;for(var l in s)this.drawGeometry(s[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),Ro.drawCompass(t)}},Xo.prototype.redrawCore=function(){console.log("重绘!"),Ro.clear();var t=re.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 r=t.symbols;for(var s in r)this.drawGeometry(r[s]);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])}},Xo.prototype.clear=function(){Ro.clear()},Xo.prototype.getContext=function(){return Ro.context};var jo=function(){};jo.prototype.isDifferentForWalls=function(t,e){return t.start!=e.start||t.end!=e.end||t.out!=e.out||t.important!=e.important},jo.prototype.isDifferentForSymbols=function(t,e){return!s.equalPoint(t.startPoint,e.startPoint)||!s.equalPoint(t.endPoint,e.endPoint)||t.openSide!=e.openSide||t.parent!=e.parent||t.enter!=e.enter},jo.prototype.isDifferentForComponents=function(t,e){return JSON.stringify(t.points2d)!=JSON.stringify(e.points)||t.angle!=e.angle},jo.prototype.isDifferentForTags=function(t,e){return!s.equalPoint(t.center,e.center)||t.title!=e.title||t.des!=e.des||t.unit!=e.unit},jo.prototype.isDifferentForFurnitures=function(t,e){return t.zoom!=e.zoom||JSON.stringify(t.center)!=JSON.stringify(e.center)||t.angle!=e.angle},jo.prototype.isDifferentForAngle=function(t,e){return t!=e},jo.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,st.setWallInfo(o)},jo.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)),st.setPointInfo(o)},jo.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,ee.setSymbolInfo(o)},jo.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)),ut.setComponentInfo(o)},jo.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,ge.setTagInfo(o)},jo.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,Gt.setFurnitureInfo(o)},jo.prototype.deletePoint=function(t){var e=re.getPoint(t).parent;for(var o in e)re.deletePoint(t,o)},jo.prototype.getDataForPoint=function(t){var e={};return e.id=t.vectorId,s.clonePoint(e,t),e.parent=JSON.parse(JSON.stringify(t.parent)),e.type=t.geoType,e},jo.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},jo.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},jo.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},jo.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},jo.prototype.getDataForTag=function(t){var e={};return e.id=t.vectorId,e.type=t.geoType,e.center={},s.clonePoint(e.center,t.center),e.points=[].concat(t.points2d),e.title=t.title,e.des=t.des,e.unit=t.unit,e},jo.prototype.getDataForAngle=function(t){return t},jo.prototype.getDataForRes=function(t){return t};var _o=new jo,Uo="addPoint",Jo="deletePoint",Vo="modifyPoint",Ho="addWall",Zo="deleteWall",Go="modifyWall",$o="addSymbol",Ko="deleteSymbol",qo="modifySymbol",Qo="addComponent",ti="deleteComponent",ei="modifyComponent",oi="addTag",ii="deleteTag",ni="modifyTag",ri="addFurniture",si="deleteFurniture",li="modifyFurniture",ai="modifyAngle",hi=function(){this.lastData={},this.elements={}};hi.prototype.saveCurrentInfo=function(){this.lastData.currentFloor=re.getCurrentFloor(),this.lastData.points=JSON.parse(JSON.stringify(re.getPoints())),this.lastData.walls=JSON.parse(JSON.stringify(re.getWalls())),this.lastData.symbols=JSON.parse(JSON.stringify(re.getSymbols())),this.lastData.components=JSON.parse(JSON.stringify(re.getComponents())),this.lastData.furnitures=JSON.parse(JSON.stringify(re.getFurnitures())),this.lastData.tags=JSON.parse(JSON.stringify(re.getTags())),this.lastData.angle=re.getAngle(),this.lastData.res=ie.res},hi.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))},hi.prototype.comparePoints=function(){var t=re.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:Vo,prePoint:_o.getDataForPoint(i),curPoint:_o.getDataForPoint(o)};this.elements.points.push(n)}else{var r={handle:Uo,point:_o.getDataForPoint(o)};this.elements.points.push(r)}delete this.lastData.points[e]}for(var s in this.lastData.points){var l={handle:Jo,point:_o.getDataForPoint(this.lastData.points[s])};this.elements.points.push(l)}},hi.prototype.compareWalls=function(){this.elements.walls=[];var t=re.getWalls();for(var e in t){var o=t[e],i=this.lastData.walls[e];if(i){if(!_o.isDifferentForWalls(o,i)){delete this.lastData.walls[e];continue}var n={handle:Go,preWall:_o.getDataForWall(i),curWall:_o.getDataForWall(o)};this.elements.walls.push(n)}else{var r={handle:Ho,wall:_o.getDataForWall(o)};this.elements.walls.push(r)}delete this.lastData.walls[e]}for(var s in this.lastData.walls){var l={handle:Zo,wall:_o.getDataForWall(this.lastData.walls[s])};this.elements.walls.push(l)}},hi.prototype.compareSymbols=function(){this.elements.symbols=[];var t=re.getSymbols();for(var e in t){var o=t[e],i=this.lastData.symbols[e];if(i){if(!_o.isDifferentForSymbols(o,i)){delete this.lastData.symbols[e];continue}var n={handle:qo,preSymbol:_o.getDataForSymbol(i),curSymbol:_o.getDataForSymbol(o)};this.elements.symbols.push(n)}else{var r={handle:$o,symbol:_o.getDataForSymbol(o)};this.elements.symbols.push(r)}delete this.lastData.symbols[e]}for(var s in this.lastData.symbols){var l={handle:Ko,symbol:_o.getDataForSymbol(this.lastData.symbols[s])};this.elements.symbols.push(l)}},hi.prototype.compareComponents=function(){this.elements.components=[];var t=re.getComponents();for(var e in t){var o=t[e],i=this.lastData.components[e];if(i){if(!_o.isDifferentForComponents(o,i)){delete this.lastData.components[e];continue}var n={handle:ei,preComponent:_o.getDataForComponent(i),curComponent:_o.getDataForComponent(o)};this.elements.components.push(n)}else{var r={handle:Qo,component:_o.getDataForComponent(o)};this.elements.components.push(r)}delete this.lastData.components[e]}for(var s in this.lastData.components){var l={handle:ti,component:_o.getDataForComponent(this.lastData.components[s])};this.elements.components.push(l)}},hi.prototype.compareTags=function(){this.elements.tags=[];var t=re.getTags();for(var e in t){var o=t[e],i=this.lastData.tags[e];if(i){if(!_o.isDifferentForTags(o,i)){delete this.lastData.tags[e];continue}var n={handle:ni,preTag:_o.getDataForTag(i),curTag:_o.getDataForTag(o)};this.elements.tags.push(n)}else{var r={handle:oi,tag:_o.getDataForTag(o)};this.elements.tags.push(r)}delete this.lastData.tags[e]}for(var s in this.lastData.tags){var l={handle:ii,tag:_o.getDataForTag(this.lastData.tags[s])};this.elements.tags.push(l)}},hi.prototype.compareFurnitures=function(){this.elements.furnitures=[];var t=re.getFurnitures();for(var e in t){var o=t[e],i=this.lastData.furnitures[e];if(i){if(!_o.isDifferentForFurnitures(o,i)){delete this.lastData.furnitures[e];continue}var n={handle:li,preFurniture:_o.getDataForFurniture(i),curFurniture:_o.getDataForFurniture(o)};this.elements.furnitures.push(n)}else{var r={handle:ri,furniture:_o.getDataForFurniture(o)};this.elements.furnitures.push(r)}delete this.lastData.furnitures[e]}for(var s in this.lastData.furnitures){var l={handle:si,furniture:_o.getDataForFurniture(this.lastData.furnitures[s])};this.elements.furnitures.push(l)}},hi.prototype.compareAngle=function(){var t=re.getAngle(),e=this.lastData.angle,o=this.lastData.res;if(_o.isDifferentForAngle(t,e)){var i={handle:ai,preState:{angle:_o.getDataForAngle(e),res:_o.getDataForRes(o)},curState:{angle:_o.getDataForAngle(t),res:_o.getDataForRes(ie.res)}};return this.elements.rotate=i,!0}return!1};var ci=new hi,ui=function(t){this.layer=t};ui.prototype.init=function(){ci.saveCurrentInfo();var t=re.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)},ui.prototype.save=function(){if(ci.operate()){ae.update(!1),Ae.addHistoryRecord(ci.elements),ci.saveCurrentInfo(),this.setState(),Ae.getHistoryState().pre&&(this.layer.$xui.toolbar.recall=!0),this.layer.$xui.toolbar.recover=!1;var t=re.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"),ci.elements}},ui.prototype.setState=function(){var t={pre:0,next:0},e=Ae.getCurrentRecordIndex(),o=Ae.getHistoryRecords();e>-1&&(t.pre=1),e<o.length-1&&(t.next=1);var i=Ae.getHistoryState();i.pre==t.pre&&i.next==t.next||Ae.setHistoryState(t.pre,t.next)},ui.prototype.canUndo=function(){return 0!=this.setState().pre},ui.prototype.canRedo=function(){return 0!=this.setState().next},ui.prototype.handleUndo=function(){this.goPreState()},ui.prototype.handleRedo=function(){this.goNextState()},ui.prototype.goPreState=function(){var t=Ae.getHistoryRecord();if(t){Kt.clearFocusItem(),Kt.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)),ae.update(!1),Ae.undoHistoryRecord(),ci.saveCurrentInfo(),this.setState();var e=re.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超出范围!")},ui.prototype.goPreForPoints=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==Uo)_o.deletePoint(o.point.id);else if(o.handle==Jo){st.createPoint(o.point.x,o.point.y,o.point.id).parent=JSON.parse(JSON.stringify(o.point.parent))}else if(o.handle==Vo){var i=o.prePoint,n=re.getPoint(o.curPoint.id);_o.assignPointFromPoint(n,i)}}},ui.prototype.goPreForWalls=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==Ho)re.deleteWallNoSymbol(o.wall.id);else if(o.handle==Zo){var i=o.wall,n=st.createWall(i.start,i.end,i.id);_o.assignWallFromWall(n,i)}else if(o.handle==Go){var r=o.preWall,s=re.getWall(o.curWall.id);_o.assignWallFromWall(s,r)}}},ui.prototype.goPreForSymbols=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==$o)ee.deleteSymbol(o.symbol.id);else if(o.handle==Ko){var i=ee.createSymbol(o.symbol.start,o.symbol.end,o.symbol.type,o.symbol.parent,o.symbol.id);_o.assignSymbolFromSymbol(i,o.symbol)}else if(o.handle==qo){var n=o.preSymbol,r=re.getSymbol(o.curSymbol.id);_o.assignSymbolFromSymbol(r,n)}}},ui.prototype.goPreForComponents=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==Qo)re.deleteComponent(o.component.id);else if(o.handle==ti){var i=ut.createComponent(o.component.center,o.component.type,o.component.id);_o.assignComponentFromComponent(i,o.component)}else if(o.handle==ei){var n=o.preComponent,r=re.getComponent(o.curComponent.id);_o.assignComponentFromComponent(r,n)}}},ui.prototype.goPreForFurnitures=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==ri)re.deleteFurniture(o.furniture.id);else if(o.handle==si){var i=Gt.createFurniture(o.furniture.center,o.furniture.type,o.furniture.id);_o.assignFurnitureFromFurniture(i,o.furniture)}else if(o.handle==li){var n=o.preFurniture,r=re.getFurniture(o.curFurniture.id);_o.assignFurnitureFromFurniture(r,n)}}},ui.prototype.goPreForTags=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==oi)ge.deleteTag(o.tag.id);else if(o.handle==ii){var i=ge.createTag(o.tag.center,o.tag.id);_o.assignTagFromTag(i,o.tag)}else if(o.handle==ni){var n=o.preTag,r=re.getTag(o.curTag.id);_o.assignTagFromTag(r,n)}}},ui.prototype.goPreForAngle=function(t){if(t.handle==ai){ie.reSet(),ie._setRes(t.preState.res),re.setAngle(t.preState.angle),ie.updateForRotate(t.preState.angle-t.curState.angle);var e=ie.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(re.getCurrentFloor()),!0}return!1},ui.prototype.goNextForPoints=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==Uo){var i=st.createPoint(o.point.x,o.point.y,o.point.id);_o.assignPointFromPoint(i,o.point)}else if(o.handle==Jo)_o.deletePoint(o.point.id);else if(o.handle==Vo){var n=o.curPoint,r=re.getPoint(o.curPoint.id);_o.assignPointFromPoint(r,n)}}},ui.prototype.goNextForWalls=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==Ho){var i=o.wall,n=st.createWall(i.start,i.end,i.id);_o.assignWallFromWall(n,i)}else if(o.handle==Zo)re.deleteWallNoSymbol(o.wall.id);else if(o.handle==Go){var r=o.curWall,s=re.getWall(o.preWall.id);_o.assignWallFromWall(s,r)}}},ui.prototype.goNextForSymbols=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==$o){var i=ee.createSymbol(o.symbol.start,o.symbol.end,o.symbol.type,o.symbol.parent,o.symbol.id);_o.assignSymbolFromSymbol(i,o.symbol)}else if(o.handle==Ko)ee.deleteSymbol(o.symbol.id);else if(o.handle==qo){var n=o.curSymbol,r=re.getSymbol(o.curSymbol.id);_o.assignSymbolFromSymbol(r,n)}}},ui.prototype.goNextForComponents=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==Qo){var i=ut.createComponent(o.component.center,o.component.type,o.component.id);_o.assignComponentFromComponent(i,o.component)}else if(o.handle==ti)re.deleteComponent(o.component.id);else if(o.handle==ei){var n=o.curComponent,r=re.getComponent(o.curComponent.id);_o.assignComponentFromComponent(r,n)}}},ui.prototype.goNextForTags=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==oi){var i=ge.createTag(o.tag.center,o.tag.id);_o.assignTagFromTag(i,o.tag)}else if(o.handle==ii)re.deleteTag(o.tag.id);else if(o.handle==ni){var n=o.curTag,r=re.getTag(o.curTag.id);_o.assignTagFromTag(r,n)}}},ui.prototype.goNextForFurnitures=function(t){for(var e=0;e<t.length;++e){var o=t[e];if(o.handle==ri){var i=Gt.createFurniture(o.furniture.center,o.furniture.type,o.furniture.id);_o.assignFurnitureFromFurniture(i,o.furniture)}else if(o.handle==si)re.deleteFurniture(o.furniture.id);else if(o.handle==li){var n=o.curFurniture,r=re.getFurniture(o.curFurniture.id);_o.assignFurnitureFromFurniture(r,n)}}},ui.prototype.goNextForAngle=function(t){if(t.handle==ai){ie.reSet(),ie._setRes(t.curState.res),re.setAngle(t.curState.angle),ie.updateForRotate(t.curState.angle-t.preState.angle);var e=ie.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(re.getCurrentFloor()),!0}return!1},ui.prototype.goNextState=function(){Ae.redoHistoryRecord();var t=Ae.getHistoryRecord();if(t){Kt.clearFocusItem(),Kt.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)),ae.update(!1),ci.saveCurrentInfo(),this.setState();var e=re.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 Ae.undoHistoryRecord(),console.error("goNextState超出范围!")};var di={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"}},yi=function(){this.context=null};yi.prototype.initContext=function(t){this.context=t},yi.prototype.clear=function(){this.context.clearRect(0,0,this.context.canvas.width,this.context.canvas.height)},yi.prototype.drawWall=function(t,e){var o=re.getPoint(t.start),i=re.getPoint(t.end),n=[];n.push(o);for(var r=0;r<t.children.length;++r){var l=re.getSymbol(t.children[r]);n.push(l.startPoint),n.push(l.endPoint)}n.push(i),n=n.sort(function(t,e){return s.getDistance(o,t)-s.getDistance(o,e)}.bind(this)),this.context.save(),this.context.beginPath(),"export"==e?(t.out||t.important?this.context.lineWidth=di.export.Wall.lineWidth_out:this.context.lineWidth=di.export.Wall.lineWidth,this.context.strokeStyle=di.export.Wall.strokeStyle,this.context.fillStyle=di.export.Wall.fillStyle):"cover"==e?(t.out||t.important?this.context.lineWidth=di.cover.Wall.lineWidth_out:this.context.lineWidth=di.cover.Wall.lineWidth,this.context.strokeStyle=di.cover.Wall.strokeStyle,this.context.fillStyle=di.cover.Wall.fillStyle):"default"==e&&(t.out||t.important?this.context.lineWidth=di.default.Wall.lineWidth_out:this.context.lineWidth=di.default.Wall.lineWidth,this.context.strokeStyle=di.default.Wall.strokeStyle,this.context.fillStyle=di.default.Wall.fillStyle),this.context.lineCap="butt";for(var a=0;a<n.length-1;a+=2){var h=ie.getScreenXY(n[a]),c=ie.getScreenXY(n[a+1]);this.context.moveTo(h.x,h.y),this.context.lineTo(c.x,c.y)}this.context.stroke(),this.context.restore(),o.x,i.x,o.y,i.y},yi.prototype.drawPoint=function(t,e){this.context.save(),this.context.beginPath();var o="thin";for(var i in t.parent){var n=re.getWall(i);if(n.out&&n.important){o="fat";break}}var r=null;"export"==e?(r="thin"==o?di.export.Wall.lineWidth:di.export.Wall.lineWidth_out,this.context.strokeStyle=di.export.Wall.strokeStyle,this.context.fillStyle=di.export.Wall.fillStyle):"cover"==e?(r="thin"==o?di.cover.Wall.lineWidth:di.cover.Wall.lineWidth_out,this.context.strokeStyle=di.cover.Wall.strokeStyle,this.context.fillStyle=di.cover.Wall.fillStyle):"default"==e&&(r="thin"==o?di.default.Wall.lineWidth:di.default.Wall.lineWidth_out,this.context.strokeStyle=di.default.Wall.strokeStyle,this.context.fillStyle=di.default.Wall.fillStyle),this.context.lineCap="butt";var s=ie.getScreenXY(t);this.context.rect(s.x-r/2,s.y-r/2,r,r),this.context.fill(),this.context.restore()},yi.prototype.drawText=function(t,e,o,n){this.context.save(),this.setCanvasStyle(di.Font),ie.ratio==i.ratio?this.context.font="36px Microsoft YaHei":this.context.font="12px Microsoft YaHei";var r={x:t.x,y:t.y};o||(r=ie.getScreenXY({x:t.x,y:t.y})),n?(this.context.translate(r.x,r.y),this.context.rotate(n),this.context.strokeText(e,0,0),this.context.fillText(e,0,0)):(this.context.strokeText(e,r.x,r.y),this.context.fillText(e,r.x,r.y)),this.context.restore()},yi.prototype.drawSingleDoor=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=ie.getScreenXY({x:o[n].x,y:o[n].y});var r=s.getDistance(i[0],i[1]);this.context.save(),this.context.lineCap="butt",this.context.lineWidth=1,"export"==e?(this.context.strokeStyle=di.export.strokeStyle,this.context.fillStyle=di.export.fillStyle):"cover"==e?(this.context.strokeStyle=di.cover.strokeStyle,this.context.fillStyle=di.export.fillStyle):"default"==e&&(this.context.strokeStyle=di.default.strokeStyle,this.context.fillStyle=di.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,r),this.context.closePath(),this.context.stroke(),this.context.restore(),null!=t.enter&&this.drawEntranceDoor(t)},yi.prototype.drawDoubleDoor=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=ie.getScreenXY({x:o[n].x,y:o[n].y});var r=s.getDistance(i[0],i[1]);this.context.save(),this.context.lineWidth=1,this.context.lineCap="butt","export"==e?(this.context.strokeStyle=di.export.strokeStyle,this.context.fillStyle=di.export.fillStyle):"cover"==e?(this.context.strokeStyle=di.cover.strokeStyle,this.context.fillStyle=di.export.fillStyle):"default"==e&&(this.context.strokeStyle=di.default.strokeStyle,this.context.fillStyle=di.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,r),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,r),this.context.closePath(),this.context.stroke(),this.context.restore(),null!=t.enter&&this.drawEntranceDoor(t)},yi.prototype.drawSlideDoor=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=ie.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=di.export.strokeStyle,this.context.fillStyle=di.export.fillStyle):"cover"==e?(this.context.strokeStyle=di.cover.strokeStyle,this.context.fillStyle=di.export.fillStyle):"default"==e&&(this.context.strokeStyle=di.default.strokeStyle,this.context.fillStyle=di.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)},yi.prototype.drawSingleWindow=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=ie.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=di.export.strokeStyle,this.context.fillStyle=di.export.fillStyle):"cover"==e?(this.context.strokeStyle=di.cover.strokeStyle,this.context.fillStyle=di.export.fillStyle):"default"==e&&(this.context.strokeStyle=di.default.strokeStyle,this.context.fillStyle=di.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()},yi.prototype.drawBayWindow=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=ie.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=di.export.strokeStyle,this.context.fillStyle=di.export.fillStyle):"cover"==e?(this.context.strokeStyle=di.cover.strokeStyle,this.context.fillStyle=di.export.fillStyle):"default"==e&&(this.context.strokeStyle=di.default.strokeStyle,this.context.fillStyle=di.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()},yi.prototype.drawFrenchWindow=function(t,e){for(var o=t.points2d,i=[],n=0;n<o.length;++n)i[n]=ie.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=di.export.strokeStyle,this.context.fillStyle=di.export.fillStyle):"cover"==e?(this.context.strokeStyle=di.cover.strokeStyle,this.context.fillStyle=di.export.fillStyle):"default"==e&&(this.context.strokeStyle=di.default.strokeStyle,this.context.fillStyle=di.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()},yi.prototype.drawMeasure=function(t,e){this.context.save(),this.context.strokeStyle=di.Measure.strokeStyle,this.context.beginPath();for(var o=0;o<t.length-1;++o){var i=ie.getScreenXY(t[o]),n=ie.getScreenXY(t[o+1]),r=0;"top"==e?(i.y=ae.region.top*ie.ratio,n.y=ae.region.top*ie.ratio):"bottom"==e?(i.y=ae.region.bottom*ie.ratio,n.y=ae.region.bottom*ie.ratio):"left"==e?(i.x=ae.region.left*ie.ratio,n.x=ae.region.left*ie.ratio,r=-.5*Math.PI):"right"==e&&(i.x=ae.region.right*ie.ratio,n.x=ae.region.right*ie.ratio,r=.5*Math.PI);var l=s.createLine1(i,n),a=s.getParallelLineForDistance(l,6),h=s.getJoinLinePoint(i,a.line1),c=s.getJoinLinePoint(n,a.line1),u=s.getJoinLinePoint(i,a.line2),d=s.getJoinLinePoint(n,a.line2);this.context.moveTo(h.x,h.y),this.context.lineTo(u.x,u.y),this.context.moveTo(c.x,c.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},x=s.getVerticalLine(l,y);a=s.getParallelLineForDistance(x,20);var p=s.getIntersectionPoint(l,a.line1),g=s.getIntersectionPoint(l,a.line2);if(s.getDistance(i,p)<s.getDistance(i,y)){this.context.moveTo(i.x,i.y),this.context.lineTo(p.x,p.y),this.context.moveTo(g.x,g.y),this.context.lineTo(n.x,n.y),this.context.stroke();var f=s.getDistance(t[o],t[o+1]);"ft"==ae.unit&&(f=" "+xe.convert(f,"distance",void 0,"imperial",.01,!0)+" "),this.drawText(y,s.getFixed(f,2),!0,r)}else{this.context.moveTo(i.x,i.y),this.context.lineTo(g.x,g.y),this.context.moveTo(p.x,p.y),this.context.lineTo(n.x,n.y),this.context.stroke();var m=s.getDistance(t[o],t[o+1]);"ft"==ae.unit&&(m=" "+xe.convert(m,"distance",void 0,"imperial",.01,!0)+" "),this.drawText(y,s.getFixed(m,2),!0,r)}}this.context.restore()},yi.prototype.drawExportTxt=function(){this.context.save(),this.context.font=di.export.Font[0].font,this.context.fillStyle=di.export.Font[0].fillStyle,this.context.fillText(di.export.Font[0].text,di.export.Font[0].screen.x,di.export.Font[0].screen.y),this.context.restore(),this.context.save(),this.context.font=di.export.Font[1].font,this.context.fillStyle=di.export.Font[1].fillStyle,this.context.fillText(di.export.Font[1].text,di.export.Font[1].screen.x,di.export.Font[1].screen.y),this.context.restore(),this.context.save(),this.context.font=di.export.Font[2].font,this.context.fillStyle=di.export.Font[2].fillStyle,this.context.fillText(di.export.Font[2].text[0],di.export.Font[2].screen.x,di.export.Font[2].screen.y),this.context.fillText(di.export.Font[2].text[1],di.export.Font[2].screen.x,di.export.Font[2].screen.y+14),this.context.fillText(di.export.Font[2].text[2],di.export.Font[2].screen.x,di.export.Font[2].screen.y+28),this.context.restore()},yi.prototype.drawExportCompass=function(t,e){this.drawImg(t,e,!0)},yi.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=re.getPoint(t[i]);n=ie.getScreenXY(n),o.push(n)}this.context.beginPath(),this.context.moveTo(o[0].x,o[0].y);for(var r=0;r<o.length;++r)this.context.lineTo(o[r].x,o[r].y);this.context.closePath(),e&&this.context.fill(),this.context.restore()},yi.prototype.drawImg=function(t,e,o){this.context.save(),o||(e=ie.getScreenXY(e)),this.context.translate(e.x,e.y),this.context.drawImage(t,-t.width/2,-t.height/2),this.context.restore()},yi.prototype.drawBackGround=function(t,e,o){this.context.save(),this.context.fillStyle=o,this.context.fillRect(0,0,t,e),this.context.restore()},yi.prototype.drawEntranceDoor=function(t){this.context.save();var e,o,i=ee.getEnterImg(),n={x:(t.startPoint.x+t.endPoint.x)/2,y:(t.startPoint.y+t.endPoint.y)/2},r=s.createLine1(t.startPoint,t.endPoint),l=s.getLineForPoint(r,n),a=null,h=null;"default"==t.enter?a=s.getParallelLineForDistance(r,i.height/2/ie.res):"reverse"==t.enter&&(a=s.getParallelLineForDistance(r,i.height/2/ie.res+s.getDistance(t.startPoint,t.endPoint))),e=s.getIntersectionPoint(a.line1,l),o=s.getIntersectionPoint(a.line2,l);var c=s.Angle(t.startPoint,{x:t.startPoint.x+1,y:t.startPoint.y},t.endPoint);s.isClockwise([t.startPoint,t.endPoint,o])?h="LEFT"==t.openSide?"default"==t.enter?e:o:"default"==t.enter?o:e:s.isClockwise([t.startPoint,t.endPoint,e])&&(h="LEFT"==t.openSide?"default"==t.enter?o:e:"default"==t.enter?e:o),s.isClockwise([t.startPoint,t.endPoint,h])||(c=Math.PI+c),h=ie.getScreenXY(n),this.context.translate(h.x,h.y),console.log("截图:"+JSON.stringify(h)),t.startPoint.y<=t.endPoint.y?this.context.rotate(-c):this.context.rotate(c);var u=s.getDistance(t.startPoint,t.endPoint)*ie.res*1.5;this.context.scale(ie.ratio*u/i.height,ie.ratio*u/i.height),this.context.drawImage(i,-i.width/2,-i.height-10),this.context.restore()},yi.prototype.setCanvasStyle=function(t){for(var e in t)"isFill"!=e&&"isStroke"!=e&&(this.context[e]=t[e])};var xi=new yi,pi=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};pi.prototype.init=function(){this.cadBoundingBox=re.getBoundingBox()},pi.prototype.start=function(){this.layer.uiControl.menu_flex(),ge.clearDefaultTags(),this.layer.history.save(),ae.unit="m",ge.convertUnit("m"),xi.context=this.layer.renderer.getContext(),this.setType("export"),this.screenshot(),this.setType("cover"),this.screenshot(),this.setType("default"),this.screenshot(),this.recovery()},pi.prototype.setType=function(t){this.type=t},pi.prototype.autoDraw=function(){for(var t=0;t<this.rooms.length;++t){null!=this.rooms[t].pointIds&&this.drawRoom(this.rooms[t])}var e=re.getFloorData(),o=e.walls;for(var i in o)this.drawGeometry(o[i]);var n=e.points;for(var r in n)this.drawGeometry(n[r]);var s=e.symbols;for(var l in s)this.drawGeometry(s[l])},pi.prototype.getSize=function(){if("export"==this.type)ie.width=900,ie.height=900,di.export.Wall.lineWidth=Math.ceil(1*di.export.Wall.lineWidth),di.export.Wall.lineWidth_out=Math.ceil(1*di.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;di.cover.Wall.lineWidth=Math.ceil(.0055*Math.max(t,e)*2*1),di.cover.Wall.lineWidth_out=Math.ceil(.0055*Math.max(t,e)*1.5*2*1),t=Math.ceil(t+di.cover.Wall.lineWidth_out),e=Math.ceil(e+di.cover.Wall.lineWidth_out),ie.width=t,ie.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;di.default.Wall.lineWidth=Math.ceil(.0055*Math.max(o,i)*2*1),di.default.Wall.lineWidth_out=Math.ceil(.0055*Math.max(o,i)*1.5*2*1),o=Math.ceil(o+di.default.Wall.lineWidth_out),i=Math.ceil(i+di.default.Wall.lineWidth_out),ie.width=o,ie.height=i}},pi.prototype.screenshot=function(){var t,e,o=this.layer.canvas;if(this.getSize(),"export"==this.type){t=(ie.width-this.padding.export-this.padding.export-di.export.Wall.lineWidth_out)/Math.abs(this.cadBoundingBox.maxX-this.cadBoundingBox.minX),e=(ie.height-this.padding.export-this.padding.export-di.export.Wall.lineWidth_out)/Math.abs(this.cadBoundingBox.maxY-this.cadBoundingBox.minY),ie.res=Math.min(t,e),o.width=ie.width,o.height=ie.height;var i=ie.getScreenXY({x:this.cadBoundingBox.minX,y:this.cadBoundingBox.minY}),n=ie.getScreenXY({x:this.cadBoundingBox.maxX,y:this.cadBoundingBox.maxY});ae.updatePad({top:n.y-22,bottom:o.height-i.y-22,left:i.x-22,right:o.width-n.x-22}),ae.updateRegion(!1),ae.update(!1),xi.drawBackGround(ie.width,ie.height,di.export.BackGround.fillStyle),xi.drawMeasure(ae.measureLines.top,"top"),xi.drawMeasure(ae.measureLines.bottom,"bottom"),xi.drawMeasure(ae.measureLines.left,"left"),xi.drawMeasure(ae.measureLines.right,"right"),xi.drawExportCompass(this.imgCache.compass,di.export.compass.screen),xi.drawExportTxt(),this.autoDraw(),this.anjuke_export=this.exportImg(o,"image/jpeg")}else"cover"==this.type?(t=(ie.width-this.padding.cover-this.padding.cover)/Math.abs(this.cadBoundingBox.maxX-this.cadBoundingBox.minX),e=(ie.height-this.padding.cover-this.padding.cover)/Math.abs(this.cadBoundingBox.maxY-this.cadBoundingBox.minY),ie.res=Math.min(t,e),o.width=ie.width,o.height=ie.height,this.autoDraw(),this.anjuke_cover=this.exportImg(o,"png")):"default"==this.type&&(t=(ie.width-this.padding.default-this.padding.default)/Math.abs(this.cadBoundingBox.maxX-this.cadBoundingBox.minX),e=(ie.height-this.padding.default-this.padding.default)/Math.abs(this.cadBoundingBox.maxY-this.cadBoundingBox.minY),ie.res=Math.min(t,e),o.width=ie.width,o.height=ie.height,ae.updatePad({top:50,bottom:50,left:50,right:50}),ae.updateRegion(!1),ae.update(!1),xi.drawMeasure(ae.measureLines.top,"top"),xi.drawMeasure(ae.measureLines.bottom,"bottom"),xi.drawMeasure(ae.measureLines.left,"left"),xi.drawMeasure(ae.measureLines.right,"right"),this.autoDraw(),this.anjuke=this.exportImg(o,"png"))},pi.prototype.recovery=function(){var t=this.layer.app.core.get("CameraControls").activeControl.camera;ie.updateForCanvas(this.layer.canvas),ie.setRes(t.left,t.right),ae.updatePad(ae.defalutMeasurePad),ae.updateRegion(),this.layer.renderer.autoRedraw()},pi.prototype.exportImg=function(t,e){var o=t.toDataURL(e,3);return this.base64ToBlob(o)},pi.prototype.base64ToBlob=function(t){for(var e=t.split(","),o=e[0].match(/:(.*?);/)[1],i=atob(e[1]),n=i.length,r=new Uint8Array(n);n--;)r[n]=i.charCodeAt(n);return new Blob([r],{type:o})},pi.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)},pi.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)},pi.prototype._fixType=function(t){return"image/"+(t=t.toLowerCase().replace(/jpg/i,"jpeg")).match(/png|jpeg|bmp|gif/)[0]},pi.prototype.drawGeometry=function(t){switch(t.geoType){case h:xi.drawWall(t,this.type);break;case l:xi.drawPoint(t,this.type);break;case c:xi.drawSingleDoor(t,this.type);break;case u:xi.drawDoubleDoor(t,this.type);break;case d:xi.drawSlideDoor(t,this.type);break;case y:xi.drawSingleWindow(t,this.type);break;case p:xi.drawFrenchWindow(t,this.type);break;case x:xi.drawBayWindow(t,this.type);break;case f:xi.drawBeam(t,this.type);break;case m:xi.drawFlue(t,this.type);break;case v:xi.drawCorridor(t,this.type);break;case P:xi.drawTag(t,this.type)}},pi.prototype.drawRoom=function(t){this.roomInfo1.indexOf(t.name)>-1?xi.drawRoomBackGround(t.pointIds,this.imgCache.room1):this.roomInfo2.indexOf(t.name)>-1?xi.drawRoomBackGround(t.pointIds,this.imgCache.room2):(this.roomInfo3.indexOf(t.name),xi.drawRoomBackGround(t.pointIds,this.imgCache.room3)),"export"==this.type&&t.name&&(xi.drawText(t.center,t.name,!1,0),null!=t.area&&""!=t.area.trim()&&xi.drawText({x:t.center.x,y:t.center.y-16/ie.res},t.area+"m²",!1,0))};var gi=new pi,fi=function(t,e){this.app=t.app,this.layer=t,gi.layer=t,this.ajkJson={},this.cameraJson={},this.floorPlanJson={},this.getCameraJson(e),this.loadImg()};fi.prototype.loadImg=function(){this.app.store.getAppImage("images/ajk/cad_compass_ajk.png").then((function(t){gi.imgCache.compass=t})),this.app.store.getAppImage("images/ajk/room1_ajk.png").then((function(t){gi.imgCache.room1=t})),this.app.store.getAppImage("images/ajk/room2_ajk.png").then((function(t){gi.imgCache.room2=t})),this.app.store.getAppImage("images/ajk/room3_ajk.png").then((function(t){gi.imgCache.room3=t})),gi.roomInfo1=["书房","厨房","卫生间","多功能室","阳台","储物间","步入式衣柜","外景","露台(无顶)","影视间","入房花园"],gi.roomInfo2=["主卧","儿童房","次卧","客卧","老人房","卧室"],gi.roomInfo3=["整套","客厅","走廊","餐厅","起居室","客餐厅","玄关","门厅"]},fi.prototype.start=function(){var t=this;return new Promise((function(e,o){ro.start(),t.getFloorPlanJson().then((function(i){t.floor=i,re.updateBoundingBox(),gi.init();var n=re.getTags();if(0!=Object.keys(n).length)if(r=t.getAJKRooms(n)){var r=t.getEntrance();r?(t.getSceneName(),t.getPictureRotate(),t.getImgInfo(),t.layer.renderer.clear(),gi.start(),e({ajkJson:t.ajkJson,cameraJson:t.cameraJson,floorPlanJson:{floors:[t.floor.floors[0]]},files:{bgmgdCZp_anjuke:gi.anjuke,bgmgdCZp_anjuke_cover:gi.anjuke_cover,bgmgdCZp_anjuke_export:gi.anjuke_export}})):o({type:"toast",msg:"平面图至少包含要给入户门,且入户门应为单开门"})}else o({type:"toast",msg:"标注应包含房间名称、面积"});else o({type:"toast",msg:"平面图应至少包含一个标注"})}))}))},fi.prototype.getAJKRooms=function(t){gi.rooms=[];var e=re.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=gi.rooms.length,r=0;r<e.length;++r){if(!(o.indexOf(r)>-1))if(e[r].containPoint(this.ajkJson.rooms[i].labelPos)){o.push(r),console.log("匹配:"+this.ajkJson.rooms[i].name+"&"+e[r].tagName),gi.rooms.push({center:JSON.parse(JSON.stringify(this.ajkJson.rooms[i].labelPos)),pointIds:JSON.parse(JSON.stringify(e[r].wallPointIDs)),name:this.ajkJson.rooms[i].name,area:this.ajkJson.rooms[i].area});break}}n==gi.rooms.length&&(this.ajkJson.rooms.splice(i,1),--i)}return this.setRoomsGroup(),!0},fi.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)}},fi.prototype.getFloorPlanJson=function(){return this.app.store.get("floor",(function(t){return t}))},fi.prototype.getEntrance=function(t){null!=t&&void 0!==t||(t=re.getCurrentFloor());var e=re.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,r=new THREE.Vector3(o.startPoint.x,n+.4*.2,-o.startPoint.y),s=new THREE.Vector3(o.endPoint.x,n+.4*.2,-o.endPoint.y),l=r.clone().add(s).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,r,s),c=a.clone().sub(h).normalize();l.clone().negate().angleTo(c)>Math.PI/2&&(l.add(c.clone().multiplyScalar(r.distanceTo(s))),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},fi.prototype.getSceneName=function(){var t=this.app.store.getValue("metadata");this.ajkJson.scene_name=t.title},fi.prototype.getPictureRotate=function(){var t=re.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},fi.prototype.getFootPoint=function(t,e,o,i){var n=t.clone().sub(e),r=e.clone().sub(o),s=r.length(),l=n.dot(r)/s,a=e.clone().add(r.multiplyScalar(l/s));return i&&a.clone().sub(e).dot(a.clone().sub(o))>0&&(a=a.distanceTo(e)<a.distanceTo(o)?e.clone():o.clone()),a},fi.prototype.getImgInfo=function(){var t=re.getCurrentFloor(),e=re.getCadInfo(this.layer.canvas)[t],o={};o.bound=e.bound,o.margin=51,o.marginReal=o.margin/ie.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},fi.prototype.createAjkRoomForTag=function(t){var e=[];for(var o in t){var i={},n={},r=t[o];n.area=r.des,n.name=r.title,n.tagId=r.vectorId,n.floor=re.getCurrentFloor(),i.x=r.center.x,i.y=r.center.y,i.z=0,n.labelPos=i,n.group=-1,e.push(n)}return e},fi.prototype.setRoomsGroup=function(){for(var t=JSON.parse(JSON.stringify(gi.rooms)),e=[],o=re.getAngle(),i=0;i<this.ajkJson.rooms.length;++i){e=[];for(var n=[],r=0;r<t[i].pointIds.length;++r){var l=re.getPoint(t[i].pointIds[r]);n.push({x:l.x,y:l.y})}for(var a=0;a<this.cameraJson.sweepLocations.length;++a){var h=ie.getVectorForRotate(this.cameraJson.sweepLocations[a].puck,o);s.isPointInPoly(h,n)&&(this.ajkJson.rooms[i].group=parseInt(this.ajkJson.rooms[i].tagId.replace("Tag","")),e.push(a))}if(void 0!==this.ajkJson.rooms[i].group&&0!=e.length){for(var c=null,u=0;u<e.length;++u){c=e[u]}this.cameraJson.sweepLocations[c].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 mi=function(){};mi.prototype.init=function(t){return this.layer=t,this},mi.prototype.use=function(t,e){if(!this[t])return"DataAJK"==t&&(this[t]=new fi(this.layer,e)),this},mi.prototype.start=function(t){return this[t]?this[t].start():Promise.reject()};var vi=new mi,Si=function(){this.wallLineStyle=null,this.targetItem=null};Si.prototype.clearTargetItem=function(){this.targetItem=null},Si.prototype.copy=function(t,e){t&&t.type&&(this.targetItem={vectorId:t.vectorId,type:t.type}),this.paste(e),this.clearTargetItem()},Si.prototype.paste=function(t){var e=!1,o=ie.getXYFromScreen(t);if(this.targetItem&&Gt.isFurniture(this.targetItem.type)){var i=re.getFurniture(this.targetItem.vectorId),n=Gt.createFurniture(o,this.targetItem.type);n.angle=i.angle,n.zoom=i.zoom,Kt.setSelectItem(n.vectorId,this.targetItem.type,_),Kt.setDraggingItem(Kt.selectItem),Kt.setEventName(Ke),Ao.clear(),e=!0}return Kt.clearFocusItem(),e};var Pi=new Si,Ii=function(t){function e(e,o){t.call(this),this.app=e,this.load=new ve(this),this.analyService=new Ee(this),this.uiControl=new go(this),this.renderer=new Xo(this),this.history=new ui(this),this.sync=vi.init(this),this.startX=null,this.startY=null,this.player=this.app.core.get("Player"),this.display=!1,this.mousePosition=null,re.$app=this.app,Gt.$app=this.app,o&&o.padding&&ae.padding(o.padding),this.app.store.getAppImage("images/cad/cad_enter_dark.png").then((function(t){ee.setEnterImg(t)})),this.app.store.getAppImage("images/cad/compass-white.png").then((function(t){zo.setWhiteImg(t)})),this.app.store.getAppImage("images/cad/compass-black.png").then((function(t){zo.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){io.setHallImg(t[0]),io.setDefaultImg(t[1]),io.setOtherWhiteImg(t[2]),io.setOtherBlackImg(t[3])}))}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={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,Ro.initContext(this.canvas),this.bindEvents()},e.prototype.initCoordinate=function(){null==ie.center&&(ie.setDefaultCenter(this.app.core.get("Player").model.center),ie.init(this.canvas)),this.initPanos(re.currentFloor);var t=this.app.core.get("CameraControls").activeControl.camera;ie.setRes(t.left,t.right),ie.setInitInfo(ie.res,ie.width,ie.height)},e.prototype.initPanos=function(t){var e=this.app.core.get("Player").model.panos.list;o.panos=[];for(var i=0;i<e.length;++i){var n=e[i];n.panoType||n.floorIndex==t&&o.panos.push({vectorId:n.id,x:n.position.x,y:-1*n.position.z,name:"pano"})}var r=re.getAngle();ie.updatePanosForRotate(r)},e.prototype.render=function(){var t=this;this.initCoordinate();var e=re.getAngle();e=parseFloat(e);var o=ie.getScreenInfoForCAD();o.floorPlanAngle=e,ae.updateRegion(),ae.update(!1),this.app.core.get("CameraControls").emit("syncCadAnd3D",o),this.app.core.get("SceneRenderer").resizeListeners.push({setSize:function(o,i){if(t.display){ie.updateForCanvas(t.canvas),ie.updateResForReSize(o,i,e),ae.updateRegion(),ae.update(!1),t.renderer.autoRedraw();var n=ie.getScreenInfoForCAD();n.floorPlanAngle=re.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,ae.unit=i.unit,ge.convertUnit(i.unit)),this.renderer.autoRedraw()},e.prototype.reRender=function(){ie.setDefaultCenter(this.app.core.get("Player").model.center),ie.init(this.canvas);var t=ie.getScreenInfoForCAD();t.floorPlanAngle=re.getAngle(),this.app.core.get("CameraControls").emit("syncCadAnd3DForRotate",t);var e=this.app.core.get("CameraControls").activeControl.camera;ie.setRes(e.left,e.right),ie.setInitInfo(ie.res,ie.width,ie.height),this.initPanos(re.getCurrentFloor()),ae.updateRegion(),ae.update(!1),this.history.init(),this.renderer.autoRedraw()},e.prototype.show=function(){var t=this;return Gt.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;re.setCurrentFloor(o),t.load.loadFloorJson().then((function(){var o=t.app.store.getValue("flooruser");t.uiControl.menu_flex(),t.app.core.get("Player").gotoFloor(re.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){ae.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!=ie.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=Kt.getEventName();if(e==Ye){if(!this.setNewWallPoint("start",{x:this.startX,y:this.startY}))return}else if(e==Ne){if(!this.setNewWallPoint("end",ie.getScreenXY(Re.newWall.end)))return;if(!lo.canAdd)return;lo.buildWall(this.uiControl.selectUI==xt),this.history.save()}else{var o=Kt.getSelectItem();null==e&&o?(Kt.setDraggingItem(o),Kt.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!=ie.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 n=e-this.lastX,r=o-this.lastY,l=ie.getXYFromScreen({x:e,y:o}),a=Kt.getEventName(),h=!1,c=Kt.getDraggingItem();switch(a){case null:h=ze.start(l);break;case Be:Kt.clearItems(),ie.center.x=ie.center.x-n*i.defaultZoom/ie.zoom/ie.res,ie.center.y=ie.center.y+r*i.defaultZoom/ie.zoom/ie.res,this.lastX=e,this.lastY=o,h=!0;var u=re.getAngle(),d=ie.getScreenInfoForCAD();d.floorPlanAngle=u,this.app.core.get("CameraControls").emit("syncCadAnd3D",d);break;case Ye:Kt.clearDraggingItem(),Kt.clearFocusItem(),h=!0,ze.start(l),ze.modifyPoint&&(l={x:ze.modifyPoint.x,y:ze.modifyPoint.y}),Re.execute(null,l),Re.setStartAddWall(l),Re.showStartAddWall();break;case Ne:Kt.clearDraggingItem(),Kt.clearFocusItem(),h=!0,ze.start(l);var y={x:lo.startInfo.position.x,y:lo.startInfo.position.y};if(ze.modifyPoint&&(l={x:ze.modifyPoint.x,y:ze.modifyPoint.y}),Re.execute(y,l),Re.setStartAddWall(l),Re.newWall.display){if(!ze.modifyPoint&&lo.startInfo.linkedPointId){var x=Re.checkAngle(l,lo.startInfo.linkedPointId,null);x&&(s.clonePoint(l,x),Re.execute(y,l))}Re.setNewWallEndPosition(l)}else Re.setNewWall(y,l),Re.showNewWall();lo.canAdd=lo.canAddWallForEnd(l),lo.canAdd?this.uiControl.selectUI==xt?Re.setNewWallState("normal-out"):Re.setNewWallState("normal"):Re.setNewWallState("error");break;case Xe:n=n*i.defaultZoom/ie.zoom,r=r*i.defaultZoom/ie.zoom;var p=No.moveWallPlane(c.vectorId,n,r);1==p?(this.lastX=e,this.lastY=o,h=!0):2==p||(3==p?(this.history.save(),Kt.clearSelectItem(),Kt.clearDraggingItem(),Kt.clearEventName(),ze.clear(),h=!0):4==p?(this.lastX=e,this.lastY=o,this.startX=e,this.startY=o,h=!0):5==p&&(this.lastX=e,this.lastY=o)),No.needUpdateRoom;break;case je:var g=re.getPoint(c.vectorId);if(ze.start(l,c.vectorId,g.parent),ze.modifyPoint&&(l={x:ze.modifyPoint.x,y:ze.modifyPoint.y}),No.movePoint(c.vectorId,l,ze.modifyPoint)){g=re.getPoint(c.vectorId),ze.start(g,c.vectorId,g.parent);var f=null;ze.modifyPoint&&ze.modifyPoint.linkedPointId?f=re.getPoint(ze.modifyPoint.linkedPointId):ze.modifyPoint&&ze.modifyPoint.linkedPointIdX?f=re.getPoint(ze.modifyPoint.linkedPointIdX):ze.modifyPoint&&ze.modifyPoint.linkedPointIdY&&(f=re.getPoint(ze.modifyPoint.linkedPointIdY)),Re.execute(f,g)}else Re.hideAll();h=!0;break;case _e:if(ze.start(l),ze.wallInfo.wallId)if(h=!0,null==c){var m=this.uiControl.getSymbolTypeForUI(),v=ee.addSymbol(l,m,ze.wallInfo.wallId);v&&(Kt.setSelectItem(v,m,_),Kt.setDraggingItem(Kt.selectItem))}else Qt.moveFullSymbol(l,c.vectorId,ze.wallInfo.wallId);else h=!1;break;case Ue:ze.start(l),h=!0,null!=c&&ee.isSymbol(c.type)&&Qt.moveFullSymbol(l,c.vectorId,ze.wallInfo.wallId);break;case Je:h=!0,null!=c&&ee.isSymbol(c.type)&&Qt.moveSymbolPoint(l,c.vectorId,c.selectIndex);break;case Ve:if(h=!0,null==c){var S=this.uiControl.getComponentTypeForUI(),I=ut.createComponent(l,S);I.vectorId&&(Kt.setSelectItem(I.vectorId,S,_),Kt.setDraggingItem(Kt.selectItem))}else Ao.setStart(l,c.vectorId,c.type),Ao.moveFull(l,c.vectorId,c.type);break;case He:h=!0,null!=c&&ut.isComponent(c.type)&&(Ao.setStart(l,c.vectorId,c.type),Ao.moveFull(l,c.vectorId,c.type));break;case Ze:if(h=!0,null==c){var b=ge.createTag(l);b.vectorId&&(Kt.setSelectItem(b.vectorId,P,_),Kt.setDraggingItem(Kt.selectItem))}else Bo.moveFullTag(l,c.vectorId);break;case Ge:h=!0,null!=c&&Bo.moveFullTag(l,c.vectorId);break;case $e:if(h=!0,null==c){var k=this.uiControl.getFurnitureTypeForUI(),T=Gt.createFurniture(l,k);T.vectorId&&(Kt.setSelectItem(T.vectorId,k,_),Kt.setDraggingItem(Kt.selectItem))}else Ao.setStart(l,c.vectorId,c.type),Ao.moveFull(l,c.vectorId,c.type);break;case Ke:h=!0,null!=c&&Gt.isFurniture(c.type)&&(Ao.setStart(l,c.vectorId,c.type),Ao.moveFull(l,c.vectorId,c.type))}h&&this.renderer.autoRedraw()}},e.prototype.onMouseUp=function(t){if(null!=ie.defaultCenter){var e=t.offsetX||t.layerX,o=t.offsetY||t.layerY;this.app.core.get("CameraControls").onMouseUp(t);var i=Kt.getEventName(),n=Kt.getDraggingItem(),r=null;n&&n.vectorId&&(r={vectorId:n.vectorId,type:n.type,cursor:{x:this.lastX,y:this.lastY}},Kt.setFocusItem(r),this.uiControl.showAttributes()),ie.getXYFromScreen({x:e,y:o});var l=null;switch(i){case null:return;case Be:Kt.clearFocusItem(),ae.update(!1),this.uiControl.currentUI=null;break;case je:Re.hideAll();var a=re.getPoint(n.vectorId);a&&(ze.start(a,n.vectorId,a.parent),ze.modifyPoint&&ze.modifyPoint.hasOwnProperty("linkedPointId")?st.moveTo(n.vectorId,ze.modifyPoint.linkedPointId):ze.modifyPoint&&(ze.modifyPoint.linkedPointIdX||ze.modifyPoint.linkedPointIdY)?(s.clonePoint(a,ze.modifyPoint),ee.updateSymbolsPositionsForWallCorner(n.vectorId)):ze.modifyPoint&&ze.modifyPoint.hasOwnProperty("linkedWallId")?(a=st.createPoint(ze.modifyPoint.x,ze.modifyPoint.y),st.splitWall(ze.modifyPoint.linkedWallId,a.vectorId,"start"),st.moveTo(n.vectorId,a.vectorId)):null!=No.splitWallId&&st.splitWall(No.splitWallId,n.vectorId,"start"),No.updateForAbsorbWallPoints(),this.history.save());break;case Ne:if(lo.startInfo&&lo.startInfo.linkedPointId){var c=re.getPoint(lo.startInfo.linkedPointId);lo.endInfo.position&&Object.keys(c.parent).length>1&&(Kt.clearEventName(),lo.clear(),this.uiControl.clearUI(),Re.hideAll())}break;case Xe:if(null!=r&&r.type==h){var u=re.getWall(r.vectorId);u.import||u.out?this.uiControl.currentUI="OutWall":this.uiControl.currentUI=r.type,this.history.save()}else this.history.save();No.setStartMoving(!1);break;case _e:if(null==n)return void this.setEventName("mouseUp");r={vectorId:n.vectorId,type:n.type,cursor:{x:this.lastX,y:this.lastY}},Kt.setFocusItem(r),this.uiControl.showAttributes(),this.uiControl.currentUI=r.type,this.history.save();break;case Ue:l=re.getSymbol(n.vectorId),null!=r&&ee.isSymbol(r.type)?(this.uiControl.currentUI=r.type,this.history.save()):l&&(l.len=null,this.history.save());break;case Je:null!=r&&ee.isSymbol(r.type)?(this.uiControl.currentUI=r.type,this.history.save()):this.history.save();break;case Ve:Re.hideSignLine1(),Re.hideSignLine2(),Ao.clear(),r={vectorId:n.vectorId,type:n.type,cursor:{x:this.lastX,y:this.lastY}},Kt.setFocusItem(r),this.uiControl.showAttributes(),this.uiControl.currentUI=r.type,this.history.save();break;case He:Re.hideSignLine1(),Re.hideSignLine2(),Ao.clear(),null!=r&&ut.isComponent(r.type)?(this.uiControl.currentUI=r.type,this.history.save()):this.history.save(),Re.hideAll();break;case Ge:null!=r&&r.type==P?(this.uiControl.currentUI=r.type,this.history.save()):this.history.save();break;case Ze:re.getTag(n.vectorId).setAdding(!1),r={vectorId:n.vectorId,type:n.type,cursor:{x:this.lastX,y:this.lastY}},Kt.setFocusItem(r),this.history.save(),this.uiControl.currentUI=r.type;break;case $e:Re.hideSignLine1(),Re.hideSignLine2(),Ao.clear(),r={vectorId:n.vectorId,type:n.type,cursor:{x:this.lastX,y:this.lastY}},Kt.setFocusItem(r),this.uiControl.showAttributes(),this.uiControl.currentUI=r.type,this.history.save();break;case Ke:Re.hideSignLine1(),Re.hideSignLine2(),Ao.clear(),null!=r&&Gt.isFurniture(r.type)?(this.uiControl.currentUI=r.type,this.history.save()):this.history.save()}this.setEventName("mouseUp"),Kt.clearDraggingItem(),this.renderer.autoRedraw()}},e.prototype.onWheel=function(t){if(null!=ie.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=ie.zoom+o;if(i<14)return;ie.updateZoom(i);var n=ie.getScreenInfoForCAD();n.floorPlanAngle=re.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=Kt.getFocusItem(),o=Kt.getDraggingItem();e&&!o&&t.ctrlKey&&"KeyC"==t.code&&(Pi.copy(e,this.mousePosition),this.renderer.autoRedraw(),this.history.save())}},e.prototype.updateEventNameForSelectUI=function(){if(Re.hideAll(),Kt.getEventName()==Ze){var t=Kt.getDraggingItem();t&&t.type==P&&re.deleteTag(t.vectorId)}Kt.clearItems(),this.uiControl.selectUI==yt||this.uiControl.selectUI==xt?Kt.setEventName(Ye):this.uiControl.selectUI==pt||this.uiControl.selectUI==gt||this.uiControl.selectUI==ft||this.uiControl.selectUI==mt||this.uiControl.selectUI==vt||this.uiControl.selectUI==St||this.uiControl.selectUI==Pt?Kt.setEventName(_e):this.uiControl.selectUI==It||this.uiControl.selectUI==bt||this.uiControl.selectUI==kt?Kt.setEventName(Ve):this.uiControl.selectUI==Tt?Kt.setEventName(Ze):this.uiControl.selectUI!=Ft&&this.uiControl.selectUI!=Ct&&this.uiControl.selectUI!=wt&&this.uiControl.selectUI!=Wt&&this.uiControl.selectUI!=Dt&&this.uiControl.selectUI!=Lt&&this.uiControl.selectUI!=zt&&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!=Yt&&this.uiControl.selectUI!=Nt&&this.uiControl.selectUI!=Xt&&this.uiControl.selectUI!=jt&&this.uiControl.selectUI!=_t&&this.uiControl.selectUI!=Ut&&this.uiControl.selectUI!=Jt&&this.uiControl.selectUI!=Vt||Kt.setEventName($e)},e.prototype.setEventName=function(t){var e=Kt.getEventName();if("mouseDown"==t)if(null==e){var o=Kt.getSelectItem();if(null==o)Kt.setEventName(Be);else if(o.type==h)Kt.setEventName(Xe);else if(o.type==a)Kt.setEventName(je);else if(ee.isSymbol(o.type))if(o.selectIndex==_||o.selectIndex==V){Kt.setEventName(Ue);var i=re.getSymbol(o.vectorId);i.len=s.getDistance(i.startPoint,i.endPoint)}else o.selectIndex!=U&&o.selectIndex!=J||Kt.setEventName(Je);else ut.isComponent(o.type)?Kt.setEventName(He):o.type==P?Kt.setEventName(Ge):Gt.isFurniture(o.type)&&Kt.setEventName(Ke)}else e==Ye&&Kt.setEventName(Ne);else"mouseUp"==t&&(e==Ze||e!=Ye&&e!=Ne&&Kt.clearEventName())},e.prototype.exit=function(){Kt.clearItems(),Kt.clearEventName(),this.uiControl.clearUI()},e.prototype.stopAddVector=function(){var t=Kt.getEventName();if(t!=Ne){Kt.clearEventName();var e=Kt.getDraggingItem();t==_e?e&&e.vectorId&&(ee.deleteSymbol(e.vectorId),Kt.clearDraggingItem()):t==Ve?e&&e.vectorId&&re.deleteComponent(e.vectorId):t==Ze?e&&e.vectorId&&(ge.deleteTag(e.vectorId),this.uiControl.currentUI=null):t==$e&&e&&e.vectorId&&re.deleteFurniture(e.vectorId)}else Kt.setEventName(Ye);this.uiControl.clearUI(),Re.hideAll()},e.prototype.setNewWallPoint=function(t,e){return"select"!=ze.symbolInfo.state&&(("start"==t||"end"==t)&&(ze.modifyPoint?lo.setPointInfo(t,ze.modifyPoint):lo.setPointInfo(t,ie.getXYFromScreen(e)),!0))},e.prototype.reload=function(){var t=this;Ae.clearHistoryRecord(),this.$xui.toolbar.recall=!1,this.$xui.toolbar.recover=!1,re.clear(),ie.clear(),Kt.clearItems(),Kt.clearEventName(),this.stopAddVector();var e=re.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()),re.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?re.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=re.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 i=JSON.parse(JSON.stringify(o.floors));e.forEach((function(t,e){t.boundingBox=i[e].boundingBox}))}ro.start(),this.app.store.getValue("flooruser").cadInfo=t;var n=JSON.parse(JSON.stringify(e||o.floors));n.sort((function(t,e){return t.id-e.id}));var r={cadInfo:t,version:o.version,floors:n,unit:ae.unit,angle:re.getAngle(),currentId:re.getCurrentId(),compass:re.getCompass()};return r.type=e?"image":"cad",r},e.prototype.exportHouseData=function(){return this.analyService.houseData},e.prototype.importJSON=function(){},n.isChanged.get=function(){return Ae.hasRecords()},n.isCurrentFloorEmpty.get=function(){return!1},e.prototype.revokeHistory=function(){this.history.goPreState(),this.renderer.autoRedraw(),Ae.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(),Ae.getHistoryState().next?this.$xui.toolbar.recover=!0:this.$xui.toolbar.recover=!1,this.$xui.toolbar.recall=!0},e.prototype.deleteItem=function(){var t=Kt.getFocusItem();t&&(t.type==h?re.deleteWall(t.vectorId):ee.isSymbol(t.type)?ee.deleteSymbol(t.vectorId):ut.isComponent(t.type)?re.deleteComponent(t.vectorId):t.type==P?re.deleteTag(t.vectorId):Gt.isFurniture(t.type)?re.deleteComponent(t.vectorId):t.type==a&&st.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 re.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){Kt.clearEventName();var i=ee.createSymbolFromPanorama(t,e,o);return this.history.save(),i},e.prototype.syncFloorplanAngel=function(t){var e=ie.getScreenInfoForCAD();e.floorPlanAngle=null!=t?t:re.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"},n.floors.get=function(){return o.floors},Object.defineProperties(e.prototype,n),e}(KanKan.MITT.Emiter);return function(t){var e=KanKan.Deferred(),o=function(){var o=new Ii(t);o.$html="<div xui_edit_cad> <canvas></canvas> </div> <style> [xui_edit_cad] {\n display: none;\n position: absolute;\n pointer-events: all;\n width: 100%;\n height: 100%;\n \n\n }\n [xui_edit_cad] canvas {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n } </style> ",o.$name="EditCAD",o.$load=function(){t.CadManager.install(o)},e.resolve(o)};return t.Scene.loaded?o():t.Scene.on("loaded",o),e}}();