MapDisplayPG Class Reference

#include <mapdisplay.h>

Inheritance diagram for MapDisplayPG:

Inheritance graph
[legend]
List of all members.

Public Member Functions

void changeZoom (int delta)
void setNewZoom (int zoom)
int getZoom () const
MapCoordinate screenPos2mapPos (const SPoint &pos)
MapCoordinate widgetPos2mapPos (const SPoint &pos)
SPoint mapGlobalPos2internalPos (const MapCoordinate &pos)
SPoint mapViewPos2internalPos (const MapCoordinate &pos)
SPoint internal2widget (const SPoint &pos)
SPoint widget2screen (const SPoint &pos)
MapCoordinate upperLeftCorner ()
MapCoordinate lowerRightCorner ()
bool fieldCompletelyInViewX (const MapCoordinate &pos)
bool fieldCompletelyInViewY (const MapCoordinate &pos)
bool fieldCompletelyInView (const MapCoordinate &pos)
void keyboadCursorMovement (bool enable)
void scrollMap (int dir)
 MapDisplayPG (MainScreenWidget *parent, const PG_Rect r)
void displayUnitMovement (GameMap *actmap, Vehicle *veh, const MapCoordinate3D &from, const MapCoordinate3D &to, int duration)
bool fieldInView (const MapCoordinate &mc)
bool centerOnField (const MapCoordinate &mc)
void registerAdditionalUnit (Vehicle *veh)
void updateMap (bool force=false)
 repaints to the internal surface, but does not blit this surface the screen
void updateWidget ()
 update the internal surface and blits it to the screen
void addMapLayer (MapLayer *layer, const ASCString &name)
void activateMapLayer (const ASCString &name, bool active)
void toggleMapLayer (const ASCString &name)
bool layerActive (const ASCString &name)
void getActiveLayers (vector< ASCString > &list)
int setSignalPriority (int priority)
 ~MapDisplayPG ()

Public Attributes

SigC::Signal1< void, int > newZoom
SigC::Signal2< void, bool,
const ASCString & > 
layerChanged
SigC::Signal5< bool, const
MapCoordinate &, const SPoint &,
bool, int, int > 
mouseButtonOnField
 Signal that is fired when the mouse is pressed on a valid field, after the cursor evaluation has been run.
SigC::Signal4< bool, const
MapCoordinate &, const SPoint &,
bool, int > 
mouseDraggedToField
 Signal that is fired when the mouse is dragged onto a new field with mouse buttons pressed.
MapDisplayPG::Cursor cursor

Protected Member Functions

void eventBlit (SDL_Surface *srf, const PG_Rect &src, const PG_Rect &dst)
bool eventMouseButtonDown (const SDL_MouseButtonEvent *button)
bool eventMouseMotion (const SDL_MouseMotionEvent *button)
bool eventMouseButtonUp (const SDL_MouseButtonEvent *button)
void checkViewPosition (MapCoordinate &pos)
void fillSurface (int playerView)
void paintBackground ()
void blitInternalSurface (SDL_Surface *dest, const SPoint &pnt, const PG_Rect &dstClip)
void displayAddons (Surface &surf, int pass)
void initMovementStructure ()
Surface createMovementBufferSurface ()
void displayMovementStep (Movement &movement, int percentage)
bool eventKeyDown (const SDL_KeyboardEvent *key)
bool keyboardHandler (const SDL_KeyboardEvent *keyEvent)

Protected Attributes

MapDisplayPG::MovementMask movementMask [sidenum]
bool disableKeyboardCursorMovement

Static Protected Attributes

static const int effectiveMovementSurfaceWidth = 4 * fielddisthalfx + fieldsizex
static const int effectiveMovementSurfaceHeight = 4*fieldsizey

Friends

class CursorHiding
class LockDisplay

Classes

struct  Cursor
class  CursorHiding
struct  Field
struct  Icons
class  LockDisplay
struct  Movement
struct  MovementMask

Detailed Description

