Package breitband.GUI.elements
Class GCity
- java.lang.Object
-
- sag.elements.GElement
-
- sag.elements.GGroup
-
- breitband.GUI.elements.GCity
-
- All Implemented Interfaces:
java.lang.Iterable<sag.elements.GElement>
,sag.elements.Drawable
public class GCity extends sag.elements.GGroup
Class for rendering cities on the map- Author:
- Juno Veenstra
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description City
getCity()
City object getterjava.lang.String
getName()
City name getterGCity
onEnter(java.util.function.Consumer<GCity> action)
Method for defining enterAction in lambdasGCity
onSelect(java.util.function.Consumer<GCity> selectAction)
Method for defining selectAction in lambdasvoid
scaleToScreen(float scale, float defaultScale)
Scale the city icon and labels to be screen space.void
setHighlighted(boolean highlighted)
void
setHighlightedWeak(boolean highlighted)
void
showName(boolean visible)
Show the city's name This method does nothing if the screen is zoomed in to the point where the name is always visible-
Methods inherited from class sag.elements.GGroup
addChild, addChild, getChildByRenderingIndex, getNumChildren, getRawSVGGroup, indexOfChild, iterator, processMouseButtonEvent, processMouseMotionEvent, processMouseWheelEvent, removeChild, renderChildAfter, renderChildBefore, renderChildEarlier, renderChildFirst, renderChildLast, renderChildLater, setChildRenderingIndex, setRootSAGPanel, swapChildren
-
Methods inherited from class sag.elements.GElement
amIPicked, executeUpdate, flipHorizontal, flipVertical, getGElement, getParent, getPositionX, getPositionY, getRGBStringFromColor, getRootSAGPanel, getRotation, getScaleX, getScaleY, getSkewX, getSkewY, move, removeCSSAttribute, removeXMLAttribute, rotate, scale, scale, setAttribute, setCSSAttribute, setCSSAttribute, setDisplay, setFill, setFill, setFillOpacity, setMouseEventListener, setOpacity, setParent, setPosition, setRotation, setScale, setScale, setSkew, setStroke, setStroke, setStroke, setStrokeLinecap, setStrokeLinejoin, setStrokeOpacity, setStrokePattern, setStrokePatternOffset, setStrokeWidth, setXMLAttribute, setXMLAttribute, skew, unsetFill, unsetFillOpacity, unsetOpacity, unsetStroke, unsetStrokeLinecap, unsetStrokeLinejoin, unsetStrokeOpacity, unsetStrokePattern, unsetStrokePatternOffset, unsetStrokeWidth, update, updateTransform
-
-
-
-
Constructor Detail
-
GCity
public GCity(City city)
Construct a new GCity object- Parameters:
city
- City object carrying information about the city
-
-
Method Detail
-
onSelect
public GCity onSelect(java.util.function.Consumer<GCity> selectAction)
Method for defining selectAction in lambdas- Parameters:
selectAction
- Consumer to be set- Returns:
- this
-
onEnter
public GCity onEnter(java.util.function.Consumer<GCity> action)
Method for defining enterAction in lambdas- Parameters:
action
- Consumer to be set- Returns:
- this
-
setHighlighted
public void setHighlighted(boolean highlighted)
-
setHighlightedWeak
public void setHighlightedWeak(boolean highlighted)
-
getName
public java.lang.String getName()
City name getter- Returns:
- City's name
-
getCity
public City getCity()
City object getter- Returns:
- This city as a City object
-
scaleToScreen
public void scaleToScreen(float scale, float defaultScale)
Scale the city icon and labels to be screen space.Also shows/hides the name depending on how zoomed in the screen is
- Parameters:
scale
- Scale to which gets scaled, should be the multiplicative inverse of the zoomdefaultScale
- The worlds default scale ('correctScale'). Used to calculate the zoom percentage
-
showName
public void showName(boolean visible)
Show the city's name This method does nothing if the screen is zoomed in to the point where the name is always visible- Parameters:
visible
- Whether visible or hidden
-
-