Polygon Crucher SDK - Documentation
Documentation
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
2DPointList.h
Go to the documentation of this file.
1//! @file 2DPointList.h
2//! @brief C2DPointList class for handling a list of C2DPoint coordinates
3//!
4//////////////////////////////////////////////////////////////////////
5
6#if !defined(AFX_2DPOINTLIST_H__15665002_0D39_11D3_A380_9A856250DB28__INCLUDED_)
7#define AFX_2DPOINTLIST_H__15665002_0D39_11D3_A380_9A856250DB28__INCLUDED_
8
9#ifdef _MSC_VER
10#pragma once
11#endif // _MSC_VER
12
13#include "PointList.h"
14#include "2DPoint.h"
15
16BEGIN_MOOTOOLS_NAMESPACE
17
18class C2DPointMethods : public CPointMethods
19{
20 DECLARE_SERIAL_XOBJECT(C2DPointMethods);
21
22 SIZET GetSizeof() const;
23 ElementType GetType() const;
24 void ConstructElement(void* pNewData);
25};
26
27inline SIZET C2DPointMethods::GetSizeof() const
28{
29 return sizeof(C2DPoint);
30}
31
32inline ElementType C2DPointMethods::GetType() const
33{
34 return MAKE_CUSTOM_ID('2', 'D', 'P', 'T');
35}
36
37inline void C2DPointMethods::ConstructElement(void* pNewData)
38{
39 xConstruct(C2DPoint, pNewData);
40}
41
42//! @class C2DPointList
43//! @brief The class handles C2DPoint list of points
44//!
45//! @note
46//! the list is designed to use the C2DPoint class (float coordinates). If you intend to use C2DPointI or C2DPointD, you must create your own variant based on CPointList class.
47class DLL_3DFUNCTION C2DPointList : public CPointList
48{
49 DECLARE_SERIAL_XOBJECT(C2DPointList)
50
51 public:
52 using CPointList::operator=;
53
54 C2DPointList(C2DPointList *srcPoints = NULL);
55 virtual ~C2DPointList();
56
57 //! @name Access functions
58 //! Get access to the C2DPoint data contained in the array
59 //!
60 //! @{
61 C2DPoint *GetFirst(); //!< Get first point, for using in while loop
62 C2DPoint *GetNext(C2DPoint *pointList); //!< Get next point, for using in while loop
63 C2DPoint *ElementAt(int i); //!< Get ith element, for using in a for loop
64 C2DPoint *operator[](int i); //!< Get ith element, for using in a for loop
65
66 //! @}
67
68 #ifdef _DEBUG
69 CXString GetPointListType() const { return _T("2D"); }
70 #endif
71};
72
73// C2DPoint Access functions
75{
76 return (C2DPoint *)CElementArray::GetFirst();
77}
78
80{
81 return (C2DPoint *)CElementArray::GetNext(pointList);
82}
83
85{
86 return ((C2DPoint *)CElementArray::ElementAt(i));
87}
88
90{
91 return ((C2DPoint *)CElementArray::operator[](i));
92}
93
94END_MOOTOOLS_NAMESPACE
95
96#endif // !defined(AFX_2DPOINTLIST_H__15665002_0D39_11D3_A380_9A856250DB28__INCLUDED_)
C2DTPoint template class for handling x, y 2D point coordinate.
The class handles C2DPoint list of points.
Definition 2DPointList.h:48
C2DPoint * ElementAt(int i)
Get ith element, for using in a for loop.
Definition 2DPointList.h:84
C2DPoint * GetFirst()
Get first point, for using in while loop.
Definition 2DPointList.h:74
C2DPoint * operator[](int i)
Get ith element, for using in a for loop.
Definition 2DPointList.h:89
C2DPoint * GetNext(C2DPoint *pointList)
Get next point, for using in while loop.
Definition 2DPointList.h:79
The class defines an x, y 2D point which can use int, float or double.
Definition 2DPoint.h:23
CPointList is the base class for different classes (C3DPointList, CUVWPointList......
Definition PointList.h:50