Ignore:
Timestamp:
05/10/18 16:04:51 (6 years ago)
Author:
davidb
Message:

Reworking of the code-base to separate logic from graphics. This version of Expeditee now supports a JFX graphics as an alternative to SWING

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/Vector.java

    r919 r1102  
    1919package org.expeditee.gui;
    2020
    21 import java.awt.Color;
    22 import java.awt.Dimension;
    23 import java.awt.Point;
    2421import java.text.NumberFormat;
    2522
     23import org.expeditee.core.Colour;
     24import org.expeditee.core.Dimension;
     25import org.expeditee.core.Point;
    2626import org.expeditee.items.Item;
    2727import org.expeditee.items.UserAppliedPermission;
    2828
     29/**
     30 * TODO: Explain WTF this is. cts16
     31 */
    2932public class Vector extends Overlay {
    3033
     34        /** TODO: Comment. cts16 */
    3135        public Point Origin;
    3236
     37        /** TODO: Comment. cts16 */
    3338        public float Scale;
    3439
    35         public Color Foreground;
     40        /** TODO: Comment. cts16 */
     41        public Colour Foreground;
    3642
    37         public Color Background;
    38        
     43        /** TODO: Comment. cts16 */
     44        public Colour Background;
     45
     46        /** TODO: Comment. cts16 */
    3947        public Item Source;
    40        
     48
     49        /** TODO: Comment. cts16 */
    4150        public Dimension Size;
    4251
    43         public Vector(Frame overlay, UserAppliedPermission permission,
    44                         Float scale, Item source) {
     52        /** TODO: Comment. cts16 */
     53        public Vector(Frame overlay, UserAppliedPermission permission, Float scale, Item source)
     54        {
    4555                super(overlay, permission);
    4656                Origin = source.getPosition();
     
    5262
    5363        @Override
    54         public boolean equals(Object o) {
    55                 if (o == null || o.getClass() != Vector.class)
    56                         return false;
    57                 Vector v = (Vector) o;
    58 
    59                 return v.Frame == Frame && Origin.equals(v.Origin)
    60                                 && Scale == v.Scale && Foreground == v.Foreground
    61                                 && Background == v.Background;
     64        public boolean equals(Object o)
     65        {
     66                if (o instanceof Vector) {
     67                        Vector v = (Vector) o;
     68                        return v.Frame == Frame &&
     69                                        Origin.equals(v.Origin) &&
     70                                        Scale == v.Scale &&
     71                                        Foreground.equals(v.Foreground) &&
     72                                        Background.equals(v.Background);
     73                }
     74               
     75                return false;
     76               
    6277        }
    6378
    6479        @Override
    65         public int hashCode() {
     80        public int hashCode()
     81        {
    6682                return 0;
    6783        }
    6884
    69         /**
    70          * Converts the given x position to be relative to the overlay frame.
    71          *
    72          * @param x
    73          * @return
    74          */
    75         public float getX(int x) {
     85        /** Converts the given x position to be relative to the overlay frame. */
     86        public float getX(int x)
     87        {
    7688                return (x - Origin.x) / Scale;
    7789        }
    7890
    79         public float getY(int y) {
     91        /** Converts the given y position to be relative to the overlay frame. */
     92        public float getY(int y)
     93        {
    8094                return (y - Origin.y) / Scale;
    8195        }
    8296
    83         public void setSize(int maxX, int maxY) {
     97        /** TODO: Comment. cts16 */
     98        public void setSize(int maxX, int maxY)
     99        {
    84100                Size = new Dimension(maxX, maxY);
    85101        }
    86102
    87         public static NumberFormat getNumberFormatter() {
     103        /** TODO: Comment. cts16 */
     104        public static NumberFormat getNumberFormatter()
     105        {
    88106                NumberFormat nf = NumberFormat.getInstance();
    89107                nf.setMaximumFractionDigits(4);
Note: See TracChangeset for help on using the changeset viewer.