odant-work 1.0.62 → 1.0.64
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/#system/package-manifest.json +141 -109
- package/$server/$folder/$class/$structure/handlers/pages/form/gantt/$handler/class.js +27 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/gantt/$handler/gantt.js +293 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/scheduler/$handler/class.js +27 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/scheduler/$handler/scheduler.js +234 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/staff/$handler/staff.js +119 -0
- package/$server/$folder/$class/handlers/pages/form/object/$handler/class.js +6 -1
- package/$server/$folder/$class/handlers/pages/form/objects/$handler/class.js +8 -2
- package/$server/$folder/handlers/pages/form/$handler/form.js +44 -1
- package/$server/$folder/lib/explorer/explorer.js +29 -0
- package/MODULES/Geo/$module/readme.md +6 -4
- package/MODULES/Geo//320/223/320/265/320/276/321/202/320/276/321/207/320/272/320/270/$catalog/class.js +12 -3
- package/MODULES/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/class.js +11 -0
- package/MODULES/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/handlers/pages/form/map/$handler/class.js +25 -0
- package/MODULES/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/handlers/pages/form/map/$handler/map.js +623 -0
- package/MODULES/Geo//320/232/320/276/320/276/321/200/320/264/320/270/320/275/320/260/321/202/321/213/$struct/class.js +1 -0
- package/MODULES/Geo//320/250/320/265/320/271/320/277/$struct/class.js +17 -0
- package/MODULES/KLADR/$module/$folder/$class/$catalog/class.js +12 -0
- package/MODULES/KLADR/$module/class.js +4 -0
- package/MODULES/KLADR/$module/handlers/pages/form/kladr/$handler/class.js +7 -0
- package/MODULES/KLADR/$module/handlers/pages/form/kladr/$handler/kladr.js +134 -0
- package/MODULES/KLADR/$module/readme.md +10 -0
- package/MODULES/KLADR//320/235/320/260/321/201/320/265/320/273/321/221/320/275/320/275/321/213/320/265 /320/277/321/203/320/275/320/272/321/202/321/213/$catalog/class.js" +14 -0
- package/MODULES/KLADR//320/237/320/276/320/264/321/200/320/260/320/267/320/264/320/265/320/273/320/265/320/275/320/270/321/217 /320/234/320/222/320/224/$catalog/class.js" +13 -0
- package/MODULES/KLADR//320/240/320/265/320/263/320/270/320/276/320/275/321/213/$catalog/class.js +14 -0
- package/MODULES/KLADR//320/243/320/273/320/270/321/206/321/213/$catalog/class.js +13 -0
- package/MODULES/Process/$module/$folder/$class/$catalog/class.js +7 -0
- package/MODULES/Process/$module/class.js +4 -0
- package/MODULES/Process/$module/readme.md +7 -0
- package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/class.js" +29 -0
- package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/gantt/$handler/class.js" +7 -0
- package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/gantt/$handler/gantt.js" +1 -0
- package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/scheduler/$handler/class.js" +7 -0
- package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/scheduler/$handler/scheduler.js" +1 -0
- package/MODULES/Process//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/class.js" +18 -0
- package/MODULES/Process//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/handlers/pages/form/bpmn/$handler/bpmn.js" +406 -0
- package/MODULES/Process//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/handlers/pages/form/bpmn/$handler/class.js" +19 -0
- package/MODULES/Register/$module/readme.md +3 -3
- package/MODULES/Register/CATALOGS/$catalog/class.js +1 -6
- package/MODULES/Register/CATALOGS/$catalog/readme.md +1 -1
- package/MODULES/Register/CATALOGS//320/222/320/270/320/264/321/213 /320/275/320/276/321/200/320/274/320/260/321/202/320/270/320/262/320/276/320/262/$catalog/class.js" +11 -4
- package/MODULES/Register/CATALOGS//320/224/320/276/320/263/320/276/320/262/320/276/321/200/321/213/$catalog/class.js +21 -19
- package/MODULES/Register/CATALOGS//320/224/320/276/320/273/320/266/320/275/320/276/321/201/321/202/320/270/$catalog/class.js +1 -1
- package/MODULES/Register/CATALOGS//320/232/320/273/320/270/320/265/320/275/321/202/321/213/$virtual/class.js +11 -10
- package/MODULES/Register/CATALOGS//320/235/320/276/320/274/320/265/320/275/320/272/320/273/320/260/321/202/321/203/321/200/320/260/$catalog/class.js +24 -13
- package/MODULES/Register/CATALOGS//320/237/320/260/321/200/321/202/320/270/320/270/$catalog/class.js +13 -13
- package/MODULES/Register/CATALOGS//320/237/320/276/321/201/321/202/320/260/320/262/321/211/320/270/320/272/320/270/$virtual/class.js +9 -8
- package/MODULES/Register/CATALOGS//320/241/320/272/320/273/320/260/320/264/321/213/$catalog/class.js +17 -0
- package/MODULES/Register/CATALOGS//320/241/320/276/321/202/321/200/321/203/320/264/320/275/320/270/320/272/320/270/$virtual/class.js +11 -9
- package/MODULES/Register/CATALOGS//320/241/320/276/321/202/321/200/321/203/320/264/320/275/320/270/320/272/320/270//320/222 /320/276/321/202/320/277/321/203/321/201/320/272/320/265/$virtual/class.js" +1 -1
- package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213/$catalog/class.js +13 -11
- package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213//320/230/320/237/$catalog/class.js +4 -6
- package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213//320/244/320/270/320/267. /320/273/320/270/321/206/320/260/$catalog/class.js" +12 -11
- package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213//320/256/321/200. /320/273/320/270/321/206/320/260/$catalog/class.js" +15 -14
- package/MODULES/Register/CATALOGS//320/242/321/200/320/260/320/275/321/201/320/277/320/276/321/200/321/202/$catalog/class.js +19 -18
- package/MODULES/Register/OPERATIONS/$operation/class.js +1 -1
- package/MODULES/Register/OPERATIONS/$operation/readme.md +1 -1
- package/MODULES/Register/OPERATIONS//320/224/320/276/321/201/321/202/320/260/320/262/320/272/320/260/$operation/class.js +22 -21
- package/MODULES/Register/OPERATIONS//320/227/320/260/321/200/320/277/320/273/320/260/321/202/320/260/$operation/class.js +48 -47
- package/MODULES/Register/OPERATIONS//320/230/320/275/320/262/320/265/320/275/321/202/320/260/321/200/320/270/320/267/320/260/321/206/320/270/321/217/$operation/class.js +46 -45
- package/MODULES/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213/$operation/class.js +1 -1
- package/MODULES/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213//320/236/321/202/320/277/321/200/320/260/320/262/320/270/321/202/321/214 /320/262 /320/276/321/202/320/277/321/203/321/201/320/272/$operation/class.js" +1 -1
- package/MODULES/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213//320/237/321/200/320/270/321/221/320/274 /320/275/320/260 /321/200/320/260/320/261/320/276/321/202/321/203/$operation/class.js" +18 -14
- package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260/$operation/class.js +1 -1
- package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260//320/220/320/262/320/260/320/275/321/201/320/276/320/262/321/213/320/271 /320/276/321/202/321/207/321/221/321/202/$operation/class.js" +1 -1
- package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260//320/237/320/232/320/236/$operation/class.js +3 -3
- package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260//320/240/320/232/320/236/$operation/class.js +1 -1
- package/MODULES/Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270/$operation/class.js +1 -1
- package/MODULES/Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270//320/227/320/262/320/276/320/275/320/276/320/272/$operation/class.js +2 -2
- package/MODULES/Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270//320/237/320/270/321/201/321/214/320/274/320/276/$operation/class.js +1 -1
- package/MODULES/Register/OPERATIONS//320/{244/320/260/321/201/320/276/320/262/320/272/320/260 → 232/320/276/320/274/320/277/320/273/320/265/320/272/321/202/320/260/321/206/320/270/321/217}/$operation/class.js +52 -57
- package/MODULES/Register/OPERATIONS//320/236/321/201/320/275/320/276/320/262/320/275/321/213/320/265 /321/201/321/200/320/265/320/264/321/201/321/202/320/262/320/260//320/235/320/260/321/207/320/270/321/201/320/273/320/265/320/275/320/270/320/265 /320/260/320/274/320/276/321/200/321/202/320/270/320/267/320/260/321/206/320/270/320/270/$operation/class.js" +2 -2
- package/MODULES/Register/OPERATIONS//320/236/321/201/320/275/320/276/320/262/320/275/321/213/320/265 /321/201/321/200/320/265/320/264/321/201/321/202/320/262/320/260//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/320/265 /320/236/320/241/$operation/class.js" +7 -6
- package/MODULES/Register/OPERATIONS//320/236/321/201/320/275/320/276/320/262/320/275/321/213/320/265 /321/201/321/200/320/265/320/264/321/201/321/202/320/262/320/260//320/237/321/200/320/270/320/275/321/217/321/202/320/270/320/265 /320/272 /321/203/321/207/321/221/321/202/321/203 /320/236/320/241/$operation/class.js" +2 -2
- package/MODULES/Register/OPERATIONS//320/237/320/265/321/200/320/265/320/274/320/265/321/211/320/265/320/275/320/270/320/265/$operation/class.js +41 -40
- package/MODULES/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260/$operation/class.js" +1 -1
- package/MODULES/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260//320/227/320/260/321/200/320/277/320/273/320/260/321/202/320/260/$operation/class.js" +1 -1
- package/MODULES/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260//320/237/320/276/321/201/321/202/320/260/320/262/321/211/320/270/320/272/321/203/$operation/class.js" +11 -10
- package/MODULES/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/320/265 /321/202/320/276/320/262/320/260/321/200/320/260/$operation/class.js" +45 -46
- package/MODULES/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202/$operation/class.js" +1 -1
- package/MODULES/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202//320/222/320/276/320/267/320/262/321/200/320/260/321/202 /320/276/321/202 /320/277/320/276/321/201/321/202/320/260/320/262/321/211/320/270/320/272/320/260/$operation/class.js" +11 -10
- package/MODULES/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202//320/236/321/202 /320/277/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/217/$operation/class.js" +11 -10
- package/MODULES/Register/OPERATIONS//320/237/321/200/320/276/320/270/320/267/320/262/320/276/320/264/321/201/321/202/320/262/320/276//320/222/321/213/320/277/321/203/321/201/320/272 /320/263/320/276/321/202/320/276/320/262/320/276/320/271 /320/277/321/200/320/276/320/264/321/203/320/272/321/206/320/270/320/270/$operation/class.js" +4 -4
- package/MODULES/Register/OPERATIONS//320/237/321/200/320/276/320/270/320/267/320/262/320/276/320/264/321/201/321/202/320/262/320/276//320/237/320/265/321/200/320/265/320/264/320/260/321/207/320/260 /320/274/320/260/321/202/320/265/321/200/320/270/320/260/320/273/320/276/320/262 /320/262 /320/277/321/200/320/276/320/270/320/267/320/262/320/276/320/264/321/201/321/202/320/262/320/276/$operation/class.js" +5 -4
- package/MODULES/Register/OPERATIONS//320/237/321/200/320/276/320/270/320/267/320/262/320/276/320/264/321/201/321/202/320/262/320/276//320/241/320/277/320/270/321/201/320/260/320/275/320/270/320/265 /320/276/320/261/321/211/320/265/321/205/320/276/320/267/321/217/320/271/321/201/321/202/320/262/320/265/320/275/320/275/321/213/321/205 /320/267/320/260/321/202/321/200/320/260/321/202/$operation/class.js" +6 -6
- package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217/$operation/class.js +26 -25
- package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/222/320/276/320/267/320/262/321/200/320/260/321/202 /320/276/321/202 /320/277/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/217/$operation/class.js" +32 -31
- package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/class.js +32 -31
- package/MODULES/Register/OPERATIONS//320/241/320/277/320/270/321/201/320/260/320/275/320/270/320/265 /320/242/320/234/320/246/$operation/class.js" +28 -0
- package/MODULES/Register/OPERATIONS//320/243/321/201/321/202/320/260/320/275/320/276/320/262/320/272/320/260 /320/275/320/276/321/200/320/274/320/260/321/202/320/270/320/262/320/260/$operation/class.js" +3 -3
- package/MODULES/Register/OPERATIONS//320/244/320/270/320/275/320/260/320/275/321/201/320/276/320/262/321/213/320/271 /321/200/320/265/320/267/321/203/320/273/321/214/321/202/320/260/321/202//320/227/320/260/320/272/321/200/321/213/321/202/320/270/320/265 /320/274/320/265/321/201/321/217/321/206/320/260/$operation/class.js" +1 -1
- package/MODULES/Register/REGISTER/$register/$folder/$class/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/$register/$folder/$class/$account/readme.md +1 -1
- package/MODULES/Register/REGISTER/$register/readme.md +1 -1
- package/MODULES/Register/REGISTER/01/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/02/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/04/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/08/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/10/$account/class.js +23 -1
- package/MODULES/Register/REGISTER/10/01/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/10/05/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/41/$account/class.js +25 -24
- package/MODULES/Register/REGISTER/43/$account/class.js +2 -2
- package/MODULES/Register/REGISTER/44/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/60/$account/class.js +24 -15
- package/MODULES/Register/REGISTER/62/$account/class.js +24 -15
- package/MODULES/Register/REGISTER/67/$account/class.js +1 -0
- package/MODULES/Register/REGISTER/70/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/71/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/73/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/76/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/90/01/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/90/02/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/90/03/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/91/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/94/$account/class.js +24 -23
- package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213/$account/class.js +1 -1
- package/MODULES/Register/REGISTER//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270/$account/class.js +1 -1
- package/MODULES/Register/REGISTER//320/235/320/276/321/200/320/274/320/260/321/202/320/270/320/262/321/213/$account/class.js +2 -2
- package/MODULES/Register/STRUCTS//320/220/320/264/321/200/320/265/321/201/$struct/class.js +14 -11
- package/MODULES/Register/STRUCTS//320/225/320/264/320/270/320/275/320/270/321/206/320/260 /320/270/320/267/320/274/320/265/321/200/320/265/320/275/320/270/321/217/$struct/class.js" +11 -11
- package/MODULES/Register/STRUCTS//320/237/320/260/321/201/320/277/320/276/321/200/321/202/$struct/class.js +14 -11
- package/MODULES/Register/STRUCTS//320/244/320/230/320/236/$struct/class.js +16 -0
- package/package.json +1 -1
- package/scripts/check-ignored-code.mjs +1 -1
- package/scripts/demo-seed.mjs +7 -5
- package/sources/client.js +6 -1
- package/sources/data/fio.js +355 -0
- package/sources/data/objects.js +11 -1
- package/sources/data/print.js +29 -3
- package/sources/data/schema.js +16 -4
- package/sources/host/auth-methods.js +34 -2
- package/sources/modules/kladr/index.js +336 -0
- package/sources/modules/user-profile/user-profile.js +40 -2
- package/sources/server/access/gateway.js +6 -0
- package/sources/server/access/invites.js +416 -0
- package/sources/server/class/base-template.js +94 -61
- package/sources/server/class.js +22 -0
- package/sources/server/folder.js +72 -6
- package/$server/$folder/$class/$structure/$server/handlers/methods/npm/$handler/class.js +0 -16
- package/$server/$folder/$class/ai/progress.md +0 -33
- package/$server/$folder/$file/$task/progress.md +0 -20
- package/$server/$folder/handlers/methods/create/progress.md +0 -15
- package/$server/$folder/lib/dot/progress.md +0 -15
- package/$server/$folder/lib/menu/progress.md +0 -13
- package/$server/$folder/lib/node/progress.md +0 -13
- package/$server/$folder/lib/prompt-bar/progress.md +0 -13
- package/$server/$folder/lib/tree/progress.md +0 -16
- package/.cursor/rules/work.mdc +0 -8
- package/.cursorrules +0 -2
- package/MODULES/Register/CATALOGS//320/241/320/272/320/273/320/260/320/264/321/213 /320/270 /321/200/320/265/320/267/320/265/321/200/320/262/321/203/320/260/321/200/321/213/$catalog/class.js" +0 -17
- package/MODULES/Register/OPERATIONS//320/225/321/201/321/202/320/265/321/201/321/202/320/262/320/265/320/275/320/275/320/260/321/217 /321/203/320/261/321/213/320/273/321/214/$operation/class.js" +0 -21
- package/NODES/teewtew/$node/class.js +0 -3
- package/NODES/work.odant.org/$node/class.js +0 -4
- package/config.json +0 -1
- package/eslint.config.js +0 -51
- package/jsconfig.json +0 -37
- package/oda/components/packets/progress.md +0 -29
- package/oda/progress.md +0 -29
- package/opencode.json +0 -9
- package/progress.md +0 -13
- package/publish.cmd +0 -2
- package/sources/data/progress.md +0 -792
- package/sources/host/progress.md +0 -14
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Представление «Карта» (form/map) для классов с миксином /MODULES/Geo/Карта (coords + shape).
|
|
3
|
+
* Поддерживает подложки OpenStreetMap, 2GIS, Yandex (EPSG:3395), Google (EPSG:3857),
|
|
4
|
+
* отображение объектов и шейпов, а также интерактивное задание координат и полигонов.
|
|
5
|
+
*/
|
|
6
|
+
const PROVIDERS = {
|
|
7
|
+
osm: {
|
|
8
|
+
id: 'osm',
|
|
9
|
+
label: 'OpenStreetMap',
|
|
10
|
+
tileUrl: (x, y, z) => `https://tile.openstreetmap.org/${z}/${x}/${y}.png`,
|
|
11
|
+
yandexProj: false,
|
|
12
|
+
},
|
|
13
|
+
'2gis': {
|
|
14
|
+
id: '2gis',
|
|
15
|
+
label: '2GIS',
|
|
16
|
+
tileUrl: (x, y, z) => `https://tile2.maps.2gis.com/tiles?x=${x}&y=${y}&z=${z}&v=1`,
|
|
17
|
+
yandexProj: false,
|
|
18
|
+
},
|
|
19
|
+
yandex: {
|
|
20
|
+
id: 'yandex',
|
|
21
|
+
label: 'Яндекс',
|
|
22
|
+
tileUrl: (x, y, z) => `https://core-renderer-tiles.maps.yandex.net/tiles?l=map&x=${x}&y=${y}&z=${z}&scale=1&lang=ru_RU`,
|
|
23
|
+
yandexProj: true,
|
|
24
|
+
},
|
|
25
|
+
google: {
|
|
26
|
+
id: 'google',
|
|
27
|
+
label: 'Google',
|
|
28
|
+
tileUrl: (x, y, z) => `https://mt1.google.com/vt/lyrs=m&x=${x}&y=${y}&z=${z}&hl=ru`,
|
|
29
|
+
yandexProj: false,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const RAD = Math.PI / 180;
|
|
34
|
+
const E_WGS84 = 0.08181919084262149;
|
|
35
|
+
|
|
36
|
+
function latLonToPixel(lat, lon, zoom, yandexProj = false) {
|
|
37
|
+
const scale = 256 * Math.pow(2, zoom);
|
|
38
|
+
const clampedLat = Math.max(-85.0511, Math.min(85.0511, Number(lat) || 0));
|
|
39
|
+
const x = ((Number(lon) || 0) + 180) / 360 * scale;
|
|
40
|
+
const phi = clampedLat * RAD;
|
|
41
|
+
let mercY;
|
|
42
|
+
if (yandexProj) {
|
|
43
|
+
const esin = E_WGS84 * Math.sin(phi);
|
|
44
|
+
const ts = Math.tan(Math.PI / 4 + phi / 2) * Math.pow((1 - esin) / (1 + esin), E_WGS84 / 2);
|
|
45
|
+
mercY = Math.log(ts);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
mercY = Math.log(Math.tan(Math.PI / 4 + phi / 2));
|
|
49
|
+
}
|
|
50
|
+
const y = (0.5 - mercY / (2 * Math.PI)) * scale;
|
|
51
|
+
return { x, y };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function pixelToLatLon(px, py, zoom, yandexProj = false) {
|
|
55
|
+
const scale = 256 * Math.pow(2, zoom);
|
|
56
|
+
const lon = (px / scale) * 360 - 180;
|
|
57
|
+
const mercY = (0.5 - py / scale) * 2 * Math.PI;
|
|
58
|
+
let lat;
|
|
59
|
+
if (yandexProj) {
|
|
60
|
+
const expY = Math.exp(-mercY);
|
|
61
|
+
let phi = Math.PI / 2 - 2 * Math.atan(expY);
|
|
62
|
+
for (let i = 0; i < 6; i++) {
|
|
63
|
+
const esin = E_WGS84 * Math.sin(phi);
|
|
64
|
+
phi = Math.PI / 2 - 2 * Math.atan(expY * Math.pow((1 - esin) / (1 + esin), E_WGS84 / 2));
|
|
65
|
+
}
|
|
66
|
+
lat = phi / RAD;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
lat = (2 * Math.atan(Math.exp(mercY)) - Math.PI / 2) / RAD;
|
|
70
|
+
}
|
|
71
|
+
return { lat: Number(lat.toFixed(6)), lon: Number(lon.toFixed(6)) };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function parseShapeCoords(shape) {
|
|
75
|
+
if (!shape || !shape.geojson)
|
|
76
|
+
return [];
|
|
77
|
+
try {
|
|
78
|
+
const parsed = typeof shape.geojson === 'string' ? JSON.parse(shape.geojson) : shape.geojson;
|
|
79
|
+
if (Array.isArray(parsed)) {
|
|
80
|
+
return parsed.map(p => Array.isArray(p) ? [Number(p[0]), Number(p[1])] : [Number(p.lat), Number(p.lon)])
|
|
81
|
+
.filter(([la, lo]) => Number.isFinite(la) && Number.isFinite(lo));
|
|
82
|
+
}
|
|
83
|
+
if (parsed?.type === 'Polygon' && Array.isArray(parsed.coordinates?.[0])) {
|
|
84
|
+
return parsed.coordinates[0].map(([lo, la]) => [Number(la), Number(lo)]);
|
|
85
|
+
}
|
|
86
|
+
if (parsed?.type === 'LineString' && Array.isArray(parsed.coordinates)) {
|
|
87
|
+
return parsed.coordinates.map(([lo, la]) => [Number(la), Number(lo)]);
|
|
88
|
+
}
|
|
89
|
+
if (parsed?.type === 'Point' && Array.isArray(parsed.coordinates)) {
|
|
90
|
+
return [[Number(parsed.coordinates[1]), Number(parsed.coordinates[0])]];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch { /* ignore */ }
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export default {
|
|
98
|
+
imports: 'oda//button, oda//icon',
|
|
99
|
+
template: /* html */`
|
|
100
|
+
<style>
|
|
101
|
+
:host {
|
|
102
|
+
@apply --vertical;
|
|
103
|
+
@apply --flex;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
background: var(--content-background);
|
|
106
|
+
color: var(--content-color);
|
|
107
|
+
font-size: 13px;
|
|
108
|
+
}
|
|
109
|
+
.toolbar {
|
|
110
|
+
@apply --horizontal;
|
|
111
|
+
align-items: center;
|
|
112
|
+
gap: 8px;
|
|
113
|
+
padding: 8px 12px;
|
|
114
|
+
border-bottom: 1px solid var(--subtle-border);
|
|
115
|
+
background: var(--subtle-background);
|
|
116
|
+
flex-wrap: wrap;
|
|
117
|
+
}
|
|
118
|
+
.provider-group {
|
|
119
|
+
@apply --horizontal;
|
|
120
|
+
gap: 4px;
|
|
121
|
+
background: var(--content-background);
|
|
122
|
+
padding: 2px;
|
|
123
|
+
border-radius: 8px;
|
|
124
|
+
border: 1px solid var(--subtle-border);
|
|
125
|
+
}
|
|
126
|
+
.chip {
|
|
127
|
+
padding: 4px 10px;
|
|
128
|
+
border-radius: 6px;
|
|
129
|
+
cursor: pointer;
|
|
130
|
+
font-size: 12px;
|
|
131
|
+
font-weight: 600;
|
|
132
|
+
border: none;
|
|
133
|
+
background: transparent;
|
|
134
|
+
color: var(--content-color);
|
|
135
|
+
}
|
|
136
|
+
.chip.active {
|
|
137
|
+
background: var(--accent-color, #1d63dc);
|
|
138
|
+
color: #fff;
|
|
139
|
+
}
|
|
140
|
+
.main {
|
|
141
|
+
@apply --horizontal;
|
|
142
|
+
@apply --flex;
|
|
143
|
+
min-height: 0;
|
|
144
|
+
overflow: hidden;
|
|
145
|
+
}
|
|
146
|
+
.sidebar {
|
|
147
|
+
width: 280px;
|
|
148
|
+
flex-shrink: 0;
|
|
149
|
+
border-right: 1px solid var(--subtle-border);
|
|
150
|
+
@apply --vertical;
|
|
151
|
+
overflow: hidden;
|
|
152
|
+
}
|
|
153
|
+
.sidebar-search {
|
|
154
|
+
padding: 8px;
|
|
155
|
+
border-bottom: 1px solid var(--subtle-border);
|
|
156
|
+
}
|
|
157
|
+
.sidebar-search input {
|
|
158
|
+
width: 100%;
|
|
159
|
+
box-sizing: border-box;
|
|
160
|
+
padding: 6px 8px;
|
|
161
|
+
border: 1px solid var(--control-border-color);
|
|
162
|
+
border-radius: 6px;
|
|
163
|
+
background: var(--control-background);
|
|
164
|
+
color: var(--control-color);
|
|
165
|
+
font: inherit;
|
|
166
|
+
}
|
|
167
|
+
.obj-list {
|
|
168
|
+
@apply --flex;
|
|
169
|
+
overflow-y: auto;
|
|
170
|
+
padding: 6px;
|
|
171
|
+
display: flex;
|
|
172
|
+
flex-direction: column;
|
|
173
|
+
gap: 4px;
|
|
174
|
+
}
|
|
175
|
+
.obj-item {
|
|
176
|
+
padding: 8px 10px;
|
|
177
|
+
border-radius: 8px;
|
|
178
|
+
border: 1px solid transparent;
|
|
179
|
+
cursor: pointer;
|
|
180
|
+
display: flex;
|
|
181
|
+
flex-direction: column;
|
|
182
|
+
gap: 2px;
|
|
183
|
+
}
|
|
184
|
+
.obj-item:hover {
|
|
185
|
+
background: var(--subtle-background);
|
|
186
|
+
}
|
|
187
|
+
.obj-item.selected {
|
|
188
|
+
border-color: var(--accent-color, #1d63dc);
|
|
189
|
+
background: var(--accent-soft, rgba(29, 99, 220, 0.1));
|
|
190
|
+
}
|
|
191
|
+
.obj-title {
|
|
192
|
+
font-weight: 600;
|
|
193
|
+
white-space: nowrap;
|
|
194
|
+
overflow: hidden;
|
|
195
|
+
text-overflow: ellipsis;
|
|
196
|
+
}
|
|
197
|
+
.obj-meta {
|
|
198
|
+
font-size: 11.5px;
|
|
199
|
+
color: var(--muted-color);
|
|
200
|
+
}
|
|
201
|
+
.viewport {
|
|
202
|
+
@apply --flex;
|
|
203
|
+
position: relative;
|
|
204
|
+
overflow: hidden;
|
|
205
|
+
background: #dbe6f2;
|
|
206
|
+
user-select: none;
|
|
207
|
+
cursor: grab;
|
|
208
|
+
}
|
|
209
|
+
.viewport.picking {
|
|
210
|
+
cursor: crosshair;
|
|
211
|
+
}
|
|
212
|
+
.viewport:active:not(.picking) {
|
|
213
|
+
cursor: grabbing;
|
|
214
|
+
}
|
|
215
|
+
.tiles-layer, .svg-layer, .markers-layer {
|
|
216
|
+
position: absolute;
|
|
217
|
+
inset: 0;
|
|
218
|
+
width: 100%;
|
|
219
|
+
height: 100%;
|
|
220
|
+
pointer-events: none;
|
|
221
|
+
}
|
|
222
|
+
.tiles-layer img {
|
|
223
|
+
position: absolute;
|
|
224
|
+
width: 256px;
|
|
225
|
+
height: 256px;
|
|
226
|
+
image-rendering: auto;
|
|
227
|
+
}
|
|
228
|
+
.marker {
|
|
229
|
+
position: absolute;
|
|
230
|
+
transform: translate(-50%, -100%);
|
|
231
|
+
pointer-events: auto;
|
|
232
|
+
cursor: pointer;
|
|
233
|
+
display: flex;
|
|
234
|
+
flex-direction: column;
|
|
235
|
+
align-items: center;
|
|
236
|
+
}
|
|
237
|
+
.marker-pin {
|
|
238
|
+
width: 24px;
|
|
239
|
+
height: 24px;
|
|
240
|
+
border-radius: 50% 50% 50% 0;
|
|
241
|
+
background: #1d63dc;
|
|
242
|
+
border: 2px solid #fff;
|
|
243
|
+
transform: rotate(-45deg);
|
|
244
|
+
box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
|
|
245
|
+
}
|
|
246
|
+
.marker.selected .marker-pin {
|
|
247
|
+
background: #ef4444;
|
|
248
|
+
transform: rotate(-45deg) scale(1.18);
|
|
249
|
+
}
|
|
250
|
+
.marker-lbl {
|
|
251
|
+
margin-top: 3px;
|
|
252
|
+
background: rgba(15, 23, 42, 0.85);
|
|
253
|
+
color: #fff;
|
|
254
|
+
padding: 2px 6px;
|
|
255
|
+
border-radius: 4px;
|
|
256
|
+
font-size: 11px;
|
|
257
|
+
font-weight: 600;
|
|
258
|
+
white-space: nowrap;
|
|
259
|
+
max-width: 160px;
|
|
260
|
+
overflow: hidden;
|
|
261
|
+
text-overflow: ellipsis;
|
|
262
|
+
}
|
|
263
|
+
.zoom-controls {
|
|
264
|
+
position: absolute;
|
|
265
|
+
right: 12px;
|
|
266
|
+
top: 12px;
|
|
267
|
+
display: flex;
|
|
268
|
+
flex-direction: column;
|
|
269
|
+
gap: 4px;
|
|
270
|
+
z-index: 5;
|
|
271
|
+
}
|
|
272
|
+
.zoom-btn {
|
|
273
|
+
width: 32px;
|
|
274
|
+
height: 32px;
|
|
275
|
+
border-radius: 8px;
|
|
276
|
+
border: 1px solid var(--subtle-border);
|
|
277
|
+
background: var(--content-background);
|
|
278
|
+
color: var(--content-color);
|
|
279
|
+
font-size: 18px;
|
|
280
|
+
font-weight: 700;
|
|
281
|
+
cursor: pointer;
|
|
282
|
+
box-shadow: 0 2px 6px rgba(0,0,0,0.18);
|
|
283
|
+
}
|
|
284
|
+
.coords-bar {
|
|
285
|
+
position: absolute;
|
|
286
|
+
left: 12px;
|
|
287
|
+
bottom: 10px;
|
|
288
|
+
background: rgba(15, 23, 42, 0.8);
|
|
289
|
+
color: #f8fafc;
|
|
290
|
+
padding: 4px 10px;
|
|
291
|
+
border-radius: 6px;
|
|
292
|
+
font-family: monospace;
|
|
293
|
+
font-size: 11.5px;
|
|
294
|
+
z-index: 5;
|
|
295
|
+
}
|
|
296
|
+
</style>
|
|
297
|
+
|
|
298
|
+
<div class="toolbar">
|
|
299
|
+
<div class="provider-group">
|
|
300
|
+
<button ~for="providerList" class="chip" ~class="{active: provider === $for.item.id}" @tap="setProvider($for.item.id)">{{$for.item.label}}</button>
|
|
301
|
+
</div>
|
|
302
|
+
<oda-button icon="icons:refresh" @tap="reload()">Обновить</oda-button>
|
|
303
|
+
<div ~if="selectedObj" class="horizontal" style="gap:6px;align-items:center;margin-left:auto;flex-wrap:wrap;">
|
|
304
|
+
<oda-button icon="carbon:location" :light="editMode === 'point'" @tap="toggleEditMode('point')">
|
|
305
|
+
{{editMode === 'point' ? 'Кликните на карту…' : 'Указать точку'}}
|
|
306
|
+
</oda-button>
|
|
307
|
+
<oda-button icon="carbon:area" :light="editMode === 'polygon'" @tap="toggleEditMode('polygon')">
|
|
308
|
+
{{editMode === 'polygon' ? 'Рисование (' + draftPoints.length + ' т.)' : 'Нарисовать шейп'}}
|
|
309
|
+
</oda-button>
|
|
310
|
+
<oda-button ~if="editMode === 'polygon' && draftPoints.length >= 3" icon="icons:check" @tap="saveDraftPolygon()">Сохранить шейп</oda-button>
|
|
311
|
+
<oda-button ~if="editMode" icon="icons:close" @tap="cancelEdit()">Отмена</oda-button>
|
|
312
|
+
<oda-button icon="icons:open-in-new" @tap="openObject(selectedObj)">Карточка</oda-button>
|
|
313
|
+
</div>
|
|
314
|
+
</div>
|
|
315
|
+
|
|
316
|
+
<div class="main">
|
|
317
|
+
<div class="sidebar">
|
|
318
|
+
<div class="sidebar-search">
|
|
319
|
+
<input type="text" placeholder="Поиск на карте…" :value="filter" @input="filter = $event.target.value">
|
|
320
|
+
</div>
|
|
321
|
+
<div class="obj-list">
|
|
322
|
+
<div ~if="!filteredItems.length" style="padding:12px;color:var(--muted-color);text-align:center;">
|
|
323
|
+
Объекты не найдены
|
|
324
|
+
</div>
|
|
325
|
+
<div ~for="filteredItems" class="obj-item" ~class="{selected: selectedId === $for.item.id}"
|
|
326
|
+
@tap="selectObject($for.item)" @dblclick="openObject($for.item)">
|
|
327
|
+
<div class="obj-title">{{$for.item.title || $for.item.id}}</div>
|
|
328
|
+
<div class="obj-meta">{{formatObjMeta($for.item)}}</div>
|
|
329
|
+
</div>
|
|
330
|
+
</div>
|
|
331
|
+
</div>
|
|
332
|
+
|
|
333
|
+
<div id="viewport" class="viewport" ~class="{picking: Boolean(editMode)}"
|
|
334
|
+
@pointerdown="onPointerDown" @pointermove="onPointerMove" @pointerup="onPointerUp"
|
|
335
|
+
@wheel.prevent="onWheel" @dblclick="onViewportDblClick">
|
|
336
|
+
<div class="tiles-layer">
|
|
337
|
+
<img ~for="visibleTiles" :src="$for.item.src" :style="'left:' + $for.item.left + 'px;top:' + $for.item.top + 'px;'"
|
|
338
|
+
@error="$event.target.style.opacity='0.08'">
|
|
339
|
+
</div>
|
|
340
|
+
<svg class="svg-layer" :viewBox="'0 0 ' + viewW + ' ' + viewH">
|
|
341
|
+
<g ~for="renderedShapes">
|
|
342
|
+
<polygon ~if="$for.item.kind === 'polygon'" :points="$for.item.pointsAttr"
|
|
343
|
+
:fill="$for.item.fill" :stroke="$for.item.color" stroke-width="2.5"></polygon>
|
|
344
|
+
<polyline ~if="$for.item.kind === 'line'" :points="$for.item.pointsAttr"
|
|
345
|
+
fill="none" :stroke="$for.item.color" stroke-width="3"></polyline>
|
|
346
|
+
<circle ~if="$for.item.kind === 'circle'" :cx="$for.item.cx" :cy="$for.item.cy" :r="$for.item.r"
|
|
347
|
+
:fill="$for.item.fill" :stroke="$for.item.color" stroke-width="2"></circle>
|
|
348
|
+
</g>
|
|
349
|
+
<polyline ~if="draftPolylineAttr" :points="draftPolylineAttr" fill="rgba(239,68,68,0.18)" stroke="#ef4444" stroke-width="2.5" stroke-dasharray="5,4"></polyline>
|
|
350
|
+
</svg>
|
|
351
|
+
<div class="markers-layer">
|
|
352
|
+
<div ~for="renderedMarkers" class="marker" ~class="{selected: selectedId === $for.item.id}"
|
|
353
|
+
:style="'left:' + $for.item.x + 'px;top:' + $for.item.y + 'px;'"
|
|
354
|
+
@pointerdown.stop @tap.stop="selectObject($for.item.raw)" @dblclick.stop="openObject($for.item.raw)">
|
|
355
|
+
<div class="marker-pin"></div>
|
|
356
|
+
<div class="marker-lbl">{{$for.item.title}}</div>
|
|
357
|
+
</div>
|
|
358
|
+
</div>
|
|
359
|
+
<div class="zoom-controls" @pointerdown.stop>
|
|
360
|
+
<button class="zoom-btn" @tap="zoomBy(1)">+</button>
|
|
361
|
+
<button class="zoom-btn" @tap="zoomBy(-1)">−</button>
|
|
362
|
+
</div>
|
|
363
|
+
<div class="coords-bar">
|
|
364
|
+
{{providerLabel}} · z{{zoom}} · {{centerLat.toFixed(5)}}, {{centerLon.toFixed(5)}} · объектов: {{renderedMarkers.length}}
|
|
365
|
+
</div>
|
|
366
|
+
</div>
|
|
367
|
+
</div>
|
|
368
|
+
`,
|
|
369
|
+
provider: 'osm',
|
|
370
|
+
centerLat: 55.7558,
|
|
371
|
+
centerLon: 37.6173,
|
|
372
|
+
zoom: 11,
|
|
373
|
+
viewW: 800,
|
|
374
|
+
viewH: 520,
|
|
375
|
+
items: [],
|
|
376
|
+
filter: '',
|
|
377
|
+
selectedId: '',
|
|
378
|
+
editMode: '',
|
|
379
|
+
draftPoints: [],
|
|
380
|
+
_drag: null,
|
|
381
|
+
_resizeObs: null,
|
|
382
|
+
get providerList() {
|
|
383
|
+
return Object.values(PROVIDERS);
|
|
384
|
+
},
|
|
385
|
+
get providerLabel() {
|
|
386
|
+
return PROVIDERS[this.provider]?.label || 'OSM';
|
|
387
|
+
},
|
|
388
|
+
get selectedObj() {
|
|
389
|
+
return (this.items || []).find(x => x.id === this.selectedId) || null;
|
|
390
|
+
},
|
|
391
|
+
get filteredItems() {
|
|
392
|
+
const q = String(this.filter || '').trim().toLowerCase();
|
|
393
|
+
if (!q)
|
|
394
|
+
return this.items || [];
|
|
395
|
+
return (this.items || []).filter(o =>
|
|
396
|
+
String(o.title || '').toLowerCase().includes(q)
|
|
397
|
+
|| String(o.body?.address || '').toLowerCase().includes(q)
|
|
398
|
+
);
|
|
399
|
+
},
|
|
400
|
+
get visibleTiles() {
|
|
401
|
+
const prov = PROVIDERS[this.provider] || PROVIDERS.osm;
|
|
402
|
+
const maxTile = Math.pow(2, this.zoom);
|
|
403
|
+
const centerPx = latLonToPixel(this.centerLat, this.centerLon, this.zoom, prov.yandexProj);
|
|
404
|
+
const topLeftX = centerPx.x - this.viewW / 2;
|
|
405
|
+
const topLeftY = centerPx.y - this.viewH / 2;
|
|
406
|
+
const startX = Math.floor(topLeftX / 256);
|
|
407
|
+
const endX = Math.floor((topLeftX + this.viewW) / 256);
|
|
408
|
+
const startY = Math.floor(topLeftY / 256);
|
|
409
|
+
const endY = Math.floor((topLeftY + this.viewH) / 256);
|
|
410
|
+
const out = [];
|
|
411
|
+
for (let tx = startX; tx <= endX; tx++) {
|
|
412
|
+
for (let ty = startY; ty <= endY; ty++) {
|
|
413
|
+
if (ty < 0 || ty >= maxTile)
|
|
414
|
+
continue;
|
|
415
|
+
const wx = ((tx % maxTile) + maxTile) % maxTile;
|
|
416
|
+
out.push({
|
|
417
|
+
src: prov.tileUrl(wx, ty, this.zoom),
|
|
418
|
+
left: Math.round(tx * 256 - topLeftX),
|
|
419
|
+
top: Math.round(ty * 256 - topLeftY),
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return out;
|
|
424
|
+
},
|
|
425
|
+
_latLonToScreen(lat, lon) {
|
|
426
|
+
const prov = PROVIDERS[this.provider] || PROVIDERS.osm;
|
|
427
|
+
const centerPx = latLonToPixel(this.centerLat, this.centerLon, this.zoom, prov.yandexProj);
|
|
428
|
+
const pt = latLonToPixel(lat, lon, this.zoom, prov.yandexProj);
|
|
429
|
+
return {
|
|
430
|
+
x: Math.round(pt.x - (centerPx.x - this.viewW / 2)),
|
|
431
|
+
y: Math.round(pt.y - (centerPx.y - this.viewH / 2)),
|
|
432
|
+
};
|
|
433
|
+
},
|
|
434
|
+
get renderedMarkers() {
|
|
435
|
+
const out = [];
|
|
436
|
+
for (const o of this.filteredItems) {
|
|
437
|
+
const c = o.body?.coords;
|
|
438
|
+
if (!c || !Number.isFinite(Number(c.lat)) || !Number.isFinite(Number(c.lon)))
|
|
439
|
+
continue;
|
|
440
|
+
const pos = this._latLonToScreen(Number(c.lat), Number(c.lon));
|
|
441
|
+
out.push({ id: o.id, title: o.title || o.id, x: pos.x, y: pos.y, raw: o });
|
|
442
|
+
}
|
|
443
|
+
return out;
|
|
444
|
+
},
|
|
445
|
+
get renderedShapes() {
|
|
446
|
+
const out = [];
|
|
447
|
+
for (const o of this.filteredItems) {
|
|
448
|
+
const sh = o.body?.shape;
|
|
449
|
+
if (!sh)
|
|
450
|
+
continue;
|
|
451
|
+
const color = sh.color || '#1d63dc';
|
|
452
|
+
const fill = color.startsWith('#') && color.length === 7 ? `${color}33` : 'rgba(29,99,220,0.2)';
|
|
453
|
+
const pts = parseShapeCoords(sh);
|
|
454
|
+
if (sh.kind === 'circle' && o.body?.coords) {
|
|
455
|
+
const pos = this._latLonToScreen(Number(o.body.coords.lat), Number(o.body.coords.lon));
|
|
456
|
+
const mPerPx = 156543.03 * Math.cos((Number(o.body.coords.lat) || 0) * RAD) / Math.pow(2, this.zoom);
|
|
457
|
+
const r = Math.max(6, Math.round((Number(sh.radius) || 200) / Math.max(0.1, mPerPx)));
|
|
458
|
+
out.push({ kind: 'circle', cx: pos.x, cy: pos.y, r, color, fill });
|
|
459
|
+
}
|
|
460
|
+
else if (pts.length >= 2) {
|
|
461
|
+
const screenPts = pts.map(([la, lo]) => {
|
|
462
|
+
const p = this._latLonToScreen(la, lo);
|
|
463
|
+
return `${p.x},${p.y}`;
|
|
464
|
+
}).join(' ');
|
|
465
|
+
out.push({ kind: sh.kind === 'line' ? 'line' : 'polygon', pointsAttr: screenPts, color, fill });
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
return out;
|
|
469
|
+
},
|
|
470
|
+
get draftPolylineAttr() {
|
|
471
|
+
if (this.editMode !== 'polygon' || !this.draftPoints.length)
|
|
472
|
+
return '';
|
|
473
|
+
return this.draftPoints.map(([la, lo]) => {
|
|
474
|
+
const p = this._latLonToScreen(la, lo);
|
|
475
|
+
return `${p.x},${p.y}`;
|
|
476
|
+
}).join(' ');
|
|
477
|
+
},
|
|
478
|
+
formatObjMeta(o) {
|
|
479
|
+
const c = o.body?.coords;
|
|
480
|
+
if (c && Number.isFinite(Number(c.lat)) && Number.isFinite(Number(c.lon)))
|
|
481
|
+
return `${Number(c.lat).toFixed(4)}, ${Number(c.lon).toFixed(4)}${o.body?.shape?.kind ? ' · ' + o.body.shape.kind : ''}`;
|
|
482
|
+
return 'координаты не заданы';
|
|
483
|
+
},
|
|
484
|
+
setProvider(id) {
|
|
485
|
+
if (PROVIDERS[id])
|
|
486
|
+
this.provider = id;
|
|
487
|
+
},
|
|
488
|
+
zoomBy(delta) {
|
|
489
|
+
this.zoom = Math.max(2, Math.min(18, this.zoom + Number(delta || 0)));
|
|
490
|
+
},
|
|
491
|
+
onWheel(e) {
|
|
492
|
+
this.zoomBy(e.deltaY < 0 ? 1 : -1);
|
|
493
|
+
},
|
|
494
|
+
selectObject(obj) {
|
|
495
|
+
if (!obj)
|
|
496
|
+
return;
|
|
497
|
+
this.selectedId = obj.id;
|
|
498
|
+
const c = obj.body?.coords;
|
|
499
|
+
if (c && Number.isFinite(Number(c.lat)) && Number.isFinite(Number(c.lon))) {
|
|
500
|
+
this.centerLat = Number(c.lat);
|
|
501
|
+
this.centerLon = Number(c.lon);
|
|
502
|
+
if (Number(c.zoom) >= 2 && Number(c.zoom) <= 18)
|
|
503
|
+
this.zoom = Number(c.zoom);
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
openObject(obj) {
|
|
507
|
+
if (!obj?.id)
|
|
508
|
+
return;
|
|
509
|
+
const wf = this.closest?.('work-form') || this.domHost?.closest?.('work-form') || window.parent?.document?.querySelector?.('work-form');
|
|
510
|
+
if (typeof wf?.applyNav === 'function')
|
|
511
|
+
wf.applyNav({ view: 'object', id: obj.id, targetClassPath: obj.cid || this.$item?.short });
|
|
512
|
+
},
|
|
513
|
+
toggleEditMode(mode) {
|
|
514
|
+
this.editMode = this.editMode === mode ? '' : mode;
|
|
515
|
+
this.draftPoints = [];
|
|
516
|
+
},
|
|
517
|
+
cancelEdit() {
|
|
518
|
+
this.editMode = '';
|
|
519
|
+
this.draftPoints = [];
|
|
520
|
+
},
|
|
521
|
+
async _saveSelectedPatch(patch) {
|
|
522
|
+
const obj = this.selectedObj;
|
|
523
|
+
if (!obj || !this.$item?.fetch)
|
|
524
|
+
return;
|
|
525
|
+
const nextBody = { ...(obj.body || {}), ...patch };
|
|
526
|
+
await this.$item.fetch('db_update', {}, { id: obj.id, version: obj.version, body: nextBody });
|
|
527
|
+
await this.reload();
|
|
528
|
+
},
|
|
529
|
+
async saveDraftPolygon() {
|
|
530
|
+
if (this.draftPoints.length < 3)
|
|
531
|
+
return;
|
|
532
|
+
const ring = [...this.draftPoints, this.draftPoints[0]].map(([la, lo]) => [lo, la]);
|
|
533
|
+
await this._saveSelectedPatch({
|
|
534
|
+
shape: {
|
|
535
|
+
...(this.selectedObj?.body?.shape || {}),
|
|
536
|
+
kind: 'polygon',
|
|
537
|
+
geojson: JSON.stringify({ type: 'Polygon', coordinates: [ring] }),
|
|
538
|
+
color: this.selectedObj?.body?.shape?.color || '#1d63dc',
|
|
539
|
+
},
|
|
540
|
+
});
|
|
541
|
+
this.cancelEdit();
|
|
542
|
+
},
|
|
543
|
+
onViewportDblClick() {
|
|
544
|
+
if (this.editMode === 'polygon' && this.draftPoints.length >= 3)
|
|
545
|
+
this.saveDraftPolygon();
|
|
546
|
+
},
|
|
547
|
+
async onPointerDown(e) {
|
|
548
|
+
const vp = this.$('#viewport');
|
|
549
|
+
if (!vp)
|
|
550
|
+
return;
|
|
551
|
+
const rect = vp.getBoundingClientRect();
|
|
552
|
+
const prov = PROVIDERS[this.provider] || PROVIDERS.osm;
|
|
553
|
+
if (this.editMode) {
|
|
554
|
+
const centerPx = latLonToPixel(this.centerLat, this.centerLon, this.zoom, prov.yandexProj);
|
|
555
|
+
const clickPxX = centerPx.x - this.viewW / 2 + (e.clientX - rect.left);
|
|
556
|
+
const clickPxY = centerPx.y - this.viewH / 2 + (e.clientY - rect.top);
|
|
557
|
+
const ll = pixelToLatLon(clickPxX, clickPxY, this.zoom, prov.yandexProj);
|
|
558
|
+
if (this.editMode === 'point') {
|
|
559
|
+
await this._saveSelectedPatch({ coords: { lat: ll.lat, lon: ll.lon, zoom: this.zoom } });
|
|
560
|
+
this.cancelEdit();
|
|
561
|
+
}
|
|
562
|
+
else if (this.editMode === 'polygon') {
|
|
563
|
+
this.draftPoints = [...this.draftPoints, [ll.lat, ll.lon]];
|
|
564
|
+
}
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
this._drag = {
|
|
568
|
+
startX: e.clientX,
|
|
569
|
+
startY: e.clientY,
|
|
570
|
+
startCenterPx: latLonToPixel(this.centerLat, this.centerLon, this.zoom, prov.yandexProj),
|
|
571
|
+
};
|
|
572
|
+
},
|
|
573
|
+
onPointerMove(e) {
|
|
574
|
+
if (!this._drag)
|
|
575
|
+
return;
|
|
576
|
+
const prov = PROVIDERS[this.provider] || PROVIDERS.osm;
|
|
577
|
+
const dx = e.clientX - this._drag.startX;
|
|
578
|
+
const dy = e.clientY - this._drag.startY;
|
|
579
|
+
const next = pixelToLatLon(this._drag.startCenterPx.x - dx, this._drag.startCenterPx.y - dy, this.zoom, prov.yandexProj);
|
|
580
|
+
this.centerLat = next.lat;
|
|
581
|
+
this.centerLon = next.lon;
|
|
582
|
+
},
|
|
583
|
+
onPointerUp() {
|
|
584
|
+
this._drag = null;
|
|
585
|
+
},
|
|
586
|
+
async reload() {
|
|
587
|
+
if (!this.$item?.fetch)
|
|
588
|
+
return;
|
|
589
|
+
try {
|
|
590
|
+
const res = await this.$item.fetch('db_query', { limit: 500 });
|
|
591
|
+
const list = Array.isArray(res?.items) ? res.items : [];
|
|
592
|
+
this.items = list;
|
|
593
|
+
if (!this.selectedId && list.length) {
|
|
594
|
+
const withCoords = list.find(o => o.body?.coords?.lat != null);
|
|
595
|
+
if (withCoords)
|
|
596
|
+
this.selectObject(withCoords);
|
|
597
|
+
else
|
|
598
|
+
this.selectedId = list[0].id;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
catch {
|
|
602
|
+
this.items = [];
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
attached() {
|
|
606
|
+
this.reload();
|
|
607
|
+
const vp = this.$('#viewport');
|
|
608
|
+
if (vp && typeof ResizeObserver !== 'undefined') {
|
|
609
|
+
this._resizeObs = new ResizeObserver((entries) => {
|
|
610
|
+
for (const ent of entries) {
|
|
611
|
+
if (ent.contentRect.width > 0)
|
|
612
|
+
this.viewW = Math.round(ent.contentRect.width);
|
|
613
|
+
if (ent.contentRect.height > 0)
|
|
614
|
+
this.viewH = Math.round(ent.contentRect.height);
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
this._resizeObs.observe(vp);
|
|
618
|
+
}
|
|
619
|
+
},
|
|
620
|
+
detached() {
|
|
621
|
+
this._resizeObs?.disconnect?.();
|
|
622
|
+
},
|
|
623
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
label: 'Шейп / Геозона',
|
|
3
|
+
icon: 'carbon:area',
|
|
4
|
+
METADATA: {
|
|
5
|
+
FIELDS: [
|
|
6
|
+
{
|
|
7
|
+
id: 'kind',
|
|
8
|
+
label: 'Тип геометрии',
|
|
9
|
+
type: 'enum',
|
|
10
|
+
values: ['point', 'line', 'polygon', 'circle'],
|
|
11
|
+
},
|
|
12
|
+
{ id: 'geojson', label: 'Геометрия (GeoJSON / точки)', type: 'text' },
|
|
13
|
+
{ id: 'radius', label: 'Радиус, м', type: 'number' },
|
|
14
|
+
{ id: 'color', label: 'Цвет', type: 'string' },
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
}
|