Documentation of 'visad.util.BaseRGBMap' Java class
BaseRGBMap
visad.util

Class BaseRGBMap

  • All Implemented Interfaces:
    java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, ControlListener
    Direct Known Subclasses:
    RGBAMap, RGBMap


    public class BaseRGBMap
    extends ColorMap
    implements ControlListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener
    An extensible RGB colormap with no interpolation between the internally stored values. Click and drag with the left mouse button to draw the color curves. Click with the right or middle mouse button to alternate between the color curves.
    Since:
    Visad Utility Library, 0.5
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.BaselineResizeBehavior
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int DEFAULT_RESOLUTION
      default resolution
      static boolean USE_COLOR_CURSORS
      change this to true to use color cursors
      • Fields inherited from class javax.swing.JComponent

        TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Constructor Summary

      Constructors 
      Constructor and Description
      BaseRGBMap(BaseColorControl ctl)
      Construct a colormap from the specified control.
      BaseRGBMap(boolean hasAlpha)
      Construct a BaseRGBMap with the default resolution
      BaseRGBMap(float[][] vals)
      Construct a colormap initialized with the supplied tuples
      BaseRGBMap(float[][] vals, boolean hasAlpha)
      Deprecated. 
      hasAlpha isn't really necessary.
      BaseRGBMap(int resolution, boolean hasAlpha)
      Construct a colormap with the specified resolution
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void controlChanged(ControlEvent evt)
      If the color data in the Control associated with this widget's Control has changed, update the data in the ColorMap.
      float[][] getColorMap()
      Get the color map (as an array of float tuples.
      int getMapDimension()
      Get the dimension of the map
      int getMapResolution()
      Get the resolution of the map
      java.awt.Dimension getPreferredSize()
      Return the preferred size of this map, taking into account the resolution.
      float[] getRGBTuple(float value)
      Implementation of the abstract function in ColorMap WARNING: This is a really slow way to get a color, so don't use it inside a loop.
      float[][] getRGBTuples(float startVal, float endVal, int num)
      Implementation of the abstract function in ColorMap WARNING: This is a really slow way to get a color, so don't use it inside a loop.
      float[] getTuple(float value)
      Returns the tuple at a floating point value val WARNING: This is a really slow way to get a color, so don't use it inside a loop.
      float[][] getTuples(float firstVal, float lastVal, int num)
      Returns the tuple at a floating point value val
      void mouseClicked(java.awt.event.MouseEvent evt)
      Present to implement MouseListener, currently ignored
      void mouseDragged(java.awt.event.MouseEvent evt)
      Updates the associated Control
      void mouseEntered(java.awt.event.MouseEvent evt)
      MouseListener, currently ignored
      void mouseExited(java.awt.event.MouseEvent evt)
      MouseListener method, currently ignored
      void mouseMoved(java.awt.event.MouseEvent evt)
      MouseMovementListener method, currently ignored
      void mousePressed(java.awt.event.MouseEvent evt)
      Updates the associated Control
      void mouseReleased(java.awt.event.MouseEvent evt)
      Listens for releases of the right mouse button, and changes the active color
      void paint(java.awt.Graphics g)
      Repaints the entire JPanel
      void setPreferredSize(java.awt.Dimension pref)
      Override the widget's calculation for the preferred size of this map.
      void setValues(float[][] newVal)
      Sets the values of the internal array after the map has been created.
      void update(java.awt.Graphics g)
      Repaints the modified areas of the JPanel
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, setUI, updateUI
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • USE_COLOR_CURSORS

        public static boolean USE_COLOR_CURSORS
        change this to true to use color cursors
      • DEFAULT_RESOLUTION

        public static final int DEFAULT_RESOLUTION
        default resolution
        See Also:
        Constant Field Values
    • Constructor Detail

      • BaseRGBMap

        public BaseRGBMap(boolean hasAlpha)
                   throws java.rmi.RemoteException,
                          VisADException
        Construct a BaseRGBMap with the default resolution
        Parameters:
        hasAlpha - set to true is this map has an alpha component
        Throws:
        java.rmi.RemoteException
        VisADException
      • BaseRGBMap

        public BaseRGBMap(int resolution,
                          boolean hasAlpha)
                   throws java.rmi.RemoteException,
                          VisADException
        Construct a colormap with the specified resolution
        Parameters:
        resolution - the length of the array
        hasAlpha - set to true is this map has an alpha component
        Throws:
        java.rmi.RemoteException
        VisADException
      • BaseRGBMap

        public BaseRGBMap(float[][] vals,
                          boolean hasAlpha)
                   throws java.rmi.RemoteException,
                          VisADException
        Deprecated. hasAlpha isn't really necessary.
        Construct a colormap initialized with the supplied tuples
        Parameters:
        vals - the tuples used to initialize the colormap
        hasAlpha - true if the colormap should have an ALPHA component.
        Throws:
        java.rmi.RemoteException
        VisADException
      • BaseRGBMap

        public BaseRGBMap(float[][] vals)
                   throws java.rmi.RemoteException,
                          VisADException
        Construct a colormap initialized with the supplied tuples
        Parameters:
        vals - the tuples used to initialize the colormap See setValues() for constraints on the vals array.
        Throws:
        java.rmi.RemoteException
        VisADException
      • BaseRGBMap

        public BaseRGBMap(BaseColorControl ctl)
        Construct a colormap from the specified control.
        Parameters:
        ctl - control to use as data source
    • Method Detail

      • setValues

        public void setValues(float[][] newVal)
                       throws java.rmi.RemoteException,
                              VisADException
        Sets the values of the internal array after the map has been created. The table should be float[resolution][dimension] where dimension is either 3 (for an RGB table) or 4 (if the table also has an alpha component) and resolution is the number of colors in the table, which must be greater than 4.
        Parameters:
        newVal - the color tuples used to initialize the map.
        Throws:
        java.rmi.RemoteException
        VisADException
      • getMapResolution

        public int getMapResolution()
        Get the resolution of the map
        Specified by:
        getMapResolution in class ColorMap
        Returns:
        the number of colors in the map.
      • getMapDimension

        public int getMapDimension()
        Get the dimension of the map
        Specified by:
        getMapDimension in class ColorMap
        Returns:
        either 3 or 4
      • getColorMap

        public float[][] getColorMap()
        Get the color map (as an array of float tuples.
        Specified by:
        getColorMap in class ColorMap
        Returns:
        a copy of the color map
      • getTuples

        public float[][] getTuples(float firstVal,
                                   float lastVal,
                                   int num)
        Returns the tuple at a floating point value val
        Specified by:
        getTuples in class ColorMap
        Parameters:
        firstVal - the location to start.
        lastVal - the location to finish.
        num - the number of tuples to return.
        Returns:
        The array of 3 or 4 element arrays.
      • getTuple

        public float[] getTuple(float value)
        Returns the tuple at a floating point value val WARNING: This is a really slow way to get a color, so don't use it inside a loop.
        Specified by:
        getTuple in class ColorMap
        Parameters:
        value - the location to return.
        Returns:
        The 3 or 4 element array.
      • getRGBTuples

        public float[][] getRGBTuples(float startVal,
                                      float endVal,
                                      int num)
        Implementation of the abstract function in ColorMap WARNING: This is a really slow way to get a color, so don't use it inside a loop.
        Specified by:
        getRGBTuples in class ColorMap
        Parameters:
        startVal - the first value to translate
        endVal - the last value to translate
        num - the number of values (including the two endpoints) to be returned.
      • getRGBTuple

        public float[] getRGBTuple(float value)
        Implementation of the abstract function in ColorMap WARNING: This is a really slow way to get a color, so don't use it inside a loop.
        Specified by:
        getRGBTuple in class ColorMap
        Parameters:
        value - a floating point number between 0 and 1
        Returns:
        an RGB tuple of floating point numbers in the range 0 to 1
      • mouseClicked

        public void mouseClicked(java.awt.event.MouseEvent evt)
        Present to implement MouseListener, currently ignored
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
        Parameters:
        evt - ignored
      • mouseEntered

        public void mouseEntered(java.awt.event.MouseEvent evt)
        MouseListener, currently ignored
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
        Parameters:
        evt - ignored
      • mouseExited

        public void mouseExited(java.awt.event.MouseEvent evt)
        MouseListener method, currently ignored
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
        Parameters:
        evt - ignored
      • mousePressed

        public void mousePressed(java.awt.event.MouseEvent evt)
        Updates the associated Control
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
        Parameters:
        evt - the mouse press event
      • mouseReleased

        public void mouseReleased(java.awt.event.MouseEvent evt)
        Listens for releases of the right mouse button, and changes the active color
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
        Parameters:
        evt - the release event
      • mouseDragged

        public void mouseDragged(java.awt.event.MouseEvent evt)
        Updates the associated Control
        Specified by:
        mouseDragged in interface java.awt.event.MouseMotionListener
        Parameters:
        evt - the drag event
      • mouseMoved

        public void mouseMoved(java.awt.event.MouseEvent evt)
        MouseMovementListener method, currently ignored
        Specified by:
        mouseMoved in interface java.awt.event.MouseMotionListener
        Parameters:
        evt - ignored
      • paint

        public void paint(java.awt.Graphics g)
        Repaints the entire JPanel
        Overrides:
        paint in class javax.swing.JComponent
        Parameters:
        g - The Graphics to update.
      • update

        public void update(java.awt.Graphics g)
        Repaints the modified areas of the JPanel
        Overrides:
        update in class javax.swing.JComponent
        Parameters:
        g - The Graphics to update.
      • getPreferredSize

        public java.awt.Dimension getPreferredSize()
        Return the preferred size of this map, taking into account the resolution.
        Overrides:
        getPreferredSize in class javax.swing.JComponent
        Returns:
        preferred size.
      • setPreferredSize

        public void setPreferredSize(java.awt.Dimension pref)
        Override the widget's calculation for the preferred size of this map.
        Overrides:
        setPreferredSize in class javax.swing.JComponent
        Parameters:
        pref - preferred size.
      • controlChanged

        public void controlChanged(ControlEvent evt)
                            throws java.rmi.RemoteException,
                                   VisADException
        If the color data in the Control associated with this widget's Control has changed, update the data in the ColorMap.
        Specified by:
        controlChanged in interface ControlListener
        Parameters:
        evt - Data from the changed Control.
        Throws:
        java.rmi.RemoteException
        VisADException

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.