DrawingAttributes (OpenMap API)
Date: 2016-12-09

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.omGraphics
Class DrawingAttributes

    java.lang.Object
      com.bbn.openmap.omGraphics.DrawingAttributes

All Implemented Interfaces:
  ShapeRenderer, PropertyConsumer, java.awt.event.ActionListener, java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

Direct Known Subclasses:
  FeatureDrawingAttributes, GraphicAttributes

    public class DrawingAttributes

extends java.lang.Object
implements java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, PropertyConsumer, java.beans.PropertyChangeListener, ShapeRenderer

DrawingAttributes provides a mechanism for loading and managing different drawing attributes that may be used. Several layers need to be able to have Properties define how objects should be drawn, and the list of these drawing attributes tend to be the same. The DrawingAttributes class fishes out the applicable properties for you, creates the objects needed, and then lets you get those objects when needed.

The list of properties that the DrawingAttributes object can handle are listed below. If a property is not set, the default value will be used.

         # The Edge or Line color
         lineColor=AARRGGBB (Hex ARGB Color, black is default)
         # The Fill color for 2D shapes
         fillColor=AARRGGBB (Hex ARGB Color, clean is default)
         # A highlight color to switch a graphic to when "selected".
         selectColor=AARRGGBB (Hex ARGB Color, black is default)
         # A file or URL that can be used for a fill pattern, in place of the fill color.
         fillPattern=file://file (default is N/A)
         # The line width of the edge of the graphic
         lineWidth=int (1 is default)
         # A pattern to use for a dashed line, reflected as a
         # space-separated list of numbers, which are interpreted as on dash
         # length, off dash length, on dash length, etc.
         dashPattern=10 5 3 5 (5 5 is the default if an error occurs reading the numbers, a non-dashed line is the default.)
         The phase for the dash pattern,
         dashPhase=0.0f (0 is the default)
         # The scale to use for certain measurements, so that fill patterns
         # can be scaled depending on the map scale compared to the
         # baseScale.
         baseScale=XXXXXX (where 1:XXXXXX is the scale to use.  N/A for the default).
         # Set whether any OMPoints that are given to the DrawingAttributes object are oval or rectangle.
         pointOval=false
         # Set the pixel radius of any OMPoint given to the DrawingAttributes object.
         pointRadius=2

See Also:
  Serialized Form

Nested Class Summary
`static class` | `DrawingAttributes.Builder` Builders are usually for immutable objects, but it seems kinda handy to have one for this class, to eliminate lines of code.
`protected static class` | `DrawingAttributes.DrawingAttributesGUIButton` A JButton that listens for PropertyChange notifications from a DrawingAttributes object, so it can update its icon.

Field Summary
`static boolean` | `alwaysSetTextToBlack`
`protected float` | `baseScale` The base scale for scaling the fill pattern image.
`static java.lang.String` | `baseScaleProperty` The base scale to use for the image provided for the fill pattern.
`protected BasicStrokeEditorMenu` | `bse`
`static java.lang.String` | `capProperty` The name of the property that holds the cap for the ends of lines.
`static java.lang.String` | `dashPatternProperty` The name of the property that holds a dashed pattern for lines.
`static java.lang.String` | `dashPhaseProperty` The name of the property that holds a dashed phase for lines.
`static DrawingAttributes` | `DEFAULT` A good ol' generic DrawingAttributes object for all to use.
`static float` | `defaultDashLength` The default dash length, for opaque and transparent parts.
`static float` | `defaultDashPhase` The default dash phase, which is zero.
`static java.lang.String` | `defaultFillPaintString` The default fill paint.
`static java.lang.String` | `defaultLinePaintString` The default line paint.
`static float` | `defaultLineWidth` The default line width
`static java.lang.String` | `defaultMattingPaintString` The default matting paint.
`static java.lang.String` | `defaultSelectPaintString` The default fill paint.
`protected boolean` | `enableFillPaintChoice` Flag to disable choice of fill paint selection, from an external source.
`static java.lang.String` | `FillColorCommand` Command for fill color string adjustments.
`protected javax.swing.JMenuItem` | `fillColorItem`
`protected java.awt.Paint` | `fillPaint` The paint to fill the shapes.
`static java.lang.String` | `fillPaintProperty` The name of the property that holds the fill paint of the graphics.
`protected java.awt.TexturePaint` | `fillPattern` A TexturePaint pattern, if defined.
`static java.lang.String` | `fillPatternProperty` The property that specifies an URL or file a image file to be used to construct the Paint object for a texture fill pattern.
`protected java.lang.String` | `fPattern`
`protected I18n` | `i18n` For internationalization.
`protected static int` | `icon_height`
`protected static int` | `icon_width`
`static java.lang.String` | `joinProperty` The name of the property that holds the join for lines.
`static java.lang.String` | `LineColorCommand` Command for line color string adjustments.
`protected javax.swing.JMenuItem` | `lineColorItem`
`protected javax.swing.JMenu[]` | `lineMenuAdditions` Any additional JMenu items that should be added to the line menu.
`protected java.awt.Paint` | `linePaint` The paint to outline the shapes.
`static java.lang.String` | `linePaintProperty` The name of the property that holds the line paint of the graphics.
`static java.lang.String` | `lineWidthProperty` The name of the property that holds the lineWidth of the graphics.
`protected static java.util.logging.Logger` | `logger`
`protected boolean` | `matted` Whether a thin black matting line should be rendered around the OMGraphic.
`static java.lang.String` | `MattedCommand` Command for adding matting.
`protected javax.swing.JCheckBoxMenuItem` | `mattedEnabledItem`
`static java.lang.String` | `mattedProperty` Set whether a thin black matting should be drawing around the OMGraphic.
`static java.lang.String` | `MattingColorCommand` Command for matting color string adjustments.
`protected javax.swing.JMenuItem` | `mattingColorItem`
`protected java.awt.Paint` | `mattingPaint` The paint to use for matting.
`static java.lang.String` | `mattingPaintProperty` The name of the property that holds the matting paint of the graphics, which is the wider line paint that gets set when matting is enabled.
`static java.lang.String` | `miterLimitProperty` The name of the property that controls miterLimits.
`static int` | `NONE`
`protected int` | `orientation`
`protected boolean` | `pointOval` The isOval setting to set on OMPoints.
`static java.lang.String` | `PointOvalProperty` Property for whether OMPoints should be oval.
`protected int` | `pointRadius` The pixel radius to set on OMPoints.
`static java.lang.String` | `PointRadiusProperty` Property for the pixel radius of OMPoints.
`protected java.beans.PropertyChangeSupport` | `propertyChangeSupport` Support object to notify listeners when something has changed.
`protected java.lang.String` | `propertyPrefix`
`static java.lang.String` | `SelectColorCommand` Command for select color string adjustments.
`protected javax.swing.JMenuItem` | `selectColorItem`
`protected java.awt.Paint` | `selectPaint` The select paint for the shapes.
`static java.lang.String` | `selectPaintProperty` The name of the property that holds the select paint of the graphics, which is the line paint that gets set with the default OMGraphic.select() action.
`protected java.awt.Stroke` | `stroke` The line stroke, for dashes, etc.

