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 <plot_common.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]
 

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 712 of file common_plotDXF_functions.cpp.

Referenced by DXF_PLOTTER::Text().

713 {
714  for( unsigned i = 0; i < string.length(); i++ )
715  {
716  wchar_t ch = string[i];
717  if( ch > 255 )
718  return true;
719  }
720  return false;
721 }
static wxString getDXFColorName ( COLOR4D  aColor)
static

Definition at line 100 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().

101 {
102  EDA_COLOR_T color = ColorFindNearest( int( aColor.r*255 ),
103  int( aColor.g*255 ),
104  int( aColor.b*255 ) );
105  wxString cname( dxf_layer[color].name );
106  return cname;
107 }
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:282
static const struct @44 dxf_layer[NBCOLORS]
double b
Blue component.
Definition: color4d.h:283
const char * name
double r
Red component.
Definition: color4d.h:281

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(), WIDGET_EESCHEMA_COLOR_CONFIG::CreateControls(), DIALOG_SVG_PRINT::CreateSVGFile(), DisplayRoutingMatrix(), SCH_MARKER::Draw(), SCH_NO_CONNECT::Draw(), SCH_JUNCTION::Draw(), TEXTE_PCB::Draw(), SCH_BUS_ENTRY_BASE::Draw(), SCH_LINE::Draw(), EDGE_MODULE::Draw(), RATSNEST_ITEM::Draw(), ZONE_CONTAINER::Draw(), SCH_TEXT::Draw(), SCH_FIELD::Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), DRAWSEGMENT::Draw(), KIGFX::PCB_PAINTER::draw(), GERBER_DRAW_ITEM::Draw(), LIB_ITEM::Draw(), SCH_GLOBALLABEL::Draw(), D_PAD::Draw(), SCH_HIERLABEL::Draw(), SEGZONE::Draw(), VIA::Draw(), SCH_SHEET::Draw(), drawArcWithHilight(), EDA_DRAW_PANEL::DrawAuxiliaryAxis(), ZONE_CONTAINER::DrawFilledArea(), 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(), BOARD::GetVisibleElementColor(), PL_EDITOR_FRAME::Locate(), ZONE_CREATE_HELPER::OnFirstPoint(), 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(), 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 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(), AskLoadBoardFileName(), PGM_BASE::AskUserForPreferredEditor(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), FOOTPRINT_VIEWER_FRAME::ClickOnLibList(), Contributor::Contributor(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField(), LIB_EDIT_FRAME::CreateNewLibraryPart(), LIB_EDIT_FRAME::DeleteOnePart(), KIWAY::dso_search_path(), EATTR::EATTR(), WIDGET_HOTKEY_LIST::EditItem(), EELEMENT::EELEMENT(), ELAYER::ELAYER(), EPAD::EPAD(), ESMD::ESMD(), PCB_EDIT_FRAME::ExportToSpecctra(), FOOTPRINT_FILTER::ITERATOR::FootprintFilterMatch(), LIB_TABLE::FormatOptions(), DSN::SPECCTRA_DB::FromBOARD(), ACTION_PLUGINS::GetAction(), WORKSHEET_DATAITEM::GetClassName(), LIB_EDIT_FRAME::GetCurLib(), LIB_EDIT_FRAME::GetCurPart(), GERBER_FILE_IMAGE_LIST::GetDisplayName(), getDXFColorName(), ALIAS_INFO_GENERATOR::GetHtmlFieldRow(), GBR_LAYER_BOX_SELECTOR::GetLayerName(), LIB_FIELD::GetName(), BOARD_CONNECTED_ITEM::GetNetClassName(), D_PAD::GetPadName(), DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Pin::GetString(), TOOL_MANAGER::GetTool(), FOOTPRINT_WIZARDS::GetWizard(), PCB_EDIT_FRAME::ImportSpecctraSession(), DIALOG_DESIGN_RULES::InitDialogRules(), DIALOG_FOOTPRINT_WIZARD_LIST::initLists(), KIWAY_PLAYER::kiway_express(), SCH_NO_CONNECT::Load(), SCH_JUNCTION::Load(), FP_CACHE::Load(), SCH_SHEET_PIN::Load(), GPCB_FPL_CACHE::Load(), SCH_LEGACY_PLUGIN::loadComponent(), LEGACY_NETLIST_READER::loadComponent(), EAGLE_PLUGIN::loadElements(), SCH_LEGACY_PLUGIN_CACHE::loadField(), SCH_LEGACY_PLUGIN::loadJunction(), SCH_LEGACY_PLUGIN::loadNoConnect(), SCH_LEGACY_PLUGIN_CACHE::loadPart(), SCH_LEGACY_PLUGIN_CACHE::loadPin(), 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(), TREE_PROJECT_FRAME::OnExpand(), APP_SINGLE_TOP::OnInit(), DIALOG_LAYERS_SETUP::OnOkButtonClick(), 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(), SGSHAPE::ReadCache(), S3D::ReadCache(), SGFACESET::ReadCache(), SCENEGRAPH::ReadCache(), S3D::ReadTag(), FOOTPRINT_WIZARD_FRAME::ReCreatePageList(), FOOTPRINT_WIZARD_FRAME::ReCreateParameterList(), TREE_PROJECT_FRAME::ReCreateTreePrj(), TREEPROJECT_ITEM::Rename(), SYMBOL_LIB_TABLE::SaveSymbol(), AboutAppInfo::SetAppName(), TREEPROJECT_ITEM::SetFileName(), KIWAY_HOLDER::SetKiway(), mpLayer::SetName(), GERBER_DRAW_ITEM::ShowGBRShape(), DXF_PLOTTER::StartPlot(), DIALOG_LAYERS_SETUP::testLayerNames(), DIALOG_ENV_VAR_CONFIG::TransferDataFromWindow(), DLG_SELECT_3DMODEL::TransferDataFromWindow(), and NETLIST_DIALOG::UserNetlistTypeName().