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

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


    cl.setCirclePoint(new GlobalPosition(3.0, 2.0));
    List<EdgeModel> underlyingEdges = calculateUnderlyingEdges(3.0, 4.0, 2.0, Arrays.asList(e));
    for (EdgeModel underlyingEdge : underlyingEdges) {
      cl.addEdge(underlyingEdge);
    }
    ee[0] = new EnvironmentEventModel(EnvironmentEventModel.Type.Fog, 2, cl);
    ee[0].setStartTime(0);
    ee[0].setEndTime(5000);

    cl = new CircleLocationModel();
    cl.setCenter(new GlobalPosition(3.0, 3.0));
    cl.setRadius(3.0);
    cl.setCirclePoint(new GlobalPosition(3.0, 2.0));
    underlyingEdges = calculateUnderlyingEdges(3.0, 3.0, 3.0, Arrays.asList(e));
    for (EdgeModel underlyingEdge : underlyingEdges) {
      cl.addEdge(underlyingEdge);
    }
    ee[1] = new EnvironmentEventModel(EnvironmentEventModel.Type.Rain, 2, cl);
    ee[1].setStartTime(100);
    ee[1].setEndTime(2000);

    // add all model elements to a list
    for (NodeModel node : n) {
View Full Code Here


    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 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);
   
    ///////////////////////////////////
    // run assertions
   
    Assert.assertEquals(12, ee1.getStrength());
    Assert.assertEquals(-23, ee2.getStrength());
    Assert.assertEquals(0, ee3.getStrength());
   
    Assert.assertEquals(EnvironmentEventModel.Type.CO2, ee1.getEventType());
    Assert.assertEquals(EnvironmentEventModel.Type.Fog, ee2.getEventType());
    Assert.assertEquals(EnvironmentEventModel.Type.Snow, ee3.getEventType());
   
    ee1.setEventType(EnvironmentEventModel.Type.Ice);
    Assert.assertEquals(EnvironmentEventModel.Type.Ice, ee1.getEventType());
   
    Assert.assertEquals(0.5, ee1.getEventEffect());
    Assert.assertEquals(0.7, ee2.getEventEffect());
    Assert.assertEquals(0.8, ee3.getEventEffect());
  }
View Full Code Here

    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);
   
    ///////////////////////////////////
    // run restore test
   
    ModelManager mm = ModelManager.getInstance();
View Full Code Here

  }

  @Override
  public ModelElement getAdjustedAssociatedElement(Point2D scrolledPoint,
      GraphController graphModel) {
    EnvironmentEventModel clonedModel = (EnvironmentEventModel) getModelElement()
        .clone();
    PolygonLocationModel locationModel = new PolygonLocationModel();
    List<GlobalPosition> globals = new ArrayList<GlobalPosition>();
    for (Point2D p : basicShape.translated(scrolledPoint.getX(),
        scrolledPoint.getY()).getPoints()) {
      globals.add(GlobalPosition.from(p));
    }
    locationModel.setPoints(globals);
    clonedModel.setLocation(locationModel);
    return clonedModel;
  }
View Full Code Here

  }

  @Override
  public EnvironmentEventModel getAdjustedAssociatedElement(Point2D scrolledPoint, GraphController graphModel) {
   
    EnvironmentEventModel event = (EnvironmentEventModel) getModelElement().clone();
    CircleLocationModel circle = new CircleLocationModel();

    // setting center
    final GlobalPosition centerPosition = GlobalPosition.from(scrolledPoint);
    circle.setCenter(centerPosition);
    // setting circlePoint
    final Point2D translationPoint = new Point2D.Double(0, 25);
    final Point2D circlePoint = Point2DUtils.add(scrolledPoint, translationPoint);

    final GlobalPosition circlePosition = GlobalPosition.from(circlePoint);
    circle.setCirclePoint(circlePosition);
    // setting radius
    circle.setRadius(centerPosition.distanceTo(circlePosition));
   
    // return adjusted RoadEvent attribute
    event.setLocation(circle);
    return event;
  }
View Full Code Here

TOP

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

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.