ellipse works via mouse + menu, but dimensions are probably wrong

This commit is contained in:
jan 2016-07-10 07:33:35 -07:00
parent df880a0e66
commit 58bb1611c8
4 changed files with 139 additions and 109 deletions

View File

@ -2,12 +2,10 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="6e752a8c-6cb9-4ef9-9031-0329ce15fcb4" name="Default" comment="">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/ClickGetter.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/Procedure.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/Ellipse.java" afterPath="$PROJECT_DIR$/src/Ellipse.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/EuglenaApplet.java" afterPath="$PROJECT_DIR$/src/EuglenaApplet.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/ProjectorApplet.java" afterPath="$PROJECT_DIR$/src/ProjectorApplet.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/Menu.java" afterPath="$PROJECT_DIR$/src/Menu.java" />
</list>
<ignored path="processing-intellij.iws" />
<ignored path=".idea/workspace.xml" />
@ -31,8 +29,8 @@
<file leaf-file-name="euglena_basic_stimuli.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/euglena_basic_stimuli.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="392">
<caret line="424" column="17" selection-start-line="424" selection-start-column="17" selection-end-line="424" selection-end-column="17" />
<state relative-caret-position="517">
<caret line="455" column="12" selection-start-line="455" selection-start-column="5" selection-end-line="455" selection-end-column="12" />
<folding>
<element signature="e#0#16478#0" expanded="true" />
<element signature="imports" expanded="true" />
@ -55,11 +53,14 @@
<file leaf-file-name="EuglenaApplet.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/EuglenaApplet.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="321">
<caret line="59" column="9" selection-start-line="59" selection-start-column="9" selection-end-line="59" selection-end-column="9" />
<state relative-caret-position="273">
<caret line="45" column="49" selection-start-line="45" selection-start-column="49" selection-end-line="45" selection-end-column="49" />
<folding>
<element signature="e#398#399#0" expanded="true" />
<element signature="e#443#444#0" expanded="true" />
<element signature="imports" expanded="true" />
<element signature="e#474#475#0" expanded="true" />
<element signature="e#519#520#0" expanded="true" />
<element signature="e#1641#1642#0" expanded="true" />
<element signature="e#1684#1685#0" expanded="true" />
</folding>
</state>
</provider>
@ -68,7 +69,7 @@
<file leaf-file-name="ProjectorApplet.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ProjectorApplet.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="573">
<state relative-caret-position="1113">
<caret line="44" column="0" selection-start-line="44" selection-start-column="0" selection-end-line="44" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
@ -82,8 +83,8 @@
<file leaf-file-name="Ellipse.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Ellipse.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="645">
<caret line="56" column="25" selection-start-line="56" selection-start-column="25" selection-end-line="56" selection-end-column="25" />
<state relative-caret-position="573">
<caret line="54" column="5" selection-start-line="54" selection-start-column="5" selection-end-line="54" selection-end-column="5" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -94,7 +95,7 @@
<file leaf-file-name="LEDControl.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/LEDControl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-252">
<state relative-caret-position="288">
<caret line="8" column="27" selection-start-line="8" selection-start-column="27" selection-end-line="8" selection-end-column="27" />
<folding>
<element signature="imports" expanded="true" />
@ -106,8 +107,8 @@
<file leaf-file-name="Menu.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Menu.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="108">
<caret line="3" column="12" selection-start-line="3" selection-start-column="12" selection-end-line="3" selection-end-column="12" />
<state relative-caret-position="36">
<caret line="190" column="43" selection-start-line="190" selection-start-column="43" selection-end-line="190" selection-end-column="43" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -143,7 +144,6 @@
<option value="$PROJECT_DIR$/src/heatup.java" />
<option value="$PROJECT_DIR$/src/TriangleClass.java" />
<option value="$PROJECT_DIR$/src/RectangleClass.java" />
<option value="$PROJECT_DIR$/src/Menu.java" />
<option value="$PROJECT_DIR$/src/LEDControl.java" />
<option value="$PROJECT_DIR$/src/Calibrator.java" />
<option value="$PROJECT_DIR$/lib/core.jar!/processing/core/PApplet.class" />
@ -156,6 +156,7 @@
<option value="$PROJECT_DIR$/src/ProjectorApplet.java" />
<option value="$PROJECT_DIR$/src/Procedure.java" />
<option value="$PROJECT_DIR$/src/Ellipse.java" />
<option value="$PROJECT_DIR$/src/Menu.java" />
<option value="$PROJECT_DIR$/src/EuglenaApplet.java" />
</list>
</option>
@ -522,8 +523,11 @@
<state relative-caret-position="630">
<caret line="39" column="5" selection-start-line="39" selection-start-column="5" selection-end-line="39" selection-end-column="5" />
<folding>
<element signature="e#398#399#0" expanded="true" />
<element signature="e#443#444#0" expanded="true" />
<element signature="imports" expanded="true" />
<element signature="e#474#475#0" expanded="true" />
<element signature="e#519#520#0" expanded="true" />
<element signature="e#1641#1642#0" expanded="true" />
<element signature="e#1684#1685#0" expanded="true" />
</folding>
</state>
</provider>
@ -598,8 +602,11 @@
<state relative-caret-position="522">
<caret line="40" column="35" selection-start-line="40" selection-start-column="35" selection-end-line="40" selection-end-column="35" />
<folding>
<element signature="e#398#399#0" expanded="true" />
<element signature="e#443#444#0" expanded="true" />
<element signature="imports" expanded="true" />
<element signature="e#474#475#0" expanded="true" />
<element signature="e#519#520#0" expanded="true" />
<element signature="e#1641#1642#0" expanded="true" />
<element signature="e#1684#1685#0" expanded="true" />
</folding>
</state>
</provider>
@ -635,8 +642,11 @@
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#398#399#0" expanded="true" />
<element signature="e#443#444#0" expanded="true" />
<element signature="imports" expanded="true" />
<element signature="e#474#475#0" expanded="true" />
<element signature="e#519#520#0" expanded="true" />
<element signature="e#1641#1642#0" expanded="true" />
<element signature="e#1684#1685#0" expanded="true" />
</folding>
</state>
</provider>
@ -646,8 +656,11 @@
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#398#399#0" expanded="true" />
<element signature="e#443#444#0" expanded="true" />
<element signature="imports" expanded="true" />
<element signature="e#474#475#0" expanded="true" />
<element signature="e#519#520#0" expanded="true" />
<element signature="e#1641#1642#0" expanded="true" />
<element signature="e#1684#1685#0" expanded="true" />
</folding>
</state>
</provider>
@ -657,8 +670,11 @@
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#398#399#0" expanded="true" />
<element signature="e#443#444#0" expanded="true" />
<element signature="imports" expanded="true" />
<element signature="e#474#475#0" expanded="true" />
<element signature="e#519#520#0" expanded="true" />
<element signature="e#1641#1642#0" expanded="true" />
<element signature="e#1684#1685#0" expanded="true" />
</folding>
</state>
</provider>
@ -668,8 +684,11 @@
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#398#399#0" expanded="true" />
<element signature="e#443#444#0" expanded="true" />
<element signature="imports" expanded="true" />
<element signature="e#474#475#0" expanded="true" />
<element signature="e#519#520#0" expanded="true" />
<element signature="e#1641#1642#0" expanded="true" />
<element signature="e#1684#1685#0" expanded="true" />
</folding>
</state>
</provider>
@ -679,8 +698,11 @@
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#398#399#0" expanded="true" />
<element signature="e#443#444#0" expanded="true" />
<element signature="imports" expanded="true" />
<element signature="e#474#475#0" expanded="true" />
<element signature="e#519#520#0" expanded="true" />
<element signature="e#1641#1642#0" expanded="true" />
<element signature="e#1684#1685#0" expanded="true" />
</folding>
</state>
</provider>
@ -690,8 +712,11 @@
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#398#399#0" expanded="true" />
<element signature="e#443#444#0" expanded="true" />
<element signature="imports" expanded="true" />
<element signature="e#474#475#0" expanded="true" />
<element signature="e#519#520#0" expanded="true" />
<element signature="e#1641#1642#0" expanded="true" />
<element signature="e#1684#1685#0" expanded="true" />
</folding>
</state>
</provider>
@ -762,16 +787,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/LEDControl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-252">
<caret line="8" column="27" selection-start-line="8" selection-start-column="27" selection-end-line="8" selection-end-column="27" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ProjectorCommand.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="36">
@ -799,39 +814,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Menu.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="108">
<caret line="3" column="12" selection-start-line="3" selection-start-column="12" selection-end-line="3" selection-end-column="12" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ProjectorApplet.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="573">
<caret line="44" column="0" selection-start-line="44" selection-start-column="0" selection-end-line="44" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#514#515#0" expanded="true" />
<element signature="e#573#574#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/euglena_basic_stimuli.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="392">
<caret line="424" column="17" selection-start-line="424" selection-start-column="17" selection-end-line="424" selection-end-column="17" />
<folding>
<element signature="e#0#16478#0" expanded="true" />
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Procedure.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
@ -840,16 +822,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Ellipse.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="645">
<caret line="56" column="25" selection-start-line="56" selection-start-column="25" selection-end-line="56" selection-end-column="25" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="jar://$PROJECT_DIR$/lib/core.jar!/processing/core/PApplet.class">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="812">
@ -858,13 +830,69 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/LEDControl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="288">
<caret line="8" column="27" selection-start-line="8" selection-start-column="27" selection-end-line="8" selection-end-column="27" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Ellipse.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="573">
<caret line="54" column="5" selection-start-line="54" selection-start-column="5" selection-end-line="54" selection-end-column="5" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/euglena_basic_stimuli.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="517">
<caret line="455" column="12" selection-start-line="455" selection-start-column="5" selection-end-line="455" selection-end-column="12" />
<folding>
<element signature="e#0#16478#0" expanded="true" />
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ProjectorApplet.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1113">
<caret line="44" column="0" selection-start-line="44" selection-start-column="0" selection-end-line="44" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#514#515#0" expanded="true" />
<element signature="e#573#574#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Menu.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="36">
<caret line="190" column="43" selection-start-line="190" selection-start-column="43" selection-end-line="190" selection-end-column="43" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/EuglenaApplet.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="321">
<caret line="59" column="9" selection-start-line="59" selection-start-column="9" selection-end-line="59" selection-end-column="9" />
<state relative-caret-position="273">
<caret line="45" column="49" selection-start-line="45" selection-start-column="49" selection-end-line="45" selection-end-column="49" />
<folding>
<element signature="e#398#399#0" expanded="true" />
<element signature="e#443#444#0" expanded="true" />
<element signature="imports" expanded="true" />
<element signature="e#474#475#0" expanded="true" />
<element signature="e#519#520#0" expanded="true" />
<element signature="e#1641#1642#0" expanded="true" />
<element signature="e#1684#1685#0" expanded="true" />
</folding>
</state>
</provider>

