Examples of Trajectory


Examples of ch.epfl.lbd.trajectories.Trajectory

        "  ORDER BY datetime  " +
        "  LIMIT 200";
   
    ResultSet results = conn.getSQLQueryResults(query);
   
    Trajectory trj = new Trajectory();
    GPSPoint lastPt = null;
    GPSPoint pt = null;
    while (results.next()){
       Episode newEpisode;
       String tag     = results.getString("tag");
       double lat     = results.getDouble("latitude");
       double lng     = results.getDouble("longitude");
       double northing   = results.getDouble("northing")
       double easting   = results.getDouble("easting");
       int userid     = results.getInt("userid");
       Timestamp datetime = results.getTimestamp("datetime");
       String name = "";
       String desc = "";
       if(pt != null)lastPt = pt;
       pt = new GPSPoint(lat,lng,northing,easting,userid,datetime,name,desc);
       pt.comparePrePoint(lastPt);
       Episode lastEpisode = trj.getLastEpisode();
       if(tag.equalsIgnoreCase("B") || tag.equalsIgnoreCase("S")){
         if(lastEpisode != null && lastEpisode instanceof Move){
           lastEpisode.merge(new Move(pt));
         }
         newEpisode = new Stop(pt);
       }
       else{
         if(lastEpisode != null && lastEpisode instanceof Stop){
           newEpisode = new Move(lastPt);
           newEpisode.merge(new Move(pt));
         }
         else newEpisode = new Move(pt);
       }
       trj.addEpisode(newEpisode);
    }
 
    logger.info("MOVES");
    ArrayList<Move> moves = trj.getMoves();
    for(Move move : moves)logger.info(move.getAvgSpeed());
    logger.info("STOPS");
    ArrayList<Stop> stops = trj.getStops();
    for(Stop stop : stops)logger.info(stop.getAvgSpeed());

    conn.closeConnection();
  }
View Full Code Here

