/** * Modifies a PlotData object used by this window. This is an optimisation to do with current * pixel size. * * @param state plot state * @param data plot data object - may be modified */ private void adjustPlotData(SphericalPlotState state, PlotData data) { if (data instanceof PointSelection) { Points points = ((PointSelection) data).getPoints(); if (points != null) { Object basePoints = WrapUtils.getWrapped(points); if (basePoints instanceof SphericalPolarPointStore) { /* If the data is a spherical polar point store, tell it * roughly what the display pixel size is for this plot. * This enables skipping some expensive calculaations of * error points where it is known that they will end up in * the same pixel as the error point. */ SphericalPolarPointStore sphPoints = (SphericalPolarPointStore) basePoints; Dimension size = getPlot().getSize(); int scale = Math.max(size.width, size.height); /* This is a rough estimate, but it should be an * underestimate, which is safe though perhaps not * maximally efficient. */ double minTanErr = 1.0 / (scale * state.getZoomScale()); sphPoints.setMinimumTanError(minTanErr); } } } }
/** * Returns the SphericalAxesSelector associated with a given PointSelector. * * @param psel point selector * @return spherical axes selector */ private static SphericalAxesSelector getSphericalAxesSelector(PointSelector psel) { return (SphericalAxesSelector) WrapUtils.getWrapped(psel.getAxesSelector()); }