Fields inherited from interface com.bbn.openmap.PropertyConsumer
`EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty`

Constructor Summary
`DrawingAttributes()` Create a DrawingAttributes with the default settings - clear fill paint and pattern, sold black edge line of width 1.
`DrawingAttributes(java.util.Properties props)` Create the DrawingAttributes and call setProperties without a prefix for the properties.
`DrawingAttributes(java.lang.String prefix, java.util.Properties props)` Create the DrawingAttributes and call setProperties with a prefix for the properties.

Method Summary
`void` | `actionPerformed(java.awt.event.ActionEvent e)` The DrawingAttributes method for handling ActionEvents.
`static java.awt.Color` | `calculateTextColor(java.awt.Color color)`
`java.lang.Object` | `clone()` Shallow clone.
`java.awt.Stroke` | `cloneBasicStroke()`
`boolean` | `equals(java.lang.Object obj)`
`javax.swing.JButton` | `getALineButton()` Get a JButton used to bring up the line menu.
`float` | `getBaseScale()` Get the base scale that the texture paint and dashes are set for.
`BasicStrokeEditorMenu` | `getBasicStrokeEditor()`
`javax.swing.JMenu` | `getColorAndLineMenu()`
`javax.swing.JMenu` | `getColorMenu()` Gets the JMenu that has the color control options.
`static DrawingAttributes` | `getDefaultClone()` If you want to get a DEFAULT DrawingAttributes object that you may modify, get your own copy.
`static javax.swing.ImageIcon` | `getDrawingAttributesIcon(DrawingAttributes attributes, int width, int height, boolean horizontalOrientation)` Given a BasicStroke, create an ImageIcon that shows it.
`java.awt.Paint` | `getFillPaint()` Get the fill paint for the graphics created for the coverage type.
`java.awt.Paint` | `getFillPaintForScale(float scale)` Get the Paint for these attributes, and scale it for the scale compared to the base scale set if the fill Paint is a TexturePattern.
`java.awt.TexturePaint` | `getFillPattern()` Get the TexturePaint set as the fill pattern.
`static java.awt.Paint` | `getGradientPaintForShape(java.awt.Shape shape, java.awt.Paint paint)` Create a GradientPaint object for the given shape.
`java.awt.Component` | `getGUI()` Get the GUI components that control the DrawingAttributes.
`static javax.swing.ImageIcon` | `getIconForPaint(java.awt.Paint paint, boolean fill)`
`java.lang.String` | `getInitPropertiesOrder()`
`javax.swing.JMenu[]` | `getLineMenuAdditions()`
`java.awt.Paint` | `getLinePaint()` Get the line paint for the graphics created for the coverage type.
`protected boolean` | `getLock()` Get the lock to use a JColorChooser.
`static javax.swing.ImageIcon` | `getMattedIcon(java.awt.Paint mattingPaint, java.awt.Paint linePaint)`
`javax.swing.ImageIcon` | `getMattingIconForPaint()`
`java.awt.Paint` | `getMattingPaint()` Get the matting paint for the OMGraphics
`protected java.awt.Color` | `getNewPaint(java.awt.Component source, java.lang.String title, java.awt.Color startingColor)` A convenience method to get a color from a JColorChooser.
`int` | `getOrientation()`
`static javax.swing.ImageIcon` | `getPaletteIcon(java.awt.Paint paint, int width, int height)` Create an ImageIcon from a java.awt.Paint.
`int` | `getPointRadius()` Get the pixel radius given to OMPoint objects.
`java.util.Properties` | `getProperties(java.util.Properties props)` PropertyConsumer method, to fill in a Properties object, reflecting the current values of the layer.
`java.beans.PropertyChangeSupport` | `getPropertyChangeSupport()` Get the PropertyChangeSupport object to register anything that is interested in finding out when some parameter has changed.
`java.util.Properties` | `getPropertyInfo(java.util.Properties list)` Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer.
`java.lang.String` | `getPropertyPrefix()` Get the property key prefix that is being used to prepend to the property keys for Properties lookups.
`java.awt.Paint` | `getSelectPaint()` Get the line paint for the graphics created for the coverage type.
`java.awt.Stroke` | `getStroke()` Get the Stroke used for the lines of a graphic.
`java.awt.Stroke` | `getStrokeForScale(float scale)` Get the Stroke object, scaled for comparison to the base scale.
`int` | `hashCode()`
`void` | `init(java.util.Properties props)` Deprecated. use setProperties(props).
`void` | `init(java.lang.String prefix, java.util.Properties props)` Deprecated. use setProperties(prefix, props).
`static boolean` | `isClear(java.awt.Paint paint)` Checks if the Paint is clear.
`boolean` | `isEnableFillPaintChoice()`
`boolean` | `isMatted()` Return whether the OMGraphic has matting around the edge.
`boolean` | `isPointOval()` Get the oval setting given to OMPoint objects.
`static int` | `normalizeOn128(int value)`
`void` | `propertyChange(java.beans.PropertyChangeEvent pce)`
`protected void` | `releaseLock()` Release the lock on the JColorChooser.
`void` | `render(java.awt.Graphics2D g, java.awt.Shape shape)` Render the Shape into the Graphics2D object, using the mattingPaint, fillPaint, fillPattern, linePaint and stroke contained in this DrawingAttributes object.
`void` | `render(java.awt.Graphics2D g, java.awt.Shape shape, boolean replaceColorWithGradient)` Render the Shape into the Graphics2D object, using the mattingPaint, fillPaint, fillPattern, linePaint and stroke contained in this DrawingAttributes object.
`void` | `resetGUI()` Updates the color and line stroke control buttons to match the current settings.
`void` | `setBaseScale(float bScale)` Set the base scale to use for the texture paint and stroke.
`void` | `setEnableFillPaintChoice(boolean enableFillPaintChoice)`
`void` | `setFillPaint(java.awt.Paint fPaint)` Set the fill paint for the graphics created for the coverage type.
`void` | `setFillPattern(java.awt.TexturePaint fPattern)` Set the fill pattern TexturePaint to be used as the fill color.
`void` | `setFrom(OMGraphic graphic)` Set the DrawingAttributes parameters based on the current settings of an OMGraphic.
`void` | `setFrom(OMGraphic graphic, boolean resetGUI)` Set the DrawingAttributes parameters based on the current settings of an OMGraphic, and reset the GUI of the DrawingAttributes object if desired.
`void` | `setLineMenuAdditions(javax.swing.JMenu[] lma)` A hook to add to the line menu brought up in the GUI for the DrawingAttributes.
`void` | `setLinePaint(java.awt.Paint lPaint)` Set the edge paint for the graphics created for the coverage type.
`void` | `setMatted(boolean set)` Set whether the OMGraphic should have matting around the edge.
`void` | `setMattingPaint(java.awt.Paint mPaint)` Set the matting paint for the graphics created for the coverage type.
`void` | `setOMGraphicAttributesForScale(OMGraphic graphic, float scale)` Set all the attributes for the graphic that are contained within this DrawingAttributes class.
`void` | `setOMGraphicEdgeAttributes(OMGraphic graphic)` Set the graphic attributes that only pertain to boundaries.
`void` | `setOMGraphicEdgeAttributesForScale(OMGraphic graphic, float scale)` Set the graphic attributes that only pertain to boundaries.
`void` | `setOrientation(int orientation)`
`void` | `setPointOval(boolean value)` Set the oval setting given to OMPoint objects.
`void` | `setPointRadius(int radius)` Set the pixel radius given to OMPoint objects.
`protected void` | `setPostStrokeMenuOptions(javax.swing.JComponent popup)` Callout method to add stuff to menu after the stroke menus.
`protected void` | `setPreStrokeMenuOptions(javax.swing.JComponent popup)` Callout method to add stuff to popup menu before the stroke editor is consulted for additions.
`void` | `setProperties(java.util.Properties props)` Sets the properties for the `DrawingAttributes`.
`void` | `setProperties(java.lang.String prefix, java.util.Properties props)` Sets the properties for the `DrawingAttributes`.
`void` | `setPropertyChangeSupport(java.beans.PropertyChangeSupport support)`
`void` | `setPropertyPrefix(java.lang.String prefix)` Set the property key prefix that should be used by the PropertyConsumer.
`void` | `setSelectPaint(java.awt.Paint sPaint)` Set the selected edge paint for the graphics created for the coverage type.
`void` | `setStroke(java.awt.Stroke stroke)` Set the Stroke to use for the edge of a graphic.
`protected void` | `setStrokeMenuOptions(javax.swing.JComponent popup)` Calls the editor for strokes to get popup menu addition for stroke editing.
`void` | `setTo(DrawingAttributes clone)` Shallow.
`void` | `setTo(OMGraphic graphic)` Set all the attributes for the graphic that are contained within this DrawingAttributes class.
`void` | `setTo(OMGraphic graphic, boolean resetGUI)` Set all the attributes for the graphic that are contained within this DrawingAttributes class.
`static void` | `sTransfer(OMGraphic from, OMGraphic to)` Simple push of OMGraphic attributes from one to another.
`java.lang.String` | `toString()`
`void` | `transfer(OMGraphic from, OMGraphic to)` Simple push of OMGraphic attributes from one to another.

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### logger

    protected static java.util.logging.Logger logger

