UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 1.13 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */ import{__decorate as e}from"tslib";import{createScreenPointArray as t}from"../../../core/screenUtils.js";import{subclass as r}from"../../../core/accessorSupport/decorators.js";import{equals as o}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{getEndpoint as s}from"../../../geometry/support/curves/curveUtils.js";import{SegmentLabels as n}from"../../interactive/SegmentLabels.js";let i=class extends n{getCameraOrExtent({view:e}){return e.extent}toScreenPointArray({view:e,editGeometryOperations:r},o,s=t()){const{coordinateHelper:n}=r.data,i=e.toScreen(n.arrayToPoint(o));return i&&(s[0]=i.x,s[1]=i.y),s}getRing(e,t,r,n,i){const a=[];for(const o of t.parts[i].iterateVertices())o.leftSegment?a.push(o.leftSegment.toCurveOrCoordinate()):a.push(o.pos);if(0===i&&null!=r&&a.push(n.vectorToArray(r)),a.length<2)return a;const c=a[0],m=a.at(-1),p=n.toXYZ(n.arrayToVector(s(c))),l=n.toXYZ(n.arrayToVector(s(m)));return"polygon"===e.type&&a.length>2&&!o(p,l)&&a.push(c),a}};i=e([r("esri.views.2d.interactive.SegmentLabels2D")],i);export{i as SegmentLabels2D};