[drape] Draw embankments. #2738

Merged
vng merged 3 commits from vng-dev into master 2022-06-15 16:12:44 +00:00
23 changed files with 781 additions and 551 deletions

View file

@ -370,6 +370,7 @@
2152416835
2153149782
2157549977
2157989906
2159483932
2160576191
2160707771

Binary file not shown.

View file

@ -9727,8 +9727,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9739,8 +9739,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9841,8 +9841,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9853,8 +9853,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9955,8 +9955,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9967,8 +9967,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -10076,8 +10076,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -10088,8 +10088,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -10380,8 +10380,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -10392,8 +10392,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -30250,8 +30250,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -30262,8 +30262,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -38568,31 +38568,49 @@ cont {
scale: 16
lines {
width: 1.0
color: 2157549977
color: 2157989906
priority: 1000
}
}
element {
scale: 17
lines {
width: 2.0
color: 1301911961
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 18
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 19
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
@ -40089,31 +40107,49 @@ cont {
scale: 16
lines {
width: 1.0
color: 2157549977
color: 2157989906
priority: 1000
}
}
element {
scale: 17
lines {
width: 2.0
color: 1301911961
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 18
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 19
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
@ -40266,31 +40302,49 @@ cont {
scale: 16
lines {
width: 1.0
color: 2157549977
color: 2157989906
priority: 1000
}
}
element {
scale: 17
lines {
width: 2.0
color: 1301911961
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 18
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 19
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}

Binary file not shown.

View file

@ -9517,8 +9517,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9529,8 +9529,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9631,8 +9631,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9643,8 +9643,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9745,8 +9745,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9757,8 +9757,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9866,8 +9866,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9878,8 +9878,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -10170,8 +10170,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -10182,8 +10182,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -29912,8 +29912,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -29924,8 +29924,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -38230,31 +38230,49 @@ cont {
scale: 16
lines {
width: 1.0
color: 2157549977
color: 2157989906
priority: 1000
}
}
element {
scale: 17
lines {
width: 2.0
color: 1301911961
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 18
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 19
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
@ -39751,31 +39769,49 @@ cont {
scale: 16
lines {
width: 1.0
color: 2157549977
color: 2157989906
priority: 1000
}
}
element {
scale: 17
lines {
width: 2.0
color: 1301911961
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 18
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 19
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
@ -39928,31 +39964,49 @@ cont {
scale: 16
lines {
width: 1.0
color: 2157549977
color: 2157989906
priority: 1000
}
}
element {
scale: 17
lines {
width: 2.0
color: 1301911961
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 18
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 19
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}

Binary file not shown.

View file

@ -9517,8 +9517,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9529,8 +9529,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9631,8 +9631,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9643,8 +9643,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9745,8 +9745,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9757,8 +9757,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9866,8 +9866,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -9878,8 +9878,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -10170,8 +10170,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -10182,8 +10182,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -30060,8 +30060,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -30072,8 +30072,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1456
}
@ -38359,31 +38359,49 @@ cont {
scale: 16
lines {
width: 1.0
color: 2151957572
color: 2157989906
priority: 1000
}
}
element {
scale: 17
lines {
width: 2.0
color: 1296319556
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 18
lines {
width: 3.0
color: 4473924
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 19
lines {
width: 3.0
color: 4473924
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
@ -39866,31 +39884,49 @@ cont {
scale: 16
lines {
width: 1.0
color: 2151957572
color: 2157989906
priority: 1000
}
}
element {
scale: 17
lines {
width: 2.0
color: 1296319556
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 18
lines {
width: 3.0
color: 4473924
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 19
lines {
width: 3.0
color: 4473924
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
@ -40043,31 +40079,49 @@ cont {
scale: 16
lines {
width: 1.0
color: 2151957572
color: 2157989906
priority: 1000
}
}
element {
scale: 17
lines {
width: 2.0
color: 1296319556
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 18
lines {
width: 3.0
color: 4473924
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 19
lines {
width: 3.0
color: 4473924
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}

Binary file not shown.

View file

@ -4104,8 +4104,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4116,8 +4116,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4155,8 +4155,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4167,8 +4167,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4206,8 +4206,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4218,8 +4218,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4324,8 +4324,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4336,8 +4336,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4490,8 +4490,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4502,8 +4502,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -17576,8 +17576,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -17588,8 +17588,8 @@ cont {
width: 2.0
color: 10066329
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -22428,31 +22428,49 @@ cont {
scale: 16
lines {
width: 1.0
color: 2157549977
color: 2157989906
priority: 1000
}
}
element {
scale: 17
lines {
width: 2.0
color: 1301911961
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 18
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 19
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
@ -23050,31 +23068,49 @@ cont {
scale: 16
lines {
width: 1.0
color: 2157549977
color: 2157989906
priority: 1000
}
}
element {
scale: 17
lines {
width: 2.0
color: 1301911961
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 18
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 19
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
@ -23227,31 +23263,49 @@ cont {
scale: 16
lines {
width: 1.0
color: 2157549977
color: 2157989906
priority: 1000
}
}
element {
scale: 17
lines {
width: 2.0
color: 1301911961
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 18
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 19
lines {
width: 3.0
color: 10066329
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}

Binary file not shown.

View file

@ -4104,8 +4104,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4116,8 +4116,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4155,8 +4155,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4167,8 +4167,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4206,8 +4206,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4218,8 +4218,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4324,8 +4324,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4336,8 +4336,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4490,8 +4490,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -4502,8 +4502,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -17900,8 +17900,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -17912,8 +17912,8 @@ cont {
width: 2.0
color: 4473924
dashdot {
dd: 2.4
dd: 2.4
dd: 2.5
dd: 2.5
}
priority: 1505
}
@ -22752,31 +22752,49 @@ cont {
scale: 16
lines {
width: 1.0
color: 2151957572
color: 2157989906
priority: 1000
}
}
element {
scale: 17
lines {
width: 2.0
color: 1296319556
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 18
lines {
width: 3.0
color: 4473924
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 19
lines {
width: 3.0
color: 4473924
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
@ -23374,31 +23392,49 @@ cont {
scale: 16
lines {
width: 1.0
color: 2151957572
color: 2157989906
priority: 1000
}
}
element {
scale: 17
lines {
width: 2.0
color: 1296319556
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 18
lines {
width: 3.0
color: 4473924
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 19
lines {
width: 3.0
color: 4473924
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
@ -23551,31 +23587,49 @@ cont {
scale: 16
lines {
width: 1.0
color: 2151957572
color: 2157989906
priority: 1000
}
}
element {
scale: 17
lines {
width: 2.0
color: 1296319556
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 18
lines {
width: 3.0
color: 4473924
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}
element {
scale: 19
lines {
width: 3.0
color: 4473924
width: 7.0
color: 10506258
dashdot {
dd: 4.0
dd: 4.0
dd: 5.0
dd: 2.0
}
priority: 1000
}
}

View file

@ -1,7 +1,7 @@
1.0 18.0
1.0 1.0
2.0 2.0
2.4 2.4
2.5 2.5
1.35 1.0
1.8 1.0
1.44 1.44
@ -29,10 +29,10 @@
6.0 3.6
1.5 1.5
1.8 1.8
2.5 2.5
3.2 3.2
4.0 4.0
2.52 1.35
4.0 4.0 5.0 2.0
6.3 6.3
1.8 5.4
4.5 4.5

View file

@ -701,23 +701,25 @@ line|z18-[barrier=hedge],
line|z18-[barrier=retaining_wall],
line|z18-[barrier=wall],
line|z18-[historic=citywalls],
Review

please add a comment explaining meaning of dashes: 6,4,4,2;
so that others can use the feature for other objects later

please add a comment explaining meaning of `dashes: 6,4,4,2;` so that others can use the feature for other objects later
Review

also would be great to make it dark-brown :)

also would be great to make it dark-brown :)
biodranik commented 2022-06-14 20:49:26 +00:00 (Migrated from github.com)
Review

Как забор красить точно не нужно.

Как забор красить точно не нужно.
{width: 2.0; dashes: 2.4,2.4; opacity: 1;}
{width: 2.0; dashes: 2.5,2.5; opacity: 1;}
/* ToDo: Make linear style with small triangles pointing downwards, when drape will be ready */
line|z16-[natural=cliff],
line|z16-[natural=earth_bank],
line|z16-[man_made=embankment],
{color: @fence; width: 1.0; opacity: 0.5;}
line|z16[natural=cliff],
line|z16[natural=earth_bank],
line|z16[man_made=embankment],
{color: @path; width: 1.0; opacity: 0.5;}
line|z17[natural=cliff],
line|z17[natural=earth_bank],
line|z17[man_made=embankment],
{width: 2.0; opacity: 0.7;}
line|z17-[natural=cliff],
line|z17-[natural=earth_bank],
line|z17-[man_made=embankment],
/*
4 values tuple: dash (===), triangle base (tb), triangle height, base height.
===\tb /=== - base height
\ / | - triangle height
line|z18-[natural=cliff],
line|z18-[natural=earth_bank],
line|z18-[man_made=embankment],
{width: 3.0; opacity: 1;}
Set width = 6 to be equal with triangle height + base height.
*/
{color: @path; width: 7.0; dashes: 4,4,5,2; opacity: 1;}
/* 9. ISOLINES */

View file

@ -609,20 +609,22 @@ line|z18-[barrier=hedge],
line|z18-[barrier=retaining_wall],
line|z18-[barrier=wall],
line|z18-[historic=citywalls],
{width: 2.0; dashes: 2.4,2.4; opacity: 1;}
{width: 2.0; dashes: 2.5,2.5; opacity: 1;}
/* ToDo: Make linear style with small triangles pointing downwards, when drape will be ready */
line|z16-[natural=cliff],
line|z16-[natural=earth_bank],
line|z16-[man_made=embankment],
{color: @fence; width: 1.0; opacity: 0.5;}
line|z16[natural=cliff],
line|z16[natural=earth_bank],
line|z16[man_made=embankment],
{color: @path; width: 1.0; opacity: 0.5;}
line|z17[natural=cliff],
line|z17[natural=earth_bank],
line|z17[man_made=embankment],
{width: 2.0; opacity: 0.7;}
line|z17-[natural=cliff],
line|z17-[natural=earth_bank],
line|z17-[man_made=embankment],
/*
4 values tuple: dash (===), triangle base (tb), triangle height, base height.
===\tb /=== - base height
\ / | - triangle height
line|z18-[natural=cliff],
line|z18-[natural=earth_bank],
line|z18-[man_made=embankment],
{width: 3.0; opacity: 1;}
Set width = 6 to be equal with triangle height + base height.
*/
{color: @path; width: 7.0; dashes: 4,4,5,2; opacity: 1;}

View file

@ -6,14 +6,15 @@
#include "drape/stipple_pen_resource.hpp"
#include "drape/texture.hpp"
namespace stipple_pen_tests
{
using namespace dp;
namespace
{
void TestPacker(StipplePenPacker & packer, uint32_t width, m2::RectU const & expect)
{
m2::RectU rect = packer.PackResource(width);
TEST_EQUAL(rect, expect, ());
TEST_EQUAL(packer.PackResource({ width, 1 }), expect, ());
}
bool IsRectsEqual(m2::RectF const & r1, m2::RectF const & r2)
@ -23,24 +24,9 @@ bool IsRectsEqual(m2::RectF const & r1, m2::RectF const & r2)
base::AlmostEqualULPs(r1.maxX(), r2.maxX()) &&
base::AlmostEqualULPs(r1.maxY(), r2.maxY());
}
class DummyStipplePenIndex : public StipplePenIndex
{
using Base = StipplePenIndex;
public:
explicit DummyStipplePenIndex(m2::PointU const & size)
: Base(size)
{}
ref_ptr<Texture::ResourceInfo> MapResource(StipplePenKey const & key)
{
bool dummy = false;
return Base::MapResource(key, dummy);
}
};
} // namespace
UNIT_TEST(SimpleStipplePackTest)
UNIT_TEST(StippleTest_Pack)
{
StipplePenPacker packer(m2::PointU(512, 8));
TestPacker(packer, 30, m2::RectU(0, 0, 30, 1));
@ -53,34 +39,4 @@ UNIT_TEST(SimpleStipplePackTest)
TEST(IsRectsEqual(mapped, m2::RectF(0.5f / 512.0f, 0.5f / 8.0f,
255.5f / 512.0f, 0.5f / 8.0f)), ());
}
UNIT_TEST(SimplePatternKey)
{
{
StipplePenKey info;
info.m_pattern.push_back(2);
info.m_pattern.push_back(21);
TEST_EQUAL(StipplePenHandle(info), StipplePenHandle(0x204A000000000000), ());
}
{
StipplePenKey info;
info.m_pattern.push_back(1);
info.m_pattern.push_back(1);
TEST_EQUAL(StipplePenHandle(info), StipplePenHandle(0x2000000000000000), ());
}
{
StipplePenKey info;
info.m_pattern.push_back(12);
info.m_pattern.push_back(12);
info.m_pattern.push_back(8);
info.m_pattern.push_back(9);
info.m_pattern.push_back(128);
info.m_pattern.push_back(128);
info.m_pattern.push_back(40);
info.m_pattern.push_back(40);
TEST_EQUAL(StipplePenHandle(info), StipplePenHandle(0xE2C58711FFFA74E0), ());
}
}
} // namespace stipple_pen_tests

View file

@ -11,8 +11,7 @@
namespace dp
{
uint32_t const kMaxStipplePenLength = 512;
uint32_t const kStippleHeight = 1;
uint32_t const kMaxStipplePenLength = 512; /// @todo Should be equal with kStippleTextureWidth?
StipplePenPacker::StipplePenPacker(m2::PointU const & canvasSize)
biodranik commented 2022-06-14 16:00:44 +00:00 (Migrated from github.com)
Review

Так сразу пропиши equal.

Так сразу пропиши equal.
vng commented 2022-06-15 06:39:03 +00:00 (Migrated from github.com)
Review

Они сейчас equal, я оставляю вопрос, т.к. кажется что константы одной природы, но не уверен.

Они сейчас equal, я оставляю вопрос, т.к. кажется что константы одной природы, но не уверен.
: m_canvasSize(canvasSize)
@ -21,146 +20,157 @@ StipplePenPacker::StipplePenPacker(m2::PointU const & canvasSize)
ASSERT_GREATER_OR_EQUAL(canvasSize.x, kMaxStipplePenLength, ());
}
m2::RectU StipplePenPacker::PackResource(uint32_t width)
m2::RectU StipplePenPacker::PackResource(m2::PointU const & size)
{
ASSERT_LESS(m_currentRow, m_canvasSize.y, ());
ASSERT_LESS_OR_EQUAL(width, m_canvasSize.x, ());
uint32_t yOffset = m_currentRow;
m_currentRow += kStippleHeight;
return m2::RectU(0, yOffset, width, yOffset + kStippleHeight);
ASSERT_LESS_OR_EQUAL(size.x, m_canvasSize.x, ());
uint32_t const yOffset = m_currentRow;
m_currentRow += size.y;
return m2::RectU(0, yOffset, size.x, m_currentRow);
}
m2::RectF StipplePenPacker::MapTextureCoords(m2::RectU const & pixelRect) const
{
return m2::RectF((pixelRect.minX() + 0.5f) / m_canvasSize.x,
(pixelRect.minY() + 0.5f) / m_canvasSize.y,
(pixelRect.maxX() - 0.5f) / m_canvasSize.x,
(pixelRect.maxY() - 0.5f) / m_canvasSize.y);
}
StipplePenHandle::StipplePenHandle(buffer_vector<uint8_t, 8> const & pattern)
: m_keyValue(0)
{
Init(pattern);
}
StipplePenHandle::StipplePenHandle(StipplePenKey const & info)
: m_keyValue(0)
{
Init(info.m_pattern);
}
void StipplePenHandle::Init(buffer_vector<uint8_t, 8> const & pattern)
{
// encoding scheme
// 63 - 61 bits = size of pattern in range [0 : 8]
// 60 - 53 bits = first value of pattern in range [1 : 128]
// 52 - 45 bits = second value of pattern
// ....
// 0 - 5 bits = reserved
ASSERT(pattern.size() >= 1 && pattern.size() < 9, (pattern.size()));
uint32_t const patternSize = static_cast<uint32_t>(pattern.size());
m_keyValue = patternSize - 1; // we code value 1 as 000 and value 8 as 111
for (size_t i = 0; i < patternSize; ++i)
{
m_keyValue <<=7;
ASSERT_GREATER(pattern[i], 0, ()); // we have 7 bytes for value. value = 1 encode like 0000000
ASSERT_LESS(pattern[i], 129, ()); // value = 128 encode like 1111111
uint32_t value = pattern[i] - 1;
m_keyValue += value;
}
m_keyValue <<= ((8 - patternSize) * 7 + 5);
return { (pixelRect.minX() + 0.5f) / m_canvasSize.x,
(pixelRect.minY() + 0.5f) / m_canvasSize.y,
(pixelRect.maxX() - 0.5f) / m_canvasSize.x,
(pixelRect.maxY() - 0.5f) / m_canvasSize.y };
}
StipplePenRasterizator::StipplePenRasterizator(StipplePenKey const & key)
: m_key(key)
{
m_patternLength = std::accumulate(m_key.m_pattern.begin(), m_key.m_pattern.end(), 0);
if (IsTrianglePattern(m_key.m_pattern))
{
m_patternLength = 2 * m_key.m_pattern[0] + m_key.m_pattern[1];
m_height = m_key.m_pattern[2] + m_key.m_pattern[3];
}
else
{
m_patternLength = std::accumulate(m_key.m_pattern.begin(), m_key.m_pattern.end(), 0);
m_height = 1;
}
uint32_t const availableSize = kMaxStipplePenLength - 2; // the first and the last pixel reserved
ASSERT(m_patternLength > 0 && m_patternLength < availableSize, (m_patternLength, availableSize));
uint32_t const count = floor(availableSize / m_patternLength);
m_pixelLength = count * m_patternLength;
}
uint32_t StipplePenRasterizator::GetSize() const
void StipplePenRasterizator::Rasterize(uint8_t * buffer) const
{
return m_pixelLength;
if (IsTrianglePattern(m_key.m_pattern))
RasterizeTriangle(buffer);
else
RasterizeDash(buffer);
}
uint32_t StipplePenRasterizator::GetPatternSize() const
void StipplePenRasterizator::RasterizeDash(uint8_t * pixels) const
{
return m_patternLength;
}
// No problem here, but we use 2 entries patterns now (dash length, space length).
ASSERT_EQUAL(m_key.m_pattern.size(), 2, ());
void StipplePenRasterizator::Rasterize(void * buffer)
{
ASSERT(!m_key.m_pattern.empty(), ());
uint8_t * pixels = static_cast<uint8_t *>(buffer);
uint16_t offset = 1;
buffer_vector<uint8_t, 8> pattern = m_key.m_pattern;
for (size_t i = 0; i < pattern.size(); ++i)
uint32_t offset = 1;
for (size_t i = 0; i < m_key.m_pattern.size(); ++i)
{
uint8_t value = (i & 0x1) == 0 ? 255 : 0;
uint8_t length = m_key.m_pattern[i];
memset(pixels + offset, value, length * sizeof(uint8_t));
uint8_t const length = m_key.m_pattern[i];
ASSERT(length > 0, ());
memset(pixels + offset, (i & 0x1) == 0 ? 255 : 0, length);
offset += length;
}
uint8_t period = offset - 1;
ClonePattern(pixels);
}
void StipplePenRasterizator::ClonePattern(uint8_t * pixels) const
{
uint32_t offset = m_patternLength + 1;
while (offset < m_pixelLength + 1)
{
memcpy(pixels + offset, pixels + 1, period);
offset += period;
memcpy(pixels + offset, pixels + 1, m_patternLength);
offset += m_patternLength;
}
ASSERT_LESS(offset, kMaxStipplePenLength, ());
ASSERT_EQUAL(offset, m_pixelLength + 1, ());
pixels[0] = pixels[1];
pixels[offset] = pixels[offset - 1];
}
void StipplePenRasterizator::RasterizeTriangle(uint8_t * pixels) const
{
// 4 values: dash (===), triangle base (tb), triangle height, base height.
// Triangle should go on the right.
// ===\tb /=== - base height
// \/ | - triangle height
uint8_t baseH = m_key.m_pattern[3];
ASSERT(baseH > 0, ());
while (baseH > 0)
{
memset(pixels, 255, m_pixelLength + 2);
pixels += kMaxStipplePenLength;
--baseH;
}
uint8_t trgH = m_key.m_pattern[2];
ASSERT(trgH > 0, ());
double const tan = m_key.m_pattern[1] / double(trgH);
ASSERT(tan > 0, ());
while (trgH > 0)
{
uint8_t const base = std::round(trgH * tan);
uint32_t const left = (m_patternLength - base) / 2;
memset(pixels + 1, 0, left);
memset(pixels + left + 1, 255, base);
memset(pixels + left + 1 + base, 0, m_patternLength - left - base);
ClonePattern(pixels);
pixels += kMaxStipplePenLength;
--trgH;
}
}
ref_ptr<Texture::ResourceInfo> StipplePenIndex::ReserveResource(bool predefined, StipplePenKey const & key,
bool & newResource)
{
std::lock_guard<std::mutex> g(m_mappingLock);
newResource = false;
StipplePenHandle handle(key);
TResourceMapping & resourceMapping = predefined ? m_predefinedResourceMapping : m_resourceMapping;
TResourceMapping::iterator it = resourceMapping.find(handle);
auto it = resourceMapping.find(key);
if (it != resourceMapping.end())
{
newResource = false;
return make_ref(&it->second);
}
newResource = true;
StipplePenRasterizator resource(key);
m2::RectU pixelRect = m_packer.PackResource(resource.GetSize());
m2::RectU const pixelRect = m_packer.PackResource(resource.GetSize());
{
std::lock_guard<std::mutex> g(m_lock);
m_pendingNodes.push_back(std::make_pair(pixelRect, resource));
m_pendingNodes.emplace_back(pixelRect, resource);
}
auto res = resourceMapping.emplace(handle, StipplePenResourceInfo(m_packer.MapTextureCoords(pixelRect),
resource.GetSize(),
resource.GetPatternSize()));
auto res = resourceMapping.emplace(key, StipplePenResourceInfo(m_packer.MapTextureCoords(pixelRect),
resource.GetSize()));
ASSERT(res.second, ());
return make_ref(&res.first->second);
}
ref_ptr<Texture::ResourceInfo> StipplePenIndex::MapResource(StipplePenKey const & key, bool & newResource)
{
StipplePenHandle handle(key);
TResourceMapping::iterator it = m_predefinedResourceMapping.find(handle);
auto it = m_predefinedResourceMapping.find(key);
if (it != m_predefinedResourceMapping.end())
{
newResource = false;
return make_ref(&it->second);
}
std::lock_guard<std::mutex> g(m_mappingLock);
return ReserveResource(false /* predefined */, key, newResource);
}
@ -175,31 +185,32 @@ void StipplePenIndex::UploadResources(ref_ptr<dp::GraphicsContext> context, ref_
m_pendingNodes.swap(pendingNodes);
}
uint32_t height = 0;
for (auto const & n : pendingNodes)
height += n.second.GetSize().y;
uint32_t const reserveBufferSize = base::NextPowOf2(height * kMaxStipplePenLength);
SharedBufferManager & mng = SharedBufferManager::instance();
uint32_t const bytesPerNode = kMaxStipplePenLength * kStippleHeight;
uint32_t reserveBufferSize = base::NextPowOf2(static_cast<uint32_t>(pendingNodes.size()) * bytesPerNode);
SharedBufferManager::shared_buffer_ptr_t ptr = mng.reserveSharedBuffer(reserveBufferSize);
uint8_t * rawBuffer = SharedBufferManager::GetRawPointer(ptr);
memset(rawBuffer, 0, reserveBufferSize);
for (size_t i = 0; i < pendingNodes.size(); ++i)
pendingNodes[i].second.Rasterize(rawBuffer + i * bytesPerNode);
texture->UploadData(context, 0, pendingNodes.front().first.minY(), kMaxStipplePenLength,
static_cast<uint32_t>(pendingNodes.size()) * kStippleHeight, make_ref(rawBuffer));
uint8_t * pixels = rawBuffer;
for (auto const & n : pendingNodes)
{
n.second.Rasterize(pixels);
pixels += (kMaxStipplePenLength * n.second.GetSize().y);
}
texture->UploadData(context, 0, pendingNodes.front().first.minY(), kMaxStipplePenLength, height, make_ref(rawBuffer));
mng.freeSharedBuffer(reserveBufferSize, ptr);
}
void StipplePenTexture::ReservePattern(buffer_vector<uint8_t, 8> const & pattern)
void StipplePenTexture::ReservePattern(PenPatternT const & pattern)
{
bool newResource = false;
m_indexer->ReserveResource(true /* predefined */, StipplePenKey(pattern), newResource);
}
std::string DebugPrint(StipplePenHandle const & key)
{
std::ostringstream out;
out << "0x" << std::hex << key.m_keyValue;
return out.str();
}
} // namespace dp

View file

@ -17,76 +17,70 @@
namespace dp
{
// Based on ./data/patterns.txt, all paterns have 2 entries now.
using PenPatternT = buffer_vector<uint8_t, 2>;
inline bool IsTrianglePattern(PenPatternT const & p)
{
return p.size() == 4;
}
class StipplePenKey : public Texture::Key
{
public:
StipplePenKey() = default;
StipplePenKey(buffer_vector<uint8_t, 8> const & pattern) : m_pattern(pattern) {}
explicit StipplePenKey(PenPatternT const & pattern) : m_pattern(pattern) {}
virtual Texture::ResourceType GetType() const { return Texture::ResourceType::StipplePen; }
buffer_vector<uint8_t, 8> m_pattern;
};
bool operator<(StipplePenKey const & rhs) const { return m_pattern < rhs.m_pattern; }
bool operator==(StipplePenKey const & rhs) const { return m_pattern == rhs.m_pattern; }
class StipplePenHandle
{
public:
StipplePenHandle(uint64_t value) : m_keyValue(value) {} // don't use this ctor. Only for tests
StipplePenHandle(buffer_vector<uint8_t, 8> const & pattern);
StipplePenHandle(StipplePenKey const & info);
bool operator == (StipplePenHandle const & other) const { return m_keyValue == other.m_keyValue; }
bool operator < (StipplePenHandle const & other) const { return m_keyValue < other.m_keyValue; }
private:
void Init(buffer_vector<uint8_t, 8> const & pattern);
private:
friend std::string DebugPrint(StipplePenHandle const &);
uint64_t m_keyValue;
PenPatternT m_pattern;
};
class StipplePenRasterizator
{
public:
StipplePenRasterizator() : m_pixelLength(0), m_patternLength(0) {}
StipplePenRasterizator(StipplePenKey const & key);
explicit StipplePenRasterizator(StipplePenKey const & key);
uint32_t GetSize() const;
uint32_t GetPatternSize() const;
m2::PointU GetSize() const { return { m_pixelLength, m_height }; }
void Rasterize(void * buffer);
void Rasterize(uint8_t * buffer) const;
private:
void RasterizeDash(uint8_t * buffer) const;
void RasterizeTriangle(uint8_t * buffer) const;
void ClonePattern(uint8_t * pixels) const;
private:
StipplePenKey m_key;
uint32_t m_pixelLength;
uint32_t m_patternLength;
uint32_t m_patternLength, m_pixelLength;
uint32_t m_height;
};
class StipplePenResourceInfo : public Texture::ResourceInfo
{
public:
StipplePenResourceInfo(m2::RectF const & texRect, uint32_t pixelLength, uint32_t patternLength)
: Texture::ResourceInfo(texRect)
, m_pixelLength(pixelLength)
, m_patternLength(patternLength)
StipplePenResourceInfo(m2::RectF const & texRect, m2::PointU const & pixelSize)
: Texture::ResourceInfo(texRect), m_pixelSize(pixelSize)
{
}
virtual Texture::ResourceType GetType() const { return Texture::ResourceType::StipplePen; }
uint32_t GetMaskPixelLength() const { return m_pixelLength; }
uint32_t GetPatternPixelLength() const { return m_patternLength; }
m2::PointU GetMaskPixelSize() const { return m_pixelSize; }
private:
uint32_t m_pixelLength;
uint32_t m_patternLength;
m2::PointU m_pixelSize;
};
class StipplePenPacker
{
public:
StipplePenPacker(m2::PointU const & canvasSize);
explicit StipplePenPacker(m2::PointU const & canvasSize);
m2::RectU PackResource(uint32_t width);
m2::RectU PackResource(m2::PointU const & size);
m2::RectF MapTextureCoords(m2::RectU const & pixelRect) const;
private:
@ -97,19 +91,28 @@ private:
class StipplePenIndex
{
public:
StipplePenIndex(m2::PointU const & canvasSize) : m_packer(canvasSize) {}
explicit StipplePenIndex(m2::PointU const & canvasSize) : m_packer(canvasSize) {}
/// @param[out] newResource Needed for the generic DynamicTexture code.
/// @{
// Called from TextureManager::Init and fills m_predefinedResourceMapping, no need in m_mappingLock.
ref_ptr<Texture::ResourceInfo> ReserveResource(bool predefined, StipplePenKey const & key,
bool & newResource);
// Checks m_predefinedResourceMapping, fills m_resourceMapping, locks m_mappingLock.
ref_ptr<Texture::ResourceInfo> MapResource(StipplePenKey const & key, bool & newResource);
/// @}
void UploadResources(ref_ptr<dp::GraphicsContext> context, ref_ptr<Texture> texture);
private:
typedef std::map<StipplePenHandle, StipplePenResourceInfo> TResourceMapping;
// std::unordered_map can be better here
typedef std::map<StipplePenKey, StipplePenResourceInfo> TResourceMapping;
typedef std::pair<m2::RectU, StipplePenRasterizator> TPendingNode;
typedef buffer_vector<TPendingNode, 32> TPendingNodes;
typedef std::vector<TPendingNode> TPendingNodes;
// Initialized once via ReserveResource.
TResourceMapping m_predefinedResourceMapping;
// Filled async via MapResource, protected with m_mappingLock.
TResourceMapping m_resourceMapping;
TPendingNodes m_pendingNodes;
StipplePenPacker m_packer;
@ -117,12 +120,11 @@ private:
std::mutex m_mappingLock;
};
std::string DebugPrint(StipplePenHandle const & key);
class StipplePenTexture : public DynamicTexture<StipplePenIndex, StipplePenKey,
Texture::ResourceType::StipplePen>
{
using TBase = DynamicTexture<StipplePenIndex, StipplePenKey, Texture::ResourceType::StipplePen>;
public:
StipplePenTexture(m2::PointU const & size, ref_ptr<HWTextureAllocator> allocator)
: m_index(size)
@ -134,7 +136,7 @@ public:
~StipplePenTexture() override { TBase::Reset(); }
void ReservePattern(buffer_vector<uint8_t, 8> const & pattern);
void ReservePattern(PenPatternT const & pattern);
private:
StipplePenIndex m_index;

View file

@ -11,6 +11,7 @@
#include "platform/platform.hpp"
#include "coding/reader.hpp"
#include "coding/reader_streambuf.hpp"
#include "base/buffer_vector.hpp"
#include "base/file_name_utils.hpp"
@ -28,14 +29,17 @@
namespace dp
{
namespace
{
uint32_t const kMaxTextureSize = 1024;
uint32_t const kStippleTextureWidth = 512;
uint32_t const kStippleTextureWidth = 512; /// @todo Should be equal with kMaxStipplePenLength?
uint32_t const kMinStippleTextureHeight = 64;
uint32_t const kMinColorTextureSize = 32;
uint32_t const kGlyphsTextureSize = 1024;
size_t const kInvalidGlyphGroup = std::numeric_limits<size_t>::max();
uint32_t const kReservedPatterns = 10;
// Reserved for elements like RuleDrawer or other LineShapes.
uint32_t const kReservedPatterns = 0;
size_t const kReservedColors = 20;
biodranik commented 2022-06-14 20:54:19 +00:00 (Migrated from github.com)
Review

Если сомневаешься, сделай сразу равной kMaxStipplePenLength, и оставь туду.

Если сомневаешься, сделай сразу равной kMaxStipplePenLength, и оставь туду.
vng commented 2022-06-15 06:39:25 +00:00 (Migrated from github.com)
Review

Они равны, тут вопрос

Они равны, тут вопрос
float const kGlyphAreaMultiplier = 1.2f;
@ -44,8 +48,6 @@ float const kGlyphAreaCoverage = 0.9f;
std::string const kSymbolTextures[] = { "symbols" };
uint32_t const kDefaultSymbolsIndex = 0;
namespace
{
void MultilineTextToUniString(TextureManager::TMultilineText const & text, strings::UniString & outString)
{
size_t cnt = 0;
@ -58,32 +60,15 @@ void MultilineTextToUniString(TextureManager::TMultilineText const & text, strin
outString.append(str.begin(), str.end());
}
std::string ReadFileToString(std::string const & filename)
{
std::string result;
try
{
ReaderPtr<Reader>(GetPlatform().GetReader(filename)).ReadAsString(result);
}
catch(RootException const & e)
{
LOG(LWARNING, ("Error reading file ", filename, " : ", e.what()));
return "";
}
return result;
}
template <typename ToDo>
void ParseColorsList(std::string const & colorsFile, ToDo toDo)
{
std::istringstream fin(ReadFileToString(colorsFile));
while (true)
ReaderStreamBuf buffer(GetPlatform().GetReader(colorsFile));
std::istream is(&buffer);
while (is.good())
{
uint32_t color;
fin >> color;
if (!fin)
break;
is >> color;
toDo(dp::Extract(color));
}
}
@ -91,13 +76,14 @@ void ParseColorsList(std::string const & colorsFile, ToDo toDo)
template <typename ToDo>
void ParsePatternsList(std::string const & patternsFile, ToDo && toDo)
{
strings::Tokenize(ReadFileToString(patternsFile), "\n", [&](std::string_view patternStr)
{
if (patternStr.empty())
return;
ReaderStreamBuf buffer(GetPlatform().GetReader(patternsFile));
std::istream is(&buffer);
std::string line;
while (std::getline(is, line))
{
buffer_vector<double, 8> pattern;
strings::Tokenize(patternStr, " ", [&](std::string_view token)
strings::Tokenize(line, " ", [&](std::string_view token)
{
double d = 0.0;
VERIFY(strings::to_double(token, d), ());
@ -109,7 +95,7 @@ void ParsePatternsList(std::string const & patternsFile, ToDo && toDo)
{
if (fabs(pattern[i]) < 1e-5)
{
LOG(LWARNING, ("Pattern was skipped", patternStr));
LOG(LWARNING, ("Pattern was skipped", line));
isValid = false;
break;
}
@ -117,21 +103,26 @@ void ParsePatternsList(std::string const & patternsFile, ToDo && toDo)
if (isValid)
toDo(pattern);
});
}
}
m2::PointU StipplePenTextureSize(size_t patternsCount, uint32_t maxTextureSize)
{
uint32_t const sz = base::NextPowOf2(static_cast<uint32_t>(patternsCount) + kReservedPatterns);
uint32_t const stippleTextureHeight =
std::min(maxTextureSize, std::max(sz, kMinStippleTextureHeight));
// No problem if assert will fire here. Just pen texture will be 2x bigger :)
ASSERT_LESS_OR_EQUAL(sz, kMinStippleTextureHeight, ());
uint32_t const stippleTextureHeight = std::min(maxTextureSize, std::max(sz, kMinStippleTextureHeight));
return m2::PointU(kStippleTextureWidth, stippleTextureHeight);
}
m2::PointU ColorTextureSize(size_t colorsCount, uint32_t maxTextureSize)
{
uint32_t const sz = static_cast<uint32_t>(floor(sqrt(colorsCount + kReservedColors)));
// No problem if assert will fire here. Just color texture will be 2x bigger :)
ASSERT_LESS_OR_EQUAL(sz, kMinColorTextureSize, ());
uint32_t colorTextureSize = std::max(base::NextPowOf2(sz), kMinColorTextureSize);
colorTextureSize *= ColorTexture::GetColorSizeInPixels();
colorTextureSize = std::min(maxTextureSize, colorTextureSize);
return m2::PointU(colorTextureSize, colorTextureSize);
@ -195,10 +186,6 @@ m2::RectF const & TextureManager::BaseRegion::GetTexRect() const
return m_info->GetTexRect();
}
TextureManager::GlyphRegion::GlyphRegion()
: BaseRegion()
{}
float TextureManager::GlyphRegion::GetOffsetX() const
{
ASSERT(m_info->GetType() == Texture::ResourceType::Glyph, ());
@ -223,17 +210,17 @@ float TextureManager::GlyphRegion::GetAdvanceY() const
return ref_ptr<GlyphInfo>(m_info)->GetMetrics().m_yAdvance;
}
uint32_t TextureManager::StippleRegion::GetMaskPixelLength() const
m2::PointU TextureManager::StippleRegion::GetMaskPixelSize() const
{
ASSERT(m_info->GetType() == Texture::ResourceType::StipplePen, ());
return ref_ptr<StipplePenResourceInfo>(m_info)->GetMaskPixelLength();
return ref_ptr<StipplePenResourceInfo>(m_info)->GetMaskPixelSize();
}
uint32_t TextureManager::StippleRegion::GetPatternPixelLength() const
{
ASSERT(m_info->GetType() == Texture::ResourceType::StipplePen, ());
return ref_ptr<StipplePenResourceInfo>(m_info)->GetPatternPixelLength();
}
//uint32_t TextureManager::StippleRegion::GetPatternPixelLength() const
//{
// ASSERT(m_info->GetType() == Texture::ResourceType::StipplePen, ());
// return ref_ptr<StipplePenResourceInfo>(m_info)->GetPatternPixelLength();
//}
void TextureManager::Release()
{
@ -437,9 +424,9 @@ void TextureManager::Init(ref_ptr<dp::GraphicsContext> context, Params const & p
GLFunctions::glPixelStore(gl_const::GLUnpackAlignment, 1);
// Initialize symbols.
for (size_t i = 0; i < ARRAY_SIZE(kSymbolTextures); ++i)
for (auto const & texName : kSymbolTextures)
{
m_symbolTextures.push_back(make_unique_dp<SymbolsTexture>(context, m_resPostfix, kSymbolTextures[i],
m_symbolTextures.push_back(make_unique_dp<SymbolsTexture>(context, m_resPostfix, texName,
make_ref(m_textureAllocator)));
}
@ -458,37 +445,57 @@ void TextureManager::Init(ref_ptr<dp::GraphicsContext> context, Params const & p
dp::TextureFormat::Alpha, make_ref(m_textureAllocator));
}
// Initialize patterns.
buffer_vector<buffer_vector<uint8_t, 8>, 64> patterns;
// Initialize patterns (reserved ./data/patterns.txt lines count).
std::vector<PenPatternT> patterns;
patterns.reserve(kMinStippleTextureHeight);
double const visualScale = params.m_visualScale;
ParsePatternsList(params.m_patterns, [&patterns, visualScale](buffer_vector<double, 8> const & pattern)
uint32_t rowsCount = 0;
ParsePatternsList(params.m_patterns, [&](buffer_vector<double, 8> const & pattern)
{
buffer_vector<uint8_t, 8> p;
for (size_t i = 0; i < pattern.size(); i++)
p.push_back(static_cast<uint8_t>(pattern[i] * visualScale));
patterns.push_back(std::move(p));
patterns.push_back({});
auto & added = patterns.back();
for (double d : pattern)
added.push_back(static_cast<uint8_t>(d * visualScale));
if (IsTrianglePattern(added))
{
rowsCount = rowsCount + added[2] + added[3];
}
else
{
ASSERT_EQUAL(added.size(), 2, ());
++rowsCount;
}
});
m_stipplePenTexture = make_unique_dp<StipplePenTexture>(StipplePenTextureSize(patterns.size(), m_maxTextureSize),
// We don't filter duplicates in rowsCount (it is bigger than unique count),
// but they will be filtered in ReservePattern call.
m_stipplePenTexture = make_unique_dp<StipplePenTexture>(StipplePenTextureSize(rowsCount, m_maxTextureSize),
make_ref(m_textureAllocator));
LOG(LDEBUG, ("Patterns texture size =", m_stipplePenTexture->GetWidth(), m_stipplePenTexture->GetHeight()));
ref_ptr<StipplePenTexture> stipplePenTextureTex = make_ref(m_stipplePenTexture);
for (auto it = patterns.begin(); it != patterns.end(); ++it)
stipplePenTextureTex->ReservePattern(*it);
ref_ptr<StipplePenTexture> stipplePenTex = make_ref(m_stipplePenTexture);
for (auto const & p : patterns)
stipplePenTex->ReservePattern(p);
// Initialize colors.
buffer_vector<dp::Color, 256> colors;
// Initialize colors (reserved ./data/colors.txt lines count).
std::vector<dp::Color> colors;
colors.reserve(512);
ParseColorsList(params.m_colors, [&colors](dp::Color const & color)
{
colors.push_back(color);
});
m_colorTexture = make_unique_dp<ColorTexture>(ColorTextureSize(colors.size(), m_maxTextureSize),
make_ref(m_textureAllocator));
LOG(LDEBUG, ("Colors texture size =", m_colorTexture->GetWidth(), m_colorTexture->GetHeight()));
ref_ptr<ColorTexture> colorTex = make_ref(m_colorTexture);
for (auto it = colors.begin(); it != colors.end(); ++it)
colorTex->ReserveColor(*it);
for (auto const & c : colors)
colorTex->ReserveColor(c);
// Initialize glyphs.
m_glyphManager = make_unique_dp<GlyphManager>(params.m_glyphMngParams);
@ -558,7 +565,7 @@ bool TextureManager::HasSymbolRegion(std::string const & symbolName) const
return false;
}
void TextureManager::GetStippleRegion(TStipplePattern const & pen, StippleRegion & region)
void TextureManager::GetStippleRegion(PenPatternT const & pen, StippleRegion & region)
{
CHECK(m_isInitialized, ());
GetRegionBase(make_ref(m_stipplePenTexture), region, StipplePenKey(pen));

View file

@ -1,11 +1,12 @@
#pragma once
#include "drape/color.hpp"
#include "drape/font_texture.hpp"
#include "drape/glyph_generator.hpp"
#include "drape/glyph_manager.hpp"
#include "drape/pointers.hpp"
#include "drape/stipple_pen_resource.hpp" // for PenPatternT
#include "drape/texture.hpp"
#include "drape/font_texture.hpp"
#include "base/string_utils.hpp"
#include "base/timer.hpp"
@ -19,8 +20,6 @@
namespace dp
{
extern std::string const kDefaultSymbolsTexture;
class HWTextureAllocator;
class TextureManager
@ -56,8 +55,6 @@ public:
class GlyphRegion : public BaseRegion
{
public:
GlyphRegion();
float GetOffsetX() const;
float GetOffsetY() const;
float GetAdvanceX() const;
@ -67,16 +64,12 @@ public:
class StippleRegion : public BaseRegion
{
public:
StippleRegion() : BaseRegion() {}
uint32_t GetMaskPixelLength() const;
uint32_t GetPatternPixelLength() const;
m2::PointU GetMaskPixelSize() const;
//uint32_t GetPatternPixelLength() const;
};
class ColorRegion : public BaseRegion
{
public:
ColorRegion() : BaseRegion() {}
};
struct Params
@ -98,8 +91,7 @@ public:
void GetSymbolRegion(std::string const & symbolName, SymbolRegion & region);
bool HasSymbolRegion(std::string const & symbolName) const;
typedef buffer_vector<uint8_t, 8> TStipplePattern;
void GetStippleRegion(TStipplePattern const & pen, StippleRegion & region);
void GetStippleRegion(PenPatternT const & pen, StippleRegion & region);
void GetColorRegion(Color const & color, ColorRegion & region);
using TMultilineText = buffer_vector<strings::UniString, 4>;

View file

@ -21,10 +21,8 @@ ColorPalette::ColorPalette(m2::PointU const & canvasSize)
ref_ptr<Texture::ResourceInfo> ColorPalette::ReserveResource(bool predefined, ColorKey const & key, bool & newResource)
{
std::lock_guard<std::mutex> lock(m_mappingLock);
TPalette & palette = predefined ? m_predefinedPalette : m_palette;
TPalette::iterator itm = palette.find(key.m_color);
auto itm = palette.find(key.m_color);
newResource = (itm == palette.end());
if (newResource)
{
@ -61,12 +59,14 @@ ref_ptr<Texture::ResourceInfo> ColorPalette::ReserveResource(bool predefined, Co
ref_ptr<Texture::ResourceInfo> ColorPalette::MapResource(ColorKey const & key, bool & newResource)
{
TPalette::iterator itm = m_predefinedPalette.find(key.m_color);
auto itm = m_predefinedPalette.find(key.m_color);
if (itm != m_predefinedPalette.end())
{
newResource = false;
return make_ref(&itm->second);
}
std::lock_guard<std::mutex> lock(m_mappingLock);
return ReserveResource(false /* predefined */, key, newResource);
}
@ -78,6 +78,7 @@ void ColorPalette::UploadResources(ref_ptr<dp::GraphicsContext> context, ref_ptr
std::lock_guard<std::mutex> g(m_lock);
if (m_pendingNodes.empty())
return;
if (context->HasPartialTextureUpdates())
{
pendingNodes.swap(m_pendingNodes);
@ -197,4 +198,4 @@ int ColorTexture::GetColorSizeInPixels()
return kResourceSize;
}
}
} // namespace dp

View file

@ -27,24 +27,18 @@ class TextureCoordGenerator
{
public:
explicit TextureCoordGenerator(dp::TextureManager::StippleRegion const & region)
: m_region(region)
, m_maskLength(static_cast<float>(m_region.GetMaskPixelLength()))
: m_region(region), m_maskSize(m_region.GetMaskPixelSize())
{}
glsl::vec4 GetTexCoordsByDistance(float distance) const
{
return GetTexCoords(distance / m_maskLength);
}
glsl::vec4 GetTexCoords(float offset) const
glsl::vec4 GetTexCoordsByDistance(float distance, bool isLeft) const
{
m2::RectF const & texRect = m_region.GetTexRect();
return glsl::vec4(offset, texRect.minX(), texRect.SizeX(), texRect.Center().y);
return { distance / GetMaskLength(), texRect.minX(), texRect.SizeX(), isLeft ? texRect.minY() : texRect.maxY() };
}
float GetMaskLength() const
uint32_t GetMaskLength() const
{
return m_maskLength;
return m_maskSize.x;
}
dp::TextureManager::StippleRegion const & GetRegion() const
@ -54,7 +48,7 @@ public:
private:
dp::TextureManager::StippleRegion const m_region;
float const m_maskLength;
m2::PointU const m_maskSize;
};
struct BaseBuilderParams
@ -320,7 +314,7 @@ public:
int GetDashesCount(float const globalLength) const
{
float const pixelLen = globalLength * m_baseGtoPScale;
return static_cast<int>((pixelLen + m_texCoordGen.GetMaskLength() - 1) / m_texCoordGen.GetMaskLength());
return (pixelLen + m_texCoordGen.GetMaskLength() - 1) / m_texCoordGen.GetMaskLength();
}
dp::RenderState GetState() override
@ -336,7 +330,7 @@ public:
{
float const halfWidth = GetHalfWidth();
m_geometry.emplace_back(pivot, TNormal(halfWidth * normal, halfWidth * GetSide(isLeft)),
m_colorCoord, m_texCoordGen.GetTexCoordsByDistance(offsetFromStart));
m_colorCoord, m_texCoordGen.GetTexCoordsByDistance(offsetFromStart, isLeft));
}
private:
@ -482,20 +476,18 @@ bool LineShape::CanBeSimplified(int & lineWidth) const
void LineShape::Prepare(ref_ptr<dp::TextureManager> textures) const
{
float const pxHalfWidth = m_params.m_width / 2.0f;
dp::TextureManager::ColorRegion colorRegion;
textures->GetColorRegion(m_params.m_color, colorRegion);
auto commonParamsBuilder = [&](BaseBuilderParams & p)
auto commonParamsBuilder = [this, textures](BaseBuilderParams & p)
{
dp::TextureManager::ColorRegion colorRegion;
textures->GetColorRegion(m_params.m_color, colorRegion);
p.m_cap = m_params.m_cap;
p.m_color = colorRegion;
p.m_depthTestEnabled = m_params.m_depthTestEnabled;
p.m_depth = m_params.m_depth;
p.m_depthLayer = m_params.m_depthLayer;
p.m_join = m_params.m_join;
p.m_pxHalfWidth = pxHalfWidth;
p.m_pxHalfWidth = m_params.m_width / 2;
};
if (m_params.m_pattern.empty())
@ -530,7 +522,7 @@ void LineShape::Prepare(ref_ptr<dp::TextureManager> textures) const
commonParamsBuilder(p);
p.m_stipple = maskRegion;
p.m_baseGtoP = m_params.m_baseGtoPScale;
p.m_glbHalfWidth = pxHalfWidth / m_params.m_baseGtoPScale;
p.m_glbHalfWidth = p.m_pxHalfWidth / m_params.m_baseGtoPScale;
auto builder = std::make_unique<DashedLineBuilder>(p, m_spline->GetPath().size());
Construct<DashedLineBuilder>(*builder);

View file

@ -85,7 +85,7 @@ struct LineViewParams : CommonViewParams
float m_width = 0.0f;
dp::LineCap m_cap;
dp::LineJoin m_join;
buffer_vector<uint8_t, 8> m_pattern;
dp::PenPatternT m_pattern;
float m_baseGtoPScale = 1.0f;
int m_zoomLevel = -1;
};

View file

@ -28,6 +28,8 @@
namespace df
{
namespace
{
std::array<double, 20> const kLineWidthZoomFactor =
{
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
@ -35,14 +37,6 @@ std::array<double, 20> const kLineWidthZoomFactor =
};
int const kLineSimplifyLevelEnd = 15;
std::string DebugPrint(ColoredSymbolViewParams const & csvp)
{
return DebugPrint(csvp.m_anchor) + DebugPrint(csvp.m_color) +
DebugPrint(csvp.m_sizeInPixels) + DebugPrint(csvp.m_offset);
}
namespace
{
template <typename TCreateVector>
void AlignFormingNormals(TCreateVector const & fn, dp::Anchor anchor, dp::Anchor first,
dp::Anchor second, glsl::vec2 & firstNormal, glsl::vec2 & secondNormal)