Skip to content

Commit

Permalink
Add preliminary cube model import plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
trisyoungs committed Oct 18, 2018
1 parent cf9c9df commit 3c397cf
Show file tree
Hide file tree
Showing 6 changed files with 419 additions and 36 deletions.
26 changes: 26 additions & 0 deletions src/plugins/io_cube/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
### Cube Model

# Meta-Objects
set(cubemodel_MOC_HDRS
cubemodel.hui
)
QT5_WRAP_CPP(cubemodel_MOC_SRCS ${cubemodel_MOC_HDRS} OPTIONS -I${PROJECT_SOURCE_DIR}/src)

add_library(cubemodel MODULE
cubemodel_funcs.cpp
${cube_MOC_SRCS}
)
target_link_libraries(cubemodel
${PLUGIN_LINK_LIBS}
)
set_target_properties(cubemodel PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${Aten_BINARY_DIR}/data/plugins
COMPILE_DEFINITIONS "QT_PLUGIN"
PREFIX ""
)

#### Cube

# Meta-Objects
set(cube_MOC_HDRS
cube.hui
Expand All @@ -17,6 +40,9 @@ set_target_properties(cube PROPERTIES
PREFIX ""
)

# Install Targets

# Install Targets
if(UNIX AND NOT APPLE)
install(TARGETS cube
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/aten/plugins COMPONENT RuntimePlugins
Expand Down
8 changes: 6 additions & 2 deletions src/plugins/io_cube/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Set plugin installation dir and define plugin targets
pluginexecdir = @ATEN_PLUGINLIBDIR@
pluginexec_LTLIBRARIES = cube.la
pluginexec_LTLIBRARIES = cube.la cubemodel.la

# Rules
.ui.lo:
Expand All @@ -18,8 +18,12 @@ pluginexec_LTLIBRARIES = cube.la
clean-local:
-rm -f cube.cpp

# AKF Model plugin
# Cube Model plugin
cube_la_SOURCES = cube_funcs.cpp cube.hui
cube_la_LDFLAGS = -module -shared -avoid-version

# Cube Model plugin
cubemodel_la_SOURCES = cubemodel_funcs.cpp cubemodel.hui
cubemodel_la_LDFLAGS = -module -shared -avoid-version

AM_CPPFLAGS = -I${top_srcdir}/src @ATEN_INCLUDES@ @ATEN_CFLAGS@
14 changes: 7 additions & 7 deletions src/plugins/io_cube/cube.hui
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
*** CUBE Model File Plugin
*** Cube Grid File Plugin
*** src/plugins/io_cube/cube.hui
Copyright T. Youngs 2016-2018

Expand All @@ -19,8 +19,8 @@
along with Aten. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef ATEN_CUBEMODELPLUGIN_H
#define ATEN_CUBEMODELPLUGIN_H
#ifndef ATEN_CUBEGRIDPLUGIN_H
#define ATEN_CUBEGRIDPLUGIN_H

#include "plugins/interfaces/fileplugin.h"

Expand All @@ -29,8 +29,8 @@ ATEN_BEGIN_NAMESPACE
// Forward Declarations
/* none */

// CUBE Model Plugin
class CUBEModelPlugin : public QObject, public FilePluginInterface
// Cube Grid Plugin
class CubeGridPlugin : public QObject, public FilePluginInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "com.projectaten.Aten.FilePluginInterface.v1")
Expand All @@ -39,9 +39,9 @@ class CUBEModelPlugin : public QObject, public FilePluginInterface

public:
// Constructor
CUBEModelPlugin();
CubeGridPlugin();
// Destructor
~CUBEModelPlugin();
~CubeGridPlugin();


/*
Expand Down
54 changes: 27 additions & 27 deletions src/plugins/io_cube/cube_funcs.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
*** CUBE Model Plugin Functions
*** Cube Plugin Functions
*** src/plugins/io_cube/cube_funcs.cpp
Copyright T. Youngs 2016-2018
Expand All @@ -23,12 +23,12 @@
#include "model/model.h"

// Constructor
CUBEModelPlugin::CUBEModelPlugin()
CubeGridPlugin::CubeGridPlugin()
{
}

// Destructor
CUBEModelPlugin::~CUBEModelPlugin()
CubeGridPlugin::~CubeGridPlugin()
{
}

Expand All @@ -37,59 +37,59 @@ CUBEModelPlugin::~CUBEModelPlugin()
*/

// Return a copy of the plugin object
BasePluginInterface* CUBEModelPlugin::makeCopy() const
BasePluginInterface* CubeGridPlugin::makeCopy() const
{
return new CUBEModelPlugin;
return new CubeGridPlugin;
}

/*
* Definition
*/

// Return type of plugin
PluginTypes::PluginType CUBEModelPlugin::type() const
PluginTypes::PluginType CubeGridPlugin::type() const
{
return PluginTypes::FilePlugin;
}

// Return category of plugin
int CUBEModelPlugin::category() const
int CubeGridPlugin::category() const
{
return PluginTypes::ModelFilePlugin;
}

// Name of plugin
QString CUBEModelPlugin::name() const
QString CubeGridPlugin::name() const
{
return QString("CUBE (dlputils) 3D probability density");
return QString("Cube (dlputils) 3D probability density");
}

// Nickname of plugin
QString CUBEModelPlugin::nickname() const
QString CubeGridPlugin::nickname() const
{
return QString("cube");
}

// Return whether the plugin is enabled
bool CUBEModelPlugin::enabled() const
bool CubeGridPlugin::enabled() const
{
return true;
}

// Description (long name) of plugin
QString CUBEModelPlugin::description() const
QString CubeGridPlugin::description() const
{
return QString("Import/export for dlputils CUBE files");
return QString("Import/export for cube files");
}

// Related file extensions
QStringList CUBEModelPlugin::extensions() const
QStringList CubeGridPlugin::extensions() const
{
return QStringList() << "cube";
}

// Exact names
QStringList CUBEModelPlugin::exactNames() const
QStringList CubeGridPlugin::exactNames() const
{
return QStringList();
}
Expand All @@ -99,15 +99,15 @@ QStringList CUBEModelPlugin::exactNames() const
*/

// Return whether this plugin can import data
bool CUBEModelPlugin::canImport() const
bool CubeGridPlugin::canImport() const
{
return true;
}

// Import data from the specified file
bool CUBEModelPlugin::importData()
bool CubeGridPlugin::importData()
{
//filter(type="importmodel", name="Gaussian CUBE", nickname="cube", extension="cube", glob="*.cube", zmap="numeric")
//filter(type="importmodel", name="Gaussian Cube", nickname="cube", extension="cube", glob="*.cube", zmap="numeric")
//{
// # Variable declaration
// string e,title;
Expand Down Expand Up @@ -163,7 +163,7 @@ bool CUBEModelPlugin::importData()
// finaliseGrid();
//}
//
//filter(type="importgrid", name="Gaussian CUBE", nickname="cube", extension="cube", glob="*.cube", zmap="numeric", id=1)
//filter(type="importgrid", name="Gaussian Cube", nickname="cube", extension="cube", glob="*.cube", zmap="numeric", id=1)
//{
// # Variable declaration
// string e,title;
Expand Down Expand Up @@ -213,25 +213,25 @@ bool CUBEModelPlugin::importData()
}

// Return whether this plugin can export data
bool CUBEModelPlugin::canExport() const
bool CubeGridPlugin::canExport() const
{
return false;
}

// Export data to the specified file
bool CUBEModelPlugin::exportData()
bool CubeGridPlugin::exportData()
{
return false;
}

// Import next partial data chunk
bool CUBEModelPlugin::importNextPart()
bool CubeGridPlugin::importNextPart()
{
return false;
}

// Skip next partial data chunk
bool CUBEModelPlugin::skipNextPart()
bool CubeGridPlugin::skipNextPart()
{
return false;
}
Expand All @@ -241,25 +241,25 @@ bool CUBEModelPlugin::skipNextPart()
*/

// Return whether the plugin has import options
bool CUBEModelPlugin::hasImportOptions() const
bool CubeGridPlugin::hasImportOptions() const
{
return false;
}

// Show import options dialog
bool CUBEModelPlugin::showImportOptionsDialog(KVMap& targetOptions) const
bool CubeGridPlugin::showImportOptionsDialog(KVMap& targetOptions) const
{
return false;
}

// Return whether the plugin has export options
bool CUBEModelPlugin::hasExportOptions() const
bool CubeGridPlugin::hasExportOptions() const
{
return false;
}

// Show export options dialog
bool CUBEModelPlugin::showExportOptionsDialog(KVMap& targetOptions) const
bool CubeGridPlugin::showExportOptionsDialog(KVMap& targetOptions) const
{
return false;
}
Expand Down
111 changes: 111 additions & 0 deletions src/plugins/io_cube/cubemodel.hui
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/*
*** Cube Model File Plugin
*** src/plugins/io_cube/cubemodel.hui
Copyright T. Youngs 2016-2018

This file is part of Aten.

Aten is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Aten is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Aten. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef ATEN_CUBEMODELPLUGIN_H
#define ATEN_CUBEMODELPLUGIN_H

#include "plugins/interfaces/fileplugin.h"

ATEN_BEGIN_NAMESPACE

// Forward Declarations
/* none */

// Cube Model Plugin
class CubeModelPlugin : public QObject, public FilePluginInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "com.projectaten.Aten.FilePluginInterface.v1")
Q_INTERFACES(AtenSpace::FilePluginInterface)


