2007-12-23 19:28:04 +00:00
|
|
|
|
|
|
|
package net.sourceforge.tuned.ui.notification;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.SwingConstants;
|
|
|
|
|
|
|
|
|
2008-07-30 22:37:01 +00:00
|
|
|
class Factor implements SwingConstants {
|
2007-12-23 19:28:04 +00:00
|
|
|
|
2008-07-30 22:37:01 +00:00
|
|
|
public final double fx;
|
|
|
|
public final double fy;
|
2007-12-23 19:28:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
public Factor(double fx, double fy) {
|
|
|
|
this.fx = fx;
|
|
|
|
this.fy = fy;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static Factor getOrientationFactor(int orientation) {
|
|
|
|
double fx = 0;
|
|
|
|
double fy = 0;
|
|
|
|
|
|
|
|
switch (orientation) {
|
|
|
|
case NORTH_WEST:
|
|
|
|
fx = 0;
|
|
|
|
fy = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NORTH:
|
|
|
|
fx = 0.5;
|
|
|
|
fy = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NORTH_EAST:
|
|
|
|
fx = 1;
|
|
|
|
fy = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WEST:
|
|
|
|
fx = 0;
|
|
|
|
fy = 0.5;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EAST:
|
|
|
|
fx = 1;
|
|
|
|
fy = 0.5;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SOUTH_WEST:
|
|
|
|
fx = 0;
|
|
|
|
fy = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SOUTH:
|
|
|
|
fx = 0.5;
|
|
|
|
fy = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SOUTH_EAST:
|
|
|
|
fx = 1;
|
|
|
|
fy = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CENTER:
|
|
|
|
fx = 0.5;
|
|
|
|
fy = 0.5;
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Factor(fx, fy);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static Factor getDirectionFactor(int direction) {
|
|
|
|
double fx = 0;
|
|
|
|
double fy = 0;
|
|
|
|
|
|
|
|
switch (direction) {
|
|
|
|
case NORTH_WEST:
|
|
|
|
fx = -1;
|
|
|
|
fy = -1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NORTH:
|
|
|
|
fx = 0;
|
|
|
|
fy = -1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NORTH_EAST:
|
|
|
|
fx = 1;
|
|
|
|
fy = -1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WEST:
|
|
|
|
fx = -1;
|
|
|
|
fy = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EAST:
|
|
|
|
fx = 1;
|
|
|
|
fy = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SOUTH_WEST:
|
|
|
|
fx = -1;
|
|
|
|
fy = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SOUTH:
|
|
|
|
fx = 0;
|
|
|
|
fy = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SOUTH_EAST:
|
|
|
|
fx = 1;
|
|
|
|
fy = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CENTER:
|
|
|
|
fx = 0;
|
|
|
|
fy = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Factor(fx, fy);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|