Class PanamaGLSWTCanvas
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable, ICanvas, IPanamaGLCanvas, IScreenCanvas
Composite hosting a PanamaGL-backed GLCanvasSWT.
Ships the very same PanamaGLCanvasSupport plumbing as the Swing and JavaFX panels, while
exposing itself as a regular SWT Composite so it can be dropped into any SWT widget
hierarchy.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<ICanvasListener> protected panamagl.canvas.swt.GLCanvasSWTprotected PanamaGLCanvasSupportFields inherited from class org.eclipse.swt.widgets.Composite
embeddedHandleFields inherited from class org.eclipse.swt.widgets.Widget
handleFields inherited from interface ICanvas
ALLOW_WATCH_PIXEL_SCALE, LAST_RENDER_TIME_UNDEFINED -
Constructor Summary
ConstructorsConstructorDescriptionPanamaGLSWTCanvas(IChartFactory factory, org.jzy3d.plot3d.rendering.scene.Scene scene, Quality quality, org.eclipse.swt.widgets.Composite parent, panamagl.canvas.swt.GLCanvasSWT glCanvas) Advanced / test-friendly constructor: inject a pre-builtGLCanvasSWT.PanamaGLSWTCanvas(IChartFactory factory, org.jzy3d.plot3d.rendering.scene.Scene scene, Quality quality, org.eclipse.swt.widgets.Composite parent, panamagl.factory.PanamaGLFactory panamaGLFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCanvasListener(ICanvasListener listener) voidvoidRegister an SWT controller on the underlyingGLCanvasSWT.voiddisplay()voiddispose()protected voidfirePixelScaleChanged(double pixelScaleX, double pixelScaleY) voidorg.jzy3d.maths.Dimensionpanamagl.canvas.GLCanvaspanamagl.GLEventListenerdoubleorg.jzy3d.maths.Coord2dorg.jzy3d.maths.Coord2dintintRenderer dimensions are reported in physical pixels, matching the FBO size that the underlyingGLCanvasSWTallocates.getView()booleanisNative()voidremoveCanvasListener(ICanvasListener listener) voidvoidvoidscreenshot(File file) voidsetGLEventListener(panamagl.GLEventListener listener) voidsetPixelScale(float[] scale) Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabListMethods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBarMethods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isAutoScalable, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, updateMethods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ICanvas
setPixelScale
-
Field Details
-
glCanvas
protected panamagl.canvas.swt.GLCanvasSWT glCanvas -
support
-
canvasListeners
-
-
Constructor Details
-
PanamaGLSWTCanvas
public PanamaGLSWTCanvas(IChartFactory factory, org.jzy3d.plot3d.rendering.scene.Scene scene, Quality quality, org.eclipse.swt.widgets.Composite parent, panamagl.factory.PanamaGLFactory panamaGLFactory) -
PanamaGLSWTCanvas
public PanamaGLSWTCanvas(IChartFactory factory, org.jzy3d.plot3d.rendering.scene.Scene scene, Quality quality, org.eclipse.swt.widgets.Composite parent, panamagl.canvas.swt.GLCanvasSWT glCanvas) Advanced / test-friendly constructor: inject a pre-builtGLCanvasSWT. The supplied canvas is re-parented to this composite so that theFillLayoutcan drive its size. Use the main constructor in application code.
-
-
Method Details
-
firePixelScaleChanged
protected void firePixelScaleChanged(double pixelScaleX, double pixelScaleY) -
getGLCanvas
public panamagl.canvas.GLCanvas getGLCanvas()Methods that simply forward toglCanvasgo through the field directly rather than throughsupport.SWT's
ThreadRedirect_SWTruns the GL init synchronously when already on the display thread, which is exactly the case whilePanamaGLCanvasSupport's constructor wiresglCanvas.setGLEventListener(renderer). The init walks back throughRenderer3D.init -> View.initinto the canvas — firstPanamaGLPainter.configureGL(Quality)callsgetGLCanvas(), thenView.initResources -> updateBounds -> shootcallsforceRepaint()— all beforesupporthas been assigned. CallingglCanvaskeeps these paths NPE-free; the field andsupport.getGLCanvas()reference the same object.- Specified by:
getGLCanvasin interfaceIPanamaGLCanvas
-
getGLEventListener
public panamagl.GLEventListener getGLEventListener()- Specified by:
getGLEventListenerin interfaceIPanamaGLCanvas
-
setGLEventListener
public void setGLEventListener(panamagl.GLEventListener listener) - Specified by:
setGLEventListenerin interfaceIPanamaGLCanvas
-
isNative
-
getView
-
getRendererWidth
public int getRendererWidth()Renderer dimensions are reported in physical pixels, matching the FBO size that the underlyingGLCanvasSWTallocates.Viewuses these values to build theViewportConfigurationthat drivesglViewport; on a Retina display the FBO is2W x 2Hso we must return2Wand2Hhere, otherwiseglViewport(0, 0, W, H)only fills the bottom-left quadrant of the FBO.When HiDPI is disabled (Jzy3D's
Quality.preserveViewportSize=true), the FBO is already in logical pixels andgetPhysicalWidth()returns the logical width.- Specified by:
getRendererWidthin interfaceICanvas
-
getRendererHeight
public int getRendererHeight()- Specified by:
getRendererHeightin interfaceICanvas
-
screenshot
- Specified by:
screenshotin interfaceICanvas- Throws:
IOException
-
screenshot
- Specified by:
screenshotin interfaceICanvas
-
display
public void display()- Specified by:
displayin interfaceIScreenCanvas
-
forceRepaint
public void forceRepaint()- Specified by:
forceRepaintin interfaceICanvas
-
dispose
-
addMouseController
Register an SWT controller on the underlyingGLCanvasSWT.The controller is expected to implement one or more of SWT's mouse listener interfaces (
MouseListener,MouseMoveListener,MouseWheelListener,MouseTrackListener). Each implemented interface is wired up to the canvas; missing ones are silently ignored — same lenient behavior as the AWT canvas'saddMouseController(Object).- Specified by:
addMouseControllerin interfaceICanvas
-
addKeyController
- Specified by:
addKeyControllerin interfaceICanvas
-
removeMouseController
- Specified by:
removeMouseControllerin interfaceICanvas
-
removeKeyController
- Specified by:
removeKeyControllerin interfaceICanvas
-
getDebugInfo
- Specified by:
getDebugInfoin interfaceICanvas
-
setPixelScale
public void setPixelScale(float[] scale) - Specified by:
setPixelScalein interfaceICanvas- See Also:
-
getPixelScale
public org.jzy3d.maths.Coord2d getPixelScale()- Specified by:
getPixelScalein interfaceICanvas
-
getPixelScaleJVM
public org.jzy3d.maths.Coord2d getPixelScaleJVM()- Specified by:
getPixelScaleJVMin interfaceICanvas
-
getLastRenderingTimeMs
public double getLastRenderingTimeMs()- Specified by:
getLastRenderingTimeMsin interfaceICanvas
-
addCanvasListener
- Specified by:
addCanvasListenerin interfaceICanvas
-
removeCanvasListener
- Specified by:
removeCanvasListenerin interfaceICanvas
-
getCanvasListeners
- Specified by:
getCanvasListenersin interfaceICanvas
-
getAnimation
- Specified by:
getAnimationin interfaceIScreenCanvas
-
getDimension
public org.jzy3d.maths.Dimension getDimension()- Specified by:
getDimensionin interfaceICanvas
-