diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
commit | 47e6e7c84f008a53061e661f31ae96629bc694ef (patch) | |
tree | 648a07f3b5b9d67ce19b0fd72e8caa1175c98f1a /src/pmview/barmod.h | |
download | pcp-debian.tar.gz |
Debian 3.9.10debian/3.9.10debian
Diffstat (limited to 'src/pmview/barmod.h')
-rw-r--r-- | src/pmview/barmod.h | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/src/pmview/barmod.h b/src/pmview/barmod.h new file mode 100644 index 0000000..073f7ce --- /dev/null +++ b/src/pmview/barmod.h @@ -0,0 +1,133 @@ +/* + * Copyright (c) 1997 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2009 Aconex. All Rights Reserved. + * + * This program 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 2 of the License, or (at your + * option) any later version. + * + * This program 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. + */ +#ifndef _BARMOD_H_ +#define _BARMOD_H_ + +#include "colorscale.h" +#include "modulate.h" +#include <QtCore/QVector> + +class SoBaseColor; +class SoScale; +class SoNode; +class SoTranslation; +class Launch; + +struct BarBlock { + SoSeparator *_sep; + SoBaseColor *_color; + SoScale *_scale; + SoTranslation *_tran; + Modulate::State _state; + bool _selected; +}; + +typedef QVector<BarBlock> BarBlockList; + +class BarMod : public Modulate +{ +public: + + enum Direction { instPerCol, instPerRow }; + enum Modulation { yScale, color, colYScale }; + enum Grouping { groupByRow, groupByCol, groupByMetric, groupByInst }; + +private: + + static const char theBarId; + + BarBlockList _blocks; + Direction _dir; + Modulation _mod; + Grouping _group; + ColorScale _colScale; + int _selectCount; + int _infoValue; + int _infoMetric; + int _infoInst; + float _xScale; + float _yScale; + float _zScale; + int _width; + int _depth; + int _cols; + int _rows; + +public: + + virtual ~BarMod(); + + BarMod(MetricList *list, + SoNode *obj, + BarMod::Direction dir, + BarMod::Grouping group, + float xScale, float yScale, float zScale, + float xSpace, float zSpace); + + BarMod(MetricList *list, + const ColorScale &colScale, + SoNode *obj, + BarMod::Direction dir, + BarMod::Modulation mod, + BarMod::Grouping group, + float xScale, float yScale, float zScale, + float xSpace, float zSpace); + + Direction dir() const + { return _dir; } + int width() const + { return _width; } + int depth() const + { return _depth; } + int numBars() const + { return _blocks.size(); } + int rows() const + { return _rows; } + int cols() const + { return _cols; } + + virtual void refresh(bool fetchFlag); + + virtual void selectAll(); + virtual int select(SoPath *); + virtual int remove(SoPath *); + + virtual void selectInfo(SoPath *); + virtual void removeInfo(SoPath *); + + virtual void infoText(QString &str, bool) const; + + virtual void launch(Launch &launch, bool) const; + + virtual void dump(QTextStream &) const; + + void regenerate(float xScale, float zScale, float xSpace, float zSpace); + + const char *dirStr() const; + const char *modStr() const; + +private: + + BarMod(); + BarMod(const BarMod &); + const BarMod &operator=(const BarMod &); + // Never defined + + void generate(SoNode *obj, float xSpace, float zSpace); + void findBlock(SoPath *path, int &metric, int &inst, + int &value, bool idMetric = true); +}; + +#endif /* _BARMOD_H_ */ |