KiCad PCB EDA Suite
Loading...
Searching...
No Matches
DS_DATA_ITEM_POLYGONS Class Reference

#include <ds_data_item.h>

Inheritance diagram for DS_DATA_ITEM_POLYGONS:
DS_DATA_ITEM

Public Types

enum  DS_ITEM_TYPE {
  DS_TEXT , DS_SEGMENT , DS_RECT , DS_POLYPOLYGON ,
  DS_BITMAP
}
 

Public Member Functions

 DS_DATA_ITEM_POLYGONS ()
 
void SyncDrawItems (DS_DRAW_ITEM_LIST *aCollector, KIGFX::VIEW *aView) override
 
virtual int GetPenSizeUi () override
 
void AppendCorner (const VECTOR2D &aCorner)
 Add a corner in corner list. More...
 
void CloseContour ()
 Close the current contour, by storing the index of the last corner of the current polygon in m_polyIndexEnd. More...
 
int GetPolyCount () const
 
unsigned GetPolyIndexStart (unsigned aContour) const
 
unsigned GetPolyIndexEnd (unsigned aContour) const
 
const VECTOR2D GetCornerPosition (unsigned aIdx, int aRepeat=0) const
 
const VECTOR2I GetCornerPositionUi (unsigned aIdx, int aRepeat=0) const
 
void SetBoundingBox ()
 Calculate the bounding box of the set polygons. More...
 
bool IsInsidePage (int ii) const override
 
const std::vector< DS_DRAW_ITEM_BASE * > & GetDrawItems () const
 
void SetStart (double aPosx, double aPosy, enum CORNER_ANCHOR aAnchor=RB_CORNER)
 
void SetEnd (double aPosx, double aPosy, enum CORNER_ANCHOR aAnchor=RB_CORNER)
 
DS_ITEM_TYPE GetType () const
 
PAGE_OPTION GetPage1Option () const
 
void SetPage1Option (PAGE_OPTION aChoice)
 
const VECTOR2I GetStartPosIU (int ii=0) const
 
const VECTOR2I GetEndPosIU (int ii=0) const
 
const VECTOR2D GetStartPos (int ii=0) const
 
const VECTOR2D GetEndPos (int ii=0) const
 
void MoveTo (const VECTOR2D &aPosition)
 Move item to a new position. More...
 
void MoveToUi (const VECTOR2I &aPosition)
 Move item to a new position. More...
 
void MoveStartPointTo (const VECTOR2D &aPosition)
 Move the starting point of the item to a new position. More...
 
void MoveStartPointToUi (const VECTOR2I &aPosition)
 Move the starting point of the item to a new position. More...
 
void MoveEndPointTo (const VECTOR2D &aPosition)
 Move the ending point of the item to a new position. More...
 
void MoveEndPointToUi (const VECTOR2I &aPosition)
 Move the ending point of the item to a new position. More...
 
const wxString GetClassName () const
 

Public Attributes

EDA_ANGLE m_Orient
 
std::vector< VECTOR2Dm_Corners
 
wxString m_Name
 
wxString m_Info
 
POINT_COORD m_Pos
 
POINT_COORD m_End
 
double m_LineWidth
 
int m_RepeatCount
 
VECTOR2D m_IncrementVector
 
int m_IncrementLabel
 

Protected Attributes

DS_ITEM_TYPE m_type
 
PAGE_OPTION m_pageOption
 
std::vector< DS_DRAW_ITEM_BASE * > m_drawItems
 

Private Attributes

std::vector< unsigned > m_polyIndexEnd
 
VECTOR2D m_minCoord
 
VECTOR2D m_maxCoord
 

Detailed Description

Definition at line 215 of file ds_data_item.h.

Member Enumeration Documentation

◆ DS_ITEM_TYPE

Enumerator
DS_TEXT 
DS_SEGMENT 
DS_RECT 
DS_POLYPOLYGON 
DS_BITMAP 

Definition at line 98 of file ds_data_item.h.

Constructor & Destructor Documentation

◆ DS_DATA_ITEM_POLYGONS()

DS_DATA_ITEM_POLYGONS::DS_DATA_ITEM_POLYGONS ( )

Definition at line 376 of file ds_data_item.cpp.

Member Function Documentation

◆ AppendCorner()

void DS_DATA_ITEM_POLYGONS::AppendCorner ( const VECTOR2D aCorner)
inline

Add a corner in corner list.

Parameters
aCorneris the item to append.

Definition at line 229 of file ds_data_item.h.

References m_Corners.

Referenced by DRAWING_SHEET_PARSER::parsePolyOutline().

◆ CloseContour()

void DS_DATA_ITEM_POLYGONS::CloseContour ( )
inline

Close the current contour, by storing the index of the last corner of the current polygon in m_polyIndexEnd.

Definition at line 238 of file ds_data_item.h.

References m_Corners, and m_polyIndexEnd.

Referenced by DRAWING_SHEET_PARSER::parsePolygon().

