MorphoGraphX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | List of all members
mgx::process::MeshSave Class Reference

Save a mesh into a INRIA or MGXM file. More...

#include <SystemProcessSave.hpp>

+ Inheritance diagram for mgx::process::MeshSave:

Public Member Functions

 MeshSave (const MeshProcess &proc)
 
bool operator() (const QStringList &parms)
 Implementation of the process with generic arguments. More...
 
bool operator() (Mesh *mesh, const QString &filename, bool transform)
 Save a mesh. More...
 
QString folder () const
 Folder in which to place the process. More...
 
QString name () const
 Returns the name of the process. More...
 
QString description () const
 Returns a description of the process for the GUI.
 
QStringList parmNames () const
 List of named parameters. More...
 
QStringList parmDescs () const
 List of parameters descriptions. More...
 
QIcon icon () const
 Icon to use to represent the process in the GUI. More...
 
QStringList parmDefaults () const
 List of default parms.
 
ParmChoiceMap parmChoice () const
 Purely for GUI purposes, provides for some of the parms parameter a choice. More...
 
bool initialize (QStringList &parms, QWidget *parent)
 This is an optional method that is called only when a process is launched from the GUI. More...
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent=0)
 
 blockSignals (bool block)
 
 childEvent (QChildEvent *event)
 
 children ()
 
 connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type=Qt::AutoConnection)
 
 connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type=Qt::AutoConnection)
 
 connectNotify (const char *signal)
 
 customEvent (QEvent *event)
 
 deleteLater ()
 
 destroyed (QObject *obj=0)
 
 disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
 disconnect (const char *signal=0, const QObject *receiver=0, const char *method=0)
 
 disconnect (const QObject *receiver, const char *method=0)
 
 disconnectNotify (const char *signal)
 
 dumpObjectInfo ()
 
 dumpObjectTree ()
 
 dynamicPropertyNames ()
 
 event (QEvent *e)
 
 eventFilter (QObject *watched, QEvent *event)
 
 findChild (const QString &name=QString()
 
 findChildren (const QString &name=QString()
 
 findChildren (const QRegExp &regExp)
 
 inherits (const char *className)
 
 installEventFilter (QObject *filterObj)
 
 isWidgetType ()
 
 killTimer (int id)
 
 metaObject ()
 
 moveToThread (QThread *targetThread)
 
 parent ()
 
 property (const char *name)
 
 receivers (const char *signal)
 
 removeEventFilter (QObject *obj)
 
 sender ()
 
 setParent (QObject *parent)
 
 setProperty (const char *name, const QVariant &value)
 
 signalsBlocked ()
 
 startTimer (int interval)
 
 thread ()
 
 timerEvent (QTimerEvent *event)
 
 tr (const char *sourceText, const char *disambiguation=0, int n=-1)
 
 trUtf8 (const char *sourceText, const char *disambiguation=0, int n=-1)
 
 staticMetaObject
 
- Public Member Functions inherited from mgx::process::MeshProcess
 MeshProcess (const MeshProcess &copy)
 Copy constructor. More...
 
virtual QString type () const
 Returns a string identifying the process type.
 
const Stackstack (int i)
 
const StackcurrentStack ()
 
std::pair
< const_stack_iterator,
const_stack_iterator > 
stacks () const
 
- Public Member Functions inherited from mgx::process::Process
 Process ()
 Default constructor.
 
 Process (const Process &p)
 Copy constructor. More...
 
virtual ~Process ()
 Virtual destructor.
 
void actingFile (const QString &filename, bool project_file=false)
 Method to be called anytime a file is acted on (i.e. More...
 
QString actingFile () const
 Get the file currently defining the path of the system.
 
QString pythonCall (const QStringList &parms) const
 Return the python call describing the current process.
 
int stackCount () const
 Number of stacks available to the process.
 
Stackstack (int i)
 Returns the ith stack, or 0 if there is no such stack.
 
StackcurrentStack ()
 Returns the current stack (i.e. More...
 
int currentStackId () const
 Return the id (i.e. More...
 
void setCurrentStackId (int i)
 Change which stack is current.
 
std::pair< stack_iterator,
stack_iterator > 
stacks ()
 Iterate over all the stacks.
 
std::pair
< const_stack_iterator,
const_stack_iterator > 
stacks () const
 Iterate over all the stacks.
 
StackaddStack ()
 Add a new stack to the process.
 
bool deleteStack (int i)
 Delete the stack of given id. More...
 
int meshCount () const
 Returns the number of mesh available to the process.
 
Meshmesh (int i)
 Returns the ith mesh.
 
MeshcurrentMesh ()
 Returns the current mesh (i.e. More...
 
int currentMeshId () const
 Returns the id (i.e. More...
 
void setCurrentMeshId (int i)
 Change which mesh is current.
 
std::pair< mesh_iterator,
mesh_iterator > 
meshes ()
 Iterate over all the meshs.
 
std::pair< const_mesh_iterator,
const_mesh_iterator > 
meshes () const
 Iterate over all the meshs.
 
MeshaddMesh (const Stack *stack)
 Add a mesh to the process for the given stack.
 
bool deleteMesh (int i)
 Remove a mesh from the process.
 
int selectedLabel () const
 Get the current selected label.
 
void setSelectedLabel (int label)
 Change the current selected label.
 
float globalBrightness ()
 Return the current setting for the global brightness level.
 
float globalContrast ()
 Return the current setting for the global contrast level.
 
void setGlobalBrightness (float value)
 Change the current setting for the global brightness level. More...
 
void setGlobalContrast (float value)
 Change the current setting for the global contrast level. More...
 
bool meshSelection () const
 Returns if the user has mesh selection active.
 
bool lineBorderSelection () const
 Returns is the user has line border selection active.
 
void updateState ()
 Update the state of the application from the current data. More...
 
void updateViewer ()
 Force the viewer to refresh, without pausing the process.
 
bool setErrorMessage (const QString &str)
 Set an error message that will be displayed if the process returns false.
 
QString errorMessage () const
 Get the current error message.
 
void setWarningMessage (const QString &str)
 Set a warning message that will be displayed if the process returns true.
 
QString warningMessage () const
 Get the current warning message.
 
void userCancel () const
 Throw an exception informing the system that the user canceled the current process.
 
const QStringfile () const
 Get the name of the file that was used to load the current process (i.e. More...
 
Clipclip1 ()
 Return the object defining the first clipping region.
 
Clipclip2 ()
 Return the object defining the second clipping region.
 
Clipclip3 ()
 Return the object defining the third clipping region.
 
const Clipclip1 () const
 Return the object defining the first clipping region.
 
const Clipclip2 () const
 Return the object defining the second clipping region.
 
const Clipclip3 () const
 Return the object defining the third clipping region.
 
CuttingSurfacecuttingSurface ()
 Return the cutting surface.
 
const CuttingSurfacecuttingSurface () const
 Return the cutting surface.
 
QStringList booleanChoice () const
 Helper function that provides a list of choices for a boolean argument.
 
QStringList storeChoice () const
 Helper function that provides a list of choices for choosing from the main or work stack.
 
virtual uint numParms () const
 Returns the number of named string for this process.
 
ProcessmakeProcess (const QString &processType, const QString &processName)
 Creates a process object by name.
 
bool RunProcess (Process &proc, const QStringList &parms) throw ()
 Launch a process with generic arguments. More...
 
bool RunProcess (const QString &processType, const QString &processName, const QStringList &parms) throw ()
 Launch a process by name. More...
 
CheckState checkState ()
 Call this function and convert the result to a boolean. More...
 

Protected Slots

void selectMeshFile ()
 

Protected Member Functions

QString properFile (QString filename) const
 
void setMeshFile (const QString &filename)
 
Point3f savedPos (Point3f pos, bool transform, const Stack *stack)
 
bool saveMesh (Mesh *mesh, const QString &filename, bool transform)
 
- Protected Member Functions inherited from mgx::process::Process
bool systemCommand (SystemCommand cmd, const QStringList &parms)
 Method that can be used to launch a system command. More...
 
bool stackCheck (int checks, int which)
 Check stack properties.
 
bool storeCheck (int checks, int which)
 Check store properties.
 
bool meshCheck (int checks, int which)
 Check mesh properties.
 
QString stackError (int checks, int which)
 Generate a standardised string describing how the stack should be to not generate an error.
 
QString storeError (int checks, int which)
 Generate a standardised string describing how the store should be to not generate an error.
 
QString meshError (int checks, int which)
 Generate a standardised string describing how the mesh should be to not generate an error.
 

Protected Attributes

QDialogdlg
 
Ui_SaveMeshDialog * ui
 

Additional Inherited Members

- Public Types inherited from mgx::process::Process
typedef std::vector< Stack * >
::iterator 
stack_iterator
 
typedef std::vector< Stack * >
::const_iterator 
const_stack_iterator
 
typedef std::vector< Mesh * >
::iterator 
mesh_iterator
 
typedef std::vector< Mesh * >
::const_iterator 
const_mesh_iterator
 
enum  StackCheckType {
  STACK_ANY, STACK_NON_EMPTY, STACK_VISIBLE, STACK_EMPTY,
  STACK_SCALED, STACK_TRANSFORMED, STACK_NON_SCALED, STACK_NON_TRANSFORMED
}
 Enumeration for the bitfield that identifies stack properties. More...
 
enum  StoreCheckType {
  STORE_ANY, STORE_NON_EMPTY, STORE_VISIBLE, STORE_EMPTY,
  STORE_LABEL, STORE_NON_LABEL, STORE_SCALED, STORE_TRANSFORMED,
  STORE_NON_SCALED, STORE_NON_TRANSFORMED, STORE_WORK, STORE_MAIN
}
 Enumeration for the bitfield that identifies store properties. More...
 
enum  MeshCheckType {
  MESH_ANY, MESH_NON_EMPTY, MESH_VISIBLE, MESH_HEAT,
  MESH_LABEL, MESH_NORMAL, MESH_SIGNAL, MESH_TEXTURE,
  MESH_IMAGE, MESH_SHOW_MESH, MESH_SHOW_SURF, MESH_ALL,
  MESH_BORDER, MESH_CELLMAP, MESH_CELLS, MESH_IMG_TEX,
  MESH_SCALED, MESH_TRANSFORMED, MESH_EMPTY, MESH_NON_CELLS,
  MESH_NON_IMG_TEX, MESH_NON_SCALED, MESH_NON_TRANSFORMED, MESH_PARENT,
  MESH_LABEL_PARENT
}
 Enumeration for the bitfield that identifies mesh properties. More...
 
enum  CheckType { CHECK_STACK, CHECK_STORE, CHECK_MESH }
 Enumeration of the type of checks that can be performed. More...
 
enum  CheckWhich { CHECK_CURRENT }
 
- Public Attributes inherited from mgx::process::Process
PrivateProcess * p
 
- Static Public Attributes inherited from mgx::process::Process
static unsigned int processVersion
 

Detailed Description

Save a mesh into a INRIA or MGXM file.

Description of the MGXM file format

MGXM is a binary file format to store triangular meshes with all the data and meta-data used by MorphoGraphX.

There are a few versions, from 1.0 to 1.2. This version of MorphoGraphX will always generate MGXM files version 1.2.

Each MGXM file starts with the ASCII string MGXM followed by a space, the version number in ASCII and another space. For instance, for the current version, the file starts with the ASCII string "MGXM 1.2 ".

A binary header follows the version number. The header is made of:

Field Size (bytes) type Version Description
is_cells 1 bool 1.2 If true, the mesh represent 2D cells (see notes)
scale 1 bool 1.1 If true, the mesh has been scaled when saved
transform 1 bool 1.1 If true, the mesh has been transformed rigidly
signalLow 4 float 1.1 Lower value of the signal
signalHigh 4 float 1.1 Upper value of the signal
signalUnit * utf8 1.1 Text of the signal unit (see notes)
header_size 4 uint 1.0 Specified the size in bytes of extra data placed after the header
vertex_cnt 4 uint 1.0 Number of vertices in the mesh
vertex_size 4 uint 1.0 Size in bytes of the structure describing a vertex, minus 12.
edge_size 4 uint 1.0 Size in bytes of the structure describing an edge.

The description of the vertices follows the header. For each vertex, a structure of size vertex_size+12 is written. Only fields fitting in the given size are actually written, and any other data is ignored. Note that the first four field are always there!

Field Size (bytes) type Description
Id 4 uint Id of the vertex, used to reference it in other places in the file
X 4 float X position of the vertex
Y 4 float Y position of the vertex
Z 4 float Z position of the vertex
label 4 uint Label of the vertex
color 4 float "Color" of the vertex (e.g. like signal, but scaled from 0 to 1)
signal 4 float Signal of the vertex
type 1 char type of vertex 'c' for center and 'j' for junction.
selected 1 bool If true, the vertex is selected

Currently, the edges have no defined fields. For each vertex, the Id of the vertex is written, followed by a 32 bits unsigned integer for the number of neighbors, and the list of Id for each neighbor. Neighbors of a vertex are always written counter-clockwise.

Notes on UTF-8 strings

UTF-8 strings are written as: their size in bytes as a 32 bits unsigned integer, followed by the bytes themselves.

Notes on vertex labels

Vertex are labels to mark which cells they are part of. Boundary vertices are labeled with -1 or -2. -1 mark vertices between cells, and -2 vertices at the border of the whole mesh.

Notes on cell mesh

If the mesh is a cell mesh, then each cell has a unique labeled vertex on its center, surrounded by cell-boundary vertices, labels -1 or -2. In this case, labeled vertices have type 'c' and boundary vertices 'j'.

Member Function Documentation

QString mgx::process::MeshSave::folder ( ) const
inlinevirtual

Folder in which to place the process.

Subfolders can be specified by placing '/' in the path

Note
This is a purely presentation parameter. It doesn't allow two processes to have the same name if they are in different folders.

Reimplemented from mgx::process::Process.

QIcon mgx::process::MeshSave::icon ( ) const
inlinevirtual

Icon to use to represent the process in the GUI.

Note that to use an icon present in the resources, you must precede the path with a colon (i.e. ":/images/myicon.png".

Reimplemented from mgx::process::Process.

bool mgx::process::MeshSave::initialize ( QStringList ,
QWidget  
)
virtual

This is an optional method that is called only when a process is launched from the GUI.

If reimplemented, it receives a potential argument list, and should provide a GUI for editing it. Once the user finishing the edition, this method should modify the provided arguments and return true. If the user aborts, the method should return false. Note that returning false does not produce an error.

Parameters
parmsList of arguments
parentPointer to the parent widget. If the configure method creates a GUI, it should be a child of this widget.

Reimplemented from mgx::process::Process.

QString mgx::process::MeshSave::name ( ) const
inlinevirtual

Returns the name of the process.

Note that the name must be a valid identifier in Python once the spaces are replaced by underscores. Also, all underscore in the name will be replaced by spaces for user presentation.

Implements mgx::process::Process.

bool mgx::process::MeshSave::operator() ( const QStringList parms)
virtual

Implementation of the process with generic arguments.

The number of arguments is guaranteed to be at least as many as the ones named in the process.

Implements mgx::process::Process.

bool mgx::process::MeshSave::operator() ( Mesh mesh,
const QString filename,
bool  transform 
)

Save a mesh.

Parameters
meshMesh to be saved
filenameFile to save the mesh in. Its extension must be either .inr or .mgmx [aram transform Save the transformed positions
ParmChoiceMap mgx::process::MeshSave::parmChoice ( ) const
inlinevirtual

Purely for GUI purposes, provides for some of the parms parameter a choice.

In this case, the user will be presented with a combo box presenting the provided list. Note that no mechanism forces the user to choose one of this choice.

Reimplemented from mgx::process::Process.

QStringList mgx::process::MeshSave::parmDescs ( ) const
inlinevirtual

List of parameters descriptions.

There must be as many parameters than defaults.

Reimplemented from mgx::process::Process.

QStringList mgx::process::MeshSave::parmNames ( ) const
inlinevirtual

List of named parameters.

There must be as many parameters than defaults.

Implements mgx::process::Process.


The documentation for this class was generated from the following file: