Opened 20 years ago
Closed 18 years ago
#760 closed enhancement (fixed)
[PATCH] improvements to client-side imagemap support
Reported by: | Owned by: | sdlime | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Command Line Utilties | Version: | 4.10 |
Severity: | minor | Keywords: | |
Cc: | bear@…, mapserver@… |
Description
The existing support for generating client-side imagemaps using mapserver is sloppily-coded in places, generates HTML which is inconsistent with the latest W3C guidelines, and is rather inflexible. Attached is a patch to clean up the code and output a bit and allow customization of the href, onMouseOver, onMouseOut, and name attributes generated.
Attachments (2)
Change History (12)
by , 20 years ago
comment:1 by , 20 years ago
The source file patch includes better comments describing the (improved) functionality of the imagemap output format; if the patch is accepted I plan on updating the wiki (http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?ImageMap) to add this documentation, too.
comment:2 by , 20 years ago
Cc: | added |
---|
Probably should consult the original author before applying. I've cc'd him. Have you compared the imagemap output format with the [shpxy...] tag that was recently added? I was after SVG output but several folks have been using it for imagemap production as well. Steve
comment:3 by , 20 years ago
Some documentation on the patch, extracted from the patched source file for reader's convenience. The defaults for the new options were all chosen for backward-compatibility; .map files without any of the new options produce output identical to that produced by the current code. --- Client-side imagemap support was originally written by Attila Csipa (http://prometheus.org.yu/me.php). C. Scott Ananian (http://cscott.net) cleaned up the code somewhat and made it more flexible: you can now customize the generated HREFs and create mouseover and mouseout attributes. Use IMAGETYPE imagemap to select this driver. The following FORMATOPTIONs are available. If any are set to the empty string the associated attribute will be suppressed. POLYHREF the href string to use for the <area> elements. use a %s to interpolate the area title. default: "javascript:Clicked('%s');" POLYMOUSEOVER the onMouseOver string to use for the <area> elements. use a %s to interpolate the area title. default: "" (ie the attribute is suppressed) POLYMOUSEOUT the onMouseOut string to use for the <area> elements. use a %s to interpolate the area title. default: "" (ie the attribute is suppressed) SYMBOLMOUSEOVER and SYMBOLMOUSEOUT are equivalent properties for <area> tags representing symbols, with the same defaults. MAPNAME the string which will be used in the name attribute of the <map> tag. There is no %s interpolation. default: "map1" SUPPRESS if "yes", then we will suppress area declarations with no title. default: "NO" For example, http://vevo.verifiedvoting.org/verifier contains this .map file fragment: OUTPUTFORMAT NAME imagemap DRIVER imagemap FORMATOPTION "POLYHREF=/verifier/map.php?state=%s" FORMATOPTION "SYMBOLHREF=#" FORMATOPTION "SUPPRESS=YES" FORMATOPTION "MAPNAME=map-48" FORMATOPTION "POLYMOUSEOUT=return nd();" FORMATOPTION "POLYMOUSEOVER=return overlib('%s');" END
comment:4 by , 20 years ago
Where can I find documentation on [shpxy...]? For the record, I'm not using template files at all in my application; all the HTML is generated by a separate set of PHP scripts and mapserver is just used as a backend to generate images and client-side imagemap fragments on demand. This is a valuable use which the [shpxy] technique (if I'm guessing at it correctly) does not allow. [Also, as far as I know, PHP/MapScript is still unsupported on Debian systems due to the system regex library issue. (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=138971 ; http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=156 ) ]
comment:5 by , 20 years ago
You're correct that [shpxy...] requires using templates. However, it imposes no structural limitations on output so is useful in a broad range of applications, plus you get access to any attribute present in a feature. It's not clear how that is addressed with the output filter since they are not layer specific. I'll need to read up more... You can retrieve imagemap fragments on demand using [shp...] and templates. There's nothing that prevents you from using MODE=NQUERY as part of a URL and limiting the templates to producing just an imagemap. I plan to add support for inline templates so there will be no need for external files which should make maintenance even easier (and configurable on- the-fly). Steve
comment:6 by , 20 years ago
Cc: | added |
---|
comment:7 by , 20 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Ok, I've applied the patch in 4.3. Looks like there are still a number of unused functions, and I get a few warnings about unused variables. Just in case someone wants to really clean up that source file... ;-) Steve
comment:8 by , 18 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
We still detected a bug in this implementation. The new code inserts an undesired comma in the beginning of the "coords" item everytime our map polygon has too many vertices. Following there is an exemple : <area onMouseOver="eval(getValor('47000'));" onMouseOut="return nd();" title="47000" shape="poly" coords=" 496,169, 495,170, 495,169, 496,169" /> <area onMouseOver="eval(getValor('47000'));" onMouseOut="return nd();" title="47000" shape="poly" coords=", 485,159, 486,160, 484,162, 483" /> This problem has no effect in Internet Explorer but Mozilla Firefox can't show it properly. I'm attaching a patch for it.
by , 18 years ago
Attachment: | mapimagemap.c added |
---|
Patch for undesired comma bug in coords element (see Additional Comment #8)
comment:9 by , 18 years ago
Status: | reopened → assigned |
---|---|
Version: | 4.2 → 4.10 |
Looks simple enough to get into 4.10... Steve
comment:10 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Vilson, please verify the supplied patch works ok. Marking as fixed unless I hear otherwise. Steve
Note:
See TracTickets
for help on using tickets.
Patch to improve imagemap support.