KiCad PCB EDA Suite
DXF_plotter.cpp File Reference

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

#include <fctsys.h>
#include <gr_basic.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 (PlotDashType 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

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

References i.

Referenced by DXF_PLOTTER::Text().

815 {
816  for( unsigned i = 0; i < string.length(); i++ )
817  {
818  wchar_t ch = string[i];
819  if( ch > 255 )
820  return true;
821  }
822  return false;
823 }
size_t i
Definition: json11.cpp:597
static wxString getDXFColorName ( COLOR4D  aColor)
static

Definition at line 115 of file DXF_plotter.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().

116 {
117  EDA_COLOR_T color = ColorFindNearest( int( aColor.r*255 ),
118  int( aColor.g*255 ),
119  int( aColor.b*255 ) );
120  wxString cname( dxf_layer[color].name );
121  return cname;
122 }
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
int color
Definition: DXF_plotter.cpp:62
double g
Green component.
Definition: color4d.h:288
double b
Blue component.
Definition: color4d.h:289
static const struct @42 dxf_layer[NBCOLORS]
const char * name
Definition: DXF_plotter.cpp:61
double r
Red component.
Definition: color4d.h:287
static const char* getDXFLineType ( PlotDashType  aType)
static

Definition at line 98 of file DXF_plotter.cpp.

References PLOTDASHTYPE_DASH, PLOTDASHTYPE_DASHDOT, PLOTDASHTYPE_DOT, and PLOTDASHTYPE_SOLID.

Referenced by DXF_PLOTTER::PenTo().

99 {
100  switch( aType )
101  {
102  case PLOTDASHTYPE_SOLID: return "CONTINUOUS";
103  case PLOTDASHTYPE_DASH: return "DASHED";
104  case PLOTDASHTYPE_DOT: return "DOTTED";
105  case PLOTDASHTYPE_DASHDOT: return "DASHDOT";
106  }
107 
108  wxFAIL_MSG( "Unhandled PlotDashType" );
109  return "CONTINUOUS";
110 }

Variable Documentation

int color

Definition at line 62 of file DXF_plotter.cpp.

