KiCad PCB EDA Suite
DXF_plotter.cpp File Reference

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

#include <plotters/plotter_dxf.h>
#include <macros.h>
#include <string_utils.h>
#include <convert_basic_shapes_to_polygon.h>
#include <trigo.h>

Go to the source code of this file.

Functions

static const char * getDXFLineType (PLOT_DASH_TYPE aType)
 
static wxString getDXFColorName (const COLOR4D &aColor)
 
bool containsNonAsciiChars (const wxString &string)
 Check 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)

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

827 {
828  for( unsigned i = 0; i < string.length(); i++ )
829  {
830  wchar_t ch = string[i];
831  if( ch > 255 )
832  return true;
833  }
834  return false;
835 }

Referenced by DXF_PLOTTER::Text().

◆ getDXFColorName()

static wxString getDXFColorName ( const COLOR4D aColor)
static

Definition at line 120 of file DXF_plotter.cpp.

121 {
122  EDA_COLOR_T color = COLOR4D::FindNearestLegacyColor( int( aColor.r * 255 ),
123  int( aColor.g * 255 ),
124  int( aColor.b * 255 ) );
125  wxString cname( dxf_layer[color].name );
126  return cname;
127 }
int color
Definition: DXF_plotter.cpp:57
double g
Green component.
Definition: color4d.h:385
double b
Blue component.
Definition: color4d.h:386
static const struct @8 dxf_layer[NBCOLORS]
EDA_COLOR_T
Legacy color enumeration.
Definition: color4d.h:41
const char * name
Definition: DXF_plotter.cpp:56
double r
Red component.
Definition: color4d.h:384

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

99 {
100  switch( aType )
101  {
104  return "CONTINUOUS";
106  return "DASHED";
107  case PLOT_DASH_TYPE::DOT:
108  return "DOTTED";
110  return "DASHDOT";
111  default:
112  wxFAIL_MSG( "Unhandled PLOT_DASH_TYPE" );
113  return "CONTINUOUS";
114  }
115 }

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

Referenced by DXF_PLOTTER::PenTo().

Variable Documentation

◆ color

int color

Definition at line 57 of file DXF_plotter.cpp.

