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_END, ARC_CENTER,
  ARC_START, ARC_MID, ARC_END
}
 
enum  CIRCLE_POINTS { CIRC_CENTER, CIRC_END, CIRC_CENTER, CIRC_END }
 
enum  RECTANGLE_POINTS { RECT_TOPLEFT, RECT_TOPRIGHT, RECT_BOTLEFT, RECT_BOTRIGHT }
 
enum  LINE_POINTS { 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_END 
ARC_CENTER 
ARC_START 
ARC_MID 
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 

Definition at line 62 of file ee_point_editor.cpp.

◆ RECTANGLE_POINTS

Enumerator
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 375 of file ee_point_editor.cpp.

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

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

Referenced by EE_POINT_EDITOR::updateItem().