### linePaintProperty

    public static final java.lang.String linePaintProperty

  The name of the property that holds the line paint of the graphics.

  See Also:
    Constant Field Values

### fillPaintProperty

    public static final java.lang.String fillPaintProperty

  The name of the property that holds the fill paint of the graphics.

  See Also:
    Constant Field Values

### selectPaintProperty

    public static final java.lang.String selectPaintProperty

  The name of the property that holds the select paint of the graphics, which is the line paint that gets set with the default OMGraphic.select() action.

  See Also:
    Constant Field Values

### mattingPaintProperty

    public static final java.lang.String mattingPaintProperty

  The name of the property that holds the matting paint of the graphics, which is the wider line paint that gets set when matting is enabled.

  See Also:
    Constant Field Values

### fillPatternProperty

    public static final java.lang.String fillPatternProperty

  The property that specifies an URL or file a image file to be used to construct the Paint object for a texture fill pattern. If the fillPattern is null, the fillPaint will be used.

  See Also:
    Constant Field Values

### lineWidthProperty

    public static final java.lang.String lineWidthProperty

  The name of the property that holds the lineWidth of the graphics.

  See Also:
    Constant Field Values

### dashPatternProperty

    public static final java.lang.String dashPatternProperty

  The name of the property that holds a dashed pattern for lines. This will be used to build the stroke object for lines. This pattern should be two space-separated numbers, the first representing the pixel length of the line in the dash, the second being the space pixel length of the dash.

  See Also:
    Constant Field Values

