Example #1
0
 private boolean funcLocMixVeloOk(ccr.app.Context ctx1, ccr.app.Context ctx2) {
   java.lang.String v1 = (java.lang.String) ctx1.get(Context.FLD_OBJECT);
   java.lang.String v2 = (java.lang.String) ctx1.get(Context.FLD_TIMESTAMP);
   java.lang.String v3 = (java.lang.String) ctx2.get(Context.FLD_OBJECT);
   java.lang.String v4 = (java.lang.String) ctx2.get(Context.FLD_TIMESTAMP);
   if (v1 == null || v2 == null || v3 == null || v4 == null) {
     return false;
   }
   java.util.StringTokenizer st = new java.util.StringTokenizer(v1);
   double x1 = Double.parseDouble(st.nextToken());
   double y1 = Double.parseDouble(st.nextToken());
   st = new java.util.StringTokenizer(v3);
   double x2 = Double.parseDouble(st.nextToken());
   double y2 = Double.parseDouble(st.nextToken());
   double dist = Coordinates.calDist(x1, y1, x2, y2);
   long t = TimeFormat.convert(v4) - TimeFormat.convert(v2) - STAY_TIME;
   boolean result = false;
   double vmin = (VELOCITY * ((double) t / 1000) - 2 * ERR) / ((double) t / 1000);
   double vmax = (VELOCITY * ((double) t / 1000) + 2 * ERR) / ((double) t / 1000);
   double ve = dist / ((double) t / 1000);
   if (ve >= vmin && ve <= vmax) {
     result = true;
   }
   return result;
 }
Example #2
0
 private ccr.app.Coordinates toCoordinates(ccr.app.Context ctx) {
   java.util.StringTokenizer st =
       new java.util.StringTokenizer((java.lang.String) ctx.get(Context.FLD_OBJECT));
   double x = Double.parseDouble(st.nextToken());
   double y = Double.parseDouble(st.nextToken());
   return new ccr.app.Coordinates(x, y);
 }
Example #3
0
 private boolean funcLocDistOk(ccr.app.Context ctx1, ccr.app.Context ctx2) {
   java.lang.String v1 = (java.lang.String) ctx1.get(Context.FLD_OBJECT);
   java.lang.String v2 = (java.lang.String) ctx2.get(Context.FLD_OBJECT);
   if (v1 == null || v2 == null) {
     return false;
   }
   java.util.StringTokenizer st = new java.util.StringTokenizer(v1);
   double x1 = Double.parseDouble(st.nextToken());
   double y1 = Double.parseDouble(st.nextToken());
   st = new java.util.StringTokenizer(v2);
   double x2 = Double.parseDouble(st.nextToken());
   double y2 = Double.parseDouble(st.nextToken());
   double dist = Coordinates.calDist(x1, y1, x2, y2);
   boolean result = false;
   if (dist <= 2 * ERR) {
     result = true;
   }
   return result;
 }