Announcement

Collapse
No announcement yet.

How to keep the entire track in vision

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

  • How to keep the entire track in vision

    Hello,

    i'm currently using this api to present MILSTD2525 symbols on an app. The thing is that these symbols are not always completely visible (look at the pics). I've used CLAMP_TO_GROUND and RELATIVE with 0 height but the effect is the same, i've also used "Z-order" (distaceFromEye) set to -1 and the results are no better. I understand that the symbols may intersect with the terrain causing this effect, but i need for this NOT to happen, i mean, i need the entire symbol to be visible at all times independent of the height in it's surroundings and it's heading of view. ¿Is there something about this in progress?

    Thanks!
    Attached Files

  • #2
    ccaceres,

    The standard World Wind pattern for achieving the effect you want is to provide an alwaysOnTop property for the object, which when enabled causes the object to appear on top of the terrain and other objects. Unfortunately, TacticalSymbol does not currently provide this property. We have created an issue in the World Wind bug base mentioned on http://goworldwind.org.

    In the meantime, you can work around this by extending MilStd2525TacticalSymbol to provide the alwaysOnTop capability yourself. Below is an example of how to do this. Please try this and let us know if it meets your needs.

    Thanks,
    Dave

    Code:
    protected static class AlwaysOnTopMilStd2525TacticalSymbol extends MilStd2525TacticalSymbol
    {
        protected boolean alwaysOnTop;
    
        public AlwaysOnTopMilStd2525TacticalSymbol(String symbolId, Position position)
        {
            super(symbolId, position);
        }
    
        public AlwaysOnTopMilStd2525TacticalSymbol(String symbolId, Position position, AVList modifiers)
        {
            super(symbolId, position, modifiers);
        }
    
        public boolean isAlwaysOnTop()
        {
            return this.alwaysOnTop;
        }
    
        public void setAlwaysOnTop(boolean alwaysOnTop)
        {
            this.alwaysOnTop = alwaysOnTop;
        }
    
        @Override
        public double getDistanceFromEye()
        {
            return this.isAlwaysOnTop() ? 0 : super.getDistanceFromEye();
        }
    
        @Override
        protected void draw(DrawContext dc)
        {
            boolean disableDepthTest = this.isAlwaysOnTop();
    
            try
            {
                if (disableDepthTest)
                    dc.getGL().glDisable(GL.GL_DEPTH_TEST);
    
                super.draw(dc);
            }
            finally
            {
                if (disableDepthTest)
                    dc.getGL().glEnable(GL.GL_DEPTH_TEST);
            }
        }
    }
    Dave
    WW Team

    Comment


    • #3
      This, being six years out of date, no longer works with the current WW code. The problem is that the method "draw" now takes a second parameter, an OrderedSymbol, and the getDistanceFromEye method is in a subclass of AbstractTacticalSymbol, the OrderedSymbol subclass, so I'm not clear on how to override that.

      I'd like to implement something like this to force MilStd2525 Tactical symbols to display regardless. Any help is appreciated. Thanks.

      Comment

      Working...
      X