### dashPhaseProperty

    public static final java.lang.String dashPhaseProperty

  The name of the property that holds a dashed phase for lines. This will be used to build the stroke object for lines.

  See Also:
    Constant Field Values

### capProperty

    public static final java.lang.String capProperty

  The name of the property that holds the cap for the ends of lines. BasicStroke values apply, CAP_BUTT, CAP_ROUND, CAP_SQUARE.

  See Also:
    Constant Field Values

### joinProperty

    public static final java.lang.String joinProperty

  The name of the property that holds the join for lines. BasicStroke values apply, JOIN_MITER, JOIN_ROUND, JOIN_BEVEL.

  See Also:
    Constant Field Values

### miterLimitProperty

    public static final java.lang.String miterLimitProperty

  The name of the property that controls miterLimits.

  See Also:
    Constant Field Values

### baseScaleProperty

    public static final java.lang.String baseScaleProperty

  The base scale to use for the image provided for the fill pattern. As the scale of the map changes, the base scale can be used as a reference to change the resolution of the pattern. This scale will also be used for strokes.

  See Also:
    Constant Field Values

### mattedProperty

    public static final java.lang.String mattedProperty

  Set whether a thin black matting should be drawing around the OMGraphic.

  See Also:
    Constant Field Values

### PointOvalProperty

    public static final java.lang.String PointOvalProperty

  Property for whether OMPoints should be oval. "pointOval"

  See Also:
    Constant Field Values

### PointRadiusProperty

    public static final java.lang.String PointRadiusProperty

  Property for the pixel radius of OMPoints. "pointRadius"

  See Also:
    Constant Field Values

### NONE

    public static final int NONE

See Also:
  Constant Field Values

### defaultLinePaintString

    public static final java.lang.String defaultLinePaintString

  The default line paint. (black)

  See Also:
    Constant Field Values

### defaultFillPaintString

    public static final java.lang.String defaultFillPaintString

  The default fill paint. (none)

  See Also:
    Constant Field Values

### defaultSelectPaintString

    public static final java.lang.String defaultSelectPaintString

  The default fill paint. (black)

  See Also:
    Constant Field Values

### defaultMattingPaintString

    public static final java.lang.String defaultMattingPaintString

  The default matting paint. (black)

  See Also:
    Constant Field Values

### defaultLineWidth

    public static final float defaultLineWidth

  The default line width

  See Also:
    Constant Field Values

### defaultDashPhase

    public static final float defaultDashPhase

  The default dash phase, which is zero.

  See Also:
    Constant Field Values

### defaultDashLength

    public static final float defaultDashLength

  The default dash length, for opaque and transparent parts.

  See Also:
    Constant Field Values

### linePaint

    protected java.awt.Paint linePaint

  The paint to outline the shapes.

### selectPaint

    protected java.awt.Paint selectPaint

  The select paint for the shapes.

### fillPaint

    protected java.awt.Paint fillPaint

  The paint to fill the shapes.

### mattingPaint

    protected java.awt.Paint mattingPaint

  The paint to use for matting.

### fillPattern

    protected java.awt.TexturePaint fillPattern

  A TexturePaint pattern, if defined. Overrules fillPaint if fillPaint is null or clear.

### stroke

    protected transient java.awt.Stroke stroke

  The line stroke, for dashes, etc.

### baseScale

    protected float baseScale

  The base scale for scaling the fill pattern image. If NONE, then the resolution of the raw image will always be used.

### matted

    protected boolean matted

  Whether a thin black matting line should be rendered around the OMGraphic.

### propertyPrefix

    protected java.lang.String propertyPrefix

