Package de.hpi.eworld.model.db.data.event

Examples of de.hpi.eworld.model.db.data.event.EdgeLocationModel


    poi[1] = new PointOfInterest(5.0, 3.0, "Point of interest 2");

    // create road events
    RoadEventModel[] re = new RoadEventModel[2];

    EdgeLocationModel el = new EdgeLocationModel(e[4], 0.25, 0.5);
    re[0] = new RoadEventModel(RoadEventModel.Type.Accident, el);
    re[0].setBlockedLanes(new ArrayList<LaneModel>(e[4].getLanes()));
    re[0].setStartTime(100);
    re[0].setEndTime(1000);

    el = new EdgeLocationModel(e[34], 0.25, 0.5);
    re[1] = new RoadEventModel(RoadEventModel.Type.Roadwork, el);
    re[1].setBlockedLanes(new ArrayList<LaneModel>(e[34].getLanes()));
    re[1].setStartTime(0);
    re[1].setEndTime(10000);
View Full Code Here


  public void testEdgeLocation () {
    NodeModel fromNode = new NodeModel(2.3, 45,6);
    NodeModel toNode = new NodeModel(45.22, 78.899);
   
    EdgeModel e = new EdgeModel("testModelID", fromNode, toNode);
    EdgeLocationModel el1 = new EdgeLocationModel(e, -12.3, -55.67);
    EdgeLocationModel el2 = new EdgeLocationModel(e, 12.3, 55.67);
   
    Assert.assertEquals(-12.3, el1.getDistance());
    Assert.assertEquals(-55.67, el1.getLength());
   
    Assert.assertEquals(12.3, el2.getDistance());
    Assert.assertEquals(55.67, el2.getLength());
   
    Assert.assertEquals(fromNode, el1.getFromNode());
    Assert.assertEquals(fromNode, el2.getFromNode());
   
    Assert.assertEquals(toNode, el1.getToNode());
    Assert.assertEquals(toNode, el2.getToNode());
  }
View Full Code Here

   
    NodeModel fromNode = new NodeModel(2.3, 45,6);
    NodeModel toNode = new NodeModel(45.22, 78.899);
   
    EdgeModel e = new EdgeModel("testModelID", fromNode, toNode);
    EdgeLocationModel el1 = new EdgeLocationModel(e, -12.3, -55.67);
    EdgeLocationModel el2 = new EdgeLocationModel(e, 12.3, 55.67);
   
   
    ///////////////////////////////////
    // run restore test
   
View Full Code Here

  @Test
  public void testSetEvent() {
    NodeModel from = new NodeModel(0, 0);
    NodeModel to = new NodeModel(1, 1);
    EdgeModel e = new EdgeModel("testModelID", from, to);
    EdgeLocationModel edgeLocation = new EdgeLocationModel(e, 0, 0);
    RoadEventModel roadEvent = new RoadEventModel(RoadEventModel.Type.Accident, edgeLocation);
    timeline.getTimeline().setEvent(roadEvent);
    Assert.assertTrue(timeline.getTimeline().getCurrentEvent() == roadEvent);
  }
