first commit

This commit is contained in:
2019-08-13 12:23:06 -05:00
commit 916073f43b
337 changed files with 23253 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
/*
* SE1021
* Spring 2018
* Lab 4 - Inheritance
* Name: Trevor Barnes
* Created: 3/28/18
*/
package barnestr;
import edu.msoe.winplotterfx.WinPlotterFX;
import javafx.scene.paint.Color;
/**
* This class represents a circle extension of the Shape Class
*
* @author barnestr
* @version 2.0
*/
public class Circle extends Shape {
protected double radius;
/**
* Constructor - creates the circle with the passed in parameters
*
* @param x x-coordinate location of the circle
* @param y y-coordinate location of the circle
* @param radius radius of the circle
* @param color the JavaFX color of the outline of the circle
*/
public Circle(double x, double y, double radius, Color color) {
super(x, y, color);
this.radius = radius;
}
/**
* Draws the circle in the WinPlotterFX window
*
* @param plotter the current WinPlotterFX being used
*/
public void draw(WinPlotterFX plotter) {
final int CIRCLE_DEGREES = 360;
setPenColor(plotter);
for (int i = 0; i < CIRCLE_DEGREES; i++) {
plotter.moveTo(x + radius * Math.cos(Math.toRadians(i)),
y + radius * Math.sin(Math.toRadians(i)));
plotter.drawTo(x + radius * Math.cos(Math.toRadians(i + 1)),
y + radius * Math.sin(Math.toRadians(i + 1)));
}
}
}

View File

@@ -0,0 +1,49 @@
/*
* SE1021
* Spring 2018
* Lab 4 - Inheritance
* Name: Trevor Barnes
* Created: 3/28/18
*/
package barnestr;
import edu.msoe.winplotterfx.WinPlotterFX;
import javafx.scene.paint.Color;
/**
* This class represents a LabeledRectangle extension of the Rectangle Class
*
* @author barnestr
* @version 2.0
*/
public class LabeledRectangle extends Rectangle {
String name;
/**
* Constructor - creates the LabeledRectangle with the passed in parameters
*
* @param x x-coordinate location of the LabeledRectangle
* @param y y-coordinate location of the LabeledRectangle
* @param width the width of the LabeledRectangle
* @param height the height of the LabeledRectangle
* @param color the JavaFX color of the LabeledRectangle's outline
* @param name the label placed on the LabeledRectangle as text
*/
public LabeledRectangle(double x, double y, double width, double height, Color color,
String name) {
super(x, y, width, height, color);
this.name = name;
}
/**
* Draws the LabeledRectangle in the current WinPlotterFX window
*
* @param plotter the current WinPlotterFX being used
*/
public void draw(WinPlotterFX plotter) {
super.draw(plotter);
plotter.printAt(x + width / 2, y + height / 2, name);
}
}

View File

@@ -0,0 +1,49 @@
/*
* SE1021
* Spring 2018
* Lab 4 - Inheritance
* Name: Trevor Barnes
* Created: 3/28/18
*/
package barnestr;
import edu.msoe.winplotterfx.WinPlotterFX;
import javafx.scene.paint.Color;
/**
* This class represents a LabeledTriangle extension of the Triangle Class
*
* @author barnestr
* @version 2.0
*/
public class LabeledTriangle extends Triangle {
String name;
/**
* Constructor - creates the LabeledTriangle with the passed in parameters
*
* @param x x-coordinate location of the LabeledTriangle
* @param y y-coordinate location of the LabeledTriangle
* @param base the bottom side length of the LabeledTriangle
* @param height the height of the LabeledTriangle
* @param color the JavaFX color of the LabeledTriangle's outline
* @param name the label placed on the LabeledTriangle as text
*/
public LabeledTriangle(double x, double y, double base, double height, Color color,
String name) {
super(x, y, base, height, color);
this.name = name;
}
/**
* Draws the LabeledTriangle in the current WinPlotterFX window
*
* @param plotter the current WinPlotterFX being used
*/
public void draw(WinPlotterFX plotter) {
super.draw(plotter);
plotter.printAt(x + base / 3, y + height / 4, name);
}
}

View File