Examples of ch.epfl.lbd.trajectories.Trajectory

    //retrieving all trajectory combinations that has at least 3 moves
    Combiner trjCombinations = new Combiner();
    ArrayList<ArrayList<Integer>> movesId = trjCombinations.generate(trj.getNumberOfMoves(), 3);
   
    for(int j = 0 ; j < movesId.size() ; j++ ){
      Trajectory subTrajectory = trj.getSubTrajectory(movesId.get(j));
      for(int i = 0 ; i < this.outputs.size() ; i++){
        if(similar(subTrajectory,this.outputs.get(i))){
          this.outputs.get(i).addTrajectory();
          shared = true;
        }
View Full Code Here

Examples of ch.epfl.lbd.trajectories.Trajectory

      int trj_id = 1;
      int eps = 1;
      GPSPoint lastPt = null;
      GPSPoint pt = null;
     
      Trajectory trj = new Trajectory();
      while(results.next()){
         Episode newEpisode;
         String tag     = results.getString("tag");
         double lat     = results.getDouble("longitude"); //inverted on purpose
         double lng     = results.getDouble("latitude");
         double northing   = results.getDouble("northing")
         double easting   = results.getDouble("easting");
         int userid     = results.getInt("userid");
         Timestamp datetime = results.getTimestamp("datetime");
         String name = "";
         String desc = "";
        if(tag.equalsIgnoreCase("B")){
          if(trj.getLastEpisode() != null){
            Object[] values = null;
            values = new Object[9];
            values[0] = (Integer)trj_id;        //ID
            values[1] = trj.getLifeSpan().getStart()//START
            values[2] = trj.getLifeSpan().getEnd();    //END
            values[3] = trj.getMovingObject().getId()//MOVING_ENTITY
            values[4] = "";                //TYPE
            values[5] = trj.getAvgSpeed();        //AVG_SPEED
            values[6] = trj.getAvgTravelTime();      //AVG_TRAVEL_TIME
            values[7] = 0;                //GROUP_ID
            values[8] = trj.getGeometry();//GEOM

            if(values[8] != null){
              //populate values from trj obj;
              trj_table.insertRow(values);
             
              //populate the list of episodes
              ArrayList<Episode> episodes = trj.getEpisodes();
              for(int j = 0 ; j < episodes.size() ; j++ ){
                Episode episode = episodes.get(j);
                Object[] vals = new Object[9];
                String type = "";
                if(episode instanceof Move ) type = "MOVE";
                else type = "STOP";
                vals[0] = (Integer)eps;            //ID
                vals[1] = episode.getLifeSpan().getStart()//START
                vals[2] = episode.getLifeSpan().getEnd()//END
                vals[3] = trj.getMovingObject().getId()//MOVING_ENTITY
                vals[4] = type;                //TYPE
                vals[5] = episode.getAvgSpeed();      //AVG_SPEED
                vals[6] = episode.getVarSpeed();      //AVG_TRAVEL_TIME
                vals[7] = (Integer)trj_id;          //GROUP_ID
                vals[8] = episode.getGeometry();      //GEOM
                epi_table.insertRow(vals);
                eps++;
              }
             
              logger.info(trj_id+" trajectories inserted");
              trj_id++;
            }
          }
          trj = new Trajectory();
          trj.setMovingObject(new MovingObject(userid));
        }
         if(pt != null)lastPt = pt;
         pt = new GPSPoint(lat,lng,northing,easting,userid,datetime,name,desc);
         pt.comparePrePoint(lastPt);
         Episode lastEpisode = trj.getLastEpisode();
         if(tag.equalsIgnoreCase("B") || tag.equalsIgnoreCase("S")){
           if(lastEpisode != null && lastEpisode instanceof Move){
             lastEpisode.merge(new Move(pt));
           }
           newEpisode = new Stop(pt);
         }
         else{
           if(lastEpisode != null && lastEpisode instanceof Stop){
             newEpisode = new Move(lastPt);
             newEpisode.merge(new Move(pt));
           }
           else newEpisode = new Move(pt);
         }
         trj.addEpisode(newEpisode);
         i++;
      }
    }
    catch(SQLException e){
      e.printStackTrace();
View Full Code Here

Examples of fr.soleil.lib.flyscan.model.parsing.configuration.trajectory.Trajectory

            if (s instanceof ActorSection) {
                actorSection = (ActorSection) s;
            }
        }

        Trajectory trajectory = null;
        String trajectoryStr = null;
        for (Actor a : actorSection.getActors()) {
            if (a.getName().trim().equalsIgnoreCase("motor_1") && (a instanceof Actuator)) {
                trajectoryStr = ((Actuator<?>) a).getTrajectory();
            }
        }

        assertNotNull(trajectoryStr);

        trajectory = TrajectoryParser.getInstance().parse(trajectoryStr, TrajectoryType.STEP_BY_STEP);

        assertNotNull(trajectory);

        assertEquals("[{40.0,50.0,5}]", trajectory.getStringTrajectory());

        IntervalStepByStepTrajectory isbsTrajectory = ((IntervalStepByStepTrajectory) trajectory);

        assertEquals(1, isbsTrajectory.getIntervals().size());
View Full Code Here

Examples of fr.soleil.lib.flyscan.model.parsing.configuration.trajectory.Trajectory

            if (s instanceof ActorSection) {
                actorSection = (ActorSection) s;
            }
        }

        Trajectory trajectory = null;
        String trajectoryStr = null;
        for (Actor a : actorSection.getActors()) {
            if (a.getName().trim().equalsIgnoreCase("rz") && (a instanceof ContinuousActuator)) {
                trajectoryStr = ((Actuator<?>) a).getTrajectory();
            }
        }

        assertNotNull(trajectoryStr);

        trajectory = TrajectoryParser.getInstance().parse(trajectoryStr, TrajectoryType.CONTINUOUS);

        assertNotNull(trajectory);

        assertEquals("[{50.0,100.0,5}]", trajectory.getStringTrajectory());

        ContinuousTrajectory cTrajectory = ((ContinuousTrajectory) trajectory);

        assertEquals(1, cTrajectory.getIntervals().size());
View Full Code Here

Examples of fr.soleil.lib.flyscan.model.parsing.configuration.trajectory.Trajectory

            if (s instanceof ActorSection) {
                actorSection = (ActorSection) s;
            }
        }

        Trajectory trajectory = null;
        String trajectoryStr = null;
        for (Actor a : actorSection.getActors()) {
            if (a.getName().trim().equalsIgnoreCase("actuator_x") && (a instanceof Actuator)) {
                trajectoryStr = ((Actuator<?>) a).getTrajectory();
            }
        }

        assertNotNull(trajectoryStr);

        trajectory = TrajectoryParser.getInstance().parse(trajectoryStr, TrajectoryType.STEP_BY_STEP);

        assertNotNull(trajectory);

        assertEquals("[10.0,20.0,30.0,40.0,50.0,60.0,70.0,80.0,90.0,100.0]", trajectory.getStringTrajectory());

        TabStepByStepTrajectory tTrajectory = ((TabStepByStepTrajectory) trajectory);

        assertEquals(10, tTrajectory.getPoints().size());
