Labels disappearing

View: New views
3 Messages — Rating Filter:   Alert me  

Labels disappearing

by JayDub :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all, I override the SHP layer to add OMTextLabeler's. I see them when zooming but they disappear after the layer is fully painted.

@Override
    public synchronized OMGraphicList prepare() {
        OMGraphicList graphicList = super.prepare();
        for(int i = 0; i < graphicList.size(); i++){
            OMGraphic graphic = graphicList.getOMGraphicAt(i);
            OMTextLabeler label = new OMTextLabeler("SOME TEXT",OMText.JUSTIFY_RIGHT);
            graphic.putAttribute(OMGraphicConstants.LABEL, label);
        }
        return graphicList;
    }

Re: Labels disappearing

by JayDub :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Any one help me with this?

JayDub wrote:
Hi all, I override the SHP layer to add OMTextLabeler's. I see them when zooming but they disappear after the layer is fully painted.

@Override
    public synchronized OMGraphicList prepare() {
        OMGraphicList graphicList = super.prepare();
        for(int i = 0; i < graphicList.size(); i++){
            OMGraphic graphic = graphicList.getOMGraphicAt(i);
            OMTextLabeler label = new OMTextLabeler("SOME TEXT",OMText.JUSTIFY_RIGHT);
            graphic.putAttribute(OMGraphicConstants.LABEL, label);
        }
        return graphicList;
    }

Re: Labels disappearing

by Don Dietrick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi JayDub,

Do you call generate(Projection) on the OMGraphics after you add the  
OMTextLabelers, but before you paint?  That should happen in the  
method below before you return the list:

On Sep 14, 2009, at 9:32 AM, JayDub wrote:

>
> Any one help me with this?
>
>
> JayDub wrote:
>>
>> Hi all, I override the SHP layer to add OMTextLabeler's. I see them  
>> when
>> zooming but they disappear after the layer is fully painted.
>>
>> @Override
>>    public synchronized OMGraphicList prepare() {
>>        OMGraphicList graphicList = super.prepare();

Projection proj = getProjection();

>>        for(int i = 0; i < graphicList.size(); i++){
>>            OMGraphic graphic = graphicList.getOMGraphicAt(i);
>>            OMTextLabeler label = new OMTextLabeler("SOME
>> TEXT",OMText.JUSTIFY_RIGHT);
>>            graphic.putAttribute(OMGraphicConstants.LABEL, label);

graphic.generate(proj);


>>        }
>>        return graphicList;
>>    }
>>
>>

Otherwise, the labels never get told where to render themselves.

-Don

--
[To unsubscribe to this list send an email to "majdart@..."
with the following text in the BODY of the message "unsubscribe openmap-users"]