[mapserver-dev] Correct usage of SWIG-MapScript-SYMBOL generation

Stephan Holl stephan.holl at intevation.de
Fri May 20 09:11:19 EDT 2011


Hello Mapserver-devs,

we try to add symbols to a SYMBOLSET with Java (1.6.2 on Windows)
MapScript dynamically (with MS 6.0.0-rc2 with MS4W) with this code:
-------------------
import java.io.IOException;
import java.io.File;

import edu.umn.gis.mapscript.mapObj;
import edu.umn.gis.mapscript.layerObj;
import edu.umn.gis.mapscript.classObj;
import edu.umn.gis.mapscript.styleObj;
import edu.umn.gis.mapscript.symbolObj;
import edu.umn.gis.mapscript.symbolSetObj;
import edu.umn.gis.mapscript.MS_SYMBOL_TYPE;

public class CharTest {

    /**
     * Entrypoint for the application.
     */
    public static void main(String[] args) {
       mapObj map = new mapObj("template.map");
       layerObj layer = new layerObj(map);
       classObj co = new classObj(layer);

       symbolSetObj symbolSet = map.getSymbolset();
       symbolObj symbol = symbolSet.getSymbolByName("testname");
       symbol.setType(MS_SYMBOL_TYPE.MS_SYMBOL_TRUETYPE.swigValue());
       symbol.setFont("Arial-alike");
       symbol.setAntialias(1);
       // see
       //
       http://mapserver.org/mapfile/symbology/construction.html#symbols-of-type-truetype
       symbol.setCharacter("");

       symbolSet.save("symbols.sym");
    }
}
-------------------

The resulting symbol is
  SYMBOL
    NAME "testname"
    TYPE TRUETYPE
  END

There is no error raising up with the above program, but the result
seems odd. At least FONT and CHARACTER-keywords should be set within
the exported symbolset.

Btw. the keyword SYMBOLSET at the beginning is also missing (see [1]
for a separate issue).

Does anybody can give some advice how to use the
SWIG-based MapScript-API to construct symbolsets correctly.

Best 
	Stephan

[1] http://trac.osgeo.org/mapserver/ticket/3885
-- 
Stephan Holl <stephan.holl at intevation.de> | Tel.: +49 (0)541-33 508 3663
Intevation GmbH, Neuer Graben 17, 49074 OS  |  AG Osnabrück - HR B 18998
Geschäftsführer:  Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20110520/3a9abdef/signature.bin


More information about the mapserver-dev mailing list