[mapserver-users] JAVA Mapscript LayerObj issues
julien
julien.trolet at ifremer.fr
Thu Mar 5 01:49:37 PST 2009
Hi again,
Thanks for the help, I think I am close to the solution but it is still
not working as I get the following error :
java.lang.UnknownError: msGetBitmapFont(): GD library error. Invalid bitmap font. Must be one of tiny, small, medium, large or giant.
edu.umn.gis.mapscript.mapscriptJNI.mapObj_drawLabelCache(Native Method)
edu.umn.gis.mapscript.mapObj.drawLabelCache(mapObj.java:403)
I thougth I have to use the setSize funtction of the labelObj class to
set the BitmapFont as MS_BITMAP_FONT_SIZES.MS_LARGE. But it is not working.
Here is what I have done in my layerObj :
my_layer_item.setType(MS_LAYER_TYPE.MS_LAYER_POINT);
pointObj legendpoint = new pointObj(10,10,0,0);
lineObj legendline = new lineObj();
legendline.add(legendpoint);
shapeObj legendfeat = new
shapeObj(MS_SHAPE_TYPE.MS_SHAPE_POINT.swigValue());
legendfeat.add(legendline);
legendfeat.setText("Blablabla");
my_layer_item.addFeature(legendfeat);
classObj my_class = new classObj(my_layer_item.layer_object);
styleObj my_style = new styleObj(my_class);
my_style.setColor(new colorObj(0, 0, 0, -4));
my_style.setSize(50);
my_style.setSymbolname("kreis");
labelObj my_label = my_class.getLabel();
my_label.setType(MS_FONT_TYPE.MS_BITMAP);
my_label.setColor(new colorObj(0, 0, 0, -4));
my_class.getLabel().setPosition(MS_POSITIONS_ENUM.MS_UC.swigValue());
my_label.setSize(MS_BITMAP_FONT_SIZES.MS_LARGE.swigValue());
my_label.setForce(mapscriptConstants.MS_TRUE);
my_layer_item.setStyleName("Test");
my_layer_item.setProjection(4030);
my_layer_item.setStatus(true);
The corresponding mapfile is :
LAYER
NAME Test
TYPE POINT
STATUS DEFAULT
FEATURE
POINTS
10 10
END
TEXT "Blablabla"
END
CLASS
STYLE
SYMBOL "kreis"
SIZE 50
COLOR 0 0 0
END
LABEL
TYPE BITMAP
SIZE MEDIUM
COLOR 0 0 0
POSITION UC
END
END
END
Any helps is welcome.
Thanks in advance
Trolet Julien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20090305/627c9dd7/attachment.htm>
More information about the MapServer-users
mailing list