protected static boolean isServiceVisible(DrawContext dc, PlaceNameService placeNameService) { //noinspection SimplifiableIfStatement if (!placeNameService.isEnabled()) return false; return (dc.getVisibleSector() != null) && placeNameService.getMaskingSector().intersects(dc.getVisibleSector()); // // return // placeNameService.getExtent(dc).intersects(dc.getView().getFrustumInModelCoordinates()); }
@Override protected void doRender(DrawContext dc) { this.referencePoint = this.computeReferencePoint(dc); int serviceCount = this.placeNameServiceSet.getServiceCount(); for (int i = 0; i < serviceCount; i++) { PlaceNameService placeNameService = this.placeNameServiceSet.getService(i); if (!isServiceVisible(dc, placeNameService)) continue; double minDistSquared = placeNameService.getMinDisplayDistance() * placeNameService.getMinDisplayDistance(); double maxDistSquared = placeNameService.getMaxDisplayDistance() * placeNameService.getMaxDisplayDistance(); if (isSectorVisible( dc, placeNameService.getMaskingSector(), minDistSquared, maxDistSquared)) { ArrayList<Tile> baseTiles = new ArrayList<Tile>(); NavigationTile navTile = this.navTiles.get(i); // drill down into tiles to find bottom level navTiles visible List<NavigationTile> list = navTile.navTilesVisible(dc, minDistSquared, maxDistSquared); for (NavigationTile nt : list) { baseTiles.addAll(nt.getTiles()); } for (Tile tile : baseTiles) { try { drawOrRequestTile(dc, tile, minDistSquared, maxDistSquared); } catch (Exception e) { Logging.logger() .log( Level.FINE, Logging.getMessage("layers.PlaceNameLayer.ExceptionRenderingTile"), e); } } } } this.sendRequests(); this.requestQ.clear(); }