Definition at line 127 of file mapdisplay.h.


Constructor & Destructor Documentation

MapDisplayPG::MapDisplayPG ( MainScreenWidget parent,
const PG_Rect  r 
)

Definition at line 598 of file mapdisplay.cpp.

References MapRenderer::additionalItemDisplayHook, addMapLayer(), Surface::assignDefaultPalette(), dataLoaderTicker, displayAddons(), MapRenderer::getFieldPosX(), MapRenderer::getFieldPosY(), CGameOptions::Instance(), keyboardHandler(), MainScreenWidget::lockOptionsChanged, repaintMap, setNewZoom(), GameMap::sigMapDeletion, theGlobalMapDisplay, updateWidget(), and Surface::Wrap().

MapDisplayPG::~MapDisplayPG (  ) 

Definition at line 671 of file mapdisplay.cpp.


Member Function Documentation

void MapDisplayPG::eventBlit ( SDL_Surface *  srf,
const PG_Rect &  src,
const PG_Rect &  dst 
) [protected]

Definition at line 868 of file mapdisplay.cpp.

References blitInternalSurface(), cursor, MapDisplayPG::Cursor::invisible, and updateMap().

bool MapDisplayPG::eventMouseButtonDown ( const SDL_MouseButtonEvent *  button  )  [protected]

Definition at line 992 of file mapdisplay.cpp.

References actmap, CGameOptions::Mouse::centerbutton, centerOnField(), changeZoom(), checkViewPosition(), cursor, CGameOptions::Mouse::fieldmarkbutton, filterQueuedZoomEvents(), CGameOptions::Instance(), MapDisplayPG::Cursor::invisible, CGameOptions::mouse, mouseButtonOnField, MapDisplayPG::Cursor::pos(), repaintMap, screenPos2mapPos(), updateFieldInfo, MapCoordinate::valid(), viewChanged, MapCoordinate::x, GameMap::xsize, MapCoordinate::y, GameMap::ysize, CGameOptions::Mouse::zoominbutton, and CGameOptions::Mouse::zoomoutbutton.

bool MapDisplayPG::eventMouseMotion ( const SDL_MouseMotionEvent *  button  )  [protected]

Definition at line 1054 of file mapdisplay.cpp.

References actmap, cursor, cursorMoved, CGameOptions::Instance(), MapDisplayPG::Cursor::invisible, mouseDraggedToField, MapDisplayPG::Cursor::pos(), screenPos2mapPos(), MapCoordinate::valid(), MapCoordinate::x, GameMap::xsize, MapCoordinate::y, and GameMap::ysize.

bool MapDisplayPG::eventMouseButtonUp ( const SDL_MouseButtonEvent *  button  )  [protected]

Definition at line 1080 of file mapdisplay.cpp.

void MapDisplayPG::checkViewPosition ( MapCoordinate pos  )  [protected]

Definition at line 747 of file mapdisplay.cpp.

References actmap, max(), MapCoordinate::x, GameMap::xsize, MapCoordinate::y, and GameMap::ysize.

Referenced by centerOnField(), eventMouseButtonDown(), fillSurface(), and scrollMap().

void MapDisplayPG::fillSurface ( int  playerView  )  [protected]

Definition at line 727 of file mapdisplay.cpp.

References actmap, checkViewPosition(), paintBackground(), and MapRenderer::paintTerrain().

Referenced by updateMap().

void MapDisplayPG::paintBackground (  )  [protected]

Definition at line 739 of file mapdisplay.cpp.

References MapRenderer::paintBackground().

Referenced by fillSurface().

void MapDisplayPG::changeZoom ( int  delta  )  [inline]

Definition at line 187 of file mapdisplay.h.

References getZoom(), and setNewZoom().

Referenced by eventMouseButtonDown(), execaction_pg(), and executeUserAction().

void MapDisplayPG::setNewZoom ( int  zoom  ) 

Definition at line 692 of file mapdisplay.cpp.