Referenced by GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), ROUTER_PREVIEW_ITEM::assignColor(), KIGFX::CAIRO_GAL_BASE::blitCursor(), KIGFX::OPENGL_GAL::blitCursor(), PCB_ONE_LAYER_SELECTOR::buildList(), SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList(), WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(), DIALOG_COLOR_PICKER::buttColorClick(), WIDGET_EESCHEMA_COLOR_CONFIG::CreateControls(), DIALOG_COLOR_PICKER::createHSVBitmap(), DIALOG_COLOR_PICKER::createRGBBitmap(), 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(), ZONE_CONTAINER::Draw(), SCH_TEXT::Draw(), KIGFX::SCH_PAINTER::draw(), SCH_FIELD::Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), KIGFX::GERBVIEW_PAINTER::draw(), LIB_ITEM::Draw(), DRAWSEGMENT::Draw(), GERBER_DRAW_ITEM::Draw(), KIGFX::PCB_PAINTER::draw(), SCH_GLOBALLABEL::Draw(), SCH_HIERLABEL::Draw(), SEGZONE::Draw(), VIA::Draw(), SCH_SHEET::Draw(), D_PAD::Draw(), drawArcWithHilight(), 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(), DrawPageLayout(), LIB_PIN::DrawPinSymbol(), AR_AUTOPLACER::drawPlacementRoutingMatrix(), ZONE_CONTAINER::DrawWhileCreateOutline(), EDA_DRAW_FRAME::DrawWorkSheet(), WS_DRAW_ITEM_POLYGON::DrawWsItem(), ELAYER::ELAYER(), EDA_MSG_PANEL::erase(), export_vrml_pcbtext(), EDA_DRAW_FRAME::GeneralControl(), AR_MATRIX::GetBrdCoordOrigin(), BRDITEMS_PLOTTER::getColor(), PLOTTER::GetCurrentLineWidth(), KIGFX::GAL::getCursorColor(), getDXFColorName(), CINFO3D_VISU::GetLayerColor(), SVG_PLOTTER::GetPlotterType(), GERBVIEW_FRAME::GetVisibleElementColor(), SCH_LEGACY_PLUGIN::loadWire(), PL_EDITOR_FRAME::Locate(), ZONE_CREATE_HELPER::OnFirstPoint(), DRCLISTBOX::OnGetItem(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::onPaintPolyPanel(), DIALOG_PAD_PROPERTIES::OnPaintShowPanel(), KIGFX::VIEW::updateItemsColor::operator()(), PlacePad(), AR_MATRIX::PlacePad(), LIB_TEXT::Plot(), SCH_FIELD::Plot(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotDimension(), PlotSilkScreen(), PlotStandardLayer(), LIB_PIN::PlotSymbol(), BRDITEMS_PLOTTER::PlotTextePcb(), GERBER_LAYER_WIDGET::ReFillRender(), C3D_RENDER_RAYTRACING::rt_final_color(), DXF_PLOTTER::SetColor(), KIGFX::SCH_PAINTER::setColors(), DXF_PLOTTER::SetDefaultLineWidth(), PSLIKE_PLOTTER::SetScaleAdjust(), EDA_MSG_PANEL::showItem(), ShowNewTrackWhenMovingCursor(), DXF_PLOTTER::StartPlot(), AR_MATRIX::TraceSegmentPcb(), TraceSegmentPcb(), TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(), EDA_TEXT::TransformTextShapeToSegmentList(), KIGFX::VIEW::UpdateAllLayersColor(), KIGFX::VIEW::updateItemColor(), 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 DXF_plotter.cpp.

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

const char* name

Definition at line 61 of file DXF_plotter.cpp.

Referenced by NETCLASSES::Add(), GERBER_JOBFILE_WRITER::addJSONFilesAttributes(), DXF2BRD_CONVERTER::addLayer(), AddMenusForComponentField(), DIALOG_SIGNAL_LIST::addSelectionToPlotFrame(), SCH_EDIT_FRAME::AppendSchematic(), AskLoadBoardFileName(), PGM_BASE::AskUserForPreferredEditor(), PART_LIBS::CacheName(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), FOOTPRINT_VIEWER_FRAME::ClickOnLibList(), KIWAY::dso_search_path(), EATTR::EATTR(), WIDGET_HOTKEY_LIST::EditItem(), EPAD_COMMON::EPAD_COMMON(), FOOTPRINT_FILTER::ITERATOR::FootprintFilterMatch(), LIB_TABLE::FormatOptions(), DSN::SPECCTRA_DB::FromBOARD(), FOOTPRINT_INFO_GENERATOR::GenerateHtml(), ACTION_PLUGINS::GetAction(), WORKSHEET_DATAITEM::GetClassName(), PROJECT_TEMPLATE::GetDestinationFiles(), GERBER_FILE_IMAGE_LIST::GetDisplayName(), getDXFColorName(), FOOTPRINT_INFO_GENERATOR::GetHtmlFieldRow(), GBR_LAYER_BOX_SELECTOR::GetLayerName(), LIB_FIELD::GetName(), BOARD_CONNECTED_ITEM::GetNetClassName(), mpWindow::GetPopupMenu(), TOOL_MANAGER::GetTool(), LIB_MANAGER::GetUniqueComponentName(), LIB_MANAGER::GetUniqueLibraryName(), FOOTPRINT_WIZARD_LIST::GetWizard(), PCB_EDIT_FRAME::ImportSpecctraSession(), DIALOG_FOOTPRINT_WIZARD_LIST::initLists(), IsWxPythonLoaded(), GPCB_FPL_CACHE::Load(), SCH_LEGACY_PLUGIN::loadComponent(), LEGACY_NETLIST_READER::loadComponent(), EAGLE_PLUGIN::loadElements(), SCH_LEGACY_PLUGIN::loadJunction(), DIALOG_SPICE_MODEL::loadLibrary(), SCH_EAGLE_PLUGIN::loadLibrary(), SCH_LEGACY_PLUGIN::loadNoConnect(), SCH_LEGACY_PLUGIN_CACHE::loadPart(), SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname(), SIM_PLOT_FRAME::loadWorkbook(), WORKSHEET_LAYOUT::MakeFullFileName(), DSN::SPECCTRA_DB::makePADSTACK(), DSN::SPECCTRA_DB::makeVia(), mpFX::mpFX(), mpFXY::mpFXY(), mpFY::mpFY(), mpProfile::mpProfile(), mpScaleXBase::mpScaleXBase(), mpScaleY::mpScaleY(), DIALOG_BOM::OnAddPlugin(), LIB_EDIT_FRAME::OnCreateNewPart(), PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE::OnDeleteButtonClick(), TREE_PROJECT_FRAME::OnExpand(), APP_SINGLE_TOP::OnInit(), PGM_SINGLE_TOP::OnPgmInit(), PANEL_PCBNEW_ACTION_PLUGINS_BASE::OnReloadButtonClick(), APP_SINGLE_TOP::OnRun(), APP_KICAD::OnRun(), SIM_PLOT_FRAME_BASE::onSignalRClick(), DIALOG_PAGES_SETTINGS::OnWksFileSelection(), 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(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), SGSHAPE::ReadCache(), S3D::ReadCache(), SGFACESET::ReadCache(), SCENEGRAPH::ReadCache(), FOOTPRINT_LIST_IMPL::ReadCacheFromFile(), 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_BASE_FRAME::SelectLibraryFromList(), ABOUT_APP_INFO::SetAppName(), TREEPROJECT_ITEM::SetFileName(), KIWAY_HOLDER::SetKiway(), mpLayer::SetName(), TREEPROJECT_ITEM::SetPopulated(), GERBER_DRAW_ITEM::ShowGBRShape(), DXF_PLOTTER::StartPlot(), FP_TREE_SYNCHRONIZING_ADAPTER::Sync(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), PANEL_SETUP_LAYERS::testLayerNames(), DIALOG_CONFIGURE_PATHS::TransferDataFromWindow(), DLG_SELECT_3DMODEL::TransferDataFromWindow(), DIALOG_FP_PLUGIN_OPTIONS::TransferDataFromWindow(), mpScaleXLog::TransformFromPlot(), and NETLIST_DIALOG::UserNetlistTypeName().