### fPattern

    protected java.lang.String fPattern

### pointOval

    protected boolean pointOval

  The isOval setting to set on OMPoints.

### pointRadius

    protected int pointRadius

  The pixel radius to set on OMPoints.

### DEFAULT

    public static final DrawingAttributes DEFAULT

  A good ol' generic DrawingAttributes object for all to use. Black lines, clear fill paint.

### propertyChangeSupport

    protected java.beans.PropertyChangeSupport propertyChangeSupport

  Support object to notify listeners when something has changed.

### i18n

    protected I18n i18n

  For internationalization.

### LineColorCommand

    public static final java.lang.String LineColorCommand

  Command for line color string adjustments.

  See Also:
    Constant Field Values

### FillColorCommand

    public static final java.lang.String FillColorCommand

  Command for fill color string adjustments.

  See Also:
    Constant Field Values

### SelectColorCommand

    public static final java.lang.String SelectColorCommand

  Command for select color string adjustments.

  See Also:
    Constant Field Values

### MattingColorCommand

    public static final java.lang.String MattingColorCommand

  Command for matting color string adjustments.

  See Also:
    Constant Field Values

### MattedCommand

    public static final java.lang.String MattedCommand

  Command for adding matting.

  See Also:
    Constant Field Values

### lineColorItem

    protected javax.swing.JMenuItem lineColorItem

### fillColorItem

    protected javax.swing.JMenuItem fillColorItem

### selectColorItem

    protected javax.swing.JMenuItem selectColorItem

### mattingColorItem

    protected javax.swing.JMenuItem mattingColorItem

### mattedEnabledItem

    protected javax.swing.JCheckBoxMenuItem mattedEnabledItem

### icon_width

    protected static final int icon_width

See Also:
  Constant Field Values

### icon_height

    protected static final int icon_height

See Also:
  Constant Field Values

### enableFillPaintChoice

    protected boolean enableFillPaintChoice

  Flag to disable choice of fill paint selection, from an external source.

### alwaysSetTextToBlack

    public static boolean alwaysSetTextToBlack

### bse

    protected transient BasicStrokeEditorMenu bse

### orientation

    protected int orientation

### lineMenuAdditions

    protected javax.swing.JMenu[] lineMenuAdditions

  Any additional JMenu items that should be added to the line menu.

Constructor Detail

### DrawingAttributes

    public DrawingAttributes()

  Create a DrawingAttributes with the default settings - clear fill paint and pattern, sold black edge line of width 1.

### DrawingAttributes

    public DrawingAttributes(java.util.Properties props)

  Create the DrawingAttributes and call setProperties without a prefix for the properties. Call setProperties without a prefix for the properties.

  Parameters:
    `props` - the Properties to look in.

### DrawingAttributes

    public DrawingAttributes(java.lang.String prefix,
                             java.util.Properties props)

  Create the DrawingAttributes and call setProperties with a prefix for the properties.

  Parameters:
    `prefix` - the prefix marker to use for a property, like prefix.propertyName. The period is added in this function.
    `props` - the Properties to look in.

Method Detail

### clone

    public java.lang.Object clone()

  Shallow clone.

  Overrides:
    `clone` in class `java.lang.Object`

### cloneBasicStroke

    public java.awt.Stroke cloneBasicStroke()

### setTo

    public void setTo(DrawingAttributes clone)

  Shallow.

### equals

    public boolean equals(java.lang.Object obj)

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### getDefaultClone

    public static DrawingAttributes getDefaultClone()

  If you want to get a DEFAULT DrawingAttributes object that you may modify, get your own copy.

### transfer

    public void transfer(OMGraphic from,
                         OMGraphic to)

  Simple push of OMGraphic attributes from one to another.

### sTransfer

    public static void sTransfer(OMGraphic from,
                                 OMGraphic to)

  Simple push of OMGraphic attributes from one to another. Don't put in a loop, creates a DrawingAttributes object to do the transfer. If in a loop, create one and reuse it with the none-static method.

  Parameters:
    `from` -
    `to` -

### init

    public void init(java.util.Properties props)

  Deprecated. use setProperties(props).

  Call setProperties without a prefix for the properties.

  Parameters:
    `props` - the Properties to look in.

### init

    public void init(java.lang.String prefix,
                     java.util.Properties props)

  Deprecated. use setProperties(prefix, props).

  Look at the Properties, and fill in the drawing attributes based in it's contents. If a property is not in the properties, it's set to its default setting.

  Parameters:
    `prefix` - the prefix marker to use for a property, like prefix.propertyName. The period is added in this function.
    `props` - the Properties to look in.

### setStroke

    public void setStroke(java.awt.Stroke stroke)

  Set the Stroke to use for the edge of a graphic.

### getStroke

    public java.awt.Stroke getStroke()

  Get the Stroke used for the lines of a graphic.

### getStrokeForScale

    public java.awt.Stroke getStrokeForScale(float scale)

  Get the Stroke object, scaled for comparison to the base scale. If the base scale equals NONE, it's the same as getStroke().

  Parameters:
    `scale` - scale to compare to the base scale.

### getFillPaintForScale

    public java.awt.Paint getFillPaintForScale(float scale)

  Get the Paint for these attributes, and scale it for the scale compared to the base scale set if the fill Paint is a TexturePattern. If the base scale equals NONE, or if the Paint is not a TexturePaint, it's the same as getFillPaint().

  Parameters:
    `scale` - scale to compare to the base scale.
  Returns:
    a Paint object to use for the fill, scaled if necessary.

