Re: [OpenMap Users] Need advice on Layer to use to render grid of polygons

From: Don Dietrick <dietrick_at_bbn.com>
Date: Thu, 15 Jul 2004 07:03:59 -0700

I tried your layer, without making it static, and it worked fine.

- Don

On Jul 13, 2004, at 4:24 PM, serrotam wrote:

> Thanks a lot. This works great. For posterity I'm
> attaching below sample GridDataLayer that I used for
> testing. Welcome any other comments you or others may
> have, I can there's a better way to do this.
>
> However, I am getting a java.lang.StackOverflowError
> when I create an OMGridData.Int that is 51x51 in size
> (2601 values). Any ideas on how to correct that?
> TIA
>
> Here's my sample
>
> public static class GridLayer extends Layer {
> private OMGraphicList omgraphics;
> public GridLayer() {
> omgraphics = new OMGraphicList();
> createGrid(omgraphics);
> }
>
> private OMGraphicList createGrid(OMGraphicList
> graphics)
> {
> int[][] data = new int[10][10];
>
> for (int i=0; i<10; i++) {
> for (int j = 0; j < 10; j++) {
> data[i][j] = 0xCCFFFF00;
> }
> }
> OMGridData.Int gridData = new
> OMGridData.Int(data);
>
> float vRes = (42.0f - 35.5f)/10.0f;
> float hRes = (120.5f - 71.0f)/10.0f;
>
> OMGrid omGrid = new OMGrid(35.5f, -120.5f,
> vRes, hRes, gridData);
> SimpleColorGenerator gen = new
> SimpleColorGenerator();
> omGrid.setGenerator(gen);
>
> graphics.addOMGraphic(omGrid);
>
> return graphics;
> }
>
> public void paint(java.awt.Graphics g) {
> omgraphics.render(g);
> }
>
> public void projectionChanged(ProjectionEvent e) {
> omgraphics.project(e.getProjection(), true);
> repaint();
> }
> }
>
>
>
> --- Don Dietrick <dietrick_at_bbn.com> wrote:
>> There's an OMGrid object that handles this
>> situation. You create one
>> where the grid should be overlayed, and give it an
>> OMGridGenerator that
>> creates OMGraphics from the data values within the
>> grid. There are
>> example OMGridGenerators in the package.
>>
>> I think you might want to check out the version from
>> CVS, I did some
>> work this year on OMGrids that might make it easier
>> to use them for
>> your data values. CVS instructions are on the
>> website download page.
>>
>> There is more information about OMGrids in the
>> javadocs.
>>
>> Regards,
>>
>> Don
>>
>> On Jul 8, 2004, at 5:02 PM, serrotam wrote:
>>
>>>
>>> I would appreciate advice on how to approach the
>>> rendering of a (2D)grid of values that need to be
>>> rendered as an overlay on a lat-lon map.
>>>
>>> grid of values can be as large a 2000x2000 where
>>> each value will correspond to a colored square of
>> a
>>> few kilometers each.
>>> ____________________________
>>> | red | yellow | green | ...
>>>
>>> | red | green | yellow | ...
>>> | yellow | red | green | ...
>>> | : | : | : | ...
>>>
>>> Which is the most efficient way of creating this
>>> layer? I.e. with an OMRaster or OMPolygons?
>>>
>>> What are good examples for setting OMRaster
>>> projections? these are still a bit confusing to
>> me.
>>> appreciate any hints.
>>> TIA
>>>
>>>
>>>
>>> __________________________________
>>> Do you Yahoo!?
>>> New and Improved Yahoo! Mail - Send 10MB messages!
>>> http://promotions.yahoo.com/new_mail
>>> --
>>> [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
>> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>
>>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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 Thu Jul 15 2004 - 10:04:12 EDT

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