Class BarrelConfiguration
- java.lang.Object
-
- ch.sahits.game.openpatrician.display.model.BarrelConfiguration
-
public class BarrelConfiguration extends java.lang.Object
Configuration 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 int
barrelBottom
private int
barrelTop
private int
iconSize
private IDataImageLoader
imageLoader
private int
totalHeigh
-
Constructor Summary
Constructors Constructor Description BarrelConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javafx.scene.shape.Path
createBarrelShape()
Create the path outlining the barrel.javafx.scene.image.ImageView
getBarrelView()
Get the image view in the correct size.private double
getCargoPercentage(IShip ship)
javafx.scene.shape.Rectangle
getCargoShape(IShip ship)
Calculate the rectangle covering the barrel shape that represents the amount of loaded wares.private double
getCargoTop(IShip ship)
private double
getHeight(double heighPercentage)
private double
getUnloadablePercentage(IShip ship)
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.private double
getUnloadableTop(IShip ship)
private void
init()
-
-
-
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)
-
-