KiCad PCB EDA Suite
PNS::CORNER_COUNT_LIMIT_CONSTRAINT Class Reference

#include <pns_optimizer.h>

Inheritance diagram for PNS::CORNER_COUNT_LIMIT_CONSTRAINT:
PNS::OPT_CONSTRAINT

Public Member Functions

 CORNER_COUNT_LIMIT_CONSTRAINT (NODE *aWorld, int aMinCorners, int aMaxCorners, int aAngleMask)
 
virtual bool Check (int aVertex1, int aVertex2, const LINE *aOriginLine, const SHAPE_LINE_CHAIN &aCurrentPath, const SHAPE_LINE_CHAIN &aReplacement) override
 
int GetPriority () const
 
void SetPriority (int aPriority)
 

Protected Attributes

NODEm_world
 
int m_priority
 

Private Attributes

int m_minCorners
 
int m_maxCorners
 
int m_angleMask
 

Detailed Description

Definition at line 333 of file pns_optimizer.h.

Constructor & Destructor Documentation

◆ CORNER_COUNT_LIMIT_CONSTRAINT()

PNS::CORNER_COUNT_LIMIT_CONSTRAINT::CORNER_COUNT_LIMIT_CONSTRAINT ( NODE aWorld,
int  aMinCorners,
int  aMaxCorners,
int  aAngleMask 
)
inline

Definition at line 336 of file pns_optimizer.h.

337  :
338  OPT_CONSTRAINT( aWorld ),
339  m_minCorners( aMinCorners ),
340  m_maxCorners( aMaxCorners ),
341  m_angleMask( aAngleMask )
342  {
343  };
OPT_CONSTRAINT(NODE *aWorld)

Member Function Documentation

◆ Check()

bool PNS::CORNER_COUNT_LIMIT_CONSTRAINT::Check ( int  aVertex1,
int  aVertex2,
const LINE aOriginLine,
const SHAPE_LINE_CHAIN aCurrentPath,
const SHAPE_LINE_CHAIN aReplacement 
)
overridevirtual

Implements PNS::OPT_CONSTRAINT.

Definition at line 268 of file pns_optimizer.cpp.

271 {
272  LINE newPath( *aOriginLine, aCurrentPath );
273  newPath.Line().Replace( aVertex1, aVertex2, aReplacement );
274  newPath.Line().Simplify();
275  int cc = newPath.CountCorners( m_angleMask );
276 
277  if( cc >= m_minCorners && cc <= m_maxCorners )
278  return true;
279 
280  return false;
281 }

References PNS::LINE::CountCorners(), PNS::LINE::Line(), m_angleMask, m_maxCorners, m_minCorners, SHAPE_LINE_CHAIN::Replace(), and SHAPE_LINE_CHAIN::Simplify().

◆ GetPriority()

int PNS::OPT_CONSTRAINT::GetPriority ( ) const
inlineinherited

Definition at line 233 of file pns_optimizer.h.

233 { return m_priority; }

References PNS::OPT_CONSTRAINT::m_priority.

◆ SetPriority()

void PNS::OPT_CONSTRAINT::SetPriority ( int  aPriority)
inlineinherited

Definition at line 234 of file pns_optimizer.h.

234 { m_priority = aPriority; }

References PNS::OPT_CONSTRAINT::m_priority.

Member Data Documentation

◆ m_angleMask

int PNS::CORNER_COUNT_LIMIT_CONSTRAINT::m_angleMask
private

Definition at line 352 of file pns_optimizer.h.

Referenced by Check().

◆ m_maxCorners

int PNS::CORNER_COUNT_LIMIT_CONSTRAINT::m_maxCorners
private

Definition at line 351 of file pns_optimizer.h.

Referenced by Check().

◆ m_minCorners

int PNS::CORNER_COUNT_LIMIT_CONSTRAINT::m_minCorners
private

Definition at line 350 of file pns_optimizer.h.

Referenced by Check().

◆ m_priority

int PNS::OPT_CONSTRAINT::m_priority
protectedinherited

◆ m_world

NODE* PNS::OPT_CONSTRAINT::m_world
protectedinherited

Definition at line 237 of file pns_optimizer.h.

Referenced by PNS::KEEP_TOPOLOGY_CONSTRAINT::Check().


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