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

 CODPointComponent()

Constructor.

 CODPointComponent(const CODPointComponent& src)

Copy constructor.

virtual  ~CODPointComponent()

Destructor.

BOOL  Create(UINT nID)

Creates the component after the object has been instaniated.

CODPointComponent&  operator=(const CODPointComponent& src)

Overloaded '=' assignment operator.

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.

virtual int  GetPointCount() const

Retrieves the number of vertices associated with this component.

virtual int  GetPoints(LPPOINT lpPoints) const

Retrieves the vertices associated with the component.

virtual int  GetPoints(CODPointArray& ptArray) const

Retrieves the vertices associated with the component.

virtual void  SetPoints(LPPOINT lpPoints, const int nCount)

Sets the component's vertex positions.

virtual void  SetPoints(const CODPointArray& ptArray)

Sets the component's vertex positions.

virtual CPoint  GetVertex(const int nIndex) const

Gets one of the vertices of the component.

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

Sets the value of a vertex.

virtual void  AddVertex(const CPoint& ptVertex)

Adds a vertex to the component.

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

Inserts a vertex into the component.

virtual CPoint  DeleteVertex(const int nIndex)

Removes a vertex from the component.

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

Moves one of the component's vertices.

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

Calculates the new position of a vertex given an offset.

void  AllocatePointMemory(int nCount)

Allocates memory for the arrays of points.

LPPOINT  GetPoints()

Retrieves a pointer to the points for this component.

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

Gets the component's vertex positions.

virtual void  MoveAllVertices(int nOffsetX, int nOffsetY)

Move all vertices by a given offset.

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

Gets the component's handle (transformed) positions.

virtual CODComponentPosition*  GetPosition()

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

virtual BOOL  SetPosition(CODComponentPosition* pCompPos)

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

virtual CPoint  SetOrigin(int x, int y)

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

virtual CPoint  MoveOrigin(int xOff,int yOff)

Move the origin of this component by specified deltas

virtual CPoint  OffsetOrigin(int xOff, int yOff)

Offset the origin of this component by specified deltas

virtual void  OnPrepareDC(CDC* pDC)

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

virtual CODRgn  GetEdgeRgn()

Returns a region surrounding the edges of the component.

virtual void  CalculateRgn(CODRgn* pRgn)

Calculates the bounding rectangle of the component.

virtual CRect  CalculateAlignRect()

Calculates the aligment rectangle of the component.

virtual void  Serialize(CArchive& ar)

Serialize the component.

virtual ULONG STDMETHODCALLTYPE  AddRef()

Add a reference to this object.

virtual ULONG STDMETHODCALLTYPE  Release()

Release a reference to this object.