Re: [OpenMap Users] polygon with curved lines

From: Ruben DF <rdocasalf_at_yahoo.es>
Date: Fri, 22 May 2009 11:50:06 +0000 (GMT)

Hi,

I've already solved the problem. If there anybody with the same problem...At the end I didn't use OMAreaList, but I was creating the lines in my class (which extended OMPoly) with generate method from OMLine (according to my input angle parameter I was defining an arc (ArcCalc) or not). The other problem about the grabpoints (grabpoints were moved but the whole figure remained at the same position). What i did was to override setlocation method from OMPoly and update the new LatLong positions and generate again.

Thanks you all for your help :)

--- El jue, 21/5/09, Ruben DF <rdocasalf_at_yahoo.es> escribió:

De: Ruben DF <rdocasalf_at_yahoo.es>
Asunto: Re: [OpenMap Users] polygon with curved lines
Para: "Don Dietrick" <dietrick_at_bbn.com>
CC: "openmap-users Users" <openmap-users_at_bbn.com>
Fecha: jueves, 21 mayo, 2009 3:15

Hi,

I was modifying my code. Within generate() method, I created a for to iterate all my nodes. Depending on if I have an angle defined or not, I create a straight line o an arc line (with ArcCalc) and I create the shape with that lines (the code was extracted from OMLine and its way to crate the line (straight or curved)). Now, the shape is not null and render is able to paint it on the screen.

When I select the figure (a set of lines and curves joined themselves), the grabpoints appear on the nodes which were selected previously, but, if I try to move one of them, or move the whole figure, the grabpoints are moved, but the figure remains in the same position. I suppose that EditableOMPoly (since my class extends OMPoly class) is trying to get a shape projection which is a polyline or polygon, not a strange shape with straight and curved lines, isn't it?

Any idea? Thanks in advance

--- El mar, 19/5/09, Ruben DF <rdocasalf_at_yahoo.es> escribió:

De: Ruben DF <rdocasalf_at_yahoo.es>
Asunto: Re: [OpenMap Users] polygon with curved lines
Para: "Don Dietrick" <dietrick_at_bbn.com>
CC: "openmap-users Users" <openmap-users_at_bbn.com>
Fecha: martes, 19 mayo, 2009 12:41

Don,

As you told me, I created a new class which extends OMPoly and I overrided the generated() method. The code is the following:

public boolean generate(Projection proj) {

int i, j, npts;
        setShape(null);
        setNeedToRegenerate(true);

        if (proj == null) {
            Debug.message("omgraphic", "OMPoly: null projection in generate!");
            return false;
        }

        // answer the question now, saving calcuation for future
        // calculations. The set method forces the calculation for
        // the query.

        isGeometryClosed();

        switch (renderType) {

case RENDERTYPE_LATLON://rest of rendertype is not concerning
OMLine l;
            OMAreaList area = new OMAreaList();
            for (int k = 0; k < super.rawllpts.length-4; k=k+4) {
                l = new OMLine(super.rawllpts[k],super.rawllpts[k+1],super.rawllpts[k+2],super.rawllpts[k+3],OMLine.LINETYPE_STRAIGHT);
                area.add(l);
            }
            area.setConnectParts(false);

            setShape(area.getShape());
            setNeedToRegenerate(true);
            return true;

}

I'm trying to set the shape to my super OMPoly class. I commented rest of the code which is calling to projection library. In theory, render() method would detect that my shape is not null and would render my shape, but it does not appear any figure on the display (there is no failure neither) What am i doing wrong?. I dont know what i have to do with distance(x,y) method....

I was also trying to override render method in order to replace the g.drawPolyline(_x, _y, _x.length); method, programming a for iteration and calling to g.drawLine and g.drawArc according to my input parameter; the trouble here is that g.drawArc does not draw an arc between two given points (like ArcCalc.java)

Some code would be helpful :)

Thanks again in advance

--- El jue, 14/5/09, Don Dietrick <dietrick_at_bbn.com> escribió:

De: Don Dietrick <dietrick_at_bbn.com>
Asunto: Re: [OpenMap Users] polygon with curved lines
Para: "Ruben DF" <rdocasalf_at_yahoo.es>
CC: "openmap-users Users" <openmap-users_at_bbn.com>
Fecha: jueves, 14 mayo, 2009 1:41

Hi Ruben,

