No announcement yet.

Only one SurfacePolygon per layer

  • Filter
  • Time
  • Show
Clear All
new posts

  • Only one SurfacePolygon per layer

    I'm new to WWJ, but have been developing in Java for about 6 years at this point (Just for some background).

    I've been following and modifying example code to fit my needs. Recently when I was experimenting the "" class, I wanted to see what happened when the shapes were changed to SurfacePolygon classes instead of just Polygon.

    I found that only the last SurfacePolygon added to the RenderableLayer would be displayed, whether added one by one or all at once. Is this the desired behavior? I have a project in mind that might use about 10,000 SurfacePolygons at once, and it would seem rather inefficient to create a new layer for each polygon!

    I also tried to use the SurfacePolygons (notice the s) class, but I need to be able to display many different colors, and the render had everything as grey.

  • #2
    Never mind! It looks like I misunderstood how the SurfacePolygon class worked. I was using a loop and overwriting a list of Positions each time. The calculated positions in the loop were used to create a polygon and were then destroyed on the next iteration. It looks like the SurfacePolygon might have been referencing the original object when I cleared the points away. Hence, only the last polygon was rendered. The same was true of the ShapeAttributes given to each SurfacePolygon.


    • #3
      It is strange that you are among very few persons who post questions and comments about WWJ on this forum.