KiCad PCB EDA Suite
Loading...
Searching...
No Matches
s3d_plugin_idf.cpp File Reference
#include <cmath>
#include <string>
#include <map>
#include <wx/filename.h>
#include <wx/log.h>
#include <wx/string.h>
#include "plugins/3d/3d_plugin.h"
#include "plugins/3dapi/ifsg_all.h"
#include "idf_parser.h"
#include "vrml_layer.h"

Go to the source code of this file.

Classes

class  LOCALESWITCH
 
struct  FILE_DATA
 

Macros

#define PLUGIN_3D_IDF_MAJOR   1
 
#define PLUGIN_3D_IDF_MINOR   0
 
#define PLUGIN_3D_IDF_PATCH   0
 
#define PLUGIN_3D_IDF_REVNO   0
 
#define NCOLORS   6
 
#define NEXTS   4
 
#define NFILS   2
 

Functions

static SCENEGRAPHloadIDFOutline (const wxString &aFileName)
 
static SCENEGRAPHloadIDFBoard (const wxString &aFileName)
 
static SCENEGRAPHaddOutline (IDF3_COMP_OUTLINE *outline, int idxColor, SGNODE *aParent)
 
static SCENEGRAPHmakeBoard (IDF3_BOARD &brd, SGNODE *aParent)
 
static bool makeComponents (IDF3_BOARD &brd, SGNODE *aParent)
 
static bool makeOtherOutlines (IDF3_BOARD &brd, SGNODE *aParent)
 
static bool getOutlineModel (VRML_LAYER &model, const std::list< IDF_OUTLINE * > *items)
 
static bool addSegment (VRML_LAYER &model, IDF_SEGMENT *seg, int icont, int iseg)
 
static SCENEGRAPHvrmlToSG (VRML_LAYER &vpcb, int idxColor, SGNODE *aParent, double top, double bottom)
 
static SGNODEgetColor (IFSG_SHAPE &shape, int colorIdx)
 
const char * GetKicadPluginName (void)
 Function GetKicadPluginName returns the name of the plugin instance; for example IDFv3.
 
void GetPluginVersion (unsigned char *Major, unsigned char *Minor, unsigned char *Patch, unsigned char *Revision)
 Function GetPluginVersion retrieves the version of the instantiated plugin for informational purposes.
 
int GetNExtensions (void)
 Function GetNExtensions.
 
char const * GetModelExtension (int aIndex)
 Function GetModelExtension.
 
int GetNFilters (void)
 Function GetNFilters.
 
char const * GetFileFilter (int aIndex)
 Function GetFileFilter.
 
bool CanRender (void)
 Function CanRender.
 
SCENEGRAPHLoad (char const *aFileName)
 reads a model file and creates a generic display structure
 

Variables

const wxChar *const traceIdfPlugin = wxT( "KICAD_IDF_PLUGIN" )
 Flag to enable IDF plugin trace output.
 
static char ext0 [] = "idf"
 
static char ext1 [] = "emn"
 
static char ext2 [] = "IDF"
 
static char ext3 [] = "EMN"
 
static char fil0 [] = "IDF (*.idf;*.IDF)|*.idf;*.IDF"
 
static char fil1 [] = "IDF BRD (*.emn;*.EMN)|*.emn;*.EMN"
 
static struct FILE_DATA file_data
 

Macro Definition Documentation

◆ NCOLORS

#define NCOLORS   6

Definition at line 46 of file s3d_plugin_idf.cpp.

◆ NEXTS

#define NEXTS   4

Definition at line 222 of file s3d_plugin_idf.cpp.

◆ NFILS

#define NFILS   2

Definition at line 227 of file s3d_plugin_idf.cpp.

◆ PLUGIN_3D_IDF_MAJOR

#define PLUGIN_3D_IDF_MAJOR   1

Definition at line 39 of file s3d_plugin_idf.cpp.

◆ PLUGIN_3D_IDF_MINOR

#define PLUGIN_3D_IDF_MINOR   0

Definition at line 40 of file s3d_plugin_idf.cpp.

◆ PLUGIN_3D_IDF_PATCH

#define PLUGIN_3D_IDF_PATCH   0

Definition at line 41 of file s3d_plugin_idf.cpp.

◆ PLUGIN_3D_IDF_REVNO

#define PLUGIN_3D_IDF_REVNO   0

Definition at line 42 of file s3d_plugin_idf.cpp.

Function Documentation

◆ addOutline()

static SCENEGRAPH * addOutline ( IDF3_COMP_OUTLINE *  outline,
int  idxColor,
SGNODE aParent 
)
static

Definition at line 574 of file s3d_plugin_idf.cpp.

References getOutlineModel(), traceIdfPlugin, and vrmlToSG().

Referenced by loadIDFOutline(), and makeComponents().

◆ addSegment()

static bool addSegment ( VRML_LAYER &  model,
IDF_SEGMENT *  seg,
int  icont,
int  iseg 
)
static

◆ CanRender()

bool CanRender ( void  )

Function CanRender.

Returns
true if the plugin can render a model, that is the Load() function is implemented

Definition at line 295 of file s3d_plugin_idf.cpp.

◆ getColor()

