KiCad PCB EDA Suite
ee_point_editor.cpp File Reference
#include <functional>
#include "ee_point_editor.h"
#include <tool/tool_manager.h>
#include <view/view_controls.h>
#include <geometry/seg.h>
#include <tools/ee_actions.h>
#include <tools/ee_selection_tool.h>
#include <bitmaps.h>
#include <sch_edit_frame.h>
#include <sch_line.h>
#include <sch_bitmap.h>
#include <sch_sheet.h>
#include <lib_edit_frame.h>
#include <lib_arc.h>
#include <lib_circle.h>
#include <lib_rectangle.h>
#include <lib_polyline.h>

Go to the source code of this file.

Classes

class  EDIT_POINTS_FACTORY
 

Enumerations

enum  ARC_POINTS {
  ARC_CENTER, ARC_START, ARC_MID, ARC_END,
  ARC_CENTER, ARC_START, ARC_END
}
 
enum  CIRCLE_POINTS { CIRC_CENTER, CIRC_END, CIRC_CENTER, CIRC_END }
 
enum  RECTANGLE_POINTS {
  RECT_TOPLEFT, RECT_TOPRIGHT, RECT_BOTLEFT, RECT_BOTRIGHT,
  RECT_TOPLEFT, RECT_TOPRIGHT, RECT_BOTLEFT, RECT_BOTRIGHT
}
 
enum  LINE_POINTS { LINE_START, LINE_END, LINE_START, LINE_END }
 

Functions

void pinEditedCorner (int editedPointIndex, int minWidth, int minHeight, VECTOR2I &topLeft, VECTOR2I &topRight, VECTOR2I &botLeft, VECTOR2I &botRight)
 

Enumeration Type Documentation

◆ ARC_POINTS

enum ARC_POINTS
Enumerator
ARC_CENTER 
ARC_START 
ARC_MID 
ARC_END 
ARC_CENTER 
ARC_START 
ARC_END 

Definition at line 47 of file ee_point_editor.cpp.

◆ CIRCLE_POINTS

Enumerator
CIRC_CENTER 
CIRC_END 
CIRC_CENTER 
CIRC_END 

Definition at line 52 of file ee_point_editor.cpp.

◆ LINE_POINTS

Enumerator
LINE_START 
LINE_END 
LINE_START 
LINE_END 

Definition at line 62 of file ee_point_editor.cpp.

◆ RECTANGLE_POINTS

Enumerator
RECT_TOPLEFT 
RECT_TOPRIGHT 
RECT_BOTLEFT 
RECT_BOTRIGHT 
RECT_TOPLEFT 
RECT_TOPRIGHT 
RECT_BOTLEFT 
RECT_BOTRIGHT 

Definition at line 57 of file ee_point_editor.cpp.

Function Documentation

◆ pinEditedCorner()

void pinEditedCorner ( int  editedPointIndex,
int  minWidth,
int  minHeight,
VECTOR2I topLeft,
VECTOR2I topRight,
VECTOR2I botLeft,
VECTOR2I botRight 
)

Definition at line 374 of file ee_point_editor.cpp.

376 {
377  switch( editedPointIndex )
378  {
379  case RECT_TOPLEFT:
380  // pin edited point within opposite corner
381  topLeft.x = std::min( topLeft.x, botRight.x - minWidth );
382  topLeft.y = std::min( topLeft.y, botRight.y - minHeight );
383 
384  // push edited point edges to adjacent corners
385  topRight.y = topLeft.y;
386  botLeft.x = topLeft.x;
387 
388  break;
389 
390  case RECT_TOPRIGHT:
391  // pin edited point within opposite corner
392  topRight.x = std::max( topRight.x, botLeft.x + minWidth );
393  topRight.y = std::min( topRight.y, botLeft.y - minHeight );
394 
395  // push edited point edges to adjacent corners
396  topLeft.y = topRight.y;
397  botRight.x = topRight.x;
398 
399  break;
400 
401  case RECT_BOTLEFT:
402  // pin edited point within opposite corner
403  botLeft.x = std::min( botLeft.x, topRight.x - minWidth );
404  botLeft.y = std::max( botLeft.y, topRight.y + minHeight );
405 
406  // push edited point edges to adjacent corners
407  botRight.y = botLeft.y;
408  topLeft.x = botLeft.x;
409 
410  break;
411 
412  case RECT_BOTRIGHT:
413  // pin edited point within opposite corner
414  botRight.x = std::max( botRight.x, topLeft.x + minWidth );
415  botRight.y = std::max( botRight.y, topLeft.y + minHeight );
416 
417  // push edited point edges to adjacent corners
418  botLeft.y = botRight.y;
419  topRight.x = botRight.x;
420 
421  break;
422  }
423 }
#define max(a, b)
Definition: auxiliary.h:86
#define min(a, b)
Definition: auxiliary.h:85

References max, min, RECT_BOTLEFT, RECT_BOTRIGHT, RECT_TOPLEFT, RECT_TOPRIGHT, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by EE_POINT_EDITOR::updateItem().