Class CrosshairLayer

    • Constructor Detail

      • CrosshairLayer

        public CrosshairLayer()
      • CrosshairLayer

        public CrosshairLayer​(java.lang.String iconFilePath)
    • Method Detail

      • getIconFilePath

        public java.lang.String getIconFilePath()
        Returns the layer's current icon file path.
        Returns:
        the icon file path
      • setIconFilePath

        public void setIconFilePath​(java.lang.String iconFilePath)
        Sets the crosshair icon's image location. The layer first searches for this location in the current Java classpath. If not found then the specified path is assumed to refer to the local file system. found there then the
        Parameters:
        iconFilePath - the path to the icon's image file
      • getToViewportScale

        public double getToViewportScale()
        Returns the layer's compass-to-viewport scale factor.
        Returns:
        the crosshair-to-viewport scale factor
      • setToViewportScale

        public void setToViewportScale​(double toViewportScale)
        Sets the scale factor applied to the viewport size to determine the displayed size of the crosshair icon. This scale factor is used only when the layer's resize behavior is AVKey.RESIZE_STRETCH or AVKey.RESIZE_SHRINK_ONLY. The icon's width is adjusted to occupy the proportion of the viewport's width indicated by this factor. The icon's height is adjusted to maintain the crosshair image's native aspect ratio.
        Parameters:
        toViewportScale - the compass to viewport scale factor
      • getIconScale

        public double getIconScale()
        Returns the icon scale factor. See setIconScale(double) for a description of the scale factor.
        Returns:
        the current icon scale
      • setIconScale

        public void setIconScale​(double iconScale)
        Sets the scale factor defining the displayed size of the crosshair icon relative to the icon's width and height in its image file. Values greater than 1 magify the image, values less than one minify it. If the layer's resize behavior is other than AVKey.RESIZE_KEEP_FIXED_SIZE, the icon's displayed sized is further affected by the value specified by setToViewportScale(double) and the current viewport size.
        Parameters:
        iconScale - the icon scale factor
      • getResizeBehavior

        public java.lang.String getResizeBehavior()
        Returns the crosshair icon's resize behavior.
        Returns:
        the icon's resize behavior
      • setResizeBehavior

        public void setResizeBehavior​(java.lang.String resizeBehavior)
        Sets the behavior the layer uses to size the crosshair icon when the viewport size changes, typically when the WorldWind window is resized. If the value is AVKey.RESIZE_KEEP_FIXED_SIZE, the icon size is kept to the size specified in its image file scaled by the layer's current icon scale. If the value is AVKey.RESIZE_STRETCH, the icon is resized to have a constant size relative to the current viewport size. If the viewport shrinks the icon size decreases; if it expands then the icon file enlarges. The relative size is determined by the current crosshair-to-viewport scale and by the icon's image file size scaled by the current icon scale. If the value is AVKey.RESIZE_SHRINK_ONLY (the default), icon sizing behaves as for AVKey.RESIZE_STRETCH but the icon will not grow larger than the size specified in its image file scaled by the current icon scale.
        Parameters:
        resizeBehavior - the desired resize behavior
      • getLocationCenter

        public Vec4 getLocationCenter()
        Get the crosshair location inside the viewport. If this location is null, the crosshair is drawn in the viewport center.
        Returns:
        the crosshair location inside the viewport.
      • setLocationCenter

        public void setLocationCenter​(Vec4 locationCenter)
        Set the crosshair location inside the viewport. If this location is null, the crosshair will be drawn in the viewport center.
        Parameters:
        locationCenter - the crosshair location inside the viewport.