### setLinePaint

    public void setLinePaint(java.awt.Paint lPaint)

  Set the edge paint for the graphics created for the coverage type.

  Parameters:
    `lPaint` - the paint.

### getLinePaint

    public java.awt.Paint getLinePaint()

  Get the line paint for the graphics created for the coverage type.

  Returns:
    the line paint to use for the edges.

### setSelectPaint

    public void setSelectPaint(java.awt.Paint sPaint)

  Set the selected edge paint for the graphics created for the coverage type.

  Parameters:
    `sPaint` - the paint.

### getSelectPaint

    public java.awt.Paint getSelectPaint()

  Get the line paint for the graphics created for the coverage type.

  Returns:
    the select line paint to use for the edges.

### setFillPaint

    public void setFillPaint(java.awt.Paint fPaint)

  Set the fill paint for the graphics created for the coverage type.

  Parameters:
    `fPaint` - the paint.

### getFillPaint

    public java.awt.Paint getFillPaint()

  Get the fill paint for the graphics created for the coverage type. This used to return the fillPattern if it was defined. Now, it always returns the fillPaint.

  Returns:
    the fill paint to use for the areas.

### setMattingPaint

    public void setMattingPaint(java.awt.Paint mPaint)

  Set the matting paint for the graphics created for the coverage type. The matting paint is the paint used for the matting line painted around the edge, two pixels wider than the edge line width. Black by default, only painted when the matting variable is set to true.

  Parameters:
    `mPaint` - the paint.

### getMattingPaint

    public java.awt.Paint getMattingPaint()

  Get the matting paint for the OMGraphics

  Returns:
    the matting paint to use for the areas.

### setFillPattern

    public void setFillPattern(java.awt.TexturePaint fPattern)

  Set the fill pattern TexturePaint to be used as the fill color. If not null, the fillPattern will be returned from getFillPaint() instead of fillPaint.

  Parameters:
    `fPattern` - the TexturePaint to set.

### getFillPattern

    public java.awt.TexturePaint getFillPattern()

  Get the TexturePaint set as the fill pattern.

  Returns:
    TexturePaint.

### setBaseScale

    public void setBaseScale(float bScale)

  Set the base scale to use for the texture paint and stroke. If this is set to a negative number, then no scaling of the paint or stroke will be performed.

  Parameters:
    `bScale` - the base scale to use - 1:bScale.

### getBaseScale

    public float getBaseScale()

  Get the base scale that the texture paint and dashes are set for. If the texture paint and stroke are asked for with a scale, those values will be adjusted accordingly.

  Returns:
    base scale for paint and stroke.

### isMatted

    public boolean isMatted()

  Return whether the OMGraphic has matting around the edge.

### setMatted

    public void setMatted(boolean set)

  Set whether the OMGraphic should have matting around the edge.

### setPointRadius

    public void setPointRadius(int radius)

  Set the pixel radius given to OMPoint objects.

### getPointRadius

    public int getPointRadius()

  Get the pixel radius given to OMPoint objects.

### setPointOval

    public void setPointOval(boolean value)

  Set the oval setting given to OMPoint objects.

### isPointOval

    public boolean isPointOval()

  Get the oval setting given to OMPoint objects.

### setFrom

    public void setFrom(OMGraphic graphic)

  Set the DrawingAttributes parameters based on the current settings of an OMGraphic.

### setFrom

    public void setFrom(OMGraphic graphic,
                        boolean resetGUI)

  Set the DrawingAttributes parameters based on the current settings of an OMGraphic, and reset the GUI of the DrawingAttributes object if desired.

### setTo

    public void setTo(OMGraphic graphic)

  Set all the attributes for the graphic that are contained within this DrawingAttributes class.

  If the fillPattern is set to a TexturePaint, and the fillPaint is null or clear, then the fillPattern will be set as the fill paint. Otherwise, the fillPaint will be set in the OMGraphic, and the fillPattern will be set too. If the OMGraphic.textureMask is != null, then it will get painted on top of the fillPaint. Makes for effects if the fillPattern has some transparent spots.

  Parameters:
    `graphic` - OMGraphic.

### setTo

    public void setTo(OMGraphic graphic,
                      boolean resetGUI)

  Set all the attributes for the graphic that are contained within this DrawingAttributes class.

  If the fillPattern is set to a TexturePaint, and the fillPaint is null or clear, then the fillPattern will be set as the fill paint. Otherwise, the fillPaint will be set in the OMGraphic, and the fillPattern will be set too. If the OMGraphic.textureMask is != null, then it will get painted on top of the fillPaint. Makes for effects if the fillPattern has some transparent spots.

  Parameters:
    `graphic` - OMGraphic.
    `resetGUI` - reset the GUI if desired, set the enableFillPaintChoice option if OMGraphic allows it.

### setOMGraphicEdgeAttributes

    public void setOMGraphicEdgeAttributes(OMGraphic graphic)

  Set the graphic attributes that only pertain to boundaries. This is good for polylines, where setting the fill paint will close up the polyline making it a polygon. So if you want to paint edge data, use this function. Sets line paint, line width, and stroke if graphic is a OMGraphic

  Parameters:
    `graphic` - OMGraphic

