001package jmri.jmrit.display.layoutEditor; 002 003import javax.annotation.Nonnull; 004 005 006/** 007 * A LayoutTurnout corresponds to a turnout on the layout. A LayoutTurnout is an 008 * extension of the standard Turnout object with drawing and connectivity 009 * information added. 010 * <p> 011 * Six types are supported: right-hand, left-hand, wye, double crossover, 012 * right-handed single crossover, and left-handed single crossover. Note that 013 * double-slip turnouts can be handled as two turnouts, throat to throat, and 014 * three-way turnouts can be handles as two turnouts, left-hand and right-hand, 015 * arranged throat to continuing route. 016 * <p> 017 * A LayoutTurnout has three or four connection points, designated A, B, C, and 018 * D. For right-handed or left-handed turnouts, A corresponds to the throat. At 019 * the crossing, A-B (and C-D for crossovers) is a straight segment (continuing 020 * route). A-C (and B-D for crossovers) is the diverging route. B-C (and A-D for 021 * crossovers) is an illegal condition. 022 * <br> 023 * <pre> 024 * Turnouts 025 * Right-hand Left-hand 026 * 027 * C 028 * // 029 * A ==**== B A ==**== B 030 * \\ 031 * C 032 * 033 * Wye Three-way 034 * 035 * B D 036 * // // 037 * A ==** A ==**== B 038 * \\ \\ 039 * C C 040 * 041 * Crossovers 042 * Right-hand left-hand 043 * A ==**===== B A ====**== B 044 * \\ // 045 * \\ // 046 * D ====**== C D ==**===== C 047 * 048 * Double 049 * A ==**==**== B 050 * \\// 051 * XX 052 * //\\ 053 * D ==**==**== C 054 * </pre> 055 * <p> 056 * A LayoutTurnout carries Block information. For right-handed, left-handed, and 057 * wye turnouts, the entire turnout is in one block, however, a block border may 058 * occur at any connection (A,B,C,D). For a double crossover turnout, up to four 059 * blocks may be assigned, one for each connection point, but if only one block 060 * is assigned, that block applies to the entire turnout. 061 * <p> 062 * For drawing purposes, each LayoutTurnout carries a center point and 063 * displacements for B and C. For right-handed or left-handed turnouts, the 064 * displacement for A = - the displacement for B, and the center point is at the 065 * junction of the diverging route and the straight through continuing route. 066 * For double crossovers, the center point is at the center of the turnout, and 067 * the displacement for A = - the displacement for C and the displacement for D 068 * = - the displacement for B. The center point and these displacements may be 069 * adjusted by the user when in edit mode. For double crossovers, AB and BC are 070 * constrained to remain perpendicular. For single crossovers, AB and CD are 071 * constrained to remain parallel, and AC and BD are constrained to remain 072 * parallel. 073 * <p> 074 * When LayoutTurnouts are first created, a rotation (degrees) is provided. For 075 * 0.0 rotation, the turnout lies on the east-west line with A facing east. 076 * Rotations are performed in a clockwise direction. 077 * <p> 078 * When LayoutTurnouts are first created, there are no connections. Block 079 * information and connections may be added when available. 080 * <p> 081 * When a LayoutTurnout is first created, it is enabled for control of an 082 * assigned actual turnout. Clicking on the turnout center point will toggle the 083 * turnout. This can be disabled via the popup menu. 084 * <p> 085 * Signal Head names are saved here to keep track of where signals are. 086 * LayoutTurnout only serves as a storage place for signal head names. The names 087 * are placed here by tools, e.g., Set Signals at Turnout, and Set Signals at 088 * Double Crossover. Each connection point can have up to three SignalHeads and one SignalMast. 089 * <p> 090 * A LayoutTurnout may be linked to another LayoutTurnout to form a turnout 091 * pair. Throat-To-Throat Turnouts - Two turnouts connected closely at their 092 * throats, so closely that signals are not appropriate at the their throats. 093 * This is the situation when two RH, LH, or WYE turnouts are used to model a 094 * double slip. 3-Way Turnout - Two turnouts modeling a 3-way turnout, where the 095 * throat of the second turnout is closely connected to the continuing track of 096 * the first turnout. The throat will have three heads, or one head. A link is 097 * required to be able to correctly interpret the use of signal heads. 098 * 099 * @author Dave Duchamp Copyright (c) 2004-2007 100 * @author George Warner Copyright (c) 2017-2019 101 */ 102public class LayoutRHTurnout extends LayoutTurnout { 103 104 public LayoutRHTurnout(@Nonnull String id, 105 @Nonnull LayoutEditor layoutEditor) { 106 this(id, layoutEditor, 1); 107 } 108 109 /** 110 * Main constructor method. 111 * @param id turnout ID string. 112 * @param layoutEditor main layout editor. 113 * @param v version, unused. 114 */ 115 public LayoutRHTurnout(@Nonnull String id, 116 @Nonnull LayoutEditor layoutEditor, int v) { 117 super(id, TurnoutType.RH_TURNOUT, layoutEditor, 1); 118 } 119 120 // private final static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LayoutRHTurnout.class); 121}