close #1548 with explict handling of point geometries and amend 629d768eae for cairo/grid renderers to ensure proper placement on lines (refs #1604,#1350,#1607)

This commit is contained in:
Dane Springmeyer 2012-12-02 19:53:44 -08:00
parent 388ac9799d
commit 7d408d523c
8 changed files with 114 additions and 11 deletions

View file

@ -78,11 +78,17 @@ struct raster_markers_rasterizer_dispatch_grid
{
marker_placement_e placement_method = sym_.get_marker_placement();
box2d<double> bbox_(0,0, src_.width(),src_.height());
if (placement_method != MARKER_LINE_PLACEMENT)
if (placement_method != MARKER_LINE_PLACEMENT ||
path.type() == Point)
{
double x = 0;
double y = 0;
if (placement_method == MARKER_INTERIOR_PLACEMENT)
if (path.type() == LineString)
{
if (!label::middle_point(path, x, y))
return;
}
else if (placement_method == MARKER_INTERIOR_PLACEMENT)
{
if (!label::interior_position(path, x, y))
return;
@ -209,11 +215,17 @@ struct vector_markers_rasterizer_dispatch_grid
void add_path(T & path)
{
marker_placement_e placement_method = sym_.get_marker_placement();
if (placement_method != MARKER_LINE_PLACEMENT)
if (placement_method != MARKER_LINE_PLACEMENT ||
path.type() == Point)
{
double x = 0;
double y = 0;
if (placement_method == MARKER_INTERIOR_PLACEMENT)
if (path.type() == LineString)
{
if (!label::middle_point(path, x, y))
return;
}
else if (placement_method == MARKER_INTERIOR_PLACEMENT)
{
if (!label::interior_position(path, x, y))
return;

View file

@ -87,7 +87,8 @@ struct vector_markers_rasterizer_dispatch
{
marker_placement_e placement_method = sym_.get_marker_placement();
if (placement_method != MARKER_LINE_PLACEMENT)
if (placement_method != MARKER_LINE_PLACEMENT ||
path.type() == Point)
{
double x = 0;
double y = 0;
@ -188,7 +189,8 @@ struct raster_markers_rasterizer_dispatch
marker_placement_e placement_method = sym_.get_marker_placement();
box2d<double> bbox_(0,0, src_.width(),src_.height());
if (placement_method != MARKER_LINE_PLACEMENT)
if (placement_method != MARKER_LINE_PLACEMENT ||
path.type() == Point)
{
double x = 0;
double y = 0;

View file

@ -1550,11 +1550,17 @@ struct markers_dispatch
{
marker_placement_e placement_method = sym_.get_marker_placement();
if (placement_method != MARKER_LINE_PLACEMENT)
if (placement_method != MARKER_LINE_PLACEMENT ||
path.type() == Point)
{
double x = 0;
double y = 0;
if (placement_method == MARKER_INTERIOR_PLACEMENT)
if (path.type() == LineString)
{
if (!label::middle_point(path, x, y))
return;
}
else if (placement_method == MARKER_INTERIOR_PLACEMENT)
{
if (!label::interior_position(path, x, y))
return;
@ -1633,11 +1639,17 @@ struct markers_dispatch_2
{
marker_placement_e placement_method = sym_.get_marker_placement();
if (placement_method != MARKER_LINE_PLACEMENT)
if (placement_method != MARKER_LINE_PLACEMENT ||
path.type() == Point)
{
double x = 0;
double y = 0;
if (placement_method == MARKER_INTERIOR_PLACEMENT)
if (path.type() == LineString)
{
if (!label::middle_point(path, x, y))
return;
}
else if (placement_method == MARKER_INTERIOR_PLACEMENT)
{
if (!label::interior_position(path, x, y))
return;

View file

@ -85,7 +85,7 @@ def summary(generate=False):
global passed
if len(errors) != 0:
msg = "Visual text rendering: %s failures" % len(errors)
msg = "Visual text rendering: %s failed / %s passed" % (len(errors),passed)
print "-"*len(msg)
print msg
print "-"*len(msg)

View file

@ -0,0 +1,40 @@
{
"keys": [
"",
"4",
"3",
"6",
"5",
"7",
"1",
"2"
],
"data": {},
"grid": [
" !!!!!! ###### ",
" !!!!! ##### ",
" !! ## ",
" ",
" ",
" ",
" ",
" ",
" $$$$ ",
" $$$$$$ ",
" $$$$$$$ ",
" $$$$$$ ",
" %%%$$%% ",
" %%&&&&% ",
" &&&&&& ",
" &&&&&&& ",
" &&&&&& ",
" && ",
" ",
" ",
" ",
" ",
" ",
" ''' ((( ",
" ''''' ((((( "
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -0,0 +1,36 @@
<!DOCTYPE Map>
<Map background-color="white" srs="+init=epsg:4326" minimum-version="0.7.2">
<Style name="1">
<Rule>
<Filter>[id]=1</Filter>
<MarkersSymbolizer fill="darkgreen" opacity=".7" width="15" height="10" stroke="green" stroke-width="7" stroke-opacity=".2" placement="line" marker-type="ellipse"/>
</Rule>
<Rule>
<Filter>[id]=2</Filter>
<MarkersSymbolizer fill="darkorange" opacity=".7" width="20" height="10" stroke="orange" stroke-width="7" stroke-opacity=".2" placement="line" marker-type="ellipse"/>
</Rule>
<Rule>
<Filter>[id]=3</Filter>
<MarkersSymbolizer fill="darkred" opacity=".7" width="20" height="10" stroke="orange" stroke-width="7" stroke-opacity=".2" placement="line" marker-type="ellipse"/>
</Rule>
</Style>
<Layer name="point" srs="+init=epsg:4326">
<StyleName>1</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
x,y,id
0,0,1
5,0,1
5,5,1
0,5,1
2.5,2.5,2
2.5,3,3
2.5,2,3
3,2.5,3
2,2.5,3
</Parameter>
</Datasource>
</Layer>
</Map>

View file

@ -38,6 +38,7 @@ files = [
{'name': "lines-3", 'sizes': sizes_few_square,'bbox':default_text_box},
{'name': "lines-shield", 'sizes': sizes_few_square,'bbox':default_text_box},
{'name': "marker-multi-policy", 'sizes':[(600,400)]},
{'name': "marker_line_placement_on_points"},
{'name': "whole-centroid", 'sizes':[(600,400)],
'bbox': mapnik.Box2d(736908, 4390316, 2060771, 5942346)},
{'name': "simple-E", 'bbox':mapnik.Box2d(-0.05, -0.01, 0.95, 0.01)},