-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added GUI, controller class, and event handlers
- Loading branch information
Kristopher Guzman
committed
Nov 21, 2016
1 parent
45a941a
commit 0315e25
Showing
3 changed files
with
107 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package main; | ||
|
||
/** | ||
* Created by kristopherguzman on 11/19/16. | ||
*/ | ||
|
||
import javafx.beans.value.ChangeListener; | ||
import javafx.beans.value.ObservableValue; | ||
import javafx.fxml.FXML; | ||
import javafx.scene.Scene; | ||
import javafx.scene.canvas.Canvas; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.control.Slider; | ||
import javafx.scene.control.SplitPane; | ||
import javafx.scene.layout.AnchorPane; | ||
|
||
import java.text.DecimalFormat; | ||
|
||
public class Controller { | ||
|
||
@FXML private AnchorPane controlPanel; | ||
@FXML private AnchorPane canvasPanel; | ||
@FXML private SplitPane rootPane; | ||
@FXML private Canvas canvas; | ||
@FXML private Slider offsetSlider; | ||
@FXML private Slider zoomSlider; | ||
@FXML private Label offsetLabel; | ||
@FXML private Label zoomLabel; | ||
|
||
private double MIN_OFFSET = 0.000000000000000001; //10^-18 | ||
private double MAX_OFFSET = 0.0000000000000009; //9x10^-16 | ||
private int maxResolution = 100; | ||
|
||
private DecimalFormat df = new DecimalFormat(".##"); | ||
|
||
@FXML private void initialize() { | ||
|
||
offsetSlider.valueProperty().addListener(((observable, oldValue, newValue) -> { | ||
offsetLabel.setText("Offset: " + newValue); | ||
})); | ||
|
||
zoomLabel.setText("0.1x"); | ||
zoomSlider.setValue(10); | ||
zoomSlider.valueProperty().addListener(((observable, oldValue, newValue) -> { | ||
double val = newValue.doubleValue() / maxResolution; | ||
System.out.println(val); | ||
zoomLabel.setText("Zoom: " + df.format(val) + "x"); | ||
})); | ||
|
||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.scene.canvas.Canvas?> | ||
<?import javafx.scene.control.Label?> | ||
<?import javafx.scene.control.Slider?> | ||
<?import javafx.scene.control.SplitPane?> | ||
<?import javafx.scene.layout.AnchorPane?> | ||
<?import javafx.scene.text.Font?> | ||
|
||
<SplitPane fx:id="rootPane" dividerPositions="0.7575250836120402" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="768.0" prefWidth="1366.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="main.Controller"> | ||
<items> | ||
<AnchorPane fx:id="canvasPanel" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0"> | ||
<children> | ||
<Canvas fx:id="canvas" height="768.0" layoutY="-1.0" width="768.0" /> | ||
</children></AnchorPane> | ||
<AnchorPane fx:id="controlPanel" maxWidth="598.0" minWidth="598.0" prefWidth="598.0" style="-fx-background-color: #535151;"> | ||
<children> | ||
<Label alignment="CENTER" contentDisplay="CENTER" layoutX="204.0" layoutY="45.0" prefHeight="74.0" prefWidth="243.0" text="CCW Test" textFill="WHITE"> | ||
<font> | ||
<Font name="Avenir Black Oblique" size="50.0" /> | ||
</font> | ||
</Label> | ||
<Label alignment="CENTER" contentDisplay="CENTER" layoutX="53.0" layoutY="128.0" prefHeight="99.0" prefWidth="490.0" text="Point Q and R are collinear and extremely far away. Observe the output of the orientation test in relation to the position of point P." textAlignment="CENTER" textFill="WHITE" wrapText="true"> | ||
<font> | ||
<Font name="Avenir Black Oblique" size="21.0" /> | ||
</font> | ||
</Label> | ||
<Label fx:id="offsetLabel" alignment="CENTER" contentDisplay="CENTER" layoutX="54.0" layoutY="274.0" prefHeight="51.0" prefWidth="490.0" text="Offset: 2^-53" textAlignment="CENTER" textFill="WHITE" wrapText="true"> | ||
<font> | ||
<Font name="Avenir Black Oblique" size="21.0" /> | ||
</font> | ||
</Label> | ||
<Slider fx:id="offsetSlider" blockIncrement="1.0E-16" layoutX="103.0" layoutY="316.0" max="9.0E-16" min="1.0E-18" prefHeight="16.0" prefWidth="410.0" value="1.0E-16" /> | ||
<Label fx:id="zoomLabel" alignment="CENTER" contentDisplay="CENTER" layoutX="55.0" layoutY="393.0" prefHeight="51.0" prefWidth="490.0" text="Zoom: 0.3x" textAlignment="CENTER" textFill="WHITE" wrapText="true"> | ||
<font> | ||
<Font name="Avenir Black Oblique" size="21.0" /> | ||
</font> | ||
</Label> | ||
<Slider fx:id="zoomSlider" layoutX="101.0" layoutY="432.0" prefHeight="16.0" prefWidth="410.0" value="30.0" /> | ||
</children></AnchorPane> | ||
</items> | ||
</SplitPane> |