Package route

Examples of route.Route


   */
  public void calcGraphics(){
   
    MainGraphics gr = Game.getInstance().getMap().getGraphics();
   
    Route r = ord.getRoute();
    //ha nem keresztezodesben van az auto
    if (r!=null || ord.getCross()!=null )
    {
      // ket csompont koordinatainak lekerese
    Cross cr1 = r.getStartCross();
    Point cr1p = gr.getGraphicsFromObject(cr1).getPosition();
    Cross cr2 = r.getEndCross();
    Point cr2p = gr.getGraphicsFromObject(cr2).getPosition();
    // konkret pozicio kiszamolasa
    xp = (cr2p.x-cr1p.x)*ord.getPosition()/r.getLength()+cr1p.x;;   
    yp = (cr2p.y-cr1p.y)*ord.getPosition()/r.getLength()+cr1p.y;;
    System.out.println(xp+","+yp);
   
    Route showRoute; // melyik utat mutassuk

    Cross c;
   
    // lek�rj�k melyik a pillanatnyi kijel�lt tov�bbi �t
    if (ord.getCurrentSpeed()<0 )
    {
      //ha szembe megyunk a forgalommal a StartCross kell
      c = ord.getRoute().getStartCross();       
    }
    else {
      // ha normalisan megyunk
      c = ord.getRoute().getEndCross();
    }
 
    int dir = ord.getDesiredDirection();
    int in_db = c.getInRoutes().size();
    int out_db =c.getOutRoutes().size();
    System.out.println("dir:"+dir+" in_db:"+in_db+" out_db:"+out_db);
    //ha tul nagy a kivalasztott ut szama, lejjebb visszuk
    if (dir>=in_db+out_db)
    {
      dir=0;
      ord.setDesiredDirection(dir);
    }
   
    //ha a dir kisebb mint a bemeno utak szama, akkor a bemeno utlistabol jelolunk ki
    if (dir<in_db)
    showRoute = c.getInRoutes().get(dir);
    //kulonben mar a kimeno utlistabol kell kivalasztanunk a kijelolt utat
    else showRoute = c.getOutRoutes().get(dir-in_db);
 
   
    // megvan a kimen� utunk showRoute szem�ly�ben
    // ennek k�rj�k le a k�t koordin�t�j�t
   
    Cross r1 = showRoute.getStartCross();
    desiredRoute1 = gr.getGraphicsFromObject(r1).getPosition();
    Cross r2 = showRoute.getEndCross();
    desiredRoute2 = gr.getGraphicsFromObject(r2).getPosition();
   
   
   
    // be�llitja forgat�s szerint a k�pet, figyelni kell, hogy ford�tva megy-e
View Full Code Here


      if(speed <= 0 || speed > 90){
        return MessageBox.get().getMessage(Messages.WrongParameter) + ("(Sebesseg: 0-90)\r\n");
      }
     
      //lekerjuk a szukseges objektumokat
      Route destRoute = ObjectStore.getInstance().getRoute(routeId);
      RobberyCar rcar = ObjectStore.getInstance().getRobberyCar();
      if(destRoute == null || rcar ==null){
        return MessageBox.get().getMessage(Messages.NotFound);
      }
     
      //beallitjuk az uj poziciora a rendorautot
      Route proute = rcar.getRoute();
      if(proute != null)
        proute.removeCarFromRoute(rcar);
      destRoute.addVehicle(rcar, routePos);
      rcar.setSpeed(speed);
     
      //turn it if necessary
      if(rcar.getTurned() != direction){
View Full Code Here

   */
  public void calcGraphics(){
   
    MainGraphics gr = Game.getInstance().getMap().getGraphics();
   
    Route r = ord.getRoute();
    //ha nem keresztezodesben van az auto
    if (r!=null)
    {
      // ket csompont koordinatinak lekerdezese
    Cross cr1 = r.getStartCross();
    Point cr1p = gr.getGraphicsFromObject(cr1).getPosition();
    Cross cr2 = r.getEndCross();
    Point cr2p = gr.getGraphicsFromObject(cr2).getPosition();
    // konkret koordinata kiszamolasa
    xp = (cr2p.x-cr1p.x)*ord.getPosition()/r.getLength()+cr1p.x;   
    yp = (cr2p.y-cr1p.y)*ord.getPosition()/r.getLength()+cr1p.y;
    setRotateImage(calcRotation(cr1p,cr2p));
    System.out.println("police:"+xp+","+yp);
    }
    // ha keresztezodesben van az auto
    else{
View Full Code Here

  public void calcGraphics(){
   
    MainGraphics gr = Game.getInstance().getMap().getGraphics();
   
    //meghatarozzuk a bunny poziciojat a terkepen
    Route r = Bunny.get().getRoute();
   
    // lekerjuk a ket csomopont koordinatait
    Cross cr1 = r.getStartCross();
    Point cr1p = gr.getGraphicsFromObject(cr1).getPosition();
    Cross cr2 = r.getEndCross();
    Point cr2p = gr.getGraphicsFromObject(cr2).getPosition();
   
    //kiszamoljuk a bunny konkret megjeleniteshez hasznalt koordinatajat
    xp = (cr2p.x-cr1p.x)*Bunny.get().getPos()/r.getLength()+cr1p.x;   
    yp = (cr2p.y-cr1p.y)*Bunny.get().getPos()/r.getLength()+cr1p.y;
   
    System.out.println("bunny:"+xp+","+yp);
   
    draw.drawing((Object)this,gr.getGraphic());
  }
 
View Full Code Here

      String rId = params.get(1);
      int rPos = Integer.parseInt(params.get(2));
     
      //a parameterek alapjan lekerdezzuk az adott objektumokat
      PoliceCar pcar = ObjectStore.getInstance().getPoliceCar(pId);
      Route proute = pcar.getRoute();
      Route route = ObjectStore.getInstance().getRoute(rId);
     
      //ha valamelyiket nem talaltuk..
      if(route == null || pcar == null){
        return MessageBox.get().getMessage(Messages.NotFound);
      }
     
      //...ha viszont megtalaltuk oket
      route.addVehicle((Vehicle)pcar, rPos);
      proute.removeCarFromRoute(pcar);
     
     
      return "A rendor(id:" + pId + ") ra lett hekkelve a route(id:" + rId + ") " + rPos + ". poziciojara!\r\n";
    } catch(NumberFormatException e){
View Full Code Here

      String routeId = params.get(0);
      int position = Integer.parseInt(params.get(1));
     
      Bunny bunny = ObjectStore.getInstance().getBunny();
     
      Route route = ObjectStore.getInstance().getRoute(routeId);
      if(route == null)
        return MessageBox.get().getMessage(Messages.NotFound) + "(Route) \r\n";
     
      if(position < 0 || position > route.getLength()){
        return MessageBox.get().getMessage(Messages.Error) + "(nem megfelelo hosszusag) \r\n";
      }
     
      bunny.setBunnyPlace(route, position);
     
View Full Code Here

   
    //BANK
    bank = new Bank();
   
    //ROUTES
    Route r0 = new Route(this, bank, quitpoints.get(0), 1000);
    Route r1 = new Route(this, entrypoints.get(0), bank, 800);
    Route r2 = new Route(this, entrypoints.get(0), stopcross.get(0), 900);
    Route r3 = new Route(this, bank, lampcross.get(0), 900);
    Route r4 = new Route(this, bank, hidingplace, 800);
    Route r5 = new Route(this, stopcross.get(0), hidingplace, 900);
    Route r6 = new Route(this, hidingplace, lampcross.get(0), 900);
    Route r7 = new Route(this, lampcross.get(0), stopcross.get(0), 600);
    Route r8 = new Route(this, stopcross.get(0), bank, 1000);
    routes.add(r0);
    routes.add(r1);
    routes.add(r2);
    routes.add(r3);
    routes.add(r4);
View Full Code Here

   
    //BANK
    bank = new Bank();
   
    //ROUTES
    Route r0 = new Route(this, entrypoints.get(0),hidingplace, 1000);
    Route r1 = new Route(this, stopcross.get(0), hidingplace, 800);
    Route r2 = new Route(this, entrypoints.get(0), stopcross.get(0), 900);
    Route r3 = new Route(this, hidingplace, lampcross.get(0), 900);
    Route r4 = new Route(this, stopcross.get(0),lampcross.get(0), 800)
    Route r5 = new Route(this, entrypoints.get(0), lampcross.get(0), 600);
    Route r6 = new Route(this, lampcross.get(0), bank, 1000);
    Route r7 = new Route(this, bank,quitpoints.get(0), 1000);
    Route r8 = new Route(this, entrypoints.get(0),bank, 1000);
   
    routes.add(r0);
    routes.add(r1);
    routes.add(r2);
    routes.add(r3);
View Full Code Here

   *
   * az entrypointban l�v� aut�t kil�pteti
   */
  @Override
  public void vehicleOut() {
    Route selectedOutRoute = vehicleInCross.selectRoute(outroutes);
    selectedOutRoute.addVehicle(vehicleInCross);
  }
View Full Code Here

    List<Route> routes = map.getRoutes();
    double routesSize = routes.size();
   
    //select a random route
    int selectedRoute = (int)(routesSize * rand);
    Route route = routes.get(selectedRoute);
   
    //select a random position
    double length = route.getLength();
    int randomPos = (int)(length * generator.nextDouble());
   
    //beallitjuk az uj ertekeket
    this.route = route;
    this.position = randomPos;
   
    route.setBunny(this);
  }
View Full Code Here

TOP

Related Classes of route.Route

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.