Package de.tudresden.ws.container

Examples of de.tudresden.ws.container.SumoPosition2D


    }else if(sc.output_type == Constants.TYPE_DOUBLE){output = resp.content().readDouble();
    }else if(sc.output_type == Constants.TYPE_STRING){output = resp.content().readStringUTF8();
    }else if(sc.output_type == Constants.POSITION_2D){
      double x = resp.content().readDouble();
      double y = resp.content().readDouble();
      output = new SumoPosition2D(x,y);
    }else if(sc.output_type == Constants.POSITION_3D){
      double x = resp.content().readDouble();
      double y = resp.content().readDouble();
      double z = resp.content().readDouble();
      output = new SumoPosition3D(x,y,z);
    }else if(sc.output_type == Constants.TYPE_STRINGLIST){
     
      SumoStringList ssl = new SumoStringList();
      int laenge = resp.content().readInt();
      for(int i=0; i<laenge; i++){
        ssl.add(resp.content().readStringASCII());
      }
      output = ssl;
   
    }else if(sc.output_type == Constants.TYPE_BOUNDINGBOX){
     
      double min_x = resp.content().readDouble();
      double min_y = resp.content().readDouble();
      double max_x = resp.content().readDouble();
      double max_y = resp.content().readDouble();
     
      output = new SumoBoundingBox(min_x, min_y, max_x, max_y);
     
    }else if(sc.output_type == Constants.TYPE_COMPOUND){
     
      Object[] obj = null;
     
      //decision making
      if(sc.input2 == Constants.TL_CONTROLLED_LINKS){
       
        SumoLinkList sll = new SumoLinkList();
       
        //read length
        resp.content().readUnsignedByte();
        resp.content().readInt();
       
        int laenge = resp.content().readInt();
        obj = new StringList[laenge];
       
        for(int i=0; i<laenge; i++){
       
          resp.content().readUnsignedByte();
          int anzahl = resp.content().readInt();
         
          for(int i1=0; i1<anzahl; i1++){
           
            resp.content().readUnsignedByte();
            resp.content().readInt(); //length
           
            String from = resp.content().readStringASCII();
            String to = resp.content().readStringASCII();
            String over = resp.content().readStringASCII();
            sll.add(new SumoLink(from, to, over));
           
          }
         
        }
       
        output = sll;
     
      }else if(sc.input2 == Constants.TL_COMPLETE_DEFINITION_RYG){
       
        resp.content().readUnsignedByte();
        resp.content().readInt();
       
        int length = resp.content().readInt();
        for(int i=0; i<length; i++){
         
          resp.content().readUnsignedByte();
          String subID = resp.content().readStringASCII();
         
          resp.content().readUnsignedByte();
          int type = resp.content().readInt();
         
          resp.content().readUnsignedByte();
          int subParameter = resp.content().readInt();
         
          resp.content().readUnsignedByte();
          int currentPhaseIndex = resp.content().readInt();
         
          SumoTLSLogic stl = new SumoTLSLogic(subID, type, subParameter, currentPhaseIndex);
         
          resp.content().readUnsignedByte();
          int nbPhases = resp.content().readInt();
         
          for(int i1=0; i1<nbPhases; i1++){
           
            resp.content().readUnsignedByte();
            int duration = resp.content().readInt();
           
            resp.content().readUnsignedByte();
            int duration1 = resp.content().readInt();
           
            resp.content().readUnsignedByte();
            int duration2 = resp.content().readInt();
           
            resp.content().readUnsignedByte();
            String phaseDef = resp.content().readStringASCII();
           
            stl.add(new  SumoTLSPhase(duration, duration1, duration2, phaseDef));
           
          }

          output = stl;
         
        }

       
      }else if(sc.input2 == Constants.LANE_LINKS)
      {
     
        resp.content().readUnsignedByte();
        resp.content().readInt();
       
        //number of links
        int length = resp.content().readInt();
        SumoLinkList links = new SumoLinkList();
        for(int i=0; i<length; i++){
         
          resp.content().readUnsignedByte();
          String notInternalLane = resp.content().readStringASCII();
         
          resp.content().readUnsignedByte();
          String internalLane = resp.content().readStringASCII();
         
          resp.content().readUnsignedByte();
          byte hasPriority = (byte)resp.content().readUnsignedByte();
         
          resp.content().readUnsignedByte();
          byte isOpened = (byte)resp.content().readUnsignedByte();
         
          resp.content().readUnsignedByte();
          byte hasFoes = (byte)resp.content().readUnsignedByte();
         
          //not implemented
          resp.content().readUnsignedByte();
          String state = resp.content().readStringASCII();
         
          resp.content().readUnsignedByte();
          String direction = resp.content().readStringASCII();
         
          resp.content().readUnsignedByte();
          double laneLength = resp.content().readDouble();
         
         
          links.add(new SumoLink(notInternalLane,internalLane,hasPriority,isOpened,hasFoes,laneLength, state, direction));
        }
        output = links;
      }
      else{
       
        int laenge = resp.content().readInt();
        obj = new Object[laenge];
       
        for(int i=0; i<laenge; i++){
         
          int k = resp.content().readUnsignedByte();
          obj[i] = this.get_value(k, resp);
         
        }
       
        output = obj;
      }
     
     
    }
    else if(sc.output_type == Constants.TYPE_POLYGON){
     
      int laenge = resp.content().readUnsignedByte();
     
      SumoGeometry sg = new SumoGeometry();
      for(int i=0; i<laenge; i++){
        double x =  (Double) this.get_value(Constants.TYPE_DOUBLE, resp);
        double y = (Double) this.get_value(Constants.TYPE_DOUBLE, resp);
        sg.add(new SumoPosition2D(x,y));
      }
     
      output = sg;
   
    }
View Full Code Here


        cmd.content().writeDouble(pos.x);
        cmd.content().writeDouble(pos.y);
      }
    }else if(input.getClass().equals(SumoPosition2D.class)){
     
      SumoPosition2D pos = (SumoPosition2D) input;
      cmd.content().writeDouble(pos.x);
      cmd.content().writeDouble(pos.y);
     
    }else if(input.getClass().equals(SumoTLSPhase.class)){
     
View Full Code Here

  }

  public SumoPosition2D getPosition2D(Object obj) {

    SumoPosition2D output = new SumoPosition2D(0, 0);

    try {
      if (obj.getClass().equals(SumoPosition2D.class)) {
        output = (SumoPosition2D) obj;
      }
View Full Code Here

TOP

Related Classes of de.tudresden.ws.container.SumoPosition2D

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.