Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

AW: Using RubberBandBoxRendererJ3D results to specify filter for ShapeFileAdapter

Hi Luke,

What are your RealTypes passed to RubberBandBoxRendererJ3D? I assume you
use a LatLon-Tuple. Your code is not very transparent and a bit to
complicated for what you want to do. Try this:

double latMin = Math.min(samples[0][0], samples[0][1]);
double latMax = Math.max(samples[0][0], samples[0][1]);
double lonMin = Math.min(samples[1][0], samples[1][1]);
double lonMax = Math.max(samples[1][0], samples[1][1]);
double width = lonMax-lonMin;
double height = latMax-latMin;
latMap.setRange(latMin, latMax);
lonMap.setRange(lonMin, lonMax);
latMap.getAxisScale().createStandardLabels(latMax, latMin, latMin, 15);
lonMap.getAxisScale().createStandardLabels(lonMax, lonMin, lonMin, 15);
try {
  mapBackgroundShapeFile = new ShapefileAdapter(shapeFilename,
    new Rectangle2D.Double(lonMin, latMin, width, height),
    dataCourseness);
} catch (IOException ioEx) {
  ioEx.printStackTrace();
}

That makes your code more tranparent since you don't have to distinguish
between different cases. I did not test the code so be aware of bugs :)
You should try to experiment with latMin, latMax and height, perhaps to
change latMin and latMax in latMap.setRange.

Hope that helps, Mathias


 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690