### setOMGraphicAttributesForScale

    public void setOMGraphicAttributesForScale(OMGraphic graphic,
                                               float scale)

  Set all the attributes for the graphic that are contained within this DrawingAttributes class. Get the TexturePaint for these attributes, and scale it for the scale compared to the base scale set. If the base scale equals NONE, the fill pattern is not changed with relation to scale.

  Parameters:
    `graphic` - OMGraphic.
    `scale` - scale to compare to the base scale.

### setOMGraphicEdgeAttributesForScale

    public void setOMGraphicEdgeAttributesForScale(OMGraphic graphic,
                                                   float scale)

  Set the graphic attributes that only pertain to boundaries. This is good for polylines, where setting the fill paint will close up the polyline making it a polygon. So if you want to paint edge data, use this function. Sets line paint, line width, and stroke if graphic is a OMGraphic The stroke, if the base scale is set, is adjusted accordingly.

  Parameters:
    `graphic` - OMGraphic.
    `scale` - scale to compare to the base scale.

### getLock

    protected boolean getLock()

  Get the lock to use a JColorChooser. Returns true if you got the lock, false if you didn't.

### releaseLock

    protected void releaseLock()

  Release the lock on the JColorChooser.

### actionPerformed

    public void actionPerformed(java.awt.event.ActionEvent e)

  The DrawingAttributes method for handling ActionEvents. Used to handle the GUI actions, like changing the colors, line widths, etc.

  Specified by:
    `actionPerformed` in interface `java.awt.event.ActionListener`

### getNewPaint

    protected java.awt.Color getNewPaint(java.awt.Component source,
                                         java.lang.String title,
                                         java.awt.Color startingColor)

  A convenience method to get a color from a JColorChooser. Null will be returned if the JColorChooser lock is in place, or if something else is done where the JColorChooser would normally return null.

  Parameters:
    `source` - the source component for the JColorChooser.
    `title` - the String to label the JColorChooser window.
    `startingColor` - the color to give to the JColorChooser to start with. Returned if the cancel button is pressed.
  Returns:
    Color chosen from the JColorChooser, null if lock for chooser can't be acquired.

### getGUI

    public java.awt.Component getGUI()

  Get the GUI components that control the DrawingAttributes.

  Returns:
    JButton returns a JButton that triggers a pop-up menu.

### setPreStrokeMenuOptions

    protected void setPreStrokeMenuOptions(javax.swing.JComponent popup)

  Callout method to add stuff to popup menu before the stroke editor is consulted for additions. Adds colors and line menu additions (arrowhead controls for lines, for instance).

  Parameters:
    `popup` -

### setStrokeMenuOptions

    protected void setStrokeMenuOptions(javax.swing.JComponent popup)

  Calls the editor for strokes to get popup menu addition for stroke editing.

  Parameters:
    `popup` -

### setPostStrokeMenuOptions

    protected void setPostStrokeMenuOptions(javax.swing.JComponent popup)

  Callout method to add stuff to menu after the stroke menus.

  Parameters:
    `popup` -

### getALineButton

    public javax.swing.JButton getALineButton()

  Get a JButton used to bring up the line menu. An ActionListener is added that will bring up line/color popup menu.

  Returns:
    a new JButton is created, every time.

### getColorAndLineMenu

    public javax.swing.JMenu getColorAndLineMenu()

### getColorMenu

    public javax.swing.JMenu getColorMenu()

  Gets the JMenu that has the color control options.

  Returns:
    JMenu with options to bring up color interfaces.

### setLineMenuAdditions

    public void setLineMenuAdditions(javax.swing.JMenu[] lma)

  A hook to add to the line menu brought up in the GUI for the DrawingAttributes.

### getLineMenuAdditions

    public javax.swing.JMenu[] getLineMenuAdditions()

### resetGUI

    public void resetGUI()

  Updates the color and line stroke control buttons to match the current settings.

### getPaletteIcon

    public static javax.swing.ImageIcon getPaletteIcon(java.awt.Paint paint,
                                                       int width,
                                                       int height)

  Create an ImageIcon from a java.awt.Paint.

  Parameters:
    `paint` - java.awt.Paint
    `width` - icon pixel width
    `height` - icon pixel height

### getPropertyChangeSupport

    public java.beans.PropertyChangeSupport getPropertyChangeSupport()

  Get the PropertyChangeSupport object to register anything that is interested in finding out when some parameter has changed.

### setPropertyChangeSupport

    public void setPropertyChangeSupport(java.beans.PropertyChangeSupport support)

### calculateTextColor

    public static java.awt.Color calculateTextColor(java.awt.Color color)

### normalizeOn128

    public static int normalizeOn128(int value)

### setProperties

    public void setProperties(java.util.Properties props)

  Sets the properties for the `DrawingAttributes`. This particular method assumes that the marker name is not needed, because all of the contents of this Properties object are to be used for this object, and scoping the properties with a prefix is unnecessary.

  Specified by:
    `setProperties` in interface `PropertyConsumer`
  Parameters:
    `props` - the `Properties` object.

### getBasicStrokeEditor

    public BasicStrokeEditorMenu getBasicStrokeEditor()

### setProperties

    public void setProperties(java.lang.String prefix,
                              java.util.Properties props)

  Sets the properties for the `DrawingAttributes`. Part of the PropertyConsumer interface. DrawingAttributess which override this method should do something like:

       public void setProperties(String prefix, Properties props) {
           super.setProperties(prefix, props);
           // do local stuff
       }

  If the addToBeanContext property is not defined, it is set to false here.

  Specified by:
    `setProperties` in interface `PropertyConsumer`
  Parameters:
    `prefix` - the token to prefix the property names
    `props` - the `Properties` object

