Name: general
Owner: 2GIS
Description: Fast marker generalization algorithm
Created: 2017-03-29 09:42:16.0
Updated: 2017-12-05 07:12:52.0
Pushed: 2018-03-13 09:12:56.0
Size: 2473
Language: TypeScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Fast marker generalization algorithm
?? ???? ????????? ????????????? ???????? ?????????? ??????? ?????? ????????. ???????? ?? ????? ?????? ?????????? ?????-?? ?????????? ???????? ?? ????? ?????? ???, ????? ?????????? ???????????? ?? ????? ?? ??????????? ???? ? ??????.
\ ?????? ??????????? ???????? ?? ????? ?? ? ????? ?????????????
?????????, ??? ?????? ???????? ???????????? ? ??????? ???????? ??????????. ??????? ?????? ??????? ?????? ????? ?????? ?????? ???????????? ?? ?????.
????? ?????????? ?????? ?????? ???????? ?? ????? ????????????, ????????:
?????? ?????? ????? ??????????? ????????? ????, ??? ??? ????? ?????????????? ??????????.
?????? ????????:
feZone: 5,
rgin: 10,
gradation: 180
?????????? ?????? ?? ???????? ???????? ? ?????-?? ?????????? ??????. ?????? ???? ?? ???????. ???? ?????? ?? ?????? ?????? ?? ???? ???????????? ?? ?????, ?? ????????? ??? ??????? ??? ? ?????? ????? ???????????? (??????) ??????. ???? ? ??? ?? ?? ???? ????????? ?? ?????, ?? ?? ???????? ? ????????? (??????) ?????? ? ?.?.
?????? ?????? ??? ????????? ????????????? ?????????????? ????????????? ???????? ????????? ??????? ???????? ?????? ??????? ???? ???? ?? ????????????????? ??????????.
????? ???????? ?? ????? ?????? ??????????? ?? ??????????? ? ???????, ??? ????????? ????????? ?? ?????. ??? ???? ???????? ??????? ??????? ?????? ??????? ?????? ??? ??????? ???? ????????? safeZone
.
?????? A ??? ????? ?? ????? ? ????? ??????? ?????? ?????? ???????, ??:
????? ??????? ????? ???????????? ????????? ?????????? ????? ???????? ?? ?????, ??? ????? ??? ?? ???????????, ? ?????????????? ??????????.
????? ?????? ???????? ?? ?????, ?? ???????? ??? ?????? ??????? ?? ????????? ? ???, ??????? ?????????????? ??? ????????. ??????? ???? ??????? ????? ???????? ?????? ??????? ???? ???????? margin
.
??? ???????? ????? ????????????, ????? ?????????? ???? ?? ????? ?????? ?????? ??????? ?? ????? ??????:
\ ????? ???????? margin ????? 0, ?????? ? 40
??????, ???????? ? ??????? ???????? ?????????? degradation
??????? ?? ????? ???????????? ??????, ????????????? ????????? ?? ???? ?????? ????, ??? ??????????? ?? ?????????? ?????. ???? ?????? ???? ?????????, ?? ?????? ?????????.
????? ??????? ????? ???????? ???? ???????, ?? ????????? ?????? ?????????:
\ ????? ???????? degradation ????? 0, ?????? - 40
? ??????? npm
:
install @2gis/general
????? ?????????? ????? script
???????????? ????? ?????????? ?????????? General
:
ipt src="node_modules/general/dist/general.js"></script>
???? ?????????? ??? es6 ??????:
rt { General } from 'general';
??? ?????? ????? ??????? ????????? ??????:
t general = new General();
???????? ????? ??? ?????????????:
ral.generalize(bounds, groups, atlas, markers);
???
bounds: BBox
? ???????, ? ??????? ?????????? ?????????????, ??????? ?? ???????? ? ??? ??????? ?????? ????????????groups: PriorityGroup[]
? ?????? ????? ???????? ? ??????????? ??? ?????????????atlas: Sprite[]
? ?????? ???????? ??????????? ??????? ??????, ??????? ????? ?????????????? ?????????markers: Marker[]
? ?????? ????????????? ?????????? Promise
, ??????? ?????????? ????? ?????????? ?????????????. ???????? ??????????? ?????????? ? ???????.
?????? ?? ????? PriorityGroup
???????? ????????? ?????????:
iconIndex
? ?????? ?????? ? ??????, ??????? ????? ??????????? ???????, ????????? ? ??? ??????safeZone
, margin
, degradation
? ??????????? ????????? ??????????? ???????? ?? Sprite
, ?????? ?? ??????? ??????? ??:
size: Vec2
? ?????? ??????anchor: Vec2
? ????? ?????? ???????????? ?? ????????, ????????? ???????? ?? 0 ?? 1?????? Marker
??????? ??:
pixelPosition
? ??????? ??????? ? ????????, ?????? ??????????? ??? ????????? ????????????? ? ?????????? ? ??? ?? ??????? ?????????, ??? ? bounds
?????????? ? ????? generalize
groupIndex
? ?????? ? ??????? ?????, ? ??????? ?????? ????? ?????????? ????????????????? generalize
?? ?????????? ????? ?????? ????????, ?? ???????? ??????.
? ???????? ?????????????, ???????? ?????????? ???????? ???????? iconIndex
?????????????? ?????-?? ?????? ? ??????. ???? ???? ???????? ???? ?????? -1
, ??????, ??? ?????? ?? ?????? ??????? ?? ????? ? ??? ???? ??????.
?????, ????????????? ?????????? ???????? ?????????????? ???????? prevGroupIndex
, ????? ??? ????????? ?????????????, ???????????? ?????? ????? ???????. ??? ???????? ???????? ????????, ????? ??? ?????????? ????? ????????, ?????? ??????? ?????????????? ? ????? ???????? ??-??????.
????? ???????, ???? ?????????? ?????????? ????????????? ????????? ?? ????, ????????, ??? ????????? ???????? ?????, ?? ????? ??????? ?????? generalize
????? ????????? ???????? prevGroupIndex
? undefined
? ??????? ???????.
npm version patch
? ???????? ?????? ? package.json
git push --follow-tags
? ???????? ????????? ?? githubrm -rf dist && npm run build
? ??????? ??????npm publish
? ????????? ? npm