KiCad PCB EDA Suite
DXF_plotter.cpp File Reference

Kicad: specialized plotter for DXF files format. More...

#include <fctsys.h>
#include <trigo.h>
#include <eda_base_frame.h>
#include <base_struct.h>
#include <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 const char * getDXFLineType (PLOT_DASH_TYPE aType)
 
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: specialized plotter for DXF files format.

Definition in file DXF_plotter.cpp.

Function Documentation

◆ containsNonAsciiChars()

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 854 of file DXF_plotter.cpp.

855 {
856  for( unsigned i = 0; i < string.length(); i++ )
857  {
858  wchar_t ch = string[i];
859  if( ch > 255 )
860  return true;
861  }
862  return false;
863 }

Referenced by DXF_PLOTTER::Text().

◆ getDXFColorName()

static wxString getDXFColorName ( COLOR4D  aColor)
static

Definition at line 119 of file DXF_plotter.cpp.

120 {
121  EDA_COLOR_T color = COLOR4D::FindNearestLegacyColor( int( aColor.r * 255 ),
122  int( aColor.g * 255 ),
123  int( aColor.b * 255 ) );
124  wxString cname( dxf_layer[color].name );
125  return cname;
126 }
int color
Definition: DXF_plotter.cpp:61
double g
Green component.
Definition: color4d.h:367
static const struct @11 dxf_layer[NBCOLORS]
double b
Blue component.
Definition: color4d.h:368
EDA_COLOR_T
Legacy color enumeration.
Definition: color4d.h:41
const char * name
Definition: DXF_plotter.cpp:60
double r
Red component.
Definition: color4d.h:366

References KIGFX::COLOR4D::b, color, 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().

◆ getDXFLineType()

static const char* getDXFLineType ( PLOT_DASH_TYPE  aType)
static

Definition at line 97 of file DXF_plotter.cpp.

98 {
99  switch( aType )
100  {
103  return "CONTINUOUS";
105  return "DASHED";
106  case PLOT_DASH_TYPE::DOT:
107  return "DOTTED";
109  return "DASHDOT";
110  default:
111  wxFAIL_MSG( "Unhandled PLOT_DASH_TYPE" );
112  return "CONTINUOUS";
113  }
114 }

References DASH, DASHDOT, DEFAULT, DOT, and SOLID.

Referenced by DXF_PLOTTER::PenTo().

Variable Documentation

◆ color

int color

Definition at line 61 of file DXF_plotter.cpp.

