KiCad PCB EDA Suite
dialog_dxf_import.cpp File Reference

Dialog to import a dxf file on a given board layer. More...

#include <dialog_dxf_import.h>
#include <kiface_i.h>
#include <convert_to_biu.h>
#include <pcb_layer_box_selector.h>
#include <wildcards_and_files_ext.h>
#include <class_board.h>
#include <class_module.h>
#include <class_edge_mod.h>
#include <class_text_mod.h>
#include <class_pcb_text.h>

Go to the source code of this file.

Macros

#define DXF_IMPORT_LAYER_OPTION_KEY   "DxfImportBrdLayer"
 
#define DXF_IMPORT_COORD_ORIGIN_KEY   "DxfImportCoordOrigin"
 
#define DXF_IMPORT_LAST_FILE_KEY   "DxfImportLastFile"
 
#define DXF_IMPORT_IMPORT_UNITS_KEY   "DxfImportOffsetUnits"
 
#define DXF_IMPORT_IMPORT_OFFSET_X_KEY   "DxfImportOffsetX"
 
#define DXF_IMPORT_IMPORT_OFFSET_Y_KEY   "DxfImportOffsetY"
 
#define DXF_IMPORT_LINEWIDTH_UNITS_KEY   "DxfImportLineWidthUnits"
 
#define DXF_IMPORT_LINEWIDTH_KEY   "DxfImportLineWidth"
 

Functions

bool InvokeDXFDialogBoardImport (PCB_BASE_FRAME *aCaller)
 
bool InvokeDXFDialogModuleImport (PCB_BASE_FRAME *aCaller, MODULE *aModule)
 

Detailed Description

Dialog to import a dxf file on a given board layer.

Definition in file dialog_dxf_import.cpp.

Macro Definition Documentation

#define DXF_IMPORT_COORD_ORIGIN_KEY   "DxfImportCoordOrigin"
#define DXF_IMPORT_IMPORT_OFFSET_X_KEY   "DxfImportOffsetX"
#define DXF_IMPORT_IMPORT_OFFSET_Y_KEY   "DxfImportOffsetY"
#define DXF_IMPORT_IMPORT_UNITS_KEY   "DxfImportOffsetUnits"
#define DXF_IMPORT_LAST_FILE_KEY   "DxfImportLastFile"
#define DXF_IMPORT_LAYER_OPTION_KEY   "DxfImportBrdLayer"
#define DXF_IMPORT_LINEWIDTH_KEY   "DxfImportLineWidth"
#define DXF_IMPORT_LINEWIDTH_UNITS_KEY   "DxfImportLineWidthUnits"

Function Documentation

bool InvokeDXFDialogBoardImport ( PCB_BASE_FRAME aCaller)

Definition at line 322 of file dialog_dxf_import.cpp.

References BOARD::Add(), PCB_BASE_FRAME::GetBoard(), DIALOG_DXF_IMPORT::GetImportedItems(), PCB_BASE_FRAME::OnModify(), PICKED_ITEMS_LIST::PushItem(), PCB_BASE_FRAME::SaveCopyInUndoList(), and UR_NEW.

323 {
324  DIALOG_DXF_IMPORT dlg( aCaller );
325  bool success = ( dlg.ShowModal() == wxID_OK );
326 
327  if( success )
328  {
329  const std::list<BOARD_ITEM*>& list = dlg.GetImportedItems();
330  PICKED_ITEMS_LIST picklist;
331  BOARD* board = aCaller->GetBoard();
332 
333  std::list<BOARD_ITEM*>::const_iterator it, itEnd;
334  for( it = list.begin(), itEnd = list.end(); it != itEnd; ++it )
335  {
336  BOARD_ITEM* item = *it;
337  board->Add( item );
338 
339  ITEM_PICKER itemWrapper( item, UR_NEW );
340  picklist.PushItem( itemWrapper );
341  }
342 
343  aCaller->SaveCopyInUndoList( picklist, UR_NEW, wxPoint( 0, 0 ) );
344  aCaller->OnModify();
345  }
346 
347  return success;
348 }
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
BOARD * GetBoard() const
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
Adds an item to the container.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
virtual void SaveCopyInUndoList(BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))=0
Function SaveCopyInUndoList (virtual pure) Creates a new entry in undo list of commands.
bool InvokeDXFDialogModuleImport ( PCB_BASE_FRAME aCaller,
MODULE aModule 
)

Definition at line 351 of file dialog_dxf_import.cpp.

References MODULE::Add(), DIALOG_DXF_IMPORT::GetImportedItems(), PCB_BASE_FRAME::OnModify(), PCB_BASE_FRAME::SaveCopyInUndoList(), and UR_CHANGED.

352 {
353  wxASSERT( aModule );
354 
355  DIALOG_DXF_IMPORT dlg( aCaller, true );
356  bool success = ( dlg.ShowModal() == wxID_OK );
357 
358  if( success )
359  {
360  const std::list<BOARD_ITEM*>& list = dlg.GetImportedItems();
361 
362  aCaller->SaveCopyInUndoList( aModule, UR_CHANGED );
363  aCaller->OnModify();
364 
365  std::list<BOARD_ITEM*>::const_iterator it, itEnd;
366 
367  for( it = list.begin(), itEnd = list.end(); it != itEnd; ++it )
368  {
369  aModule->Add( *it );
370  }
371  }
372 
373  return success;
374 }
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
>
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
virtual void SaveCopyInUndoList(BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))=0
Function SaveCopyInUndoList (virtual pure) Creates a new entry in undo list of commands.