summaryrefslogtreecommitdiff
path: root/src/pmview/modulate.h
blob: b8e6b7dd3b860904e9e4d933f51c542b2192a453 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
 * 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 _MODULATE_H_
#define _MODULATE_H_

#include <Inventor/SbString.h>
#include "metriclist.h"

class SoSeparator;
class SoPath;
class Launch;
class Record;

extern double		theNormError;
extern float		theScale;

class Modulate
{
public:

    enum State	{ start, error, saturated, normal };

protected:

    static const QString	theErrorText;
    static const QString	theStartText;
    static const float		theDefErrorColor[];
    static const float		theDefSaturatedColor[];
    static const double		theMinScale;

    int				_sts;
    MetricList			*_metrics;
    SoSeparator			*_root;
    SbColor			_errorColor;
    SbColor			_saturatedColor;

public:

    virtual ~Modulate();

    Modulate(const char *metric, double scale,
		 MetricList::AlignColor align = MetricList::perMetric);

    Modulate(const char *metric, double scale, const SbColor &color,
		 MetricList::AlignColor align = MetricList::perMetric);

    Modulate(MetricList *list);

    int status() const
	{ return _sts; }
    const SoSeparator *root() const
	{ return _root; }
    SoSeparator *root()
	{ return _root; }

    int numValues() const
	{ return _metrics->numValues(); }

    const char *add();

    void setErrorColor(const SbColor &color)
	{ _errorColor.setValue(color.getValue()); }
    void setSaturatedColor(const SbColor &color)
        { _saturatedColor.setValue(color.getValue()); }

    virtual void refresh(bool fetchFlag) = 0;

    // Return the number of objects still selected
    virtual void selectAll();
    virtual int select(SoPath *)
	{ return 0; }
    virtual int remove(SoPath *)
	{ return 0; }

    // Should expect selectInfo calls to different paths without
    // previous removeInfo calls
    virtual void selectInfo(SoPath *)
	{}
    virtual void removeInfo(SoPath *)
	{}

    virtual void infoText(QString &str, bool selected) const = 0;

    virtual void launch(Launch &launch, bool all) const = 0;
    virtual void record(Record &rec) const;

    virtual void dump(QTextStream &) const
	{}
    void dumpState(QTextStream &os, State state) const;

    friend QTextStream &operator<<(QTextStream &os, const Modulate &rhs);

protected:

    static void add(Modulate *obj);

private:

    Modulate();
    Modulate(const Modulate &);
    const Modulate &operator=(const Modulate &);
    // Never defined
};

#endif /* _MODULATE_H_ */