Program: 11491
Project: 11491
Buggy source:
@Override public MultiAxisPlot2D getLayout(){
  MultiAxisPlot2D plot=new MultiAxisPlot2D();
  plot.getCenterAxis().lockAspectRatioXY(1.0);
  plot.getCenterAxis().getAxisX().setUpdateMode(CenterScale);
  plot.getCenterAxis().getAxisX().setUpdateMode(CenterScale);
  plot.setBorderSize(2);
  plot.setShowTitle(false);
  Axis2D xyAxis=plot.getCenterAxis();
  AxisUnitConverter unitConverter=new AxisUnitConverter(){
    public double fromAxisUnits(    double value){
      return Length.fromNauticalMiles(value);
    }
    public double toAxisUnits(    double value){
      return Length.toNauticalMiles(value);
    }
  }
;
  GridAxisLabelHandler xTicks=new GridAxisLabelHandler();
  GridAxisLabelHandler yTicks=new GridAxisLabelHandler();
  xTicks.setAxisUnitConverter(unitConverter);
  yTicks.setAxisUnitConverter(unitConverter);
  TaggedAxis1D colorAxis=new TaggedAxis1D();
  AxisMouseListener colorMouseListener=new TaggedAxisMouseListener1D();
  final AxisInfo colorAxisInfo=plot.createAxisRight("String_Node_Str",colorAxis,colorMouseListener);
  final GridAxisLabelHandler colorTickHandler=new GridAxisLabelHandler();
  final TaggedPartialColorYAxisPainter colorTagPainter=new TaggedPartialColorYAxisPainter(colorTickHandler);
  colorAxisInfo.setAxisPainter(colorTagPainter);
  ColorTexture1D colorMapTexture=new ColorTexture1D(1024);
  colorMapTexture.mutate(new ColorGradientConcatenator(ColorGradients.bathymetry,ColorGradients.topography));
  colorTagPainter.setColorScale(colorMapTexture);
  final Tag maxTag=colorAxis.addTag("String_Node_Str",10000.0).setAttribute(TEX_COORD_ATTR,1.0f);
  final Tag seaLevelTag=colorAxis.addTag("String_Node_Str",0.0).setAttribute(TEX_COORD_ATTR,0.5f);
  final Tag minTag=colorAxis.addTag("String_Node_Str",-8000.0).setAttribute(TEX_COORD_ATTR,0.0f);
  colorAxis.addConstraint(new NamedConstraint("String_Node_Str"){
    protected double buffer=200;
    @Override public void applyConstraint(    TaggedAxis1D axis){
      if (seaLevelTag.getValue() > maxTag.getValue() - buffer)       seaLevelTag.setValue(maxTag.getValue() - buffer);
      if (minTag.getValue() > seaLevelTag.getValue() - buffer)       minTag.setValue(seaLevelTag.getValue() - buffer);
    }
  }
);
  colorAxis.setMin(-10000);
  colorAxis.setMax(12000);
  plot.addPainter(new BackgroundPainter().setColor(GlimpseColor.getBlack()));
  GridPainter grid=new GridPainter(xTicks,yTicks);
  grid.setLineColor(GlimpseColor.getGray(0.2f));
  grid.setMinorLineColor(GlimpseColor.getGray(0.1f));
  plot.addPainter(grid);
  final TaggedHeatMapPainter heatmap=new TaggedHeatMapPainter(colorAxis);
  heatmap.setColorScale(colorMapTexture);
  plot.addPainter(heatmap);
  final TangentPlane initPlane=new TangentPlane(LatLonGeo.fromDeg(0,0));
  BathymetryData bathyData;
  try {
    bathyData=new BathymetryData(openBathyFile(),initPlane);
  }
 catch (  IOException e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  }
  bathyData.setAxisBounds(xyAxis);
  final FloatTextureProjected2D texture=new FloatTextureProjected2D(bathyData.getImageWidth(),bathyData.getImageHeight(),true);
  texture.setData(bathyData.getData());
  final double startLat=bathyData.getStartLat();
  final double startLon=bathyData.getStartLon();
  final double endLat=startLat + bathyData.getHeightStep() * bathyData.getImageHeight();
  final double endLon=startLon + bathyData.getWidthStep() * bathyData.getImageWidth();
  final RunnableOn<TangentPlane> reprojectHeatmap=new RunnableOn<TangentPlane>(){
    double earthCircumference=2 * PI * LatLonGeo.defaultDatum.getRadius();
    double oneOverDistanceThreshold=1.0 / (0.4 * earthCircumference);
    public void run(    TangentPlane plane){
      LatLonProjection newProjection=new LatLonProjection(plane,startLat,endLat,startLon,endLon,false){
        public void getVertexXYZ(        double textureFractionX,        double textureFractionY,        float[] resultXYZ){
          Vector2d xy=project(textureFractionX,textureFractionY);
          resultXYZ[0]=(float)xy.getX();
          resultXYZ[1]=(float)xy.getY();
          Vector2d xyTangent=((TangentPlane)projection).getTangentPointOnPlane();
          resultXYZ[2]=(float)(xy.minus(xyTangent).norm() * oneOverDistanceThreshold);
        }
      }
;
      texture.setProjection(newProjection);
      heatmap.setData(texture);
    }
  }
;
  reprojectHeatmap.run(initPlane);
  xyAxis.addAxisListener(new AxisListener2D(){
    TangentPlane currentPlane=initPlane;
    public void axisUpdated(    Axis2D axis){
      double xRef=axis.getAxisX().getSelectionCenter();
      double yRef=axis.getAxisY().getSelectionCenter();
      LatLonGeo ref=currentPlane.unproject(xRef,yRef);
      currentPlane=new TangentPlane(ref,xRef,yRef);
      reprojectHeatmap.run(currentPlane);
    }
  }
);
  CrosshairPainter crosshairs=new CrosshairPainter();
  crosshairs.showSelectionBox(false);
  crosshairs.setLineWidth(1.0f);
  crosshairs.setCursorColor(GlimpseColor.getGreen(0.3f));
  plot.addPainter(crosshairs);
  ScalePainter scale=new ScalePainter();
  scale.setUnitConverter(unitConverter);
  scale.setPixelBufferX(5);
  scale.setPixelBufferY(5);
  scale.setPrimaryColor(GlimpseColor.getGray(0.75f));
  scale.setSecondaryColor(GlimpseColor.getGray(0.5f));
  scale.setBorderColor(GlimpseColor.getWhite());
  scale.setTextColor(GlimpseColor.getWhite());
  plot.addPainter(scale);
  plot.addPainter(new BorderPainter());
  return plot;
}