### getProperties

    public java.util.Properties getProperties(java.util.Properties props)

  PropertyConsumer method, to fill in a Properties object, reflecting the current values of the layer. If the layer has a propertyPrefix set, the property keys should have that prefix plus a separating '.' prepended to each property key it uses for configuration.

  Specified by:
    `getProperties` in interface `PropertyConsumer`
  Parameters:
    `props` - a Properties object to load the PropertyConsumer properties into. If props equals null, then a new Properties object should be created.
  Returns:
    Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

### getPropertyInfo

    public java.util.Properties getPropertyInfo(java.util.Properties list)

  Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer. The key for each property should be the raw property name (without a prefix) with a value that is a String that describes what the property key represents, along with any other information about the property that would be helpful (range, default value, etc.).

  Specified by:
    `getPropertyInfo` in interface `PropertyConsumer`
  Parameters:
    `list` - a Properties object to load the PropertyConsumer properties into. If getList equals null, then a new Properties object should be created.
  Returns:
    Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

### getInitPropertiesOrder

    public java.lang.String getInitPropertiesOrder()

### setPropertyPrefix

    public void setPropertyPrefix(java.lang.String prefix)

  Set the property key prefix that should be used by the PropertyConsumer. The prefix, along with a '.', should be prepended to the property keys known by the PropertyConsumer.

  Specified by:
    `setPropertyPrefix` in interface `PropertyConsumer`
  Parameters:
    `prefix` - the prefix String.

### getPropertyPrefix

    public java.lang.String getPropertyPrefix()

  Get the property key prefix that is being used to prepend to the property keys for Properties lookups.

  Specified by:
    `getPropertyPrefix` in interface `PropertyConsumer`
  Returns:
    the prefix String.

### propertyChange

    public void propertyChange(java.beans.PropertyChangeEvent pce)

  Specified by:
    `propertyChange` in interface `java.beans.PropertyChangeListener`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### render

    public void render(java.awt.Graphics2D g,
                       java.awt.Shape shape)

  Render the Shape into the Graphics2D object, using the mattingPaint, fillPaint, fillPattern, linePaint and stroke contained in this DrawingAttributes object.

  Specified by:
    `render` in interface `ShapeRenderer`

### render

    public void render(java.awt.Graphics2D g,
                       java.awt.Shape shape,
                       boolean replaceColorWithGradient)

  Render the Shape into the Graphics2D object, using the mattingPaint, fillPaint, fillPattern, linePaint and stroke contained in this DrawingAttributes object.

  Specified by:
    `render` in interface `ShapeRenderer`
  Parameters:
    `g` - java.awt.Graphics2D object to render into
    `shape` - java.awt.Shape to draw
    `replaceColorWithGradient` - flag to specify replacement of fill and edge colors with a GradientPaint to give a light to dark look. You can set the Paints in the DrawingAttributes object with GradientPaints if you want more control over the GradientPaint, but this will let the DrawingAttributes object take a shot at creating one for a Color that fits the shape given.

### getGradientPaintForShape

    public static java.awt.Paint getGradientPaintForShape(java.awt.Shape shape,
                                                          java.awt.Paint paint)

  Create a GradientPaint object for the given shape.

  Parameters:
    `shape` - shape to take measurements from to set GradientPaint settings - .3 h/w lighter to .7 h/w darker.
    `paint` - the base color to use for gradient.
  Returns:
    GradientPaint for shape.

### getMattingIconForPaint

    public javax.swing.ImageIcon getMattingIconForPaint()

  Returns:
    a matting paint choice icon for the current settings of this DrawingAttributes object, with the matting paint used.

### getIconForPaint

    public static javax.swing.ImageIcon getIconForPaint(java.awt.Paint paint,
                                                        boolean fill)

  Parameters:
    `paint` - the paint to use for the icon.
    `fill` - if fill color should be used.
  Returns:
    an ImageIcon for the provided paint object, two triangles in upper left and lower right. Upper left version has transparency set.

### getMattedIcon

    public static javax.swing.ImageIcon getMattedIcon(java.awt.Paint mattingPaint,
                                                      java.awt.Paint linePaint)

  Parameters:
    `mattingPaint` -
    `linePaint` -
  Returns:
    an ImageIcon that shows a square with the matting paint and line paint.

### getDrawingAttributesIcon

    public static javax.swing.ImageIcon getDrawingAttributesIcon(DrawingAttributes attributes,
                                                                 int width,
                                                                 int height,
                                                                 boolean horizontalOrientation)

  Given a BasicStroke, create an ImageIcon that shows it.

  Parameters:
    `attributes` - attributes to use for drawing the icon for the stroke.
    `width` - the width of the icon.
    `height` - the height of the icon.
    `horizontalOrientation` - if true, draw line on the icon horizontally, else draw it vertically.

### isEnableFillPaintChoice

    public boolean isEnableFillPaintChoice()

### setEnableFillPaintChoice

    public void setEnableFillPaintChoice(boolean enableFillPaintChoice)

### getOrientation

    public int getOrientation()

### setOrientation

    public void setOrientation(int orientation)

### isClear

    public static boolean isClear(java.awt.Paint paint)

  Checks if the Paint is clear.

  Parameters:
    `paint` - Paint or null.
  Returns:
    true if Paint is null or is a Color with a 0 alpha value.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details