CODPointComponent Class

class CODPointComponent: public CODComponent

This is the base class for any component which is made up of a series of vertices. All primitive components are derived from CODPointComponent, but you may have components which do not have vertices. The point component contains a set of local points which are stored in m_lpPoints. Local points are relative to the local coordinate system of the component. Applying the component's transform to the local points yields a set of world points. The world points are stored in the m_lpDrawingPoints member. The world points are used to draw the component, and are logical coordinates that can be used in a device context. The coordinate mapping information (i.e. mapping mode and extents) in the device context map the world points to device points.

The point arrays are allocated by the AllocatePointMemory method. The class has several methods for adding, updating, and deleting vertices. Coordinates passed to the vertex editing methods should always be world coordinates, because they are converted by these functions into local coordinates using an inverse transform.

Defined in: OdPointComp.h

See Also

CODComponent, IODVertices

Class Members

VIEWS_API CODPointComponent()

Constructor.

VIEWS_API CODPointComponent(const CODPointComponent& src)

Copy constructor.

VIEWS_API virtual ~CODPointComponent()

Destructor.

VIEWS_API BOOL Create(UINT nID)

Creates the component after the object has been instaniated.

VIEWS_API CODPointComponent& operator=(const CODPointComponent& src)

Overloaded '=' assignment operator.

VIEWS_API virtual CODComponent* Dup() const

Creates and returns a duplicate component.

int m_nPointCount

Count of the points.

LPPOINT m_lpPoints

The vertices of the component.

LPPOINT m_lpDrawingPoints

The vertices of the component used for drawing.

VIEWS_API virtual int GetPointCount() const

Retrieves the number of vertices associated with this component.

VIEWS_API virtual int GetPoints(LPPOINT lpPoints) const

Retrieves the vertices associated with the component.

VIEWS_API virtual int GetPoints(CODPointArray& ptArray) const

Retrieves the vertices associated with the component.

VIEWS_API virtual void SetPoints(LPPOINT lpPoints, const int nCount)

Sets the component's vertex positions.

VIEWS_API virtual void SetPoints(const CODPointArray& ptArray)

Sets the component's vertex positions.

VIEWS_API virtual CPoint GetVertex(const int nIndex) const

Gets one of the vertices of the component.

VIEWS_API virtual CPoint SetVertex(const int nIndex, const CPoint& ptVertex)

Sets the value of a vertex.

VIEWS_API virtual void AddVertex(const CPoint& ptVertex)

Adds a vertex to the component.

VIEWS_API virtual void InsertVertex(const int nIndex, const CPoint& ptVertex)

Inserts a vertex into the component.

VIEWS_API virtual CPoint DeleteVertex(const int nIndex)

Removes a vertex from the component.

VIEWS_API virtual OD_MOVEVERTEX_RC MoveVertex(int nIndex, int nOffsetX, int nOffsetY)

Moves one of the component's vertices.

VIEWS_API virtual OD_MOVEVERTEX_RC CalculateMovedVertices(int nIndex, int nOffsetX, int nOffsetY)

Calculates the new position of a vertex given an offset.

VIEWS_API void AllocatePointMemory(int nCount)

Allocates memory for the arrays of points.

VIEWS_API LPPOINT GetPoints()

Retrieves a pointer to the points for this component.

VIEWS_API virtual void GetVertices(CODPointArray* pVertexArray, BOOL bTracking = FALSE)

Gets the component's vertex positions.

VIEWS_API virtual void MoveAllVertices(int nOffsetX, int nOffsetY)

Move all vertices by a given offset.

VIEWS_API virtual void GetHandles(CODPointArray* pHandleArray, BOOL bVertexHandles = FALSE)

Gets the component's handle (transformed) positions.

VIEWS_API virtual CODComponentPosition* GetPosition()

Returns the current position and size of the component as an object.

VIEWS_API virtual BOOL SetPosition(CODComponentPosition* pCompPos)

Restores the position and size of the component to a previously saved state.

VIEWS_API virtual CPoint SetOrigin(int x, int y)

Set the origin of this component relative to the container and in the container's units

VIEWS_API virtual CPoint MoveOrigin(int xOff,int yOff)

Move the origin of this component by specified deltas

VIEWS_API virtual CPoint OffsetOrigin(int xOff, int yOff)

Offset the origin of this component by specified deltas

VIEWS_API virtual void OnPrepareDC(CDC* pDC)

Creates GDI objects and sets up the device context for drawing.

VIEWS_API virtual CODRgn GetEdgeRgn()

Returns a region surrounding the edges of the component.

VIEWS_API virtual void CalculateRgn(CODRgn* pRgn)

Calculates the bounding rectangle of the component.

VIEWS_API virtual CRect CalculateAlignRect()

Calculates the aligment rectangle of the component.

VIEWS_API virtual void Serialize(CArchive& ar)

Serialize the component.

VIEWS_API virtual ULONG STDMETHODCALLTYPE AddRef()

Add a reference to this object.

VIEWS_API virtual ULONG STDMETHODCALLTYPE Release()

Release a reference to this object.