use of games.strategy.triplea.ui.screen.drawable.BattleDrawable in project triplea by triplea-game.
the class TileManager method drawTerritory.
private void drawTerritory(final Territory territory, final GameData data, final MapData mapData) {
final Set<Tile> drawnOn = new HashSet<>();
final Set<IDrawable> drawing = new HashSet<>();
if (territoryOverlays.get(territory.getName()) != null) {
drawing.add(territoryOverlays.get(territory.getName()));
}
if (uiContext.getShowTerritoryEffects()) {
drawTerritoryEffects(territory, mapData, drawing);
}
if (uiContext.getShowUnits()) {
drawUnits(territory, mapData, drawnOn, drawing, data);
}
drawing.add(new BattleDrawable(territory.getName()));
final TerritoryAttachment ta = TerritoryAttachment.get(territory);
if (!territory.isWater()) {
drawing.add(new LandTerritoryDrawable(territory.getName()));
} else {
if (ta != null) {
// Kamikaze Zones
if (ta.getKamikazeZone()) {
drawing.add(new KamikazeZoneDrawable(territory, uiContext));
}
// Blockades
if (ta.getBlockadeZone()) {
drawing.add(new BlockadeZoneDrawable(territory));
}
// Convoy Routes
if (ta.getConvoyRoute()) {
drawing.add(new ConvoyZoneDrawable(territory.getOwner(), territory, uiContext));
}
// Convoy Centers
if (ta.getProduction() > 0) {
drawing.add(new ConvoyZoneDrawable(territory.getOwner(), territory, uiContext));
}
}
drawing.add(new SeaZoneOutlineDrawable(territory.getName()));
}
final OptionalExtraBorderLevel optionalBorderLevel = uiContext.getDrawTerritoryBordersAgain();
if (optionalBorderLevel != OptionalExtraBorderLevel.LOW) {
drawing.add(new OptionalExtraTerritoryBordersDrawable(territory.getName(), optionalBorderLevel));
}
drawing.add(new TerritoryNameDrawable(territory.getName(), uiContext));
if (ta != null && ta.isCapital() && mapData.drawCapitolMarkers()) {
final PlayerID capitalOf = data.getPlayerList().getPlayerId(ta.getCapital());
drawing.add(new CapitolMarkerDrawable(capitalOf, territory, uiContext));
}
if (ta != null && (ta.getVictoryCity() != 0)) {
drawing.add(new VcDrawable(territory));
}
// add to the relevant tiles
for (Tile tile : getTiles(mapData.getBoundingRect(territory.getName()))) {
drawnOn.add(tile);
tile.addDrawables(drawing);
}
territoryDrawables.put(territory.getName(), drawing);
territoryTiles.put(territory.getName(), drawnOn);
}
Aggregations