Just to let people know, I found the solution.

I changed :
classObj my_class = new classObj(my_layer_item.layer_object);
styleObj my_style = new styleObj(my_class);

By :
classObj my_class =  my_layer_item.layer_object.getClass(0);
styleObj my_style = my_layer_item.layer_object.getClass(0).getStyle(0);


julien wrote:
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
------------------------------------------------------------------------

_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to