OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
OpenXcom::Polygon Class Reference

Represents a polygon in the world map. More...

#include <Polygon.h>

Public Member Functions

 Polygon (int points)
 Creates a polygon with a number of points. More...
 
 Polygon (const Polygon &other)
 Creates a new polygon from an existing one. More...
 
 ~Polygon ()
 Cleans up the polygon. More...
 
double getLatitude (int i) const
 Gets the latitude of a point. More...
 
void setLatitude (int i, double lat)
 Sets the latitude of a point. More...
 
double getLongitude (int i) const
 Gets the longitude of a point. More...
 
void setLongitude (int i, double lon)
 Sets the longitude of a point. More...
 
Sint16 getX (int i) const
 Gets the X coordinate of a point. More...
 
void setX (int i, Sint16 x)
 Sets the X coordinate of a point. More...
 
Sint16 getY (int i) const
 Gets the Y coordinate of a point. More...
 
void setY (int i, Sint16 y)
 Sets the Y coordinate of a point. More...
 
int getTexture () const
 Gets the texture of the polygon. More...
 
void setTexture (int tex)
 Sets the texture of the polygon. More...
 
int getPoints () const
 Gets the number of points of the polygon. More...
 

Detailed Description

Represents a polygon in the world map.

Polygons constitute the textured land portions of the X-Com globe and typically have 3-4 points.

Constructor & Destructor Documentation

OpenXcom::Polygon::Polygon ( int  points)

Creates a polygon with a number of points.

Initializes the polygon with arrays to store each point's coordinates.

Parameters
pointsNumber of points.
OpenXcom::Polygon::Polygon ( const Polygon other)

Creates a new polygon from an existing one.

Performs a deep copy of an existing polygon.

Parameters
otherPolygon to copy from.
OpenXcom::Polygon::~Polygon ( )

Cleans up the polygon.

Deletes the arrays from memory.

Member Function Documentation

double OpenXcom::Polygon::getLatitude ( int  i) const

Gets the latitude of a point.

Returns the latitude of a given point.

Parameters
iPoint number (0-max).
Returns
Point's latitude.
double OpenXcom::Polygon::getLongitude ( int  i) const

Gets the longitude of a point.

Returns the longitude of a given point.

Parameters
iPoint number (0-max).
Returns
Point's longitude.
int OpenXcom::Polygon::getPoints ( ) const

Gets the number of points of the polygon.

Returns the number of points (vertexes) that make up the polygon.

Returns
Number of points.
int OpenXcom::Polygon::getTexture ( ) const

Gets the texture of the polygon.

Returns the texture used to draw the polygon (textures are stored in a set).

Returns
Texture sprite number.
Sint16 OpenXcom::Polygon::getX ( int  i) const

Gets the X coordinate of a point.

Returns the X coordinate of a given point.

Parameters
iPoint number (0-max).
Returns
Point's X coordinate.
Sint16 OpenXcom::Polygon::getY ( int  i) const

Gets the Y coordinate of a point.

Returns the Y coordinate of a given point.

Parameters
iPoint number (0-max).
Returns
Point's Y coordinate.
void OpenXcom::Polygon::setLatitude ( int  i,
double  lat 
)

Sets the latitude of a point.

Changes the latitude of a given point.

Parameters
iPoint number (0-max).
latPoint's latitude.
void OpenXcom::Polygon::setLongitude ( int  i,
double  lon 
)

Sets the longitude of a point.

Changes the latitude of a given point.

Parameters
iPoint number (0-max).
lonPoint's longitude.
void OpenXcom::Polygon::setTexture ( int  tex)

Sets the texture of the polygon.

Changes the texture used to draw the polygon.

Parameters
texTexture sprite number.
void OpenXcom::Polygon::setX ( int  i,
Sint16  x 
)

Sets the X coordinate of a point.

Changes the X coordinate of a given point.

Parameters
iPoint number (0-max).
xPoint's X coordinate.
void OpenXcom::Polygon::setY ( int  i,
Sint16  y 
)

Sets the Y coordinate of a point.

Changes the Y coordinate of a given point.

Parameters
iPoint number (0-max).
yPoint's Y coordinate.

The documentation for this class was generated from the following files: