\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 5.0.2 - Three
CGAL::Three::Polyhedron_demo_io_plugin_interface Class Referenceabstract

#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>

Definition

This class provides a base for creating a new IO plugin.

Public Member Functions

virtual void init ()
 Initializes the plugin This function is called in the constructor of the MainWindow. More...
 
virtual QString name () const =0
 Returns the name of the plugin It is used by the loading system. More...
 
virtual QString nameFilters () const =0
 The filters for the names of the files that can be used by the plugin. More...
 
virtual QString saveNameFilters () const
 Returns only the filters used for saving. More...
 
virtual QString loadNameFilters () const
 Returns only the filters used for loading. More...
 
virtual bool canLoad (QFileInfo fileinfo) const =0
 Specifies if the io_plugin is able to load an item or not. More...
 
virtual QList< Scene_item * > load (QFileInfo fileinfo, bool &ok, bool add_to_scene=true)=0
 Loads one or more item(s) from a file. More...
 
virtual bool canSave (const Scene_item *)=0
 Specifies if the io_plugin can save the item or not. More...
 
virtual bool save (QFileInfo fileinfo, QList< CGAL::Three::Scene_item *> &)=0
 Saves one or more items in the file corresponding to the path contained in fileinfo. More...
 
virtual bool isDefaultLoader (const Scene_item *) const
 If this returns true, then the loader will be chosen as default in the list of available loaders when saving a file, which means it will be the first in the list. More...
 
virtual bool isDefaultLoader (const QString &name) const
 If this returns true, then the loader will be chosen as default in the list of available loaders when loading a file, which means it will be the first in the list. More...
 

Member Function Documentation

◆ canLoad()

virtual bool CGAL::Three::Polyhedron_demo_io_plugin_interface::canLoad ( QFileInfo  fileinfo) const
pure virtual

Specifies if the io_plugin is able to load an item or not.

This must be overriden.

◆ canSave()

virtual bool CGAL::Three::Polyhedron_demo_io_plugin_interface::canSave ( const Scene_item )
pure virtual

Specifies if the io_plugin can save the item or not.

This must be overriden.

◆ init()

virtual void CGAL::Three::Polyhedron_demo_io_plugin_interface::init ( )
virtual

Initializes the plugin This function is called in the constructor of the MainWindow.

Whatever initialization the plugin needs can be done here. Default behavior is to do nothing.

◆ isDefaultLoader() [1/2]

virtual bool CGAL::Three::Polyhedron_demo_io_plugin_interface::isDefaultLoader ( const Scene_item ) const
virtual

If this returns true, then the loader will be chosen as default in the list of available loaders when saving a file, which means it will be the first in the list.

◆ isDefaultLoader() [2/2]

virtual bool CGAL::Three::Polyhedron_demo_io_plugin_interface::isDefaultLoader ( const QString &  name) const
virtual

If this returns true, then the loader will be chosen as default in the list of available loaders when loading a file, which means it will be the first in the list.

Parameters
nameis the extension without the dot (e.g. "off" for a .off file)

◆ load()

virtual QList<Scene_item*> CGAL::Three::Polyhedron_demo_io_plugin_interface::load ( QFileInfo  fileinfo,
bool &  ok,
bool  add_to_scene = true 
)
pure virtual

Loads one or more item(s) from a file.

ok is true if the loading was successful, false otherwise. New items will be added to the scene if add_to_scene is true. You don't want that when you reload an item, for example, as it will be added at some other point of the process. This must be overriden.

◆ loadNameFilters()

virtual QString CGAL::Three::Polyhedron_demo_io_plugin_interface::loadNameFilters ( ) const
virtual

Returns only the filters used for loading.

The default is nameFilters(). You must override this function to change its behavior. If multiple plugins have the same load filters, only once will be kept, so be careful not to use one that already exists.

◆ name()

virtual QString CGAL::Three::Polyhedron_demo_io_plugin_interface::name ( ) const
pure virtual

Returns the name of the plugin It is used by the loading system.

◆ nameFilters()

virtual QString CGAL::Three::Polyhedron_demo_io_plugin_interface::nameFilters ( ) const
pure virtual

The filters for the names of the files that can be used by the plugin.

Example : to filter OFF files : return "OFF files (*.off)"

◆ save()

virtual bool CGAL::Three::Polyhedron_demo_io_plugin_interface::save ( QFileInfo  fileinfo,
QList< CGAL::Three::Scene_item *> &   
)
pure virtual

Saves one or more items in the file corresponding to the path contained in fileinfo.

Returns false if error. This must be overriden.

Attention
When a file is successfully saved, it must be removed from the list.

◆ saveNameFilters()

virtual QString CGAL::Three::Polyhedron_demo_io_plugin_interface::saveNameFilters ( ) const
virtual

Returns only the filters used for saving.

The default is nameFilters(). You must override this function to change its behavior.