KiCad PCB EDA Suite
pl_point_editor.cpp File Reference
#include <functional>
#include <tool/tool_manager.h>
#include <tool/actions.h>
#include <view/view_controls.h>
#include <gal/graphics_abstraction_layer.h>
#include <geometry/seg.h>
#include <confirm.h>
#include <bitmaps.h>
#include <status_popup.h>
#include <drawing_sheet/ds_draw_item.h>
#include <drawing_sheet/ds_data_item.h>
#include <widgets/progress_reporter.h>
#include "pl_editor_frame.h"
#include "pl_editor_id.h"
#include "pl_point_editor.h"
#include "properties_frame.h"
#include "tools/pl_actions.h"
#include "tools/pl_selection_tool.h"

Go to the source code of this file.

Classes

class  EDIT_POINTS_FACTORY
 

Enumerations

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

◆ LINE_POINTS

Enumerator
LINE_START 
LINE_END 
LINE_START 
LINE_END 

Definition at line 54 of file pl_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 49 of file pl_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 261 of file pl_point_editor.cpp.

263 {
264  switch( editedPointIndex )
265  {
266  case RECT_TOPLEFT:
267  // pin edited point within opposite corner
268  topLeft.x = std::min( topLeft.x, botRight.x - minWidth );
269  topLeft.y = std::min( topLeft.y, botRight.y - minHeight );
270 
271  // push edited point edges to adjacent corners
272  topRight.y = topLeft.y;
273  botLeft.x = topLeft.x;
274 
275  break;
276 
277  case RECT_TOPRIGHT:
278  // pin edited point within opposite corner
279  topRight.x = std::max( topRight.x, botLeft.x + minWidth );
280  topRight.y = std::min( topRight.y, botLeft.y - minHeight );
281 
282  // push edited point edges to adjacent corners
283  topLeft.y = topRight.y;
284  botRight.x = topRight.x;
285 
286  break;
287 
288  case RECT_BOTLEFT:
289  // pin edited point within opposite corner
290  botLeft.x = std::min( botLeft.x, topRight.x - minWidth );
291  botLeft.y = std::max( botLeft.y, topRight.y + minHeight );
292 
293  // push edited point edges to adjacent corners
294  botRight.y = botLeft.y;
295  topLeft.x = botLeft.x;
296 
297  break;
298 
299  case RECT_BOTRIGHT:
300  // pin edited point within opposite corner
301  botRight.x = std::max( botRight.x, topLeft.x + minWidth );
302  botRight.y = std::max( botRight.y, topLeft.y + minHeight );
303 
304  // push edited point edges to adjacent corners
305  botLeft.y = botRight.y;
306  topRight.x = botRight.x;
307 
308  break;
309  }
310 }

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

Referenced by PL_POINT_EDITOR::updateItem().