2 * Copyright (c) 1995 Silicon Graphics, Inc. All Rights Reserved.
3 * Copyright (c) 2009 Aconex. All Rights Reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 #include "metriclist.h"
21 #include <QStringList>
27 class BarObj
: public ModObj
31 enum LabelDir
{ away
, towards
};
32 enum LabelSide
{ left
, right
, above
, below
, numSides
};
36 ViewObj::Shape _shape
;
37 BarMod::Direction _dir
;
38 BarMod::Modulation _mod
;
39 BarMod::Grouping _group
;
47 QStringList
*_metLabels
;
49 QStringList
*_instLabels
;
50 float _margins
[numSides
];
57 BarObj(ViewObj::Shape shape
,
58 BarMod::Direction dir
,
59 BarMod::Modulation mod
,
60 BarMod::Grouping group
,
62 const DefaultObj
&defaults
,
64 int cols
= 1, int rows
= 1,
65 BaseObj::Alignment align
= BaseObj::center
);
67 virtual int width() const
69 virtual int depth() const
73 BarMod::Direction
dir() const
75 BarMod::Modulation
mod() const
77 int numMetricLabels() const
78 { return _metLabels
->size(); }
79 LabelDir
metricLabelDir() const
81 int numInstLabels() const
82 { return _instLabels
->size(); }
83 LabelDir
instLabelDir() const
86 void addMetric(const char *metric
, double scale
, const char *label
)
87 { if (_metrics
.add(metric
, scale
) >= 0) _metLabels
->append(label
); }
89 void addMetricLabel(const char *label
)
90 { _metLabels
->append(label
); }
91 void addInstLabel(const char *label
)
92 { _instLabels
->append(label
); }
94 virtual void finishedAdd();
101 LabelDir
&metricLabelDir()
103 LabelDir
&instLabelDir()
106 virtual void setTran(float xTran
, float zTran
, int width
, int depth
);
108 virtual const char* name() const;
110 virtual void display(QTextStream
& os
) const;
112 friend QTextStream
& operator<<(QTextStream
& os
, BarObj
const& rhs
);
116 Text
** calcLabels(const QStringList
&labels
, LabelSide side
,
118 SoNode
*doLabels(Text
**text
, LabelSide side
, int numLabels
);
121 BarObj(BarObj
const&);
122 BarObj
const& operator=(BarObj
const &);
125 #endif /* _BAROBJ_H_ */