private boolean atMaxLevel(DrawContext dc) { Position vpc = dc.getViewportCenterPosition(); if (dc.getView() == null || this.getLevels() == null || vpc == null) return false; if (!this.getLevels().getSector().contains(vpc.getLatitude(), vpc.getLongitude())) return true; Level nextToLast = this.getLevels().getNextToLastLevel(); if (nextToLast == null) return true; Sector centerSector = nextToLast.computeSectorForPosition( vpc.getLatitude(), vpc.getLongitude(), this.getLevels().getTileOrigin()); return this.needToSplit(dc, centerSector); }
private Vec4 computeReferencePoint(DrawContext dc) { if (dc.getViewportCenterPosition() != null) return dc.getGlobe().computePointFromPosition(dc.getViewportCenterPosition()); java.awt.geom.Rectangle2D viewport = dc.getView().getViewport(); int x = (int) viewport.getWidth() / 2; for (int y = (int) (0.5 * viewport.getHeight()); y >= 0; y--) { Position pos = dc.getView().computePositionFromScreenPoint(x, y); if (pos == null) continue; return dc.getGlobe().computePointFromPosition(pos.getLatitude(), pos.getLongitude(), 0d); } return null; }