Split off marker classes.

This commit is contained in:
Calum
2017-09-12 14:48:30 +12:00
parent bc9f0ea924
commit da3613fe36
4 changed files with 37 additions and 46 deletions
@@ -1,4 +1,4 @@
package seng302.visualiser.fxObjects.assets_2D;
package seng302.visualiser.fxObjects.assets_3D;
import java.util.ArrayList;
import java.util.List;
@@ -6,15 +6,14 @@ import javafx.application.Platform;
import javafx.scene.Group;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.scene.shape.Circle;
import javafx.scene.transform.Scale;
import seng302.visualiser.fxObjects.assets_3D.ModelFactory;
import seng302.visualiser.fxObjects.assets_3D.ModelType;
import seng302.visualiser.fxObjects.assets_2D.MarkArrowFactory;
import seng302.visualiser.fxObjects.assets_2D.MarkArrowFactory.RoundingSide;
/**
* Visual object for a mark. Contains a coloured circle and any specified arrows.
*/
public class Marker extends Group {
public class Marker3D extends Group {
private Group mark = ModelFactory.importModel(ModelType.PLAIN_MARKER).getAssets();
private Paint colour = Color.BLACK;
@@ -26,7 +25,7 @@ public class Marker extends Group {
/**
* Creates a new Marker containing only a circle. The default colour is black.
*/
public Marker() {
public Marker3D() {
// mark.setRadius(5);
// mark.setCenterX(0);
// mark.setCenterY(0);
@@ -40,7 +39,7 @@ public class Marker extends Group {
* Creates a new Marker containing only a circle of the given colour.
* @param colour the desired colour for the marker.
*/
public Marker(Paint colour) {
public Marker3D(Paint colour) {
this();
this.colour = colour;
// mark.setFill(colour);
@@ -53,7 +52,7 @@ public class Marker extends Group {
* @param entryAngle The angle the arrow will point towards a marker
* @param exitAngle The angle the arrow wil point from the marker.
*/
public void addArrows(MarkArrowFactory.RoundingSide roundingSide, double entryAngle,
public void addArrows(RoundingSide roundingSide, double entryAngle,
double exitAngle) {
//Change Color.GRAY to this.colour to revert all gray arrows.
enterArrows.add(
@@ -2,6 +2,7 @@ package seng302.visualiser.fxObjects.assets_3D;
import com.interactivemesh.jfx.importer.col.ColModelImporter;
import com.interactivemesh.jfx.importer.stl.StlMeshImporter;
import java.util.Random;
import javafx.animation.AnimationTimer;
import javafx.geometry.Point3D;
import javafx.scene.AmbientLight;
@@ -22,12 +23,29 @@ public class ModelFactory {
public static BoatModel boatIconView(BoatMeshType boatType, Color primaryColour) {
Group boatAssets = getUnmodifiedBoatModel(boatType, primaryColour);
boatAssets.getTransforms().addAll(
new Scale(20, 20, 20),
new Rotate(90, new Point3D(0,0,1)),
new Rotate(90, new Point3D(0, 1, 0))
new Scale(10, 10, 10),
new Rotate(45, new Point3D(0,0,1)),
new Rotate(90, new Point3D(0, 1, 0)),
new Rotate(270, new Point3D(1, 0, 0)),
new Translate(12, 14, 0)
);
BoatModel bo = new BoatModel(boatAssets, null, boatType);
bo.showSail();
bo.rotateSail(45);
bo.setAnimation(new AnimationTimer() {
Group group = bo.getAssets();
double boatAngle = 0;
int id = new Random().nextInt();
@Override
public void handle(long now) {
((Rotate) group.getTransforms().get(3)).setAngle(boatAngle++);
System.out.println("animating a thingy " + id);
}
});
boatAssets.getChildren().add(new AmbientLight(new Color(1, 1, 1, 0.01)));
return new BoatModel(boatAssets, null, boatType);
return bo;
}
public static BoatModel boatRotatingView(BoatMeshType boatType, Color primaryColour) {