area in openmap

26 views
Skip to first unread message

Geoffrey Koo

unread,
Sep 23, 2021, 8:06:21 PM9/23/21
to openmap-users
How do I highlight in area ?  How do I  show areas in  different  colors ?

Don Dietrick

unread,
Sep 23, 2021, 9:34:01 PM9/23/21
to Geoffrey Koo, openmap-users
All OMGraphics have a bunch of color settings. There are methods for OMGraphics that let you set them as java.awt.Color or OMColor objects (OMColor extends Color).

You can set the highlight color on an OMGraphic, and that edge color will become the color when omGraphic.setSelected(true) is called. You can revert the color to the line color with omGraphic.setSelected(false).

In OpenMap 5.1.15, the com.bbn.openmap.layer.DemoLayer has a bunch of examples of this. That layer has been moved to com.bbn.openmap.layer.test.DemoLayer in OpenMap 6. Version 6 is in the git repo.

Hope this helps,

Don



> On Sep 23, 2021, at 8:06 PM, Geoffrey Koo <wxc...@163.com> wrote:
>
> How do I highlight in area ? How do I show areas in different colors ?
>
> --
> You received this message because you are subscribed to the Google Groups "openmap-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to openmap-user...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/openmap-users/98aee83f-cb81-459d-b5f3-1419ca78920cn%40googlegroups.com.

Message has been deleted

Don Dietrick

unread,
Nov 2, 2021, 9:42:40 AM11/2/21
to Geoffrey Koo, openmap-users
Hello,

You can override the select() and deselect() methods on an OMGraphic to change what happens to the OMGraphic when setSelected(true) gets called, including changing the fill paint, matting, and stroke settings.

If you are using an standard OpenMap layer, you might have to override the method that creates the OMGraphics for it, so that it uses your new version of the OMGraphic with the overridden select()/deselect() methods.

Hope this helps,

Don

> On Nov 1, 2021, at 3:32 AM, Geoffrey Koo <wxc...@163.com> wrote:
>
> Sorry,I tried to call omGraphic.setSelected(true),But It is not the effect I want.I want to highlight an area like the image on the right.<1635750852(1).png>
> To view this discussion on the web visit https://groups.google.com/d/msgid/openmap-users/186882e5-a036-46c2-80ab-f51d3ed9bbd3n%40googlegroups.com.
> <1635750852(1).png>

Reply all
Reply to author
Forward
0 new messages