mxdraw 0.1.99 → 0.1.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(exports,"__esModule",{value:!0});var three_1=require("three"),MxDbEntity_1=require("../MxDbEntity"),McGiWorldDrawType_1=require("../McGiWorldDrawType"),MxDbCloudLine=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.points=[],e.radius=16,e.drawGeometry=null,e}return __extends(e,t),e.prototype.getTypeName=function(){return"MxDbCloudLine"},e.prototype.create=function(){return new e},e.prototype.setRadius=function(t){this.radius=t,this.drawGeometry=null},e.prototype.getRadius=function(){return this.radius},e.prototype.clacNewArcDiameterPoint=function(t){if(0==this.points.length)return t;var e=this.points[this.points.length-1],r=2*this.radius,n=e.distanceTo(t);if(n<r)return null;var o=r*(t.x-e.x)/n+e.x,i=r*(t.y-e.y)/n+e.y;return new three_1.Vector3(o,i,e.z)},e.prototype.createCloudArcCurvePoints=function(t,e,r){var n=new three_1.Vector3((t.x+e.x)/2,(t.y+e.y)/2,0);r||(r=n.distanceTo(t));var o,i,s,a,u=(o=n,i=t,s=e,a=2*Math.PI/360,{startAngle:180*Math.atan2(i.y-o.y,i.x-o.x)/Math.PI*a,endAngle:180*Math.atan2(s.y-o.y,s.x-o.x)/Math.PI*a}),h=u.startAngle,y=u.endAngle;return new three_1.ArcCurve(n.x,n.y,r,h,y,!0).getPoints(10)},e.prototype.addPoint=function(t,e){var r=this.clacNewArcDiameterPoint(t);if(r)if(this.points.push(r),e){if(this.points.length<2)return;var n=this.points[this.points.length-2],o=this.createCloudArcCurvePoints(n,r),i=this.drawGeometry;i||(i=new three_1.Geometry),o.forEach(function(t){null===i||void 0===i||i.vertices.push(new three_1.Vector3(t.x,t.y,0))}),this.drawGeometry=new three_1.Geometry,this.drawGeometry.vertices=i.vertices}else this.drawGeometry=null},e.prototype.addLine=function(t,e){this.addPoint(t);for(var r=2*this.radius,n=this.points[this.points.length-1],o=n.distanceTo(e),i=Math.round(o/r),s=0;s<i;s++){o=n.distanceTo(e);var a=r*(e.x-n.x)/o+n.x,u=r*(e.y-n.y)/o+n.y,h=new three_1.Vector3(a,u,e.z);this.addPoint(h),n=h}return this.points[this.points.length-1]},e.prototype.reCalculateDrawGeometry=function(){var t=this;if(this.drawGeometry=new three_1.Geometry,!(this.points.length<2))for(var e=this.points[0],r=this.points.length,n=1;n<r;n++){var o=this.points[n];this.createCloudArcCurvePoints(e,o).forEach(function(e){var r;null===(r=t.drawGeometry)||void 0===r||r.vertices.push(new three_1.Vector3(e.x,e.y,0))}),e=o}},e.prototype.worldDraw=function(t){var e;if(t.getType()===McGiWorldDrawType_1.default.kSelectDraw){if(!this.drawGeometry)return;this.drawGeometry.computeBoundingBox();var r=new three_1.Vector3;this.drawGeometry.boundingBox.getSize(r);var n=new three_1.Vector3;this.drawGeometry.boundingBox.getCenter(n);var o=r.x/2,i=r.y/2,s={x:n.x-o,y:n.y-i},a={x:n.x+o,y:n.y-i},u={x:n.x+o,y:n.y+i},h={x:n.x-o,y:n.y+i};t.drawLine(s.x,s.y,a.x,a.y),t.drawLine(a.x,a.y,u.x,u.y),t.drawLine(u.x,u.y,h.x,h.y),t.drawLine(h.x,h.y,s.x,s.y)}else{if(this.drawGeometry||this.reCalculateDrawGeometry(),0==(null===(e=this.drawGeometry)||void 0===e?void 0:e.vertices.length))return;var y=t.getColor(),c=new three_1.LineBasicMaterial({color:y,transparent:!0,depthTest:!1}),p=new three_1.Line(this.drawGeometry,c);t.drawEntity(p)}},e.prototype.getCenter=function(){var t=new three_1.Geometry;t.vertices=this.points;var e=new three_1.Vector3;return t.computeBoundingBox(),t.boundingBox.getCenter(e),e},e.prototype.getGripPoints=function(){return[this.getCenter()]},e.prototype.moveGripPointsAt=function(t,e){return this.points.forEach(function(t){t.add(e)}),this.drawGeometry=null,!0},e.prototype.dwgIn=function(t){var e=this;this.onDwgIn(t);var r=t.points;return this.points=[],r.forEach(function(t){e.points.push(new three_1.Vector3(t.x,t.y,t.z))}),this.drawGeometry=null,this.radius=t.radius,!0},e.prototype.dwgOut=function(t){return this.onDwgOut(t),t.points=this.points,t.radius=this.radius,t},e}(MxDbEntity_1.default);exports.default=MxDbCloudLine;
1
+ "use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(exports,"__esModule",{value:!0});var three_1=require("three"),MxDbEntity_1=require("../MxDbEntity"),McGiWorldDrawType_1=require("../McGiWorldDrawType"),MxDbCloudLine=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.points=[],e.radius=16,e.drawGeometry=null,e}return __extends(e,t),e.prototype.getTypeName=function(){return"MxDbCloudLine"},e.prototype.create=function(){return new e},e.prototype.setRadius=function(t){this.radius=t,this.drawGeometry=null},e.prototype.getRadius=function(){return this.radius},e.prototype.clacNewArcDiameterPoint=function(t){if(0==this.points.length)return t;var e=this.points[this.points.length-1],r=2*this.radius,n=e.distanceTo(t);if(n<r)return null;var o=r*(t.x-e.x)/n+e.x,i=r*(t.y-e.y)/n+e.y;return new three_1.Vector3(o,i,e.z)},e.prototype.createCloudArcCurvePoints=function(t,e,r){var n=new three_1.Vector3((t.x+e.x)/2,(t.y+e.y)/2,0);r||(r=n.distanceTo(t));var o,i,s,a,u=(o=n,i=t,s=e,a=2*Math.PI/360,{startAngle:180*Math.atan2(i.y-o.y,i.x-o.x)/Math.PI*a,endAngle:180*Math.atan2(s.y-o.y,s.x-o.x)/Math.PI*a}),h=u.startAngle,y=u.endAngle;return new three_1.ArcCurve(n.x,n.y,r,h,y,!0).getPoints(10)},e.prototype.addPoint=function(t,e){var r=this.clacNewArcDiameterPoint(t);if(r)if(this.points.push(r),e){if(this.points.length<2)return;var n=this.points[this.points.length-2],o=this.createCloudArcCurvePoints(n,r),i=this.drawGeometry;i||(i=new three_1.Geometry),o.forEach(function(t){null===i||void 0===i||i.vertices.push(new three_1.Vector3(t.x,t.y,0))}),this.drawGeometry=new three_1.Geometry,this.drawGeometry.vertices=i.vertices}else this.drawGeometry=null},e.prototype.addLine=function(t,e){this.addPoint(t);for(var r=2*this.radius,n=this.points[this.points.length-1],o=n.distanceTo(e),i=Math.round(o/r),s=0;s<i;s++){o=n.distanceTo(e);var a=r*(e.x-n.x)/o+n.x,u=r*(e.y-n.y)/o+n.y,h=new three_1.Vector3(a,u,e.z);this.addPoint(h),n=h}return this.points[this.points.length-1]},e.prototype.reCalculateDrawGeometry=function(){var t=this;if(this.drawGeometry=new three_1.Geometry,!(this.points.length<2))for(var e=this.points[0],r=this.points.length,n=1;n<r;n++){var o=this.points[n];this.createCloudArcCurvePoints(e,o).forEach(function(e){var r;null===(r=t.drawGeometry)||void 0===r||r.vertices.push(new three_1.Vector3(e.x,e.y,0))}),e=o}},e.prototype.worldDraw=function(t){var e;if(t.getType()===McGiWorldDrawType_1.default.kSelectDraw){if(!this.drawGeometry)return;this.drawGeometry.computeBoundingBox();var r=new three_1.Vector3;this.drawGeometry.boundingBox.getSize(r);var n=new three_1.Vector3;this.drawGeometry.boundingBox.getCenter(n);var o=r.x/2,i=r.y/2,s={x:n.x-o,y:n.y-i},a={x:n.x+o,y:n.y-i},u={x:n.x+o,y:n.y+i},h={x:n.x-o,y:n.y+i};t.drawLine(s.x,s.y,a.x,a.y),t.drawLine(a.x,a.y,u.x,u.y),t.drawLine(u.x,u.y,h.x,h.y),t.drawLine(h.x,h.y,s.x,s.y)}else{if(this.drawGeometry||this.reCalculateDrawGeometry(),0==(null===(e=this.drawGeometry)||void 0===e?void 0:e.vertices.length))return;t.drawGeometryLines(this.drawGeometry)}},e.prototype.getCenter=function(){var t=new three_1.Geometry;t.vertices=this.points;var e=new three_1.Vector3;return t.computeBoundingBox(),t.boundingBox.getCenter(e),e},e.prototype.getGripPoints=function(){return[this.getCenter()]},e.prototype.moveGripPointsAt=function(t,e){return this.points.forEach(function(t){t.add(e)}),this.drawGeometry=null,!0},e.prototype.dwgIn=function(t){var e=this;this.onDwgIn(t);var r=t.points;return this.points=[],r.forEach(function(t){e.points.push(new three_1.Vector3(t.x,t.y,t.z))}),this.drawGeometry=null,this.radius=t.radius,!0},e.prototype.dwgOut=function(t){return this.onDwgOut(t),t.points=this.points,t.radius=this.radius,t},e}(MxDbEntity_1.default);exports.default=MxDbCloudLine;