KiCad PCB EDA Suite
common_plotDXF_functions.cpp File Reference

KiCad: Common plot DXF Routines. More...

#include <fctsys.h>
#include <gr_basic.h>
#include <trigo.h>
#include <wxstruct.h>
#include <base_struct.h>
#include <class_plotter.h>
#include <macros.h>
#include <kicad_string.h>
#include <convert_basic_shapes_to_polygon.h>

Go to the source code of this file.

Functions

static wxString getDXFColorName (COLOR4D aColor)
 
bool containsNonAsciiChars (const wxString &string)
 Checks if a given string contains non-ASCII characters. More...
 

Variables

static const double DXF_OBLIQUE_ANGLE = 15
 Oblique angle for DXF native text (I don't remember if 15 degrees is the ISO value... More...
 
struct {
   const char *   name
 
   int   color
 
dxf_layer [NBCOLORS]
 
static const char * dxf_lines []
 Line types in the boilerplate DXF header. More...
 

Detailed Description

KiCad: Common plot DXF Routines.

Definition in file common_plotDXF_functions.cpp.

Function Documentation

bool containsNonAsciiChars ( const wxString &  string)

Checks if a given string contains non-ASCII characters.

FIXME: the performance of this code is really poor, but in this case it can be acceptable because the plot operation is not called very often.

Parameters
stringString to check
Returns
true if it contains some non-ASCII character, false if all characters are inside ASCII range (<=255).

Definition at line 792 of file common_plotDXF_functions.cpp.

Referenced by DXF_PLOTTER::Text().

793 {
794  for( unsigned i = 0; i < string.length(); i++ )
795  {
796  wchar_t ch = string[i];
797  if( ch > 255 )
798  return true;
799  }
800  return false;
801 }
static wxString getDXFColorName ( COLOR4D  aColor)
static

Definition at line 113 of file common_plotDXF_functions.cpp.

References KIGFX::COLOR4D::b, color, ColorFindNearest(), dxf_layer, KIGFX::COLOR4D::g, name, and KIGFX::COLOR4D::r.

Referenced by DXF_PLOTTER::Arc(), DXF_PLOTTER::Circle(), DXF_PLOTTER::PenTo(), and DXF_PLOTTER::Text().

114 {
115  EDA_COLOR_T color = ColorFindNearest( int( aColor.r*255 ),
116  int( aColor.g*255 ),
117  int( aColor.b*255 ) );
118  wxString cname( dxf_layer[color].name );
119  return cname;
120 }
EDA_COLOR_T
NOTE: EDA_COLOR_T is deprecated and is kept around for compatibility with legacy canvas.
Definition: colors.h:42
EDA_COLOR_T ColorFindNearest(const wxColour &aColor)
Find the nearest color match.
Definition: colors.cpp:96
double g
Green component.
Definition: color4d.h:287
double b
Blue component.
Definition: color4d.h:288
static const struct @36 dxf_layer[NBCOLORS]
const char * name
double r
Red component.
Definition: color4d.h:286

Variable Documentation

int color

Definition at line 62 of file common_plotDXF_functions.cpp.

Referenced by ROUTER_PREVIEW_ITEM::assignColor(), KIGFX::CAIRO_GAL::blitCursor(), KIGFX::OPENGL_GAL::blitCursor(), PCB_ONE_LAYER_SELECTOR::buildList(), SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList(), WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(), COLOR4D_PICKER_DLG::buttColorClick(), WIDGET_EESCHEMA_COLOR_CONFIG::CreateControls(), COLOR4D_PICKER_DLG::createHSVBitmap(), COLOR4D_PICKER_DLG::createRGBBitmap(), DisplayRoutingMatrix(), SCH_MARKER::Draw(), SCH_NO_CONNECT::Draw(), SCH_JUNCTION::Draw(), TEXTE_PCB::Draw(), SCH_BUS_ENTRY_BASE::Draw(), EDGE_MODULE::Draw(), SCH_LINE::Draw(), SCH_TEXT::Draw(), ZONE_CONTAINER::Draw(), SCH_FIELD::Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), KIGFX::GERBVIEW_PAINTER::draw(), DRAWSEGMENT::Draw(), KIGFX::PCB_PAINTER::draw(), LIB_ITEM::Draw(), GERBER_DRAW_ITEM::Draw(), SCH_GLOBALLABEL::Draw(), SCH_HIERLABEL::Draw(), SEGZONE::Draw(), VIA::Draw(), SCH_SHEET::Draw(), D_PAD::Draw(), drawArcWithHilight(), EDA_DRAW_PANEL::DrawAuxiliaryAxis(), ZONE_CONTAINER::DrawFilledArea(), PCB_BASE_FRAME::DrawGeneralRatsnest(), LIB_CIRCLE::drawGraphic(), LIB_POLYLINE::drawGraphic(), LIB_RECTANGLE::drawGraphic(), LIB_BEZIER::drawGraphic(), LIB_TEXT::drawGraphic(), LIB_ARC::drawGraphic(), LIB_FIELD::drawGraphic(), EDA_DRAW_PANEL::DrawGridAxis(), LIB_PIN::DrawPinSymbol(), drawPlacementRoutingMatrix(), DrawSegment(), ZONE_CONTAINER::DrawWhileCreateOutline(), EDA_DRAW_FRAME::DrawWorkSheet(), WS_DRAW_ITEM_POLYGON::DrawWsItem(), ELAYER::ELAYER(), EDA_MSG_PANEL::erase(), export_vrml_pcbtext(), BRDITEMS_PLOTTER::getColor(), KIGFX::GAL::getCursorColor(), LIB_FIELD::GetDefaultColor(), getDXFColorName(), CINFO3D_VISU::GetLayerColor(), getOptimalModulePlacement(), GERBVIEW_FRAME::GetVisibleElementColor(), SCH_LEGACY_PLUGIN::loadWire(), PL_EDITOR_FRAME::Locate(), ZONE_CREATE_HELPER::OnFirstPoint(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::onPaintPolyPanel(), DIALOG_PAD_PROPERTIES::OnPaintShowPanel(), KIGFX::VIEW::updateItemsColor::operator()(), PlacePad(), LIB_TEXT::Plot(), SCH_FIELD::Plot(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotDimension(), PlotSilkScreen(), PlotStandardLayer(), LIB_PIN::PlotSymbol(), BRDITEMS_PLOTTER::PlotTextePcb(), PCB_EDIT_FRAME::PrintPage(), GERBER_LAYER_WIDGET::ReFillRender(), C3D_RENDER_RAYTRACING::rt_final_color(), DXF_PLOTTER::SetColor(), SELECT_COPPER_LAYERS_PAIR_DIALOG::SetGridCursor(), EDA_MSG_PANEL::showItem(), ShowNewTrackWhenMovingCursor(), DXF_PLOTTER::StartPlot(), TraceSegmentPcb(), TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(), EDA_TEXT::TransformTextShapeToSegmentList(), KIGFX::VIEW::updateItemColor(), PNS_TUNE_STATUS_POPUP::UpdateStatus(), KIGFX::RATSNEST_VIEWITEM::ViewDraw(), and KIGFX::WORKSHEET_VIEWITEM::ViewDraw().

const { ... } dxf_layer[NBCOLORS]
const char* dxf_lines[]
static
Initial value:

Line types in the boilerplate DXF header.

The element indices correspond to the eeschema line types.

Definition at line 102 of file common_plotDXF_functions.cpp.

Referenced by DXF_PLOTTER::PenTo().

const double DXF_OBLIQUE_ANGLE = 15
static

Oblique angle for DXF native text (I don't remember if 15 degrees is the ISO value...

it looks nice anyway)

Definition at line 43 of file common_plotDXF_functions.cpp.

Referenced by DXF_PLOTTER::StartPlot(), and DXF_PLOTTER::Text().

const char* name

Definition at line 61 of file common_plotDXF_functions.cpp.

Referenced by NETCLASSES::Add(), CMP_TREE_MODEL_ADAPTER::AddAliasList(), DXF2BRD_CONVERTER::addLayer(), AddMenusForComponentField(), DIALOG_SIGNAL_LIST::addSelectionToPlotFrame(), SCH_EDIT_FRAME::AppendSchematic(), AskLoadBoardFileName(), PGM_BASE::AskUserForPreferredEditor(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), FOOTPRINT_VIEWER_FRAME::ClickOnLibList(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField(), GERBER_JOBFILE_WRITER::CreateJobFile(), KIWAY::dso_search_path(), WIDGET_HOTKEY_LIST::EditItem(), PCB_EDIT_FRAME::ExportToSpecctra(), FOOTPRINT_FILTER::ITERATOR::FootprintFilterMatch(), LIB_TABLE::FormatOptions(), DSN::SPECCTRA_DB::FromBOARD(), ACTION_PLUGINS::GetAction(), WORKSHEET_DATAITEM::GetClassName(), PROJECT_TEMPLATE::GetDestinationFiles(), GERBER_FILE_IMAGE_LIST::GetDisplayName(), getDXFColorName(), ALIAS_INFO_GENERATOR::GetHtmlFieldRow(), GBR_LAYER_BOX_SELECTOR::GetLayerName(), LIB_FIELD::GetName(), BOARD_CONNECTED_ITEM::GetNetClassName(), DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Pin::GetString(), TOOL_MANAGER::GetTool(), LIB_MANAGER::GetUniqueComponentName(), LIB_MANAGER::GetUniqueLibraryName(), FOOTPRINT_WIZARDS::GetWizard(), PCB_EDIT_FRAME::ImportSpecctraSession(), DIALOG_DESIGN_RULES::InitDialogRules(), DIALOG_FOOTPRINT_WIZARD_LIST::initLists(), KIWAY_PLAYER::kiway_express(), GPCB_FPL_CACHE::Load(), SCH_LEGACY_PLUGIN::loadComponent(), LEGACY_NETLIST_READER::loadComponent(), EAGLE_PLUGIN::loadElements(), SCH_LEGACY_PLUGIN_CACHE::loadField(), SCH_LEGACY_PLUGIN::loadJunction(), DIALOG_SPICE_MODEL::loadLibrary(), SCH_EAGLE_PLUGIN::loadLibrary(), SCH_LEGACY_PLUGIN::loadNoConnect(), SCH_LEGACY_PLUGIN_CACHE::loadPart(), SCH_LEGACY_PLUGIN_CACHE::loadPin(), SCH_EAGLE_PLUGIN::loadSchematic(), SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname(), SIM_PLOT_FRAME::loadWorkbook(), WORKSHEET_LAYOUT::MakeFullFileName(), DSN::SPECCTRA_DB::makePADSTACK(), DIALOG_FP_PLUGIN_OPTIONS::makeResult(), DSN::SPECCTRA_DB::makeVia(), DIALOG_BOM::OnAddPlugin(), LIB_EDIT_FRAME::OnCreateNewPart(), TREE_PROJECT_FRAME::OnExpand(), APP_SINGLE_TOP::OnInit(), PGM_SINGLE_TOP::OnPgmInit(), APP_SINGLE_TOP::OnRun(), APP_KICAD::OnRun(), ERULES::parse(), KICAD_NETLIST_PARSER::parseComponent(), PCB_PARSER::parseLayer(), PCB_PARSER::parseLayers(), PCB_PARSER::parseMODULE_unchecked(), KICAD_NETLIST_PARSER::parseNet(), PCB_PARSER::parseNETINFO_ITEM(), LIB_TABLE::ParseOptions(), GERBER_JOBFILE_READER::parseTJLayerString(), SGSHAPE::ReadCache(), S3D::ReadCache(), SGFACESET::ReadCache(), SCENEGRAPH::ReadCache(), S3D::ReadTag(), LIB_VIEW_FRAME::ReCreateListLib(), FOOTPRINT_WIZARD_FRAME::ReCreatePageList(), FOOTPRINT_WIZARD_FRAME::ReCreateParameterList(), TREE_PROJECT_FRAME::ReCreateTreePrj(), TREEPROJECT_ITEM::Rename(), SYMBOL_LIB_TABLE::SaveSymbol(), SCH_BASE_FRAME::SelectLibraryFromList(), ABOUT_APP_INFO::SetAppName(), TREEPROJECT_ITEM::SetFileName(), KIWAY_HOLDER::SetKiway(), mpLayer::SetName(), GERBER_DRAW_ITEM::ShowGBRShape(), DXF_PLOTTER::StartPlot(), LIB_MANAGER_ADAPTER::Sync(), DIALOG_LAYERS_SETUP::testLayerNames(), DLG_SELECT_3DMODEL::TransferDataFromWindow(), DIALOG_ENV_VAR_SINGLE::TransferDataFromWindow(), DIALOG_LAYERS_SETUP::TransferDataFromWindow(), NETLIST_DIALOG::UserNetlistTypeName(), and LIB_MANAGER::ValidateName().