If you need your shape to be editable, I'd create a new class that extends OMPoly, and override the generate() method so that instead of calling the projection libraries to generate a straight polygon, it uses the coordinates and any other information to create the OMAreaList you are creating now, and then set the Shape object from the OMAreaList into the Shape object of your OMPoly superclass.  You'll probably have to override the distance(x, y) method too, so it forwards that call to the internal OMAreaList.

Then, the EditableOMPoly should be able to modify your OMAreaList.

- Don

On May 14, 2009, at 5:57 AM, Ruben DF wrote:

> Thanks again for answering,
>
> I need an OMPoly object which can be formed by lines straight and lines curves. Since I cannot get the OMLines from a OMPoly given (or OMAbstractLines) in order to modify some of them by curve lines, I was thinking about joining the OMLines and OMArc (Thanks Don, I didn't know that class) in an unique shape; OMAreaList give to me the solution (Thanks Don again ;)), however, I've seen that there's no an EditableOMAreaList either an EditableOMArc, so i cannot select that shapes in order to moving, modify the shape..etc, any idea?
>
> I was also trying with arcCalc, but i think i need a geocentric arc so I will use OMArc class.
>
> Ben, I dont know if this could slow down the performance, but I need to try it at least! :)
>
> --- El mié, 13/5/09, Don Dietrick <dietrick_at_bbn.com> escribió:
>
> De: Don Dietrick <dietrick_at_bbn.com>
> Asunto: Re: [OpenMap Users] polygon with curved lines
> Para: "Ruben DF" <rdocasalf_at_yahoo.es>
> CC: "openmap-users Users" <openmap-users_at_bbn.com>, "Ben Weisburd" <benw_at_ll.mit.edu>
> Fecha: miércoles, 13 mayo, 2009 5:51
>
> Hi Ruben,
>
> Ben has the right idea, but it also depends on if you want all the parts to be rendered the same.  You can use an OMAreaList to join different OMGraphics together into one shape.
>
> Do the lines between the points have geocentric meaning, or are you just trying to create a certain visual effect?  OMLines can have an ArcCalc object set on it to create a arc in pixel space between two points.  It has no geocentric meaning.   Might be easier to use than defining an OMArc's parameters to meet up at certain endpoints, but defining the OMArc will give you an edge that means something - a path that is a certain distance away from a lat/lon point.
>
> - Don
>
> On May 13, 2009, at 11:21 AM, Weisburd, Ben wrote:
>
> > Ruben,
> >
> > Creating multiple OMLines and OMCircles, and putting them in an OMGraphicList?
> > This might be slow if you have a large amount of shapes though.
> >
> > -Ben
> >
> >
> > From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com] On Behalf Of Ruben DF
> > Sent: Wednesday, May 13, 2009 11:01 AM
> > To: Don Dietrick
> > Cc: openmap-users_at_bbn.com
> > Subject: Re: [OpenMap Users] polygon with curved lines
> >
> > Thanks for answering,
> >
> > I was seeing OMSpline, however, i need that my object (let's call circuit, for example) has lines which are totally straight and lines curved. I think OMSpline is formed by curved lines always. Perhaps, OMSpline may be implemented in order to draw straight lines between a pair of points?
> >
> > My hipotetic object would be formed by n points, ok? among those points it could have a OMLine or an OMCircle (the arc which pass between those points, giving a specific radius)
> >
> > hope this helps to its understanding, thanks again in advance :)
> >
> > --- El mié, 13/5/09, Don Dietrick <dietrick_at_bbn.com> escribió:
> >
> > De: Don Dietrick <dietrick_at_bbn.com>
> > Asunto: Re: [OpenMap Users] polygon with curved lines
> > Para: "Ruben DF" <rdocasalf_at_yahoo.es>
> > CC: openmap-users_at_bbn.com
> > Fecha: miércoles, 13 mayo, 2009 3:21
> >
> > Hi Ruben,
> >
> > I think you are looking for the OMSpline class in OpenMap.
> >
> > Hope this helps,
> >
> > Don
> >
> > On May 13, 2009, at 6:17 AM, Ruben DF wrote:
> >
> > > Hi,
> > >
> > > I'm interested in drawing polygons with its lines curved. I know that in theory it is not possible since a polygon is based on lines straight but i need to be able to draw lines curved and straight. I've been reviewing OMPoly class, and i think i should modify this class to convert the straight lines in curved lines (the curved lines would be formed by OMCircle class, wouldn't be?)
> > >
> > > I'm lost...anyone can help me?
> > > Thanks in advance
> > >
> >
> >
>
> --
> [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 Fri May 22 2009 - 07:52:01 EDT

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