static SGNODE * getColor ( IFSG_SHAPE shape,
int  colorIdx 
)
static

◆ GetFileFilter()

char const * GetFileFilter ( int  aIndex)

Function GetFileFilter.

Returns
the file filter string for the given index

Definition at line 286 of file s3d_plugin_idf.cpp.

◆ GetKicadPluginName()

const char * GetKicadPluginName ( void  )

Function GetKicadPluginName returns the name of the plugin instance; for example IDFv3.

This string may be used to check for name conflicts or to display informational messages about loaded plugins. This method must be implemented in specific instantiations of a plugin class.

Returns
is the NULL-terminated UTF-8 string representing the plugin name

Definition at line 195 of file s3d_plugin_idf.cpp.

◆ GetModelExtension()

char const * GetModelExtension ( int  aIndex)

Function GetModelExtension.

Parameters
aIndexis the extension to return; valid values are 0 to GetNExtensions() - 1.
Returns
the requested extension or a null string if aIndex was invalid.

Definition at line 271 of file s3d_plugin_idf.cpp.

◆ GetNExtensions()

int GetNExtensions ( void  )

Function GetNExtensions.

Returns
the number of extensions supported by the plugin

Definition at line 265 of file s3d_plugin_idf.cpp.

◆ GetNFilters()

int GetNFilters ( void  )

Function GetNFilters.

Returns
the number of file filters

Definition at line 280 of file s3d_plugin_idf.cpp.

◆ getOutlineModel()

static bool getOutlineModel ( VRML_LAYER &  model,
const std::list< IDF_OUTLINE * > *  items 
)
static

Definition at line 340 of file s3d_plugin_idf.cpp.

References addSegment(), and traceIdfPlugin.

Referenced by addOutline(), makeBoard(), and makeOtherOutlines().

◆ GetPluginVersion()

void GetPluginVersion ( unsigned char *  Major,
unsigned char *  Minor,
unsigned char *  Patch,
unsigned char *  Revision 
)

Function GetPluginVersion retrieves the version of the instantiated plugin for informational purposes.

Do not confuse this with GetClassVersion which is used to determine API compatibility.

Parameters
Majorwill hold the Plugin Major version
Minorwill hold the Plugin Minor version
Patchwill hold the Plugin Patch level
Revisionwill hold the Plugin Revision

Definition at line 201 of file s3d_plugin_idf.cpp.

◆ Load()

SCENEGRAPH * Load ( char const *  aFileName)

reads a model file and creates a generic display structure

Parameters
aFileNameis the full path of the model file
Returns
a SCENEGRAPH pointer to the display structure if the model was successfully loaded and NULL if there is no rendering support for the model or there were problems reading the model

Definition at line 302 of file s3d_plugin_idf.cpp.

◆ loadIDFBoard()

static SCENEGRAPH * loadIDFBoard ( const wxString &  aFileName)
static

◆ loadIDFOutline()

static SCENEGRAPH * loadIDFOutline ( const wxString &  aFileName)
static

Definition at line 605 of file s3d_plugin_idf.cpp.

References addOutline(), and traceIdfPlugin.

Referenced by Load().

◆ makeBoard()

static SCENEGRAPH * makeBoard ( IDF3_BOARD &  brd,
SGNODE aParent 
)
static

Definition at line 675 of file s3d_plugin_idf.cpp.

References getOutlineModel(), and vrmlToSG().

Referenced by loadIDFBoard().

◆ makeComponents()

static bool makeComponents ( IDF3_BOARD &  brd,
SGNODE aParent 
)
static

◆ makeOtherOutlines()

static bool makeOtherOutlines ( IDF3_BOARD &  brd,
SGNODE aParent 
)
static

Definition at line 859 of file s3d_plugin_idf.cpp.

References std::abs(), getOutlineModel(), and vrmlToSG().

Referenced by loadIDFBoard().

◆ vrmlToSG()

Variable Documentation

◆ ext0

char ext0[] = "idf"
static

Definition at line 230 of file s3d_plugin_idf.cpp.

Referenced by FILE_DATA::FILE_DATA().

◆ ext1

char ext1[] = "emn"
static

Definition at line 231 of file s3d_plugin_idf.cpp.

Referenced by FILE_DATA::FILE_DATA().

◆ ext2

char ext2[] = "IDF"
static

Definition at line 238 of file s3d_plugin_idf.cpp.

Referenced by FILE_DATA::FILE_DATA().

◆ ext3

char ext3[] = "EMN"
static

Definition at line 239 of file s3d_plugin_idf.cpp.

Referenced by FILE_DATA::FILE_DATA().

◆ fil0

char fil0[] = "IDF (*.idf;*.IDF)|*.idf;*.IDF"
static

Definition at line 240 of file s3d_plugin_idf.cpp.

Referenced by FILE_DATA::FILE_DATA().

◆ fil1

char fil1[] = "IDF BRD (*.emn;*.EMN)|*.emn;*.EMN"
static

Definition at line 241 of file s3d_plugin_idf.cpp.

Referenced by FILE_DATA::FILE_DATA().

◆ file_data

struct FILE_DATA file_data
static

Referenced by GetFileFilter(), and GetModelExtension().