var DataAJK=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 r={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},s=function(){};s.prototype.getFixed=function(t,e){return e||(e=5),parseFloat(t.toFixed(e))},s.prototype.getDistance=function(t,e){var n=t.x,o=t.y,i=e.x,r=e.y,s=Math.sqrt(Math.pow(n-i,2)+Math.pow(o-r,2));return this.getFixed(s)},s.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 n=(t.y-e.y)/(t.x-e.x),o=(t.x*e.y-e.x*t.y)/(t.x-e.x);return 0==this.getFixed(n)?{y:this.getFixed(o)}:{a:this.getFixed(n),b:this.getFixed(o)}},s.prototype.createLine2=function(t,e){if(e==Math.PI/2||e==1.5*Math.PI)return{x:t.x};var n=Math.tan(e),o=t.y-n*t.x;return 0!=n?{a:n,b:o}:{y:t.y}},s.prototype.createLine3=function(t,e){var n={};return void 0===t.a?void 0!==t.x?n.x=e.x:void 0!==t.y&&(n.y=e.y):(n.a=t.a,n.b=e.y-e.x*t.a),n},s.prototype.create2AngleLine=function(t,e,n){return{line1:this.createLine2(t,e-n/2),line2:this.createLine2(t,e+n/2)}},s.prototype.distanceForPoints=function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},s.prototype.getParallelLineForDistance=function(t,e){var n={},o={};if(t.hasOwnProperty("a")){n.a=t.a,n.b=t.b,o.a=t.a,o.b=t.b;var i=Math.atan(t.a),r=Math.abs(e/Math.cos(i)),s=t.b;n.b=s+r,o.b=s-r}else if(t.hasOwnProperty("x")){var a=t.x;n.x=a+e,o.x=a-e}else if(t.hasOwnProperty("y")){var l=t.y;n.y=l+e,o.y=l-e}return{line1:n,line2:o}},s.prototype.getEndpoint=function(t,e,n){var o=this.create2AngleLine(t,e,n),i=this.createLine2(t,e);i=this.getLineForPoint(i,t);var r=this.getParallelLineForDistance(i,15),s=this.getIntersectionPoint(o.line1,r.line1),a=this.getIntersectionPoint(o.line1,r.line2),l=this.getIntersectionPoint(o.line2,r.line1),h=this.getIntersectionPoint(o.line2,r.line2),p=this.Angle(t,s,{x:t.x+1,y:t.y}),c=this.Angle(t,a,{x:t.x+1,y:t.y}),u=this.Angle(t,l,{x:t.x+1,y:t.y}),d=this.Angle(t,h,{x:t.x+1,y:t.y});return e>Math.PI&&(e=2*Math.PI-e),Math.abs((p+u)/2-e)0},s.prototype.reverse=function(t){for(var e=[],n=t.length-1;n>-1;--n)e.push(t[n]);return e},s.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)}},s.prototype.getIntersectionPoint2=function(t,e,n,o){var i=(e.y-t.y)*(o.x-n.x)-(t.x-e.x)*(n.y-o.y);return 0==i?null:{x:((e.x-t.x)*(o.x-n.x)*(n.y-t.y)+(e.y-t.y)*(o.x-n.x)*t.x-(o.y-n.y)*(e.x-t.x)*n.x)/i,y:-((e.y-t.y)*(o.y-n.y)*(n.x-t.x)+(e.x-t.x)*(o.y-n.y)*t.y-(o.x-n.x)*(e.y-t.y)*n.y)/i}},s.prototype.getIntersectionPoint3=function(t,e,n,o){var i=this.getIntersectionPoint2(t,e,n,o);if(i){var r=i.x,s=i.y;return(r-t.x)*(r-e.x)<=.001&&(s-t.y)*(s-e.y)<=.001&&(r-n.x)*(r-o.x)<=.001&&(s-n.y)*(s-o.y)<=.001?{x:r,y:s}:null}return null},s.prototype.getIntersectionPoint4=function(t,e,n){var o=this.createLine1(t,e),i=this.getIntersectionPoint(o,n);return null==i?null:this.PointInSegment(i,t,e)?i:null},s.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)},s.prototype.Angle=function(t,e,n){var o,i,r=0,s=e.x-t.x,a=e.y-t.y,l=n.x-t.x,h=n.y-t.y;return r=s*l+a*h,i=(s*s+a*a)*(l*l+h*h),(r/=Math.sqrt(i))>=1?0:r<=-1?Math.PI:180*(o=Math.acos(r))/Math.PI<180?o:2*Math.PI-o},s.prototype.getLineForPoint=function(t,e){var n={};return 0==t.a||void 0===t.a?t.hasOwnProperty("x")?n.y=e.y:t.hasOwnProperty("y")&&(n.x=e.x):(n.a=-1/t.a,n.b=e.y-e.x*n.a),n},s.prototype.getJoinLinePoint=function(t,e){var n=this.getVerticalLine(e,t);return this.getIntersectionPoint(e,n)},s.prototype.getDisForPoinLine=function(t,e){var n=this.getJoinLinePoint(t,e);return this.getDistance(t,n)},s.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 n={};return n.a=-1/t.a,this.createLine3(n,e)},s.prototype.isContainForSegment=function(t,e,n,o){o||(o=r.minAdsorb);var i=this.getDistance(e,t)+this.getDistance(n,t),s=this.getDistance(e,n);return Math.abs(i-s)o!=u>o&&n<(c-h)*(o-p)/(u-p)+h&&(i=!i)}return i},s.prototype.getDisForPoinSegment=function(t,e,n,o){var i=this.createLine1(e,n),r=this.getJoinLinePoint(t,i),s=this.getDistance(e,n),a=this.getDistance(r,e),l=this.getDistance(r,n);return this.getDistance(r,e)>s||this.getDistance(r,n)>s?a=0&&r*p+s*c<=0&&Math.abs(o*s-i*r)<=.001},s.prototype.clonePoint=function(t,e){t.x=e.x,t.y=e.y},s.prototype.equalPoint=function(t,e){return t.x==e.x&&t.y==e.y},s.prototype.crossTwoLines=function(t,e,n,o,i){void 0===i&&(i=r.minAdsorb);var s=this.getIntersectionPoint2(t,e,n,o);if(null!=s){if(this.getDistance(t,s)>i&&this.getDistance(e,s)>i&&this.getDistance(n,s)>i&&this.getDistance(o,s)>i)return this.getDistance(t,s)s.x&&(e=s.x),o>s.y&&(o=s.y),ns.x)&&(e=s.x),(null==o||o>s.y)&&(o=s.y),(null==n||n0?null:s};var a=new s,l="Point",h="Wall",p="SingleDoor",c="DoubleDoor",u="SlideDoor",d="SingleWindow",y="BayWindow",g="FrenchWindow",f="Pass",x="Tag",m="start",P="end",v="select",I="LEFT",S="RIGHT",b=function(){this.len=null};b.prototype.setId=function(t){null==t||void 0===t?(t=J.getCurrentId(),J.updateCurrentId(),this.vectorId=this.geoType+t):this.vectorId=t},b.prototype.setSymbolPosition=function(t,e){"start"==e?a.clonePoint(this.startPoint,t):"end"==e&&a.clonePoint(this.endPoint,t)},b.prototype.setSymbolParent=function(t){this.parent=t},b.prototype.setPointParent=function(t,e){null==this.parent&&(this.parent={}),this.parent[t]=e},b.prototype.setOpenSide=function(t){var e=[];e.push(this.startPoint),e.push(this.endPoint),e.push(t);var n=null;n=a.isClockwise(e)?I:S,this.openSide=n},b.prototype.rotatePoint=function(t,e,n){n*=-1;var o=e.x,i=e.y,r=t.x,s=t.y;return{x:o+(r-o)*Math.cos(n*Math.PI/180)-(s-i)*Math.sin(n*Math.PI/180),y:i+(r-o)*Math.sin(n*Math.PI/180)+(s-i)*Math.cos(n*Math.PI/180)}};var w=function(t){function e(e,n,o,i){t.call(this),this.startPoint=e,this.endPoint=n,this.floor=i,this.openSide=null,this.parent=null,this.enter=null,this.points2d=[],this.position3d={},this.name="单开门",this.geoType=p,this.setId(o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setPoints2d=function(){var t=a.createLine1(this.startPoint,this.endPoint),e=a.getDistance(this.startPoint,this.endPoint),n=a.getParallelLineForDistance(t,e),o=a.getVerticalLine(t,this.startPoint),i=a.getVerticalLine(t,this.endPoint),r=a.getIntersectionPoint(n.line1,o),s=a.getIntersectionPoint(n.line2,o),l=a.getIntersectionPoint(n.line1,i),h=a.getIntersectionPoint(n.line2,i);if(this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(this.endPoint),this.points2d.push(l),this.points2d.push(r),this.openSide==I){if(a.isClockwise(this.points2d))return;this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(this.endPoint),this.points2d.push(h),this.points2d.push(s)}else if(this.openSide==S){if(!a.isClockwise(this.points2d))return;this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(this.endPoint),this.points2d.push(h),this.points2d.push(s)}},e.prototype.isContain=function(t){var e=a.getDistance(t,this.startPoint),n=a.getDistance(t,this.endPoint);if(eo)return null;var i=a.Angle(this.points2d[0],t,this.points2d[1]),s=a.Angle(this.points2d[0],t,this.points2d[3]);return ithis.endPoint.x){var o=n.line1;n.line1=n.line2,n.line2=o}var i=a.getVerticalLine(t,this.startPoint),r=a.getVerticalLine(t,this.endPoint),s=n.line1,l=n.line2,h=a.getIntersectionPoint(n.line1,i),p=a.getIntersectionPoint(n.line2,r);this.points2d=[],this.points2d.push(this.startPoint),this.points2d.push(this.endPoint),this.points2d.push(h),a.isClockwise(this.points2d)?null==this.openSide||"LEFT"==this.openSide||(s=n.line2,l=n.line1,h=a.getIntersectionPoint(s,i),p=a.getIntersectionPoint(l,r)):null!=this.openSide&&"LEFT"!=this.openSide||(s=n.line2,l=n.line1,h=a.getIntersectionPoint(s,i),p=a.getIntersectionPoint(l,r));var c={x:(this.startPoint.x+this.endPoint.x)/2,y:(this.startPoint.y+this.endPoint.y)/2};this.points2d=[],this.points2d.push(this.startPoint);var u=4/Y.res,d=a.getVerticalLine(t,c),y=a.getParallelLineForDistance(d,u),g=a.getIntersectionPoint(s,y.line1),f=a.getIntersectionPoint(s,y.line2),x=a.getIntersectionPoint(l,y.line1),m=a.getIntersectionPoint(l,y.line2),P=a.getIntersectionPoint(t,y.line1),v=a.getIntersectionPoint(t,y.line2);a.getDistance(this.startPoint,P)a.getDisForPoinLine(this.startPoint,p.line2)?(t=p.line2,e=c.line2,n=p.line1,o=c.line1):(t=p.line1,e=c.line1,n=p.line2,o=c.line2);var u=a.getParallelLineForDistance(i,2/Y.res),d=a.getParallelLineForDistance(i,this.thickness-2/Y.res),y=a.getParallelLineForDistance(i,this.thickness),g=u.line1,f=u.line2,x=d.line2,m=y.line2,P=u.line2,v=u.line1,I=d.line1,S=y.line1,b=a.getIntersectionPoint(t,g),w=a.getIntersectionPoint(n,g),D=a.getIntersectionPoint(n,x),M=a.getIntersectionPoint(t,x),F=a.getIntersectionPoint(e,f),T=a.getIntersectionPoint(o,f),k=a.getIntersectionPoint(o,m),W=a.getIntersectionPoint(e,m),O=a.getIntersectionPoint(t,P),C=a.getIntersectionPoint(n,P),L=a.getIntersectionPoint(n,I),B=a.getIntersectionPoint(t,I),E=a.getIntersectionPoint(e,v),A=a.getIntersectionPoint(o,v),R=a.getIntersectionPoint(o,S),_=a.getIntersectionPoint(e,S);this.points2d=[],this.points2d.push(b),this.points2d.push(w),this.points2d.push(D),this.points2d.push(M),"LEFT"==this.openSide?a.isClockwise(this.points2d)?(this.points2d.push(F),this.points2d.push(T),this.points2d.push(k),this.points2d.push(W)):(this.points2d=[],this.points2d.push(O),this.points2d.push(C),this.points2d.push(L),this.points2d.push(B),this.points2d.push(E),this.points2d.push(A),this.points2d.push(R),this.points2d.push(_)):"RIGHT"==this.openSide&&(a.isClockwise(this.points2d)?(this.points2d=[],this.points2d.push(O),this.points2d.push(C),this.points2d.push(L),this.points2d.push(B),this.points2d.push(E),this.points2d.push(A),this.points2d.push(R),this.points2d.push(_)):(this.points2d.push(F),this.points2d.push(T),this.points2d.push(k),this.points2d.push(W)))},e.prototype.isContain=function(t){var e=a.getDistance(t,this.startPoint),n=a.getDistance(t,this.endPoint);if(e2){for(var c in s)if(c!=e){var u=this.AngleForWall2(e,c);null==h&&1==u.clockwise?((o=u).wallId=c,h=u.angle,(r=u).wallId=c,p=u.angle):h>u.angle&&1==u.clockwise?((o=u).wallId=c,h=u.angle):pu.angle&&0==u.clockwise?((n=u).wallId=c,a=u.angle):l1)this.moveTo(n,o);else{J.deleteWall(e);var r=J.getPoint(n);a.clonePoint(r,i)}return o},L.prototype.changeSymbolsWallToWall=function(t,e,n){for(var o=J.getWall(t,n),i=J.getWall(e,n),r=0;rr.maxAngle/180*Math.PI)return this.mergeWall(Object.keys(e.parent)[0],Object.keys(e.parent)[1]);return null},L.prototype.getLinkPointId=function(t,e){var n=J.getWall(t),o=J.getWall(e);return n.start==o.start||n.start==o.end?n.start:n.end==o.start||n.end==o.end?n.end:n.start==o.start?null:void 0},L.prototype.moveTo=function(t,e){var n=this.getWallId(t,e),o=J.getPoint(t),i=J.getPoint(e);o.x,i.x,o.y,i.y;var s=o.parent,l=i.parent;for(var h in s)if(h!=n){var p=J.getWall(h).getOtherPointId(t),c=J.getPoint(p);for(var u in l)if(u!=n){var d=J.getWall(u).getOtherPointId(e),y=J.getPoint(d),g=a.Angle(i,c,y);if(Math.abs(g)2)for(var n in e.parent)J.deleteWall(n);else if(2==Object.keys(e.parent).length){this.AngleForWall(Object.keys(e.parent)[0],Object.keys(e.parent)[1])>r.maxAngle/180*Math.PI?this.mergeWall(Object.keys(e.parent)[0],Object.keys(e.parent)[1]):(J.deleteWall(Object.keys(e.parent)[0]),J.deleteWall(Object.keys(e.parent)[0]))}};var B=new L,E=function(){this.symbol=null};E.prototype.moveFullSymbol=function(t,e,n){var o=J.getSymbol(e),i=J.getWall(n);if(!i)return null;var r=B.getLine(i),s=a.getVerticalLine(r,t),l=o.len;null==l&&(l=a.getDistance(o.startPoint,o.endPoint));var h=a.getIntersectionPoint(s,r),p=_.getNewPosForSymbol(h,n,e);null!=p&&p.state&&(a.dotPoints(o.startPoint,o.endPoint,p.position1,p.position2)>0?(a.clonePoint(o.startPoint,p.position1),a.clonePoint(o.endPoint,p.position2)):(a.clonePoint(o.endPoint,p.position1),a.clonePoint(o.startPoint,p.position2)),o.parent!=n&&_.changeSymbolForBelong(e,n),o.setOpenSide(t),o.setPoints2d(),_.setPosition3d(o))},E.prototype.moveSymbolPoint=function(t,e,n){var o=_.moveSymbolSinglePoint(t,e,n);if(null==o)return null;var i=J.getSymbol(e),s={x:(i.startPoint.x+i.endPoint.x)/2,y:(i.startPoint.y+i.endPoint.y)/2},l=a.getDistance(s,o.position);if(lr.maxSymbolLen)return null;var h=J.getWall(i.parent),p=J.getPoint(h.start),c=J.getPoint(h.end);if(n==m){var u=_.getNewForContainSymbols(i.endPoint,o.position,i.parent,e);if(null==u||u.collision)return null;B.isContain(h,o.position)?_.setPosition(i,o.position,"start"):a.getDistance(i.startPoint,p)-1&&t.children.splice(n,1),J.getSymbol(e).parent=null}},R.prototype.deleteSymbol=function(t){var e=J.getSymbol(t);if(e.parent){var n=J.getWall(e.parent);this.deleteSymbolForWall(n,t)}J.deleteSymbol(t)},R.prototype.changeSymbolForBelong=function(t,e){var n=J.getSymbol(t),o=n.parent,i=J.getWall(o);this.deleteSymbolForWall(i,t),n.setSymbolParent(e);var r=J.getWall(e);B.addChildren(r,t)},R.prototype.reBelongForSplitWall=function(t,e,n){for(var o=J.getWall(t),i=0;iu){if(v[w].vectorId==v[w+1].vectorId&&v[w].type!=h)return{position1:y,position2:g,collision:!0,state:!1};if(v[w].vectorId==v[w+1].vectorId&&v[w].type==h)return{position1:y,position2:g,collision:!0,state:!0};if(!a.isContainForSegment(y,v[w],v[w+1])||!a.isContainForSegment(g,v[w],v[w+1]))return{position1:y,position2:g,collision:!0,state:!1}}else{if(a.getDistance(v[w],v[w+1])u&&(e=u)}var d=a.getParallelLineForDistance(l,e/2),y=a.getIntersectionPoint(d.line1,r),g=a.getIntersectionPoint(d.line2,r),f={};a.getDistance(o,y)Math.min(P,v)&&(Pa.getDistance(p.endPoint,d)?(d=null,g=null):c=Math.min(P,v));var I=a.getDistance(p.endPoint,m.startPoint),S=a.getDistance(p.endPoint,m.endPoint);u>Math.min(I,S)&&(Ia.getDistance(p.startPoint,y)?(y=null,f=null):u=Math.min(I,S))}return n&&(null==d&&(a.getDistance(s,p.startPoint)>a.getDistance(s,p.endPoint)?(d=l,g=l):(d=s,g=s)),null==y&&(a.getDistance(s,p.startPoint)>a.getDistance(s,p.endPoint)?(y=s,f=s):(y=l,f=l))),{startPosition:d,startPosition2:g,endPosition:y,endPosition2:f}},R.prototype.moveSymbolSinglePoint=function(t,e,n){var o=J.getSymbol(e),i=a.createLine1(o.startPoint,o.endPoint),r=a.getVerticalLine(i,t);t=a.getIntersectionPoint(r,i);var s={x:(o.startPoint.x+o.endPoint.x)/2,y:(o.startPoint.y+o.endPoint.y)/2},l=J.getWall(o.parent),h=J.getPoint(l.start),p=J.getPoint(l.end);if("start"==n){if(!a.PointInSegment(s,t,o.endPoint))return null;a.getDistance(o.startPoint,h)a.getDistance(h,s)&&a.clonePoint(t,h):a.getDistance(t,s)>a.getDistance(p,s)&&a.clonePoint(t,p)}else if("end"==n){if(!a.PointInSegment(s,t,o.startPoint))return null;a.getDistance(o.endPoint,p)a.getDistance(p,s)&&a.clonePoint(t,p):a.getDistance(t,s)>a.getDistance(h,s)&&a.clonePoint(t,h)}return{dir:n,position:t}},R.prototype.setSymbolInfo=function(t){var e=J.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},R.prototype.setEnterImg=function(t){this.enterImg=t},R.prototype.getEnterImg=function(){return this.enterImg},R.prototype.createSymbolFromPanorama=function(t,e,n){var o=[],i={x:t.ray.origin.x,y:-1*t.ray.origin.z},r=J.getWalls();for(var s in r){var l=J.getWall(s),h=J.getPoint(l.start),p=J.getPoint(l.end),c=a.raySegmentIntersection(i,t.ray.direction,h,p);null!=c&&o.push({wallId:s,join:c})}if(o.length>0){function t(t,e){return a.getDistance(i,t.join)-a.getDistance(i,e.join)}o=o.sort(t.bind(this));var u=this.addSymbol(o[0].join,e,o[0].wallId);return null!=u?(A.moveFullSymbol(o[0].join,u,o[0].wallId),J.getSymbol(u),u):(console.error("漫游模式下添加门/窗:门/窗区域太小,加不上"),null)}return console.error("漫游模式下添加门/窗:没有与任何墙相交"),null};var _=new R,j=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};j.prototype.init=function(t){var e=J.getBoundingBox();this.setCenter(e),this.updateForCanvas(t)},j.prototype.setInitInfo=function(t,e,n){null==this.initRes&&(this.initRes=t),null==this.initWidth&&(this.initWidth=e),null==this.initHeight&&(this.initHeight=n)},j.prototype.updateResForReSize=function(t,e,n){Math.abs(n)<.01||Math.abs(n-2*Math.PI)<.01?this.res=this.initRes*t/this.initWidth:this.res=this.initRes*e/this.initHeight,r.minRealDis=r.minPixDistance/this.res*r.defaultZoom/this.zoom,r.minAdsorb=r.minPixLen/this.res*r.defaultZoom/this.zoom},j.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}))},j.prototype._setDefaultCenter=function(t){this.defaultCenter={x:t.x,y:t.y}},j.prototype.setDefaultCenter=function(t){this.defaultCenter={x:t.x,y:-t.z}},j.prototype._setRes=function(t){this.res=t,r.minRealDis=r.minPixDistance/this.res*r.defaultZoom/this.zoom,r.minAdsorb=r.minPixLen/this.res*r.defaultZoom/this.zoom},j.prototype.setRes=function(t,e){this.res=this.width/Math.abs(e-t),r.minRealDis=r.minPixDistance/this.res*r.defaultZoom/this.zoom,r.minAdsorb=r.minPixLen/this.res*r.defaultZoom/this.zoom},j.prototype.getScreenXY=function(t){if(null==this.width||null==this.height)return null;var e=t.x,n=t.y,o=this.width/2+(e-this.center.x)*this.res*this.zoom/100,i=this.height/2-(n-this.center.y)*this.res*this.zoom/100;return o=.5+(o*=this.ratio)<<0,i=.5+(i*=this.ratio)<<0,{x:Math.floor(o),y:Math.floor(i)}},j.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},j.prototype.getPointForRevRotate=function(t,e){if(Math.abs(e)<.01||Math.abs(e-2*Math.PI)<.01)return t;var n=(t.x-this.center.x)*Math.cos(e)-(t.y-this.center.y)*Math.sin(e)+this.center.x,o=(t.y-this.center.y)*Math.cos(e)+(t.x-this.center.x)*Math.sin(e)+this.center.y;return t.x=n,t.y=o,t},j.prototype.getVectorForRotate=function(t,e){if(e=-e,Math.abs(e)<.01||Math.abs(e-2*Math.PI)<.01)return t;var n=(t.x-this.center.x)*Math.cos(e)-(t.y-this.center.y)*Math.sin(e)+this.center.x,o=(t.y-this.center.y)*Math.cos(e)+(t.x-this.center.x)*Math.sin(e)+this.center.y;return t.x=n,t.y=o,t},j.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),n=this.center.y*Math.cos(t)+this.center.x*Math.sin(t);return this.center.x=e,this.center.y=n,this.center}},j.prototype.updateForCanvas=function(t){t&&(this.width=t.clientWidth,this.height=t.clientHeight,t.width=t.clientWidth,t.height=t.clientHeight)},j.prototype.updateZoom=function(t){this.zoom=t,r.minRealDis=r.minPixDistance/this.res*r.defaultZoom/this.zoom,r.minAdsorb=r.minPixLen/this.res*r.defaultZoom/this.zoom},j.prototype.moveTo=function(t,e){var n=this.getXYFromScreen(e);this.zoom=t;var o=(100*e.x/this.zoom-this.width/2)/this.res,i=(this.height/2-100*e.y/this.zoom)/this.res;this.center.x=n.x-o,this.center.y=n.y-i},j.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},j.prototype.getScreenInfoForCAD=function(){var t=this.getXYFromScreen({x:this.width,y:this.height}),e=this.getXYFromScreen({x:0,y:0}),n={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:n.x,y:n.y},defaultCenter:this.defaultCenter}},j.prototype.getPixelRatio=function(t){var e=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/e},j.prototype.reSet=function(){this.center={x:this.defaultCenter.x,y:this.defaultCenter.y},this.zoom=100},j.prototype.updateForRotate=function(t){void 0===t&&(t=Math.PI/2);for(var e=0;eo.floors[s].boundingBox.minX)&&(e=o.floors[s].boundingBox.minX),(null==n||no.floors[s].boundingBox.minY)&&(i=o.floors[s].boundingBox.minY),(null==r||rs.minX)&&(t=s.minX),(null==e||e>s.minY)&&(e=s.minY),(null==n||na.x)&&(n=a.x),(null==o||oa.y)&&(i=a.y),(null==r||rh)&&(n=h),(void 0===r||rp)&&(i=p),(void 0===s||s=h&&e[c].x<=p)continue;(h=Math.min(h,e[c].x))!=(p=Math.max(p,e[c].x))&&this.measureLines.top.push({x:e[c].x,y:this.region.top})}e=this.measureLines.top.sort(T.bind(this)),this.measureLines.top=[],this.measureLines.top.push(e[0]);for(var u=0;u=h&&n[g].x<=p)continue;(h=Math.min(h,n[g].x))!=(p=Math.max(p,n[g].x))&&this.measureLines.bottom.push({x:n[g].x,y:this.region.bottom})}n=this.measureLines.bottom.sort(T.bind(this)),this.measureLines.bottom=[],this.measureLines.bottom.push(n[0]);for(var f=0;f=h&&o[P].y<=p)continue;(h=Math.min(h,o[P].y))!=(p=Math.max(p,o[P].y))&&this.measureLines.left.push({x:this.region.left,y:o[P].y})}o=this.measureLines.left.sort(F.bind(this)),this.measureLines.left=[],this.measureLines.left.push(o[0]);for(var v=0;v=h&&i[b].y<=p)continue;(h=Math.min(h,i[b].y))!=(p=Math.max(p,i[b].y))&&this.measureLines.right.push({x:this.region.right,y:i[b].y})}i=this.measureLines.right.sort(F.bind(this)),this.measureLines.right=[],this.measureLines.right.push(i[0]);for(var w=0;w=o})).reduce((function(t,e){return e.fromBase(n)=1?e:t}));return a?[a.fromBase(n),a]:void 0},Z.prototype.getMostRelevantMeasurement2=function(t,e,n,o){void 0===o&&(o=0);var i=[],r=G.getUnitsOfMeasurementByDomainAndSystem(t,e);for(var s in r)i.push(r[s]);var a=i.filter((function(t){return t.factor>=o})).reduce((function(t,e){return e.toBase(n)=1?e:t}));return a?[a.toBase(n),a]:void 0},Z.prototype.convertBack=function(t,e,n,o,i){if(void 0===n&&(n=2),!t)return"";t=t.trim().replace(",","");var r=G.getDefaultUnitByDomainAndSystem(e,"metric"),s=this.getMostRelevantMeasurement2(e,o,t,i);return this.getFormattedMeasurementString(s[0],r,n)};var q=new Z,Q=function(){};Q.prototype.createTag=function(t,e,n){var o=new U(t,e);return o.setPoints2d(),J.addTag(o,n),o},Q.prototype.setTagInfo=function(t){var e=J.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},Q.prototype.deleteTag=function(t,e){J.deleteTag(t,e)},Q.prototype.clearDefaultTags=function(){for(var t=0;tr.x||n.x===r.x&&n.y>r.y)&&(n={x:r.x,y:r.y},o=i)}return o},nt.prototype.createPolygon=function(t,e,n){if(0!==Object.keys(n).length&&0!==Object.keys(e).length){this.matrix={};var o=[];this.preHandle(n,e);var i=Object.keys(e).length;if(0!==Object.keys(n).length&&0!==Object.keys(e).length){null!==t&&n[t]||(t=this.getStartPoint(n)),o.push(t);var r=this.getNextForMinAngleX(t,n,e);if(null!==r){o.push(r);var s=this.getMaxPolygon(o,n,e);this.checkPolygonSegmentIds(s,n,e);var a=this.splitPolygon(s);if(a){var l=this.getPolygonData(a,n,e),h=Object.keys(l.points),p=Object.keys(l.segments);if(l.segments=this.getChildSegments(l.points,l.segments,e),this.createPolygon(a[0],l.segments,l.points),this.updateMartix2(h,p,n,e),this.preHandle(n,e),0===Object.keys(n).length||0===Object.keys(e).length)return;this.createPolygon(t,e,n)}else if(0!==Object.keys(n).length&&0!==Object.keys(e).length){this.maxPolygons.push(s),this.updateMartix(s,n,e),n[t]||(t=this.getStartPoint(n),r=this.getNextForMinAngleX(t,n,e));var c=[];c.push(t),c.push(r);var u=this.getMinPolygon(c,n,e);if(this.checkPolygonSegmentIds(u,n,e),a=this.splitPolygon(u)){var d=this.getPolygonData(a,n,e),y=Object.keys(d.points),g=Object.keys(d.segments);if(this.createPolygon(a[0],d.segments,d.points),this.updateMartix2(y,g,n,e),this.preHandle(n,e),0===Object.keys(n).length||0===Object.keys(e).length)return;this.createPolygon(t,e,n)}else if(0!==s.length&&0!==u.length){if(this.addPolygon(u,n,e)){var f=u.slice(0);if(f.push(u[0]),this.updateMartix(f,n,e),this.preHandle(n,e),0===Object.keys(n).length||0===Object.keys(e).length)return}if(i===Object.keys(e).length){this.addPolygon(s,n,e);var x=s.slice(0);if(x.push(s[0]),this.updateMartix(x,n,e),this.updateMartix(x,n,e),this.preHandle(n,e),0===Object.keys(n).length||0===Object.keys(e).length)return}var m=this.getStartPoint(n,t);this.createPolygon(m,e,n)}else console.error("createPolygon——————————————————————————————————————————————————————————————出错!")}}}}},nt.prototype.splitPolygon=function(t){for(var e=[],n=0;n-1||p.indexOf(u)>-1)){var d=e[u];if(a.isPointInPoly(d,r)){p.push(u);var y=d.parent;for(var g in y)if(n[g]&&!i[g]&&-1===c.indexOf(g)){var f=null;n[g].start===u?f=n[g].end:n[g].end===u&&(f=n[g].start);var x=e[f];t.indexOf(f)>-1||p.indexOf(f)>-1?c.push(g):a.isPointInPoly(x,r)&&(c.push(g),p.push(f))}}}for(var m=0;mp)&&(r=p,s=i[l])}}return s},nt.prototype.getNextForMaxMinAngle=function(t,e,n,o){var i=n[t],r=n[e];i&&r||console.error("getNextForMaxMinAngle******************************************");for(var s=r.x-i.x,l=r.y-i.y,h={x:r.x+s,y:r.y+l},p=this.getAllLinkedPoint(e,n,o),c=null,u=null,d=null,y=null,g=0;gx)&&(d=x,y=p[g])}}return{max:u,min:y}},nt.prototype.updateMartix=function(t,e,n){for(var o=0;o1)continue;delete t[o]}}return n},nt.prototype.getPoint=function(t,e){return e[t]},nt.prototype.isClockwise=function(t,e){for(var n=[],o=0;o-1))for(var a=t[s],l=e[a.start],h=e[a.end],p=0;p-1||this.containPoint(d,l))&&(c=!0),(d.pointIds.indexOf(a.end)>-1||this.containPoint(d,h))&&(u=!0),c&&u&&d.childrenSegmentIds.push(s)}},nt.prototype.isContain=function(t,e){for(var n=[],o=[],i=0;i-1&&(e=e.concat(i.pointIds),n=n.concat(i.segmentIds))}for(var r={},s={},a=0;a-1){e.splice(a,1),--a;break}this.getChildMaxPolygons(t,e)}else if(1===e.length){var p=this.getPolygon(e[0]);t.caves.push(p.pointIds)}},nt.prototype.getPolygon=function(t){for(var e=0;eMath.PI/2&&(a.add(p.clone().multiplyScalar(r.distanceTo(s))),p.multiplyScalar(-1)),a.add(p.clone().multiplyScalar(-.5));var c={Position:new THREE.Vector3(a.x,-a.z,a.y),Direction:new THREE.Vector3(p.x,-p.z,p.y)};this.ajkJson.Entrance=c}},dt.prototype.getSceneName=function(){var t=this.app.store.getValue("metadata");this.ajkJson.scene_name=t.title},dt.prototype.getPictureRotate=function(){var t=J.getAngle(),e=new THREE.Euler(0,t,0),n=new THREE.Vector3(0,0,-1);n.applyEuler(e),n=new THREE.Vector3(n.x,-n.z,n.y),this.ajkJson.picture_rotate=n},dt.prototype.getFootPoint=function(t,e,n,o){var i=t.clone().sub(e),r=e.clone().sub(n),s=r.length(),a=i.dot(r)/s,l=e.clone().add(r.multiplyScalar(a/s));return o&&l.clone().sub(e).dot(l.clone().sub(n))>0&&(l=l.distanceTo(e)