|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrit.display.layoutEditor.LayoutTurntable
public class LayoutTurntable
A LayoutTurntable is a representation used by LayoutEditor to display a turntable.
A LayoutTurntable has a variable number of connection points, called RayTracks, each radiating from the center of the turntable. Each of these points should be connected to a TrackSegment.
Each radiating segment (RayTrack) gets its Block information from its connected track segment.
Each radiating segment (RayTrack) has a unique connection index. The connection index is set when the RayTrack is created, and cannot be changed. This connection index is used to maintain the identity of the radiating segment to its connected Track Segment as ray tracks are added and deleted by the user.
The radius of the turntable circle is variable by the user.
Each radiating segment (RayTrack) connecting point is a fixed distance from the center of the turntable. The user may vary the angle of the radiating segment. Angles are measured from the vertical (12 o'clock) position in a clockwise manner. For example, 30 degrees is 1 o'clock, 60 degrees is 2 o'clock, 90 degrees is 3 o'clock, etc.
Each radiating segment is drawn from its connection point to the turntable circle in the direction of the turntable center.
| Nested Class Summary | |
|---|---|
(package private) class |
LayoutTurntable.RayTrack
|
| Field Summary | |
|---|---|
(package private) boolean |
active
|
(package private) JButton |
addRayTrack
|
(package private) JTextField |
angleField
|
(package private) JCheckBox |
dccControlled
|
(package private) JButton |
deleteRayTrack
|
(package private) boolean |
editOpen
|
(package private) JmriJFrame |
editTurntableFrame
|
(package private) static org.slf4j.Logger |
log
|
(package private) boolean |
needsRedraw
|
(package private) String |
oldRadius
|
(package private) JPopupMenu |
popup
|
(package private) JTextField |
radiusField
|
(package private) JPanel |
rayPanel
|
(package private) JPopupMenu |
rayPopup
|
(package private) ResourceBundle |
rb
|
(package private) JButton |
turntableEditCancel
|
(package private) JButton |
turntableEditDone
|
| Constructor Summary | |
|---|---|
LayoutTurntable(String id,
Point2D c,
LayoutEditor myPanel)
constructor method |
|
| Method Summary | |
|---|---|
protected LayoutTurntable.RayTrack |
addRay(double angle)
|
void |
addRayTrack(double angle,
int index,
String name)
|
(package private) void |
deleteRay(LayoutTurntable.RayTrack closest)
|
(package private) void |
deleteRayTrackPressed(ActionEvent a)
|
double |
diffAngle(double a,
double b)
|
(package private) void |
dispose()
Clean up when this object is no longer needed. |
protected void |
editTurntable(LayoutTurntable x)
Edit a Turntable |
Point2D |
getCoordsCenter()
|
String |
getID()
Accessor methods |
int |
getNumberRays()
|
int |
getPosition()
|
double |
getRadius()
|
double |
getRayAngle(int i)
|
TrackSegment |
getRayConnectIndexed(int index)
|
TrackSegment |
getRayConnectOrdered(int i)
|
Point2D |
getRayCoordsIndexed(int index)
|
Point2D |
getRayCoordsOrdered(int i)
|
int |
getRayIndex(int i)
|
String |
getRayTurnoutName(int i)
|
int |
getRayTurnoutState(int i)
|
boolean |
isActive()
"active" means that the object is still displayed, and should be stored. |
boolean |
isMainlineIndexed(int index)
Methods to test if ray is a mainline track or not Returns true if connecting track segment is mainline Defaults to not mainline if connecting track segment is missing |
boolean |
isMainlineOrdered(int i)
|
boolean |
isTurnoutControlled()
|
double |
normalizeAngle(double a)
|
(package private) void |
remove()
Removes this object from display and persistance |
(package private) double |
round(double x)
|
void |
scaleCoords(float xFactor,
float yFactor)
|
void |
setCoordsCenter(Point2D p)
Modify coordinates methods |
void |
setObjects(LayoutEditor p)
Initialization method The name of each track segment connected to a ray track is initialized by by LayoutTurntableXml, then the following method is called after the entire LayoutEditor is loaded to set the specific TrackSegment objects. |
void |
setPosition(int index)
|
void |
setRadius(double r)
|
void |
setRayConnect(TrackSegment tr,
int index)
|
void |
setRayCoordsIndexed(double x,
double y,
int index)
|
void |
setRayTurnout(int index,
String turnoutName,
int state)
|
void |
setTurnoutControlled(boolean boo)
|
protected void |
showPopUp(MouseEvent e)
Display popup menu for information and editing |
protected void |
showRayPopUp(MouseEvent e,
int index)
|
(package private) void |
turntableEditCancelPressed(ActionEvent a)
|
(package private) void |
turntableEditDonePressed(ActionEvent a)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
ResourceBundle rb
JPopupMenu popup
JPopupMenu rayPopup
JmriJFrame editTurntableFrame
JTextField radiusField
JTextField angleField
JButton turntableEditDone
JButton turntableEditCancel
JButton addRayTrack
JButton deleteRayTrack
JCheckBox dccControlled
String oldRadius
JPanel rayPanel
boolean editOpen
boolean needsRedraw
boolean active
static org.slf4j.Logger log
| Constructor Detail |
|---|
public LayoutTurntable(String id,
Point2D c,
LayoutEditor myPanel)
| Method Detail |
|---|
public String getID()
public Point2D getCoordsCenter()
public double getRadius()
public void setRadius(double r)
protected LayoutTurntable.RayTrack addRay(double angle)
public void addRayTrack(double angle,
int index,
String name)
public TrackSegment getRayConnectIndexed(int index)
public TrackSegment getRayConnectOrdered(int i)
public void setRayConnect(TrackSegment tr,
int index)
public int getNumberRays()
public int getRayIndex(int i)
public double getRayAngle(int i)
public void setRayTurnout(int index,
String turnoutName,
int state)
public String getRayTurnoutName(int i)
public int getRayTurnoutState(int i)
public Point2D getRayCoordsIndexed(int index)
public Point2D getRayCoordsOrdered(int i)
public void setRayCoordsIndexed(double x,
double y,
int index)
public boolean isMainlineIndexed(int index)
public boolean isMainlineOrdered(int i)
public void setCoordsCenter(Point2D p)
public void scaleCoords(float xFactor,
float yFactor)
double round(double x)
public void setObjects(LayoutEditor p)
public boolean isTurnoutControlled()
public void setTurnoutControlled(boolean boo)
protected void showPopUp(MouseEvent e)
protected void showRayPopUp(MouseEvent e,
int index)
public void setPosition(int index)
public int getPosition()
protected void editTurntable(LayoutTurntable x)
void deleteRayTrackPressed(ActionEvent a)
void deleteRay(LayoutTurntable.RayTrack closest)
void turntableEditDonePressed(ActionEvent a)
void turntableEditCancelPressed(ActionEvent a)
void dispose()
void remove()
public boolean isActive()
public double normalizeAngle(double a)
public double diffAngle(double a,
double b)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||