Commit c0a99386 authored by Philip Levis's avatar Philip Levis
Browse files

Move UIDrawer to Drawing to its easier to type file names (no UI Preface).

Implement geometric placement of flyers on ceiling pipes. Next is
stairwell, then done with geometry.

Rather than messing with trig, the easiest thing to do is just compute
start and end points and interpolate. The start and end points require
a little trig, but it's very simple.

Also fixed a bug in which the Layout Tool would have all parameters
modifiable when firsts started (then after you change to a different
flyer they grey out normally). Requires callijng updateEditableParameters
in constructor.
parent cf4b13c5
class UIFlightDisplay extends UI3dComponent implements GeometryConstants {
class UIFlightDrawer extends UI3dComponent implements GeometryConstants {
final float[] VBAR_OFFSETS;
final float[] HBAR_OFFSETS;
final float[] BACK_WALL_OFFSETS;
UIFlightDisplay() {
UIFlightDrawer() {
super();
VBAR_OFFSETS = new float[GeometryConstants.FRONT_WINDOW_VBAR_SPACINGS.length];
......
......@@ -140,7 +140,7 @@ void configureUI(LXStudio.UI ui) {
viewContext.setInteractionMode(UI3dContext.InteractionMode.ZOOM);
viewContext.setRadius(85 * GeometryConstants.FEET);
viewContext.addComponent(new UIFlightDisplay());
viewContext.addComponent(new UIFlightDrawer());
// Adds the control panel for selecting and moving Flyers
ui.addLayer(viewContext);
ui.addLayer(new UIFlyerConfiguration(ui));
......
......@@ -99,6 +99,7 @@ class UIFlyerConfiguration extends UIWindow {
}.setMomentary(true).setLabel("Save Changes").addToContainer(this);
setFlyer();
updateEditableParameters();
}
private void makeEnableButton() {
......
......@@ -2,13 +2,13 @@
{
"index": 0,
"faceConfig": {
"face": "F",
"face": "C",
"x": 514.41174,
"y": 5,
"position": 0.0,
"pipe": 0.0,
"mountPoint": 0.0,
"hangDistance": 49.411766
"pipe": 2.0,
"mountPoint": 0.36764708,
"hangDistance": 96.0
},
"rotation": 0.0,
"tilt": 0.0,
......@@ -70,7 +70,7 @@
"y": 1,
"position": 0.0,
"pipe": 3.0,
"mountPoint": 3.0,
"mountPoint": 0.0,
"hangDistance": 3.0
},
"rotation": 15.0,
......@@ -154,7 +154,7 @@
"y": 1,
"position": 0.0,
"pipe": 7.0,
"mountPoint": 7.0,
"mountPoint": 0.0,
"hangDistance": 7.0
},
"rotation": 35.0,
......@@ -238,7 +238,7 @@
"y": 1,
"position": 0.0,
"pipe": 7.0,
"mountPoint": 11.0,
"mountPoint": 0.0,
"hangDistance": 11.0
},
"rotation": 55.0,
......@@ -322,7 +322,7 @@
"y": 1,
"position": 0.0,
"pipe": 0.0,
"mountPoint": 15.0,
"mountPoint": 0.0,
"hangDistance": 15.0
},
"rotation": 75.0,
......@@ -406,7 +406,7 @@
"y": 1,
"position": 0.0,
"pipe": 0.0,
"mountPoint": 19.0,
"mountPoint": 0.0,
"hangDistance": 19.0
},
"rotation": 95.0,
......@@ -490,7 +490,7 @@
"y": 1,
"position": 0.0,
"pipe": 0.0,
"mountPoint": 23.0,
"mountPoint": 0.0,
"hangDistance": 23.0
},
"rotation": 115.0,
......@@ -574,7 +574,7 @@
"y": 1,
"position": 0.0,
"pipe": 0.0,
"mountPoint": 27.0,
"mountPoint": 0.0,
"hangDistance": 27.0
},
"rotation": 135.0,
......@@ -658,7 +658,7 @@
"y": 1,
"position": 0.0,
"pipe": 0.0,
"mountPoint": 31.0,
"mountPoint": 0.0,
"hangDistance": 31.0
},
"rotation": 155.0,
......@@ -742,7 +742,7 @@
"y": 1,
"position": 0.0,
"pipe": 0.0,
"mountPoint": 35.0,
"mountPoint": 0.0,
"hangDistance": 35.0
},
"rotation": 175.0,
......@@ -826,7 +826,7 @@
"y": 1,
"position": 0.0,
"pipe": 0.0,
"mountPoint": 39.0,
"mountPoint": 0.0,
"hangDistance": 39.0
},
"rotation": 195.0,
......@@ -910,7 +910,7 @@
"y": 1,
"position": 0.0,
"pipe": 0.0,
"mountPoint": 43.0,
"mountPoint": 0.0,
"hangDistance": 43.0
},
"rotation": 215.0,
......@@ -994,7 +994,7 @@
"y": 1,
"position": 0.0,
"pipe": 0.0,
"mountPoint": 47.0,
"mountPoint": 0.0,
"hangDistance": 47.0
},
"rotation": 235.0,
......@@ -1078,7 +1078,7 @@
"y": 1,
"position": 0.0,
"pipe": 0.0,
"mountPoint": 51.0,
"mountPoint": 0.0,
"hangDistance": 51.0
},
"rotation": 255.0,
......@@ -1162,7 +1162,7 @@
"y": 1,
"position": 0.0,
"pipe": 0.0,
"mountPoint": 55.0,
"mountPoint": 0.0,
"hangDistance": 55.0
},
"rotation": 275.0,
......@@ -1246,7 +1246,7 @@
"y": 1,
"position": 0.0,
"pipe": 0.0,
"mountPoint": 59.0,
"mountPoint": 0.0,
"hangDistance": 59.0
},
"rotation": 295.0,
......@@ -1330,7 +1330,7 @@
"y": 1,
"position": 0.0,
"pipe": 0.0,
"mountPoint": 63.0,
"mountPoint": 0.0,
"hangDistance": 63.0
},
"rotation": 315.0,
......@@ -1414,7 +1414,7 @@
"y": 1,
"position": 0.0,
"pipe": 0.0,
"mountPoint": 67.0,
"mountPoint": 0.0,
"hangDistance": 67.0
},
"rotation": 335.0,
......@@ -1498,7 +1498,7 @@
"y": 1,
"position": 0.0,
"pipe": 0.0,
"mountPoint": 71.0,
"mountPoint": 0.0,
"hangDistance": 71.0
},
"rotation": 355.0,
......@@ -1582,7 +1582,7 @@
"y": 1,
"position": 0.0,
"pipe": 0.0,
"mountPoint": 75.0,
"mountPoint": 0.0,
"hangDistance": 75.0
},
"rotation": 375.0,
......@@ -1595,4 +1595,4 @@
"year": 1894
}
}
]
]
\ No newline at end of file
......@@ -348,56 +348,47 @@ class FlyerModel extends LXModel implements Flyer {
return this.x;
} else if (face.equals("C")) {
int pipe = (int)this.faceConfig.pipe;
float x = 0.0f;
float angle = 0.0f;
float len = 1.0f;
float startx = 0.0f;
float endx = 0.0f;
switch (pipe) {
case 0:
x = VBAR_OFFSETS[0];
angle = - (float)Math.PI/8f;
len = (float)Math.abs(Math.tan(angle) * x);
startx = VBAR_OFFSETS[0];
endx = BACK_WALL_OFFSETS[0] * 0.707f;
break;
case 1:
x = VBAR_OFFSETS[2];
angle = - (float)Math.PI/8f;
len = (float)Math.abs(Math.tan(angle) * x);
startx = VBAR_OFFSETS[2];
endx = BACK_WALL_OFFSETS[1] * 0.707f;
break;
case 2:
x = VBAR_OFFSETS[2];
angle =(float) Math.PI/8f;
len = (float)Math.abs(Math.tan(angle) * x);
startx = VBAR_OFFSETS[2];
endx = (BACK_WALL_OFFSETS[2] * 0.707f + VBAR_OFFSETS[4]) / 2.0f;
break;
case 3:
x = BACK_WALL_OFFSETS[1];
angle = 5f * (float)Math.PI/8f;
len = (float)Math.abs(Math.tan(angle) * x);
startx = BACK_WALL_OFFSETS[1];
endx = (BACK_WALL_OFFSETS[2] * 0.707f + VBAR_OFFSETS[4]) / 2.0f;
break;
case 4:
x = VBAR_OFFSETS[4];
angle = - (float)Math.PI/8f;
len = (float)Math.abs(Math.tan(angle) * x);
startx = VBAR_OFFSETS[4];
endx = BACK_WALL_OFFSETS[2] * 0.707f;
break;
case 5:
x = VBAR_OFFSETS[4];
angle = - (float)Math.PI/8f;
len = (float)Math.abs(Math.tan(angle) * x);
startx = VBAR_OFFSETS[4];
endx = (BACK_WALL_OFFSETS[3] * 0.707f + VBAR_OFFSETS[6]) / 2.0f;
break;
case 6:
x = BACK_WALL_OFFSETS[2];
angle = 5f * (float)Math.PI/8f;
len = (float)Math.abs(Math.tan(angle) * x);
startx = BACK_WALL_OFFSETS[2];
endx = (BACK_WALL_OFFSETS[3] * 0.707f + VBAR_OFFSETS[6]) / 2.0f;
endx = 0;
break;
case 7:
x = VBAR_OFFSETS[6];
angle = - (float)Math.PI/8f;
len = (float)Math.abs(Math.tan(angle) * x);
startx = VBAR_OFFSETS[6];
endx = BACK_WALL_OFFSETS[3] * 0.707f;
break;
default:
System.err.println("ERROR: Invalid pipe specified for Flyer " + index + ": " + pipe + " -- valid values are 0-7");
return 0.0f;
}
x += (float)(Math.sin(angle) * len * this.faceConfig.mountPoint);
return x;
return startx += (this.faceConfig.mountPoint) * (endx - startx);
}
return 0.0f;
}
......@@ -410,9 +401,8 @@ class FlyerModel extends LXModel implements Flyer {
y = offset - this.faceConfig.hangDistance;
return y;
} else if (face.equals("C")) {
float y = FRONT_WINDOW_NADIR_HEIGHT;
y -= this.faceConfig.hangDistance;
return y;
float offset = GeometryConstants.FRONT_WINDOW_NADIR_HEIGHT - 20f;
return offset - this.faceConfig.hangDistance;
}
else {
return this.y;
......@@ -423,7 +413,44 @@ class FlyerModel extends LXModel implements Flyer {
public float getZ() {
String face = this.faceConfig.face;
if (face.equals("F")) {
return 10.0f;
return 10.0f;
} else if (face.equals("C")) {
int pipe = (int)this.faceConfig.pipe;
float startz = 12f;
float endz = 0.0f;
switch (pipe) {
case 0:
endz = (float)(BACK_WALL_OFFSETS[0] * Math.sin(Math.PI/4f));
break;
case 1:
endz = (float)(BACK_WALL_OFFSETS[1] * Math.sin(Math.PI/4f));
break;
case 2:
endz = (float)((BACK_WALL_OFFSETS[2] * 0.707f) / 2.0f);
break;
case 3:
startz = (float)(BACK_WALL_OFFSETS[1] * Math.sin(Math.PI/4f));
endz = (float)((BACK_WALL_OFFSETS[2] * 0.707f) / 2.0f);
break;
case 4:
endz = (float)(BACK_WALL_OFFSETS[2] * Math.sin(Math.PI/4f));
break;
case 5:
endz = (float)((BACK_WALL_OFFSETS[3] * 0.707f) / 2.0f);
break;
case 6:
startz = (float)(BACK_WALL_OFFSETS[2] * Math.sin(Math.PI/4f));
endz = (float)((BACK_WALL_OFFSETS[3] * 0.707f) / 2.0f);
break;
case 7:
endz =(float)(BACK_WALL_OFFSETS[3] * Math.sin(Math.PI/4f));
break;
default:
System.err.println("ERROR: Invalid pipe specified for Flyer " + index + ": " + pipe + " -- valid values are 0-7");
return 0.0f;
}
return startz += (this.faceConfig.mountPoint) * (endz - startz);
} else {
return this.z;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment