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