Rendering improvements


This is all you Dave, fill in the improvements you've done.




April 10, 2015, 3:57 PM

CodeHaus Comment From: dblasby - Time: Tue, 17 May 2005 16:00:48 -0500
<p>I've updated the labeler (major changes), plus changes to the SLD parser.</p>

<p>1.The old version of the labeler, if given a <b>set</b> of points, lines,

or polygons justed labels the first item in the set. The sets are

formed when you want to only put a single "Main St" on the map even if

you have a bunch of small "Main St" segments.</p>

<p> I changed this to be much much wiser.</p>

<p> Basically, the new way looks at the set of geometries that its going

to put a label on and find the "best" one that represents it. That

geometry is then labeled (see below for details on where that label is


<p>Here's the javadocs, but please note the details are actually quite

complex. They all try to handle robustness issue, sets of basic and

MULTI* geometries as well as mixed geometries, and do geometry


<p>I spent a lot of time getting the line merger to work "smart" to build a

nice representative line from the set of input lines.</p>

<p> /**

<li>1. get a list of points from the input geometries that are inside

the displayGeom</li>
<li>NOTE: lines and polygons are reduced to their centroids (you

shouldnt really calling this with lines and polys)</li>
<li>2. choose the most "central" of the points</li>
<li>METRIC - choose anyone</li>
<li>TODO: change metric to be "closest to the centoid of the

possible points"

<li>@param geoms list of Point or MultiPoint (any other geometry types

are rejected</li>
<li>@param displayGeometry</li>
<li>@return a point or null (if there's nothing to draw)


Point getPointSetRepresentativeLocation(List geoms, Geometry


<p> /**</p>
<li>1. make a list of all the geoms (not clipped)</li>
<li>NOTE: reject points, convert polygons to their exterior ring

(you shouldnt be calling this function with points and polys)</li>
<li>2. join the lines together</li>
<li>3. clip resulting lines to display geometry</li>
<li>4. return longest line

<li>NOTE: the joining has multiple solution. For example, consider a

Y (3 lines):</li>
<li>* *</li>
<li>1 2</li>
<li>* *</li>
<li>solutions are:</li>
<li>1-&gt;2 and 3</li>
<li>1-&gt;3 and 2</li>
<li>2-&gt;3 and 1

<li>(see mergeLines() below for detail of the algorithm; its basically

a greedy</li>
<li>algorithm that should form the 'longest' possible route through

the linework)

<li>NOTE: we clip after joining because there could be connections

"going on" outside the display bbox


<li>@param geoms</li>
<li>@param displayGeometry must be poly


LineString getLineSetRepresentativeLocation(List geoms, Geometry


<p> /**</p>
<li>1. make a list of all the polygons clipped to the displayGeometry</li>
<li>NOTE: reject any points or lines</li>
<li>2. choose the largest of the clipped geometries

<li>@param geoms</li>
<li>@param displayGeometry</li>


Polygon getPolySetRepresentativeLocation(List geoms, Geometry


<p>2. I changed the actual drawing routines;</p>

<p> 1. get the "representative geometry" (as above)

2. for points, label as before

3. for lines, find the middle point on the line (old version just

averaged start and end points) and centre label on that point (rotated)

4. for polygons, put the label in the middle of the polygon</p>

<p>3. TODO: For polygons and lines, the labeler should look at multiple

locations and choose the best:</p>

<p> ie. for lines, try the label at the 1/3, 1/2, and 2/3 location.

Metric is how close the label bounding box is to the line.</p>

<p> ie. for polygons, bisect the polygon (about the centroid) into

North, South, East and West polygons. Use the location that has the

label best inside the polygon.</p>

<p> After this is done, you can start doing constraint relaxation to

figure out which set of a labels to actually draw and where (use other

information to help decide this like priority - label Hwys over


<p>4. TODO: deal with labels going off the edge of the screen (much reduced


<p>5. TODO: add a "minimum quality" parameter (ie. if you're labeling a

tiny polygon with a tiny label, dont bother). Metrics are descibed in


<p>6. TODO: add ability for SLD to tweak parameters (ie. "always label").</p>

<p>I will probably not do these for quite a while (if ever), except perhaps

adding the parameters into SLD so users can do some tweaking.</p>

April 10, 2015, 3:57 PM

CodeHaus Comment From: aaime - Time: Thu, 29 Mar 2007 02:06:11 -0500
<p>These issue has been in resolved state for at least one month (quite a bit, a lot more than one month). Batch transitioning them to closed state</p>







Fix versions

Affects versions