public:
// Constructor
CubeModelPlugin();
// Destructor
~CubeModelPlugin();


/*
* Instance Handling
*/
private:
// Return a copy of the plugin object
BasePluginInterface* makeCopy() const;


/*
* Definition
*/
public:
// Return type of plugin
PluginTypes::PluginType type() const;
// Return category of plugin
int category() const;
// Return name of plugin
QString name() const;
// Return nickname of plugin
QString nickname() const;
// Return whether plugin is enabled
bool enabled() const;
// Return description (long name) of plugin
QString description() const;
// Return related file extensions
QStringList extensions() const;
// Return exact names
QStringList exactNames() const;


/*
* Input / Output
*/
public:
// Return whether this plugin can import data
bool canImport() const;
// Import data via the supplied parser
bool importData();
// Return whether this plugin can export data
bool canExport() const;
// Export data via the supplied parser
bool exportData();
// Import next partial data chunk
bool importNextPart();
// Skip next partial data chunk
bool skipNextPart();


/*
* Options
*/
public:
// Return whether the plugin has import options
bool hasImportOptions() const;
// Show import options dialog
bool showImportOptionsDialog(KVMap& targetOptions) const;
// Return whether the plugin has export options
bool hasExportOptions() const;
// Show export options dialog
bool showExportOptionsDialog(KVMap& targetOptions) const;
};

ATEN_END_NAMESPACE

#endif
Loading

0 comments on commit 3c397cf

Please sign in to comment.