Examples of EdgeLocationModel


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

    return edge;
  }
   
  @Override
  public void propagatePosition() {
    final EdgeLocationModel location = (EdgeLocationModel) getModelElement().getLocation();
    // search the edge at our position
    final Ellipse2D rect = new Ellipse2D.Double(getPosition().getX(), getPosition().getY(), 2*SOME_WEIRD_MAGIC_EPSILON, 2*SOME_WEIRD_MAGIC_EPSILON);
    final List<WayView> ways = GraphUtils.getWaysIn(graphController, rect);
    EdgeModel foundForwardEdge = null;
    EdgeModel foundBackwardEdge = null;
    EdgeModel chosenEdge = null;
   
    for (final WayView view : ways) {
      final List<EdgeModel> forwardEdges = ((WayView) view).getModelElement().getForwardEdges();
      foundForwardEdge = findAffectedEdges(view, forwardEdges);
       
      final List<EdgeModel> backwardEdges = ((WayView) view).getModelElement().getBackwardEdges();
      foundBackwardEdge = findAffectedEdges(view, backwardEdges);
    }
   
    chosenEdge = foundBackwardEdge;
    if (foundBackwardEdge == null) {
      if (foundForwardEdge == null){
        // no edge found, do nothing
        return
      }     
      chosenEdge = foundForwardEdge;
    }
   
    location.resetEdges();
    location.addEdge(chosenEdge);
    location.setDistance(GlobalPosition.from(getPosition()).distanceTo(chosenEdge.getFromNode().getPosition()));
    getModelElement().setLocation(location);
  }
View Full Code Here

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

  @Override
  public ModelElement getAdjustedAssociatedElement(Point2D position, GraphController graphController) {
    RoadEventModel modelElement = (RoadEventModel) getModelElement().clone();
    if (this.graphController == null) this.graphController = graphController;
   
    EdgeLocationModel edgeLocation = findEdgeLocationAt(graphController, position);
    if (edgeLocation != null) {
      // set edge information to RoadEventModel attribute
      modelElement.setLocation(edgeLocation);
      return modelElement;
    }
View Full Code Here

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

   * @param edge - the nearest edge
   * @param distanceToStartPoint - the distance to the edge start point
   * @return
   */
  private EdgeLocationModel initializeEdgeLocation(EdgeModel edge, double distanceToStartPoint){
    EdgeLocationModel edgeLocation = new EdgeLocationModel();
    edgeLocation.addEdge(edge);
    edgeLocation.setDistance(distanceToStartPoint);
    return edgeLocation;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.