Opened 16 years ago
Last modified 14 years ago
#2468 assigned enhancement
Allow for specifying scalebar alignment (within the scalebar image)
Reported by: | sdlime | Owned by: | sdlime |
---|---|---|---|
Priority: | normal | Milestone: | 5.6 release |
Component: | MapServer C Library | Version: | svn-trunk (development) |
Severity: | minor | Keywords: | scalebar, align |
Cc: | dmorissette, assefa, jmckenna |
Description
Currently, MapServer scalebars are fit to a fixed with specified by the size parameter in the scalebar object. Depending on how the math works the scalebar won't always fit the width perfectly (this is most often the case) so the code centers the scalebar in the allotted space. This can leave a good deal of white space around the graphic that doesn't look great depending on the interface design. So, it would be desirable to be able to align the scalebar within the image (right, left or center=default).
This ticket tracks the addition of a ALIGN keyword to the scalebar object.
Steve
Attachments (1)
Change History (11)
comment:1 by , 16 years ago
Status: | new → assigned |
---|
comment:2 by , 16 years ago
Type: | defect → enhancement |
---|
Added base code to trunk, need to document and update php...
Steve
comment:3 by , 16 years ago
Cc: | added |
---|
comment:4 by , 16 years ago
Documentation (by Jeff I think) and HISTORY.TXT have been updated. Just PHP remains.
Steve
comment:5 by , 16 years ago
Component: | MapServer C Library → MapScript-PHP |
---|
Changing component to PHP/MapScript. Should be a relatively easy addition.
Steve
comment:7 by , 16 years ago
Cc: | added |
---|
I have committed the required changes for PHP MapScript in r7598 (trunk). Adding Jeff to CC since that includes an update to the PHP MapScript README.
In my testing I was never able to produce a scalebar with enough whitespace around it to justify this change. However I did notice that with MS_ALIGN_RIGHT the 'km' label in my scalebar is always truncated. I'll attach an image showing the problem. Here is my scalebar definition:
SCALEBAR IMAGECOLOR 150 150 150 LABEL COLOR 0 0 0 SIZE SMALL END SIZE 150 5 COLOR 255 255 255 BACKGROUNDCOLOR 0 0 0 OUTLINECOLOR 0 0 0 UNITS kilometers INTERVALS 3 STATUS ON END
by , 16 years ago
Attachment: | scalebar_align.png added |
---|
Scalebar examples showing truncated 'km' label
comment:8 by , 16 years ago
Must be off by 1/2 a character or something like that. I typically use miles but have had no problem with the 'i' getting truncated. Will look...
Steve
comment:9 by , 16 years ago
Component: | MapScript-PHP → MapServer C Library |
---|---|
Milestone: | 5.2 release → 5.4 release |
Severity: | normal → minor |
Will try to fix rounding problems in 5.4. Reclassifying as minor since this is a lightly used option...
Steve
comment:10 by , 14 years ago
Working on the alignment issue (I hope in time for 5.6). Problem is that the math used was based on a approximation of truetype font width per character and that's not precise enough. Solution is to use actual string sizes via the functions found in maplabel.c and not rely on the direct GD calls. This should allow for exact placement AND make this much easier to port to use the rendering API.
Steve
Tasks:
Lot's of files but the changes are tiny in each.
Steve