WXP C++ Library Version 6.74.6
Loading...
Searching...
No Matches
Public Member Functions | List of all members
WXP::GridPoints Class Reference

This class creates an array a 2D points (x, y) More...

#include "../include/GridPoints.h"

Public Member Functions

int init ()
 
int init (int size)
 
 GridPoints ()
 
 GridPoints (int size)
 
 ~GridPoints ()
 
 GridPoints (const GridPoints &data)
 
GridPoints operator= (const GridPoints &data)
 
int copy (const GridPoints &data)
 
int copy (const GridPoints &data, int start, int rnum)
 
int clear ()
 
int expand (int size)
 
int add (float x, float y)
 
int add (GridPoint gpt)
 
int add1 (GridPoint gpt)
 
int add (int ind)
 
int add1 (int ind)
 
int set (int ind, float rx, float ry)
 
int set (int ind, GridPoint &gpt)
 
int get (int ind, GridPoint &gpt)
 
GridPoint get (int ind)
 
int remove (int ind)
 
int insert (int ind, GridPoint &gpt)
 
int insert (int ind, float x, float y)
 
float getGX (int ind)
 
float getGY (int ind)
 
float getGX1 (int ind)
 
float getGY1 (int ind)
 
int getNum ()
 
int offset (int ind, float rx, float ry)
 
int offset (float rx, float ry)
 
int within (GridPoint &gpt)
 
int getCenter (GridPoint &gpt)
 
int getCentroid (GridPoint &gpt)
 
int getBoundingBox (Rect &box)
 
int getPointsWithin (GridPoints &gpts)
 
int print ()
 

Detailed Description

This class creates an array a 2D points (x, y)

Author
Dan Vietor

Constructor & Destructor Documentation

◆ GridPoints() [1/3]

GridPoints::GridPoints ( )

Constructor. Initializes the values.

References init().

◆ GridPoints() [2/3]

GridPoints::GridPoints ( int  size)

Constructor. Size the arrays.

References init().

◆ ~GridPoints()

GridPoints::~GridPoints ( )

Destructor.

◆ GridPoints() [3/3]

GridPoints::GridPoints ( const GridPoints data)

Copy constructor.

Parameters
dataStrings class to copy from

References copy().

Member Function Documentation

◆ add() [1/3]

int GridPoints::add ( float  rx,
float  ry 
)

Adds a new point.

Parameters
rxSets X
rySets Y

References expand().

Referenced by add().

◆ add() [2/3]

int GridPoints::add ( GridPoint  gpt)

Adds a new point.

Parameters
ptGridPoint class with values

References expand().

◆ add() [3/3]

int GridPoints::add ( int  ind)

Adds a new point from the existing list.

Parameters
indIndex of point to copy to and of list

References add().

◆ add1() [1/2]

int WXP::GridPoints::add1 ( GridPoint  gpt)
inline

Adds a point (no bounds check

Parameters
ptGridPoint to add

◆ add1() [2/2]

int WXP::GridPoints::add1 ( int  ind)
inline

Adds an existing point (no bounds check

Parameters
indIndex of point to add

◆ clear()

int WXP::GridPoints::clear ( )
inline

Clears point array

◆ copy() [1/2]

int GridPoints::copy ( const GridPoints data)

Copy data.

Parameters
eptsStrings class to copy from

References init().

Referenced by GridPoints(), and operator=().

◆ copy() [2/2]

int GridPoints::copy ( const GridPoints data,
int  start,
int  rnum 
)

Copies a subset of point into array

Parameters
dataGridPoints
startStarting point within data
rnumNumber of points to copy

References init().

◆ expand()

int GridPoints::expand ( int  size)

Expands array size

Parameters
sizeNew size

Referenced by add(), and insert().

◆ get() [1/2]

GridPoint GridPoints::get ( int  ind)

Gets a specific point value from array.

Parameters
indIndex of value to get
Returns
Output GridPoint class with values

References get().

◆ get() [2/2]

int GridPoints::get ( int  ind,
GridPoint gpt 
)

Gets a specific point value from array.

Parameters
indIndex of value to get
Return values
pntOutput GridPoint class with values

Referenced by get().

◆ getCenter()

int GridPoints::getCenter ( GridPoint gpt)

Find a point at the center of the polygon

Return values
ptCentral point

References WXP::GridPoint::init(), and within().

◆ getCentroid()

int GridPoints::getCentroid ( GridPoint gpt)

Find the centroid of the polygon (averages X and Y). Centroid can be outside of polygon.

Return values
ptCentroid point

◆ getGX()

float WXP::GridPoints::getGX ( int  ind)
inline

Returns X value

Parameters
indIndex in array

References WXP::Const::MISS.

◆ getGX1()

float WXP::GridPoints::getGX1 ( int  ind)
inline

Returns X value (no bounds check)

Parameters
indIndex in array

◆ getGY()

float WXP::GridPoints::getGY ( int  ind)
inline

Returns Y value

Parameters
indIndex in array

References WXP::Const::MISS.

◆ getGY1()

float WXP::GridPoints::getGY1 ( int  ind)
inline

Returns Y value (no bounds check)

Parameters
indIndex in array

◆ getNum()

int WXP::GridPoints::getNum ( )
inline

Return the number of points

◆ init() [1/2]

int GridPoints::init ( )

Initializes the values

Referenced by copy(), and GridPoints().

◆ init() [2/2]

int GridPoints::init ( int  size)

Initializes the values

◆ insert() [1/2]

int GridPoints::insert ( int  ind,
float  rx,
float  ry 
)

Insert a point into the array

Parameters
indIndex to insert the point
rxX value
ryY value

References expand().

◆ insert() [2/2]

int GridPoints::insert ( int  ind,
GridPoint gpt 
)

Insert a point into the array

Parameters
indIndex to insert the point
ptGridPoint to insert

References insert().

Referenced by insert().

◆ offset() [1/2]

int GridPoints::offset ( float  rx,
float  ry 
)

Offsets the entire array.

Parameters
rxNew x value
ryNew y value

◆ offset() [2/2]

int GridPoints::offset ( int  ind,
float  rx,
float  ry 
)

Offsets a specific point value in array.

Parameters
indIndex of value to set
rxNew x value
ryNew y value

◆ operator=()

GridPoints GridPoints::operator= ( const GridPoints data)

Assignment operator. Used to overload copying

Parameters
dataString class to copy from

References copy().

◆ print()

int GridPoints::print ( )

Prints the values to standard output.

◆ remove()

int GridPoints::remove ( int  ind)

Deletes a specific point from array.

Parameters
indIndex of point to delete

◆ set() [1/2]

int GridPoints::set ( int  ind,
float  rx,
float  ry 
)

Sets a specific point value in array.

Parameters
indIndex of value to set
rxNew x value
ryNew y value

◆ set() [2/2]

int GridPoints::set ( int  ind,
GridPoint gpt 
)

Sets a specific point value in array.

Parameters
indIndex of value to set
pntNew values

◆ within()

int GridPoints::within ( GridPoint gpt)

Determines if a point is within the array.

Parameters
ptGridPoint to check

Referenced by getCenter().


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