View Javadoc

1   package cz.cuni.amis.pogamut.defcon.communication.worldview.modules.grid.flags;
2   
3   import cz.cuni.amis.pogamut.defcon.base3d.worldview.object.DefConLocation;
4   import cz.cuni.amis.pogamut.base3d.worldview.object.Location;
5   
6   /**
7    * Interface for the map sources. Provides access to map features and tracing
8    * methods.
9    * 
10   * @author Radek 'Black_Hand' Pibil
11   * 
12   */
13  public interface IFlagChecker {
14  	
15  	/**
16  	 * Returns true if the flag is present on the given location. Uses cached
17  	 * values.
18  	 * 
19  	 * @param location
20  	 * @param flag
21  	 * @return
22  	 */
23  	public boolean hasFlag(Location location, BasicFlag flag);
24  
25  	/**
26  	 * Returns true if the flag is present on the given location. Uses cached
27  	 * values.
28  	 * 
29  	 * @param x
30  	 * @param y
31  	 * @param flag
32  	 * @return
33  	 */
34  	public boolean hasFlag(double x, double y, BasicFlag flag);
35  
36  	/**
37  	 * Returns true if the given location is a valid territory for the given
38  	 * teamId.
39  	 * 
40  	 * @param location
41  	 * @param enemyId
42  	 * @return
43  	 */
44  	public boolean hasEnemyTerritoryFlag(Location location, int enemyId);
45  
46  	/**
47  	 * Returns true if the given location is a valid territory for the given
48  	 * teamId.
49  	 * 
50  	 * @param x
51  	 * @param y
52  	 * @param enemyId
53  	 * @return
54  	 */
55  	public boolean hasEnemyTerritoryFlag(double x, double y, int enemyId);
56  
57  	/**
58  	 * Returns true if the given location is a valid territory for the given
59  	 * teamId.
60  	 * 
61  	 * @param location
62  	 * @param enemyId
63  	 * @param seaArea
64  	 *            if true then checks, whether [x, y] is a sea territory
65  	 * @return
66  	 */
67  	public boolean hasEnemyTerritoryFlag(Location location, int enemyId,
68  			boolean seaArea);
69  
70  	public boolean hasEnemyTerritoryFlag(double x, double y, int enemyId,
71  			boolean seaArea);
72  
73  	/**
74  	 * Returns the closest position to end from start, which has the proper
75  	 * flag.
76  	 * 
77  	 * @param start
78  	 * @param end
79  	 * @param flag
80  	 * @return
81  	 */
82  	public DefConLocation traceFromTo(DefConLocation start, DefConLocation end,
83  			BasicFlag flag);
84  
85  	/**
86  	 * Returns the a position on line to end from start, which has the proper
87  	 * flag and is as far as possible, while closer than distance from the
88  	 * closest position.
89  	 * 
90  	 * @param start
91  	 * @param end
92  	 * @param flag
93  	 * @param distance
94  	 * @return
95  	 */
96  	public DefConLocation traceFromTo(DefConLocation start, DefConLocation end,
97  			BasicFlag flag,
98  			double distance);
99  }