/******************************************************************************************************************* * * ******************************************************************************************************************/ @Override protected double[] computeFrustumLimits (final @Nonnull DrawContext dc) { final double r = dc.getGlobe().getEquatorialRadius(); final Vec4 center = dc.getGlobe().getCenter(); final double distanceFromOrigin = dc.getView().getEyePoint().distanceTo3(center); final double near = 1000; // ditanceFromOrigine - r * 2; final double far = distanceFromOrigin; return new double[]{ near, far }; }
@Override public Extent getExtent( DrawContext dc ) { if ( dc == null ) { String msg = Logging.getMessage( "nullValue.DrawContextIsNull" ); Logging.logger( ).severe( msg ); throw new IllegalArgumentException( msg ); } return Sector.computeBoundingCylinder( dc.getGlobe( ), dc.getVerticalExaggeration( ), this.getSector( ) ); } }
/******************************************************************************************************************* * * ******************************************************************************************************************/ 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; }
/******************************************************************************************************************* * * ******************************************************************************************************************/ @Override protected void requestTexture (final @Nonnull DrawContext dc, final @Nonnull MercatorTextureTile tile) { logger.finer("requestTexture(%s, %s)", dc, tile); final Vec4 centroid = tile.getCentroidPoint(dc.getGlobe()); if (this.getReferencePoint() != null) { tile.setPriority(centroid.distanceTo3(this.getReferencePoint())); } final RequestTask task = new RequestTask(tile, this); this.getRequestQ().add(task); }
private double computeSegmentLength(Path path, DrawContext dc, Position posA, Position posB) { final LatLon llA = new LatLon(posA.getLatitude(), posA.getLongitude()); final LatLon llB = new LatLon(posB.getLatitude(), posB.getLongitude()); Angle ang; String pathType = path.getPathType(); if (Objects.equals(pathType, AVKey.LINEAR)) { ang = LatLon.linearDistance(llA, llB); } else if (Objects.equals(pathType, AVKey.RHUMB_LINE) || Objects.equals(pathType, AVKey.LOXODROME)) { ang = LatLon.rhumbDistance(llA, llB); } else { // Great circle ang = LatLon.greatCircleDistance(llA, llB); } if (path.getAltitudeMode() == WorldWind.CLAMP_TO_GROUND) { return ang.radians * (dc.getGlobe().getRadius()); } final double height = 0.5 * (posA.getElevation() + posB.getElevation()); return ang.radians * (dc.getGlobe().getRadius() + height * dc.getVerticalExaggeration()); }
protected void createGList (final @Nonnull DrawContext dc, final @Nonnull GL gl) final double sphereRadius = dc.getGlobe().getEquatorialRadius(); final Vec4 pos = dc.getGlobe().computePointFromPosition(Angle.fromDegreesLatitude(yyy.coordinates.getLatitude()), Angle.fromDegreesLongitude(yyy.coordinates.getLongitude()), hhh);
protected void doUpdate(DrawContext dc) { this.referencePos = new Position(this.sector.getCentroid(), this.altitude); this.referencePoint = dc.getGlobe().computePointFromPosition(this.referencePos); if (this.surfaceRenderInfo == null || this.surfaceRenderInfo.getGridWidth() != this.width || this.surfaceRenderInfo.getGridHeight() != this.height) { this.surfaceRenderInfo = new RenderInfo(this.width, this.height) { public void drawInterior(DrawContext dc) { if (dc == null) { cartesianVertexBuffer.rewind(); geographicVertexBuffer.rewind(); colorBuffer.rewind(); shadowColorBuffer.rewind(); return; } super.drawInterior(dc); } }; } this.updateSurfacePoints(dc, this.surfaceRenderInfo); this.updateSurfaceNormals(this.surfaceRenderInfo); }
Vec4 center = dc.getGlobe( ).computePointFromPosition( centerPosition ); Vec4 eye = dc.getView( ).getEyePoint( );
/******************************************************************************************************************* * * ******************************************************************************************************************/ private void drawBoundingVolumes(DrawContext dc, ArrayList<MercatorTextureTile> tiles) { float[] previousColor = new float[4]; dc.getGL().glGetFloatv(GL.GL_CURRENT_COLOR, previousColor, 0); dc.getGL().glColor3d(0, 1, 0); for (MercatorTextureTile tile : tiles) { ((Cylinder) tile.getExtent(dc)).render(dc); } Cylinder c = dc.getGlobe().computeBoundingCylinder(dc.getVerticalExaggeration(), this.levels.getSector()); dc.getGL().glColor3d(1, 1, 0); c.render(dc); dc.getGL().glColor4fv(previousColor, 0); }