Package it.polito.appeal.traci

Examples of it.polito.appeal.traci.PositionConversionQuery


    TraCITest.printSeparator();
  }

  @Test
  public void testConvertRoadmapBeginToLonLat() throws IOException {
    PositionConversionQuery conv = conn.queryPositionConversion();
    conv.setPositionToConvert(new RoadmapPosition(EDGE_NAME, 0, LANE_NUM));
    Point2D out = conv.get();
    assertEquals(LOCATION_GEO.getX(), out.getX(), 1e-5);
    assertEquals(LOCATION_GEO.getY(), out.getY(), 1e-5);
  }
View Full Code Here


  }


  @Test
  public void testConvertXYToLonLat() throws IOException {
    PositionConversionQuery conv = conn.queryPositionConversion();
    conv.setPositionToConvert(LOCATION_LOCAL, true);
    Point2D out = conv.get();
    assertEquals(LOCATION_GEO.getX(), out.getX(), 1e-5);
    assertEquals(LOCATION_GEO.getY(), out.getY(), 1e-5);
  }
View Full Code Here

  }

  @Ignore // because it just fails. I suspect a bug in SUMO.
  @Test
  public void testConvertLonLatToXY() throws IOException {
    PositionConversionQuery conv = conn.queryPositionConversion();
    conv.setPositionToConvert(LOCATION_GEO, false);
    Point2D out = conv.get();
    assertEquals(LOCATION_LOCAL.getX(), out.getX(), 1e-5);
    assertEquals(LOCATION_LOCAL.getY(), out.getY(), 1e-5);
  }
View Full Code Here

 
  @Test
  public void testMultiConvert() throws IOException {
    MultiQuery mq = conn.makeMultiQuery();
   
    PositionConversionQuery conv1 = conn.queryPositionConversion();
    conv1.setPositionToConvert(LOCATION_LOCAL, true);
    mq.add(conv1);

    PositionConversionQuery conv2 = conn.queryPositionConversion();
    Point2D loc2 = new Point2D.Double(LOCATION_LOCAL.getX() + 5, LOCATION_LOCAL.getY() + 5);
    conv2.setPositionToConvert(loc2, false);
    mq.add(conv2);
   
    mq.run();
   
    Point2D out1 = conv1.get();
    Point2D out2 = conv2.get();

    assertEquals(LOCATION_GEO.getX(), out1.getX(), 1e-5);
    assertEquals(LOCATION_GEO.getY(), out1.getY(), 1e-5);
    assertFalse(out2.getX() + " should be different than " + out1.getX(), Math.abs(out2.getX() - out1.getX()) < 1e-5);
    assertFalse(out2.getY() + " should be different than " + out1.getY(), Math.abs(out2.getY() - out1.getY()) < 1e-5);
View Full Code Here

TOP

Related Classes of it.polito.appeal.traci.PositionConversionQuery

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.