Re: [OpenMap Users] AreaShapeLayer question

From: Don Dietrick <dietrick_at_bbn.com>
Date: Tue, 23 Jan 2007 14:35:07 -0500

Hi Chris,






On Jan 23, 2007, at 1:21 PM, Chris Hopkins wrote:

>
> Thanks Don. I now get back an array of OMGraphicList objects, one list
> for each defined area. Now, I have two questions:
>
> 1. How do I relate a particular OMGraphicList with one of the
> PoliticalArea objects that I can access via id (e.g. "IRQ-AAN")?


You should be able to call:

OMGraphic.getAttribute(ShapeConstants.SHAPE_INDEX_ATTRIBUTE);

which will return an Integer that is the index for that shape. This
number will correspond to the row number of attributes in the
DbfTableModel.


>
> 2. Once I'm able to determine the mapping from id to OMGraphicList,
> what's the best way to combine the shapes together to form a new shape
> and then only draw the outline of that new shape?

There really isn't anything in OpenMap that will do this, but you
should be able to retrieve the coordinates of the shapes from the
OMGraphics. For OMPolys, calling getLatLonArray() will return the
lat/lon in *radians*. You can covert them to decimal degrees if you
like, but you probably want to make a copy of the array first. With
the coordinates, you have some options. You might want to check the
JTS part of the JUMP project (http://www.jump-project.org/project.php?
PID=JTS&SID=OVER) to do geometry operations. You could also iterate
over the coordinates looking for common points in the opposite
direction, and create a new coordinate array based on those findings,
copying the unique coordinates into the new array.

Hope this helps,

- Don




>
> Thanks,
> Chris
>
> p.s. Yes, this is the same issue that Karen Harper emailed the openmap
> list about. Didn't realize she had done that. :)
>
> -----Original Message-----
> From: Don Dietrick [mailto:dietrick_at_bbn.com]
> Sent: Tuesday, January 23, 2007 12:23 PM
> To: Chris Hopkins
> Cc: openmap-users_at_bbn.com
> Subject: Re: [OpenMap Users] AreaShapeLayer question
>
> Hi Chris,
>
> You're probably trying to get the geometries before they are loaded.
> You can call getAreas().getGraphics() on the layer to get the
> AreaHandler to load the geometries. That's usually done when the
> layer is added to the map for the first time.
>
> - Don
>
> On Jan 23, 2007, at 7:14 AM, Chris Hopkins wrote:
>
>> Hi all -
>>
>> We are using an AreaShapeLayer to display provinces in Iraq. We
>> generated a shapefile using ArcView and, using the generated .dbf
>> file, we can get mouseover information about the name of the
>> province, etc by setting up the appropriate properties to drive the
>> AreaShapeLayer.
>>
>> Now, we are trying to do some computation about those areas.
>> Specifically, we want to be able to create a new region based on
>> the aggregation of several provinces. Using the United States as an
>> example, we'd like to be able to outline New England by combining
>> the shapes of Maine, New Hampshire, Vermont, Massachusetts and
>> Connecticut. Once we have a combined shape, we want to draw that as
>> an outlined polygon.
>>
>> We are trying to access the OMGeometryList objects that are part of
>> the PoliticalArea objects but the lists are empty when we try to do
>> that. Perhaps we are trying to access them too early in the
>> pipeline? What we have tried to do is extend the AreaShapeLayer
>> class and override something like paint() and access the
>> PoliticalArea objects using findPoliticalArea of the AreaHandler
>> class.
>>
>> Is there an easier way to do this (or rather a way that works)? :)
>>
>> Thanks
>> Chris
>>
>
>
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Don Dietrick, dietrick_at_bbn.com
> BBN Technologies, Cambridge, MA
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>
> --
> [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"]



=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick_at_bbn.com
BBN Technologies, Cambridge, MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


--
[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 Jan 23 2007 - 14:36:19 EST

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