Announcement

Collapse
No announcement yet.

Tactical symbols delayed rendering

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tactical symbols delayed rendering

    I have some tactical symbols that I add to a layer, something like this:

    Code:
    TacticalSymbol symbol = new MilStd2525TacticalSymbol(sidc, Position.fromDegrees(lat, long, elev));
    ...
    symbol.setVisible(false);
    ...
    layer.addRenderable(symbol);
    And then I selectively make symbols visible/invisible in the layer to animate them.

    I am running in offline mode, so my 2525C symbols are being loaded from the local disk.

    When WorldWind first comes up and the geo is displayed, all visible symbols are first displayed as "loading" icons. That is, they are white rectangles with a gray circular arrows inside.

    The "loading" icons are only displayed for an instant -- maybe about 1/2 second -- before the full tactical symbols with color, text and modifiers are displayed.

    It's not a big deal, but I would rather not see "loading" icons at all. Is there a way to ensure that the symbols are fully created before they are displayed? Does this have something to do with lazily loaded textures? Maybe some kind of buffering or caching mechanism?

    Later, when the symbols are being animated, I have many symbols next to each other whose visibilities are toggled on/off quickly in order to make it look like a symbol is moving across the screen. However, sometimes a symbol first comes up as a "loading" icon and then turned invisible before being fully rendered, and so for each symbol in the animation, making appear as though a "loading" icon is moving across the screen.

    Again, I don't want the "loading" icon to be shown at all. How can prevent the symbol from being displayed until after it has been fully created?

    Thanks,
    Jeff
    Last edited by jeffsp; 10-06-2017, 10:44 PM.

  • #2
    Hi,
    Did you tried to put your code into a SwingUtilities.invokeLater() (or a Platform.runLater() in you are in JavaFX) in order to load the icons on a separate thread ? Might be faster.
    Also I wouldn't addRenderable/removeRenderable at each step, but change the symbol position inside of the uniquely created layer.
    Good Luck.
    There would be also the trick to set the eye position on the other side of the earth (so that loaded icons are not visible) but that's cheating... )

    Comment


    • #3
      I did two things:

      1) Override MilStd2525TacticalSymbol.layoutIcon() and add

      Code:
      while (this.iconTexture.bind(dc) == false)
          ; // do nothing
      in order to force unlazy binding of the icon texture. This had the effect I wanted. Now, I never see the loading symbol on MilStd2525 icons on startup or in my animations. Of course, if the icons were being downloaded from the network, this would be a really bad idea. This only works because I'm running offline.

      2) Change the symbol positions, as you suggested, instead of making them visible/unvisible. This is the real fix -- it changed the more problematic behavior of breaking the animations. It also uses a lot less memory. However, it does not fix the problem of showing loading icons during startup.

      Thanks for your help,
      Jeff

      Comment


      • #4
        If you just need the 2525 symbol (not 2525 graphics), there is an alternate approach that doesn't exhibit that "loading" behavior. There is some documentation describing the IconRetriever here https://worldwind.arc.nasa.gov/java/...con-retriever/ . The idea is to get the symbol/icon BufferedImage, and now it's possible to use PointPlacemark to display it (there are other ways too). The PointPlacemarkAttributes.setImage (BufferedUmage) is method to use ....

        Comment


        • #5
          Nice. That looks useful. Thanks!

          Comment

          Working...
          X