1b216dba30a436b28cd57e53c562027a8ae3446f
wiki/info/landscape/typical-development-scenarios.md
| ... | ... | @@ -2,6 +2,35 @@ |
| 2 | 2 | |
| 3 | 3 | [[_TOC_]] |
| 4 | 4 | |
| 5 | +## Adding a New Boat Class |
|
| 6 | + |
|
| 7 | +Support for different boat classes comes with the following aspects: |
|
| 8 | +* Name and possible alias names for the boat class |
|
| 9 | +* hull dimensions |
|
| 10 | +* separate downwind sail configuration for display |
|
| 11 | +* boat class symbol / icon |
|
| 12 | +* map visualization |
|
| 13 | + |
|
| 14 | +If you'd like to add a boat class that the system does not yet support with its own boat class symbol or even a separate, new boat visualization on the map, the necessary extensions currently need to me implemented as code. |
|
| 15 | + |
|
| 16 | +To start with, add an enumeration literal for the new class in [BoatClassMasterdata](https://github.com/SAP/sailing-analytics/blob/main/java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/BoatClassMasterdata.java). The constructor needs to tell the default boat class name, whether races in this class typically have an upwind start (in which case we'll be more confident in guessing wind direction for races in this class based on the first leg's bearing), the hull length and beam in meters, the hull type, whether or not boats of that class fly a separate downwind sail, and optionally a list of alternative boat class names that can help users find the class, or to reflect name changes over time (Laser becoming ILCA, for example). |
|
| 17 | + |
|
| 18 | +To understand the next steps, you may also search your workspace for usages of other ``BoatClassMasterdata`` enumeration literals. You will typically find at least two more: one in [BoatClassImageResolver](https://github.com/SAP/sailing-analytics/blob/main/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/common/client/BoatClassImageResolver.java) which helps define the boat class symbol / icon to be displayed in the UI and made available through the REST API, e.g., for the companion apps; and another in [BoatClassVectorGraphicsResolver](https://github.com/SAP/sailing-analytics/blob/main/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/BoatClassVectorGraphicsResolver.java) which defines how boats of this class are to be visualized on the map. |
|
| 19 | + |
|
| 20 | +For the boat class symbol you have to create a transparent 140x140 pixel PNG file and place it in the ``java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/ui/client/images/boatclass`` folder. The file's base name must match the ``BoatClassMasterdata`` enumeration literal you created _exactly_. The file extension shall be ``.png``. Then, define a GWT image resource in [BoatClassImageResolver](https://github.com/SAP/sailing-analytics/blob/main/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/common/client/BoatClassImageResolver.java), using one of the other resource definitions in that class as an example: |
|
| 21 | +``` |
|
| 22 | + @Source("com/sap/sailing/gwt/ui/client/images/boatclass/FINN.png") |
|
| 23 | + @ImageOptions(preventInlining = true) |
|
| 24 | + ImageResource FinnIcon(); |
|
| 25 | +``` |
|
| 26 | +In ``BoatClassImageResolver`` then use this image resource, e.g., as follows: |
|
| 27 | +``` |
|
| 28 | + boatClassIconsMap.put(BoatClassMasterdata.FINN.getDisplayName(), imageResources.FinnIcon()); |
|
| 29 | +``` |
|
| 30 | +If any of the already existing boat class map visualizations work for your new class, simply add your new enumeration literal to the ``BoatClassVectorGraphics`` constructor in ``BoatClassVectorGraphicsResolver``'s static initializer that best matches your boat class. If you feel you need a better, more specific boat class visualization on the map, you'll have to [[implement your own|wiki/howto/development/boatgraphicssvg.md]] ``BoatClassVectorGraphics`` class and use that in the static initializer of ``BoatClassVectorGraphicsResolver``. |
|
| 31 | + |
|
| 32 | +Mention the new boat class in the release notes, and don't forget to add all new files to your Git index before committing ;-). |
|
| 33 | + |
|
| 5 | 34 | ## Adding a Bundle |
| 6 | 35 | Make sure you have read [[Workspace, Bundles, Projects|wiki/info/general/workspace-bundles-projects-structure]] before continuing. We distinguish two cases: adding a 3rd-party bundle to the target platform and adding a new development bundle as a Java project. |
| 7 | 36 |