References colorDepth, Surface::createSurface(), fielddistx, fielddisty, fieldysize, CGameOptions::Instance(), CGameOptions::mapzoom, newZoom, CGameOptions::setChanged(), and MapRenderer::surfaceBorder.

Referenced by changeZoom(), and MapDisplayPG().

int MapDisplayPG::getZoom (  )  const [inline]

Definition at line 189 of file mapdisplay.h.

Referenced by changeZoom(), and MapInfoPanel::MapInfoPanel().

MapCoordinate MapDisplayPG::screenPos2mapPos ( const SPoint pos  ) 

Definition at line 910 of file mapdisplay.cpp.

References widgetPos2mapPos().

Referenced by eventMouseButtonDown(), and eventMouseMotion().

MapCoordinate MapDisplayPG::widgetPos2mapPos ( const SPoint pos  ) 

Definition at line 919 of file mapdisplay.cpp.

References fieldsizey, MapRenderer::getFieldPosX(), MapRenderer::getFieldPosY(), MapRenderer::surfaceBorder, MapCoordinate::x, and MapCoordinate::y.

Referenced by screenPos2mapPos().

SPoint MapDisplayPG::mapGlobalPos2internalPos ( const MapCoordinate pos  ) 

Definition at line 887 of file mapdisplay.cpp.

References MapRenderer::getFieldPos(), MapCoordinate::x, and MapCoordinate::y.

Referenced by displayUnitMovement(), fieldCompletelyInView(), fieldCompletelyInViewX(), and fieldCompletelyInViewY().

SPoint MapDisplayPG::mapViewPos2internalPos ( const MapCoordinate pos  ) 

Definition at line 892 of file mapdisplay.cpp.

References MapRenderer::getFieldPos(), MapCoordinate::x, and MapCoordinate::y.

Referenced by displayAddons().

SPoint MapDisplayPG::internal2widget ( const SPoint pos  ) 

Definition at line 898 of file mapdisplay.cpp.

References MapRenderer::surfaceBorder.

Referenced by displayUnitMovement(), fieldCompletelyInView(), fieldCompletelyInViewX(), and fieldCompletelyInViewY().

SPoint MapDisplayPG::widget2screen ( const SPoint pos  ) 

Definition at line 903 of file mapdisplay.cpp.

Referenced by displayMovementStep(), displayUnitMovement(), fieldCompletelyInView(), fieldCompletelyInViewX(), and fieldCompletelyInViewY().

MapCoordinate MapDisplayPG::upperLeftCorner (  ) 

Definition at line 936 of file mapdisplay.cpp.

Referenced by Weathercast::painter(), OverviewMapPanel::painter(), and MapSwitcher::toggle().

MapCoordinate MapDisplayPG::lowerRightCorner (  ) 

Definition at line 941 of file mapdisplay.cpp.

References MapCoordinate::x, and MapCoordinate::y.

Referenced by Weathercast::painter(), and OverviewMapPanel::painter().

bool MapDisplayPG::fieldCompletelyInViewX ( const MapCoordinate pos  ) 

Definition at line 1086 of file mapdisplay.cpp.

References fieldsizex, fieldsizey, internal2widget(), mapGlobalPos2internalPos(), s2, and widget2screen().

bool MapDisplayPG::fieldCompletelyInViewY ( const MapCoordinate pos  ) 

Definition at line 1094 of file mapdisplay.cpp.

References fieldsizex, fieldsizey, internal2widget(), mapGlobalPos2internalPos(), s2, and widget2screen().

bool MapDisplayPG::fieldCompletelyInView ( const MapCoordinate pos  ) 

Definition at line 1102 of file mapdisplay.cpp.

References fieldsizex, fieldsizey, internal2widget(), mapGlobalPos2internalPos(), s2, and widget2screen().

Referenced by fieldInView().

void MapDisplayPG::blitInternalSurface ( SDL_Surface *  dest,
const SPoint pnt,
const PG_Rect &  dstClip 
) [protected]

Definition at line 791 of file mapdisplay.cpp.

