ui/src/main/java/ucar/nc2/ui/coverage2/CoverageRenderer.java
public String getXYvalueStr(ProjectionPoint loc) {
    if ((lastGrid == null) || (geodata == null))
      return "";

    // convert to dataProjection, where x and y are orthogonal
    if (!sameProjection) {
      LatLonPoint llpt = drawProjection.projToLatLon(loc);
      loc = dataProjection.latLonToProj(llpt);
    }

    // find the grid indexes
    HorizCoordSys hcs = lastGrid.getCoordSys().getHorizCoordSys();
    Optional<HorizCoordSys.CoordReturn> opt = hcs.findXYindexFromCoord(loc.getX(), loc.getY());

    // get value, construct the string
    if (!opt.isPresent())
      return opt.getErrorMessage();
    else {
      HorizCoordSys.CoordReturn cr = opt.get();
      try {
        Index imaH = geodata.getIndex();
        double dataValue = geodata.getDouble(imaH.set(cr.y, cr.x));
        // int wantz = (geocs.getZAxis() == null) ? -1 : lastLevel;
        return makeXYZvalueStr(dataValue, cr);
      } catch (Exception e) {
        return "error " + cr.x + " " + cr.y;
      }
    }
  }
public String getXYvalueStr(ProjectionPoint loc) {
    if ((lastGrid == null) || (geodata == null))
      return "";

    // convert to dataProjection, where x and y are orthogonal
    if (!sameProjection) {
      LatLonPoint llpt = drawProjection.projToLatLon(loc);
      loc = dataProjection.latLonToProj(llpt);
    }

    // find the grid indexes
    HorizCoordSys hcs = lastGrid.getCoordSys().getHorizCoordSys();
    Optional<HorizCoordSys.CoordReturn> opt = hcs.findXYindexFromCoord(loc.getX(), loc.getY());

    // get value, construct the string
    if (!opt.isPresent())
      return opt.getErrorMessage();
    else {
      HorizCoordSys.CoordReturn cr = opt.get();
      try {
        Index imaH = geodata.getIndex();
        double dataValue = geodata.getDouble(imaH.set(cr.y, cr.x));
        // int wantz = (geocs.getZAxis() == null) ? -1 : lastLevel;
        return makeXYZvalueStr(dataValue, cr);
      } catch (Exception e) {
        return "error " + cr.x + " " + cr.y;
      }
    }
  }
public String getXYvalueStr ( ProjectionPoint loc ) { if ( ( lastGrid == null ) || ( geodata == null ) ) return "" ; // convert to dataProjection, where x and y are orthogonal if ( ! sameProjection ) { LatLonPoint llpt = drawProjection . projToLatLon ( loc ) ; loc = dataProjection . latLonToProj ( llpt ) ; } // find the grid indexes HorizCoordSys hcs = lastGrid . getCoordSys ( ) . getHorizCoordSys ( ) ; Optional < HorizCoordSys . CoordReturn > opt = hcs . findXYindexFromCoord ( loc . getX ( ) , loc . getY ( ) ) ; // get value, construct the string if ( ! opt . isPresent ( ) ) return opt . getErrorMessage ( ) ; else { HorizCoordSys . CoordReturn cr = opt . get ( ) ; try { Index imaH = geodata . getIndex ( ) ; double dataValue = geodata . getDouble ( imaH . set ( cr . y , cr . x ) ) ; // int wantz = (geocs.getZAxis() == null) ? -1 : lastLevel; return makeXYZvalueStr ( dataValue , cr ) ; } catch ( Exception e ) { return "error " + cr . x + " " + cr . y ; } } }
/*
Get the data value at this projection (x,y) point.

@param loc : point in display projection coordinates (plan view)
@return String representation of value
/ * Get the data value at this projection ( x y ) point .