From 152ee7e4d59075bf57a472f6d3a6ea5b2b015fc9 Mon Sep 17 00:00:00 2001 From: DccPlusPlus Date: Thu, 25 Feb 2016 23:45:38 -0500 Subject: [PATCH 1/3] Added commented code to demonstrate simple oval layout --- DCCpp_Controller/controllerConfig.pde | 138 +++++++++++++++++++++++++- DCCpp_Controller/dccStatus.xml | 12 +-- 2 files changed, 141 insertions(+), 9 deletions(-) diff --git a/DCCpp_Controller/controllerConfig.pde b/DCCpp_Controller/controllerConfig.pde index a3a3985..3e8388e 100644 --- a/DCCpp_Controller/controllerConfig.pde +++ b/DCCpp_Controller/controllerConfig.pde @@ -369,10 +369,141 @@ cleaningCab=new CleaningCarButton(extrasWindow,28,80,80,120,50,40,16,"Cleaning\nCar"); // CREATE MAIN LAYOUT AND DEFINE ALL TRACKS + +// Step 1: Define a LAYOUT object that creates a "frame" into which TRACKS be placed +// +// Format is Layout(xCorner, yCorner, frameWidth, layoutWidth, layoutHeight) +// +// xCorner: the x-coordinate (in pixels) of the upper left corner of the layout frame +// yCorner: the y-coordinate (in pixels) of the upper left corner of the layout frame +// frameWidth: the width of the layout frame (in pixels) +// layoutWidth: the true width of the real layout, in whatever units you want to use (inches, mm, feet, etc) +// layoutHeight: the true height (depth) of the real layout, using the same units as for layoutWidth + +// Note that you do no need to specify the height of the frame. It will be automatically set to scale based on the +// other parameters. If the resulting frameHeight is too large or small, decrease or increase the frameWidth. - layout=new Layout(325,50,1000,80*25.4,36*25.4); + Layout myLayout = new Layout( 400, 100, 700, 60, 36 ); // creates a frame with upper left coordinate of (400,100), a width of 700 pixels, and real-world size of 60 inches wide by 36 inches deep - Track bridgeA = new Track(layout,20,450,62,90); +// Step 2: Create the TRACKS +// +// * You can create either a straight track or a curved track +// * You can place the track directly on the layout in an absolute position, or have one end of the track connect to the end of an existing track already on the layout (i.e. a relative position) +// +// We will begin by creating a simply oval consisting of two 15" radius semi-circles connected by 24" of straight track. +// +// Format to create a Straight Track with an Absolute Position: Track(layoutName,x,y,length,angle) +// +// layoutName: the name of the previously-created layout on which to place this track +// x,y the x- and y-coordinates (in real units) of one end of the track +// length: the length (in real units) of the track +// angle: the angle (in degrees from 0-360) where 0 degrees=to the right of the screen and 90 degrees=to the top of the screen +// +// IMPORTANT: The tracks defined below do not need to exactly match the individual tracks you used on your layout. For example, you may have used +// a single 24" straight track or six 4" straight tracks. In either case you just need to create a single 24" straight track for the graphic layout, +// though there is nothing wrong with creating six separate 4" straight tracks connected together. For illustration purposes we will create +// one 15" track connected to one 9" track to get our 24" run. We'll see why we used these specific dimensions later below. + + Track trackA = new Track( myLayout, 18, 30, 15, 0 ); // place a straight track named trackA on myLayout with one end at an absolute positon of 18" to the right and 30" down. Length of track is 15". Direction is 0 degrees (to the right). + +// Once the first track is down, we can place a second track relative to one of the end points of that first track. This makes it easy to connect tracks without having to keep track of any absolute position. + +// Format to create a Straight Track with a Relative Position: Track(trackName,endPoint,length) +// +// trackName: the name of the previously-created track already placed on the layout +// endPoint: specifies which endpoint of trackName you want to connect to (0=starting endpoint, 1=ending endpoint) +// length: the length (in real units) of the track + + Track trackB = new Track( trackA, 1, 9 ); // connect a straight track named trackB to the "ending" endpoint of previously-created trackA. Length of this track is 9" + +// Now that we have our full 24" run, let's create the right-half of the oval, connected to the end of the run. + +// Format to create a Curve Track with a Relative Position: Track(trackName,endPoint,radius,angle) +// +// trackName: the name of the previously-created track already placed on the layout +// endPoint: specifies which endpoint of trackName you want to connect to (0=starting endpoint, 1=ending endpoint) +// radius: radius of the curve (in real units) +// angle: arc angle of curve (in degrees, where a positive value indicates counter-clockwise and a negative value indicates clockwise) + + Track trackC = new Track( trackB, 1, 15, 180 ); // connect a counter-clockwise curved track namesd trackC to the "ending" endpoint of previously-created trackB. Radius is 15" and total arc angle is 180 degrees (i.e. a 30" diameter semi-circle) + +// Now let's connect on our straight tracks to the top of the semi-circle. As before, we'll use two tracks of 15" and 9" + + Track trackD = new Track( trackC, 1, 15 ); // connect a straight track named trackD to the "ending" endpoint of previously-created trackC. Length of this track is 15" + Track trackE = new Track( trackD, 1, 9 ); // connect a straight track named trackE to the "ending" endpoint of previously-created trackD. Length of this track is 9" + +// Next we need to close the semi-circle with a 15"-radius curved track spanning 180 arc degrees. +// There are two ways we can do this: +// +// * We can connect this track to the ending endpoint of the top straight track we just created, and have it curve down to meet the originally-created lower straight track (i.e. it will curve counter-clockwise), OR +// * We can connect this track to the starting endpoint of the lower straight track we originally created and have it curve up to meet the just-created top track (i.e. it will curve clockwise). +// +// Either of the two tracks below yield exactly the same graphic -- take your pick (though you probably don't need to define both!) + +// Track trackF = new Track( trackE, 1, 15, 180 ); // connect a counter-clockwise curved track named trackF to the ending endpoint previously-created trackE. Radius is 15" and total arc angle is 180 degrees (i.e. a 30" diameter semi-circle) + Track trackF = new Track( trackA, 0, 15, -180 ); // connect a clockwise curved track named trackF to the starting endpoint originaly-created trackA. Radius is 15" and total arc angle is 180 degrees (i.e. a 30" diameter semi-circle) + +// Viola - we have an oval! + +// Step 3: Add a turnout + +// Recall that instead of creating our 24" straight tracks with a single 24" graphic, we used a combination of one 9" track with one 15" track. This is because each 9" straight track is going to form the straight part of a turnout. +// We create the turnout by simply "overlaying" a curve track on top of an existing straight track. In this case, on top of the 9" straight tracks. + +// We'll start with the lower 9" straight track. Note that the it is connected to the right semi-circle named trackC. +// That is where we want to begin our turnout - at the beginning endpoint of trackC. +// We will use a 15" radius curve, but with a much shorter 30 degrees of arc. Also, the track needs to curve clockwise. +// Here's how we do it: + + Track trackG = new Track( trackC, 0, 15, -30 ); // connect a clockwise curved track named trackG to the "beginning" endpoint of previously-created trackC. Radius is 15" and total arc angle is 30 degrees + +// Now that we have the graphic in place for the turnout, let's make it operational so that it flips when we click it. +// We do that with a serial of TrackButton commands. First we create a new TrackButton object: + +// Format to create a new TrackButton object: TrackButton(width,height,ID) +// +// width: the width (in pixels) of an invisible button that will be placed on the tracks to create the "clickable" area that flips the turnout +// height: the height (in pixels) of an invisible button that will be placed on the tracks to creates the "clickable" area that flips the turnout +// ID: a unique numerical identifier for this turnout (which will be used by DCC++ BASE STATION) + + TrackButton turnout1 = new TrackButton( 20, 20, 1 ); // create a new TrackButton named turnout1 with a width and height of 20 pixels, and an ID of 1. + +// Next we have to specify that tracks that form the legs of the turnouts. We do this with the addTrack method. +// +// Format to add tracks to a previously-defined TrackButton: addtrack(trackName,position) +// +// trackName: the name of a previously-defined track to add as a leg to this track button +// position: defines whether this leg is active (=1) or inactive (=0) when the turnout is "thrown" + + turnout1.addTrack( trackB, 0 ); // add 9" straight-track named trackB to this turnout, and make it inactive when turnout is in thrown position + turnout1.addTrack( trackG, 1 ); // add 30-degree curve track named trackG to this turnout, and make it active when turnout is in thrown position + +// And that's all you need to do! If you hover over the center point of this turnout (within a 20x20 pixel area as we specified), the cursor will change to a hand and you will be able to throw and reset the turnout. + +// Step 4: Add siding tracks to the turnout + +// Let's extend the turnout into a full siding. We'll start with a straight track, the a curve, and then a few more straights. + + Track trackH = new Track( trackG, 1, 6 ); // connect a straight track named trackH to the "ending" endpoint of previously-created trackG. Length of this track is 6" + Track trackI = new Track( trackH, 1, 15, 30 ); // connect a counter-clockwise curved track named trackI to the ending endpoint of previously-created trackH. Radius is 15" and total arc angle is 30 degrees + Track trackJ = new Track( trackI, 1, 6 ); // connect a straight track named trackJ to the "ending" endpoint of previously-created trackI. Length of this track is 6" + Track trackK = new Track( trackJ, 1, 3 ); // connect a straight track named trackJ to the "ending" endpoint of previously-created trackI. Length of this track is 3" + +// Why bother creating two separate straight tracks of 6" and 3" at the end of the siding instead of just one 9" straight track? So we can add a siding route button near the end of the track + + + + + + + + + + + + +/* +Track bridgeA = new Track(layout,20,450,62,90); Track bridgeB = new Track(bridgeA,1,348,-90); Track bridgeC = new Track(bridgeB,1,399); Track t5A = new Track(bridgeC,1,126); @@ -1033,7 +1164,8 @@ cab8601.setSidingDefaults(rButton4,11,12); cab1202.setSidingDefaults(rButton5,11,13); cab2004.setSidingDefaults(rButton7,5,14); - +*/ + } // Initialize ////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/DCCpp_Controller/dccStatus.xml b/DCCpp_Controller/dccStatus.xml index 46e1237..715cdb8 100644 --- a/DCCpp_Controller/dccStatus.xml +++ b/DCCpp_Controller/dccStatus.xml @@ -4,17 +4,17 @@ false false - true + false false false false - true - true + false + false false false true false - true + false false @@ -58,6 +58,6 @@ - /dev/tty.usbmodem1431 - 192.168.1.169 + Emulator + 192.168.1.169 192.168.1.200 185.246.1.229 From f573e48c4f7641b0d7e948356766dd81d918dc0a Mon Sep 17 00:00:00 2001 From: DccPlusPlus Date: Sat, 27 Feb 2016 07:03:17 -0500 Subject: [PATCH 2/3] Updated Oval Layout Added turnouts and route buttons --- DCCpp_Controller/controllerConfig.pde | 91 ++++++++++++++++++++++++--- 1 file changed, 84 insertions(+), 7 deletions(-) diff --git a/DCCpp_Controller/controllerConfig.pde b/DCCpp_Controller/controllerConfig.pde index 3e8388e..9a007c9 100644 --- a/DCCpp_Controller/controllerConfig.pde +++ b/DCCpp_Controller/controllerConfig.pde @@ -367,6 +367,8 @@ autoPilot=new AutoPilotButton(325,550,100,50,30,18,"AUTO\nPILOT"); cleaningCab=new CleaningCarButton(extrasWindow,28,80,80,120,50,40,16,"Cleaning\nCar"); + +////// BEGINNING OF SAMPLE LAYOUT //////// // CREATE MAIN LAYOUT AND DEFINE ALL TRACKS @@ -429,8 +431,8 @@ // Now let's connect on our straight tracks to the top of the semi-circle. As before, we'll use two tracks of 15" and 9" - Track trackD = new Track( trackC, 1, 15 ); // connect a straight track named trackD to the "ending" endpoint of previously-created trackC. Length of this track is 15" - Track trackE = new Track( trackD, 1, 9 ); // connect a straight track named trackE to the "ending" endpoint of previously-created trackD. Length of this track is 9" + Track trackD = new Track( trackC, 1, 9 ); // connect a straight track named trackD to the "ending" endpoint of previously-created trackC. Length of this track is 9" + Track trackE = new Track( trackD, 1, 15 ); // connect a straight track named trackE to the "ending" endpoint of previously-created trackD. Length of this track is 15" // Next we need to close the semi-circle with a 15"-radius curved track spanning 180 arc degrees. // There are two ways we can do this: @@ -470,7 +472,7 @@ // Next we have to specify that tracks that form the legs of the turnouts. We do this with the addTrack method. // -// Format to add tracks to a previously-defined TrackButton: addtrack(trackName,position) +// Format to add tracks to a previously-defined TrackButton: addTrack(trackName,position) // // trackName: the name of a previously-defined track to add as a leg to this track button // position: defines whether this leg is active (=1) or inactive (=0) when the turnout is "thrown" @@ -482,14 +484,89 @@ // Step 4: Add siding tracks to the turnout -// Let's extend the turnout into a full siding. We'll start with a straight track, the a curve, and then a few more straights. +// Let's extend the turnout into a full siding. We'll start with a straight track, the a curve, and then another straights. Track trackH = new Track( trackG, 1, 6 ); // connect a straight track named trackH to the "ending" endpoint of previously-created trackG. Length of this track is 6" Track trackI = new Track( trackH, 1, 15, 30 ); // connect a counter-clockwise curved track named trackI to the ending endpoint of previously-created trackH. Radius is 15" and total arc angle is 30 degrees - Track trackJ = new Track( trackI, 1, 6 ); // connect a straight track named trackJ to the "ending" endpoint of previously-created trackI. Length of this track is 6" - Track trackK = new Track( trackJ, 1, 3 ); // connect a straight track named trackJ to the "ending" endpoint of previously-created trackI. Length of this track is 3" + Track trackJ = new Track( trackI, 1, 9 ); // connect a straight track named trackJ to the "ending" endpoint of previously-created trackI. Length of this track is 9" + +// Step 5: Add a route button to the siding + +// As an option, we can add a siding route button to this siding. +// Siding route buttons are simply route buttons that are placed on a track. +// They are not labeled since their location on the track makes it obvious what they do. + +// Format to add a Siding RouteButton object: RouteButton(trackName,width,height) +// +// trackName: the name of a previously-defined track, in the middle of which this siding button will be placed +// width: the width (in pixels) of the siding button +// height: the height (in pixels) of the siding button + + RouteButton sidingButton1 = new RouteButton( trackJ, 20, 20 ); // create a siding button named sidingButton1 in the middle of trackJ. The button is 20x20 pixels is size. + +// Once the button is created, we now need to define which turnouts it should operate. We do this with the addTrackButton method: +// +// Format to add turnouts to a previously-defined RouteButton: addTrackButton(trackButtonName,position) +// +// trackButtonName: the name of a previously-defined TrackButton (i.e. a turnout) to add to this RouteButton +// position: defines whether this turnout is thrown (=1) or not thrown (=0) when the RouteButton is pressed + + sidingButton1.addTrackButton( turnout1, 1 ); // cause turnout1 to be thrown when sidingButton1 is pressed + +// And that's all you need to do to create a siding button. You can now operate the turnout either directly, or with the siding button. +// Note that the siding button only operates the turnout in one direction, and it turns bright green when the siding is activated. +// If you change the direction of the turnout directly, the siding button will become dim again, indicating the siding is not active. + +// Step 6: Putting it all togther: Create a spur off of the top straight track that connects to two different sidings. Add siding RouteButtons to each. + + Track track01 = new Track( trackE, 0, 15, -30 ); // overlay a curve track named track01 connected to the beginning endpoint of trackE (the straight track at the top of the layout) + TrackButton turnout2 = new TrackButton( 20, 20, 2 ); // create a new TrackButton named turnout2 with a width and height of 20 pixels, and an ID of 2. + turnout2.addTrack( trackD, 0 ); // add the straight track to this turnout, set for un-thrown + turnout2.addTrack( track01, 1 ); // add the curve track to this turnout, set for thrown + + Track track02 = new Track( track01, 1, 6 ); // add a straight track named track02 connected to the end of curve track01 + Track track03 = new Track ( track02, 1, 15, -60 ); // add a curve track named track03 connected to the end of straight track02 + Track track10 = new Track( track03, 1, 3 ); // add a straight track named track10 connected to the end of straight track03 --- this is the end of the first siding -// Why bother creating two separate straight tracks of 6" and 3" at the end of the siding instead of just one 9" straight track? So we can add a siding route button near the end of the track + Track track04 = new Track( track01, 1, 15, -30 ); // overlay a curve track named track04 connected to the ending endpoint of track01 + Track track05 = new Track( track04, 1, 15, -30 ); // connect a second curve track named track0 + Track track06 = new Track( track05, 1, 3 ); // connect a small straight track to the end of this curve + Track track07 = new Track( track06, 1, 3 ); // connect a second straight track --- this is the end of the second siding + + TrackButton turnout3 = new TrackButton( 20, 20, 3 ); // create a new TrackButton named turnout3 with a width and height of 20 pixels, and an ID of 3. + turnout3.addTrack( track02, 0 ); // add the straight track to this turnout, set for un-thrown + turnout3.addTrack( track04, 1 ); // add the curve track to this turnout, set for thrown + + RouteButton sidingButton2 = new RouteButton( track10, 20, 20 ); // create a siding button named sidingButton2 in the middle of track03. + sidingButton2.addTrackButton( turnout2, 1 ); // cause turnout2 to be thrown when sidingButton2 is pressed + sidingButton2.addTrackButton( turnout3, 0 ); // cause turnout3 to be un-thrown when sidingButton2 is pressed + + RouteButton sidingButton3 = new RouteButton( track07, 20, 20 ); // create a siding button named sidingButton3 in the middle of track07. + sidingButton3.addTrackButton( turnout2, 1 ); // cause turnout2 to be thrown when sidingButton2 is pressed + sidingButton3.addTrackButton( turnout3, 1 ); // cause turnout3 to be thrown when sidingButton2 is pressed + +// Step 7: How about adding a Standalone RouteButton so that with one click we can set all the turnouts to be aligned with the main oval + +// Format to create a Standalone RouteButton: RouteButton(x,y,width,height,label) +// +// x,y: the x- and y-coordinate (in pixels) of the center of the RouteButton +// width: the width (in pixels) of the RouteButton +// height: the height (in pixels) of the RouteButton +// label: a descriptive label for the RouteButton + + RouteButton setOvalButton = new RouteButton( 600, 500, 70, 30, "Set Oval" ); // create a standalone route button named "Set Oval" at (x,y)=(600,500). Width=70 pixels, Height=30 pixels + +// Turnouts are add to standalone RouteButtons in the exact same way as for siding RouteButtons + + setOvalButton.addTrackButton( turnout1, 0 ); // cause turnout1 to be un-thrown when setOvalButton is pressed + setOvalButton.addTrackButton( turnout2, 0 ); // cause turnout2 to be un-thrown when setOvalButton is pressed + +// Note how this standalone siding button is lit only when all of the turnouts are set in the required directions + +////// END OF SAMPLE LAYOUT //////// + + + From a05fc683cc5a84e6c51a03cad9ae4b17b78831a5 Mon Sep 17 00:00:00 2001 From: DccPlusPlus Date: Sat, 27 Feb 2016 07:29:05 -0500 Subject: [PATCH 3/3] Completed Oval Layout Sample Added Route Button highlights --- DCCpp_Controller/controllerConfig.pde | 741 ++------------------------ 1 file changed, 49 insertions(+), 692 deletions(-) diff --git a/DCCpp_Controller/controllerConfig.pde b/DCCpp_Controller/controllerConfig.pde index 9a007c9..284f6bd 100644 --- a/DCCpp_Controller/controllerConfig.pde +++ b/DCCpp_Controller/controllerConfig.pde @@ -368,11 +368,9 @@ autoPilot=new AutoPilotButton(325,550,100,50,30,18,"AUTO\nPILOT"); cleaningCab=new CleaningCarButton(extrasWindow,28,80,80,120,50,40,16,"Cleaning\nCar"); -////// BEGINNING OF SAMPLE LAYOUT //////// +////// BEGINNING OF SAMPLE OVAL LAYOUT ///////////////////////////////////////////////////////////////////////////////////////// -// CREATE MAIN LAYOUT AND DEFINE ALL TRACKS - -// Step 1: Define a LAYOUT object that creates a "frame" into which TRACKS be placed +// STEP 1: Define a LAYOUT OBJECT that creates a "frame" into which TRACKS be placed // // Format is Layout(xCorner, yCorner, frameWidth, layoutWidth, layoutHeight) // @@ -387,7 +385,7 @@ Layout myLayout = new Layout( 400, 100, 700, 60, 36 ); // creates a frame with upper left coordinate of (400,100), a width of 700 pixels, and real-world size of 60 inches wide by 36 inches deep -// Step 2: Create the TRACKS +// STEP 2: Create TRACK OBJECTS // // * You can create either a straight track or a curved track // * You can place the track directly on the layout in an absolute position, or have one end of the track connect to the end of an existing track already on the layout (i.e. a relative position) @@ -447,7 +445,7 @@ // Viola - we have an oval! -// Step 3: Add a turnout +// STEP 3: Add a TURNOUT // Recall that instead of creating our 24" straight tracks with a single 24" graphic, we used a combination of one 9" track with one 15" track. This is because each 9" straight track is going to form the straight part of a turnout. // We create the turnout by simply "overlaying" a curve track on top of an existing straight track. In this case, on top of the 9" straight tracks. @@ -460,7 +458,7 @@ Track trackG = new Track( trackC, 0, 15, -30 ); // connect a clockwise curved track named trackG to the "beginning" endpoint of previously-created trackC. Radius is 15" and total arc angle is 30 degrees // Now that we have the graphic in place for the turnout, let's make it operational so that it flips when we click it. -// We do that with a serial of TrackButton commands. First we create a new TrackButton object: +// We do that by creating a TRACKBUTTON OBJECT. // Format to create a new TrackButton object: TrackButton(width,height,ID) // @@ -470,7 +468,7 @@ TrackButton turnout1 = new TrackButton( 20, 20, 1 ); // create a new TrackButton named turnout1 with a width and height of 20 pixels, and an ID of 1. -// Next we have to specify that tracks that form the legs of the turnouts. We do this with the addTrack method. +// Next we have to specify that tracks that form the legs of the turnouts. We do this with the ADDTRACK METHOD. // // Format to add tracks to a previously-defined TrackButton: addTrack(trackName,position) // @@ -482,15 +480,15 @@ // And that's all you need to do! If you hover over the center point of this turnout (within a 20x20 pixel area as we specified), the cursor will change to a hand and you will be able to throw and reset the turnout. -// Step 4: Add siding tracks to the turnout +// STEP 4: Add siding tracks to the turnout -// Let's extend the turnout into a full siding. We'll start with a straight track, the a curve, and then another straights. +// Let's extend the turnout into a full siding. We'll start with a straight track, the a curve, and then another straight. Track trackH = new Track( trackG, 1, 6 ); // connect a straight track named trackH to the "ending" endpoint of previously-created trackG. Length of this track is 6" Track trackI = new Track( trackH, 1, 15, 30 ); // connect a counter-clockwise curved track named trackI to the ending endpoint of previously-created trackH. Radius is 15" and total arc angle is 30 degrees Track trackJ = new Track( trackI, 1, 9 ); // connect a straight track named trackJ to the "ending" endpoint of previously-created trackI. Length of this track is 9" -// Step 5: Add a route button to the siding +// STEP 5: Add a ROUTEBUTTON OBJECT to the siding // As an option, we can add a siding route button to this siding. // Siding route buttons are simply route buttons that are placed on a track. @@ -504,7 +502,7 @@ RouteButton sidingButton1 = new RouteButton( trackJ, 20, 20 ); // create a siding button named sidingButton1 in the middle of trackJ. The button is 20x20 pixels is size. -// Once the button is created, we now need to define which turnouts it should operate. We do this with the addTrackButton method: +// Once the button is created, we now need to define which turnouts it should operate. We do this with the ADDTRACKBUTTON METHOD: // // Format to add turnouts to a previously-defined RouteButton: addTrackButton(trackButtonName,position) // @@ -517,7 +515,24 @@ // Note that the siding button only operates the turnout in one direction, and it turns bright green when the siding is activated. // If you change the direction of the turnout directly, the siding button will become dim again, indicating the siding is not active. -// Step 6: Putting it all togther: Create a spur off of the top straight track that connects to two different sidings. Add siding RouteButtons to each. +// As an option, you can have the layout highlight any set of tracks associated with a route when you hover over the route button. +// Let's do this for the siding button we just created using the ADDTRACK METHOD. + +// Format to add tracks to a previously-defined RouteButton: addTrack(trackName) +// +// trackName: the name of a previously-defined track to highlight when this route button is selected + + sidingButton1.addTrack( trackG ); // highlight the curve track from the turnout leading into this siding + sidingButton1.addTrack( trackH ); // highlight the first straight track of the siding + sidingButton1.addTrack( trackI ); // highlight the curve track in the middle of the siding + sidingButton1.addTrack( trackJ ); // highlight the first straight track at the end of the siding + +// Now when you hover over the siding route button you'll see the siding itself, including the turnout, highlighted. +// Note that turnouts that will be switched if you press the route button are shown in red. Turnouts that are already +// set in the correct direction for the route button are shown in green. This way you'll know exactly what turnouts will +// change if you actually press the route button. + +// STEP 6: Putting it all togther: Create a spur off of the top straight track that connects to two different sidings. Add siding RouteButtons to each. Track track01 = new Track( trackE, 0, 15, -30 ); // overlay a curve track named track01 connected to the beginning endpoint of trackE (the straight track at the top of the layout) TrackButton turnout2 = new TrackButton( 20, 20, 2 ); // create a new TrackButton named turnout2 with a width and height of 20 pixels, and an ID of 2. @@ -540,12 +555,21 @@ RouteButton sidingButton2 = new RouteButton( track10, 20, 20 ); // create a siding button named sidingButton2 in the middle of track03. sidingButton2.addTrackButton( turnout2, 1 ); // cause turnout2 to be thrown when sidingButton2 is pressed sidingButton2.addTrackButton( turnout3, 0 ); // cause turnout3 to be un-thrown when sidingButton2 is pressed + sidingButton2.addTrack( track01 ); // add the tracks of this siding to be highlighted when hovering over this route buton + sidingButton2.addTrack( track02 ); // add the tracks of this siding to be highlighted when hovering over this route buton + sidingButton2.addTrack( track03 ); // add the tracks of this siding to be highlighted when hovering over this route buton + sidingButton2.addTrack( track10 ); // add the tracks of this siding to be highlighted when hovering over this route buton RouteButton sidingButton3 = new RouteButton( track07, 20, 20 ); // create a siding button named sidingButton3 in the middle of track07. sidingButton3.addTrackButton( turnout2, 1 ); // cause turnout2 to be thrown when sidingButton2 is pressed sidingButton3.addTrackButton( turnout3, 1 ); // cause turnout3 to be thrown when sidingButton2 is pressed + sidingButton3.addTrack( track01 ); // add the tracks of this siding to be highlighted when hovering over this route buton + sidingButton3.addTrack( track04 ); // add the tracks of this siding to be highlighted when hovering over this route buton + sidingButton3.addTrack( track05 ); // add the tracks of this siding to be highlighted when hovering over this route buton + sidingButton3.addTrack( track06 ); // add the tracks of this siding to be highlighted when hovering over this route buton + sidingButton3.addTrack( track07 ); // add the tracks of this siding to be highlighted when hovering over this route buton -// Step 7: How about adding a Standalone RouteButton so that with one click we can set all the turnouts to be aligned with the main oval +// STEP 7: How about adding a Standalone RouteButton so that with one click we can set all the turnouts to be aligned with the main oval? // Format to create a Standalone RouteButton: RouteButton(x,y,width,height,label) // @@ -561,687 +585,20 @@ setOvalButton.addTrackButton( turnout1, 0 ); // cause turnout1 to be un-thrown when setOvalButton is pressed setOvalButton.addTrackButton( turnout2, 0 ); // cause turnout2 to be un-thrown when setOvalButton is pressed -// Note how this standalone siding button is lit only when all of the turnouts are set in the required directions - -////// END OF SAMPLE LAYOUT //////// - - - - - +// Similarly, you can highlight certin tracks as part of the route button + + setOvalButton.addTrack( trackA ); // add the tracks of this siding to be highlighted when hovering over this route buton + setOvalButton.addTrack( trackB ); // add the tracks of this siding to be highlighted when hovering over this route buton + setOvalButton.addTrack( trackC ); // add the tracks of this siding to be highlighted when hovering over this route buton + setOvalButton.addTrack( trackD ); // add the tracks of this siding to be highlighted when hovering over this route buton + setOvalButton.addTrack( trackE ); // add the tracks of this siding to be highlighted when hovering over this route buton + setOvalButton.addTrack( trackF ); // add the tracks of this siding to be highlighted when hovering over this route buton +// Note how this standalone siding button is lit only when all of the turnouts are set in the required directions +// Congratulations! You've completed an oval layout with three turnouts, three sidings, and four routes. - - - - - - - -/* -Track bridgeA = new Track(layout,20,450,62,90); - Track bridgeB = new Track(bridgeA,1,348,-90); - Track bridgeC = new Track(bridgeB,1,399); - Track t5A = new Track(bridgeC,1,126); - Track loop3A = new Track(t5A,1,682); - Track loop3B = new Track(loop3A,1,381,-180); - Track loop3C = new Track(loop3B,1,124); - Track t20A2 = new Track(loop3C,1,126); - Track t20B2 = new Track(loop3C,1,481,15); - Track t20B1 = new Track(t20B2,1,481,-15); - Track loop2A3A = new Track(t20A2,1,120); - Track t30A1 = new Track(loop2A3A,1,126); - Track t30A2 = new Track(t30A1,1,126); - Track t30B1 = new Track(loop2A3A,1,481,-15); - Track t30B4 = new Track(t30B1,1,481,15); - Track loop2C = new Track(t30A2,1,122); - Track t10A3 = new Track(loop2C,1,126); - Track t10B3 = new Track(loop2C,1,481,15); - Track t10A4 = new Track(t10A3,1,126); - Track t10B2 = new Track(t10B3,1,481,-15); - Track loop2D = new Track(t10A4,1,62); - Track loop2E = new Track(loop2D,1,315,-165); - Track loop2F = new Track(loop2E,1,128); - Track loop2G = new Track(loop2F,1,315,-15); - Track loop2H = new Track(loop2G,1,742); - Track t50A2 = new Track(loop2H,1,126); - Track loop2A = new Track(t50A2,1,315,-180); - Track loop2B = new Track(loop2A,1,308); - Track t30A3 = new Track(loop2B,1,126); - Track t30A4 = new Track(t30A3,1,126); - Track t30B3 = new Track(loop2B,1,481,15); - Track t30B2 = new Track(t30B3,1,481,-15); - Track loop1A2A = new Track(t30A4,1,60); - Track t40A1 = new Track(loop1A2A,1,126); - Track loop1B = new Track(t40A1,1,248); - Track loop1C = new Track(loop1B,1,282,-165); - Track loop1D = new Track(loop1C,1,128); - Track loop1E = new Track(loop1D,1,282,-15); - Track t4A = new Track(loop1E,1,126); - Track t4B = new Track(loop1E,1,481,-15); - Track loop1F = new Track(t4A,1,494); - Track t50A1 = new Track(loop1F,1,126); - Track t50B1 = new Track(loop1F,1,481,15); - Track t50B2 = new Track(t50B1,1,481,-15); - Track loop1G = new Track(t50A1,1,122); - Track loop1H = new Track(loop1G,1,282,-180); - Track loop1I = new Track(loop1H,1,62); - Track t1A = new Track(loop1I,1,126); - Track t1B = new Track(loop1I,1,481,-15); - Track loop1A = new Track(t1A,1,308); - Track t40A2 = new Track(loop1A,1,126); - Track t40B2 = new Track(loop1A,1,481,15); - Track t40B1 = new Track(t40B2,1,481,-15); - Track s1A = new Track(t40A2,1,60); - Track s1B = new Track(s1A,1,481,-15); - Track s1C = new Track(s1B,1,339); - Track s1 = new Track(s1C,1,50); - Track loop3D = new Track(t20B1,1,370); - Track t20A1 = new Track(loop3D,0,126); - Track t10A1 = new Track(loop3D,1,126); - Track t10B1 = new Track(loop3D,1,481,-15); - Track t10B4 = new Track(t10B1,1,481,15); - Track t10A2 = new Track(t10A1,1,126); - Track loop3E = new Track(t10A2,1,62); - Track loop3F = new Track(loop3E,1,381,-180); - Track loop3G = new Track(loop3F,1,124); - Track loop3H = new Track(loop3G,1,481,15); - Track t5B = new Track(loop3H,1,481,-15); - Track s7A = new Track(t20A1,1,337); - Track s7B = new Track(s7A,1,348,90); - Track s7C = new Track(s7B,1,124); - Track s7D = new Track(s7C,1,481,15); - Track s7E = new Track(s7D,1,124); - Track s7 = new Track(s7E,1,62); - Track t2A = new Track(t1B,1,126); - Track t2B = new Track(t1B,1,481,-15); - Track s2_3_4_5A = new Track(t2A,1,64); - Track t3A = new Track(s2_3_4_5A,1,126); - Track t3B = new Track(s2_3_4_5A,1,481,15); - Track s2A = new Track(t3B,1,30); - Track s2B = new Track(s2A,1,481,15); - Track s2C = new Track(s2B,1,481,-30); - Track s2D = new Track(s2C,1,248); - Track s2 = new Track(s2D,1,50); - Track t6A = new Track(t3A,1,126); - Track t6B = new Track(t3A,1,481,-15); - Track s3A = new Track(t6A,1,556); - Track s3 = new Track(s3A,1,50); - Track t9A = new Track(t6B,1,126); - Track t9B = new Track(t6B,1,481,15); - Track s4A = new Track(t9B,1,479); - Track s4 = new Track(s4A,1,50); - Track s5A = new Track(t9A,1,481,15); - Track s5B = new Track(s5A,1,341); - Track s5 = new Track(s5B,1,50); - Track rLoopA = new Track(t4B,1,282,-45); - Track rLoopB = new Track(rLoopA,1,87); - Track t7A = new Track(rLoopB,1,126); - Track t7B = new Track(rLoopB,1,481,15); - Track rLoopC = new Track(t7A,1,481,15); - Track rLoopD = new Track(rLoopC,1,425,15); - Track s6A = new Track(t7B,1,60); - Track s6B = new Track(s6A,1,282,45); - Track s6C = new Track(s6B,1,481,30); - Track s6D = new Track(s6C,1,188); - Track s6 = new Track(s6D,1,50); - Track bridgeD = new Track(bridgeA,0,348,60); - -// CREATE SECOND LAYOUT FOR SKY BRIDGE AND DEFINE TRACKS - - layout2=new Layout(325,500,400,80*25.4,36*25.4); - layoutBridge=new Layout(layout2); - - Track bridgeE = new Track(bridgeD,1,348,60,layoutBridge); - Track bridgeF = new Track(bridgeE,1,248); - Track t8A = new Track(bridgeF,1,200); - Track t8B = new Track(bridgeF,1,400,-35); - Track bridgeG = new Track(t8A,1,618); - Track bridgeH = new Track(bridgeG,1,282,-226); - Track bridgeI = new Track(bridgeH,1,558); - -// DEFINE SENSORS, MAP TO ARDUINO NUMBERS, AND INDICATE THEIR TRACK LOCATIONS - - new TrackSensor(loop3B,1,30,20,20,1,false); // mappings from Sensor numbers (1..N) to Arduino Pins - new TrackSensor(t50A2,1,315,-174,20,20,2,false); - new TrackSensor(loop2D,1,315,-47,20,20,3,false); - new TrackSensor(loop1B,1,282,-45,20,20,4,false); - new TrackSensor(loop3E,1,381,-45,20,20,5,false); - new TrackSensor(bridgeA,1,348,-10,20,20,6,false); - new TrackSensor(s1A,1,481,-5,20,20,7,true); - new TrackSensor(s2B,1,481,-5,20,20,8,true); - new TrackSensor(t6A,1,175,20,20,9,true); - new TrackSensor(s6A,1,282,10,20,20,10,true); - new TrackSensor(loop1G,1,282,-137,20,20,11,false); - new TrackSensor(t9B,1,100,20,20,12,true); - new TrackSensor(s5A,1,30,20,20,13,true); - new TrackSensor(s7A,1,348,50,20,20,14,true); - -// CREATE TURNOUT BUTTONS and ADD TRACKS FOR EACH TURNOUT - - tButton1 = new TrackButton(20,20,1); - tButton1.addTrack(t1A,0); - tButton1.addTrack(t1B,1); - - tButton2 = new TrackButton(20,82,2); - tButton2.addTrack(t2A,0); - tButton2.addTrack(t2B,1); - - tButton3 = new TrackButton(20,20,3); - tButton3.addTrack(t3A,0); - tButton3.addTrack(t3B,1); - - tButton4 = new TrackButton(20,20,4); - tButton4.addTrack(t4A,0); - tButton4.addTrack(t4B,1); - - tButton5 = new TrackButton(20,20,5); - tButton5.addTrack(t5A,0); - tButton5.addTrack(t5B,1); - - tButton6 = new TrackButton(20,20,6); - tButton6.addTrack(t6A,0); - tButton6.addTrack(t6B,1); - - tButton7 = new TrackButton(20,20,7); - tButton7.addTrack(t7A,0); - tButton7.addTrack(t7B,1); - - tButton8 = new TrackButton(20,20,8); - tButton8.addTrack(t8A,0); - tButton8.addTrack(t8B,1); - - tButton9 = new TrackButton(20,20,9); - tButton9.addTrack(t9A,0); - tButton9.addTrack(t9B,1); - - tButton10 = new TrackButton(20,20,10); - tButton10.addTrack(t10A1,0); - tButton10.addTrack(t10A2,0); - tButton10.addTrack(t10A3,0); - tButton10.addTrack(t10A4,0); - tButton10.addTrack(t10B1,1); - tButton10.addTrack(t10B2,1); - tButton10.addTrack(t10B3,1); - tButton10.addTrack(t10B4,1); - - tButton20 = new TrackButton(20,20,20); - tButton20.addTrack(t20A1,0); - tButton20.addTrack(t20A2,0); - tButton20.addTrack(t20B1,1); - tButton20.addTrack(t20B2,1); - - tButton30 = new TrackButton(20,20,30); - tButton30.addTrack(t30A1,0); - tButton30.addTrack(t30A2,0); - tButton30.addTrack(t30A3,0); - tButton30.addTrack(t30A4,0); - tButton30.addTrack(t30B1,1); - tButton30.addTrack(t30B2,1); - tButton30.addTrack(t30B3,1); - tButton30.addTrack(t30B4,1); - - tButton40 = new TrackButton(20,20,40); - tButton40.addTrack(t40A1,0); - tButton40.addTrack(t40A2,0); - tButton40.addTrack(t40B1,1); - tButton40.addTrack(t40B2,1); - - tButton50 = new TrackButton(20,20,50); - tButton50.addTrack(t50A1,0); - tButton50.addTrack(t50A2,0); - tButton50.addTrack(t50B1,1); - tButton50.addTrack(t50B2,1); - -// CREATE ROUTE BUTTONS and ADD TRACKS and TURNOUT BUTTONS - - rButton1 = new RouteButton(s1,20,20); - rButton1.addTrackButton(tButton40,0); - rButton1.addTrackButton(tButton1,0); - rButton1.addTrack(t1A); - rButton1.addTrack(loop1A); - rButton1.addTrack(t40A2); - rButton1.addTrack(s1A); - rButton1.addTrack(s1B); - rButton1.addTrack(s1C); - rButton1.addTrack(s1); - - rButton2 = new RouteButton(s2,20,20); - rButton2.addTrackButton(tButton3,1); - rButton2.addTrackButton(tButton2,0); - rButton2.addTrackButton(tButton1,1); - rButton2.addTrack(t1B); - rButton2.addTrack(t2A); - rButton2.addTrack(s2_3_4_5A); - rButton2.addTrack(t3B); - rButton2.addTrack(s2A); - rButton2.addTrack(s2B); - rButton2.addTrack(s2C); - rButton2.addTrack(s2D); - rButton2.addTrack(s2); - - rButton3 = new RouteButton(s3,20,20); - rButton3.addTrackButton(tButton6,0); - rButton3.addTrackButton(tButton3,0); - rButton3.addTrackButton(tButton2,0); - rButton3.addTrackButton(tButton1,1); - rButton3.addTrack(t1B); - rButton3.addTrack(t2A); - rButton3.addTrack(s2_3_4_5A); - rButton3.addTrack(t3A); - rButton3.addTrack(t6A); - rButton3.addTrack(s3A); - rButton3.addTrack(s3); - - rButton4 = new RouteButton(s4,20,20); - rButton4.addTrackButton(tButton9,1); - rButton4.addTrackButton(tButton6,1); - rButton4.addTrackButton(tButton3,0); - rButton4.addTrackButton(tButton2,0); - rButton4.addTrackButton(tButton1,1); - rButton4.addTrack(t1B); - rButton4.addTrack(t2A); - rButton4.addTrack(s2_3_4_5A); - rButton4.addTrack(t3A); - rButton4.addTrack(t6B); - rButton4.addTrack(t9B); - rButton4.addTrack(s4A); - rButton4.addTrack(s4); - - rButton5 = new RouteButton(s5,20,20); - rButton5.addTrackButton(tButton9,0); - rButton5.addTrackButton(tButton6,1); - rButton5.addTrackButton(tButton3,0); - rButton5.addTrackButton(tButton2,0); - rButton5.addTrackButton(tButton1,1); - rButton5.addTrack(t1B); - rButton5.addTrack(t2A); - rButton5.addTrack(s2_3_4_5A); - rButton5.addTrack(t3A); - rButton5.addTrack(t6B); - rButton5.addTrack(t9A); - rButton5.addTrack(s5A); - rButton5.addTrack(s5B); - rButton5.addTrack(s5); - - rButton6 = new RouteButton(s6,20,20); - rButton6.addTrackButton(tButton7,1); - rButton6.addTrackButton(tButton4,1); - rButton6.addTrack(t7B); - rButton6.addTrack(t4B); - rButton6.addTrack(rLoopA); - rButton6.addTrack(rLoopB); - rButton6.addTrack(s6A); - rButton6.addTrack(s6B); - rButton6.addTrack(s6C); - rButton6.addTrack(s6D); - rButton6.addTrack(s6); - - rButton7 = new RouteButton(s7,20,20); - rButton7.addTrackButton(tButton20,0); - rButton7.addTrackButton(tButton10,0); - rButton7.addTrack(t20A1); - rButton7.addTrack(t10A1); - rButton7.addTrack(t10A2); - rButton7.addTrack(s7A); - rButton7.addTrack(s7B); - rButton7.addTrack(s7C); - rButton7.addTrack(s7D); - rButton7.addTrack(s7E); - rButton7.addTrack(s7); - rButton7.addTrack(loop3D); - - rButton10 = new RouteButton(rX,rY,80,40,"Inner\nLoop"); - rButton10.addTrackButton(tButton50,0); - rButton10.addTrackButton(tButton1,0); - rButton10.addTrackButton(tButton40,1); - rButton10.addTrackButton(tButton4,0); - rButton10.addTrack(t40B1); - rButton10.addTrack(t40B2); - rButton10.addTrack(t4A); - rButton10.addTrack(t50A1); - rButton10.addTrack(t1A); - rButton10.addTrack(loop1A); - rButton10.addTrack(loop1B); - rButton10.addTrack(loop1C); - rButton10.addTrack(loop1D); - rButton10.addTrack(loop1E); - rButton10.addTrack(loop1F); - rButton10.addTrack(loop1G); - rButton10.addTrack(loop1H); - rButton10.addTrack(loop1I); - - rButton11 = new RouteButton(rX+200,rY,80,40,"Middle\nLoop"); - rButton11.addTrackButton(tButton50,0); - rButton11.addTrackButton(tButton30,1); - rButton11.addTrackButton(tButton10,0); - rButton11.addTrack(t50A2); - rButton11.addTrack(t30B3); - rButton11.addTrack(t30B2); - rButton11.addTrack(t10A3); - rButton11.addTrack(t10A4); - rButton11.addTrack(loop2A); - rButton11.addTrack(loop2B); - rButton11.addTrack(loop2C); - rButton11.addTrack(loop2D); - rButton11.addTrack(loop2E); - rButton11.addTrack(loop2F); - rButton11.addTrack(loop2G); - rButton11.addTrack(loop2H); - - rButton12 = new RouteButton(rX+400,rY,80,40,"Outer\nLoop"); - rButton12.addTrackButton(tButton20,1); - rButton12.addTrackButton(tButton5,1); - rButton12.addTrackButton(tButton10,0); - rButton12.addTrack(t20B2); - rButton12.addTrack(t20B1); - rButton12.addTrack(t10A1); - rButton12.addTrack(t10A2); - rButton12.addTrack(t5B); - rButton12.addTrack(loop3A); - rButton12.addTrack(loop3B); - rButton12.addTrack(loop3C); - rButton12.addTrack(loop3D); - rButton12.addTrack(loop3E); - rButton12.addTrack(loop3F); - rButton12.addTrack(loop3G); - rButton12.addTrack(loop3H); - - rButton13 = new RouteButton(rX+100,rY,80,40,"Inner/Mid"); - rButton13.addTrackButton(tButton50,1); - rButton13.addTrackButton(tButton30,0); - rButton13.addTrackButton(tButton40,0); - rButton13.addTrackButton(tButton4,0); - rButton13.addTrack(t40A1); - rButton13.addTrack(loop1B); - rButton13.addTrack(loop1C); - rButton13.addTrack(loop1D); - rButton13.addTrack(loop1E); - rButton13.addTrack(t4A); - rButton13.addTrack(loop1F); - rButton13.addTrack(t50B1); - rButton13.addTrack(t50B2); - rButton13.addTrack(loop2A); - rButton13.addTrack(loop2B); - rButton13.addTrack(t30A3); - rButton13.addTrack(t30A4); - rButton13.addTrack(loop1A2A); - - rButton14 = new RouteButton(rX+300,rY,80,40,"Mid/Outer"); - rButton14.addTrackButton(tButton5,1); - rButton14.addTrackButton(tButton20,0); - rButton14.addTrackButton(tButton30,0); - rButton14.addTrackButton(tButton10,1); - rButton14.addTrack(t5B); - rButton14.addTrack(loop3A); - rButton14.addTrack(loop3B); - rButton14.addTrack(loop3C); - rButton14.addTrack(t20A2); - rButton14.addTrack(loop2A3A); - rButton14.addTrack(t30A1); - rButton14.addTrack(t30A2); - rButton14.addTrack(loop2C); - rButton14.addTrack(t10B3); - rButton14.addTrack(t10B2); - rButton14.addTrack(loop3E); - rButton14.addTrack(loop3F); - rButton14.addTrack(loop3G); - rButton14.addTrack(loop3H); - - rButtonR1 = new RouteButton(rX,rY+60,80,40,"Reverse+"); - rButtonR1.addTrackButton(tButton4,1); - rButtonR1.addTrackButton(tButton7,0); - rButtonR1.addTrackButton(tButton1,0); - rButtonR1.addTrack(t4B); - rButtonR1.addTrack(rLoopA); - rButtonR1.addTrack(rLoopB); - rButtonR1.addTrack(t7A); - rButtonR1.addTrack(t1A); - - rButtonR2 = new RouteButton(rX+100,rY+60,80,40,"Reverse-"); - rButtonR2.addTrackButton(tButton1,1); - rButtonR2.addTrackButton(tButton2,1); - rButtonR2.addTrackButton(tButton4,0); - rButtonR2.addTrack(t4A); - rButtonR2.addTrack(t1B); - rButtonR2.addTrack(t2B); - rButtonR2.addTrack(rLoopC); - rButtonR2.addTrack(rLoopD); - - rButton15 = new RouteButton(rX+200,rY+60,80,40,"Mid+Outer"); - rButton15.addTrackButton(tButton5,1); - rButton15.addTrackButton(tButton10,1); - rButton15.addTrackButton(tButton20,1); - rButton15.addTrackButton(tButton30,1); - rButton15.addTrackButton(tButton50,0); - rButton15.addTrack(t20B2); - rButton15.addTrack(t20B1); - rButton15.addTrack(t10B1); - rButton15.addTrack(t10B2); - rButton15.addTrack(t5B); - rButton15.addTrack(loop3A); - rButton15.addTrack(loop3B); - rButton15.addTrack(loop3C); - rButton15.addTrack(loop3D); - rButton15.addTrack(loop3E); - rButton15.addTrack(loop3F); - rButton15.addTrack(loop3G); - rButton15.addTrack(loop3H); - rButton15.addTrack(t50A2); - rButton15.addTrack(t30B3); - rButton15.addTrack(t30B2); - rButton15.addTrack(t10B3); - rButton15.addTrack(t10B4); - rButton15.addTrack(loop2A); - rButton15.addTrack(loop2B); - rButton15.addTrack(loop2C); - rButton15.addTrack(loop2D); - rButton15.addTrack(loop2E); - rButton15.addTrack(loop2F); - rButton15.addTrack(loop2G); - rButton15.addTrack(loop2H); - - rButton16 = new RouteButton(rX+300,rY+60,80,40,"In+Outer"); - rButton16.addTrackButton(tButton4,0); - rButton16.addTrackButton(tButton5,1); - rButton16.addTrackButton(tButton10,1); - rButton16.addTrackButton(tButton20,0); - rButton16.addTrackButton(tButton30,1); - rButton16.addTrackButton(tButton40,0); - rButton16.addTrackButton(tButton50,1); - rButton16.addTrack(t40A1); - rButton16.addTrack(loop1B); - rButton16.addTrack(loop1C); - rButton16.addTrack(loop1D); - rButton16.addTrack(loop1E); - rButton16.addTrack(t4A); - rButton16.addTrack(loop1F); - rButton16.addTrack(t50B1); - rButton16.addTrack(t50B2); - rButton16.addTrack(loop2A); - rButton16.addTrack(loop2B); - rButton16.addTrack(t30B1); - rButton16.addTrack(t30B2); - rButton16.addTrack(t30B3); - rButton16.addTrack(t30B4); - rButton16.addTrack(loop1A2A); - rButton16.addTrack(t5B); - rButton16.addTrack(loop3A); - rButton16.addTrack(loop3B); - rButton16.addTrack(loop3C); - rButton16.addTrack(t20A2); - rButton16.addTrack(loop2A3A); - rButton16.addTrack(loop2C); - rButton16.addTrack(t10B3); - rButton16.addTrack(t10B2); - rButton16.addTrack(loop3E); - rButton16.addTrack(loop3F); - rButton16.addTrack(loop3G); - rButton16.addTrack(loop3H); - - rButton17 = new RouteButton(rX,rY+120,80,40,"Double X"); - rButton17.addTrackButton(tButton5,0); - rButton17.addTrackButton(tButton20,0); - rButton17.addTrackButton(tButton30,1); - rButton17.addTrackButton(tButton40,0); - rButton17.addTrackButton(tButton50,0); - rButton17.addTrackButton(tButton4,1); - rButton17.addTrackButton(tButton7,0); - rButton17.addTrackButton(tButton1,0); - rButton17.addTrack(t4B); - rButton17.addTrack(rLoopA); - rButton17.addTrack(rLoopB); - rButton17.addTrack(t7A); - rButton17.addTrack(t1A); - rButton17.addTrack(loop1B); - rButton17.addTrack(loop1C); - rButton17.addTrack(loop1D); - rButton17.addTrack(loop1E); - rButton17.addTrack(loop1F); - rButton17.addTrack(loop1G); - rButton17.addTrack(loop1H); - rButton17.addTrack(loop1I); - rButton17.addTrack(t50A1); - rButton17.addTrack(t40A1); - rButton17.addTrack(loop1A2A); - rButton17.addTrack(t30B4); - rButton17.addTrack(t30B1); - rButton17.addTrack(loop3A); - rButton17.addTrack(loop3B); - rButton17.addTrack(loop3C); - rButton17.addTrack(t20A2); - rButton17.addTrack(loop2A3A); - rButton17.addTrack(t5A); - rButton17.addTrack(bridgeA); - rButton17.addTrack(bridgeB); - rButton17.addTrack(bridgeC); - rButton17.addTrack(bridgeD); - rButton17.addTrack(bridgeE); - rButton17.addTrack(bridgeF); - rButton17.addTrack(bridgeG); - rButton17.addTrack(bridgeH); - rButton17.addTrack(bridgeI); - - rButtonSpiral = new RouteButton(rX+100,rY+120,80,40,"Spiral"); - rButtonSpiral.addTrackButton(tButton4,1); - rButtonSpiral.addTrackButton(tButton5,0); - rButtonSpiral.addTrackButton(tButton7,0); - rButtonSpiral.addTrackButton(tButton1,0); - rButtonSpiral.addTrackButton(tButton10,0); - rButtonSpiral.addTrackButton(tButton20,0); - rButtonSpiral.addTrackButton(tButton30,0); - rButtonSpiral.addTrackButton(tButton40,0); - rButtonSpiral.addTrackButton(tButton50,0); - rButtonSpiral.addTrack(t4B); - rButtonSpiral.addTrack(rLoopA); - rButtonSpiral.addTrack(rLoopB); - rButtonSpiral.addTrack(t7A); - rButtonSpiral.addTrack(t1A); - rButtonSpiral.addTrack(loop1B); - rButtonSpiral.addTrack(loop1C); - rButtonSpiral.addTrack(loop1D); - rButtonSpiral.addTrack(loop1E); - rButtonSpiral.addTrack(loop1F); - rButtonSpiral.addTrack(loop1G); - rButtonSpiral.addTrack(loop1H); - rButtonSpiral.addTrack(loop1I); - rButtonSpiral.addTrack(t50A1); - rButtonSpiral.addTrack(t40A1); - rButtonSpiral.addTrack(loop1A2A); - rButtonSpiral.addTrack(t30A4); - rButtonSpiral.addTrack(t30A3); - rButtonSpiral.addTrack(t50A2); - rButtonSpiral.addTrack(loop2A); - rButtonSpiral.addTrack(loop2B); - rButtonSpiral.addTrack(loop2C); - rButtonSpiral.addTrack(loop2D); - rButtonSpiral.addTrack(loop2E); - rButtonSpiral.addTrack(loop2F); - rButtonSpiral.addTrack(loop2G); - rButtonSpiral.addTrack(loop2H); - rButtonSpiral.addTrack(t10A3); - rButtonSpiral.addTrack(t10A4); - rButtonSpiral.addTrack(t30A1); - rButtonSpiral.addTrack(t30A2); - rButtonSpiral.addTrack(loop2A3A); - rButtonSpiral.addTrack(t20A2); - rButtonSpiral.addTrack(loop3A); - rButtonSpiral.addTrack(loop3B); - rButtonSpiral.addTrack(loop3C); - rButtonSpiral.addTrack(t5A); - rButtonSpiral.addTrack(bridgeA); - rButtonSpiral.addTrack(bridgeB); - rButtonSpiral.addTrack(bridgeC); - rButtonSpiral.addTrack(bridgeD); - rButtonSpiral.addTrack(bridgeE); - rButtonSpiral.addTrack(bridgeF); - rButtonSpiral.addTrack(bridgeG); - rButtonSpiral.addTrack(bridgeH); - rButtonSpiral.addTrack(bridgeI); - - rButtonReset = new RouteButton(rX+400,rY+120,80,40,"RESET"); - rButtonReset.addTrackButton(tButton40,0); - rButtonReset.addTrackButton(tButton3,0); - rButtonReset.addTrackButton(tButton2,0); - rButtonReset.addTrackButton(tButton8,0); - rButtonReset.addTrackButton(tButton10,0); - rButtonReset.addTrackButton(tButton20,0); - rButtonReset.addTrackButton(tButton9,0); - rButtonReset.addTrackButton(tButton4,0); - rButtonReset.addTrackButton(tButton1,0); - rButtonReset.addTrackButton(tButton5,0); - rButtonReset.addTrackButton(tButton50,0); - rButtonReset.addTrackButton(tButton6,0); - rButtonReset.addTrackButton(tButton7,0); - rButtonReset.addTrackButton(tButton30,0); - rButtonReset.addTrack(t1A); - rButtonReset.addTrack(t2A); - rButtonReset.addTrack(t3A); - rButtonReset.addTrack(t4A); - rButtonReset.addTrack(t5A); - rButtonReset.addTrack(t6A); - rButtonReset.addTrack(t7A); - rButtonReset.addTrack(t8A); - rButtonReset.addTrack(t9A); - rButtonReset.addTrack(t10A1); - rButtonReset.addTrack(t10A2); - rButtonReset.addTrack(t10A3); - rButtonReset.addTrack(t10A4); - rButtonReset.addTrack(t20A1); - rButtonReset.addTrack(t20A2); - rButtonReset.addTrack(t30A1); - rButtonReset.addTrack(t30A2); - rButtonReset.addTrack(t30A3); - rButtonReset.addTrack(t30A4); - rButtonReset.addTrack(t40A1); - rButtonReset.addTrack(t40A2); - rButtonReset.addTrack(t50A1); - rButtonReset.addTrack(t50A2); - - rButtonBridge = new RouteButton(bridgeA,20,20); - rButtonBridge.addTrackButton(tButton5,0); - rButtonBridge.addTrackButton(tButton8,0); - rButtonBridge.addTrack(t5A); - rButtonBridge.addTrack(bridgeA); - rButtonBridge.addTrack(bridgeB); - rButtonBridge.addTrack(bridgeC); - rButtonBridge.addTrack(bridgeD); - rButtonBridge.addTrack(bridgeE); - rButtonBridge.addTrack(bridgeF); - rButtonBridge.addTrack(bridgeG); - rButtonBridge.addTrack(bridgeH); - rButtonBridge.addTrack(bridgeI); - rButtonBridge.addTrack(t8A); - - cab622.setSidingDefaults(rButton6,4,10); // must set default sidings AFTER rButtons are defined above - cab6021.setSidingDefaults(rButton1,11,7); - cab54.setSidingDefaults(rButton2,11,8); - cab1506.setSidingDefaults(rButton3,11,9); - cab8601.setSidingDefaults(rButton4,11,12); - cab1202.setSidingDefaults(rButton5,11,13); - cab2004.setSidingDefaults(rButton7,5,14); -*/ +////// END OF SAMPLE LAYOUT ///////////////////////////////////////////////////////////////////////////////////////// } // Initialize