/*
* targetclass.java
*
* Created on November 6, 2001, 8:57 PM
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
/**
*
* @author Administrator
* @version
*/
public class targetclass {
// so one field unit can be changed. so if the target can move 2 meters in one second
// then the returned value would be 2. The width and height of the field is in meters
// essentially.
/** Creates new trackerclass */
// This allows for a panel to be added to control the settings of this routine
// real time.
public targetclass(JPanel root) {
root.setBorder(BorderFactory.createTitledBorder("Target Properties"));
}
// This is the routine that is called to get the information for the next period. It also tells
// the routine if the camera can see the target. All the variable are taken
// care oif in here. Like latency, slipage and camera accuracy. INcluding the
// turning time of the wheels and how far they have to go, accerlation and the like.
public movementdata setNextPeriod() {
movementdata data = new movementdata();
data.setForwardMovement(.25);
return data;
}
// passes the central point of the tracker, it also passes the aspect ratio
// which is the distance in meters of one pixel. It also passes the graphics
// class to it. Since one field unit is one meter the picture can be drawn to scale :-)
//
// A normal field is 600 by 600. So if a side is one meter long at a factor of 1
// the length is one pixal. If the factor is .25 or a zoom of 4x. the side would be 4 pixals.
public void drawtarget(int targetposx, int targetposy, double factorx, double factory, Graphics g)
{
g.fillOval(targetposx-3, targetposy-3, 7, 7);
}
// All movement and turning considerations are done in this routine.
// the value returned is the direction of the tires, with the forward
// value the number of units forward, and leftorright the number of units
// left (-) or right (+).
}
syntax highlighted by Code2HTML, v. 0.9