001package jmri.jmrit.etcs.dmi.swing; 002 003import java.awt.Color; 004 005import org.apiguardian.api.API; 006 007/** 008 * Class to represent a section of the DMI Circular Speed Guide. 009 * @author Steve Young Copyright (C) 2024 010 */ 011@API(status=API.Status.EXPERIMENTAL) 012public class DmiCircularSpeedGuideSection { 013 014 final float start; 015 final float stop; 016 final int type; 017 final Color col; 018 final boolean includeHook; 019 final boolean includeNegative; 020 021 public static final int CSG_TYPE_NORMAL = 0; 022 public static final int CSG_TYPE_HOOK = 1; // width of hook 023 public static final int CSG_TYPE_SUPERVISION = 2; // inner edge, yellow with hook 024 public static final int CSG_TYPE_RELEASE = 3; // outer edge, grey, 025 026 /** 027 * Create a new section of the Circular Speed Guide. 028 * @param csgType Type constant, e.g. CSG_TYPE_NORMAL or CSG_TYPE_HOOK 029 * @param colour the Colour of the section. 030 * @param startSpeed the section Start speed. 031 * @param stopSpeed the section End speed. 032 * @param hook true to include a hook, else false. 033 */ 034 public DmiCircularSpeedGuideSection(int csgType, Color colour, float startSpeed, float stopSpeed, boolean hook) { 035 this( csgType, colour, startSpeed, stopSpeed, hook, false); 036 } 037 038 /** 039 * Create a new section of the Circular Speed Guide. 040 * @param csgType Type constant, e.g. CSG_TYPE_NORMAL or CSG_TYPE_HOOK 041 * @param colour the Colour of the section. 042 * @param startSpeed the section Start speed. 043 * @param stopSpeed the section End speed. 044 * @param hook true to include a hook, else false. 045 * @param includeNegative true to include the negative section. 046 */ 047 public DmiCircularSpeedGuideSection(int csgType, Color colour, float startSpeed, 048 float stopSpeed, boolean hook, boolean includeNegative ) { 049 start = startSpeed; 050 stop = stopSpeed; 051 type = csgType; 052 col = colour; 053 includeHook = (hook || csgType == CSG_TYPE_HOOK); 054 this.includeNegative = includeNegative; 055 } 056 057}