1 line
988 B
JavaScript
1 line
988 B
JavaScript
import{addRegisterMxDbEntity}from"../../tools/registerMxDbEntity";import MxDbEntity from"../MxDbEntity";import drawMxDbPolyline from"./draw";class MxDbPolyline extends MxDbEntity{constructor(){super(...arguments),this.points=[]}getTypeName(){return"MxDbPolyline"}worldDraw(t){this.points.length<2||t.drawLines(this.points)}getGripPoints(){return this.points}moveGripPointsAt(t,i){return!(t>=this.points.length)&&(this.points[t].add(i),!0)}create(){return new MxDbPolyline}dwgIn(t){this.onDwgIn(t);let i=t.points;return this.points=[],i.forEach(t=>{this.points.push(new THREE.Vector3(t.x,t.y,t.z))}),!0}dwgOut(t){return this.onDwgOut(t),t.points=this.points,t}addVertexAt(t){this.points.push(t)}numVerts(){return this.points.length}getPointAt(t){return t<this.points.length?this.points[t]:null}setPointAt(t,i){return t<this.points.length&&(this.points[t]=i,!0)}}MxDbPolyline.cmd="Mx_Lines",MxDbPolyline.draw=drawMxDbPolyline,addRegisterMxDbEntity(MxDbPolyline);export default MxDbPolyline; |