MapServer / MapServer

Source code of the MapServer project. Please submit pull requests to the 'main' branch.
https://mapserver.org
Other
1.02k stars 373 forks source link

PIXMAP Symbols do not appear in mapscript java #1058

Closed mapserver-bot closed 12 years ago

mapserver-bot commented 12 years ago

Reporter: mapserver@geochem.de Date: 2004/11/12 - 19:06 Trac URL: http://trac.osgeo.org/mapserver/ticket/1058

I found a bug in the handling of PIXMAP-Symbols in JAVA-Mapscript. The image do
not appear if i include the symbolname in my style section.
The output is completely blank.

here i my symbol-File

Symbol
    Name 'logo'
    Type PIXMAP
    Image 'recenter.png'
END
mapserver-bot commented 12 years ago

Author: sgillies@frii.com Date: 2004/11/13 - 18:26

There is an important difference between the CGI mapserver and mapscript.

In a mapfile you can set a STYLE to reference a SYMBOL by name.  In mapscript,
a style has to reference a symbol by the index of the symbol within the 
map's symbolset.

You must do something like this

    style = new styleObj(class)               # adds a style
    logo_index = map.symbolset.index('logo')  # finds index of logo symbol
    style.setSymbol(logo_index)

Try this with the mapserver 4.4 beta2.

Also I noticed one more thing in your program -- do not set map height and
width seperately.  You should use the new setSize() method:

    map.setSize(width, height)

Please confirm.
mapserver-bot commented 12 years ago

Author: mapserver@geochem.de Date: 2004/11/13 - 19:35

I modified my java application according to your hint and the mapscript docs.
See the attached file. Sadly i still get back a blank image. I tried this script
with the latest CVS version. Anything else to do?
mapserver-bot commented 12 years ago

Author: mapserver@geochem.de Date: 2004/11/13 - 19:40

Sean,
i found my mistake. I forget to add the line:
map.setSymbolset(symbolset);

Seams that i have to read the docs more exacty. Now it works.
Nicol
mapserver-bot commented 12 years ago

Author: sgillies@frii.com Date: 2004/11/14 - 01:55

OK, closing up the bug.
mapserver-bot commented 12 years ago

attachment http://trac.osgeo.org/mapserver/attachment/ticket/1058/symbols_point.java :

   Java-Application Script which shows the problem