@thibezer/ui-components-kit 2.32.0 → 2.33.0
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.
- package/CHANGELOG.md +18 -0
- package/dist/canvas.cjs +51 -51
- package/dist/canvas.js +1215 -1173
- package/dist/custom-elements.json +16776 -16776
- package/dist/feature_caixa-B_oDGhlM.cjs +1 -0
- package/dist/{feature_caixa-DdI35r81.js → feature_caixa-DlckNoPa.js} +139 -139
- package/dist/{feature_desenho-BcvJt7r_.cjs → feature_desenho-CB7QCWS3.cjs} +1 -1
- package/dist/{feature_desenho-BSuO-kdG.js → feature_desenho-CcUvlxIs.js} +1 -1
- package/dist/gerencigeo-canvas/feature_edicao_nos.d.ts +11 -0
- package/dist/gerencigeo-canvas/feature_edicao_ops.d.ts +1 -1
- package/dist/gerencigeo-canvas/feature_editor_vertices.d.ts +4 -0
- package/dist/prancha-nucleo.cjs +2 -2
- package/dist/prancha-nucleo.d.ts +2 -0
- package/dist/prancha-nucleo.js +44 -43
- package/dist/prancha.cjs +1 -1
- package/dist/prancha.js +2 -2
- package/package.json +1 -1
- package/dist/feature_caixa-BRZGJHTG.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var Et=Object.defineProperty;var It=(t,o,n)=>o in t?Et(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n;var j=(t,o,n)=>It(t,typeof o!="symbol"?o+"":o,n);const D=require("./feature_metricas-CnSFE0at.cjs"),O=require("./geometria-px-C4xatxmY.cjs"),Nt=111320;function Ot(t){const{lat:o,lng:n}=D.metrosPorGrau(t[0]),e=t[0],r=t[1],i=o,a=Math.max(n,1);return{paraXY:c=>[(c[1]-r)*a,(c[0]-e)*i],deXY:c=>[e+c[1]/i,r+c[0]/a]}}const I=Object.freeze({tipo:"geografico",unidade:"m",distancia:(t,o)=>D.distanciaMetros(t,o),comprimento:(t,o=!1)=>D.comprimentoMetros(t,o),area:t=>D.areaMetros2(t),planoLocal:Ot,deslocar(t,o,n){const e=D.metrosPorGrau(t[0]),r=n/e.lat,i=o/Math.max(e.lng,1);return[t[0]+r,t[1]+i]},pontoDaBorda(t,o){return[t[0],t[1]+o/Math.max(D.metrosPorGrau(t[0]).lng,1)]},pontoDeMedidaDoRaio:(t,o)=>[t[0]+o/Nt,t[1]],extremosDoCirculo:D.extremosDoCirculoGeografico,fatorEixo:t=>Math.cos(t[0]*Math.PI/180)||1});function ct(t,o){const n=e=>{let r=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){const[c,u]=e[i],[f,l]=e[a];c>t[0]!=f>t[0]&&t[1]<(l-u)*(t[0]-c)/(f-c)+u&&(r=!r)}return r};return!o[0]||!n(o[0])?!1:!o.slice(1).some(n)}function lt(t,o,n,e){const r=o[0]-t[0],i=o[1]-t[1],a=e[0]-n[0],c=e[1]-n[1],u=r*c-i*a;if(Math.abs(u)<1e-12)return null;const f=((n[0]-t[0])*c-(n[1]-t[1])*a)/u,l=((n[0]-t[0])*i-(n[1]-t[1])*r)/u;return f<0||f>1||l<0||l>=1?null:{t:f,u:l}}function z(t){let o=0;for(let n=0;n<t.length;n++){const[e,r]=t[n],[i,a]=t[(n+1)%t.length];o+=e*a-i*r}return Math.abs(o)/2}function bt(t,o,n=I){if(t.length<3||o.length<2)return null;const e=n.planoLocal(t[0]),r=_(t,e),i=_(o,e),a=ut(r,i,0);return a&&a.length>=2?a.map(c=>w(c,e)):null}function ut(t,o,n){if(n>8)return null;const e=t.length,r=[];for(let g=0;g<o.length-1;g++)for(let L=0;L<e;L++){const x=lt(o[g],o[g+1],t[L],t[(L+1)%e]);x&&r.push({tLinha:g+x.t,tAnel:L+x.u,ponto:[o[g][0]+x.t*(o[g+1][0]-o[g][0]),o[g][1]+x.t*(o[g+1][1]-o[g][1])]})}if(r.sort((g,L)=>g.tLinha-L.tLinha),r.length<2)return null;const[i,a]=r,c=[];for(let g=Math.floor(i.tLinha)+1;g<=Math.floor(a.tLinha);g++)g>i.tLinha&&g<a.tLinha&&c.push(o[g]);const u=[i.ponto,...c,a.ponto];let f=i,l=a,s=u;i.tAnel>a.tAnel&&(f=a,l=i,s=[...u].reverse());const h=Math.floor(f.tAnel),p=Math.floor(l.tAnel),P=s.slice(1,-1),d=[f.ponto];for(let g=h+1;g<=p;g++)d.push(t[g%e]);d.push(l.ponto,...[...P].reverse());const y=[l.ponto];for(let g=p+1;g<=h+e;g++)y.push(t[g%e]);y.push(f.ponto,...P);const S=z(t)*1e-9,v=[d,y].filter(g=>g.length>=3&&z(g)>S);if(v.length<2)return null;const m=[a.ponto,...o.slice(Math.floor(a.tLinha)+1)];if(r.length>2&&m.length>=2){const g=[];for(const L of v){const x=ut(L,m,n+1);x?g.push(...x):g.push(L)}return g}return v}function _(t,o){return t.map(n=>o.paraXY(n))}function w(t,o){return t.map(n=>o.deXY(n))}const E=(t,o)=>Math.hypot(t[0]-o[0],t[1]-o[1]);function _t(t,o=0,n=I){if(t.length===0||t.some(a=>a.length<2))return null;const e=n.planoLocal(t[0][0]),r=t.slice(1).map(a=>_(a,e));let i=_(t[0],e);for(;r.length>0;){let a=null;if(r.forEach((s,h)=>{const p=i[0],P=i[i.length-1],d=[{inverter:!1,noFim:!0,d:E(P,s[0])},{inverter:!0,noFim:!0,d:E(P,s[s.length-1])},{inverter:!1,noFim:!1,d:E(p,s[s.length-1])},{inverter:!0,noFim:!1,d:E(p,s[0])}];for(const y of d)(!a||y.d<a.d)&&(a={idx:h,...y})}),!a||a.d>o)return null;const{idx:c,inverter:u,noFim:f}=a;let l=r.splice(c,1)[0];u&&(l=[...l].reverse()),i=f?[...i,...E(i[i.length-1],l[0])>0?l:l.slice(1)]:[...l,...E(l[l.length-1],i[0])>0?i:i.slice(1)]}return w(i,e)}function Tt(t,o,n,e){const r=lt(t,o,n,e);return!!r&&r.t>1e-9&&r.t<1-1e-9&&r.u>1e-9}function Rt(t,o){for(let n=0;n<t.length;n++)for(let e=0;e<o.length;e++)if(Tt(t[n],t[(n+1)%t.length],o[e],o[(e+1)%o.length]))return!0;return!1}function Ft(t,o,n=0,e=I){if(t.length<3||o.length<3)return null;const r=e.planoLocal(t[0]),i=_(t,r),a=_(o,r);if(Rt(i,a))return null;let c={i:0,j:0,d:1/0};for(let s=0;s<i.length;s++)for(let h=0;h<a.length;h++){const p=E(i[s],a[h]);p<c.d&&(c={i:s,j:h,d:p})}if(c.d>n)return null;const{i:u,j:f}=c,l=[];for(let s=0;s<=i.length;s++)l.push(i[(u+s)%i.length]);for(let s=0;s<=a.length;s++)l.push(a[(f+s)%a.length]);return w(l,r)}const Q=16;function Z(t,o,n,e){const r=[];for(let i=0;i<=Q;i++){const a=n+(e-n)*i/Q;r.push([t[0]+o*Math.cos(a),t[1]+o*Math.sin(a)])}return r}function B(t,o){const n=E(t,o)||1;return[-(o[1]-t[1])/n,(o[0]-t[0])/n]}function H(t,o,n){const e=t.length,r=[],i=e;for(let a=0;a<i;a++){const c=n?t[(a-1+e)%e]:t[Math.max(0,a-1)],u=t[a],f=n?t[(a+1)%e]:t[Math.min(e-1,a+1)],l=a===0&&!n?B(u,f):B(c,u),s=a===e-1&&!n?B(c,u):B(u,f);let h=l[0]+s[0],p=l[1]+s[1];const P=Math.hypot(h,p);if(P<1e-9){r.push([u[0]+l[0]*o,u[1]+l[1]*o]);continue}h/=P,p/=P;const d=h*l[0]+p*l[1],y=Math.min(1/Math.max(d,.5),2);r.push([u[0]+h*o*y,u[1]+p*o*y])}return r}function ft(t){let o=0;for(let n=0;n<t.length;n++){const[e,r]=t[n],[i,a]=t[(n+1)%t.length];o+=(i-e)*(a+r)}return o>0}function kt(t,o,n=I){if(!Number.isFinite(o)||o===0)return null;if(t.tipo==="Point"||t.tipo==="Text"||t.tipo==="Circle"){const e=t.tipo==="Circle"?t.centro:t.coordenada,r=t.tipo==="Circle"?t.raioMetros+o:o;if(r<=0)return null;const i=n.planoLocal(e),a=64;return Array.from({length:a},(c,u)=>[r*Math.cos(2*Math.PI*u/a),r*Math.sin(2*Math.PI*u/a)]).map(c=>i.deXY(c))}if(t.tipo==="LineString"){if(o<0||t.coordenadas.length<2||D.ehMultilinha(t))return null;const e=n.planoLocal(t.coordenadas[0]),r=_(t.coordenadas,e),i=H(r,o,!1),a=H([...r].reverse(),o,!1),c=r[r.length-1],u=r[0],f=Math.atan2(c[1]-r[r.length-2][1],c[0]-r[r.length-2][0]),l=Math.atan2(u[1]-r[1][1],u[0]-r[1][0]),s=Z(c,o,f+Math.PI/2,f-Math.PI/2),h=Z(u,o,l+Math.PI/2,l-Math.PI/2);return w([...i,...s,...a,...h],e)}if(t.tipo==="Polygon"){const e=t.aneis[0];if(!e||e.length<3)return null;const r=n.planoLocal(e[0]);let i=_(e,r);ft(i)&&(i=[...i].reverse());const c=H(i,-o,!0);return c.length<3||o<0&&z(c)>=z(i)?null:w(c,r)}return null}function $(t,o,n,e){if(t.some(s=>!Number.isFinite(s[0])||!Number.isFinite(s[1])))return null;const r=t.filter((s,h)=>h===0||E(s,t[h-1])>=1e-9);e&&r.length>1&&E(r[0],r[r.length-1])<1e-9&&r.pop();const i=r.length;if(i<(e?3:2))return null;const a=n==="esquerda"?1:-1,c=e?i:i-1,u=[];for(let s=0;s<c;s++){const h=r[s],p=r[(s+1)%i],P=E(h,p);if(!Number.isFinite(P)||P<1e-9)return null;const d=-(p[1]-h[1])/P*o*a,y=(p[0]-h[0])/P*o*a;u.push([[h[0]+d,h[1]+y],[p[0]+d,p[1]+y]])}const f=(s,h,p)=>{const P=()=>[(s[1][0]+h[0][0])/2,(s[1][1]+h[0][1])/2],d=E(s[0],s[1]),y=E(h[0],h[1]),M=s[1][0]-s[0][0],S=s[1][1]-s[0][1],v=h[1][0]-h[0][0],m=h[1][1]-h[0][1],g=M*m-S*v;if(Math.abs(g)<1e-12||Math.asin(Math.min(1,Math.abs(g)/(d*y)))*(180/Math.PI)<1)return P();const L=((h[0][0]-s[0][0])*m-(h[0][1]-s[0][1])*v)/g,x=[s[0][0]+L*M,s[0][1]+L*S];return E(x,p)>Math.max(2.5*Math.abs(o),1)?P():x},l=[];if(e)for(let s=0;s<i;s++)l.push(f(u[(s-1+i)%i],u[s],r[s]));else{l.push(u[0][0]);for(let s=1;s<i-1;s++)l.push(f(u[s-1],u[s],r[s]));l.push(u[c-1][1])}if(e)for(let s=0;s<i;s++){const h=r[s],p=r[(s+1)%i],P=l[s],d=l[(s+1)%i];if((p[0]-h[0])*(d[0]-P[0])+(p[1]-h[1])*(d[1]-P[1])<=0)return null}return l}function Vt(t,o,n,e=I){if(!Number.isFinite(o)||o<=0)return null;if(t.tipo==="LineString"){if(D.ehMultilinha(t)||t.coordenadas.length<2)return null;const r=e.planoLocal(t.coordenadas[0]),i=$(_(t.coordenadas,r),o,n,!1);return i?{tipo:"LineString",coordenadas:w(i,r)}:null}if(t.tipo==="Polygon"){const r=t.aneis[0];if(!r||r.length<3||t.aneis.length>1)return null;const i=e.planoLocal(r[0]);let a=_(r,i);ft(a)&&(a=[...a].reverse());const c=$(a,o,n,!0);return c?{tipo:"Polygon",aneis:[w(c,i)]}:null}return null}function wt(t,o,n,e=I){const r=i=>e.deslocar(i,o,n);switch(t.tipo){case"Point":return{tipo:"Point",coordenada:r(t.coordenada)};case"Text":return{...t,coordenada:r(t.coordenada)};case"Circle":return{...t,centro:r(t.centro)};case"LineString":{const i=D.criarLinha(D.partesDaLinha(t).map(a=>a.map(r)));return t.curva?{...i,curva:O.moverNos(t.curva,r)}:i}case"Polygon":{const i={tipo:"Polygon",aneis:t.aneis.map(a=>a.map(r))};return t.curva?{...i,curva:O.moverNos(t.curva,r)}:i}}}const tt={m:1,km:1e3,ft:.3048,mi:1609.344},ot={m2:1,ha:1e4,km2:1e6,ac:4046.8564224,alqueire:24200};function Xt(t,o,n){return t*tt[o]/tt[n]}function jt(t,o,n){return t*ot[o]/ot[n]}function Gt(t,o,n=I){return n.distancia(t,o)}function qt(t,o,n){return{...t,id:o,geometria:n??JSON.parse(JSON.stringify(t.geometria)),estilo:t.estilo?{...t.estilo}:void 0,propriedades:{...t.propriedades}}}const ht=5e3;function J(t){return t.tipo==="Polygon"?3:t.tipo==="LineString"?2:1}function Yt(t,o=!1){if(t.bloqueada||o)return"bloqueada";const n=t.geometria;return n.tipo!=="Point"&&n.tipo!=="LineString"&&n.tipo!=="Polygon"&&n.tipo!=="Circle"?"tipo-nao-suportado":n.tipo==="Polygon"&&n.aneis.length!==1?"poligono-com-furos":D.ehMultilinha(n)?"multiparte":b(n).length>ht?"muitos-vertices":null}function b(t){return t.tipo==="Point"?[t.coordenada]:t.tipo==="LineString"?t.coordenadas:t.tipo==="Polygon"?t.aneis[0]??[]:[]}function Y(t,o){return t.tipo==="Point"?{tipo:"Point",coordenada:o[0]}:t.tipo==="LineString"?{tipo:"LineString",coordenadas:o}:t.tipo==="Polygon"?{tipo:"Polygon",aneis:[o]}:t}function Bt(t,o,n){const e=b(t).slice();return o<0||o>=e.length?t:(e[o]=n,Y(t,e))}function pt(t,o,n){if(t.tipo!=="LineString"&&t.tipo!=="Polygon")return t;const e=b(t).slice();return o<0||o>=e.length?t:(e.splice(o+1,0,n),Y(t,e))}function mt(t,o){if(t.tipo!=="LineString"&&t.tipo!=="Polygon")return null;const n=b(t);return o<0||o>=n.length||n.length<=J(t)?null:Y(t,n.filter((e,r)=>r!==o))}function K(t,o){return[(t[0]+o[0])/2,(t[1]+o[1])/2]}function dt(t){const o=b(t).length,n=[];if(t.tipo!=="LineString"&&t.tipo!=="Polygon")return n;for(let e=0;e<o-1;e++)n.push([e,e+1]);return t.tipo==="Polygon"&&o>2&&n.push([o-1,0]),n}function T(t){return(t.tipo==="LineString"||t.tipo==="Polygon")&&t.curva&&t.curva.length>=J(t)?t.curva:null}const gt=.5;function Pt(t,o,n=I){return n.pontoDaBorda(t,o)}function zt(t,o=I){var n;return t.tipo==="Circle"?[t.centro,Pt(t.centro,t.raioMetros,o)]:((n=T(t))==null?void 0:n.map(e=>e.ponto))??b(t)}function k(t,o){const n=t.tipo==="Polygon",e=O.amostrarCurva(o,n);return n?{tipo:"Polygon",aneis:[e],curva:o}:{tipo:"LineString",coordenadas:e,curva:o}}function Jt(t,o,n=I){if(t.tipo==="Circle")return o.length<2?t:{...t,centro:o[0],raioMetros:Math.max(gt,n.distancia(o[0],o[1]))};const e=T(t);if(!e||e.length!==o.length)return Y(t,o);const r=e.map((i,a)=>{const c=o[a][0]-i.ponto[0],u=o[a][1]-i.ponto[1],f=s=>[s[0]+c,s[1]+u],l={ponto:o[a]};return i.entrada&&(l.entrada=f(i.entrada)),i.saida&&(l.saida=f(i.saida)),i.modo&&(l.modo=i.modo),l});return k(t,r)}function X(t,o,n){return[t[0]+(o[0]-t[0])*n,t[1]+(o[1]-t[1])*n]}function Ut(t,o,n){const[e,r]=O.controlesDoSegmento(t,o);let i=.5,a=1/0;for(let c=1;c<64;c++){const u=c/64,f=O.pontoDaCubica(t.ponto,e,r,o.ponto,u),l=(f[0]-n[0])**2+(f[1]-n[1])**2;l<a&&(a=l,i=u)}return i}function yt(t,o,n){const e=T(t);if(!e){const a=b(t);return K(a[o],a[n])}const[r,i]=O.controlesDoSegmento(e[o],e[n]);return O.pontoDaCubica(e[o].ponto,r,i,e[n].ponto,.5)}function Mt(t){const o=T(t);if(!o)return dt(t);const n=[];for(let e=0;e<o.length-1;e++)n.push([e,e+1]);return t.tipo==="Polygon"&&o.length>2&&n.push([o.length-1,0]),n}function Ht(t,o,n){const e=T(t);if(!e)return pt(t,o,n);if(o<0||o>=e.length)return t;const r=(o+1)%e.length,i=e[o],a=e[r],c=i.saida===void 0&&a.entrada===void 0;let u,f=i,l=a;if(c)u={ponto:n};else{const h=Ut(i,a,n),[p,P]=O.controlesDoSegmento(i,a),d=X(i.ponto,p,h),y=X(p,P,h),M=X(P,a.ponto,h),S=X(d,y,h),v=X(y,M,h);u={ponto:X(S,v,h),entrada:S,saida:v,modo:"suave"},f={...i,saida:d},l={...a,entrada:M},O.tipoDoNo(i)==="simetrico"&&i.entrada&&(f.modo="suave"),O.tipoDoNo(a)==="simetrico"&&a.saida&&(l.modo="suave")}const s=e.slice();return s[o]=f,s[r]=l,s.splice(o+1,0,u),k(t,s)}function Wt(t,o){const n=T(t);return n?o<0||o>=n.length||n.length<=J(t)?null:k(t,n.filter((e,r)=>r!==o)):mt(t,o)}function U(t){return t.tipo!=="LineString"&&t.tipo!=="Polygon"?null:T(t)??b(t).map(o=>({ponto:[o[0],o[1]]}))}const Kt=40;function Qt(t,o,n){const e=U(t);if(!e||o<0||o>=e.length)return null;const r=t.tipo==="Polygon",i=e.length,a=n==="saida"?o<i-1?e[o+1]:r?e[0]:null:o>0?e[o-1]:r?e[i-1]:null;if(!a)return null;const c=e[o].ponto;return[c[0]+(a.ponto[0]-c[0])/3,c[1]+(a.ponto[1]-c[1])/3]}function Lt(t){const o=D.metrosPorGrau(t[0]);return{ref:t,mLat:Math.max(o.lat,1e-9),mLng:Math.max(o.lng,1e-9)}}const W=(t,o)=>[(o[1]-t.ref[1])*t.mLng,(o[0]-t.ref[0])*t.mLat],vt=(t,o,n)=>[t.ref[0]+n/t.mLat,t.ref[1]+o/t.mLng],Zt=t=>Array.isArray(t)&&t.length===2&&Number.isFinite(t[0])&&Number.isFinite(t[1]);function xt(t,o,n,e,r=!1){const i=O.tipoDoNo(t),a=r?"livre":i==="canto"?e:i,c=o==="saida"?"entrada":"saida",u={...t,[o]:n,modo:a};if(a==="simetrico")u[c]=O.espelhoDaAlca(t.ponto,n);else if(a==="suave"){const f=Lt(t.ponto),[l,s]=W(f,n),h=Math.hypot(l,s),p=t[c],[P,d]=p?W(f,p):[l,s],y=Math.hypot(P,d);h>0&&y>0&&(u[c]=vt(f,-(l/h)*y,-(s/h)*y))}return u}function $t(t,o,n,e,r=!0){const i=U(t);if(!i||o<0||o>=i.length||!Zt(e))return t;const a=i.slice();return a[o]=xt(i[o],n,e,"simetrico",!r),k(t,a)}function to(t,o){const n=U(t);if(!n||o<0||o>=n.length)return t;const e=n[o],r=n.slice();if(e.entrada||e.saida)return r[o]={ponto:e.ponto},k(t,r);const i=t.tipo==="Polygon",a=n.length,c=o>0?n[o-1]:i?n[a-1]:null,u=o<a-1?n[o+1]:i?n[0]:null;if(!c&&!u)return t;const f=e.ponto;if(c&&u){const P=u.ponto[0]-c.ponto[0],d=u.ponto[1]-c.ponto[1],y=Math.hypot(P,d),M=Math.hypot(u.ponto[0]-f[0],u.ponto[1]-f[1])/3,S=Math.hypot(f[0]-c.ponto[0],f[1]-c.ponto[1])/3;if(!(y>0)||!Number.isFinite(y))return t;const v=P/y,m=d/y;return r[o]={ponto:f,saida:[f[0]+v*M,f[1]+m*M],entrada:[f[0]-v*S,f[1]-m*S]},k(t,r)}const l=(u??c).ponto,s=u?1:-1,h=(l[0]-f[0])/3*s,p=(l[1]-f[1])/3*s;return r[o]={ponto:f,saida:[f[0]+h,f[1]+p],entrada:[f[0]-h,f[1]-p]},k(t,r)}const oo=128,no=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),eo="rgba(255,255,255,0.9)";function St(t){if(!t)return[];const o=t.split(/[\s,]+/).map(Number).filter(n=>Number.isFinite(n)&&n>=0);return o.length>0&&o.some(n=>n>0)?o.length%2===1?[...o,...o]:o:[]}const N=t=>Number.isFinite(t),ro=new Set(["marca","caixa","poligono","circulo","linha","ponto"]);function io(t){let o=0;if(t)for(const n of t.itens)ro.has(n.forma)&&o++;return o}class ao{constructor(o){j(this,"destaques",new Set);j(this,"destruido",!1);j(this,"ultima",{itens:0,marcas:0,preenchimentos:0,tracos:0,chamadas:0});j(this,"semTracejado",!1);this.alvos=o}definirTracejado(o){this.semTracejado=!o}destacar(o){this.destaques=new Set(o)}limpar(){const o=this.alvos.sobreposicao();o&&this.limparSuperficie(o)}destruir(){this.destruido=!0,this.destaques.clear()}desenhar(o,n,e={}){const r=this.desenharFatiado(o,n,e);return r.passo(Number.POSITIVE_INFINITY),r.estatisticas}desenharFatiado(o,n,e={},r=no){const i={itens:0,marcas:0,caixas:0,preenchimentos:0,tracos:0,chamadas:0};if(this.destruido||!o)return{passo:()=>!0,estatisticas:i};const a=e.alvo==="sobreposicao",c=n&&N(n.dpr)&&n.dpr>0?n.dpr:1,u=o.origem;let f=null,l=0,s=0,h=0,p=!1;const P=()=>{const y=[];if(a){const M=this.alvos.sobreposicao();M&&e.limpar!==!1&&this.limparSuperficie(M,c)}for(const M of o.camadas){const S=a?this.alvos.sobreposicao():this.alvos.camada(M.camadaId);S&&(!a&&e.limpar!==!1&&this.limparSuperficie(S,c),y.push({sup:S,lotes:this.lotesDaCamada(M,a,i)}))}return y};return{passo:y=>{if(p)return!0;if(this.destruido)return p=!0,!0;f??(f=P());const M=e.recorte;for(;l<f.length;){const{sup:S,lotes:v}=f[l],m=S.ctx;m.setTransform(c,0,0,c,0,0),M&&(m.save(),m.beginPath(),m.rect(M.x,M.y,M.largura,M.altura),m.clip());let g=!1;try{for(m.lineJoin="round",m.lineCap="round";s<v.length;){const L=v[s],x=this.pintorDoLote(m,L,u,i,h===0);if(!x){s++,h=0;continue}const A=L.itens.length;for(;h<A;){const C=Math.min(A,h+oo);for(;h<C;h++)x(L.itens[h]);if(h<A&&r()>=y){g=!0;break}}if(g)break;if(s++,h=0,s<v.length&&r()>=y){g=!0;break}}g||(m.globalAlpha=1,m.setLineDash([]),m.lineDashOffset=0)}finally{M&&m.restore()}if(g)return!1;l++,s=0,h=0}return p=!0,this.ultima=i,!0},estatisticas:i}}limparSuperficie(o,n){const e=n??o.dpr;o.ctx.setTransform(1,0,0,1,0,0),o.ctx.clearRect(0,0,Math.ceil(o.largura*e),Math.ceil(o.altura*e)),o.ctx.setTransform(e,0,0,e,0,0)}lotesDaCamada(o,n,e){const r=[],i=[],a=[],c=[],u=[];for(const s of o.itens)switch(s.forma){case"marca":r.push(s);break;case"caixa":i.push(s);break;case"poligono":case"circulo":a.push(s);break;case"linha":c.push(s);break;case"ponto":u.push(s);break}e.itens+=r.length+i.length+a.length+c.length+u.length;const f=[];if(n){const s=[];for(const h of[a,c,u])for(const p of h)(p.destaque||this.destaques.has(p.id))&&s.push(p);s.length>0&&f.push({tipo:"halo",estilo:null,itens:s})}const l=(s,h)=>{for(const[p,P]of this.agrupar(h))f.push({tipo:s,estilo:p,itens:P})};return l("marca",r),l("caixa",i),l("area",a),l("linha",c),l("area",u),f}agrupar(o){const n=new Map;for(const e of o){const r=n.get(e.estilo);r?r.push(e):n.set(e.estilo,[e])}return n}pintorDoLote(o,n,e,r,i){const a=n.estilo;if(n.tipo==="halo")return s=>this.halo(o,s,e,r);if(!a)return null;if(n.tipo==="marca")return o.fillStyle=a.corPreenchimento,o.globalAlpha=a.opacidadePreenchimento,i&&(r.chamadas+=2),s=>{const h=s.geometriaEmPx[0];if(!h)return;const p=h[0]-e.x,P=h[1]-e.y;if(!(N(p)&&N(P)))return;const d=s.raioPx>=2?2:1;o.fillRect(Math.round(p-d/2),Math.round(P-d/2),d,d),r.marcas++,r.chamadas++};if(n.tipo==="caixa"){const s=a.traco&&a.peso>0,h=a.preencher&&a.opacidadePreenchimento>0;if(!s&&!h)return null;o.fillStyle=s?a.cor:a.corPreenchimento,o.globalAlpha=s?a.opacidadeTraco??1:a.opacidadePreenchimento;const p=s?a.peso/2:0;return i&&(r.chamadas+=2),P=>{const d=P.geometriaEmPx[0];if(!d||d.length<4)return;const y=Math.floor(d[0]-e.x-p),M=Math.floor(d[1]-e.y-p),S=Math.ceil(d[2]-e.x+p),v=Math.ceil(d[3]-e.y+p);N(y)&&N(M)&&N(S)&&N(v)&&(o.fillRect(y,M,Math.max(1,S-y),Math.max(1,v-M)),r.caixas=(r.caixas??0)+1,r.chamadas++)}}const c=n.tipo==="area"&&a.preencher&&a.opacidadePreenchimento>0,u=a.traco&&a.peso>0;if(!c&&!u)return null;c&&(o.fillStyle=a.corPreenchimento),u&&(o.strokeStyle=a.cor,o.lineWidth=a.peso,o.setLineDash(this.semTracejado?[]:St(a.dash)),o.lineDashOffset=this.semTracejado?0:a.deslocamentoDash??0,o.lineCap=a.terminacao??"round",o.lineJoin=a.juncao??"round"),i&&(r.chamadas+=3);const f=a.opacidadePreenchimento,l=a.opacidadeTraco??1;return s=>{o.beginPath(),this.caminho(o,s,e),c&&(o.globalAlpha=f,o.fill(),r.preenchimentos++,r.chamadas++),u&&(o.globalAlpha=l,o.stroke(),r.tracos++,r.chamadas++)}}caminho(o,n,e){if(n.forma==="circulo"||n.forma==="ponto"){const i=n.geometriaEmPx[0];if(!i)return;const a=i[0]-e.x,c=i[1]-e.y;N(a)&&N(c)&&N(n.raioPx)&&(o.moveTo(a+n.raioPx,c),o.arc(a,c,n.raioPx,0,Math.PI*2));return}const r=n.forma==="poligono";for(const i of n.geometriaEmPx){const a=i.length>>1;if(a<2)continue;let c=!1;for(let u=0;u<a;u++){const f=i[u*2]-e.x,l=i[u*2+1]-e.y;N(f)&&N(l)&&(c?o.lineTo(f,l):(o.moveTo(f,l),c=!0))}c&&r&&o.closePath()}}halo(o,n,e,r){o.strokeStyle=eo,o.lineWidth=Math.max(n.estilo.peso,1)+4,o.globalAlpha=.9,o.setLineDash([]),o.lineCap="round",o.lineJoin="round",o.beginPath(),this.caminho(o,n,e),o.stroke(),r.tracos++,r.chamadas+=4}}const nt=36,et=.45;function so(t,o){const n=Math.abs(o[0]-t[0]),e=Math.abs(o[1]-t[1]);if(n===0&&e===0)return null;const r=[];for(let i=0;i<nt;i++){const a=i*2*Math.PI/nt;r.push([t[0]+n*Math.sin(a),t[1]+e*Math.cos(a)])}return r}function At(t,o,n){const e=n.fatorEixo(t),r=o[0]-t[0],i=(o[1]-t[1])*e,a=Math.hypot(r,i);return a===0?null:{raio:a,inicio:Math.atan2(r,i),cosLat:e}}function co(t,o,n=6,e=I){const r=At(t,o,e);if(!r||n<3)return null;const i=[];for(let a=0;a<n;a++){const c=r.inicio+a*2*Math.PI/n;i.push([t[0]+r.raio*Math.sin(c),t[1]+r.raio*Math.cos(c)/r.cosLat])}return i}function lo(t,o,n=5,e=I,r=et){const i=At(t,o,e);if(!i||n<3)return null;const a=Number.isFinite(r)&&r>0&&r<=1?r:et,c=n*2,u=[];for(let f=0;f<c;f++){const l=f%2===0?i.raio:i.raio*a,s=i.inicio+f*2*Math.PI/c;u.push([t[0]+l*Math.sin(s),t[1]+l*Math.cos(s)/i.cosLat])}return u}const Ct=10,G=(t,o)=>Math.hypot(t.x-o.x,t.y-o.y);function rt(t,o,n){const e=n.x-o.x,r=n.y-o.y,i=e*e+r*r,a=i===0?0:Math.max(0,Math.min(1,((t.x-o.x)*e+(t.y-o.y)*r)/i));return{t:a,d:Math.hypot(t.x-(o.x+a*e),t.y-(o.y+a*r))}}function uo(t,o,n,e={},r){const i=e.toleranciaPx??Ct,a=e.vertice!==!1,c=e.meio!==!1,u=e.aresta!==!1;let f=null,l=null,s=null;const h=(p,P)=>!p||P.distanciaPx<p.distanciaPx?P:p;for(const p of o){if(p.excluida||p.oculta)continue;const P=!!r&&r.feicaoId===p.id&&(r.camadaId===void 0||r.camadaId===p.camadaId),d=p.geometria,y={feicaoId:p.id,camadaId:p.camadaId};if(d.tipo==="Point"||d.tipo==="Text"||d.tipo==="Circle"){if(!a||P)continue;const m=d.tipo==="Circle"?d.centro:d.coordenada,g=G(t,n(m));g<=i&&(f=h(f,{tipo:"vertice",coordenada:m,distanciaPx:g,...y}));continue}if(P&&(d.tipo==="LineString"||d.tipo==="Polygon")&&d.curva)continue;const M=d.tipo==="LineString"||d.tipo==="Polygon"?T(d):null;if(M){if(a)for(const m of M){const g=G(t,n(m.ponto));g<=i&&(f=h(f,{tipo:"vertice",coordenada:m.ponto,distanciaPx:g,...y}))}if(c)for(const[m,g]of Mt(d)){const L=yt(d,m,g),x=G(t,n(L));x<=i&&(l=h(l,{tipo:"meio",coordenada:L,distanciaPx:x,...y}))}if(u){const m=b(d),g=m.map(n),L=d.tipo==="Polygon"&&m.length>2?m.length:m.length-1;for(let x=0;x<L;x++){const A=x,C=(x+1)%m.length,{t:R,d:F}=rt(t,g[A],g[C]);if(F<=i){const V=[m[A][0]+R*(m[C][0]-m[A][0]),m[A][1]+R*(m[C][1]-m[A][1])];s=h(s,{tipo:"aresta",coordenada:V,distanciaPx:F,...y})}}}continue}const S=d.tipo==="LineString"?D.partesDaLinha(d).map(m=>({pts:m,fechado:!1})):[{pts:b(d),fechado:d.tipo==="Polygon"}],v=P?r.vertice:void 0;for(const{pts:m,fechado:g}of S){const L=m.map(n);if(a)for(let A=0;A<m.length;A++){if(A===v)continue;const C=G(t,L[A]);C<=i&&(f=h(f,{tipo:"vertice",coordenada:m[A],distanciaPx:C,...y}))}if(!c&&!u)continue;const x=g&&m.length>2?m.length:m.length-1;for(let A=0;A<x;A++){const C=A,R=(A+1)%m.length;if(!(v!==void 0&&(C===v||R===v))&&!(P&&v===void 0)){if(c){const F=K(m[C],m[R]),V=G(t,n(F));V<=i&&(l=h(l,{tipo:"meio",coordenada:F,distanciaPx:V,...y}))}if(u){const{t:F,d:V}=rt(t,L[C],L[R]);if(V<=i){const Dt=[m[C][0]+F*(m[R][0]-m[C][0]),m[C][1]+F*(m[R][1]-m[C][1])];s=h(s,{tipo:"aresta",coordenada:Dt,distanciaPx:V,...y})}}}}}}return f??l??s}function q(t,o){return t.x>=o.x1&&t.x<=o.x2&&t.y>=o.y1&&t.y<=o.y2}function it(t,o,n){let e=0,r=1;const i=o.x-t.x,a=o.y-t.y,c=[-i,i,-a,a],u=[t.x-n.x1,n.x2-t.x,t.y-n.y1,n.y2-t.y];for(let f=0;f<4;f++)if(c[f]===0){if(u[f]<0)return!1}else{const l=u[f]/c[f];if(c[f]<0){if(l>r)return!1;l>e&&(e=l)}else{if(l<e)return!1;l<r&&(r=l)}}return!0}function at(t,o){let n=!1;for(let e=0,r=o.length-1;e<o.length;r=e++){const i=o[e],a=o[r];i.y>t.y!=a.y>t.y&&t.x<(a.x-i.x)*(t.y-i.y)/(a.y-i.y)+i.x&&(n=!n)}return n}function st(t,o,n){for(let e=1;e<t.length;e++)if(it(t[e-1],t[e],o))return!0;return n&&t.length>2&&it(t[t.length-1],t[0],o)}function fo(t,o,n,e){const r=n(t),i=n(e.pontoDeMedidaDoRaio(t,o));return Math.hypot(i.x-r.x,i.y-r.y)}function ho(t,o,n,e,r=I){if(t.oculta)return!1;const i=t.geometria,a=e==="window";switch(i.tipo){case"Point":case"Text":return q(n(i.coordenada),o);case"LineString":{const c=D.partesDaLinha(i).map(u=>u.map(n));return a?c.every(u=>u.every(f=>q(f,o))):c.some(u=>u.some(f=>q(f,o))||st(u,o,!1))}case"Polygon":{const c=i.aneis.map(l=>l.map(n)),u=c[0];if(!u)return!1;if(a)return u.every(l=>q(l,o));if(c.some(l=>l.some(s=>q(s,o))||st(l,o,!0)))return!0;const f={x:o.x1,y:o.y1};return at(f,u)&&!c.slice(1).some(l=>at(f,l))}case"Circle":{const c=n(i.centro),u=fo(i.centro,i.raioMetros,n,r);if(a)return c.x-u>=o.x1&&c.x+u<=o.x2&&c.y-u>=o.y1&&c.y+u<=o.y2;const f=Math.max(o.x1,Math.min(c.x,o.x2)),l=Math.max(o.y1,Math.min(c.y,o.y2));return Math.hypot(c.x-f,c.y-l)<=u}}}function po(t,o){if(o.length<3||t.oculta)return!1;const n=r=>ct(r,[o]),e=t.geometria;switch(e.tipo){case"Point":case"Text":return n(e.coordenada);case"Circle":return n(e.centro);case"LineString":return D.partesDaLinha(e).some(r=>r.some(n));case"Polygon":{const r=e.aneis[0]??[];if(r.some(n))return!0;if(r.length<3)return!1;const i=r.reduce((a,c)=>[a[0]+c[0],a[1]+c[1]],[0,0]);return n([i[0]/r.length,i[1]/r.length])}}}exports.ESPACO_GEOGRAFICO=I;exports.MAX_NOS_COM_ALCA_LATENTE=Kt;exports.MAX_VERTICES_EDICAO=ht;exports.PintorCanvas2D=ao;exports.RAIO_MINIMO_EDICAO_CIRCULO_M=gt;exports.TOLERANCIA_SNAP_PX=Ct;exports.alcaLatente=Qt;exports.alternarSuavidade=to;exports.buscarSnap=uo;exports.clonarFeicao=qt;exports.comAlcaMovida=xt;exports.comNos=k;exports.comPontos=Jt;exports.comVertices=Y;exports.contarItensCanvas=io;exports.converterArea=jt;exports.converterComprimento=Xt;exports.deMetros=vt;exports.deslocarGeometria=wt;exports.distanciaEntre=Gt;exports.dividirPoligonoComLinha=bt;exports.feicaoNaCaixa=ho;exports.feicaoNoLaco=po;exports.gerarBuffer=kt;exports.gerarElipse=so;exports.gerarEstrela=lo;exports.gerarPoligonoRegular=co;exports.inserirPonto=Ht;exports.inserirVertice=pt;exports.juntarLinhas=_t;exports.juntarPoligonos=Ft;exports.minimoVertices=J;exports.moverAlca=$t;exports.moverVertice=Bt;exports.nosDe=T;exports.nosOuVertices=U;exports.offsetParalelo=Vt;exports.paraMetros=W;exports.parseDash=St;exports.planoLocal=Lt;exports.pontoDaBordaDoCirculo=Pt;exports.pontoMedio=K;exports.pontoMedioDoSegmento=yt;exports.pontoNoPoligono=ct;exports.pontosDe=zt;exports.removerPonto=Wt;exports.removerVertice=mt;exports.segmentosDe=dt;exports.segmentosDoEditor=Mt;exports.verificarEditavel=Yt;exports.verticesDe=b;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Pt = Object.defineProperty;
|
|
2
2
|
var Mt = (t, n, o) => n in t ? Pt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[n] = o;
|
|
3
3
|
var X = (t, n, o) => Mt(t, typeof n != "symbol" ? n + "" : n, o);
|
|
4
|
-
import { e as
|
|
4
|
+
import { e as xt, m as q, a as Lt, c as vt, d as St, b as At, p as G, f as H } from "./feature_metricas-hUren6kK.js";
|
|
5
5
|
import { m as Z, b as U, e as Ct, a as bt, c as W, p as ft } from "./geometria-px-wXudjSxA.js";
|
|
6
6
|
const It = 111320;
|
|
7
7
|
function Et(t) {
|
|
@@ -16,7 +16,7 @@ const I = Object.freeze({
|
|
|
16
16
|
unidade: "m",
|
|
17
17
|
distancia: (t, n) => St(t, n),
|
|
18
18
|
comprimento: (t, n = !1) => vt(t, n),
|
|
19
|
-
area: (t) =>
|
|
19
|
+
area: (t) => Lt(t),
|
|
20
20
|
planoLocal: Et,
|
|
21
21
|
deslocar(t, n, o) {
|
|
22
22
|
const e = q(t[0]), r = o / e.lat, s = n / Math.max(e.lng, 1);
|
|
@@ -26,7 +26,7 @@ const I = Object.freeze({
|
|
|
26
26
|
return [t[0], t[1] + n / Math.max(q(t[0]).lng, 1)];
|
|
27
27
|
},
|
|
28
28
|
pontoDeMedidaDoRaio: (t, n) => [t[0] + n / It, t[1]],
|
|
29
|
-
extremosDoCirculo:
|
|
29
|
+
extremosDoCirculo: xt,
|
|
30
30
|
fatorEixo: (t) => Math.cos(t[0] * Math.PI / 180) || 1
|
|
31
31
|
});
|
|
32
32
|
function Nt(t, n) {
|
|
@@ -62,40 +62,40 @@ function nn(t, n, o = I) {
|
|
|
62
62
|
function pt(t, n, o) {
|
|
63
63
|
if (o > 8) return null;
|
|
64
64
|
const e = t.length, r = [];
|
|
65
|
-
for (let
|
|
66
|
-
for (let
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
tLinha:
|
|
70
|
-
tAnel:
|
|
71
|
-
ponto: [n[
|
|
65
|
+
for (let g = 0; g < n.length - 1; g++)
|
|
66
|
+
for (let x = 0; x < e; x++) {
|
|
67
|
+
const v = ht(n[g], n[g + 1], t[x], t[(x + 1) % e]);
|
|
68
|
+
v && r.push({
|
|
69
|
+
tLinha: g + v.t,
|
|
70
|
+
tAnel: x + v.u,
|
|
71
|
+
ponto: [n[g][0] + v.t * (n[g + 1][0] - n[g][0]), n[g][1] + v.t * (n[g + 1][1] - n[g][1])]
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
if (r.sort((
|
|
74
|
+
if (r.sort((g, x) => g.tLinha - x.tLinha), r.length < 2) return null;
|
|
75
75
|
const [s, a] = r, c = [];
|
|
76
|
-
for (let
|
|
77
|
-
|
|
76
|
+
for (let g = Math.floor(s.tLinha) + 1; g <= Math.floor(a.tLinha); g++)
|
|
77
|
+
g > s.tLinha && g < a.tLinha && c.push(n[g]);
|
|
78
78
|
const u = [s.ponto, ...c, a.ponto];
|
|
79
79
|
let f = s, l = a, i = u;
|
|
80
80
|
s.tAnel > a.tAnel && (f = a, l = s, i = [...u].reverse());
|
|
81
|
-
const h = Math.floor(f.tAnel), p = Math.floor(l.tAnel), y = i.slice(1, -1),
|
|
82
|
-
for (let
|
|
83
|
-
|
|
81
|
+
const h = Math.floor(f.tAnel), p = Math.floor(l.tAnel), y = i.slice(1, -1), d = [f.ponto];
|
|
82
|
+
for (let g = h + 1; g <= p; g++) d.push(t[g % e]);
|
|
83
|
+
d.push(l.ponto, ...[...y].reverse());
|
|
84
84
|
const P = [l.ponto];
|
|
85
|
-
for (let
|
|
85
|
+
for (let g = p + 1; g <= h + e; g++) P.push(t[g % e]);
|
|
86
86
|
P.push(f.ponto, ...y);
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
const
|
|
90
|
-
if (r.length > 2 &&
|
|
91
|
-
const
|
|
92
|
-
for (const
|
|
93
|
-
const
|
|
94
|
-
|
|
87
|
+
const S = B(t) * 1e-9, L = [d, P].filter((g) => g.length >= 3 && B(g) > S);
|
|
88
|
+
if (L.length < 2) return null;
|
|
89
|
+
const m = [a.ponto, ...n.slice(Math.floor(a.tLinha) + 1)];
|
|
90
|
+
if (r.length > 2 && m.length >= 2) {
|
|
91
|
+
const g = [];
|
|
92
|
+
for (const x of L) {
|
|
93
|
+
const v = pt(x, m, o + 1);
|
|
94
|
+
v ? g.push(...v) : g.push(x);
|
|
95
95
|
}
|
|
96
|
-
return
|
|
96
|
+
return g;
|
|
97
97
|
}
|
|
98
|
-
return
|
|
98
|
+
return L;
|
|
99
99
|
}
|
|
100
100
|
function N(t, n) {
|
|
101
101
|
return t.map((o) => n.paraXY(o));
|
|
@@ -111,13 +111,13 @@ function on(t, n = 0, o = I) {
|
|
|
111
111
|
for (; r.length > 0; ) {
|
|
112
112
|
let a = null;
|
|
113
113
|
if (r.forEach((i, h) => {
|
|
114
|
-
const p = s[0], y = s[s.length - 1],
|
|
114
|
+
const p = s[0], y = s[s.length - 1], d = [
|
|
115
115
|
{ inverter: !1, noFim: !0, d: b(y, i[0]) },
|
|
116
116
|
{ inverter: !0, noFim: !0, d: b(y, i[i.length - 1]) },
|
|
117
117
|
{ inverter: !1, noFim: !1, d: b(p, i[i.length - 1]) },
|
|
118
118
|
{ inverter: !0, noFim: !1, d: b(p, i[0]) }
|
|
119
119
|
];
|
|
120
|
-
for (const P of
|
|
120
|
+
for (const P of d) (!a || P.d < a.d) && (a = { idx: h, ...P });
|
|
121
121
|
}), !a || a.d > n) return null;
|
|
122
122
|
const { idx: c, inverter: u, noFim: f } = a;
|
|
123
123
|
let l = r.splice(c, 1)[0];
|
|
@@ -175,7 +175,7 @@ function J(t, n, o) {
|
|
|
175
175
|
continue;
|
|
176
176
|
}
|
|
177
177
|
h /= y, p /= y;
|
|
178
|
-
const
|
|
178
|
+
const d = h * l[0] + p * l[1], P = Math.min(1 / Math.max(d, 0.5), 2);
|
|
179
179
|
r.push([u[0] + h * n * P, u[1] + p * n * P]);
|
|
180
180
|
}
|
|
181
181
|
return r;
|
|
@@ -222,14 +222,14 @@ function nt(t, n, o, e) {
|
|
|
222
222
|
for (let i = 0; i < c; i++) {
|
|
223
223
|
const h = r[i], p = r[(i + 1) % s], y = b(h, p);
|
|
224
224
|
if (!Number.isFinite(y) || y < 1e-9) return null;
|
|
225
|
-
const
|
|
226
|
-
u.push([[h[0] +
|
|
225
|
+
const d = -(p[1] - h[1]) / y * n * a, P = (p[0] - h[0]) / y * n * a;
|
|
226
|
+
u.push([[h[0] + d, h[1] + P], [p[0] + d, p[1] + P]]);
|
|
227
227
|
}
|
|
228
228
|
const f = (i, h, p) => {
|
|
229
|
-
const y = () => [(i[1][0] + h[0][0]) / 2, (i[1][1] + h[0][1]) / 2],
|
|
230
|
-
if (Math.abs(
|
|
231
|
-
const
|
|
232
|
-
return b(
|
|
229
|
+
const y = () => [(i[1][0] + h[0][0]) / 2, (i[1][1] + h[0][1]) / 2], d = b(i[0], i[1]), P = b(h[0], h[1]), M = i[1][0] - i[0][0], S = i[1][1] - i[0][1], L = h[1][0] - h[0][0], m = h[1][1] - h[0][1], g = M * m - S * L;
|
|
230
|
+
if (Math.abs(g) < 1e-12 || Math.asin(Math.min(1, Math.abs(g) / (d * P))) * (180 / Math.PI) < 1) return y();
|
|
231
|
+
const x = ((h[0][0] - i[0][0]) * m - (h[0][1] - i[0][1]) * L) / g, v = [i[0][0] + x * M, i[0][1] + x * S];
|
|
232
|
+
return b(v, p) > Math.max(2.5 * Math.abs(n), 1) ? y() : v;
|
|
233
233
|
}, l = [];
|
|
234
234
|
if (e)
|
|
235
235
|
for (let i = 0; i < s; i++) l.push(f(u[(i - 1 + s) % s], u[i], r[i]));
|
|
@@ -240,8 +240,8 @@ function nt(t, n, o, e) {
|
|
|
240
240
|
}
|
|
241
241
|
if (e)
|
|
242
242
|
for (let i = 0; i < s; i++) {
|
|
243
|
-
const h = r[i], p = r[(i + 1) % s], y = l[i],
|
|
244
|
-
if ((p[0] - h[0]) * (
|
|
243
|
+
const h = r[i], p = r[(i + 1) % s], y = l[i], d = l[(i + 1) % s];
|
|
244
|
+
if ((p[0] - h[0]) * (d[0] - y[0]) + (p[1] - h[1]) * (d[1] - y[1]) <= 0) return null;
|
|
245
245
|
}
|
|
246
246
|
return l;
|
|
247
247
|
}
|
|
@@ -325,7 +325,7 @@ function _t(t, n, o) {
|
|
|
325
325
|
const e = O(t).slice();
|
|
326
326
|
return n < 0 || n >= e.length ? t : (e.splice(n + 1, 0, o), z(t, e));
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function Ft(t, n) {
|
|
329
329
|
if (t.tipo !== "LineString" && t.tipo !== "Polygon") return null;
|
|
330
330
|
const o = O(t);
|
|
331
331
|
return n < 0 || n >= o.length || o.length <= K(t) ? null : z(t, o.filter((e, r) => r !== n));
|
|
@@ -333,7 +333,7 @@ function Rt(t, n) {
|
|
|
333
333
|
function dt(t, n) {
|
|
334
334
|
return [(t[0] + n[0]) / 2, (t[1] + n[1]) / 2];
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function Rt(t) {
|
|
337
337
|
const n = O(t).length, o = [];
|
|
338
338
|
if (t.tipo !== "LineString" && t.tipo !== "Polygon") return o;
|
|
339
339
|
for (let e = 0; e < n - 1; e++) o.push([e, e + 1]);
|
|
@@ -342,7 +342,7 @@ function kt(t) {
|
|
|
342
342
|
function _(t) {
|
|
343
343
|
return (t.tipo === "LineString" || t.tipo === "Polygon") && t.curva && t.curva.length >= K(t) ? t.curva : null;
|
|
344
344
|
}
|
|
345
|
-
const
|
|
345
|
+
const kt = 0.5;
|
|
346
346
|
function wt(t, n, o = I) {
|
|
347
347
|
return o.pontoDaBorda(t, n);
|
|
348
348
|
}
|
|
@@ -350,22 +350,22 @@ function mn(t, n = I) {
|
|
|
350
350
|
var o;
|
|
351
351
|
return t.tipo === "Circle" ? [t.centro, wt(t.centro, t.raioMetros, n)] : ((o = _(t)) == null ? void 0 : o.map((e) => e.ponto)) ?? O(t);
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function R(t, n) {
|
|
354
354
|
const o = t.tipo === "Polygon", e = bt(n, o);
|
|
355
355
|
return o ? { tipo: "Polygon", aneis: [e], curva: n } : { tipo: "LineString", coordenadas: e, curva: n };
|
|
356
356
|
}
|
|
357
357
|
function dn(t, n, o = I) {
|
|
358
358
|
if (t.tipo === "Circle")
|
|
359
|
-
return n.length < 2 ? t : { ...t, centro: n[0], raioMetros: Math.max(
|
|
359
|
+
return n.length < 2 ? t : { ...t, centro: n[0], raioMetros: Math.max(kt, o.distancia(n[0], n[1])) };
|
|
360
360
|
const e = _(t);
|
|
361
361
|
if (!e || e.length !== n.length) return z(t, n);
|
|
362
362
|
const r = e.map((s, a) => {
|
|
363
363
|
const c = n[a][0] - s.ponto[0], u = n[a][1] - s.ponto[1], f = (i) => [i[0] + c, i[1] + u], l = { ponto: n[a] };
|
|
364
364
|
return s.entrada && (l.entrada = f(s.entrada)), s.saida && (l.saida = f(s.saida)), s.modo && (l.modo = s.modo), l;
|
|
365
365
|
});
|
|
366
|
-
return
|
|
366
|
+
return R(t, r);
|
|
367
367
|
}
|
|
368
|
-
function
|
|
368
|
+
function w(t, n, o) {
|
|
369
369
|
return [t[0] + (n[0] - t[0]) * o, t[1] + (n[1] - t[1]) * o];
|
|
370
370
|
}
|
|
371
371
|
function Xt(t, n, o) {
|
|
@@ -388,7 +388,7 @@ function Yt(t, n, o) {
|
|
|
388
388
|
}
|
|
389
389
|
function jt(t) {
|
|
390
390
|
const n = _(t);
|
|
391
|
-
if (!n) return
|
|
391
|
+
if (!n) return Rt(t);
|
|
392
392
|
const o = [];
|
|
393
393
|
for (let e = 0; e < n.length - 1; e++) o.push([e, e + 1]);
|
|
394
394
|
return t.tipo === "Polygon" && n.length > 2 && o.push([n.length - 1, 0]), o;
|
|
@@ -402,15 +402,15 @@ function gn(t, n, o) {
|
|
|
402
402
|
if (c)
|
|
403
403
|
u = { ponto: o };
|
|
404
404
|
else {
|
|
405
|
-
const h = Xt(s, a, o), [p, y] = W(s, a),
|
|
406
|
-
u = { ponto:
|
|
405
|
+
const h = Xt(s, a, o), [p, y] = W(s, a), d = w(s.ponto, p, h), P = w(p, y, h), M = w(y, a.ponto, h), S = w(d, P, h), L = w(P, M, h);
|
|
406
|
+
u = { ponto: w(S, L, h), entrada: S, saida: L, modo: "suave" }, f = { ...s, saida: d }, l = { ...a, entrada: M }, U(s) === "simetrico" && s.entrada && (f.modo = "suave"), U(a) === "simetrico" && a.saida && (l.modo = "suave");
|
|
407
407
|
}
|
|
408
408
|
const i = e.slice();
|
|
409
|
-
return i[n] = f, i[r] = l, i.splice(n + 1, 0, u),
|
|
409
|
+
return i[n] = f, i[r] = l, i.splice(n + 1, 0, u), R(t, i);
|
|
410
410
|
}
|
|
411
411
|
function yn(t, n) {
|
|
412
412
|
const o = _(t);
|
|
413
|
-
return o ? n < 0 || n >= o.length || o.length <= K(t) ? null :
|
|
413
|
+
return o ? n < 0 || n >= o.length || o.length <= K(t) ? null : R(t, o.filter((e, r) => r !== n)) : Ft(t, n);
|
|
414
414
|
}
|
|
415
415
|
function Q(t) {
|
|
416
416
|
return t.tipo !== "LineString" && t.tipo !== "Polygon" ? null : _(t) ?? O(t).map((n) => ({ ponto: [n[0], n[1]] }));
|
|
@@ -434,34 +434,34 @@ function Gt(t, n, o, e, r = !1) {
|
|
|
434
434
|
if (a === "simetrico")
|
|
435
435
|
u[c] = Ct(t.ponto, o);
|
|
436
436
|
else if (a === "suave") {
|
|
437
|
-
const f = Vt(t.ponto), [l, i] = rt(f, o), h = Math.hypot(l, i), p = t[c], [y,
|
|
437
|
+
const f = Vt(t.ponto), [l, i] = rt(f, o), h = Math.hypot(l, i), p = t[c], [y, d] = p ? rt(f, p) : [l, i], P = Math.hypot(y, d);
|
|
438
438
|
h > 0 && P > 0 && (u[c] = qt(f, -(l / h) * P, -(i / h) * P));
|
|
439
439
|
}
|
|
440
440
|
return u;
|
|
441
441
|
}
|
|
442
|
-
function
|
|
442
|
+
function xn(t, n, o, e, r = !0) {
|
|
443
443
|
const s = Q(t);
|
|
444
444
|
if (!s || n < 0 || n >= s.length || !Bt(e)) return t;
|
|
445
445
|
const a = s.slice();
|
|
446
|
-
return a[n] = Gt(s[n], o, e, "simetrico", !r),
|
|
446
|
+
return a[n] = Gt(s[n], o, e, "simetrico", !r), R(t, a);
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function Ln(t, n) {
|
|
449
449
|
const o = Q(t);
|
|
450
450
|
if (!o || n < 0 || n >= o.length) return t;
|
|
451
451
|
const e = o[n], r = o.slice();
|
|
452
452
|
if (e.entrada || e.saida)
|
|
453
|
-
return r[n] = { ponto: e.ponto },
|
|
453
|
+
return r[n] = { ponto: e.ponto }, R(t, r);
|
|
454
454
|
const s = t.tipo === "Polygon", a = o.length, c = n > 0 ? o[n - 1] : s ? o[a - 1] : null, u = n < a - 1 ? o[n + 1] : s ? o[0] : null;
|
|
455
455
|
if (!c && !u) return t;
|
|
456
456
|
const f = e.ponto;
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
l = (h[0] - f[0]) / 3 * p, i = (h[1] - f[1]) / 3 * p;
|
|
457
|
+
if (c && u) {
|
|
458
|
+
const y = u.ponto[0] - c.ponto[0], d = u.ponto[1] - c.ponto[1], P = Math.hypot(y, d), M = Math.hypot(u.ponto[0] - f[0], u.ponto[1] - f[1]) / 3, S = Math.hypot(f[0] - c.ponto[0], f[1] - c.ponto[1]) / 3;
|
|
459
|
+
if (!(P > 0) || !Number.isFinite(P)) return t;
|
|
460
|
+
const L = y / P, m = d / P;
|
|
461
|
+
return r[n] = { ponto: f, saida: [f[0] + L * M, f[1] + m * M], entrada: [f[0] - L * S, f[1] - m * S] }, R(t, r);
|
|
463
462
|
}
|
|
464
|
-
|
|
463
|
+
const l = (u ?? c).ponto, i = u ? 1 : -1, h = (l[0] - f[0]) / 3 * i, p = (l[1] - f[1]) / 3 * i;
|
|
464
|
+
return r[n] = { ponto: f, saida: [f[0] + h, f[1] + p], entrada: [f[0] - h, f[1] - p] }, R(t, r);
|
|
465
465
|
}
|
|
466
466
|
const zt = 128, Jt = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), Ut = "rgba(255,255,255,0.9)";
|
|
467
467
|
function Ht(t) {
|
|
@@ -521,8 +521,8 @@ class Sn {
|
|
|
521
521
|
M && e.limpar !== !1 && this.limparSuperficie(M, c);
|
|
522
522
|
}
|
|
523
523
|
for (const M of n.camadas) {
|
|
524
|
-
const
|
|
525
|
-
|
|
524
|
+
const S = a ? this.alvos.sobreposicao() : this.alvos.camada(M.camadaId);
|
|
525
|
+
S && (!a && e.limpar !== !1 && this.limparSuperficie(S, c), P.push({ sup: S, lotes: this.lotesDaCamada(M, a, s) }));
|
|
526
526
|
}
|
|
527
527
|
return P;
|
|
528
528
|
};
|
|
@@ -533,36 +533,36 @@ class Sn {
|
|
|
533
533
|
f ?? (f = y());
|
|
534
534
|
const M = e.recorte;
|
|
535
535
|
for (; l < f.length; ) {
|
|
536
|
-
const { sup:
|
|
537
|
-
|
|
538
|
-
let
|
|
536
|
+
const { sup: S, lotes: L } = f[l], m = S.ctx;
|
|
537
|
+
m.setTransform(c, 0, 0, c, 0, 0), M && (m.save(), m.beginPath(), m.rect(M.x, M.y, M.largura, M.altura), m.clip());
|
|
538
|
+
let g = !1;
|
|
539
539
|
try {
|
|
540
|
-
for (
|
|
541
|
-
const
|
|
542
|
-
if (!
|
|
540
|
+
for (m.lineJoin = "round", m.lineCap = "round"; i < L.length; ) {
|
|
541
|
+
const x = L[i], v = this.pintorDoLote(m, x, u, s, h === 0);
|
|
542
|
+
if (!v) {
|
|
543
543
|
i++, h = 0;
|
|
544
544
|
continue;
|
|
545
545
|
}
|
|
546
|
-
const
|
|
547
|
-
for (; h <
|
|
548
|
-
const C = Math.min(
|
|
549
|
-
for (; h < C; h++) x
|
|
550
|
-
if (h <
|
|
551
|
-
|
|
546
|
+
const A = x.itens.length;
|
|
547
|
+
for (; h < A; ) {
|
|
548
|
+
const C = Math.min(A, h + zt);
|
|
549
|
+
for (; h < C; h++) v(x.itens[h]);
|
|
550
|
+
if (h < A && r() >= P) {
|
|
551
|
+
g = !0;
|
|
552
552
|
break;
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
|
-
if (
|
|
556
|
-
if (i++, h = 0, i <
|
|
557
|
-
|
|
555
|
+
if (g) break;
|
|
556
|
+
if (i++, h = 0, i < L.length && r() >= P) {
|
|
557
|
+
g = !0;
|
|
558
558
|
break;
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
|
-
|
|
561
|
+
g || (m.globalAlpha = 1, m.setLineDash([]), m.lineDashOffset = 0);
|
|
562
562
|
} finally {
|
|
563
|
-
M &&
|
|
563
|
+
M && m.restore();
|
|
564
564
|
}
|
|
565
|
-
if (
|
|
565
|
+
if (g) return !1;
|
|
566
566
|
l++, i = 0, h = 0;
|
|
567
567
|
}
|
|
568
568
|
return p = !0, this.ultima = s, !0;
|
|
@@ -631,8 +631,8 @@ class Sn {
|
|
|
631
631
|
if (!h) return;
|
|
632
632
|
const p = h[0] - e.x, y = h[1] - e.y;
|
|
633
633
|
if (!(E(p) && E(y))) return;
|
|
634
|
-
const
|
|
635
|
-
n.fillRect(Math.round(p -
|
|
634
|
+
const d = i.raioPx >= 2 ? 2 : 1;
|
|
635
|
+
n.fillRect(Math.round(p - d / 2), Math.round(y - d / 2), d, d), r.marcas++, r.chamadas++;
|
|
636
636
|
};
|
|
637
637
|
if (o.tipo === "caixa") {
|
|
638
638
|
const i = a.traco && a.peso > 0, h = a.preencher && a.opacidadePreenchimento > 0;
|
|
@@ -640,10 +640,10 @@ class Sn {
|
|
|
640
640
|
n.fillStyle = i ? a.cor : a.corPreenchimento, n.globalAlpha = i ? a.opacidadeTraco ?? 1 : a.opacidadePreenchimento;
|
|
641
641
|
const p = i ? a.peso / 2 : 0;
|
|
642
642
|
return s && (r.chamadas += 2), (y) => {
|
|
643
|
-
const
|
|
644
|
-
if (!
|
|
645
|
-
const P = Math.floor(
|
|
646
|
-
E(P) && E(M) && E(
|
|
643
|
+
const d = y.geometriaEmPx[0];
|
|
644
|
+
if (!d || d.length < 4) return;
|
|
645
|
+
const P = Math.floor(d[0] - e.x - p), M = Math.floor(d[1] - e.y - p), S = Math.ceil(d[2] - e.x + p), L = Math.ceil(d[3] - e.y + p);
|
|
646
|
+
E(P) && E(M) && E(S) && E(L) && (n.fillRect(P, M, Math.max(1, S - P), Math.max(1, L - M)), r.caixas = (r.caixas ?? 0) + 1, r.chamadas++);
|
|
647
647
|
};
|
|
648
648
|
}
|
|
649
649
|
const c = o.tipo === "area" && a.preencher && a.opacidadePreenchimento > 0, u = a.traco && a.peso > 0;
|
|
@@ -726,61 +726,61 @@ function In(t, n, o, e = {}, r) {
|
|
|
726
726
|
const h = (p, y) => !p || y.distanciaPx < p.distanciaPx ? y : p;
|
|
727
727
|
for (const p of n) {
|
|
728
728
|
if (p.excluida || p.oculta) continue;
|
|
729
|
-
const y = !!r && r.feicaoId === p.id && (r.camadaId === void 0 || r.camadaId === p.camadaId),
|
|
730
|
-
if (
|
|
729
|
+
const y = !!r && r.feicaoId === p.id && (r.camadaId === void 0 || r.camadaId === p.camadaId), d = p.geometria, P = { feicaoId: p.id, camadaId: p.camadaId };
|
|
730
|
+
if (d.tipo === "Point" || d.tipo === "Text" || d.tipo === "Circle") {
|
|
731
731
|
if (!a || y) continue;
|
|
732
|
-
const
|
|
733
|
-
|
|
732
|
+
const m = d.tipo === "Circle" ? d.centro : d.coordenada, g = Y(t, o(m));
|
|
733
|
+
g <= s && (f = h(f, { tipo: "vertice", coordenada: m, distanciaPx: g, ...P }));
|
|
734
734
|
continue;
|
|
735
735
|
}
|
|
736
|
-
if (y && (
|
|
737
|
-
const M =
|
|
736
|
+
if (y && (d.tipo === "LineString" || d.tipo === "Polygon") && d.curva) continue;
|
|
737
|
+
const M = d.tipo === "LineString" || d.tipo === "Polygon" ? _(d) : null;
|
|
738
738
|
if (M) {
|
|
739
739
|
if (a)
|
|
740
|
-
for (const
|
|
741
|
-
const
|
|
742
|
-
|
|
740
|
+
for (const m of M) {
|
|
741
|
+
const g = Y(t, o(m.ponto));
|
|
742
|
+
g <= s && (f = h(f, { tipo: "vertice", coordenada: m.ponto, distanciaPx: g, ...P }));
|
|
743
743
|
}
|
|
744
744
|
if (c)
|
|
745
|
-
for (const [
|
|
746
|
-
const
|
|
747
|
-
|
|
745
|
+
for (const [m, g] of jt(d)) {
|
|
746
|
+
const x = Yt(d, m, g), v = Y(t, o(x));
|
|
747
|
+
v <= s && (l = h(l, { tipo: "meio", coordenada: x, distanciaPx: v, ...P }));
|
|
748
748
|
}
|
|
749
749
|
if (u) {
|
|
750
|
-
const
|
|
751
|
-
for (let
|
|
752
|
-
const
|
|
750
|
+
const m = O(d), g = m.map(o), x = d.tipo === "Polygon" && m.length > 2 ? m.length : m.length - 1;
|
|
751
|
+
for (let v = 0; v < x; v++) {
|
|
752
|
+
const A = v, C = (v + 1) % m.length, { t: T, d: D } = it(t, g[A], g[C]);
|
|
753
753
|
if (D <= s) {
|
|
754
|
-
const
|
|
755
|
-
i = h(i, { tipo: "aresta", coordenada:
|
|
754
|
+
const F = [m[A][0] + T * (m[C][0] - m[A][0]), m[A][1] + T * (m[C][1] - m[A][1])];
|
|
755
|
+
i = h(i, { tipo: "aresta", coordenada: F, distanciaPx: D, ...P });
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
758
|
}
|
|
759
759
|
continue;
|
|
760
760
|
}
|
|
761
|
-
const
|
|
762
|
-
for (const { pts:
|
|
763
|
-
const
|
|
761
|
+
const S = d.tipo === "LineString" ? G(d).map((m) => ({ pts: m, fechado: !1 })) : [{ pts: O(d), fechado: d.tipo === "Polygon" }], L = y ? r.vertice : void 0;
|
|
762
|
+
for (const { pts: m, fechado: g } of S) {
|
|
763
|
+
const x = m.map(o);
|
|
764
764
|
if (a)
|
|
765
|
-
for (let
|
|
766
|
-
if (
|
|
767
|
-
const C = Y(t,
|
|
768
|
-
C <= s && (f = h(f, { tipo: "vertice", coordenada:
|
|
765
|
+
for (let A = 0; A < m.length; A++) {
|
|
766
|
+
if (A === L) continue;
|
|
767
|
+
const C = Y(t, x[A]);
|
|
768
|
+
C <= s && (f = h(f, { tipo: "vertice", coordenada: m[A], distanciaPx: C, ...P }));
|
|
769
769
|
}
|
|
770
770
|
if (!c && !u) continue;
|
|
771
|
-
const
|
|
772
|
-
for (let
|
|
773
|
-
const C =
|
|
774
|
-
if (!(
|
|
771
|
+
const v = g && m.length > 2 ? m.length : m.length - 1;
|
|
772
|
+
for (let A = 0; A < v; A++) {
|
|
773
|
+
const C = A, T = (A + 1) % m.length;
|
|
774
|
+
if (!(L !== void 0 && (C === L || T === L)) && !(y && L === void 0)) {
|
|
775
775
|
if (c) {
|
|
776
|
-
const D = dt(
|
|
777
|
-
|
|
776
|
+
const D = dt(m[C], m[T]), F = Y(t, o(D));
|
|
777
|
+
F <= s && (l = h(l, { tipo: "meio", coordenada: D, distanciaPx: F, ...P }));
|
|
778
778
|
}
|
|
779
779
|
if (u) {
|
|
780
|
-
const { t: D, d:
|
|
781
|
-
if (
|
|
782
|
-
const yt = [
|
|
783
|
-
i = h(i, { tipo: "aresta", coordenada: yt, distanciaPx:
|
|
780
|
+
const { t: D, d: F } = it(t, x[C], x[T]);
|
|
781
|
+
if (F <= s) {
|
|
782
|
+
const yt = [m[C][0] + D * (m[T][0] - m[C][0]), m[C][1] + D * (m[T][1] - m[C][1])];
|
|
783
|
+
i = h(i, { tipo: "aresta", coordenada: yt, distanciaPx: F, ...P });
|
|
784
784
|
}
|
|
785
785
|
}
|
|
786
786
|
}
|
|
@@ -875,10 +875,10 @@ function Nn(t, n) {
|
|
|
875
875
|
}
|
|
876
876
|
}
|
|
877
877
|
export {
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
878
|
+
jt as A,
|
|
879
|
+
_ as B,
|
|
880
|
+
Yt as C,
|
|
881
|
+
gn as D,
|
|
882
882
|
I as E,
|
|
883
883
|
hn as F,
|
|
884
884
|
In as G,
|
|
@@ -892,13 +892,13 @@ export {
|
|
|
892
892
|
un as O,
|
|
893
893
|
Sn as P,
|
|
894
894
|
_t as Q,
|
|
895
|
-
|
|
895
|
+
kt as R,
|
|
896
896
|
pn as S,
|
|
897
897
|
Kt as T,
|
|
898
898
|
Ht as U,
|
|
899
899
|
wt as V,
|
|
900
900
|
dt as W,
|
|
901
|
-
|
|
901
|
+
Ft as X,
|
|
902
902
|
O as Y,
|
|
903
903
|
Cn as a,
|
|
904
904
|
bn as b,
|
|
@@ -912,18 +912,18 @@ export {
|
|
|
912
912
|
on as j,
|
|
913
913
|
rt as k,
|
|
914
914
|
qt as l,
|
|
915
|
-
|
|
915
|
+
K as m,
|
|
916
916
|
Q as n,
|
|
917
917
|
sn as o,
|
|
918
918
|
Nt as p,
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
919
|
+
R as q,
|
|
920
|
+
yn as r,
|
|
921
|
+
Rt as s,
|
|
922
|
+
Ln as t,
|
|
923
|
+
mn as u,
|
|
924
|
+
dn as v,
|
|
925
|
+
xn as w,
|
|
926
|
+
Gt as x,
|
|
927
|
+
Vt as y,
|
|
928
|
+
Mn as z
|
|
929
929
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var A=Object.defineProperty;var v=(r,t,e)=>t in r?A(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var i=(r,t,e)=>v(r,typeof t!="symbol"?t+"":t,e);const s=require("./geometria-px-C4xatxmY.cjs"),l=require("./feature_caixa-
|
|
1
|
+
"use strict";var A=Object.defineProperty;var v=(r,t,e)=>t in r?A(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var i=(r,t,e)=>v(r,typeof t!="symbol"?t+"":t,e);const s=require("./geometria-px-C4xatxmY.cjs"),l=require("./feature_caixa-B_oDGhlM.cjs"),f=["ponto","linha","poligono","retangulo","elipse","poligono-regular","estrela","circulo","texto","caneta","medir-distancia","medir-area","dividir","selecao-laco","conta-gotas"],d=2,m=(r,t,e,n)=>typeof r=="number"&&Number.isFinite(r)?Math.min(e,Math.max(t,Math.round(r))):n;function M(r){return typeof r=="string"&&f.includes(r)}function u(r){return r.entrada??(r.alca?s.espelhoDaAlca(r.ponto,r.alca):void 0)}function c(r){return r.map(t=>{const e={ponto:t.ponto};return t.alca?(e.saida=t.alca,e.entrada=u(t)):t.entrada&&(e.entrada=t.entrada),e})}function g(r){return s.amostrarCurva(c(r),!1)}function h(r,t){const e=s.temAlcas(r);if(t){const o=e?s.amostrarCurva(r,!0):r.map(a=>a.ponto);return e?{tipo:"Polygon",aneis:[o],curva:r}:{tipo:"Polygon",aneis:[o]}}const n=e?s.amostrarCurva(r,!1):r.map(o=>o.ponto);return e?{tipo:"LineString",coordenadas:n,curva:r}:{tipo:"LineString",coordenadas:n}}const C=(r,t)=>r[0]===t[0]&&r[1]===t[1];class D{constructor(t,e=!1,n={}){i(this,"pontos",[]);i(this,"cursor",null);i(this,"ancoras",[]);i(this,"espaco");i(this,"raioMinimo");i(this,"lados");i(this,"pontas");i(this,"proporcaoInterna");this.ferramenta=t,this.fechar=e,this.espaco=n.espaco??l.ESPACO_GEOGRAFICO;const o=n.raioMinimoCirculo;this.raioMinimo=typeof o=="number"&&Number.isFinite(o)&&o>=0?o:d,this.lados=m(n.ladosPoligono,3,360,6),this.pontas=m(n.pontasEstrela,3,360,5),this.proporcaoInterna=n.proporcaoInternaEstrela}formaDeDoisCliques(t,e){return this.ferramenta==="elipse"?l.gerarElipse(t,e):this.ferramenta==="poligono-regular"?l.gerarPoligonoRegular(t,e,this.lados,this.espaco):l.gerarEstrela(t,e,this.pontas,this.espaco,this.proporcaoInterna)}get nos(){return this.ferramenta==="caneta"?this.ancoras.length:this.pontos.length}get ehSequencial(){return["linha","poligono","caneta","medir-distancia","medir-area","dividir","selecao-laco"].includes(this.ferramenta)}get ehArea(){return this.ferramenta==="poligono"||this.ferramenta==="medir-area"||this.ferramenta==="selecao-laco"||this.ferramenta==="caneta"&&this.fechar}get fechaNoPrimeiro(){return this.nos>=3&&(this.ehArea||this.ferramenta==="caneta")}get primeiro(){var t;return(this.ferramenta==="caneta"?(t=this.ancoras[0])==null?void 0:t.ponto:this.pontos[0])??null}get minimo(){return this.ehArea?3:2}get podeConcluir(){return this.ehSequencial&&this.nos>=this.minimo}mover(t){this.cursor=t}clicar(t){switch(this.ferramenta){case"ponto":return{concluida:{tipo:"Point",coordenada:t}};case"texto":return{concluida:{tipo:"Text",coordenada:t,texto:""}};case"retangulo":if(this.pontos.length===0)return this.pontos.push(t),{};{const e=this.retangulo(this.pontos[0],t);return e?{concluida:e}:{aviso:this.espaco.tipo==="plano"?"Os dois cantos precisam diferir na horizontal e na vertical.":"Os dois cantos precisam diferir em latitude e em longitude."}}case"circulo":if(this.pontos.length===0)return this.pontos.push(t),{};{const e=this.espaco.distancia(this.pontos[0],t);return e>=this.raioMinimo?{concluida:{tipo:"Circle",centro:this.pontos[0],raioMetros:e}}:{aviso:`Raio mínimo de ${this.raioMinimo} ${this.espaco.unidade}: clique mais longe do centro.`}}case"elipse":case"poligono-regular":case"estrela":{if(this.pontos.length===0)return this.pontos.push(t),{};const e=this.formaDeDoisCliques(this.pontos[0],t);return e?{concluida:{tipo:"Polygon",aneis:[e]}}:{aviso:"Clique num ponto diferente do centro."}}case"caneta":return this.ancoras.push({ponto:t}),{};case"conta-gotas":return{};default:return this.pontos.length>0&&C(this.pontos[this.pontos.length-1],t)?{}:(this.pontos.push(t),{})}}definirAlca(t){const e=this.ancoras[this.ancoras.length-1];this.ferramenta==="caneta"&&e&&(e.alca=t)}moverAlcaDaAncora(t,e,n,o=!0){const a=this.ancoras[t];if(this.ferramenta!=="caneta"||!a)return;if(o){a.alca=e==="saida"?n:s.espelhoDaAlca(a.ponto,n),delete a.entrada;return}const p=u(a);e==="saida"?(a.alca=n,p&&(a.entrada=p)):(a.alca??(a.alca=a.ponto),a.entrada=n)}desfazer(){const t=this.ferramenta==="caneta"?this.ancoras:this.pontos;return t.length===0?!1:(t.pop(),!0)}vertices(){return this.ferramenta==="caneta"?g(this.ancoras):this.pontos}retangulo(t,e){return t[0]===e[0]||t[1]===e[1]?null:{tipo:"Polygon",aneis:[[[t[0],t[1]],[t[0],e[1]],[e[0],e[1]],[e[0],t[1]]]]}}previa(){const t=this.cursor;switch(this.ferramenta){case"retangulo":return this.pontos.length===1&&t?this.retangulo(this.pontos[0],t):null;case"circulo":{if(this.pontos.length!==1||!t)return null;const e=this.espaco.distancia(this.pontos[0],t);return e>=this.raioMinimo?{tipo:"Circle",centro:this.pontos[0],raioMetros:e}:null}case"caneta":{if(this.ancoras.length===0)return null;const e=c(t?[...this.ancoras,{ponto:t}]:this.ancoras);return e.length<2?null:h(e,this.ehArea&&e.length>=3)}case"elipse":case"poligono-regular":case"estrela":{if(this.pontos.length!==1||!t)return null;const e=this.formaDeDoisCliques(this.pontos[0],t);return e?{tipo:"Polygon",aneis:[e]}:null}case"ponto":case"texto":case"conta-gotas":return null;default:{const e=t?[...this.pontos,t]:[...this.pontos];return e.length<2?null:this.ehArea&&e.length>=3?{tipo:"Polygon",aneis:[e]}:{tipo:"LineString",coordenadas:e}}}}concluir(){if(!this.podeConcluir)return null;if(this.ferramenta==="caneta")return h(c(this.ancoras),this.ehArea);const t=this.vertices();return this.ehArea?{tipo:"Polygon",aneis:[t]}:{tipo:"LineString",coordenadas:t}}concluirFechando(){return this.fechaNoPrimeiro?this.ferramenta==="caneta"?h(c(this.ancoras),!0):{tipo:"Polygon",aneis:[this.vertices()]}:null}comprimentoMetros(){const t=this.cursor&&this.nos>0?[...this.vertices(),this.cursor]:this.vertices();return this.espaco.comprimento(t,!1)}}exports.FERRAMENTAS=f;exports.RAIO_MINIMO_CIRCULO_M=d;exports.SessaoDesenho=D;exports.amostrarBezier=g;exports.ehFerramenta=M;exports.entradaDaAncora=u;exports.nosDeAncoras=c;
|