Package de.hpi.eworld.core

Examples of de.hpi.eworld.core.ModelManager


    filename = this.netField.getText();
    routeFilename = this.routeField.getText();
    includeTL = trafficLightsCheckBox.isSelected();
    withRoutes = routeFileCheckBox.isSelected();
 
    ModelManager model = ModelManager.getInstance();
   
    progressDialog = new ProgressDialog(this,
        "Loading SUMO file...",
        new CancelListener(this));
View Full Code Here


   *
   * At this time, there is no map loaded so no {@link CityModel} object is
   * created yet. This happens when a map is imported.
   */
  private CityPropertyModels() {
    ModelManager modelManager = ModelManager.getInstance();
    modelManager.addObserver(this);
  }
View Full Code Here

   * Creates a new {@code CityModel} instance, adds it to the
   * {@code ModelManager} and connects the number models to this new instance.
   */
  private void createCity() {
    CityModel city = new CityModel();
    ModelManager modelManager = ModelManager.getInstance();
    modelManager.addModelElement(city);

    carPersonRelationModel.clear();
    carPersonRelationModel.add(city);
    carPreferenceModel.clear();
    carPreferenceModel.add(city);
View Full Code Here

  public void buildeWorldStructure() {
    HashMap<String, NodeModel> eNodes = new HashMap<String, NodeModel>();
    HashMap<String, TrafficLightModel> eTrafficLights = new HashMap<String, TrafficLightModel>();
    HashMap<String, WayModel> eWays = new HashMap<String, WayModel>();

    ModelManager model = ModelManager.getInstance();
   
    model.clearModel();

    model.setChanged();
    model.notifyObservers(new ObserverNotification(NotificationType.startBatchProcess));
    model.clearChanged();
   
    for(String id : nodes.keySet()) {
      MyNode n = nodes.get(id);
      NodeModel newNode = new NodeModel(n.lat, n.lon);
      if (n.isTrafficLight){
        TrafficLightModel trafficLight = new TrafficLightModel(newNode);
        eTrafficLights.put(id, trafficLight);
      }
//      if (n.isTrafficLight)
//        newNode = new TrafficLightModel(n.lat, n.lon);
//      else
//        newNode = new NodeModel(n.lat, n.lon);
      eNodes.put(id, newNode);
      model.addModelElement(newNode);
    }
   
    for(Entry<String, MyEdge> edgePair : edges.entrySet()) {
      MyEdge e = edgePair.getValue();
      EdgeModel newEdge = new EdgeModel(edgePair.getKey(), eNodes.get(e.first), eNodes.get(e.second));
     
      for(int i=0; i<e.nolanes; i++) {
        newEdge.addLane(new LaneModel());
      }
     
      model.addModelElement(newEdge);
      if (eWays.keySet().contains(e.second + "|" + e.first)) {
        eWays.get(e.second+"|"+e.first).addBackwardEdge(newEdge);
        newEdge.setComplementaryEdge(eWays.get(e.second+"|"+e.first).getFirstForwardEdge());
        eWays.get(e.second+"|"+e.first).getFirstForwardEdge().setComplementaryEdge(newEdge);
        newEdge.setParentWay(eWays.get(e.second+"|"+e.first));
      } else {
        WayModel newWay = new WayModel("");
        newWay.addForwardEdge(newEdge);
        newEdge.setParentWay(newWay);
        eWays.put(e.first+"|"+e.second, newWay);
        model.addModelElement(newWay);
      }
    }
   
    model.setChanged();
    model.notifyObservers(new ObserverNotification(NotificationType.endBatchProcess, true, false));
    model.clearChanged();
  }
View Full Code Here

TOP

Related Classes of de.hpi.eworld.core.ModelManager

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.