View Full Code Here

  @Test
  public void testRoadEventItem() {
    NodeModel from = new NodeModel(0, 0);
    NodeModel to = new NodeModel(1, 1);
    EdgeModel e = new EdgeModel("testModelID", from, to);
    EdgeLocationModel edgeLocation = new EdgeLocationModel(e, 0, 0);
    RoadEventModel roadEvent = new RoadEventModel(RoadEventModel.Type.Accident, edgeLocation);
    AbstractView<Observable> viewItem = AbstractViewFactory.createView(roadEvent);
    Assert.assertNotNull(viewItem);
    Assert.assertTrue(viewItem instanceof AbstractView<?>);
//    RoadEventItem roadEventItem = (RoadEventItem) viewItem;
View Full Code Here

   
    NodeModel fromNode = new NodeModel(2.3, 45,6);
    NodeModel toNode = new NodeModel(45.22, 78.899);
   
    EdgeModel e = new EdgeModel("testModelID", fromNode, toNode);
    EdgeLocationModel el1 = new EdgeLocationModel(e, -12.3, -55.67);
    EdgeLocationModel el2 = new EdgeLocationModel(e, 12.3, 55.67);
   
    RoadEventModel re1 = new RoadEventModel(RoadEventModel.Type.Accident, el1);
    RoadEventModel re2 = new RoadEventModel(RoadEventModel.Type.Roadwork, el1);
   
    RoadEventModel re3 = new RoadEventModel(RoadEventModel.Type.Accident, el2);
View Full Code Here

   
    NodeModel fromNode = new NodeModel(2.3, 45,6);
    NodeModel toNode = new NodeModel(45.22, 78.899);
   
    EdgeModel e = new EdgeModel("testModelID", fromNode, toNode);
    EdgeLocationModel el = new EdgeLocationModel(e, -12.3, -55.67);
   
    EnvironmentEventModel ee3 =
      new EnvironmentEventModel(EnvironmentEventModel.Type.Snow, 0, el);
   
    ///////////////////////////////////
View Full Code Here

   
    NodeModel fromNode = new NodeModel(2.3, 45,6);
    NodeModel toNode = new NodeModel(45.22, 78.899);
   
    EdgeModel e = new EdgeModel("testModelID", fromNode, toNode);
    EdgeLocationModel el1 = new EdgeLocationModel(e, -12.3, -55.67);
    EdgeLocationModel el2 = new EdgeLocationModel(e, 12.3, 55.67);
   
    RoadEventModel re1 = new RoadEventModel(RoadEventModel.Type.Accident, el1);
    RoadEventModel re2 = new RoadEventModel(RoadEventModel.Type.Roadwork, el1);
   
    RoadEventModel re3 = new RoadEventModel(RoadEventModel.Type.Accident, el2);
    RoadEventModel re4 = new RoadEventModel(RoadEventModel.Type.Roadwork, el2);
   
    RoadEventModel re5 = new RoadEventModel(RoadEventModel.Type.Accident);
    RoadEventModel re6 = new RoadEventModel(RoadEventModel.Type.Roadwork);
   
    ///////////////////////////////////
    // set up ee1 with CircleLocation
   
    CircleLocationModel cl = new CircleLocationModel();
   
    Point2D positionOnScreen = new Point2D.Double(3,4);
    GlobalPosition centerPosition = GlobalPosition.from(positionOnScreen);
    cl.setCenter(centerPosition);
   
    Point2D circlePoint = new Point2D.Double(0, -25);
    GlobalPosition circlePosition = GlobalPosition.from(circlePoint);
    cl.setCirclePoint(circlePosition);
   
    cl.setRadius(centerPosition.distanceTo(circlePosition));
   
    EnvironmentEventModel ee1 =
      new EnvironmentEventModel(EnvironmentEventModel.Type.CO2, 12, cl);
   
    ///////////////////////////////////
    // set up ee2 with PloygonLocation
   
    PolygonLocationModel pl = new PolygonLocationModel();
   
    List<GlobalPosition> positions = new ArrayList<GlobalPosition>();
   
    Point2D p1 = new Point2D.Double(3,4);
    GlobalPosition gp1 = GlobalPosition.from(p1);
    positions.add(gp1);
   
    Point2D p2 = new Point2D.Double(13,14);
    GlobalPosition gp2 = GlobalPosition.from(p2);
    positions.add(gp2);
   
    Point2D p3 = new Point2D.Double(22,23);
    GlobalPosition gp3 = GlobalPosition.from(p3);
    positions.add(gp3);
   
    Point2D p4 = new Point2D.Double(12,9);
    GlobalPosition gp4 = GlobalPosition.from(p4);
    positions.add(gp4);
   
    Point2D p5 = new Point2D.Double(3,34);
    GlobalPosition gp5 = GlobalPosition.from(p5);
    positions.add(gp5);
   
    pl.setPoints(positions);
   
    EnvironmentEventModel ee2 =
      new EnvironmentEventModel(EnvironmentEventModel.Type.Fog, -23, pl);
   
    ///////////////////////////////////
    // set up ee3 with EdgeLocation
   
    NodeModel fromNode2 = new NodeModel(2.3, 45,6);
    NodeModel toNode2 = new NodeModel(45.22, 78.899);
   
    EdgeModel e2 = new EdgeModel("testModelID", fromNode2, toNode2);
    EdgeLocationModel el = new EdgeLocationModel(e2, -12.3, -55.67);
   
    EnvironmentEventModel ee3 =
      new EnvironmentEventModel(EnvironmentEventModel.Type.Snow, 0, el);
   
    ///////////////////////////////////
View Full Code Here

   *
   * @param roadEvent
   *            Underlying road event from database
   */
  public RoadEventView(final RoadEventModel roadEvent) {
    this(roadEvent, new EdgeLocationModel(null, 0, 0));
  }
View Full Code Here

 
  //FIXME the calculation seems not to use the nearest edge
  @Override
  public Rectangle2D getInitialBounds() {
    if ((getModelElement() != null) && (getModelElement().getLocation() != null)) {
      final EdgeLocationModel edgeLocation = (EdgeLocationModel) getModelElement().getLocation();
      final List<EdgeModel> edgeList = edgeLocation.getEdges();
      if ((edgeList != null) && (edgeList.size() != 0)) {
       
        EdgeModel edge = edgeList.get(0);

        GlobalPosition edgeStartGlobal = edge.getFromNode().getPosition();
        GlobalPosition edgeEndGlobal = edge.getToNode().getPosition();
       
        double globalLenght = edgeEndGlobal.distanceTo(edgeStartGlobal);
        double distanceToStart = edgeLocation.getDistance();

        Point2D edgeStartLocal = edge.getFromNode().getPosition().projected();
        Point2D edgeEndLocal = edge.getToNode().getPosition().projected();
       
        double localLength = Point2DUtils.distance(edgeEndLocal, edgeStartLocal);
View Full Code Here

TOP

Related Classes of de.hpi.eworld.model.db.data.event.EdgeLocationModel

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.