Hi thanks for the info Don,
Can you tell me where that code should go ? I'm confused by the concept of
OMGraphics, I thought there was an OMGraphic object per line or point etc..
But my code doesn’t even detect a single OMGraphic..
Right after loading the shapefile I am using this
if (shapeLayer.getList()!= null && !shapeLayer.getList().isEmpty()) {
System.out.println("getting list elements
"+shapeLayer.getList().size());
OMGraphic elem = (OMGraphic)
shapeLayer.getList().getOMGraphicAt(0);
elem.putAttribute(OMGraphicConstants.LABEL, new OMTextLabeler
("street name "));
System.out.println(elem.toString());
}
However the shapeLayer.getList() returns null everytime so it’s a bit
baffling to me.
Also can you tell me if its possible to override the line painting code,
what I want to do is first check the type of road that is being painted,
according to a field in my dbf. And then give it a specific thickness/color
etc...
Thankyou.
-----Original Message-----
From: Don Dietrick [mailto:dietrick_at_bbn.com]
Sent: Wednesday, March 01, 2006 10:55 PM
To: Dave Brown
Cc: 'openmap questions'
Subject: Re: [OpenMap Users] Labelling
Hi Dave,
On Feb 28, 2006, at 4:54 AM, Dave Brown wrote:
> Can anyone explain to me the method I would use to render Labels on a
> street shapefile I have.
The easiest thing to do now is to set an OMTextLabeler as an attribute on
each OMGraphic:
OMGraphic.putAttribute(OMGraphicConstants.LABEL, new OMTextLabeler ("street
name"));
The labels will be rendered automatically. If you want special behavior,
like scale filtering, you could substitute an extended OMTextLabeler that
will only paint if the scale is a certain value, or something like that.
The order of the rows in the DBF match the order of the shapes out of the
shape file. If you use the ShapeLayer, you can ask the OMGraphics for their
index (row number) in the app object. There's an off by one thing going on
here, though, so be careful. I keep forgetting which one starts at 1 and
which starts at 0. I think the index numbers in the OMGraphics start at 1.
>
> There is a specific column in the DBF which I wish to use as the
> label.
>
> Also, 'while I'm here.. ' Re' Routing.. How can openmap take into
> consideration the direction of a particular road, whether its oneway
> or not
> when route calculating ? The direction indicator in my case also
> comes
> from the accompanying DBF for the shapefile.
I'll have to check on this, but I can't see anything in the code that
handles one way streets.
- Don
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.1/271 - Release Date: 28/02/2006
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.1/271 - Release Date: 28/02/2006
--
[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 Thu Mar 02 2006 - 09:59:50 EST