Class StyleManager

java.lang.Object
com.kheops.jmap.client.layers.StyleManager
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
JMapServerStyleManager

public class StyleManager extends Object implements Serializable, Cloneable
See Also:
  • Field Details

    • defaultSelectionColor

      protected Color defaultSelectionColor
    • labelStyle

      protected Style labelStyle
    • selectionStyle

      protected Style selectionStyle
    • styles

      protected Style[] styles
    • maximumScales

      protected double[] maximumScales
    • elementType

      protected int elementType
  • Constructor Details

    • StyleManager

      public StyleManager()
      Default constructor for java bean compliance
    • StyleManager

      public StyleManager(int elementType)
  • Method Details

    • getElementType

      public int getElementType()
    • setElementType

      public void setElementType(int elementType)
    • getStyles

      public Style[] getStyles()
    • setStyles

      public void setStyles(Style[] styles)
    • setMaximumScales

      public void setMaximumScales(double[] minScales)
    • replaceStyle

      public Style replaceStyle(double scale, Style newStyle)
    • addStyle

      public void addStyle(double scale, Style newStyle)
    • fireStyleChangedEvent

      public void fireStyleChangedEvent()
    • addListener

      public void addListener(LayerEventListener listener)
    • removeListener

      public void removeListener(LayerEventListener listener)
    • copyArray

      protected static Object[] copyArray(Object[] s, Object[] d, int index, boolean adding)
    • copyArray

      protected static double[] copyArray(double[] s, double[] d, int index, boolean adding)
    • removeStyle

      protected Style removeStyle(double scale, boolean validateSize)
    • removeStyle

      public Style removeStyle(double scale)
      Removes the Style object that corresponds to the specified scale.
      Parameters:
      scale - a scale.
    • getStyle

      public Style getStyle(double scale)
      Returns the Style object to be used at the specified scale.
      Parameters:
      scale - a scale.
    • moveStyle

      public void moveStyle(double oldScale, double newScale)
      Moves a Style object from a specified scale to another.
      Parameters:
      oldScale - the old scale.
      newScale - the scale to move the Style at.
    • getMaximumScale

      public double getMaximumScale(Style style)
    • getMaximumScales

      public double[] getMaximumScales()
    • exists

      protected boolean exists(double scale)
    • indexOf

      public int indexOf(double scale)
      Returns the index of the style configured for the specified scale.
      Parameters:
      scale - the scale of the style to return.
      Returns:
      the index of the style.
      See Also:
    • getDefaultSelectionColor

      public Color getDefaultSelectionColor()
    • setDefaultSelectionColor

      public void setDefaultSelectionColor(Color defaultSelectionColor)
    • destroy

      public void destroy()
      Frees all listeners registered in this style manager.
    • clone

      public Object clone()
      Overrides:
      clone in class Object
    • clone

      protected void clone(StyleManager styleManager)
    • getCount

      public int getCount()
      Returns the number of styles configured in this style manager.
      Returns:
      the number of styles configured.
    • getLabelStyle

      public Style getLabelStyle()
      Returns the label style.
      Returns:
      the label style.
    • setLabelStyle

      public void setLabelStyle(Style labelStyle)
      Sets the label style.
      Parameters:
      labelStyle - the Style used to draw labels.
    • getSelectionStyle

      public Style getSelectionStyle()
      Returns the custom selection style, if any.
      Returns:
      the selection style.
    • getSelectionStyle

      public Style getSelectionStyle(double scale)
      Returns the selection style. If a custom selection style was configured, then it will be returned. Otherwise, the default selection style for the specified scale will be returned.
      Parameters:
      scale - the current scale.
      Returns:
      the selection style.
    • getEditionStyle

      public Style getEditionStyle(double scale)
    • isSelectionStyleOverridden

      public boolean isSelectionStyleOverridden()
    • createSelectionStyle

      public Style createSelectionStyle(Style style, int elementType)
      Creates a selection style using the specified style.
    • createEditionStyle

      public static Style createEditionStyle(Style style)
      Creates a new edition style using the specified style.
      Parameters:
      style - the base style to use.
      Returns:
      the edition style that was created.
    • createSelectionStyle

      public Style createSelectionStyle(Style style, int elementType, Color selectColor)
      Creates a selection style using the specified style.
    • overrideSelectionStyle

      public void overrideSelectionStyle(Style style)
      Overrides the layer selection style with the specified style object. When this method is called, the new selection style will always remain the same.
      Parameters:
      style - the style to be used for selections