RE: [OpenMap Users] any tips : Performance

From: Simon Bowen <sbowen@gammaprojects.com>
Date: Thu May 06 2004 - 12:33:13 EDT

Thanks Martin for your reply,
 
I managed to try forwardPloy and forwardRaw, (I wasn't using RADIANS
before!) these speed things up a little but again the results aren't as
presise as forward()
 
They biggest improvement I've found so far is to not to use the Area object,
callers of the function don't always need the functionality provided by
Area, so now the callers of this method must create the Area object as
needed.
 
This change basically speeds the method up by a factor of 30!
 
To those that are interested this is code from the layer.mif package
(OMSubtraction.java), I am working a a few performance tweaks to speed to
the rendering etc.. of MapInfo MIF layers... When I'm done I'll post all the
updated source from the mif package here.
 
===snip
Polygon getArea(Projection proj)
{
            Point pt = new Point();
            Polygon poly = new Polygon();
            for (int i = 0; i < len; i++)
            {
                proj.forward(lat[i], lon[i], pt);
                x[i] = pt.x;
                y[i] = pt.y;
                poly.addPoint(x[i], y[i]);
            }
            return poly;
}
 
-----Original Message-----
From: Chapman, Martin [mailto:MChapman@sanz.com]
Sent: 06 May 2004 16:10
To: Simon Bowen; openmap-users@bbn.com
Subject: RE: [OpenMap Users] any tips : Performance
 
Try proj.forwardPoly()...
 
Martin
-----Original Message-----
From: Simon Bowen [mailto:sbowen@gammaprojects.com]
Sent: Thursday, May 06, 2004 4:49 AM
To: 'openmap-users@bbn.com'
Subject: [OpenMap Users] any tips : Performance
Sorry if this a bit of a stupid question....
 
Can anyone give me any pointers in how to speed up the code below.
The 2 main bottle necks are proj.forward(lat[i],lon[i],pt); and return new
Area(new Polygon(x,y,len));
 
 
Would proj.forwardRaw speed things up? I tried to use proj.forwardRaw but
the results were a bit strange?
 
Area getArea(Projection proj)
{
          Point pt=new Point();
          for(int i=0;i<len;i++) {
            proj.forward(lat[i],lon[i],pt);
            x[i]=pt.x;
            y[i]=pt.y;
          }
          return new Area(new Polygon(x,y,len));
}
 
Thanks
 
Simon

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu May 6 12:33:16 2004

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:38 EDT