📄 drawcontextimpl.java
字号:
if (pickedObjects == null) { String msg = Logging.getMessage("nullValue.PickedObjectList"); Logging.logger().severe(msg); throw new IllegalArgumentException(msg); } if (this.pickedObjects == null) { this.pickedObjects = pickedObjects; return; } for (PickedObject po : pickedObjects) { this.pickedObjects.add(po); } } /** * Adds a single insatnce of the picked object to the current picked-object list * * @param pickedObject the object to add * * @throws IllegalArgumentException if <code>picked Object is null</code> */ public void addPickedObject(PickedObject pickedObject) { if (null == pickedObject) { String msg = Logging.getMessage("nullValue.PickedObject"); Logging.logger().severe(msg); throw new IllegalArgumentException(msg); } if (null == this.pickedObjects) this.pickedObjects = new PickedObjectList(); this.pickedObjects.add(pickedObject); } public PickedObjectList getPickedObjects() { return this.pickedObjects; } public Color getUniquePickColor() { this.uniquePickNumber++; int clearColorCode = this.getClearColor().getRGB(); if (clearColorCode == this.uniquePickNumber) this.uniquePickNumber++; if (this.uniquePickNumber >= 0x00FFFFFF) { this.uniquePickNumber = 1; // no black, no white if (clearColorCode == this.uniquePickNumber) this.uniquePickNumber++; } return new Color(this.uniquePickNumber, true); // has alpha } public Color getClearColor() { return this.clearColor; } /** * Returns true if the Picking mode is active, otherwise return false * * @return true for Picking mode, otherwise false */ public boolean isPickingMode() { return this.isPickingMode; } /** * Enables color picking mode */ public void enablePickingMode() { this.isPickingMode = true; } /** * Disables color picking mode */ public void disablePickingMode() { this.isPickingMode = false; } public void addOrderedRenderable(OrderedRenderable orderedRenderable) { if (null == orderedRenderable) { String msg = Logging.getMessage("nullValue.OrderedRenderable"); Logging.logger().warning(msg); return; // benign event } this.orderedRenderables.add(orderedRenderable); } public java.util.Queue<OrderedRenderable> getOrderedRenderables() { return this.orderedRenderables; } public void drawUnitQuad() { GL gl = this.getGL(); gl.glBegin(GL.GL_QUADS); // TODO: use a vertex array or vertex buffer gl.glVertex2d(0d, 0d); gl.glVertex2d(1, 0d); gl.glVertex2d(1, 1); gl.glVertex2d(0d, 1); gl.glEnd(); } public void drawUnitQuad(TextureCoords texCoords) { GL gl = this.getGL(); gl.glBegin(GL.GL_QUADS); // TODO: use a vertex array or vertex buffer gl.glTexCoord2d(texCoords.left(), texCoords.bottom()); gl.glVertex2d(0d, 0d); gl.glTexCoord2d(texCoords.right(), texCoords.bottom()); gl.glVertex2d(1, 0d); gl.glTexCoord2d(texCoords.right(), texCoords.top()); gl.glVertex2d(1, 1); gl.glTexCoord2d(texCoords.left(), texCoords.top()); gl.glVertex2d(0d, 1); gl.glEnd(); } public int getNumTextureUnits() { return numTextureUnits; } public void setNumTextureUnits(int numTextureUnits) { // TODO: validate arg for >= 1 this.numTextureUnits = numTextureUnits; } public double getMaxTextureAnisotropy() { return this.maxTextureAnisotropy; } public void setMaxTextureAnisotropy(double maxAnisotropy) { // The maxAnisotropy value can be any real value. A value less than 2.0 indicates that this graphics context // does not support texture anisotropy. this.maxTextureAnisotropy = maxAnisotropy; } public Vec4 getPointOnGlobe(Angle latitude, Angle longitude) { if (latitude == null || longitude == null) { String message = Logging.getMessage("nullValue.LatitudeOrLongitudeIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (this.getVisibleSector() == null) return null; if (!this.getVisibleSector().contains(latitude, longitude)) return null; SectorGeometryList sectorGeometry = this.getSurfaceGeometry(); if (sectorGeometry != null) { Vec4 p = sectorGeometry.getSurfacePoint(latitude, longitude); if (p != null) return p; } return null; } public Vec4 getScreenPoint(Angle latitude, Angle longitude, double metersElevation) { if (latitude == null || longitude == null) { String message = Logging.getMessage("nullValue.LatitudeOrLongitudeIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (this.getGlobe() == null) return null; Vec4 modelPoint = this.getGlobe().computePointFromPosition(latitude, longitude, metersElevation); if (modelPoint == null) return null; return this.getScreenPoint(modelPoint); } public Vec4 getScreenPoint(Position position) { if (position == null) { String message = Logging.getMessage("nullValue.PositionIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } return this.getScreenPoint(position.getLatitude(), position.getLongitude(), position.getElevation()); } public Vec4 getScreenPoint(Vec4 modelPoint) { if (modelPoint == null) { String message = Logging.getMessage("nullValue.Vec4IsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (this.getView() == null) return null; return this.getView().project(modelPoint); } public SurfaceTileRenderer getGeographicSurfaceTileRenderer() { return this.geographicSurfaceTileRenderer; } public Collection<PerformanceStatistic> getPerFrameStatistics() { return this.perFrameStatistics; } public void setPerFrameStatisticsKeys(Set<String> statKeys, Collection<PerformanceStatistic> stats) { this.perFrameStatisticsKeys = statKeys; this.perFrameStatistics = stats; } public Set<String> getPerFrameStatisticsKeys() { return perFrameStatisticsKeys; } public void setPerFrameStatistic(String key, String displayName, Object value) { if (this.perFrameStatistics == null || this.perFrameStatisticsKeys == null) return; if (key == null) { String message = Logging.getMessage("nullValue.KeyIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (displayName == null) { String message = Logging.getMessage("nullValue.DisplayNameIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (this.perFrameStatisticsKeys.contains(key) || this.perFrameStatisticsKeys.contains(PerformanceStatistic.ALL)) this.perFrameStatistics.add(new PerformanceStatistic(key, displayName, value)); } public void setPerFrameStatistics(Collection<PerformanceStatistic> stats) { if (this.perFrameStatistics == null || this.perFrameStatisticsKeys == null) return; if (stats == null) { String message = Logging.getMessage("nullValue.KeyIsNull"); // TODO Logging.logger().severe(message); throw new IllegalArgumentException(message); } for (PerformanceStatistic stat : stats) this.perFrameStatistics.add(stat); } public long getFrameTimeStamp() { return this.frameTimestamp; } public void setFrameTimeStamp(long frameTimeStamp) { this.frameTimestamp = frameTimeStamp; } public List<Sector> getVisibleSectors(double[] resolutions, long timeLimit, Sector sector) { if (resolutions == null) { String message = Logging.getMessage("nullValue.ArrayIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (timeLimit <= 0) { String message = Logging.getMessage("generic.TimeNegative", timeLimit); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (sector == null) sector = this.visibleSector; if (this.visibleSectors == null) this.visibleSectors = new SectorVisibilityTree(); else if (this.visibleSectors.getSectorSize() == resolutions[resolutions.length - 1] && this.visibleSectors.getTimeStamp() == this.frameTimestamp) return this.visibleSectors.getSectors(); long start = System.currentTimeMillis(); List<Sector> sectors = this.visibleSectors.refresh(this, resolutions[0], sector); for (int i = 1; i < resolutions.length && (System.currentTimeMillis() < start + timeLimit); i++) { sectors = this.visibleSectors.refresh(this, resolutions[i], sectors); } this.visibleSectors.setTimeStamp(this.frameTimestamp); return this.visibleSectors.getSectors(); } public void setCurrentLayer(Layer layer) { this.currentLayer = layer; } public Layer getCurrentLayer() { return this.currentLayer; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -