# [OpenMap Users] Re: OMLine or OMPoly with segments

From: Don Dietrick <dietrick_at_bbn.com>
Date: Thu, 15 Nov 2007 17:37:57 -0500

I just wanted to make sure that you know that ArcCalc doesn't give you
something real (or rather, representative) - it calculates a path in x,y
pixel space between two points. We've used it to create mutilple paths
between points on a map that don't lie on top of one another, where
drawing a relationship between two points was important, not the path
between them. ArcCalc shouldn't be confused with GreatCircle, which
creates a Great Circle line between two coordinates. An OMLine with a
LineType.GREAT_CIRCLE does the same thing.

That said, you can do what you've proposed, but it's a lot of extra
calculations - you can simply modify/extend ArcCalc to render between
those points for you, they are already pixel values.

If the Great Circle path is important to you, then I would extend OMLine
and override that render method. You should be able to iterate through
the Shape object's points and draw directly into the Graphics object
with the multiple colors you want.

- Don

P T wrote:
>
>
> Hi All,
>
>
>
> I came up with the following two methods to draw N number of arcs
> given start point, end point, and arc angle. Can you let me know, if
> this is reasonable way to approach this problem or is there a simpler
> procedure.
>
>
>
> Problem: Get N number of equal length arcs given start point, end
> point and arc angle between these two points.
>
>
>
> Approach 1:
>
> a) project lat, lon coordinates of start and end points
> into xy space using the forward method in projection class.
>
> b) Create an ArcCalc object from the given arc angle
>
> c) Generate the points for the curved line using generate method
> of ArcCalc.
>
> d) Get the array of x and y points from the ArcCalc
>
> e) Inverse the x and y into lat, lon coordinates
>
> f) Draw OMLines based on these inverted points
>
>
>
> Questions:
>
> a) What if the number of points generated is less than the number
> of required arcs?
>
> b) If there are more points than the required number of arcs,
> skipping some points generate a choppy curve. Also this may not
> generate equal length arcs.
>
>
>
> Code Snippet:
>
>
> Point p1 = this.projection.forward(x1, y1);
>
> Point p2 = this.projection.forward(x2, y2);
>
> arcAngle.generate(p1.x,p1.y,p2.x,p2.y);
>
> int[] xPts = arcAngle.getXPoints();
>
> int[] yPts = arcAngle.getYPoints();
>
>
>
>
> -------------------------------------------------------
>
>
>
> Approach 2:
>
> a) Convert the lat/lon from degrees to radians
>
> b) Compue the points on the Great Circle using
> GreatCircle.great_circle(x1,y1,x2,y2,N,true)
>
> c) Draw OMLine based on the points.
>
>
>
> Questions:
>
> a) How do we use the arc angle in this case?
>
> b) The OMLines go through the date line (e.g. if I use New York
> and Tokyo as starting and ending points, the arcs go from New York to
> some point near Alaska and then to Tokyo instead of direct curve from
> New York to Tokyo)
>
>
>
> Your help is highly appreciated!
>
> Prakash
>
> ------------------------------------------------------------------------
>
>
>
> Hi,
>
> I can draw an arc between two points using OMLine with starting
> and ending lat/lons and ArcCalc.
> However, I want to segment this arc into several arcs so that I
> can manipulate these individual
> segments (e.g. change color, add arrow etc). I can use OMPoly but
> looks like it requires knowledge
> of lat/lons for intermediate points. How can I draw an arc with
> multiple segments by
> specifying the end points and overall line arc angle only (not
> individual segments arc angles)?
>
> Prakash
>
>
> ------------------------------------------------------------------------
> Climb to the top of the charts! Play Star Shuffle: the word
> scramble challenge with star power. Play Now!
>
>
>
> ------------------------------------------------------------------------
> Climb to the top of the charts! Play Star Shuffle: the word scramble
> challenge with star power. Play Now!
```--