Fixed version (ground truth):
@Override public MultiAxisPlot2D getLayout(){
  MultiAxisPlot2D plot=new MultiAxisPlot2D();
  plot.getCenterAxis().lockAspectRatioXY(1.0);
  plot.getCenterAxis().getAxisX().setUpdateMode(CenterScale);
  plot.getCenterAxis().getAxisX().setUpdateMode(CenterScale);
  plot.setBorderSize(2);
  plot.setShowTitle(false);
  Axis2D xyAxis=plot.getCenterAxis();
  AxisUnitConverter unitConverter=new AxisUnitConverter(){
    public double fromAxisUnits(    double value){
      return Length.fromNauticalMiles(value);
    }
    public double toAxisUnits(    double value){
      return Length.toNauticalMiles(value);
    }
  }
;
  GridAxisLabelHandler xTicks=new GridAxisLabelHandler();
  GridAxisLabelHandler yTicks=new GridAxisLabelHandler();
  xTicks.setAxisUnitConverter(unitConverter);
  yTicks.setAxisUnitConverter(unitConverter);
  TaggedAxis1D colorAxis=new TaggedAxis1D();
  AxisMouseListener colorMouseListener=new TaggedAxisMouseListener1D();
  final AxisInfo colorAxisInfo=plot.createAxisRight("String_Node_Str",colorAxis,colorMouseListener);
  final GridAxisLabelHandler colorTickHandler=new GridAxisLabelHandler();
  final TaggedPartialColorYAxisPainter colorTagPainter=new TaggedPartialColorYAxisPainter(colorTickHandler);
  colorAxisInfo.setAxisPainter(colorTagPainter);
  ColorTexture1D colorMapTexture=new ColorTexture1D(1024);
  colorMapTexture.mutate(new ColorGradientConcatenator(ColorGradients.bathymetry,ColorGradients.topography));
  colorTagPainter.setColorScale(colorMapTexture);
  colorAxis.addTag("String_Node_Str",10000.0).setAttribute(TEX_COORD_ATTR,1.0f);
  colorAxis.addTag("String_Node_Str",0.0).setAttribute(TEX_COORD_ATTR,0.5f);
  colorAxis.addTag("String_Node_Str",-8000.0).setAttribute(TEX_COORD_ATTR,0.0f);
  List<String> constraints=new ArrayList<String>();
  for (  Tag tag : colorAxis.getSortedTags())   constraints.add(tag.getName());
  colorAxis.addConstraint(new OrderedConstraint("String_Node_Str",200,constraints));
  colorAxis.setMin(-10000);
  colorAxis.setMax(12000);
  plot.addPainter(new BackgroundPainter().setColor(GlimpseColor.getBlack()));
  GridPainter grid=new GridPainter(xTicks,yTicks);
  grid.setLineColor(GlimpseColor.getGray(0.2f));
  grid.setMinorLineColor(GlimpseColor.getGray(0.1f));
  plot.addPainter(grid);
  final TaggedHeatMapPainter heatmap=new TaggedHeatMapPainter(colorAxis);
  heatmap.setColorScale(colorMapTexture);
  plot.addPainter(heatmap);
  final TangentPlane initPlane=new TangentPlane(LatLonGeo.fromDeg(0,0));
  BathymetryData bathyData;
  try {
    bathyData=new BathymetryData(openBathyFile(),initPlane);
  }
 catch (  IOException e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  }
  bathyData.setAxisBounds(xyAxis);
  final FloatTextureProjected2D texture=new FloatTextureProjected2D(bathyData.getImageWidth(),bathyData.getImageHeight(),true);
  texture.setData(bathyData.getData());
  final double startLat=bathyData.getStartLat();
  final double startLon=bathyData.getStartLon();
  final double endLat=startLat + bathyData.getHeightStep() * bathyData.getImageHeight();
  final double endLon=startLon + bathyData.getWidthStep() * bathyData.getImageWidth();
  final RunnableOn<TangentPlane> reprojectHeatmap=new RunnableOn<TangentPlane>(){
    double earthCircumference=2 * PI * LatLonGeo.defaultDatum.getRadius();
    double oneOverDistanceThreshold=1.0 / (0.4 * earthCircumference);
    public void run(    TangentPlane plane){
      LatLonProjection newProjection=new LatLonProjection(plane,startLat,endLat,startLon,endLon,false){
        public void getVertexXYZ(        double textureFractionX,        double textureFractionY,        float[] resultXYZ){
          Vector2d xy=project(textureFractionX,textureFractionY);
          resultXYZ[0]=(float)xy.getX();
          resultXYZ[1]=(float)xy.getY();
          Vector2d xyTangent=((TangentPlane)projection).getTangentPointOnPlane();
          resultXYZ[2]=(float)(xy.minus(xyTangent).norm() * oneOverDistanceThreshold);
        }
      }
;
      texture.setProjection(newProjection);
      heatmap.setData(texture);
    }
  }
;
  reprojectHeatmap.run(initPlane);
  xyAxis.addAxisListener(new AxisListener2D(){
    TangentPlane currentPlane=initPlane;
    public void axisUpdated(    Axis2D axis){
      double xRef=axis.getAxisX().getSelectionCenter();
      double yRef=axis.getAxisY().getSelectionCenter();
      LatLonGeo ref=currentPlane.unproject(xRef,yRef);
      currentPlane=new TangentPlane(ref,xRef,yRef);
      reprojectHeatmap.run(currentPlane);
    }
  }
);
  CrosshairPainter crosshairs=new CrosshairPainter();
  crosshairs.showSelectionBox(false);
  crosshairs.setLineWidth(1.0f);
  crosshairs.setCursorColor(GlimpseColor.getGreen(0.3f));
  plot.addPainter(crosshairs);
  ScalePainter scale=new ScalePainter();
  scale.setUnitConverter(unitConverter);
  scale.setPixelBufferX(5);
  scale.setPixelBufferY(5);
  scale.setPrimaryColor(GlimpseColor.getGray(0.75f));
  scale.setSecondaryColor(GlimpseColor.getGray(0.5f));
  scale.setBorderColor(GlimpseColor.getWhite());
  scale.setTextColor(GlimpseColor.getWhite());
  plot.addPainter(scale);
  plot.addPainter(new BorderPainter());
  return plot;
}