Changeset 1102 for trunk/src/org/expeditee/gui/Vector.java
- Timestamp:
- 05/10/18 16:04:51 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/Vector.java
r919 r1102 19 19 package org.expeditee.gui; 20 20 21 import java.awt.Color;22 import java.awt.Dimension;23 import java.awt.Point;24 21 import java.text.NumberFormat; 25 22 23 import org.expeditee.core.Colour; 24 import org.expeditee.core.Dimension; 25 import org.expeditee.core.Point; 26 26 import org.expeditee.items.Item; 27 27 import org.expeditee.items.UserAppliedPermission; 28 28 29 /** 30 * TODO: Explain WTF this is. cts16 31 */ 29 32 public class Vector extends Overlay { 30 33 34 /** TODO: Comment. cts16 */ 31 35 public Point Origin; 32 36 37 /** TODO: Comment. cts16 */ 33 38 public float Scale; 34 39 35 public Color Foreground; 40 /** TODO: Comment. cts16 */ 41 public Colour Foreground; 36 42 37 public Color Background; 38 43 /** TODO: Comment. cts16 */ 44 public Colour Background; 45 46 /** TODO: Comment. cts16 */ 39 47 public Item Source; 40 48 49 /** TODO: Comment. cts16 */ 41 50 public Dimension Size; 42 51 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 { 45 55 super(overlay, permission); 46 56 Origin = source.getPosition(); … … 52 62 53 63 @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 62 77 } 63 78 64 79 @Override 65 public int hashCode() { 80 public int hashCode() 81 { 66 82 return 0; 67 83 } 68 84 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 { 76 88 return (x - Origin.x) / Scale; 77 89 } 78 90 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 { 80 94 return (y - Origin.y) / Scale; 81 95 } 82 96 83 public void setSize(int maxX, int maxY) { 97 /** TODO: Comment. cts16 */ 98 public void setSize(int maxX, int maxY) 99 { 84 100 Size = new Dimension(maxX, maxY); 85 101 } 86 102 87 public static NumberFormat getNumberFormatter() { 103 /** TODO: Comment. cts16 */ 104 public static NumberFormat getNumberFormatter() 105 { 88 106 NumberFormat nf = NumberFormat.getInstance(); 89 107 nf.setMaximumFractionDigits(4);
Note:
See TracChangeset
for help on using the changeset viewer.