public class MapController extends Controller implements IMapController
| Modifier and Type | Field and Description |
|---|---|
private DropObject |
dropObject |
private ModelObserver |
observer |
private java.util.List<MapObserver> |
observers |
private IMapState |
state |
| Constructor and Description |
|---|
MapController(IMapView view)
Creates a MapController object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
AddMapObserver(MapObserver listener) |
void |
CancelMove() |
boolean |
CanPlaceCity(Coordinate point,
CatanColor color)
This method is called whenever the user is trying to place a city on the
map.
|
boolean |
CanPlaceRoad(Coordinate p1,
Coordinate p2,
CatanColor color)
This method is called whenever the user is trying to place a road on the
map.
|
boolean |
CanPlaceRobber(Coordinate point)
This method is called whenever the user is trying to place the robber on
the map.
|
boolean |
CanPlaceSettlement(Coordinate point,
CatanColor color)
This method is called whenever the user is trying to place a settlement
on the map.
|
private void |
EndDrag() |
DropObject |
GetDropObject() |
java.util.Iterator<Edge> |
GetEdges()
Gets all the edges in the map.
|
java.util.Iterator<Hex> |
GetHexes()
Gets all the hexes in the map.
|
IMapModel |
GetModel() |
java.util.Iterator<java.util.Map.Entry<java.lang.Integer,java.util.List<Hex>>> |
GetPips()
Gets all the pips in the map.
|
java.util.Iterator<java.util.Map.Entry<Edge,Hex>> |
GetPorts()
Gets all the ports on the map.
|
Hex |
GetRobberPlacement()
Gets the location of the robber.
|
java.util.Iterator<Vertex> |
GetVertices()
Gets all the vertices in the map.
|
IMapView |
getView()
View getter
|
boolean |
IsRobberInitialized() |
void |
MouseClick() |
void |
MouseMove(java.awt.geom.Point2D worldPoint) |
void |
PlaceCity(Coordinate point) |
void |
PlaceRoad(Coordinate p1,
Coordinate p2) |
void |
PlaceRobber(Coordinate point) |
void |
PlaceSettlement(Coordinate point) |
private void |
StartDrag(boolean allowCancel) |
private void |
StartMove(PieceType pieceType) |
private java.util.List<MapObserver> observers
private DropObject dropObject
private IMapState state
private ModelObserver observer
public MapController(IMapView view)
view - The MapView object.robView - The RobberView object.public IMapView getView()
IControllergetView in interface IControllergetView in class Controllerpublic boolean CanPlaceRoad(Coordinate p1, Coordinate p2, CatanColor color)
IMapControllerCanPlaceRoad in interface IMapControllerp1 - The beginning of the road piecep2 - The end of the road piece (it's the end of the road, get it? Never mind...)color - The color of the road being placedpublic boolean CanPlaceSettlement(Coordinate point, CatanColor color)
IMapControllerCanPlaceSettlement in interface IMapControllerpoint - the location of the vertexcolor - the color of the piece being placedpublic boolean CanPlaceCity(Coordinate point, CatanColor color)
IMapControllerCanPlaceCity in interface IMapControllerpoint - the location of the vertexcolor - the color of the piece being placedpublic boolean CanPlaceRobber(Coordinate point)
IMapControllerCanPlaceRobber in interface IMapControllerpoint - the coordinate of the hexpublic java.util.Iterator<Hex> GetHexes()
IMapControllerGetHexes in interface IMapControllerpublic java.util.Iterator<Edge> GetEdges()
IMapControllerGetEdges in interface IMapControllerpublic java.util.Iterator<Vertex> GetVertices()
IMapControllerGetVertices in interface IMapControllerpublic java.util.Iterator<java.util.Map.Entry<Edge,Hex>> GetPorts()
IMapControllerGetPorts in interface IMapControllerpublic java.util.Iterator<java.util.Map.Entry<java.lang.Integer,java.util.List<Hex>>> GetPips()
IMapControllerGetPips in interface IMapControllerpublic Hex GetRobberPlacement() throws MapException
IMapControllerGetRobberPlacement in interface IMapControllerMapExceptionpublic boolean IsRobberInitialized()
IsRobberInitialized in interface IMapControllerpublic DropObject GetDropObject()
GetDropObject in interface IMapControllerpublic void PlaceRoad(Coordinate p1, Coordinate p2)
PlaceRoad in interface IMapControllerpublic void PlaceSettlement(Coordinate point)
PlaceSettlement in interface IMapControllerpublic void PlaceCity(Coordinate point)
PlaceCity in interface IMapControllerpublic void PlaceRobber(Coordinate point)
PlaceRobber in interface IMapControllerpublic void MouseMove(java.awt.geom.Point2D worldPoint)
MouseMove in interface IMapControllerpublic void MouseClick()
MouseClick in interface IMapControllerpublic IMapModel GetModel()
GetModel in interface IMapControllerpublic void AddMapObserver(MapObserver listener)
AddMapObserver in interface IMapControllerpublic void CancelMove()
CancelMove in interface IMapControllerprivate void StartDrag(boolean allowCancel)
private void EndDrag()
private void StartMove(PieceType pieceType)