Package graphics

Source Code of graphics.GraphicsRoute

package graphics;
import java.awt.*;

import cross.Cross;

import _main.Game;
import route.Route;

public class GraphicsRoute extends AbstractGraphicsObject {

  int xstart;
  int ystart;
  int xend;
  int yend;
 
 
  Image image;
  int rotation;
  Draw draw;
  Route r;
 
  public GraphicsRoute(){
       
  }
  /**
   * Beallitjuk az adott Draw-t
   * @param d Draw
   */
  public void setDraw(Draw d){
    draw = d;
  }
  /**
   * Bealltjuk az utat
   * @param ro adott ut
   */
  public void setRoute(Route ro){
    r = ro;
  }
  /**
   * Visszadja az ut kezdo koorindatait
   * @return Point, ut kezdo koordinataja
   */
  public Point getStartPosition(){
    return new Point(xstart,ystart);
  }
  /**
   * Visszaadja az ut veg koordinatait
   * @return Point, az ut vegkoordinataja
   */
  public Point getEndPosition(){
    return new Point(xend,yend);
  }
  /**
   * A megjeleniteshez hasznalt valtozok ertekeinek kiszamolasa
   */
  public void calcGraphics(){
    MainGraphics gr = Game.getInstance().getMap().getGraphics();
   
    // 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();
   
    // beallitjuk az eretkeket
    xstart = cr1p.x;
    ystart = cr1p.y;
   
    xend = cr2p.x;
    yend = cr2p.y;
 
    draw.drawing((Object)this,gr.getGraphic());
  }
 
}

TOP

Related Classes of graphics.GraphicsRoute

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.