# RE: [OpenMap Users] Creating a shape from intersecting circles?

From: Butler, Jason <Jason.Butler_at_dsto.defence.gov.au>
Date: Thu, 3 Aug 2006 10:07:14 +1000

Hi,

Your first idea can be used to do what you want. I think the steps are
1. Create the circles as OMCircles.
2. Project them onto the map. i.e. myOMCircle.generate(myProjection);
This generates the shape in screen coordinates so the shapes of the circles will change, based upon the projection used.
3. Extract the Areas from them. java.awt.geom.Area myArea = new Area(myOMCircle.getShape());
4. Use Area to create the intersection. MyArea.intersect(myOtherArea)
5. Paint the final area into the screen in the paint section of your Layer. ((Graphics2D)g).draw(myArea);

Hope this helps,

Jason.

-----Original Message-----
From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com] On Behalf Of Oystein E. Thorvaldsen
Sent: Wednesday, 2 August 2006 7:32 AM
To: openmap-users_at_bbn.com
Subject: [OpenMap Users] Creating a shape from intersecting circles?

Hi,

I'm trying to calculate and display a geographic region defined by the intersection of a number of overlapping circles. (See http://folk.ntnu.no/oysteine/om/venn.jpg, the red area) I know the coordinates of the center of all the circles, and their radi. How do I best go about doing this in OpenMap?

I've perused the list archives, and API and have some possible starting points. I would appreciate feedback on the feasibility of these, and which one is best suited. Of course I'm open to entirely different ways of doing this.

1) Create the circles as OMCircles. Using getShape to extract the Shape of every OMCircle and create Areas using Area(Shape). Intersecting the created Areas to obtain my desired region in the form of an Area. Using getPathIterator(),possibly with flattening, to create a GeneralPath and create an OMPoly (or OMGraphicsList?) from it. I know this would be costly performance wise, but that is not an issue for me.

One post (
http://openmap.bbn.com/mailArchives/openmap-users/2005-12/4466.html ) mentioned the need for Projection.forward() in a similar situation. In http://openmap.bbn.com/mailArchives/openmap-users/2004-08/3276.html
.forward() is not mentioned. And this situation also is similar to my problem. Is the usage of Graphics2D straightforward, or do I have to use forward(), and take screen resolution etc into account?

2) The .geo-package seems to deal with this type of functionality, but I'm unable to find the specific functions I need. Additionally the classes in the package are somewhat less well documented than the rest of OpenMap.

3) Try to do the intersection algebraically and store the resulting region in some kind of data structure containing the vertices and arcs between them. Then create an OMPoly or OMGraphicsList based on the data structure. This would still involve calculating the geographical coordinates of the vertices somehow. (If anyone could point me to an elegant way of doing the intersection algebraically I would appreciate it.)

Regards,
Øystein E. Thorvaldsen

```--
[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"]
--
[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 Wed Aug 02 2006 - 20:47:57 EDT

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