Referenced by GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), PANEL_SETUP_NETCLASSES::addNet(), EDA_DRAW_FRAME::AppendMsgPanel(), ROUTER_PREVIEW_ITEM::assignColor(), KIGFX::CAIRO_GAL_BASE::blitCursor(), KIGFX::OPENGL_GAL::blitCursor(), PCB_ONE_LAYER_SELECTOR::buildList(), SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList(), DIALOG_COLOR_PICKER::buttColorClick(), DIALOG_COLOR_PICKER::createHSVBitmap(), DIALOG_COLOR_PICKER::createRGBBitmap(), PANEL_SETUP_BOARD_STACKUP::createRowData(), PANEL_COLOR_SETTINGS::createSwatch(), GRID_CELL_COLOR_RENDERER::Draw(), KIGFX::SCH_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawArcWithAngleHighlight(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawCircle(), ELAYER::ELAYER(), EDA_MSG_PANEL::erase(), export_vrml_pcbtext(), JSON_SETTINGS::fromLegacyColor(), SIM_PLOT_PANEL::generateColor(), BRDITEMS_PLOTTER::getColor(), getColor(), PANEL_SETUP_BOARD_STACKUP::getColorIconItem(), KIGFX::GAL::getCursorColor(), getDXFColorName(), BOARD_ADAPTER::GetLayerColor(), KIGFX::SCH_PAINTER::getRenderColor(), GERBVIEW_FRAME::GetVisibleElementColor(), SCH_LEGACY_PLUGIN::loadWire(), EDA_3D_VIEWER_SETTINGS::MigrateFromLegacy(), PANEL_SETUP_BOARD_STACKUP::onColorSelected(), ZONE_CREATE_HELPER::OnFirstPoint(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::onPaintPolyPanel(), KIGFX::VIEW::updateItemsColor::operator()(), SCH_SEXPR_PARSER::parseFill(), SCH_SEXPR_PARSER::parseJunction(), SCH_SEXPR_PARSER::parseStroke(), AR_MATRIX::PlacePad(), LIB_TEXT::Plot(), SCH_JUNCTION::Plot(), SCH_BUS_ENTRY_BASE::Plot(), LIB_FIELD::Plot(), SCH_FIELD::Plot(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotDimension(), PlotStandardLayer(), LIB_PIN::PlotSymbol(), BRDITEMS_PLOTTER::PlotTextePcb(), LIB_POLYLINE::print(), LIB_RECTANGLE::print(), LIB_TEXT::print(), LIB_ARC::print(), SCH_JUNCTION::Print(), LIB_FIELD::print(), SCH_NO_CONNECT::Print(), SCH_BUS_ENTRY_BASE::Print(), LIB_BEZIER::print(), LIB_CIRCLE::print(), SCH_FIELD::Print(), SCH_LINE::Print(), GERBER_DRAW_ITEM::Print(), SCH_TEXT::Print(), SCH_GLOBALLABEL::Print(), SCH_HIERLABEL::Print(), SCH_SHEET::Print(), LIB_PIN::PrintPinElectricalTypeName(), LIB_PIN::PrintPinSymbol(), WS_DRAW_ITEM_LINE::PrintWsItem(), WS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem(), WS_DRAW_ITEM_RECT::PrintWsItem(), processFace(), processShell(), GERBER_LAYER_WIDGET::ReFill(), GERBER_LAYER_WIDGET::ReFillRender(), C3D_RENDER_RAYTRACING::rt_final_color(), PANEL_EESCHEMA_COLOR_SETTINGS::saveCurrentTheme(), PSLIKE_PLOTTER::SetColor(), SVG_PLOTTER::SetColor(), DXF_PLOTTER::SetColor(), EDA_MSG_PANEL::showItem(), DXF_PLOTTER::StartPlot(), EDA_3D_VIEWER::SynchroniseColoursWithBoard(), PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard(), AR_MATRIX::traceArc(), AR_MATRIX::traceCircle(), AR_MATRIX::traceFilledCircle(), AR_MATRIX::TraceFilledRectangle(), AR_MATRIX::TraceSegmentPcb(), PANEL_SETUP_BOARD_STACKUP::transferDataFromUIToStackup(), TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(), EDA_TEXT::TransformTextShapeToSegmentList(), KIGFX::VIEW::UpdateAllLayersColor(), KIGFX::VIEW::updateItemColor(), and KIGFX::RATSNEST_VIEWITEM::ViewDraw().

◆ dxf_layer

const { ... } dxf_layer[NBCOLORS]

◆ DXF_OBLIQUE_ANGLE

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 42 of file DXF_plotter.cpp.

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

◆ name

const char* name

Definition at line 60 of file DXF_plotter.cpp.

Referenced by NETCLASSES::Add(), GERBER_JOBFILE_WRITER::addJSONFilesAttributes(), GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), DXF_IMPORT_PLUGIN::addLayer(), PROPERTY_MANAGER::AddProperty(), DIALOG_SIGNAL_LIST::addSignalToPlotFrame(), SCH_SEXPR_PLUGIN_CACHE::AddSymbol(), SCH_LEGACY_PLUGIN_CACHE::AddSymbol(), AskLoadBoardFileName(), PGM_BASE::AskUserForPreferredEditor(), BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS(), BOOST_AUTO_TEST_CASE(), CONNECTION_GRAPH::buildConnectionGraph(), PART_LIBS::CacheName(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), FOOTPRINT_VIEWER_FRAME::ClickOnLibList(), PCB_EXPR_UCODE::createFuncCall(), LIB_EDIT_FRAME::CreateNewPart(), PANEL_MODEDIT_COLOR_SETTINGS::createSwatches(), PANEL_PCBNEW_COLOR_SETTINGS::createSwatches(), PANEL_EESCHEMA_COLOR_SETTINGS::createSwatches(), KIWAY::dso_search_path(), WIDGET_HOTKEY_LIST::EditItem(), ERC_SETTINGS::ERC_SETTINGS(), CONNECTION_GRAPH::ercCheckLabels(), CONNECTION_GRAPH::ercCheckNoConnects(), FindStream(), FOOTPRINT_FILTER::ITERATOR::FootprintFilterMatch(), LIB_TABLE::FormatOptions(), GERBER_JOBFILE_READER::formatStringFromJSON(), DSN::SPECCTRA_DB::FromBOARD(), FOOTPRINT_INFO_GENERATOR::GenerateHtml(), PCB_EXPR_BUILTIN_FUNCTIONS::Get(), ACTION_PLUGINS::GetAction(), DIALOG_BUS_MANAGER::getAliasDisplayText(), HOTKEY_STORE::GetAppName(), WS_DATA_ITEM::GetClassName(), SCH_PIN::GetDefaultNetName(), PROJECT_TEMPLATE::GetDestinationFiles(), GERBER_FILE_IMAGE_LIST::GetDisplayName(), getDXFColorName(), GetFootprintLibraries(), X3DPARSER::getGroupingNodes(), FOOTPRINT_INFO_GENERATOR::GetHtmlFieldRow(), mpWindow::GetLayerByName(), GBR_LAYER_BOX_SELECTOR::getLayerName(), NETLIST_OBJECT::GetPinNameText(), TOOL_MANAGER::GetTool(), LIB_MANAGER::GetUniqueLibraryName(), FOOTPRINT_WIZARD_LIST::GetWizard(), PCB_EDITOR_CONTROL::ImportSpecctraSession(), IncrementLabelMember(), DIALOG_FOOTPRINT_WIZARD_LIST::initLists(), mpWindow::IsLayerVisible(), KiROUND(), SCH_EDIT_FRAME::KiwayMailIn(), X3DPARSER::Load(), GPCB_FPL_CACHE::Load(), SCH_LEGACY_PLUGIN::loadComponent(), LEGACY_NETLIST_READER::loadComponent(), EAGLE_PLUGIN::loadElements(), BOARD_DESIGN_SETTINGS::LoadFromFile(), SCH_LEGACY_PLUGIN::loadJunction(), DIALOG_SPICE_MODEL::loadLibrary(), SCH_EAGLE_PLUGIN::loadLibrary(), SCH_LEGACY_PLUGIN::loadNoConnect(), SCH_LEGACY_PLUGIN_CACHE::LoadPart(), SCH_EDIT_FRAME::LoadSheetFromFile(), SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname(), SIM_PLOT_FRAME::loadWorkbook(), WS_DATA_MODEL::MakeFullFileName(), DSN::SPECCTRA_DB::makePADSTACK(), DSN::SPECCTRA_DB::makeVia(), PCB_CALCULATOR_SETTINGS::MigrateFromLegacy(), ModuleWithPads(), mpFX::mpFX(), mpFXY::mpFXY(), mpFY::mpFY(), mpProfile::mpProfile(), mpScaleXBase::mpScaleXBase(), mpScaleY::mpScaleY(), mpText::mpText(), NET_SETTINGS::NET_SETTINGS(), DIALOG_BOM::OnAddGenerator(), DIALOG_BUS_MANAGER::OnAddSignal(), PCB_CALCULATOR_FRAME::OnEditRegulator(), TREE_PROJECT_FRAME::OnExpand(), APP_SINGLE_TOP::OnInit(), PGM_SINGLE_TOP::OnPgmInit(), PCB_CALCULATOR_FRAME::OnRegulatorSelection(), PCB_CALCULATOR_FRAME::OnRemoveRegulator(), APP_SINGLE_TOP::OnRun(), APP_KICAD::OnRun(), DIALOG_PAGES_SETTINGS::OnWksFileSelection(), ERULES::parse(), PCB_PARSER::parseBoardStackup(), ALTIUM_PCB::ParseClasses6Data(), KICAD_NETLIST_PARSER::parseComponent(), BOM_CFG_PARSER::parseGenerator(), PCB_PARSER::parseLayer(), PCB_PARSER::parseLayers(), PCB_PARSER::parseMODULE_unchecked(), KICAD_NETLIST_PARSER::parseNet(), PCB_PARSER::parseNETINFO_ITEM(), LIB_TABLE::ParseOptions(), SCH_SEXPR_PARSER::parseProperty(), PCB_CALCULATOR_DATAFILE_PARSER::ParseRegulatorDescr(), SCH_SEXPR_PARSER::parseSchField(), SCH_SEXPR_PARSER::parseSchSheetPin(), SCH_SEXPR_PARSER::ParseSymbol(), PCB_CALCULATOR_SETTINGS::PCB_CALCULATOR_SETTINGS(), KI_TEST::COMBINED_UTILITY::printUsage(), X3DSHAPE::Read(), X3DTRANSFORM::Read(), SGSHAPE::ReadCache(), S3D::ReadCache(), SGFACESET::ReadCache(), SCENEGRAPH::ReadCache(), FOOTPRINT_LIST_IMPL::ReadCacheFromFile(), TRANSLINE_IDENT::ReadConfig(), GERBER_JOBFILE_READER::ReadGerberJobFile(), S3D::ReadTag(), LIB_VIEW_FRAME::ReCreateListLib(), FOOTPRINT_WIZARD_FRAME::ReCreatePageList(), FOOTPRINT_WIZARD_FRAME::ReCreateParameterList(), TREE_PROJECT_FRAME::ReCreateTreePrj(), TREEPROJECT_ITEM::Rename(), LIB_EDIT_FRAME::savePartAs(), SYMBOL_LIB_TABLE::SaveSymbol(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), LIB_EDIT_FRAME::SelectLibraryFromList(), ABOUT_APP_INFO::SetAppName(), TREEPROJECT_ITEM::SetFileName(), KIWAY_HOLDER::SetKiway(), mpWindow::SetLayerVisible(), DIALOG_LIB_NEW_COMPONENT::SetName(), mpLayer::SetName(), GERBER_DRAW_ITEM::ShowGBRShape(), COMMON_CONTROL::ShowHelp(), PNS::WALKAROUND::singleStep(), DXF_PLOTTER::StartPlot(), swigAddBuiltin(), swigAddModule(), FP_TREE_SYNCHRONIZING_ADAPTER::Sync(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), PANEL_SETUP_LAYERS::testLayerNames(), PANEL_TEXT_VARIABLES::TransferDataFromWindow(), DIALOG_CONFIGURE_PATHS::TransferDataFromWindow(), DLG_SELECT_3DMODEL::TransferDataFromWindow(), DIALOG_FP_PLUGIN_OPTIONS::TransferDataFromWindow(), SETTINGS_MANAGER::unloadProjectFile(), BUS_UNFOLD_MENU::update(), SIM_PLOT_FRAME::updatePlot(), and TRANSLINE_IDENT::WriteConfig().