Last change
on this file since 115 was 115, checked in by ra33, 16 years ago |
added functionality for dockable @v's
|
File size:
1.0 KB
|
Line | |
---|
1 | package org.expeditee.gui;
|
---|
2 |
|
---|
3 | import java.awt.Color;
|
---|
4 | import java.awt.Point;
|
---|
5 |
|
---|
6 | import org.expeditee.items.Permission;
|
---|
7 |
|
---|
8 | public class Vector extends Overlay {
|
---|
9 |
|
---|
10 | public Point Origin;
|
---|
11 |
|
---|
12 | public float Scale;
|
---|
13 |
|
---|
14 | public Color Foreground;
|
---|
15 |
|
---|
16 | public Color Background;
|
---|
17 |
|
---|
18 | public Vector(Frame overlay, Permission permission, Point origin,
|
---|
19 | Float scale, Color color, Color background) {
|
---|
20 | super(overlay, permission);
|
---|
21 | Origin = origin;
|
---|
22 | Scale = scale;
|
---|
23 | Foreground = color;
|
---|
24 | Background = background;
|
---|
25 | }
|
---|
26 |
|
---|
27 | @Override
|
---|
28 | public boolean equals(Object o) {
|
---|
29 | if (o == null || o.getClass() != Vector.class)
|
---|
30 | return false;
|
---|
31 | Vector v = (Vector) o;
|
---|
32 |
|
---|
33 | return v.Frame == Frame && Origin.equals(v.Origin)
|
---|
34 | && Scale == v.Scale && Foreground == v.Foreground
|
---|
35 | && Background == v.Background;
|
---|
36 | }
|
---|
37 |
|
---|
38 | @Override
|
---|
39 | public int hashCode() {
|
---|
40 | return 0;
|
---|
41 | }
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * Converts the given x position to be relative to the overlay frame.
|
---|
45 | *
|
---|
46 | * @param x
|
---|
47 | * @return
|
---|
48 | */
|
---|
49 | public float getX(int x) {
|
---|
50 | return (x - Origin.x) / Scale;
|
---|
51 | }
|
---|
52 |
|
---|
53 | public float getY(int y) {
|
---|
54 | return (y - Origin.y) / Scale;
|
---|
55 | }
|
---|
56 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.