[OpenMap Users] Labelling EsriLayer

From: JayDub <justcallmejay_at_gmail.com>
Date: Tue, 2 Jun 2009 03:51:47 -0700 (PDT)

I notice that rules don't work for EsriLayers so I was trying to write some
code to cycle through the graphic listing and create OMText objects and add
them to the map. A few hickups. I'm not sure where to fetch the projection
from in order to supply the generate method for the OMText object. Second,
I'm not sure how to get the x,y coords from the EsriGraphic. See the code
snippet below.

What I've done below is the following....
I have an EnhancedEsriLayer... it extends EsriLayer and just adds one or
two new methods so far. (getIDColumn being one that just returns the column
number for the ID field in the dbf model).
I get the graphic list from the layer and I add the OMText to that list.
Then I fetch the map bean and call omtext.generate(mapBean.getProjection);
Nothing shows up on the map.

    public static void labelLayer(EnhancedEsriLayer l) {
        EsriGraphicList list = l.getEsriGraphicList();
        for (int i = 0; i < list.size(); i++) {
            OMGraphic graphic = list.getOMGraphicAt(i);
            int row = getDbfRowNumber(graphic);
            ArrayList record = getDbfRecord(l,row); // fetches the dbf
record from l's model
            if(record != null){
                String label = record.get(l.getIDColumn()).toString();
                OMText omLabel = new OMText();
                l.getList().addOMGraphic(omLabel);
                  ModuleManager mm = ModuleManager.getManager();
                if(mm.isLoaded(MapModule.MODULE_NAME)){
                    MapSupport mapSupport = (MapSupport)
mm.getModule(MapModule.MODULE_NAME).getObject();
                    MapBean map = mapSupport.getMap();
                    omLabel.generate(map.getProjection());
                }
            }
        }
    }
-- 
View this message in context: http://www.nabble.com/Labelling-EsriLayer-tp23830257p23830257.html
Sent from the OpenMap mailing list archive at Nabble.com.
--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Jun 02 2009 - 06:52:06 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:09 EDT