◆ GetClassName()

const wxString DS_DATA_ITEM::GetClassName ( ) const
inherited

◆ GetCornerPosition()

const VECTOR2D DS_DATA_ITEM_POLYGONS::GetCornerPosition ( unsigned  aIdx,
int  aRepeat = 0 
) const
Returns
the coordinate (in mm) of the corner aIdx and the repeated item aRepeat

Definition at line 443 of file ds_data_item.cpp.

References DS_DATA_ITEM::GetStartPos(), m_Corners, m_Orient, RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by GetCornerPositionUi().

◆ GetCornerPositionUi()

const VECTOR2I DS_DATA_ITEM_POLYGONS::GetCornerPositionUi ( unsigned  aIdx,
int  aRepeat = 0 
) const
Returns
the coordinate (in draw/plot units) of the corner aIdx and the repeated item aRepeat

Definition at line 508 of file ds_data_item.cpp.

References GetCornerPosition(), DS_DATA_MODEL::GetTheInstance(), DS_DATA_MODEL::m_WSunits2Iu, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SyncDrawItems().

◆ GetDrawItems()

◆ GetEndPos()

◆ GetEndPosIU()

◆ GetPage1Option()

PAGE_OPTION DS_DATA_ITEM::GetPage1Option ( ) const
inlineinherited
Returns
true if the item has a end point (segment; rect) of false (text, polygon).

Definition at line 133 of file ds_data_item.h.

References DS_DATA_ITEM::m_pageOption.

Referenced by PROPERTIES_FRAME::CopyPrmsFromItemToPanel(), DS_DATA_MODEL_IO::formatOptions(), DS_DRAW_ITEM_BASE::GetMsgPanelInfo(), and DS_DRAW_ITEM_BASE::ViewGetLayers().

◆ GetPenSizeUi()

int DS_DATA_ITEM_POLYGONS::GetPenSizeUi ( )
overridevirtual

Reimplemented from DS_DATA_ITEM.

Definition at line 437 of file ds_data_item.cpp.

References DS_DATA_MODEL::GetTheInstance(), KiROUND(), and DS_DATA_ITEM::m_LineWidth.

Referenced by SyncDrawItems().

◆ GetPolyCount()

int DS_DATA_ITEM_POLYGONS::GetPolyCount ( ) const
inline
Returns
the count of contours in the poly polygon.

Definition at line 246 of file ds_data_item.h.

References m_polyIndexEnd.

Referenced by DS_DATA_MODEL_IO::format(), and SyncDrawItems().

◆ GetPolyIndexEnd()

unsigned DS_DATA_ITEM_POLYGONS::GetPolyIndexEnd ( unsigned  aContour) const
inline
Parameters
aContouris the index of the contour.
Returns
the index of the last corner of the contour aCountour.

Definition at line 264 of file ds_data_item.h.

References m_polyIndexEnd.

Referenced by DS_DATA_MODEL_IO::format(), and SyncDrawItems().

◆ GetPolyIndexStart()

unsigned DS_DATA_ITEM_POLYGONS::GetPolyIndexStart ( unsigned  aContour) const
inline
Parameters
aContouris the index of the contour.
Returns
the index of the first corner of the contour aCountour.

Definition at line 252 of file ds_data_item.h.

References m_polyIndexEnd.

Referenced by DS_DATA_MODEL_IO::format(), and SyncDrawItems().

◆ GetStartPos()

◆ GetStartPosIU()

◆ GetType()

◆ IsInsidePage()

bool DS_DATA_ITEM_POLYGONS::IsInsidePage ( int  ii) const
overridevirtual
Returns
true if the item is inside the rectangle defined by the 4 corners, false otherwise.

Reimplemented from DS_DATA_ITEM.

Definition at line 488 of file ds_data_item.cpp.

References DS_DATA_ITEM::GetStartPos(), DS_DATA_MODEL::GetTheInstance(), DS_DATA_MODEL::m_LT_Corner, m_maxCoord, m_minCoord, DS_DATA_MODEL::m_RB_Corner, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SyncDrawItems().

◆ MoveEndPointTo()

void DS_DATA_ITEM::MoveEndPointTo ( const VECTOR2D aPosition)
inherited

Move the ending point of the item to a new position.

This has meaning only for items defined by 2 points (segments and rectangles).

Parameters
aPositionis the new position of the ending point, in mm.

Definition at line 213 of file ds_data_item.cpp.

References DS_DATA_ITEM::DS_RECT, DS_DATA_ITEM::DS_SEGMENT, DS_DATA_MODEL::GetTheInstance(), DS_DATA_ITEM::GetType(), LB_CORNER, LT_CORNER, POINT_COORD::m_Anchor, DS_DATA_ITEM::m_End, DS_DATA_MODEL::m_LT_Corner, POINT_COORD::m_Pos, DS_DATA_MODEL::m_RB_Corner, RB_CORNER, RT_CORNER, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by DS_DATA_ITEM::MoveEndPointToUi(), and DS_DATA_ITEM::MoveTo().