References MegaBlitter< BytesPerSourcePixel, BytesPerTargetPixel, SourceColorTransform, ColorMerger, SourcePixelSelector, TargetPixelSelector, MyColorConverter >::blit(), MegaBlitter< BytesPerSourcePixel, BytesPerTargetPixel, SourceColorTransform, ColorMerger, SourcePixelSelector, TargetPixelSelector, MyColorConverter >::initSource(), and Surface::Wrap().

Referenced by eventBlit().

void MapDisplayPG::displayAddons ( Surface surf,
int  pass 
) [protected]

Definition at line 1482 of file mapdisplay.cpp.

References MapRenderer::bitmappedHeight2pass(), ContainerBase::calcShadowDist(), chsatellit, fieldsizex, fieldsizey, getFirstBit(), Vehicle::getPosition(), Vehicle::height, mapViewPos2internalPos(), and Vehicle::paint().

Referenced by MapDisplayPG().

void MapDisplayPG::initMovementStructure (  )  [protected]

Definition at line 1131 of file mapdisplay.cpp.

References createMovementBufferSurface(), fieldsizex, fieldsizey, MapRenderer::getFieldPos2(), getNeighbouringFieldCoordinate(), MapDisplayPG::MovementMask::mask, movementMask, sidenum, and MapDisplayPG::MovementMask::startFieldPos.

Referenced by displayUnitMovement().

Surface MapDisplayPG::createMovementBufferSurface (  )  [protected]

Definition at line 1123 of file mapdisplay.cpp.

References colorDepth, Surface::createSurface(), effectiveMovementSurfaceHeight, effectiveMovementSurfaceWidth, and MapRenderer::surfaceBorder.

Referenced by initMovementStructure().

void MapDisplayPG::displayMovementStep ( Movement movement,
int  percentage 
) [protected]

Definition at line 1275 of file mapdisplay.cpp.

References MapDisplayPG::Movement::actmap, MapDisplayPG::Movement::actualFieldNum, MegaBlitter< BytesPerSourcePixel, BytesPerTargetPixel, SourceColorTransform, ColorMerger, SourcePixelSelector, TargetPixelSelector, MyColorConverter >::blit(), MapDisplayPG::Movement::blitViewPortInternal, MapDisplayPG::Movement::blitViewPortScreen, fieldVisibility(), MapDisplayPG::Movement::from, MapDisplayPG::Movement::fromShadow, GameMap::getField(), MapRenderer::getFieldPosX(), MapRenderer::getFieldPosY(), ContainerBase::getMap(), Vehicle::height, MegaBlitter< BytesPerSourcePixel, BytesPerTargetPixel, SourceColorTransform, ColorMerger, SourcePixelSelector, TargetPixelSelector, MyColorConverter >::initSource(), MapDisplayPG::Movement::mapPos, MapDisplayPG::Movement::mask, MapDisplayPG::Movement::maskPosition, Vehicle::paint(), MapRenderer::paintSingleField(), MapDisplayPG::Movement::playerView, MapDisplayPG::Movement::surfPos, MapDisplayPG::Movement::targetBlitPos, MapDisplayPG::Movement::to, MapDisplayPG::Movement::toShadow, MapDisplayPG::Movement::touchedFields, MapDisplayPG::Movement::veh, widget2screen(), and Surface::Wrap().

Referenced by displayUnitMovement().

bool MapDisplayPG::eventKeyDown ( const SDL_KeyboardEvent *  key  )  [inline, protected]

Definition at line 253 of file mapdisplay.h.

References keyboardHandler().

bool MapDisplayPG::keyboardHandler ( const SDL_KeyboardEvent *  keyEvent  )  [protected]

Definition at line 1641 of file mapdisplay.cpp.

References actmap, and disableKeyboardCursorMovement.

Referenced by eventKeyDown(), and MapDisplayPG().

void MapDisplayPG::keyboadCursorMovement ( bool  enable  )  [inline]

Definition at line 263 of file mapdisplay.h.

