Class TLcdBingMapsCopyrightIcon

java.lang.Object
com.luciad.format.bingmaps.copyright.TLcdBingMapsCopyrightIcon
All Implemented Interfaces:
ILcdIcon, ILcdChangeSource, ILcdCloneable, Serializable, Cloneable
Direct Known Subclasses:
TLcdBingMapsGXYCopyrightIcon, TLspBingMapsCopyrightIcon

public class TLcdBingMapsCopyrightIcon extends Object implements ILcdIcon, ILcdChangeSource
Icon to display copyright info. Depending on the Bing Maps terms of use, it may be required to display copyright information of the displayed content.

This icon should be initialized with copyright attribution strings of all involved copyright holders. This information can be obtained from a copyright provider (for example, TLcdBingMapsGXYCopyrightProvider). Subclasses will typically do this automatically.

Usually the copyright information is displayed in conjunction with the Bing Maps logo itself (see TLcdBingMapsLogoIcon).

Example

Adding the logo and copyright icon to the overlay panel of a Swing/AWT view:
    //The Bing Maps terms of use require to display the icon and copyright information on the map
    //Here we add them to the overlay component of an ILspAWTView
    TLcdBingMapsLogoIcon logoIcon = new TLcdBingMapsLogoIcon(view);
    view.getOverlayComponent().add(logoIcon.asComponent(), TLcdOverlayLayout.Location.NORTH_WEST);

    TLspBingMapsCopyrightIcon copyrightIcon = new TLspBingMapsCopyrightIcon(view);
    copyrightIcon.setAlignment(ELcdHorizontalAlignment.RIGHT);
    view.getOverlayComponent().add(copyrightIcon.asComponent(), TLcdOverlayLayout.Location.NORTH_WEST);

Adding the logo and copyright icon to the overlay panel of an FX view:

    TLcdBingMapsLogoIcon logoIcon = new TLcdBingMapsLogoIcon(view);
    Node logoNode = new TLcdFXIcon(logoIcon);

    TLspBingMapsCopyrightIcon copyrightIcon = new TLspBingMapsCopyrightIcon(view);
    Node copyrightNode = new TLcdFXIcon(copyrightIcon);

    FXUtil.findOverlayPane(view).ifPresent(overlayPane -> {
      HBox box = new HBox(logoNode, copyrightNode);
      overlayPane.add(box, TLcdOverlayPane.Location.SOUTH_WEST);
    });
