Class BarrelConfiguration
- java.lang.Object
-
- ch.sahits.game.openpatrician.display.model.BarrelConfiguration
-
public class BarrelConfiguration extends java.lang.ObjectConfiguration for the barrel depending on the barrel size.- Author:
- Andi Hotz, (c) Sahits GmbH, 2018 Created on Jul 28, 2018
-
-
Field Summary
Fields Modifier and Type Field Description private intbarrelBottomprivate intbarrelTopprivate inticonSizeprivate IDataImageLoaderimageLoaderprivate inttotalHeigh
-
Constructor Summary
Constructors Constructor Description BarrelConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javafx.scene.shape.PathcreateBarrelShape()Create the path outlining the barrel.javafx.scene.image.ImageViewgetBarrelView()Get the image view in the correct size.private doublegetCargoPercentage(IShip ship)javafx.scene.shape.RectanglegetCargoShape(IShip ship)Calculate the rectangle covering the barrel shape that represents the amount of loaded wares.private doublegetCargoTop(IShip ship)private doublegetHeight(double heighPercentage)private doublegetUnloadablePercentage(IShip ship)javafx.scene.shape.RectanglegetUnloadableShape(IShip ship)Calculate the rectangle covering the barrel shape that represents the amount of loadable space that cannot be loaded with cargo.private doublegetUnloadableTop(IShip ship)private voidinit()
-
-
-
Field Detail
-
imageLoader
@Autowired private IDataImageLoader imageLoader
-
iconSize
private int iconSize
-
barrelTop
private int barrelTop
-
barrelBottom
private int barrelBottom
-
totalHeigh
private int totalHeigh
-
-
Method Detail
-
init
@PostConstruct private void init()
-
getBarrelView
public javafx.scene.image.ImageView getBarrelView()
Get the image view in the correct size.- Returns:
- ImageView for a barrel.
-
createBarrelShape
public javafx.scene.shape.Path createBarrelShape()
Create the path outlining the barrel.- Returns:
- path shape of the barrel image view.
-
getUnloadableShape
public javafx.scene.shape.Rectangle getUnloadableShape(IShip ship)
Calculate the rectangle covering the barrel shape that represents the amount of loadable space that cannot be loaded with cargo. This is the space occupied by weapons and passengers.- Parameters:
ship- for which to calculate.- Returns:
- rectangular shape representing the unloadable space of the barrel
-
getCargoShape
public javafx.scene.shape.Rectangle getCargoShape(IShip ship)
Calculate the rectangle covering the barrel shape that represents the amount of loaded wares.- Parameters:
ship- for which to calculate.- Returns:
- rectangular shape representing the loaded ware.
-
getUnloadablePercentage
private double getUnloadablePercentage(IShip ship)
-
getUnloadableTop
private double getUnloadableTop(IShip ship)
-
getCargoPercentage
private double getCargoPercentage(IShip ship)
-
getCargoTop
private double getCargoTop(IShip ship)
-
getHeight
private double getHeight(double heighPercentage)
-
-