References disableKeyboardCursorMovement.

Referenced by NewGuiHost::eventKeyDown(), and NewGuiHost::eventKeyUp().

void MapDisplayPG::scrollMap ( int  dir  ) 

Definition at line 1503 of file mapdisplay.cpp.

References actmap, checkViewPosition(), viewChanged, MapCoordinate::x, and MapCoordinate::y.

Referenced by MainScreenWidget::mouseScrollChecker().

void MapDisplayPG::displayUnitMovement ( GameMap actmap,
Vehicle veh,
const MapCoordinate3D from,
const MapCoordinate3D to,
int  duration 
)

Definition at line 1361 of file mapdisplay.cpp.

References actmap, ContainerBase::calcShadowDist(), ccompare(), chschwimmend, Vehicle::direction, displayMovementStep(), fieldInView(), fieldsizex, fieldsizey, MapCoordinate3D::getBitmappedHeight(), getdirection(), getNeighbouringFieldCoordinate(), MapCoordinate3D::getNumericalHeight(), GameMap::getPlayerView(), initMovementStructure(), internal2widget(), mapGlobalPos2internalPos(), MapDisplayPG::MovementMask::mask, max(), min(), movementMask, sidenum, MapDisplayPG::MovementMask::startFieldPos, ticker, widget2screen(), MapCoordinate::x, and MapCoordinate::y.

Referenced by PG_MapDisplay::displayMovingUnit().

bool MapDisplayPG::fieldInView ( const MapCoordinate mc  ) 

Definition at line 1113 of file mapdisplay.cpp.

References fieldCompletelyInView(), MapCoordinate::x, and MapCoordinate::y.

Referenced by PG_MapDisplay::displayPosition(), displayUnitMovement(), and MapDisplayPG::Cursor::goTo().

bool MapDisplayPG::centerOnField ( const MapCoordinate mc  ) 

Definition at line 947 of file mapdisplay.cpp.

References actmap, checkViewPosition(), MapCoordinate::valid(), viewChanged, MapCoordinate::x, GameMap::xsize, MapCoordinate::y, and GameMap::ysize.

Referenced by PG_MapDisplay::displayPosition(), eventMouseButtonDown(), MapDisplayPG::Cursor::goTo(), Weathercast::mouseClick(), and OverviewMapPanel::mouseClick().

void MapDisplayPG::registerAdditionalUnit ( Vehicle veh  ) 

Definition at line 1698 of file mapdisplay.cpp.

Referenced by PG_MapDisplay::displayMap().

void MapDisplayPG::updateMap ( bool  force = false  ) 

repaints to the internal surface, but does not blit this surface the screen

Definition at line 774 of file mapdisplay.cpp.

References actmap, fillSurface(), and GameMap::getPlayerView().

Referenced by eventBlit(), and updateWidget().

void MapDisplayPG::updateWidget (  ) 

update the internal surface and blits it to the screen

Definition at line 783 of file mapdisplay.cpp.

References updateMap().

Referenced by MapDisplayPG().

void MapDisplayPG::addMapLayer ( MapLayer layer,
const ASCString name 
)

Definition at line 1703 of file mapdisplay.cpp.

References MapRenderer::addMapLayer(), and MapLayer::setActive().

Referenced by ASC_MainScreenWidget::ASC_MainScreenWidget(), MapDisplayPG(), and Maped_MainScreenWidget::Maped_MainScreenWidget().

void MapDisplayPG::activateMapLayer ( const ASCString name,
bool  active 
)

Definition at line 1710 of file mapdisplay.cpp.

References layerChanged.

Referenced by MainScreenWidget::activateMapLayer(), and ASC_MainScreenWidget::ASC_MainScreenWidget().

void MapDisplayPG::toggleMapLayer ( const ASCString name  ) 

Definition at line 1719 of file mapdisplay.cpp.

References layerChanged.

Referenced by execaction(), executeUserAction(), and MainScreenWidget::toggleMapLayer().