Referenced by LABEL_MANAGER::Add(), GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), PANEL_SETUP_NETCLASSES::addNet(), 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_COLOR_SETTINGS::createSwatch(), GRID_CELL_COLOR_RENDERER::Draw(), KIGFX::SCH_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawCircle(), PNS_LOG_VIEWER_FRAME::drawLoggedItems(), ELAYER::ELAYER(), EDA_MSG_PANEL::erase(), JSON_SETTINGS::fromLegacyColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), BRDITEMS_PLOTTER::getColor(), getColor(), GetColorFromInt(), PANEL_SETUP_BOARD_STACKUP::getColorIconItem(), KIGFX::GAL::getCursorColor(), getDXFColorName(), BOARD_ADAPTER::GetLayerColor(), KIGFX::SCH_PAINTER::getRenderColor(), NET_GRID_TABLE::GetValueAsCustom(), GERBVIEW_FRAME::GetVisibleElementColor(), GRSetBrush(), GRSetColorPen(), BOARD_ADAPTER::InitSettings(), SCH_LEGACY_PLUGIN::loadWire(), COLOR_SWATCH::MakeBitmap(), EDA_3D_VIEWER_SETTINGS::MigrateFromLegacy(), PANEL_SETUP_BOARD_STACKUP::onColorSelected(), ZONE_CREATE_HELPER::OnFirstPoint(), APPEARANCE_CONTROLS::onNetclassContextMenu(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::onPaintPolyPanel(), KIGFX::VIEW::UPDATE_COLOR_VISITOR::operator()(), PCB_PARSER::parseBoardStackup(), SCH_SEXPR_PARSER::parseFill(), SCH_SEXPR_PARSER::parseJunction(), SCH_SEXPR_PARSER::parseStroke(), AR_MATRIX::PlacePad(), LIB_TEXT::Plot(), SCH_BUS_ENTRY_BASE::Plot(), SCH_JUNCTION::Plot(), LIB_FIELD::Plot(), SCH_FIELD::Plot(), SCH_LINE::Plot(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF(), BRDITEMS_PLOTTER::PlotPcbText(), PlotStandardLayer(), LIB_PIN::PlotSymbol(), SCH_NO_CONNECT::Print(), SCH_JUNCTION::Print(), SCH_BUS_ENTRY_BASE::Print(), LIB_SHAPE::print(), LIB_TEXT::print(), LIB_PIN::print(), SCH_FIELD::Print(), SCH_TEXT::Print(), SCH_LINE::Print(), GERBER_DRAW_ITEM::Print(), LIB_FIELD::print(), SCH_GLOBALLABEL::Print(), SCH_HIERLABEL::Print(), LIB_PIN::printPinElectricalTypeName(), LIB_PIN::printPinSymbol(), DS_DRAW_ITEM_LINE::PrintWsItem(), DS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem(), DS_DRAW_ITEM_RECT::PrintWsItem(), processFace(), processShell(), NET_GRID_TABLE::Rebuild(), APPEARANCE_CONTROLS::rebuildNets(), APPEARANCE_CONTROLS::rebuildObjects(), GERBER_LAYER_WIDGET::ReFill(), GERBER_LAYER_WIDGET::ReFillRender(), RENDER_3D_RAYTRACE::renderFinalColor(), PANEL_EESCHEMA_COLOR_SETTINGS::saveCurrentTheme(), CONSOLE_LOG::SetColor(), DXF_PLOTTER::SetColor(), PSLIKE_PLOTTER::SetColor(), SVG_PLOTTER::SetColor(), EDA_MSG_PANEL::showItem(), DXF_PLOTTER::StartPlot(), APPEARANCE_CONTROLS::syncColorsAndVisibility(), APPEARANCE_CONTROLS::syncObjectSettings(), AR_MATRIX::traceArc(), AR_MATRIX::traceCircle(), AR_MATRIX::traceFilledCircle(), AR_MATRIX::TraceFilledRectangle(), PANEL_3D_RAYTRACING_OPTIONS::TransferDataFromWindow(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), EDA_TEXT::TransformToSegmentList(), KIGFX::VIEW::UpdateAllLayersColor(), DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample(), KIGFX::VIEW::updateItemColor(), and RATSNEST_VIEW_ITEM::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 38 of file DXF_plotter.cpp.

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

◆ name

const char* name

Definition at line 56 of file DXF_plotter.cpp.

Referenced by NETCLASSES::Add(), DXF_IMPORT_PLUGIN::addBlock(), GERBER_JOBFILE_WRITER::addJSONFilesAttributes(), GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), DXF_IMPORT_PLUGIN::addLayer(), DXF_IMPORT_PLUGIN::addLinetype(), PROPERTY_MANAGER::AddProperty(), DIALOG_SIGNAL_LIST::addSignalToPlotFrame(), SCH_SEXPR_PLUGIN_CACHE::AddSymbol(), SCH_LEGACY_PLUGIN_CACHE::AddSymbol(), DXF_IMPORT_PLUGIN::addTextStyle(), SIM_PLOT_PANEL::addTrace(), AskLoadBoardFileName(), PGM_BASE::AskUserForPreferredEditor(), PNS_TEST_DEBUG_DECORATOR::BeginGroup(), BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS(), BOOST_AUTO_TEST_CASE(), CONNECTION_GRAPH::buildConnectionGraph(), SYMBOL_LIBS::CacheName(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), FOOTPRINT_VIEWER_FRAME::ClickOnLibList(), CONNECTION_GRAPH::collectAllDriverValues(), createBoard(), DRC_ENGINE::createImplicitRule(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), PANEL_PCBNEW_COLOR_SETTINGS::createSwatches(), PANEL_EESCHEMA_COLOR_SETTINGS::createSwatches(), PANEL_COLOR_SETTINGS::createThemeList(), DIALOG_LIB_NEW_SYMBOL::DIALOG_LIB_NEW_SYMBOL(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), KIGFX::PCB_PAINTER::draw(), KIWAY::dso_search_path(), WIDGET_HOTKEY_LIST::editItem(), ERC_SETTINGS::ERC_SETTINGS(), CONNECTION_GRAPH::ercCheckLabels(), CONNECTION_GRAPH::ercCheckNoConnects(), FindStream(), FOOTPRINT_FILTER::ITERATOR::FootprintFilterMatch(), FootprintWithPads(), formatConstraint(), 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(), LIB_PIN::GetBoundingBox(), DS_DATA_ITEM::GetClassName(), SCH_PIN::GetDefaultNetName(), PROJECT_TEMPLATE::GetDestinationFiles(), GERBER_FILE_IMAGE_LIST::GetDisplayName(), getDXFColorName(), GetFootprintLibraries(), X3DPARSER::getGroupingNodes(), FOOTPRINT_INFO_GENERATOR::GetHtmlFieldRow(), getLabelName(), mpWindow::GetLayerByName(), GBR_LAYER_BOX_SELECTOR::getLayerName(), SCH_PIN::GetShownName(), DRC_ENGINE::GetTestProvider(), TOOL_MANAGER::GetTool(), SYMBOL_LIBRARY_MANAGER::GetUniqueLibraryName(), FOOTPRINT_WIZARD_LIST::GetWizard(), BOARD_EDITOR_CONTROL::ImportSpecctraSession(), IncrementLabelMember(), DIALOG_FOOTPRINT_WIZARD_LIST::initLists(), DIALOG_BOM::installGeneratorsList(), mpWindow::IsLayerVisible(), KiROUND(), SCH_EDIT_FRAME::KiwayMailIn(), X3DPARSER::Load(), GPCB_FPL_CACHE::Load(), LEGACY_NETLIST_READER::loadComponent(), EAGLE_PLUGIN::loadElements(), BOARD_DESIGN_SETTINGS::LoadFromFile(), CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins(), DRC_ENGINE::loadImplicitRules(), 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(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(), SCH_EDIT_FRAME::LoadSheetFromFile(), SCH_LEGACY_PLUGIN::loadSymbol(), SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname(), SIM_PLOT_FRAME::loadWorkbook(), DSN::SPECCTRA_DB::makePADSTACK(), DSN::SPECCTRA_DB::makeVia(), PCB_CALCULATOR_SETTINGS::MigrateFromLegacy(), mpFX::mpFX(), mpFXY::mpFXY(), mpFY::mpFY(), mpProfile::mpProfile(), mpScaleXBase::mpScaleXBase(), mpScaleY::mpScaleY(), mpText::mpText(), NET_SETTINGS::NET_SETTINGS(), PNS_TEST_DEBUG_DECORATOR::NewStage(), DIALOG_MANAGE_REPOSITORIES::OnAddButtonClicked(), DIALOG_BOM::OnAddGenerator(), DIALOG_BUS_MANAGER::OnAddSignal(), PANEL_REGULATOR::OnEditRegulator(), PROJECT_TREE_PANE::onExpand(), APP_SINGLE_TOP::OnInit(), APP_TEST::OnInit(), APPEARANCE_CONTROLS::onLayerPresetChanged(), APPEARANCE_CONTROLS::OnNetGridMouseEvent(), PGM_SINGLE_TOP::OnPgmInit(), PANEL_REGULATOR::OnRegulatorSelection(), PANEL_REGULATOR::OnRemoveRegulator(), APP_SINGLE_TOP::OnRun(), APP_TEST::OnRun(), APP_KICAD::OnRun(), DIALOG_PAGES_SETTINGS::OnWksFileSelection(), ERULES::parse(), CADSTAR_SCH_ARCHIVE_PARSER::SHEETS::Parse(), PCB_PARSER::parseBoardStackup(), ALTIUM_PCB::ParseClasses6Data(), SCH_ALTIUM_PLUGIN::ParseComponent(), KICAD_NETLIST_PARSER::parseComponent(), PCB_PARSER::parseFOOTPRINT_unchecked(), PCB_PARSER::parseLayer(), PCB_PARSER::parseLayers(), KICAD_NETLIST_PARSER::parseNet(), PCB_PARSER::parseNETINFO_ITEM(), LIB_TABLE::ParseOptions(), SCH_ALTIUM_PLUGIN::ParsePort(), 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(), LIB_PIN::PlotPinTexts(), LIB_PIN::printPinTexts(), KI_TEST::COMBINED_UTILITY::printUsage(), FABMASTER::processCustomPads(), CONNECTION_GRAPH::processSubGraphs(), X3DSHAPE::Read(), X3DTRANSFORM::Read(), SGSHAPE::ReadCache(), SCENEGRAPH::ReadCache(), SGFACESET::ReadCache(), S3D::ReadCache(), FOOTPRINT_LIST_IMPL::ReadCacheFromFile(), TRANSLINE_IDENT::ReadConfig(), GERBER_JOBFILE_READER::ReadGerberJobFile(), S3D::ReadTag(), APPEARANCE_CONTROLS::rebuildNets(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), FOOTPRINT_WIZARD_FRAME::ReCreatePageList(), FOOTPRINT_WIZARD_FRAME::ReCreateParameterList(), SYMBOL_VIEWER_FRAME::ReCreateSymbolList(), PROJECT_TREE_PANE::ReCreateTreePrj(), PROJECT_TREE_ITEM::Rename(), DS_DATA_MODEL::ResolvePath(), PNS::LINE_PLACER::rhWalkOnly(), SYMBOL_LIB_TABLE::SaveSymbol(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), SYMBOL_EDIT_FRAME::saveSymbolAs(), SYMBOL_EDIT_FRAME::SelectLibraryFromList(), ABOUT_APP_INFO::SetAppName(), PROJECT_TREE_ITEM::SetFileName(), KIWAY_HOLDER::SetKiway(), mpWindow::SetLayerVisible(), DIALOG_LIB_NEW_SYMBOL::SetName(), mpLayer::SetName(), PANEL_PACKAGES_VIEW::setPackageDetails(), GERBER_DRAW_ITEM::ShowGBRShape(), COMMON_CONTROL::ShowHelp(), PNS::WALKAROUND::singleStep(), DXF_PLOTTER::StartPlot(), FP_TREE_SYNCHRONIZING_ADAPTER::Sync(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), PANEL_SETUP_LAYERS::testLayerNames(), ERC_TESTER::TestMultUnitPinConflicts(), PANEL_TEXT_VARIABLES::TransferDataFromWindow(), DIALOG_SELECT_3DMODEL::TransferDataFromWindow(), DIALOG_CONFIGURE_PATHS::TransferDataFromWindow(), DIALOG_FP_PLUGIN_OPTIONS::TransferDataFromWindow(), SETTINGS_MANAGER::unloadProjectFile(), BUS_UNFOLD_MENU::update(), SIM_PLOT_FRAME::updatePlot(), TRANSLINE_IDENT::WriteConfig(), and DIALOG_BOM::~DIALOG_BOM().