Examples of EdgeModel


Examples of com.pcbje.maltegoimporter.model.EdgeModel

      NodeModel source = new MaltegoNodeModel(record[NODE_A_TYPE],
          record[NODE_A_VALUE]);
      NodeModel target = new MaltegoNodeModel(record[NODE_B_TYPE],
          record[NODE_B_VALUE]);
      EdgeModel edge = new MaltegoEdgeModel(source, target,
          label);

      nodes.add(source);
      nodes.add(target);
      edges.add(edge);
View Full Code Here

Examples of de.hpi.eworld.model.db.data.EdgeModel

   * unchecked, because all edges should be of the type AbstractView<ModelElement>
   * @param way
   */
  void addEdge(EdgeView way){
    mxGraphics2DCanvas.putShape(way.getShapeName(), way);
    EdgeModel e = way.getModelElement();
    mxCell from = addShape(new NodeView(e.getFromNode()));
    mxCell to = addShape(new NodeView(e.getToNode()));
    if (from != null && to != null) {
      getGraph().insertEdge(
          getGraph().getDefaultParent(),
          way.getShapeName(),
          way,
View Full Code Here

Examples of de.hpi.eworld.model.db.data.EdgeModel

   *            The longitude of the current position
   * @param posY
   *            The latitude of the current position
   */
  public Pair<EdgeModel, Double> getNearestEdge(final double posX, final double posY) {
    EdgeModel closestEdge = null;

    // set the distance to a really high value
    double distance = 1000000.0;

    // retrieve all "near" lines
View Full Code Here

Examples of de.hpi.eworld.model.db.data.EdgeModel

            edges.put(edge.getInternalID(), edge);
          }
        }
      }

      EdgeModel currEdge;
      for (StatEdge statEdge : dataset.getInterval(interval).getStatEdges()) {
        // try to get corresponding Edge element
        if ((currEdge = edges.get(statEdge.getId())) != null) {
          // line colors
          if (colorBox.isSelected()) {
            // compute color

            Color lowColor = lowButton.color;
            Color highColor = highButton.color;
            if (dataset.isLaneDataIncluded()) {
              // set color depending on lane values
              for (int i = 0; i < currEdge.getNoOfLanes(); i++) {
                double data = statEdge.getStatLane(i).getValue(
                    value);
                Color color = computeColor(data, lowThresh,
                    lowColor, highThresh, highColor);
                currEdge.getLanes().get(i).setColor(color);
              }
            } else {// no lane data
              // give each lane the same color
              // (depending on edge value)
              double data = statEdge.getValue(value);
              Color color = computeColor(data, lowThresh,
                  lowColor, highThresh, highColor);
              for (LaneModel lane : currEdge.getLanes()) {
                lane.setColor(color);
              }
            }
          } else {// color group not checked
            // reset lane colors
            for (LaneModel lane : currEdge.getLanes()) {
              lane.setColor(null);
            }
          }

          // line widths
          if (widthBox.isSelected()) {
            // compute line width, each lane gets the same width

            double data = statEdge.getValue(value);
            double widthOffset = computeWidthOffset(data,
                lowThresh, (Double) lowWidth.getValue(), highThresh,
                (Double) highWidth.getValue());
            for (LaneModel lane : currEdge.getLanes()) {
              lane.setWidthOffset(widthOffset);
            }
          } else {// width group not checked
            // reset lane widths
            for (LaneModel lane : currEdge.getLanes()) {
              lane.setWidthOffset(0);
            }
          }
        }// end if currEdge != null
      }// end for edges
View Full Code Here

Examples of de.hpi.eworld.model.db.data.EdgeModel

          // calculate average number of vehicles to emit on one trip
          double vehicleCountPerTrip = (double) vehicleCount / (double) startEdges.size();
          emittedVehicles = 0;
          for (int i = 0; i < numberOfEdges && emittedVehicles < vehicleCount; i++) {
            EdgeModel startEdge = startEdges.get(i);

            // define the number of vehicles to emit on this trip
            int vehicleCountOnThisTrip = calculateVehicleCountOnThisTrip(vehicleCount, vehicleCountPerTrip,
                numberOfEdges, i);
            if (vehicleCountOnThisTrip == 0) {
              continue;
            }

            // select random vehicle type for this trip
            String vehicleType = defaultVehicleType;
            if (!useDefaultVehicleType) {
              int indexOfVehicleType = random.nextInt(vehicleTypes.size());
              vehicleType = vehicleTypes.get(indexOfVehicleType);
            }

            // select random destination area
            int indexOfDestinationArea = random.nextInt(destinationAreasOfThisStartArea.size());
            AreaModel destinationArea = destinationAreasOfThisStartArea.get(indexOfDestinationArea);

            // select random destination edge in this area
            List<EdgeModel> destinationEdges = destinationArea.getLocation().getEdges();
            if (destinationEdges.size() > 0) {
              int indexOfDestinationEdge = random.nextInt(destinationEdges.size());
              EdgeModel destinationEdge = destinationEdges.get(indexOfDestinationEdge);

              // write data to buffer
              buffer.append(writeTrip(startArea.getSimulationTime(), startEdge, destinationEdge, vehicleType,
                  startArea.getVehicleEmitInterval(), vehicleCountOnThisTrip));
            }
View Full Code Here

Examples of de.hpi.eworld.model.db.data.EdgeModel

        int vehicleCount = area.getVehicleCount();

        for (emittedVehicles = 1; emittedVehicles <= vehicleCount; emittedVehicles++) {
          // select random edge within the defined area
          int indexOfRandomEdgeWithinArea = random.nextInt(numberOfEdges);
          EdgeModel randomEdgeWithinArea = edges.get(indexOfRandomEdgeWithinArea);

          // select random vehicle type for this trip
          String vehicleType = defaultVehicleType;
          if (!useDefaultVehicleType) {
            int indexOfVehicleType = random.nextInt(vehicleTypes.size());
            vehicleType = vehicleTypes.get(indexOfVehicleType);
          }

          // select random destination/start edge
          int indexOfRandomEdge = random.nextInt(numberOfAllEdgesOnMap);
          EdgeModel randomEdge = allEdgesOnMap.get(indexOfRandomEdge);

          // write data to buffer
          if (startAreaDefined) {
            // edge represents the start edge; randomEdge represents the destination edge
            buffer.append(writeTrip(area.getSimulationTime(), randomEdgeWithinArea, randomEdge, vehicleType, area
View Full Code Here

Examples of de.hpi.eworld.model.db.data.EdgeModel

            stringBuffer.append(TEXT_5);
            stringBuffer.append(trafficLight.getDurations()[i]);
            stringBuffer.append(TEXT_6);
            Object[] edgeArray = trafficLight.getDefaultLogic().keySet().toArray();
            EdgeModel edge;
            // iterate over each element beginning at the second.
            for(int j=1; j<=edgeArray.length;j++) {
              if (j==edgeArray.length) {
                edge = (EdgeModel)edgeArray[0];
              }
              else {
                edge = (EdgeModel)edgeArray[j];
              }
              List<TrafficLightStateListEntry> tls = trafficLight.getDefaultLogic().get(edge).getStates();
                       
              int lanes = noOfOutgoingEdges + getStraightLanes(edge, trafficLight.getNode());
              // HACK! It seems that edges with more than one 2 lanes need one more traffic light state!
              // Have a closer look at SUMOs netconvert to solve this issue!
              if (edge.getLanes().size()>2) {
                lanes++;
              }
               
              if (tls.get(i).getState() == TrafficLightState.Green) {
                for (counter = 0; counter < lanes; counter++) {
View Full Code Here

Examples of de.hpi.eworld.model.db.data.EdgeModel

            && ( oneway_backward.contains( onewayAttribute ) )
          )
      ) {
       
        // generate way toward and backward
        EdgeModel fwdEdge;
        EdgeModel bwdEdge;
       
        for( int i = 0; i < currentWay.size() - 1; i++ ) {
          if (filterCyclicEdges && currentWay.get(i) == currentWay.get(i + 1)) {
            continue;
          }

          fwdEdge = createEdge( currentWay.get( i ), currentWay.get( i + 1 ), way );
          bwdEdge = createEdge( currentWay.get( i + 1 ), currentWay.get( i ), way );

            if(bwdEdge == null || fwdEdge == null){
              //
              logger.error("Error while creating way, skipping...");
              continue;
            }

            way.addForwardEdge( fwdEdge );
            way.addBackwardEdge( bwdEdge );

          // set complementary edges
            fwdEdge.setComplementaryEdge( bwdEdge );
            bwdEdge.setComplementaryEdge( fwdEdge );
         
        }

      } else if( oneway_forward.contains( onewayAttribute ) ) {
       
        EdgeModel edge = null;
        EdgeModel lastEdge = null;

        // generates way toward if one-way in oneway_forward or not set or no
        for( int i = 0; i < currentWay.size() - 1; i++ ) {

          edge = createEdge( currentWay.get( i ), currentWay.get( i + 1 ), way );

          // references
          if(edge == null){
            //
            logger.error("Error while creating way, skipping...");
            continue;
          }

          // references
          if(lastEdge != null){
            lastEdge.setNextEdge( edge );
            edge.setPreviousEdge( lastEdge );
          }

          // update way
          way.addForwardEdge( edge );

          // remember
          lastEdge = edge;

        }

      } else if( oneway_backward.contains( onewayAttribute ) ) {

        EdgeModel edge = null;
        EdgeModel lastEdge = null;

        // generates way back if one-way = no or not set or -1
        for( int i = currentWay.size() - 1; i > 0; i-- ) {

          edge = createEdge( currentWay.get( i ), currentWay.get( i - 1 ), way );

          if(edge == null){
            logger.error("Error while creating way, skipping...");
            continue;
          }

          // references
          //lastEdge.setNextEdge( edge );
          //edge.setPreviousEdge( lastEdge );
          if(lastEdge != null){
            lastEdge.setNextEdge( edge );
            edge.setPreviousEdge( lastEdge );
          }
         
          // update way
          way.addBackwardEdge( edge );
View Full Code Here

Examples of de.hpi.eworld.model.db.data.EdgeModel

      int speed = edgeProps.getSpeedForWay(currentAttributes);
      int priority = edgeProps.getPriorityForWay(currentAttributes);
      int noLanes = edgeProps.getLanesForWay(currentAttributes);
     
      EdgeModel edge = null;
      ArrayList<LaneModel> lanes = new ArrayList<>();
      for( int i = 0; i < noLanes; i++ ) {
        LaneModel lane = new LaneModel( 0, speed );
        lanes.add( lane );
      }

      // create edge without reference to previous or next edges

      edge = new EdgeModel( from, to, way, priority, speed );

      // check if creation has failed

      edge.setLanes( lanes );
      edge.setBridge(edgeProps.isBridge());
      edge.setTunnel(edgeProps.isTunnel());
      edge.setTrafficCalmingBump(edgeProps.isTrafficCalmingBump());
      edge.setTrafficCalmingChicane(edgeProps.isTrafficCalmingChicane());
      edge.setLivingStreet(edgeProps.isLivingStreet());

        imported = true;

        if(!alreadyImportedNodes.containsKey(fromNode)) {
          alreadyImportedNodes.put(fromNode, from);
View Full Code Here

Examples of de.hpi.eworld.model.db.data.EdgeModel

    Assert.assertEquals(1, networkView.getGraphModel().items().length);

    // adding a way
    way = new WayModel("Way");
    NodeModel to = new NodeModel(1, 1);
    way.addForwardEdge(new EdgeModel("testModelID", node, to));
    networkView.onModelElementAdded(to);
    networkView.onModelElementAdded(way);
    Assert.assertEquals(3, networkView.getGraphModel().items().length);

    // adding a point of interest
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.