Package civquest.util

Examples of civquest.util.Coordinate


     
  private void mapPath(Vector fpath){
      int envFact = 2;
      if (!fpath.isEmpty()) 
    for (int i = 0; i<fpath.size(); i++){
        Coordinate c = (Coordinate)fpath.get(i);
        if (map.getField(c).getTemperature()>temperature)
      temperature += envFact;
        else
      if (map.getField(c).getTemperature()<temperature)
          temperature -= envFact;
View Full Code Here


     */
    public void actionPerformed(FunctionActionEvent e) {
        if (this.scenarioEditor.getSelectedTab() == UNIT_TAB) {
            //only proceed if the unitTab is selected
            Nation nation = this.scenarioEditor.getSelectedNation();
            Coordinate coordinate = this.map.getWorkingFieldPos();
            if (coordinate != null) {
                ConstructCity newCityChange = new ConstructCity(
                        coordinate, nation);
                newCityChange.execute();
            }
View Full Code Here

        //        map.getField(c).setLayer(Field.LAYER_ROAD,"blue");
    }
  }

  private Coordinate getRandomSeaCoordinate(){
      Coordinate t = map.getRandomCoordinate();
      while (map.getField(t).isLand())
      t = map.getRandomCoordinate();
      return t;
  }
View Full Code Here

  public RemoveUnit(Long unitID) {
    super(unitID);

    MapData mapData = Game.getMapData();
    Coordinate coord = mapData.getMapObjectPosition(unitID);
    addFieldID(mapData.getFieldID(coord));
    this.nationID = mapData.getMapObjectOwner(unitID);
    addNationID(this.nationID);
    this.unitID = unitID;
  }
View Full Code Here

  }

  public RemoveUnit(RestrictedToNation resToNation, long unitID) {
    super(resToNation, unitID);
    MapData mapData = Game.getMapData();
    Coordinate coord = mapData.getMapObjectPosition(unitID);
    addFieldID(mapData.getFieldID(coord));
    this.nationID = mapData.getMapObjectOwner(unitID);
    addNationID(nationID);
    this.unitID = unitID;
  }
View Full Code Here

public class CircleWFPainter implements WFPainter {

  public void paintWorkingFieldMark(Graphics graphics, Painter painter,
                    Properties properties, Coordinate pos) {
        graphics.setColor(Color.WHITE);
    Coordinate center = properties.getAbsMiddlePaintCoord(pos);
    Coordinate size = properties.getEllipseSize();
    painter.drawEllipse(graphics, center, size, false);
  }
View Full Code Here

    if (pos != null) {
      Long[] fieldIDs = fieldChange.getFields();
      FieldReader fieldReader = gameData.getFieldReader();

      for (Long fieldID : fieldIDs) {
        Coordinate changePos = fieldReader.getFieldPosition(fieldID);
        if (pos.equals(changePos)) {
          repaint();
          break;
        }
      }
View Full Code Here

  public void afterGameChanged(SetWorkingField setWF) {
    // After the change, mainMapView should have the updated position
    // (and by not asking the change, we don't need to check if there is
    // perhaps a second MapView setting its working-field...)

    Coordinate workingFieldPos = mainMapView.getWorkingFieldPos();

    FieldReader fieldReader = gameData.getFieldReader();
    if (workingFieldPos != null && fieldReader.areUnitsAvailable(workingFieldPos)) {
      Iterator<Long> unitIDs = fieldReader.getUnits(workingFieldPos);
      if (unitIDs.hasNext()) {
View Full Code Here

  public void afterGameChanged(SetWorkingField setWF) {
    // After the change, mainMapView should have the updated position
    // (and by not asking the change, we don't need to check if there is
    // perhaps a second MapView setting its working-field...)

    Coordinate workingFieldPos = mainMapView.getWorkingFieldPos();
    detFIComp.setPos(workingFieldPos);
   
     repaint();
  }
View Full Code Here

      return;
    } else {



      Coordinate lineStart = p1.sub(coordOrigin);
      Coordinate lineEnd = p2.sub(coordOrigin);

      double lineLength = lineStart.getDistanceTo(lineEnd);
      Coordinate lineVector = lineEnd.sub(lineStart);
      double segmentLength = lineLength / (2 * Math.ceil(lineLength / (2 * dashLength)));
      double startFactor = 0;
      double dFactor = segmentLength / lineLength;
      boolean on = true;

      while (startFactor < 1) {
        double endFactor = startFactor + dFactor;
        if (endFactor > 1) {
          endFactor = 1;
        }
       
        if (on) {
          Coordinate start = lineStart.add(lineVector.mult(startFactor));
          Coordinate end = lineStart.add(lineVector.mult(endFactor));
          g.drawLine(start.x, start.y, end.x, end.y);
        }

        startFactor = endFactor;
        on = !on;
View Full Code Here

TOP

Related Classes of civquest.util.Coordinate

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.