Class TLcdBingMapsCopyrightIcon
java.lang.Object
com.luciad.format.bingmaps.copyright.TLcdBingMapsCopyrightIcon
- All Implemented Interfaces:
ILcdIcon
,ILcdChangeSource
,ILcdCloneable
,Serializable
,Cloneable
- Direct Known Subclasses:
TLcdBingMapsGXYCopyrightIcon
,TLspBingMapsCopyrightIcon
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,
Adding the logo and copyright icon to the overlay panel of an FX view:
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);
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addChangeListener
(ILcdChangeListener aListener) Registers the given listener so it will receive change events from this source.final JComponent
Returns aJComponent
representing this icon which can be added to a Swing container.clone()
MakesObject.clone()
public.Returns the current alignment.Returns an immutable list containing the copyright strings currently displayed by this icon.getFont()
Returns the font used to display the copyright information.Returns the font color used to display the copyright information.int
Returns the fixed height of the icon.int
Returns the fixed width of the icon.int
Returns the maximum line width used to display copyright information.Returns the shadow color used to display the copyright information.void
Draw theILcdIcon
at the specified location.void
removeChangeListener
(ILcdChangeListener aListener) Removes the specified listener so it is no longer notified.void
setAlignment
(ELcdHorizontalAlignment aAlignment) Sets the alignment used to display the copyright information.void
setCopyright
(List<String> aCopyright) Sets the list of strings to be displayed by this icon.void
Sets the font, used to display the copyright information.void
setFontColor
(Color aFontColor) Sets the font color, used to display the copyright information.void
setMaxLineWidth
(int aMaxLineWidth) Sets the maximum line width used to display the copyright information.void
setShadowColor
(Color aShadowColor) Sets the shadow color, used to display the copyright information.
-
Constructor Details
-
TLcdBingMapsCopyrightIcon
public TLcdBingMapsCopyrightIcon()Creates a new bing copyright icon. This icon will display a list of strings.
-
-
Method Details
-
setCopyright
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
Returns an immutable list containing the copyright strings currently displayed by this icon.- Returns:
- the strings displayed by this icon
-
paintIcon
Description copied from interface:ILcdIcon
Draw theILcdIcon
at the specified location.ILcdIcon
implementations may use theComponent
argument to get properties useful for painting, e.g. the foreground or background color.- Specified by:
paintIcon
in interfaceILcdIcon
- 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 interfaceILcdIcon
- 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 interfaceILcdIcon
- Returns:
- the fixed height of the icon.
-
addChangeListener
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 interfaceILcdChangeSource
- Parameters:
aListener
- The listener to be notified when a change has happened.- See Also:
-
removeChangeListener
Description copied from interface:ILcdChangeSource
Removes the specified listener so it is no longer notified.- Specified by:
removeChangeListener
in interfaceILcdChangeSource
- Parameters:
aListener
- The listener to remove.
-
getFont
Returns the font used to display the copyright information.- Returns:
- the font.
- See Also:
-
setFont
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
Returns the font color used to display the copyright information.- Returns:
- the current font color.
- See Also:
-
setFontColor
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
Returns the shadow color used to display the copyright information.- Returns:
- the current shadow color.
- See Also:
-
setShadowColor
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
Returns the current alignment.- Returns:
- the alignment currently used.
- See Also:
-
setAlignment
Sets the alignment used to display the copyright information. The default value isELcdHorizontalAlignment.LEFT
- Parameters:
aAlignment
- the alignment to use.- See Also:
-
clone
Description copied from interface:ILcdCloneable
Makes
When for example extending fromObject.clone()
public.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 interfaceILcdCloneable
- Overrides:
clone
in classObject
- See Also:
-
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
-