◆ MoveEndPointToUi()

void DS_DATA_ITEM::MoveEndPointToUi ( const VECTOR2I aPosition)
inherited

Move the ending point of the item to a new position.

This has meaning only for items defined by 2 points (segments and rectangles).

Parameters
aPositionis the new position of the ending point in graphic units

Definition at line 256 of file ds_data_item.cpp.

References DS_DATA_MODEL::GetTheInstance(), DS_DATA_MODEL::m_WSunits2Iu, DS_DATA_ITEM::MoveEndPointTo(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PL_POINT_EDITOR::updateItem().

◆ MoveStartPointTo()

void DS_DATA_ITEM::MoveStartPointTo ( const VECTOR2D aPosition)
inherited

Move the starting point of the item to a new position.

Parameters
aPositionthe new position of the starting point, in mm.

Definition at line 171 of file ds_data_item.cpp.

References DS_DATA_MODEL::GetTheInstance(), LB_CORNER, LT_CORNER, POINT_COORD::m_Anchor, DS_DATA_MODEL::m_LT_Corner, POINT_COORD::m_Pos, DS_DATA_ITEM::m_Pos, DS_DATA_MODEL::m_RB_Corner, RB_CORNER, RT_CORNER, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by DS_DATA_ITEM::MoveStartPointToUi(), and DS_DATA_ITEM::MoveTo().

◆ MoveStartPointToUi()

void DS_DATA_ITEM::MoveStartPointToUi ( const VECTOR2I aPosition)
inherited

Move the starting point of the item to a new position.

Parameters
aPositionis the new position of item in graphic units.

Definition at line 204 of file ds_data_item.cpp.

References DS_DATA_MODEL::GetTheInstance(), DS_DATA_MODEL::m_WSunits2Iu, DS_DATA_ITEM::MoveStartPointTo(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PL_DRAWING_TOOLS::PlaceItem(), and PL_POINT_EDITOR::updateItem().

◆ MoveTo()

void DS_DATA_ITEM::MoveTo ( const VECTOR2D aPosition)
inherited

◆ MoveToUi()

void DS_DATA_ITEM::MoveToUi ( const VECTOR2I aPosition)
inherited

Move item to a new position.

Parameters
aPositionthe new position of the starting point in graphic units.

Definition at line 145 of file ds_data_item.cpp.

References DS_DATA_MODEL::GetTheInstance(), DS_DATA_MODEL::m_WSunits2Iu, DS_DATA_ITEM::MoveTo(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PL_DRAWING_TOOLS::DrawShape(), and PL_EDIT_TOOL::moveItem().

◆ SetBoundingBox()

void DS_DATA_ITEM_POLYGONS::SetBoundingBox ( )

Calculate the bounding box of the set polygons.

Definition at line 454 of file ds_data_item.cpp.

References m_Corners, m_maxCoord, m_minCoord, m_Orient, RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by DRAWING_SHEET_PARSER::parsePolygon().

◆ SetEnd()

void DS_DATA_ITEM::SetEnd ( double  aPosx,
double  aPosy,
enum CORNER_ANCHOR  aAnchor = RB_CORNER 
)
inlineinherited

◆ SetPage1Option()

void DS_DATA_ITEM::SetPage1Option ( PAGE_OPTION  aChoice)
inlineinherited

◆ SetStart()

void DS_DATA_ITEM::SetStart ( double  aPosx,
double  aPosy,
enum CORNER_ANCHOR  aAnchor = RB_CORNER 
)
inlineinherited

◆ SyncDrawItems()

Member Data Documentation

◆ m_Corners

std::vector<VECTOR2D> DS_DATA_ITEM_POLYGONS::m_Corners

◆ m_drawItems

◆ m_End

◆ m_IncrementLabel

◆ m_IncrementVector

◆ m_Info

◆ m_LineWidth

◆ m_maxCoord

VECTOR2D DS_DATA_ITEM_POLYGONS::m_maxCoord
private

Definition at line 293 of file ds_data_item.h.

Referenced by IsInsidePage(), and SetBoundingBox().

◆ m_minCoord

VECTOR2D DS_DATA_ITEM_POLYGONS::m_minCoord
private

Definition at line 292 of file ds_data_item.h.

Referenced by IsInsidePage(), and SetBoundingBox().

◆ m_Name

◆ m_Orient

◆ m_pageOption

PAGE_OPTION DS_DATA_ITEM::m_pageOption
protectedinherited

◆ m_polyIndexEnd

std::vector<unsigned> DS_DATA_ITEM_POLYGONS::m_polyIndexEnd
private

Definition at line 291 of file ds_data_item.h.

Referenced by CloseContour(), GetPolyCount(), GetPolyIndexEnd(), and GetPolyIndexStart().

◆ m_Pos

◆ m_RepeatCount

◆ m_type

DS_ITEM_TYPE DS_DATA_ITEM::m_type
protectedinherited

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