Refactored to use new generic plugin base

This commit is contained in:
Cirilo Bernardo
2015-12-14 08:45:22 +11:00
parent 86042d86a6
commit 3ff8ca0caf
14 changed files with 1418 additions and 367 deletions
+96 -56
View File
@@ -30,69 +30,109 @@
#ifndef PLUGIN_3D_H
#define PLUGIN_3D_H
#include <wx/string.h>
//
// KICAD_PLUGIN CLASS INTERFACE
//
// WARNING: DO NOT EDIT THIS FILE OUTSIDE THE KICAD TREE
//
// Note: the plugin class name must match the name expected by the loader
#define KICAD_PLUGIN_CLASS "PLUGIN_3D"
#define MAJOR 1
#define MINOR 0
#define REVISION 0
#define PATCH 0
#include "../kicad_plugin.h"
KICAD_PLUGIN_EXPORT char const* GetKicadPluginClass( void )
{
return KICAD_PLUGIN_CLASS;
}
KICAD_PLUGIN_EXPORT void GetClassVersion( unsigned char* Major,
unsigned char* Minor, unsigned char* Revision, unsigned char* Patch )
{
if( Major )
*Major = MAJOR;
if( Minor )
*Minor = MINOR;
if( Revision )
*Revision = REVISION;
if( Patch )
*Patch = PATCH;
return;
}
KICAD_PLUGIN_EXPORT bool CheckClassVersion( unsigned char Major,
unsigned char Minor, unsigned char Revision, unsigned char Patch )
{
if( Major != MAJOR )
return false;
// at the moment there are no incompatibility rules other than the Major Version check
return true;
}
class SCENEGRAPH;
class S3D_PLUGIN
{
public:
virtual ~S3D_PLUGIN()
{
return;
}
/**
* Function GetNExtensions
*
* @return the number of extensions supported by the plugin
*/
KICAD_PLUGIN_EXPORT int GetNExtensions( void );
/**
* Function GetNExtensions
*
* @return the number of extensions supported by the plugin
*/
virtual int GetNExtensions( void ) const = 0;
/**
* Function GetModelExtension
*
* @param aIndex is the extension to return; valid values are
* 0 to GetNExtensions() - 1.
* @return the requested extension or a null string if aIndex
* was invalid.
*/
KICAD_PLUGIN_EXPORT char const* GetModelExtension( int aIndex );
/**
* Function GetModelExtension
*
* @param aIndex is the extension to return; valid values are
* 0 to GetNExtensions() - 1.
* @return the requested extension or a null string if aIndex
* was invalid.
*/
virtual const wxString GetModelExtension( int aIndex ) const = 0;
/**
* Function GetNFilters
* @returns the number of file filters
*/
KICAD_PLUGIN_EXPORT int GetNFilters( void );
/**
* Function GetNFilters
* @returns the number of file filters
*/
virtual int GetNFilters( void ) const = 0;
/**
* Function GetFileFilter
*
* @return the file filter string for the given index
*/
KICAD_PLUGIN_EXPORT char const* GetFileFilter( int aIndex );
/**
* Function GetFileFilter
*
* @return the file filter string for the given index
*/
virtual const wxString GetFileFilter( int aIndex ) const = 0;
/**
* Function CanRender
*
* @return true if the plugin can render a model, that is
* the Load() function is implemented
*/
KICAD_PLUGIN_EXPORT bool CanRender( void );
/**
* Function CanRender
*
* @return true if the plugin can render a model, that is
* the Load() function is implemented
*/
virtual bool CanRender( void ) const = 0;
/**
* Function Load
* reads the model file and creates a generic display structure
*
* @param aFileName is the full path of the model file
* @param aModel is a handle to a null pointer; on successful
* reading of the model data aModel will point to a representation
* for rendering
* @param returns true if the model was successfully loaded and false
* if there is no rendering support for the model or there were
* problems reading the model
*/
virtual SCENEGRAPH* Load( const wxString& aFileName ) = 0;
};
/**
* Function Load
* reads the model file and creates a generic display structure
*
* @param aFileName is the full path of the model file
* @param aModel is a handle to a null pointer; on successful
* reading of the model data aModel will point to a representation
* for rendering
* @param returns true if the model was successfully loaded and false
* if there is no rendering support for the model or there were
* problems reading the model
*/
KICAD_PLUGIN_EXPORT SCENEGRAPH* Load( char const* aFileName );
#endif // PLUGIN_3D_H