/** * Set the point size used for PointAttributes. Calls changeControl and updates the display. * * @param size size to use (>= 1.0) * @throws VisADException couldn't set the point size on local display * @throws RemoteException couldn't set the point size on remote display */ public void setPointSize(float size) throws VisADException, RemoteException { if (size < 1.0f) size = 1.0f; if (Util.isApproximatelyEqual(size, pointSize)) return; pointSize = size; changeControl(true); getDisplay().reDisplayAll(); }
/** * Sets the polygon offset and updates the display. * * @param polygonOffset the polygon offset to be used * @throws VisADException Unable to change offset * @throws RemoteException can't change offset on remote display */ public void setPolygonOffset(float polygonOffset) throws VisADException, RemoteException { if (Float.isNaN(polygonOffset)) return; if (Util.isApproximatelyEqual(this.polygonOffset, polygonOffset)) return; this.polygonOffset = polygonOffset; changeControl(true); getDisplay().reDisplayAll(); }
/** * Set the line width used for LineAttributes. Calls changeControl and resets the display. * * @param width width to use (>= 1.0) * @throws VisADException couldn't set the line width on local display * @throws RemoteException couldn't set the line width on remote display */ public void setLineWidth(float width) throws VisADException, RemoteException { if (width < 1.0f) width = 1.0f; if (Util.isApproximatelyEqual(lineWidth, width)) return; lineWidth = width; // WLH 2 Dec 2002 in response to qomo2.txt DisplayRendererJ3D dr = (DisplayRendererJ3D) getDisplayRenderer(); dr.setLineWidth(width); changeControl(true); getDisplay().reDisplayAll(); }
/** * Check to see if this GraphicsModeControlJ3D is equal to the object in question. * * @param o object in question * @return false if the objects are not the same and/or their states are not equal. */ public boolean equals(Object o) { if (!super.equals(o)) { return false; } GraphicsModeControlJ3D gmc = (GraphicsModeControlJ3D) o; boolean changed = false; if (!Util.isApproximatelyEqual(lineWidth, gmc.lineWidth)) { return false; } if (!Util.isApproximatelyEqual(pointSize, gmc.pointSize)) { return false; } if (pointMode != gmc.pointMode) { return false; } if (textureEnable != gmc.textureEnable) { return false; } if (scaleEnable != gmc.scaleEnable) { return false; } if (transparencyMode != gmc.transparencyMode) { return false; } if (projectionPolicy != gmc.projectionPolicy) { return false; } if (polygonMode != gmc.polygonMode) { return false; } if (missingTransparent != gmc.missingTransparent) { return false; } if (curvedSize != gmc.curvedSize) { return false; } if (anti_alias_flag != gmc.anti_alias_flag) { return false; } if (colorMode != colorMode) { return false; } if (lineStyle != lineStyle) { return false; } if (!Util.isApproximatelyEqual(polygonOffset, gmc.polygonOffset)) { return false; } if (!Util.isApproximatelyEqual(polygonOffsetFactor, gmc.polygonOffsetFactor)) { return false; } if (adjustProjectionSeam != gmc.adjustProjectionSeam) { return false; } if (texture3DMode != gmc.texture3DMode) { return false; } if (cacheAppearances != gmc.cacheAppearances) { return false; } if (mergeGeometries != gmc.mergeGeometries) { return false; } return true; }
/** * Copy the state of a remote control to this control * * @param rmt remote control to sync with this one * @throws VisADException rmt == null or rmt is not a GraphicsModeControlJ3D or couldn't tell if * control was changed. */ public void syncControl(Control rmt) throws VisADException { if (rmt == null) { throw new VisADException( "Cannot synchronize " + getClass().getName() + " with null Control object"); } if (!(rmt instanceof GraphicsModeControlJ3D)) { throw new VisADException( "Cannot synchronize " + getClass().getName() + " with " + rmt.getClass().getName()); } GraphicsModeControlJ3D rmtCtl = (GraphicsModeControlJ3D) rmt; boolean changed = false; boolean redisplay = false; if (!Util.isApproximatelyEqual(lineWidth, rmtCtl.lineWidth)) { changed = true; redisplay = true; lineWidth = rmtCtl.lineWidth; } if (!Util.isApproximatelyEqual(pointSize, rmtCtl.pointSize)) { changed = true; redisplay = true; pointSize = rmtCtl.pointSize; } if (pointMode != rmtCtl.pointMode) { changed = true; redisplay = true; pointMode = rmtCtl.pointMode; } if (textureEnable != rmtCtl.textureEnable) { changed = true; redisplay = true; textureEnable = rmtCtl.textureEnable; } if (scaleEnable != rmtCtl.scaleEnable) { changed = true; getDisplayRenderer().setScaleOn(scaleEnable); scaleEnable = rmtCtl.scaleEnable; } if (transparencyMode != rmtCtl.transparencyMode) { changed = true; redisplay = true; transparencyMode = rmtCtl.transparencyMode; } if (adjustProjectionSeam != rmtCtl.adjustProjectionSeam) { changed = true; redisplay = true; adjustProjectionSeam = rmtCtl.adjustProjectionSeam; } if (texture3DMode != rmtCtl.texture3DMode) { changed = true; redisplay = true; texture3DMode = rmtCtl.texture3DMode; } if (cacheAppearances != rmtCtl.cacheAppearances) { changed = true; cacheAppearances = rmtCtl.cacheAppearances; } if (mergeGeometries != rmtCtl.mergeGeometries) { changed = true; mergeGeometries = rmtCtl.mergeGeometries; } if (projectionPolicy != rmtCtl.projectionPolicy) { changed = true; redisplay = true; projectionPolicy = rmtCtl.projectionPolicy; DisplayRendererJ3D displayRenderer; displayRenderer = (DisplayRendererJ3D) getDisplayRenderer(); if (displayRenderer != null) { displayRenderer.getView().setProjectionPolicy(projectionPolicy); } } if (polygonMode != rmtCtl.polygonMode) { changed = true; polygonMode = rmtCtl.polygonMode; } if (missingTransparent != rmtCtl.missingTransparent) { changed = true; missingTransparent = rmtCtl.missingTransparent; } if (curvedSize != rmtCtl.curvedSize) { changed = true; curvedSize = rmtCtl.curvedSize; } if (!Util.isApproximatelyEqual(polygonOffset, rmtCtl.polygonOffset)) { changed = true; polygonOffset = rmtCtl.polygonOffset; } if (!Util.isApproximatelyEqual(polygonOffsetFactor, rmtCtl.polygonOffsetFactor)) { changed = true; polygonOffsetFactor = rmtCtl.polygonOffsetFactor; } if (anti_alias_flag != rmtCtl.anti_alias_flag) { changed = true; anti_alias_flag = rmtCtl.anti_alias_flag; } if (colorMode != rmtCtl.colorMode) { changed = true; colorMode = rmtCtl.colorMode; } if (lineStyle != rmtCtl.lineStyle) { changed = true; lineStyle = rmtCtl.lineStyle; } if (changed) { try { changeControl(true); } catch (RemoteException re) { throw new VisADException( "Could not indicate that control" + " changed: " + re.getMessage()); } } if (redisplay) { getDisplay().reDisplayAll(); } }