@@ -0,0 +1,43 @@
/*
* SE1021
* Spring 2018
* Lab 4 - Inheritance
* Name: Trevor Barnes
* Created: 3/28/18
*/
package barnestr;
import edu.msoe.winplotterfx.WinPlotterFX;
import javafx.scene.paint.Color;
/**
* This class represents a Point extension of the Shape Class
*
* @author barnestr
* @version 2.0
*/
public class Point extends Shape {
/**
* Constructor - creates the Point with passed in parameters
*
* @param x x-coordinate of the Point
* @param y y-coordinate of the Point
* @param color the JavaFX color of the point
*/
public Point(double x, double y, Color color) {
super(x, y, color);
}
/**
* Draws the Point in the current WinPlotterFX window
*
* @param plotter the current WinPlotterFX window being used
*/
public void draw(WinPlotterFX plotter) {
setPenColor(plotter);
plotter.drawPoint(x, y);
}
}

View File

@@ -0,0 +1,53 @@
/*
* SE1021
* Spring 2018
* Lab 4 - Inheritance
* Name: Trevor Barnes
* Created: 3/28/18
*/
package barnestr;
import edu.msoe.winplotterfx.WinPlotterFX;
import javafx.scene.paint.Color;
/**
* This class represents a Rectangle extension of the Shape Class
*
* @author barnestr
* @version 2.0
*/
public class Rectangle extends Shape {
protected double height;
protected double width;
/**
* Constructor - creates the Rectangle with the passed in parameters
*
* @param x x-coordinate location of the Rectangle
* @param y y-coordinate location of the Rectangle
* @param width the width of the Rectangle
* @param height the height of the Rectangle
* @param color the JavaFX color of the Rectangle's outline
*/
public Rectangle(double x, double y, double width, double height, Color color) {
super(x, y, color);
this.width = width;
this.height = height;
}
/**
* Draws the Rectangle in the current WinPlotterFX window
*
* @param plotter the current WinPlotterFX being used
*/
public void draw(WinPlotterFX plotter) {
setPenColor(plotter);
plotter.moveTo(x, y);
plotter.drawTo(x + width, y);
plotter.drawTo(x + width, y + height);
plotter.drawTo(x, y + height);
plotter.drawTo(x, y);
}
}

View File

@@ -0,0 +1,59 @@
/*
* SE1021
* Spring 2018
* Lab 4 - Inheritance
* Name: Trevor Barnes
* Created: 3/28/18
*/
package barnestr;
import edu.msoe.winplotterfx.WinPlotterFX;
import javafx.scene.paint.Color;
/**
* This class represents a generic graphical shape
*
* @author barnestr
* @version 2.0
*/
public abstract class Shape {
private Color color;
protected double x;
protected double y;
/**
* Constructor - initializes Shape attributes
*
* @param x x-coordinate of the shape
* @param y y-coordinate of the shape
* @param color the outlined JavaFX color of the shape
*/
public Shape(double x, double y, Color color) {
this.x = x;
this.y = y;
this.color = color;
}
/**
* Sets the pen color on the WinPlotter object to match the current outline color of the shape
*
* @param plotter the current WinPlotterFX being used
*/
public void setPenColor(WinPlotterFX plotter) {
plotter.setPenColor(color.getRed(), color.getGreen(), color.getBlue());
}
public abstract void draw(WinPlotterFX plotter);
/**
* Sets the JavaFX color of the shape
*
* @param color the JavaFX color of the shape outline
*/
public void setColor(Color color) {
this.color = color;
}
}

View File

@@ -0,0 +1,52 @@
/*
* SE1021
* Spring 2018
* Lab 4 - Inheritance
* Name: Trevor Barnes
* Created: 3/28/18
*/
package barnestr;
import edu.msoe.winplotterfx.WinPlotterFX;
import javafx.scene.paint.Color;
/**
* This class represents a Triangle extension of the Shape Class
*
* @author barnestr
* @version 2.0
*/
public class Triangle extends Shape {
protected double base;
protected double height;
/**
* Constructor - creates the Triangle with the passed in parameters
*
* @param x x-coordinate location of the Triangle
* @param y y-coordinate location of the Triangle
* @param base the bottom side length of the Triangle
* @param height the height of the Triangle
* @param color the JavaFX color of the Triangle's outline
*/
public Triangle(double x, double y, double base, double height, Color color) {
super(x, y, color);
this.base = base;
this.height = height;
}
/**
* Draws the Triangle in the current WinPlotterFX window
*
* @param plotter the current WinPlotterFX being used
*/
public void draw(WinPlotterFX plotter) {
setPenColor(plotter);
plotter.moveTo(x, y);
plotter.drawTo(x + base, y);
plotter.drawTo(x + base / 2, y + height);
plotter.drawTo(x, y);
}
}