View Full Code Here

Examples of fr.soleil.lib.flyscan.model.parsing.configuration.trajectory.Trajectory

                    break;
                case TRAJECTORY:
                    if (entry instanceof TrajectoryEntry) {
                        String location = getErrorLocation(entry, entryContainer);
                        Trajectory trajectory = ((TrajectoryEntry) entry).getTrajectory();
                        if (trajectory instanceof ContinuousTrajectory) {
                            editorComponent = new ContinuousTrajectoryComponent(panelError, errorsMap,
                                    (ContinuousTrajectory) trajectory, location, this, labelName, tabTitle);
                        } else if (trajectory instanceof IntervalStepByStepTrajectory) {
                            editorComponent = new IntervalStepByStepTrajectoryComponent(panelError, errorsMap,
                                    (IntervalStepByStepTrajectory) trajectory, location, this, labelName, tabTitle);
                        } else if (trajectory instanceof TabStepByStepTrajectory) {
                            editorComponent = new TabStepByStepTrajectoryComponent(panelError, errorsMap,
                                    (TabStepByStepTrajectory) trajectory, location, this, labelName, tabTitle);
                        }
                        final ATrajectoryComponent<?> aTrajectoryComponent = (ATrajectoryComponent<?>) editorComponent;
                        aTrajectoryComponent.addBeingEditedListener(new ConfigurationEditionStateListener() {

                            @Override
                            public void setConfigurationBeingEdited(boolean isBeingEdited) {
                                Trajectory traj = aTrajectoryComponent.getTrajectory();
                                fireEditionStateChanged(isBeingEdited, entry, entryContainer,
                                        traj.getStringTrajectory(), aTrajectoryComponent, labelName, tabTitle);
                            }
                        });
                    }
                    break;
                default:
View Full Code Here

Examples of fr.soleil.lib.flyscan.model.parsing.configuration.trajectory.Trajectory

                                        }
//                                    else {
//                                        type = TrajectoryType.CUSTOM;
//                                    }
                                        try {
                                            Trajectory trajectory = TrajectoryParser.getInstance().parse(value, type);
                                            ((TrajectoryEntry) entry).setTrajectory(trajectory);
                                        } catch (FSParsingException e) {
                                            // Bufferize FSParsingException in case of custom trajectory and
                                            // 'custom_trajectory' keyword has not been read yet
                                            trajectoryparsingExceptionBuffer.put((Actuator<?>) currentObject, e);
View Full Code Here

Examples of fr.soleil.model.scanserver.Trajectory

            trajectoryController.notifyCustomTrajectoryValueChanged(doubleValues, iPosition, jPosition);
        }
    }

    public static void main(String[] args) {
        Trajectory trajectory = new Trajectory();
        trajectory.setCompleteTrajectory(new double[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 10 });

        TrajectoryView view = new TrajectoryView();
        JFrame frame = new JFrame();
        frame.setContentPane(view);
        view.setSize(300, 400);
        frame.setSize(view.getSize());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setTitle("TrajectoryView test");
        view.setBeginPosition(String.valueOf(trajectory.getFrom()));
        view.setEndPosition(String.valueOf(trajectory.getTo()));
        view.setCustomTrajectoryValues(trajectory.getCompleteTrajectory());
        frame.setVisible(true);
    }
View Full Code Here

Examples of fr.soleil.model.scanserver.Trajectory

            trajectoryController.notifyCustomTrajectoryValueChanged(doubleValues, iPosition, jPosition);
        }
    }

    public static void main(String[] args) {
        Trajectory trajectory = new Trajectory();
        trajectory.setCompleteTrajectory(new double[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 10 });

        TrajectoryView view = new TrajectoryView();
        JFrame frame = new JFrame();
        frame.setContentPane(view);
        view.setSize(300, 400);
        frame.setSize(view.getSize());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setTitle("TrajectoryView test");
        view.setBeginPosition(String.valueOf(trajectory.getFrom()));
        view.setEndPosition(String.valueOf(trajectory.getTo()));
        view.setCustomTrajectoryValues(trajectory.getCompleteTrajectory());
        frame.setVisible(true);
    }
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.