Package de.psi.telco.sumoplayer.util

Examples of de.psi.telco.sumoplayer.util.PointImpl


     
      // calculate jitter if required
      if (jitter > 0){
        double jitterLon = GeoCalc.getLonOffset(p.getX(), p.getY(), jitter)*((Math.random()*2)-1);
        double jitterLat = GeoCalc.getLatOffset(p.getX(), p.getY(), jitter)*((Math.random()*2)-1);
        p = new PointImpl(p.getX()+jitterLon,p.getY()+jitterLat);
      }
     
      // call the listener
      this.listener.LocationUpdated(vehicleId, timestep, p.getX(), p.getY(), speed*3.6);
    }
 
View Full Code Here


      Point out = network.lanes.get(laneId).getPositionWithin(pos);
     
      out = proj.transformInvers(out);
      return out;
    }else{
      return new PointImpl(0,0);
    }
  }
View Full Code Here

        a = b;
      }
     
      // sometimes requested positions lies a bit outside the lane. dont know why.
      if (foundWithin){  // TODO: check if this is just a sumo mistake
        PointImpl startPos = new PointImpl(points.get(idx).getX(),points.get(idx).getY());
        PointImpl endPos = new PointImpl(points.get(idx+1).getX(),points.get(idx+1).getY());
        double partialLen = startPos.distance(endPos);
        double rest = pos-len;
        double fact = rest/partialLen;
       
        Vector out = startPos.add((endPos.sub(startPos).scale(fact)));
        return new PointImpl(out.getX(),out.getY());
      }else{
        return points.get(points.size()-1);    // just return last point
      }
   
    }catch(Exception e){
      e.printStackTrace();
      return new PointImpl(0,0);
    }
  }
View Full Code Here

        if (coordElements != null && coordElements.length == 2){  // split by comma ( COORD1X,COORD1Y )
          try{
            double x = Double.parseDouble(coordElements[0]);
            double y = Double.parseDouble(coordElements[1]);
           
            network.lanes.get(sumoLaneId).points.add(new PointImpl(x,y));
          }catch(NumberFormatException e){
          }
        }       
      }
     
View Full Code Here

        if (coordElements != null && coordElements.length == 2){  // split by comma ( COORD1X,COORD1Y )
          try{
            double x = Double.parseDouble(coordElements[0]);
            double y = Double.parseDouble(coordElements[1]);
           
            network.lanes.get(sumoLaneId).points.add(new PointImpl(x,y));
          }catch(NumberFormatException e){
          }
        }       
      }

    }else if (currentElementType == OFFSET){  // read offset. i.e:  <net-offset>-755969.000000,-5660071.000000</net-offset>
      char[] chars = new char[length]// copy stuff from sax buffer
      for (int i = 0; i<length; i++){
        chars[i] = ch[start+i];
      }
      String data = new String(chars);
      String[] vectorElements = data.split(",");
      if (vectorElements.length==2){
        network.offset = new PointImpl(Double.parseDouble(vectorElements[0]),Double.parseDouble(vectorElements[1]));
      }
    }else if (currentElementType == PROJ){  // read projection string. i.e:  <orig-proj>+proj=utm +ellps=bessel +units=m</orig-proj>
      char[] chars = new char[length]// copy stuff from sax buffer
      for (int i = 0; i<length; i++){
        chars[i] = ch[start+i];
View Full Code Here

  public String projString = null;
  public Vector offset = new PointImpl(0,0);
  private Map<String,Point> junctions = new HashMap<String,Point>();
 
  public void addJunction(String id, double x, double y){
    junctions.put(id, new PointImpl(x,y));
  }
View Full Code Here

TOP

Related Classes of de.psi.telco.sumoplayer.util.PointImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.