From 4dfa76a0fc004c353edf2522e4d4e8df9a016f9b Mon Sep 17 00:00:00 2001 From: jhollinger2 Date: Fri, 3 Oct 2014 13:46:23 -0400 Subject: [PATCH 1/2] Update group symbolizer collision to use margin instead of minimum-distance. Add test case. --- src/group/group_symbolizer_helper.cpp | 4 +- .../styles/group-symbolizer-2.xml | 2 +- .../styles/group-symbolizer-3.xml | 87 +++++++++++++++++++ tests/visual_tests/test.py | 1 + 4 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 tests/visual_tests/styles/group-symbolizer-3.xml diff --git a/src/group/group_symbolizer_helper.cpp b/src/group/group_symbolizer_helper.cpp index 8af250436..f3086a101 100644 --- a/src/group/group_symbolizer_helper.cpp +++ b/src/group/group_symbolizer_helper.cpp @@ -164,9 +164,9 @@ bool group_symbolizer_helper::collision(box2d const& box, value_unicode_ !query_extent_.contains(box + (scale_factor_ * placement_->properties.minimum_padding))) || (!placement_->properties.allow_overlap && - ((repeat_key.length() == 0 && !detector_.has_placement(box, placement_->properties.minimum_distance * scale_factor_)) + ((repeat_key.length() == 0 && !detector_.has_placement(box, placement_->properties.margin * scale_factor_)) || - (repeat_key.length() > 0 && !detector_.has_placement(box, placement_->properties.minimum_distance * scale_factor_, + (repeat_key.length() > 0 && !detector_.has_placement(box, placement_->properties.margin * scale_factor_, repeat_key, placement_->properties.repeat_distance * scale_factor_)))) ) { diff --git a/tests/visual_tests/styles/group-symbolizer-2.xml b/tests/visual_tests/styles/group-symbolizer-2.xml index 400d44fd3..45a3336b6 100644 --- a/tests/visual_tests/styles/group-symbolizer-2.xml +++ b/tests/visual_tests/styles/group-symbolizer-2.xml @@ -35,7 +35,7 @@ lat,long,name1,ref1,name2,ref2 + + + grouped + + csv + +lat,long,name1,ref1,name2,ref2,margin +0,-0.35,One,1,Two,2,0 +0,0.35,One,1,Two,2,30 + + + + + + + + frame + + csv + +lat,long,nr +-0.5,-1,0 +-0.5,1,1 +0.5,-1,2 +0.5,1,3 + + + + + + + center + + csv + +lat,long +0,-0.35 +0,0.35 + + + + + + + diff --git a/tests/visual_tests/test.py b/tests/visual_tests/test.py index a7c432285..ea220cf67 100755 --- a/tests/visual_tests/test.py +++ b/tests/visual_tests/test.py @@ -267,6 +267,7 @@ files = { 'polygon-winding-order': {'sizes':[(300,300)]}, 'group-symbolizer-1':{'sizes':[(512,512)]}, 'group-symbolizer-2':{'sizes':[(512,512)]}, + 'group-symbolizer-3':{'sizes':[(512,256)]}, 'group-symbolizer-line-1':{'sizes':[(512,512)]}, 'group-symbolizer-line-2':{'sizes':[(512,512)]}, 'text-charplacement':{'sizes':[(512,512)]}, From 8dad0c89753b3f9ec1a893efb7de732ead65b48f Mon Sep 17 00:00:00 2001 From: Jordan Hollinger Date: Fri, 3 Oct 2014 14:45:25 -0400 Subject: [PATCH 2/2] Add test case expected results. --- ...mbolizer-3-512-256-1.0-grid-reference.json | 74 ++++++++++++++++++ ...mbolizer-3-512-256-2.0-grid-reference.json | 74 ++++++++++++++++++ ...symbolizer-3-512-256-1.0-agg-reference.png | Bin 0 -> 1495 bytes ...mbolizer-3-512-256-1.0-cairo-reference.png | Bin 0 -> 1516 bytes ...symbolizer-3-512-256-2.0-agg-reference.png | Bin 0 -> 2236 bytes ...mbolizer-3-512-256-2.0-cairo-reference.png | Bin 0 -> 2439 bytes 6 files changed, 148 insertions(+) create mode 100644 tests/visual_tests/grids/group-symbolizer-3-512-256-1.0-grid-reference.json create mode 100644 tests/visual_tests/grids/group-symbolizer-3-512-256-2.0-grid-reference.json create mode 100644 tests/visual_tests/images/group-symbolizer-3-512-256-1.0-agg-reference.png create mode 100644 tests/visual_tests/images/group-symbolizer-3-512-256-1.0-cairo-reference.png create mode 100644 tests/visual_tests/images/group-symbolizer-3-512-256-2.0-agg-reference.png create mode 100644 tests/visual_tests/images/group-symbolizer-3-512-256-2.0-cairo-reference.png diff --git a/tests/visual_tests/grids/group-symbolizer-3-512-256-1.0-grid-reference.json b/tests/visual_tests/grids/group-symbolizer-3-512-256-1.0-grid-reference.json new file mode 100644 index 000000000..ef2ac14e2 --- /dev/null +++ b/tests/visual_tests/grids/group-symbolizer-3-512-256-1.0-grid-reference.json @@ -0,0 +1,74 @@ +{ + "keys": [ + "", + "1", + "2" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! # ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff --git a/tests/visual_tests/grids/group-symbolizer-3-512-256-2.0-grid-reference.json b/tests/visual_tests/grids/group-symbolizer-3-512-256-2.0-grid-reference.json new file mode 100644 index 000000000..ef2ac14e2 --- /dev/null +++ b/tests/visual_tests/grids/group-symbolizer-3-512-256-2.0-grid-reference.json @@ -0,0 +1,74 @@ +{ + "keys": [ + "", + "1", + "2" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! # ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff --git a/tests/visual_tests/images/group-symbolizer-3-512-256-1.0-agg-reference.png b/tests/visual_tests/images/group-symbolizer-3-512-256-1.0-agg-reference.png new file mode 100644 index 0000000000000000000000000000000000000000..7de094f5fbef31b07f4e6846c6c320f3e45d4f11 GIT binary patch literal 1495 zcmdT^YfO`86h2>Dt_o6|auJZRFmyvI8@B{P%TgvFbS-j`!3v^Khw4k^#~HvH&jPr$Rt+)awDN)z!a+5yg07-(Y$`M9$5H7iK5w zzqY2md`?*reUzLS_eig=vUisUxta!pi$WgX zUdk@ecp=zc@Oy7S!GgOZ+y_^hJS&~ch&1|luby1sdK}-6@oiN<81SmTY@N&mYvo2; zw0x4~_j}FB+uu;$bvT6w435n|n>(0U1T(_c;^8y8R0Z{vtT(%VMs0yvdwjGsoFaVe9M435QNy(vWZ)v6C|eF{wX8z$n*hc^fU2w z%H^i!kAqH=w7L3S;|EGCXg5@)O*=jlg3sdmfLyoT9o$L%P^8J%C&oe7aSO~%X0BTv zy)+>3DbDtiQm#3o(!Zz@NA#r$utUIH?mhd6#DS&KT?sjdks)2~Rztj;tJvnfjW)$5 zsKV7DBkgDhTy}vR0*XToXyuJUp@+l?9Sf7PyEvBEHA^ho5>x$WtT<_tO+W(UJK$`9 zJv7|b|4PF2MjZjK!N-1WeJXEab-7M@$2cKJ35V{umkdcp9hxTUo{oq|uyBO=r|cf1 zTfDjc+SnouzYVq%^eF}ErNsEip2At?yt=30G|SHIIn)kCP2Jka6r}9S^4=4;?1(Ov z8>5=345(GM)O(3kS>%{c9m@n>F%k*VMmw*nn!Tk-w0|Q=CuvJ8k^7Q3#`bUvnKmf<^J? z9=*U3rJ zp56SS(WUioY?R28iTIr{_i|ye=HenpBk$_(&T75k8nRPQzskCwA3on6LPRyL@A?DY tpZ)MZor+|Q=N=f!WBB%D!gy5A!z15M#VXDm`2%075FE&$H-3>&@GqBA9`FDF literal 0 HcmV?d00001 diff --git a/tests/visual_tests/images/group-symbolizer-3-512-256-1.0-cairo-reference.png b/tests/visual_tests/images/group-symbolizer-3-512-256-1.0-cairo-reference.png new file mode 100644 index 0000000000000000000000000000000000000000..636ea4468e393532059735fb8726eee9ae1a7ab1 GIT binary patch literal 1516 zcmdT^`%jw%6um8-dyf!M?iX~qaJ*`O3UXe=#rJS<>g5pf7oS!gSd(gv83 zhXZxtVSpAAi`%lnK!E^bUo^9_f`srWgLc3=*eJ3Bl~`ir{e60RRZh=*V{gur`VT#LfmA?9g}{@MBqV3>(5B0K82H-~@m;g0pQy0yh8; z055mw6ah$WrVRi(0IL-sOcq9y z(|GMX*{JM+Q+dsNXsWxN#qjvRRA*ypqUBO6yk+*IN-qAi!)xr$XENfy+hS$wP#)i zud?u>AR-}S2-_P|%I$=l@q=~5=@!qU!(ZED(40D$$3ydf7(92Fp$ZL~#NKFdmz*#2 zah%*+*AWyCFW*Ion+?lb*S&GEbt6ko(pJgz=ljEXdvPS}vpys()p_b^+pLm&T-p>R zHDt;`KQ^5uon zp3>yWcX^*VbrzW~ti;h8SbIT|uUMRFgD5vJEXaIL<^3vNx~RH`y+t1jn9V=^j?%m+ zzTnrHm*fuD#yc~G;{%yDo-Zou6%SjTP?riEZENEB1O7Vi9-X#7CdTMO67xI9TM&#c8FFR z&p4TZJQ|QJB)5JuySr$Ja^S| ztEV^^rmrx#iMvY(O35>rDO#DOXW`C`jFtl(ntcD!&0zTbMCFAr`%tq!OK_g&`lFTV w4Z`Xd=d%Bor1aVDZC1ic@0-upE=Kufz literal 0 HcmV?d00001 diff --git a/tests/visual_tests/images/group-symbolizer-3-512-256-2.0-agg-reference.png b/tests/visual_tests/images/group-symbolizer-3-512-256-2.0-agg-reference.png new file mode 100644 index 0000000000000000000000000000000000000000..c97fa95ed744f0175b4011da4bcf02557e2f1c67 GIT binary patch literal 2236 zcmdUxX;72r7RS$wxHM$upkhYXt5wdtDQ4f99G0InQ}!e$Sk9 z{xD^~k>NT+05J0L_V5S5XhQ__v09m@xCLn?;_$&hPpyIufB}Fpz)ApffOP;C0M-DT z0k#3`1aJh{1waCD2k-(o1fb0i0SE(#1o#>t7T^p(8UU&-r_lhA+2jarMERfPi6P>y`iOeCxQ%D8`6pXT=3id&KMU5uE0XZOU`6%;lDc*%o;< z)IV+wJQ_#Hj&M#7B>u1_w13%N;do!mRLaIm0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