Loading...
Searching...
No Matches
dataset.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_VIEW_DATATYPE_DATASET_H
#define BALL_VIEW_DATATYPE_DATASET_H
#ifndef BALL_DATATYPE_STRING_H
# include <BALL/DATATYPE/string.h>
#endif
#ifndef BALL_DATATYPE_HASHMAP_H
# include <BALL/DATATYPE/hashMap.h>
#endif
#ifndef BALL_DATATYPE_HASHSET_H
# include <BALL/DATATYPE/hashSet.h>
#endif
#ifndef BALL_CONCEPT_EMBEDDABLE_H
# include <BALL/CONCEPT/embeddable.h>
#endif
#ifndef BALL_VIEW_KERNEL_UIOPERATIONMODE_H
# include <BALL/VIEW/KERNEL/UIOperationMode.h>
#endif
#include <QtWidgets/QMenu>
#include <QtWidgets/QTreeWidgetItem>
namespace BALL
{
class Composite;
namespace VIEW
{
class DatasetControl;
class DatasetMessage;
class MainControl;
class DataMessage;
class BALL_VIEW_EXPORT Dataset
{
public:
Dataset();
Dataset(const Dataset& dataset);
virtual ~Dataset();
virtual void clear();
void set(const Dataset& v);
const Dataset& operator = (const Dataset& v);
void setName(String name) { name_ = name;}
String getName() const { return name_;}
void setType(String type) { type_ = type;}
String getType() const { return type_;}
void setComposite(Composite* composite) { composite_ = composite;}
Composite* getComposite() const { return composite_;}
void dump(std::ostream& s, Size depth) const;
//
protected:
Composite* composite_;
String name_;
String type_;
};
#define BALL_CREATE_DATASET(TYPE)\
class BALL_VIEW_EXPORT TYPE##Dataset\
: public Dataset\
{\
public :\
\
TYPE##Dataset(TYPE* data = 0)\
: Dataset(),\
data_(data)\
{}\
\
TYPE##Dataset(const TYPE##Dataset& set)\
: Dataset(set),\
data_(set.data_)\
{}\
\
TYPE* getData() { return data_;}\
\
void setData(TYPE* data) { data_ = data;}\
\
TYPE* data_;\
};
class BALL_VIEW_EXPORT DatasetController
: public QObject,
public Embeddable
{
Q_OBJECT
friend class DatasetControl;
public:
BALL_EMBEDDABLE(DatasetController,Embeddable)
DatasetController();
DatasetController(DatasetController& dc);
virtual ~DatasetController();
void setDatasetControl(DatasetControl* dc) { control_ = dc;}
DatasetControl* getDatasetControl() { return control_;}
virtual bool handle(DatasetMessage* msg);
virtual bool insertDataset(Dataset* set);
virtual bool deleteDataset(Dataset* set);
virtual bool createMenuEntries();
virtual QMenu* buildContextMenu(QTreeWidgetItem* item);
vector<Dataset*> getDatasets();
vector<Dataset*> getSelectedDatasets();
Dataset* getSelectedDataset();
bool hasDataset(Dataset* set);
bool hasItem(QTreeWidgetItem* item);
Dataset* getDataset(QTreeWidgetItem* item);
String getType() { return type_;}
virtual void checkMenu(MainControl& mc);
vector<String> getSupportedFileFormats() { return file_formats_;}
public Q_SLOTS:
virtual bool write();
bool open();
virtual bool deleteDatasets();
virtual bool deleteDataset();
protected:
void setStatusbarText(const String& text, bool important = false);
void setStatusbarText(const QString& text, bool important = false);
virtual bool write(Dataset* /*set*/, String /*filetype*/, String /*filename*/);
virtual Dataset* open(String /*filetype*/, String /*filename*/);
String getFileTypes_();
String getNameFromFileName_(String filename);
QAction* insertMenuEntry_(Position pid, const QString& name, const char* slot,
const String& description = "", QKeySequence accel = QKeySequence(),
const QString& menu_hint = "",
UIOperationMode::OperationMode initial_mode = UIOperationMode::MODE_ALL);
virtual void deleteDataset_(Dataset*) {};
String type_;
vector<String> file_formats_;
DatasetControl* control_;
vector<QAction*> actions_;
HashSet<QAction*> actions_for_one_set_;
HashMap<QTreeWidgetItem*, Dataset*> item_to_dataset_;
HashMap<Dataset*, QTreeWidgetItem*> dataset_to_item_;
};
} // namespace VIEW
} // namespace BALL
#endif // BALL_VIEW_DATATYPE_DATASET_H
BALL_VIEW_EXPORT
#define BALL_VIEW_EXPORT
Definition COMMON/global.h:52
UIOperationMode.h
BALL::Composite
Definition composite.h:74
BALL::Embeddable::Embeddable
Embeddable(const String &identifier="<Embeddable>")
BALL::HashMap
HashMap class based on the STL map (containing serveral convenience functions).
Definition hashMap.h:74
BALL::HashSet
Definition hashSet.h:46
BALL::String
Definition string.h:57
BALL::VIEW::DatasetControl
Definition datasetControl.h:38
BALL::VIEW::DatasetController::deleteDatasets
virtual bool deleteDatasets()
Delete all Datasets.
BALL::VIEW::DatasetController::getNameFromFileName_
String getNameFromFileName_(String filename)
BALL::VIEW::DatasetController::hasItem
bool hasItem(QTreeWidgetItem *item)
Test if a given QTreeWidgetItem corresponds to a registered Dataset.
BALL::VIEW::DatasetController::control_
DatasetControl * control_
Definition dataset.h:324
BALL::VIEW::DatasetController::setStatusbarText
void setStatusbarText(const String &text, bool important=false)
BALL::VIEW::DatasetController::getDatasets
vector< Dataset * > getDatasets()
Get all Datasets of this type in the DatasetControl.
BALL::VIEW::DatasetController::getDataset
Dataset * getDataset(QTreeWidgetItem *item)
Get the Dataset for a QTreeWidgetItem.
BALL::VIEW::DatasetController::insertMenuEntry_
QAction * insertMenuEntry_(Position pid, const QString &name, const char *slot, const String &description="", QKeySequence accel=QKeySequence(), const QString &menu_hint="", UIOperationMode::OperationMode initial_mode=UIOperationMode::MODE_ALL)
BALL::VIEW::DatasetController::getDatasetControl
DatasetControl * getDatasetControl()
Definition dataset.h:215
BALL::VIEW::DatasetController::setStatusbarText
void setStatusbarText(const QString &text, bool important=false)
BALL::VIEW::DatasetController::checkMenu
virtual void checkMenu(MainControl &mc)
BALL::VIEW::DatasetController::type_
String type_
Definition dataset.h:322
BALL::VIEW::DatasetController::getType
String getType()
Definition dataset.h:268
BALL::VIEW::DatasetController::write
virtual bool write(Dataset *, String, String)
BALL::VIEW::DatasetController::getSelectedDataset
Dataset * getSelectedDataset()
BALL::VIEW::DatasetController::buildContextMenu
virtual QMenu * buildContextMenu(QTreeWidgetItem *item)
BALL::VIEW::DatasetController::getSelectedDatasets
vector< Dataset * > getSelectedDatasets()
Get all selected Datasets of this type in the DatasetControl.
BALL::VIEW::DatasetController::item_to_dataset_
HashMap< QTreeWidgetItem *, Dataset * > item_to_dataset_
Definition dataset.h:327
BALL::VIEW::DatasetController::dataset_to_item_
HashMap< Dataset *, QTreeWidgetItem * > dataset_to_item_
Definition dataset.h:328
BALL::VIEW::DatasetController::write
virtual bool write()
Show a file dialog for writing the selected Dataset.
BALL::VIEW::DatasetController::getSupportedFileFormats
vector< String > getSupportedFileFormats()
Definition dataset.h:283
BALL::VIEW::DatasetController::setDatasetControl
void setDatasetControl(DatasetControl *dc)
Definition dataset.h:212
BALL::VIEW::DatasetController::deleteDataset
virtual bool deleteDataset()
Delete the currently highlighted Dataset.
BALL::VIEW::DatasetController::DatasetControl
friend class DatasetControl
Definition dataset.h:196
BALL::VIEW::DatasetController::DatasetController
DatasetController()
BALL::VIEW::DatasetController::actions_
vector< QAction * > actions_
Definition dataset.h:325
BALL::VIEW::DatasetController::deleteDataset
virtual bool deleteDataset(Dataset *set)
BALL::VIEW::DatasetController::insertDataset
virtual bool insertDataset(Dataset *set)
BALL::VIEW::DatasetController::getFileTypes_
String getFileTypes_()
BALL::VIEW::DatasetController::open
virtual Dataset * open(String, String)
BALL::VIEW::DatasetController::deleteDataset_
virtual void deleteDataset_(Dataset *)
Definition dataset.h:320
BALL::VIEW::DatasetController::handle
virtual bool handle(DatasetMessage *msg)
BALL::VIEW::DatasetController::createMenuEntries
virtual bool createMenuEntries()
BALL::VIEW::DatasetController::file_formats_
vector< String > file_formats_
Definition dataset.h:323
BALL::VIEW::DatasetController::open
bool open()
BALL::VIEW::DatasetController::hasDataset
bool hasDataset(Dataset *set)
BALL::VIEW::DatasetController::actions_for_one_set_
HashSet< QAction * > actions_for_one_set_
Definition dataset.h:326
BALL::VIEW::DatasetMessage
Definition message.h:139
BALL::VIEW::Dataset
Definition dataset.h:61
BALL::VIEW::Dataset::getComposite
Composite * getComposite() const
Definition dataset.h:114
BALL::VIEW::Dataset::composite_
Composite * composite_
Definition dataset.h:123
BALL::VIEW::Dataset::type_
String type_
Definition dataset.h:125
BALL::VIEW::Dataset::setName
void setName(String name)
Definition dataset.h:99
BALL::VIEW::Dataset::name_
String name_
Definition dataset.h:124
BALL::VIEW::Dataset::setType
void setType(String type)
Definition dataset.h:105
BALL::VIEW::Dataset::~Dataset
virtual ~Dataset()
BALL::VIEW::Dataset::setComposite
void setComposite(Composite *composite)
Definition dataset.h:111
BALL::VIEW::Dataset::Dataset
Dataset(const Dataset &dataset)
BALL::VIEW::Dataset::getType
String getType() const
Definition dataset.h:108
BALL::VIEW::Dataset::getName
String getName() const
Definition dataset.h:102
BALL::VIEW::Dataset::Dataset
Dataset()
BALL::VIEW::Dataset::dump
void dump(std::ostream &s, Size depth) const
BALL::VIEW::Dataset::clear
virtual void clear()
BALL::VIEW::Dataset::set
void set(const Dataset &v)
BALL::VIEW::MainControl
Definition mainControl.h:118
BALL::VIEW::UIOperationMode::OperationMode
OperationMode
Definition UIOperationMode.h:30
BALL::VIEW::UIOperationMode::MODE_ALL
@ MODE_ALL
Definition UIOperationMode.h:34
QObject
QTreeWidgetItem
embeddable.h
BALL_EMBEDDABLE
#define BALL_EMBEDDABLE(TYPE, BASE)
Definition embeddable.h:31
hashMap.h
hashSet.h
BALL::VIEW
Definition constraints.h:35
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::Position
BALL_SIZE_TYPE Position
Definition COMMON/global.h:140
string.h