Since:
11.0
See Also:
  • Constructor Details

    • TLcdBingMapsCopyrightIcon

      public TLcdBingMapsCopyrightIcon()
      Creates a new bing copyright icon. This icon will display a list of strings.
  • Method Details

    • setCopyright

      public void setCopyright(List<String> aCopyright)
      Sets the list of strings to be displayed by this icon. Changes to this list afterwards, won't have any effect on the icon.
      Parameters:
      aCopyright - the list of strings to be displayed
    • getCopyright

      public List<String> getCopyright()
      Returns an immutable list containing the copyright strings currently displayed by this icon.
      Returns:
      the strings displayed by this icon
    • paintIcon

      public void paintIcon(Component c, Graphics g, int x, int y)
      Description copied from interface: ILcdIcon
      Draw the ILcdIcon at the specified location. ILcdIcon implementations may use the Component argument to get properties useful for painting, e.g. the foreground or background color.
      Specified by:
      paintIcon in interface ILcdIcon
      Parameters:
      c - a Component to retrieve properties from.
      g - the Graphics on which the icon will be painted.
      x - the x position where the icon will be painted. x is the first coordinate of the top left corner point of the icon.
      y - the y position where the icon will be painted. y is the second coordinate of the top left corner point of the icon.
    • getIconWidth

      public int getIconWidth()
      Description copied from interface: ILcdIcon
      Returns the fixed width of the icon.
      Specified by:
      getIconWidth in interface ILcdIcon
      Returns:
      the fixed width of the icon.
    • getIconHeight

      public int getIconHeight()
      Description copied from interface: ILcdIcon
      Returns the fixed height of the icon.
      Specified by:
      getIconHeight in interface ILcdIcon
      Returns:
      the fixed height of the icon.
    • addChangeListener

      public void addChangeListener(ILcdChangeListener aListener)

      Registers the given listener so it will receive change events from this source.

      In case you need to register a listener which keeps a reference to an object with a shorter life-time than this change source, you can use a ALcdWeakChangeListener instance as change listener.

      Note that change events might be thrown on another thread then the EDT. If swing components have to be updated, make sure to invoke those changes on EDT.

      Specified by:
      addChangeListener in interface ILcdChangeSource
      Parameters:
      aListener - The listener to be notified when a change has happened.
      See Also:
    • removeChangeListener

      public void removeChangeListener(ILcdChangeListener aListener)
      Description copied from interface: ILcdChangeSource
      Removes the specified listener so it is no longer notified.
      Specified by:
      removeChangeListener in interface ILcdChangeSource
      Parameters:
      aListener - The listener to remove.
    • getFont

      public Font getFont()
      Returns the font used to display the copyright information.
      Returns:
      the font.
      See Also:
    • setFont

      public void setFont(Font aFont)
      Sets the font, used to display the copyright information. The default value is plain Dialog with size 9.
      Parameters:
      aFont - the font to use.
      See Also:
    • getFontColor

      public Color getFontColor()
      Returns the font color used to display the copyright information.
      Returns:
      the current font color.
      See Also:
    • setFontColor

      public void setFontColor(Color aFontColor)
      Sets the font color, used to display the copyright information. The default value is white.
      Parameters:
      aFontColor - the font color to use.
      See Also:
    • getShadowColor

      public Color getShadowColor()
      Returns the shadow color used to display the copyright information.
      Returns:
      the current shadow color.
      See Also:
    • setShadowColor

      public void setShadowColor(Color aShadowColor)
      Sets the shadow color, used to display the copyright information. The default value is black.
      Parameters:
      aShadowColor - the shadow color to use.
      See Also:
    • getMaxLineWidth

      public int getMaxLineWidth()
      Returns the maximum line width used to display copyright information.
      Returns:
      the currently used maximum line width.
      See Also:
    • setMaxLineWidth

      public void setMaxLineWidth(int aMaxLineWidth)
      Sets the maximum line width used to display the copyright information. Separate copyright strings will be on the same line until their total width exceeds the value set here. The default value is 256.
      Parameters:
      aMaxLineWidth - the maximum line width to use.
      See Also:
    • getAlignment

      public ELcdHorizontalAlignment getAlignment()
      Returns the current alignment.
      Returns:
      the alignment currently used.
      See Also:
    • setAlignment

      public void setAlignment(ELcdHorizontalAlignment aAlignment)
      Sets the alignment used to display the copyright information. The default value is ELcdHorizontalAlignment.LEFT
      Parameters:
      aAlignment - the alignment to use.
      See Also:
    • clone

      public Object clone()
      Description copied from interface: ILcdCloneable

      Makes Object.clone() public.

      When for example extending from java.lang.Object, it can be implemented like this:
      
       public Object clone() {
         try {
           return super.clone();
         } catch ( CloneNotSupportedException e ) {
           // Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
           throw new RuntimeException( e );
         }
       }
       
      Specified by:
      clone in interface ILcdCloneable
      Overrides:
      clone in class Object
      See Also:
    • asComponent

      public final JComponent asComponent()

      Returns a JComponent representing this icon which can be added to a Swing container. The component will repaint itself each time the copyright information is updated. Typically this component is added to the overlay panel of the view.

      Example usage:

          //The Bing Maps terms of use require to display the icon and copyright information on the map
          //Here we add them to the overlay component of an ILspAWTView
          TLcdBingMapsLogoIcon logoIcon = new TLcdBingMapsLogoIcon(view);
          view.getOverlayComponent().add(logoIcon.asComponent(), TLcdOverlayLayout.Location.NORTH_WEST);
      
          TLspBingMapsCopyrightIcon copyrightIcon = new TLspBingMapsCopyrightIcon(view);
          copyrightIcon.setAlignment(ELcdHorizontalAlignment.RIGHT);
          view.getOverlayComponent().add(copyrightIcon.asComponent(), TLcdOverlayLayout.Location.NORTH_WEST);
      
      Returns:
      a JComponent representing this icon
      Since:
      2019.0