Results 1 to 5 of 5

Thread: Custom SurfaceShape

  1. #1

    Default Custom SurfaceShape

    This is just asking for some design help to determine the best way of implementing my own surface shape. I have a shape, such as an oval, that needs to have squares placed at various locations on its border. I want to be able to move the surface shape by selecting either the oval or any of the squares.

    Can I mash an oval and quad surface shapes together to gain this functionality, or do I need to roll my own custom shape by implementing a base surface shape class?

    Any suggestions would be extremely helpful.

    Thanks in advance,

    Zak

  2. #2
    WWJ Consultant patmurris's Avatar
    Join Date
    Jun 2005
    Location
    Saint-Paul de Vence, Alpes Maritimes, France
    Posts
    3,382

    Default

    If all you need are 'regular' shapes that can be handled with the actual surface shape collection, then the best approach is probably to create a prerenderable/renderable 'compounded' object that will internally use one ellipse and four quads.

    What you should care about is to make sure all those surface shapes are handled by the same renderer, so that they will share the same tile pyramid. However, you could as well just have those shapes in a surface shape layer which will pipe them all to the same renderer.

    How many of those ovals are you planning to display?
    My World Wind Java Blog & WW.net Plugins page

  3. #3

    Default

    The number of ovals will be undetermined based on the users needs, as well as the attached quads.

    Also, when you say "regular" shapes, what exactly do you mean? Do you mean the set of shapes that are currently supported in WWJ ?

    Thanks for the help.

  4. #4

    Default

    Also, I have tried to wrap the ellipse and quads into a class that implements SurfaceShape, and add it to a SurfaceShapeLayer.
    When I render the shapes, prerender() or render() never get called, but renderToRegion() seems to be the only one that gets executed. Can you explain how this process works ?

    Thanks.

  5. #5
    WWJ Consultant patmurris's Avatar
    Join Date
    Jun 2005
    Location
    Saint-Paul de Vence, Alpes Maritimes, France
    Posts
    3,382

    Default

    Surface shapes are sent to a surface object renderer by the surface shape layer. Pre render and render will not be called in that situation. However, the surface object renderer will call getLastModifiedTime(), getSectors() and renderToRegion() on each surface object it has to deal with.

    The simplest path is to implement pre render and render and just pipe the shapes that make up your custom object to a tiled surface object renderer of your choice. In that situation you create a plain renderable. To share the same renderer among several of these compounded objects, implement a setRenderer() so that your application can direct them to one single renderer instance.

    You can also implement surface object. But that would be a little more involved as you would have to call the surface object interface on each of your shapes and 'combine' the results. In fact it is probably easy too.

    If you have a recent build, have a look at the experimental section examples.SurfaceObjects.java - there is a CustomMarker in there you may want to look at. You can also look at experimental...render.SurfaceIcon and SurfaceText.

    PS: by regular shapes i meant those actually available in the SDK yes.
    Last edited by patmurris; 05-07-2009 at 09:45 PM.
    My World Wind Java Blog & WW.net Plugins page

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Applying Custom Texture
    By kevin_bkt in forum Development Help
    Replies: 42
    Last Post: 04-21-2009, 01:10 AM
  2. Custom Boundaries
    By KettyHua in forum Developers' Corner
    Replies: 3
    Last Post: 01-21-2009, 12:57 AM
  3. Exception when zooming custom terrain - WWJ
    By Omega in forum Development Help
    Replies: 0
    Last Post: 10-28-2008, 06:24 AM
  4. SurfaceShape logic error
    By zerobarrier in forum Development Help
    Replies: 1
    Last Post: 08-14-2008, 09:45 PM
  5. Custom Terrain
    By StudentGeologist in forum Add-ons & Scripts
    Replies: 0
    Last Post: 04-11-2006, 10:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •