1 package simworldobjects;
2
3 import interfaces.*;
4
5
16 public abstract class SimSensor implements SimObject
17 {
18 private SimObject object;
20
21 private double xOffset, zOffset;
22 private double height, width, length;
23 private String type;
24 private char loc;
25
26
29 public void initSimSensor(SimObject object, double xOffset, double zOffset, double height, double width, double length, String type, char loc)
30 {
31 this.object=object;
32 this.xOffset=xOffset;
33 this.zOffset=zOffset;
34 this.height=height;
35 this.width=width;
36 this.length=length;
37 this.type=type;
38 this.loc = loc;
39 }
40
41
46 public abstract int getValue();
47
48 public void setDesiredVelocity(double v){}
49 public void setActualVelocity(double v){}
50 public void setXCoord(double x){}
51 public void setYCoord(double y){}
52 public void setZCoord(double z){}
53
54 public double getDesiredVelocity()
55 {
56 return 0.0;
57 }
58
59 public double getActualVelocity()
60 {
61 return 0.0;
62 }
63
64
67 public double getXCoord()
68 {
69 return object.getXCoord()+
70 (xOffset*Math.cos(Math.toRadians(object.getActualBearingXZ())))+
71 (zOffset*-Math.sin(Math.toRadians(object.getActualBearingXZ())));
72 }
73
74
77 public double getYCoord()
78 {
79 return 0.0;
80 }
81
82
85 public double getZCoord()
86 {
87 return object.getZCoord()+
88 (zOffset*Math.cos(Math.toRadians(object.getActualBearingXZ())))+
89 (xOffset*Math.sin(Math.toRadians(object.getActualBearingXZ())));
90 }
91
92 public void setDesiredBearingVelocityXZ(double v){}
93 public void setDesiredBearingVelocityXY(double v){}
94 public void setActualBearingVelocityXZ(double b){}
95 public void setActualBearingVelocityXY(double b){}
96 public void setActualBearingXZ(double b){}
97 public void setActualBearingXY(double b){}
98
99 public double getDesiredBearingVelocityXZ()
100 {
101 return 0.0;
102 }
103
104 public double getDesiredBearingVelocityXY()
105 {
106 return 0.0;
107 }
108
109 public double getActualBearingVelocityXZ()
110 {
111 return 0.0;
112 }
113
114 public double getActualBearingVelocityXY()
115 {
116 return 0.0;
117 }
118
119
122 public double getActualBearingXZ()
123 {
124 return object.getActualBearingXZ();
125 }
126
127 public double getActualBearingXY()
128 {
129 return 0.0;
130 }
131
132 public double getHeight()
133 {
134 return this.height;
135 }
136
137 public double getWidth()
138 {
139 return this.width;
140 }
141
142 public double getLength()
143 {
144 return this.length;
145 }
146
147 public String getType()
148 {
149 return this.type;
150 }
151 public char getPosition(){
152 return this.loc;
153 }
154 public SimObject getOwner(){
155 return this.object;
156 }
157 }
158