Class GCable

  • All Implemented Interfaces:
    java.lang.Iterable<sag.elements.GElement>, sag.elements.Drawable

    public class GCable
    extends breitband.preset.GLineWithMarkers
    A class used for drawing cables as lines with icons

    The icons are set to the cable type and the player color

    The amount of icons indicates the amount of cables used to build this line

    Author:
    Juno Veenstra
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static float ICON_RATIO
      The ratio of the icon's size to the width of the cable
      static float SCREEN_SPACE_WIDTH
      Width of the cable in screen space
      • Fields inherited from class sag.elements.GElement

        handleMouseEvents, mouseListener, mouseListenerSync, positionX, positionY, rawSVGElement, rotation, scaleX, scaleY, skewX, skewY
    • Constructor Summary

      Constructors 
      Constructor Description
      GCable​(float x1, float y1, float x2, float y2, CableConfig cable, java.awt.Color color, java.lang.String playerName, int amount)
      Cable constructor, draws a line with markers
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CableConfig getCableConfig()  
      java.lang.String getOwner()  
      void scaleToScreen​(float scale)
      Scale the width and icons to be screenSpace
      • Methods inherited from class breitband.preset.GLineWithMarkers

        addChild, addChild, addEmojiMarkers, addFontAwesomeMarkers, getPosition1X, getPosition1Y, getPosition2X, getPosition2Y, realignElements, removeChild, resizeMarkers, setPosition1, setPosition2, setStroke, setStroke, setStrokeWidth
      • Methods inherited from class sag.elements.GGroup

        getChildByRenderingIndex, getNumChildren, getRawSVGGroup, indexOfChild, iterator, processMouseButtonEvent, processMouseMotionEvent, processMouseWheelEvent, 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, setStrokeLinecap, setStrokeLinejoin, setStrokeOpacity, setStrokePattern, setStrokePatternOffset, setXMLAttribute, setXMLAttribute, skew, unsetFill, unsetFillOpacity, unsetOpacity, unsetStroke, unsetStrokeLinecap, unsetStrokeLinejoin, unsetStrokeOpacity, unsetStrokePattern, unsetStrokePatternOffset, unsetStrokeWidth, update, updateTransform
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • ICON_RATIO

        public static final float ICON_RATIO
        The ratio of the icon's size to the width of the cable
        See Also:
        Constant Field Values
      • SCREEN_SPACE_WIDTH

        public static final float SCREEN_SPACE_WIDTH
        Width of the cable in screen space
        See Also:
        Constant Field Values
    • Constructor Detail

      • GCable

        public GCable​(float x1,
                      float y1,
                      float x2,
                      float y2,
                      CableConfig cable,
                      java.awt.Color color,
                      java.lang.String playerName,
                      int amount)
        Cable constructor, draws a line with markers
        Parameters:
        x1 - Start x
        y1 - Start y
        x2 - End x
        y2 - End y
        cable - Cable type
        color - Player/marker color
        playerName - Player name
        amount - Amount of cables used and amount of markers shown
    • Method Detail

      • scaleToScreen

        public void scaleToScreen​(float scale)
        Scale the width and icons to be screenSpace
        Parameters:
        scale - Scale to which the cable gets set, should be the inverse of the zoom level
      • getOwner

        public java.lang.String getOwner()