View File

@ -54,7 +54,7 @@ class Ellipse {
};
}
ClickGetter clickGetter(ProjectorApplet p) {
ClickGetter makeClickGetter(ProjectorApplet p) {
return (int x, int y) -> {
if (!centerPointComplete){
centerX = x;

View File

@ -1,3 +1,4 @@
import controlP5.ControlEvent;
import processing.core.*;
public class EuglenaApplet extends PApplet {
@ -14,7 +15,10 @@ public class EuglenaApplet extends PApplet {
Calibrator calibrator;
ClickGetter clickGetter;
boolean tester;
//Pen
int penColor = color(200);
int penWidth = 15;
public static void main(String args[]) {
PApplet.main("EuglenaApplet");
@ -40,7 +44,6 @@ public class EuglenaApplet extends PApplet {
projectorApplet = new ProjectorApplet(this);
String[] args = {"Euglena projector"};
PApplet.runSketch(args, projectorApplet);
tester = false;
}
@Override
@ -52,13 +55,6 @@ public class EuglenaApplet extends PApplet {
imageMode(PApplet.CORNER);
image(camera.getImage(), 0, 0, width - menu.width, height);
if (!tester) {
// this.projectorApplet.commandQueue.add(new Ellipse(0f, 0f, 1000f, 1000f, color(250, 250, 250), 8).drawCommand());
this.clickGetter = new Ellipse(color(255), 10).clickGetter(projectorApplet);
tester = true;
}
}
@ -71,6 +67,10 @@ public class EuglenaApplet extends PApplet {
}
}
public void controlEvent(ControlEvent theEvent) {
menu.controlEvent(theEvent);
}
void drawArrow(int cx, int cy, int len, float angle){
pushMatrix();
translate(cx, cy);

View File

@ -1,9 +1,12 @@
import processing.core.*;
import static processing.core.PApplet.*;
import controlP5.*;
class Menu {
final int width = 200; // Width of toolbar on left side of display
EuglenaApplet parent;
private Button resetButton, calibrateButton, commitButton, lineButton, freehandButton, eraserButton, goButton;
private Textfield redField, greenField, blueField, backgroundField, penwidthField,
lagField, totaltimeField, speedField;
@ -13,7 +16,8 @@ class Menu {
private Group g1, g2, g3;
Menu(PApplet applet){
Menu(EuglenaApplet applet){
parent = applet;
cp5 = new ControlP5(applet).setPosition(applet.width - width, 0);
@ -183,25 +187,23 @@ class Menu {
a.fill(0);
a.rect(a.width - width, 0, width, a.height);
}
/*
void controlEvent(ControlEvent theEvent) {
if (theEvent.isFrom(shapesList)) {
switch((int) shapesList.getValue()) {
case 0:
ellipseDrawer.reset();
drawtype = 'e';
parent.clickGetter = new Ellipse(parent.penColor, parent.penWidth)
.makeClickGetter(parent.projectorApplet);
break;
case 1:
rectangleDrawer.reset();
drawtype = 'r';
//rectangleDrawer.reset();
break;
case 2:
triangleDrawer.reset();
drawtype = 't';
//triangleDrawer.reset();
break;
}
}
/*
if (theEvent.isFrom(animateList)){
switch((int) animateList.getValue()) {
case 0:
@ -226,8 +228,8 @@ class Menu {
if (theEvent.isFrom(presetsList)){
preset = (int) presetsList.getValue();
}
*/
}
*/
}
/*