bool MapDisplayPG::layerActive ( const ASCString name  ) 

Definition at line 1728 of file mapdisplay.cpp.

Referenced by MapInfoPanel::MapInfoPanel().

void MapDisplayPG::getActiveLayers ( vector< ASCString > &  list  ) 

Definition at line 1738 of file mapdisplay.cpp.

int MapDisplayPG::setSignalPriority ( int  priority  ) 

Definition at line 978 of file mapdisplay.cpp.

Referenced by SelectFromMap::SelectFromMap(), and SelectFromMap::~SelectFromMap().


Friends And Related Function Documentation

friend class CursorHiding [friend]

Definition at line 341 of file mapdisplay.h.

friend class LockDisplay [friend]

Definition at line 352 of file mapdisplay.h.


Member Data Documentation

SigC::Signal1<void, int> MapDisplayPG::newZoom

Definition at line 189 of file mapdisplay.h.

Referenced by MapInfoPanel::MapInfoPanel(), and setNewZoom().

const int MapDisplayPG::effectiveMovementSurfaceWidth = 4 * fielddisthalfx + fieldsizex [static, protected]

Definition at line 215 of file mapdisplay.h.

Referenced by createMovementBufferSurface().

const int MapDisplayPG::effectiveMovementSurfaceHeight = 4*fieldsizey [static, protected]

Definition at line 216 of file mapdisplay.h.

Referenced by createMovementBufferSurface().

struct MapDisplayPG::MovementMask MapDisplayPG::movementMask[sidenum] [protected]

Referenced by displayUnitMovement(), and initMovementStructure().

bool MapDisplayPG::disableKeyboardCursorMovement [protected]

Definition at line 260 of file mapdisplay.h.

Referenced by keyboadCursorMovement(), and keyboardHandler().

SigC::Signal2<void, bool, const ASCString&> MapDisplayPG::layerChanged

Definition at line 295 of file mapdisplay.h.

Referenced by activateMapLayer(), ASC_MainScreenWidget::ASC_MainScreenWidget(), MapInfoPanel::MapInfoPanel(), and toggleMapLayer().

SigC::Signal5<bool,const MapCoordinate&, const SPoint&, bool, int, int> MapDisplayPG::mouseButtonOnField

Signal that is fired when the mouse is pressed on a valid field, after the cursor evaluation has been run.

Parameters:
MapCoordinate the Coordinate of the field that was clicked
SPoint the mouse position
bool true if the cursor had been repositioned
int the button that was pressed
int the priority of the signal

Definition at line 311 of file mapdisplay.h.

Referenced by eventMouseButtonDown(), Maped_MainScreenWidget::Maped_MainScreenWidget(), NewGuiHost::NewGuiHost(), and SelectFromMap::SelectFromMap().

SigC::Signal4<bool,const MapCoordinate&, const SPoint&, bool, int> MapDisplayPG::mouseDraggedToField

Signal that is fired when the mouse is dragged onto a new field with mouse buttons pressed.

Parameters:
MapCoordinate the Coordinate of the field that was clicked
SPoint the mouse position
bool true if the cursor had been repositioned
int the priority of the signal

Definition at line 319 of file mapdisplay.h.

Referenced by eventMouseMotion(), and Maped_MainScreenWidget::Maped_MainScreenWidget().

struct MapDisplayPG::Cursor MapDisplayPG::cursor

Referenced by Maped_MainScreenWidget::clickOnMap(), PG_MapDisplay::cursor_goto(), eventBlit(), TargetCoordinateLocator::eventMouseButtonDown(), eventMouseButtonDown(), eventMouseMotion(), execaction(), TaskFactory::itemSelected(), ActionFactory::itemSelected(), SelectFromMap::listItemClicked(), PG_MapDisplay::removeActionCursor(), SelectFromMap::SelectFromMap(), and MapSwitcher::toggle().


The documentation for this class was generated from the following files:
Generated on Mon May 21 01:46:59 2012 for Advanced Strategic Command by  doxygen 1.5.1