annotate src/graphics.h.in @ 7214:86d0b16f2bb2

[project @ 2007-11-29 03:40:04 by jwe]
author jwe
date Thu, 29 Nov 2007 03:40:04 +0000
parents 4612ef369abb
children dd8b3bbeeaf9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1 /*
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3 Copyright (C) 2007 John W. Eaton
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6962
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6962
diff changeset
10 option) any later version.
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
11
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
15 for more details.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
16
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6962
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6962
diff changeset
19 <http://www.gnu.org/licenses/>.
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
20
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
21 */
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
22
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
23 #if !defined (graphics_h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
24 #define graphics_h 1
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
25
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
26 #ifdef HAVE_CONFIG_H
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
27 #include <config.h>
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
28 #endif
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
29
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
30 #include <cctype>
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
31
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
32 #include <algorithm>
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
33 #include <list>
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
34 #include <map>
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
35 #include <set>
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
36 #include <string>
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
37
6890
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
38 #include "gripes.h"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
39 #include "oct-map.h"
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
40 #include "ov.h"
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
41
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
42 class caseless_str : public std::string
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
43 {
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
44 public:
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
45 typedef std::string::iterator iterator;
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
46 typedef std::string::const_iterator const_iterator;
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
47
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
48 caseless_str (void) : std::string () { }
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
49 caseless_str (const std::string& s) : std::string (s) { }
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
50 caseless_str (const char *s) : std::string (s) { }
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
51
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
52 caseless_str (const caseless_str& name) : std::string (name) { }
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
53
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
54 caseless_str& operator = (const caseless_str& pname)
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
55 {
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
56 std::string::operator = (pname);
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
57 return *this;
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
58 }
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
59
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
60 operator std::string (void) const { return *this; }
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
61
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
62 // Case-insensitive comparison.
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
63 bool compare (const std::string& s, size_t limit = NPOS) const
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
64 {
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
65 const_iterator p1 = begin ();
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
66 const_iterator p2 = s.begin ();
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
67
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
68 size_t k = 0;
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
69
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
70 while (p1 != end () && p2 != s.end () && k++ < limit)
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
71 {
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
72 if (std::tolower (*p1) != std::tolower (*p2))
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
73 return false;
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
74
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
75 *p1++;
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
76 *p2++;
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
77 }
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
78
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
79 return (limit == NPOS) ? size () == s.size () : k == limit;
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
80 }
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
81 };
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
82
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
83 // ---------------------------------------------------------------------
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
84
7212
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
85 class radio_values
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
86 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
87 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
88 radio_values (const std::string& opt_string = std::string ());
7168
f345eb60f941 [project @ 2007-11-13 15:16:52 by jwe]
jwe
parents: 7162
diff changeset
89
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
90 radio_values (const radio_values& a)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
91 : default_val (a.default_val), possible_vals (a.possible_vals) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
92
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
93 radio_values& operator = (const radio_values& a)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
94 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
95 if (&a != this)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
96 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
97 default_val = a.default_val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
98 possible_vals = a.possible_vals;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
99 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
100
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
101 return *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
102 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
103
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
104 std::string default_value (void) const { return default_val; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
105
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
106 bool validate (const std::string& val)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
107 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
108 bool retval = true;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
109
6898
f4e1bdb66535 [project @ 2007-09-14 05:20:43 by jwe]
jwe
parents: 6893
diff changeset
110 if (! contains (val))
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
111 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
112 error ("invalid value = %s", val.c_str ());
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
113 retval = false;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
114 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
115
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
116 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
117 }
6898
f4e1bdb66535 [project @ 2007-09-14 05:20:43 by jwe]
jwe
parents: 6893
diff changeset
118
f4e1bdb66535 [project @ 2007-09-14 05:20:43 by jwe]
jwe
parents: 6893
diff changeset
119 bool contains (const std::string& val)
f4e1bdb66535 [project @ 2007-09-14 05:20:43 by jwe]
jwe
parents: 6893
diff changeset
120 {
f4e1bdb66535 [project @ 2007-09-14 05:20:43 by jwe]
jwe
parents: 6893
diff changeset
121 return (possible_vals.find (val) != possible_vals.end ());
f4e1bdb66535 [project @ 2007-09-14 05:20:43 by jwe]
jwe
parents: 6893
diff changeset
122 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
123
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
124 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
125 // Might also want to cache
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
126 std::string default_val;
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
127 std::set<caseless_str> possible_vals;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
128 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
129
7212
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
130 class radio_property
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
131 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
132 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
133 radio_property (const radio_values& v)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
134 : vals (v), current_val (v.default_value ()) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
135
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
136 radio_property (const radio_values& v, const std::string& initial_value)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
137 : vals (v), current_val (initial_value) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
138
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
139 radio_property (const radio_property& a)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
140 : vals (a.vals), current_val (a.current_val) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
141
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
142 radio_property& operator = (const radio_property& a)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
143 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
144 if (&a != this)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
145 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
146 vals = a.vals;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
147 current_val = a.current_val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
148 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
149
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
150 return *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
151 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
152
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
153 radio_property& operator = (const std::string& newval)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
154 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
155 if (vals.validate (newval))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
156 current_val = newval;
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
157 else
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
158 error ("invalid value");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
159
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
160 return *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
161 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
162
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
163 radio_property& operator = (const octave_value& newval)
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
164 {
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
165 if (newval.is_string ())
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
166 {
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
167 std::string s = newval.string_value ();
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
168 if (vals.validate (s))
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
169 current_val = s;
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
170 else
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
171 error ("invalid value");
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
172 }
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
173 else
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
174 error ("invalid value");
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
175
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
176 return *this;
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
177 }
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
178
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
179 operator octave_value (void) const { return current_val; }
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
180
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
181 const std::string& current_value (void) const { return current_val; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
182
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
183 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
184 radio_values vals;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
185 std::string current_val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
186 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
187
7212
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
188 class color_values
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
189 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
190 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
191 color_values (double r = 0, double g = 0, double b = 1)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
192 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
193 xrgb[0] = r;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
194 xrgb[1] = g;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
195 xrgb[2] = b;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
196
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
197 validate ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
198 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
199
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
200 color_values (std::string str)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
201 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
202 if (! str2rgb (str))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
203 error ("invalid color specification");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
204 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
205
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
206 color_values (const color_values& c)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
207 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
208 xrgb[0] = c.xrgb[0];
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
209 xrgb[1] = c.xrgb[1];
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
210 xrgb[2] = c.xrgb[2];
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
211 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
212
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
213 color_values& operator = (const color_values& c)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
214 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
215 if (&c != this)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
216 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
217 xrgb[0] = c.xrgb[0];
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
218 xrgb[1] = c.xrgb[1];
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
219 xrgb[2] = c.xrgb[2];
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
220
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
221 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
222
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
223 return *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
224 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
225
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
226 const double* rgb (void) const { return xrgb; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
227
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
228 void validate (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
229 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
230 for (int i = 0; i < 3; i++)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
231 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
232 if (xrgb[i] < 0 || xrgb[i] > 1)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
233 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
234 error ("invalid RGB color specification");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
235 break;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
236 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
237 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
238 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
239
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
240 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
241 double xrgb[3];
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
242
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
243 bool str2rgb (std::string str);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
244 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
245
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
246
7212
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
247 class color_property
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
248 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
249 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
250 color_property (const color_values& c = color_values (),
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
251 const radio_values& v = radio_values ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
252 : current_type (color_t), color_val (c), radio_val (v),
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
253 current_val (v.default_value ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
254 { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
255
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
256 color_property (const radio_values& v)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
257 : current_type (radio_t), color_val (color_values ()), radio_val (v),
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
258 current_val (v.default_value ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
259 { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
260
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
261 color_property (const radio_values& v, const std::string& initial_value)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
262 : current_type (radio_t), color_val (color_values ()), radio_val (v),
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
263 current_val (initial_value)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
264 { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
265
6938
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents: 6931
diff changeset
266 color_property (const octave_value& val);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
267
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
268 operator octave_value (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
269 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
270 if (current_type == color_t)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
271 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
272 Matrix retval (1, 3);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
273 const double *xrgb = color_val.rgb ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
274
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
275 for (int i = 0; i < 3 ; i++)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
276 retval(i) = xrgb[i];
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
277
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
278 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
279 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
280
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
281 return current_val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
282 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
283
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
284 color_property& operator = (const color_property& a)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
285 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
286 if (&a != this)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
287 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
288 current_type = a.current_type;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
289 color_val = a.color_val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
290 radio_val = a.radio_val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
291 current_val = a.current_val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
292 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
293
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
294 return *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
295 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
296
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
297 color_property& operator = (const std::string& newval)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
298 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
299 if (radio_val.validate (newval))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
300 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
301 current_val = newval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
302 current_type = radio_t;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
303 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
304
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
305 return *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
306 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
307
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
308 color_property& operator = (const color_values& newval)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
309 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
310 color_val = newval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
311 current_type = color_t;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
312
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
313 return *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
314 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
315
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
316 color_property& operator = (const octave_value& newval);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
317
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
318 bool is_rgb (void) const { return (current_type == color_t); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
319
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
320 bool is_radio (void) const { return (current_type == radio_t); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
321
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
322 const double* rgb (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
323 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
324 if (current_type != color_t)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
325 error ("color has no rgb value");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
326
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
327 return color_val.rgb ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
328 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
329
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
330 const std::string& current_value (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
331 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
332 if (current_type != radio_t)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
333 error ("color has no radio value");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
334
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
335 return current_val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
336 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
337
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
338 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
339 enum current_enum { color_t, radio_t } current_type;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
340 color_values color_val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
341 radio_values radio_val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
342 std::string current_val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
343 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
344
7212
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
345 class colormap_property
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
346 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
347 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
348 colormap_property (const Matrix& m = Matrix ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
349 : cmap (m)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
350 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
351 if (cmap.is_empty ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
352 {
6893
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
353 cmap = Matrix (64, 3, 0.0);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
354
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
355 for (octave_idx_type i = 0; i < 64; i++)
6893
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
356 {
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
357 // This is the jet colormap. It would be nice to be able
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
358 // to feval the jet function but since there is a static
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
359 // property object that includes a colormap_property
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
360 // object, we need to initialize this before main is even
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
361 // called, so calling an interpreted function is not
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
362 // possible.
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
363
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
364 double x = i / 63.0;
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
365
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
366 if (x >= 3.0/8.0 && x < 5.0/8.0)
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
367 cmap(i,0) = 4.0 * x - 3.0/2.0;
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
368 else if (x >= 5.0/8.0 && x < 7.0/8.0)
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
369 cmap(i,0) = 1.0;
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
370 else if (x >= 7.0/8.0)
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
371 cmap(i,0) = -4.0 * x + 9.0/2.0;
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
372
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
373 if (x >= 1.0/8.0 && x < 3.0/8.0)
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
374 cmap(i,1) = 4.0 * x - 1.0/2.0;
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
375 else if (x >= 3.0/8.0 && x < 5.0/8.0)
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
376 cmap(i,1) = 1.0;
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
377 else if (x >= 5.0/8.0 && x < 7.0/8.0)
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
378 cmap(i,1) = -4.0 * x + 7.0/2.0;
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
379
6931
ead14c505096 [project @ 2007-09-28 10:30:52 by dbateman]
dbateman
parents: 6925
diff changeset
380 if (x < 1.0/8.0)
6893
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
381 cmap(i,2) = 4.0 * x + 1.0/2.0;
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
382 else if (x >= 1.0/8.0 && x < 3.0/8.0)
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
383 cmap(i,2) = 1.0;
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
384 else if (x >= 3.0/8.0 && x < 5.0/8.0)
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
385 cmap(i,2) = -4.0 * x + 5.0/2.0;
c78e454ab599 [project @ 2007-09-13 08:04:15 by jwe]
jwe
parents: 6890
diff changeset
386 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
387 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
388
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
389 validate ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
390 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
391
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
392 colormap_property (const octave_value& val)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
393 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
394 cmap = val.matrix_value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
395
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
396 validate ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
397 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
398
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
399 void validate (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
400 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
401 if (error_state || cmap.columns () != 3)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
402 error ("invalid colormap specification");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
403 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
404
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
405 operator octave_value (void) const { return cmap; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
406
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
407 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
408 Matrix cmap;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
409 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
410
7212
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
411 class data_property
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
412 {
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
413 public:
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
414 data_property (const Matrix& m = Matrix ())
7213
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
415 : data (m), min_val (octave_Inf), max_val (-octave_Inf),
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
416 min_pos (octave_Inf)
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
417 {
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
418 get_data_limits ();
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
419 }
7212
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
420
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
421 data_property (const octave_value& val)
7213
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
422 : data (), min_val (octave_Inf), max_val (-octave_Inf),
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
423 min_pos (octave_Inf)
7212
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
424 {
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
425 data = val.matrix_value ();
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
426
7213
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
427 get_data_limits ();
7212
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
428 }
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
429
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
430 data_property& operator = (const data_property& a)
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
431 {
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
432 if (&a != this)
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
433 {
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
434 data = a.data;
7213
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
435 min_val = a.min_val;
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
436 max_val = a.max_val;
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
437 min_pos = a.min_pos;
7212
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
438 }
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
439
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
440 return *this;
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
441 }
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
442
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
443 operator octave_value (void) const { return data; }
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
444
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
445 private:
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
446 Matrix data;
7213
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
447 double min_val;
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
448 double max_val;
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
449 double min_pos;
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
450
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
451 void get_data_limits (void)
7212
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
452 {
7213
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
453 octave_idx_type nel = data.numel ();
7212
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
454
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
455 if (nel > 0)
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
456 {
7213
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
457 const double *d = data.data ();
7212
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
458
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
459 for (octave_idx_type i = 0; i < nel; i++)
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
460 {
7213
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
461 double val = d[i];
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
462
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
463 if (! (xisinf (val) || xisnan (val)))
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
464 {
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
465 if (val < min_val)
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
466 min_val = val;
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
467
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
468 if (val > max_val)
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
469 max_val = val;
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
470
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
471 if (val > 0 && val < min_pos)
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
472 min_pos = val;
4612ef369abb [project @ 2007-11-29 01:57:10 by jwe]
jwe
parents: 7212
diff changeset
473 }
7212
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
474 }
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
475 }
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
476 }
720c2b4271f8 [project @ 2007-11-28 20:51:51 by jwe]
jwe
parents: 7194
diff changeset
477 };
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
478
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
479 class property_list
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
480 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
481 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
482 typedef std::map<std::string, octave_value> pval_map_type;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
483 typedef std::map<std::string, pval_map_type> plist_map_type;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
484
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
485 typedef pval_map_type::iterator pval_map_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
486 typedef pval_map_type::const_iterator pval_map_const_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
487
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
488 typedef plist_map_type::iterator plist_map_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
489 typedef plist_map_type::const_iterator plist_map_const_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
490
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
491 property_list (const plist_map_type& m = plist_map_type ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
492 : plist_map (m) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
493
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
494 ~property_list (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
495
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
496 void set (const caseless_str& name, const octave_value& val);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
497
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
498 octave_value lookup (const caseless_str& name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
499
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
500 plist_map_iterator begin (void) { return plist_map.begin (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
501 plist_map_const_iterator begin (void) const { return plist_map.begin (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
502
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
503 plist_map_iterator end (void) { return plist_map.end (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
504 plist_map_const_iterator end (void) const { return plist_map.end (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
505
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
506 plist_map_iterator find (const std::string& go_name)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
507 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
508 return plist_map.find (go_name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
509 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
510
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
511 plist_map_const_iterator find (const std::string& go_name) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
512 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
513 return plist_map.find (go_name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
514 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
515
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
516 Octave_map as_struct (const std::string& prefix_arg) const;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
517
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
518 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
519 plist_map_type plist_map;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
520 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
521
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
522 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
523
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
524 class graphics_handle
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
525 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
526 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
527 graphics_handle (void) : val (octave_NaN) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
528
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
529 graphics_handle (const octave_value& a);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
530
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
531 graphics_handle (int a) : val (a) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
532
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
533 graphics_handle (double a) : val (a) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
534
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
535 graphics_handle (const graphics_handle& a) : val (a.val) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
536
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
537 graphics_handle& operator = (const graphics_handle& a)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
538 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
539 if (&a != this)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
540 val = a.val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
541
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
542 return *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
543 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
544
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
545 ~graphics_handle (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
546
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
547 double value (void) const { return val; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
548
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
549 octave_value as_octave_value (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
550 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
551 return ok () ? octave_value (val) : octave_value (Matrix ());
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
552 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
553
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
554 graphics_handle operator ++ (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
555 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
556 ++val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
557 return *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
558 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
559
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
560 graphics_handle operator ++ (int)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
561 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
562 graphics_handle h = *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
563 ++val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
564 return h;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
565 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
566
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
567 graphics_handle operator -- (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
568 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
569 --val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
570 return *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
571 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
572
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
573 graphics_handle operator -- (int)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
574 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
575 graphics_handle h = *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
576 --val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
577 return h;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
578 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
579
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
580 bool ok (void) const { return ! xisnan (val); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
581
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
582 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
583 double val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
584 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
585
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
586 inline bool
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
587 operator == (const graphics_handle& a, const graphics_handle& b)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
588 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
589 return a.value () == b.value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
590 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
591
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
592 inline bool
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
593 operator != (const graphics_handle& a, const graphics_handle& b)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
594 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
595 return a.value () != b.value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
596 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
597
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
598 inline bool
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
599 operator < (const graphics_handle& a, const graphics_handle& b)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
600 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
601 return a.value () < b.value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
602 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
603
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
604 inline bool
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
605 operator <= (const graphics_handle& a, const graphics_handle& b)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
606 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
607 return a.value () <= b.value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
608 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
609
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
610 inline bool
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
611 operator >= (const graphics_handle& a, const graphics_handle& b)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
612 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
613 return a.value () >= b.value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
614 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
615
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
616 inline bool
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
617 operator > (const graphics_handle& a, const graphics_handle& b)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
618 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
619 return a.value () > b.value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
620 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
621
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
622 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
623
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
624 class base_graphics_object;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
625
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
626 class base_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
627 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
628 public:
7176
6525eb2fba0f [project @ 2007-11-14 20:42:06 by jwe]
jwe
parents: 7168
diff changeset
629 base_properties (const std::string& ty = "unknown",
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
630 const graphics_handle& mh = graphics_handle (),
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
631 const graphics_handle& p = graphics_handle ())
7176
6525eb2fba0f [project @ 2007-11-14 20:42:06 by jwe]
jwe
parents: 7168
diff changeset
632 : tag (), type (ty), __modified__ (true), __myhandle__ (mh),
6525eb2fba0f [project @ 2007-11-14 20:42:06 by jwe]
jwe
parents: 7168
diff changeset
633 parent (p), children () { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
634
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
635 virtual ~base_properties (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
636
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
637 virtual std::string graphics_object_name (void) const { return "unknonwn"; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
638
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
639 void mark_modified (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
640
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
641 void override_defaults (base_graphics_object& obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
642
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
643 // Look through DEFAULTS for properties with given CLASS_NAME, and
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
644 // apply them to the current object with set (virtual method).
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
645
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
646 void set_from_list (base_graphics_object& obj, property_list& defaults);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
647
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
648 virtual void set (const caseless_str&, const octave_value&) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
649
7176
6525eb2fba0f [project @ 2007-11-14 20:42:06 by jwe]
jwe
parents: 7168
diff changeset
650 std::string get_tag (void) const { return tag; }
6525eb2fba0f [project @ 2007-11-14 20:42:06 by jwe]
jwe
parents: 7168
diff changeset
651
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
652 graphics_handle get_parent (void) const { return parent; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
653
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
654 void remove_child (const graphics_handle& h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
655
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
656 void adopt (const graphics_handle& h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
657 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
658 octave_idx_type n = children.numel ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
659 children.resize (1, n+1);
7056
2002804df782 [project @ 2007-10-24 00:32:44 by jwe]
jwe
parents: 7020
diff changeset
660 children(n) = h.value ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
661 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
662
7176
6525eb2fba0f [project @ 2007-11-14 20:42:06 by jwe]
jwe
parents: 7168
diff changeset
663 void set_tag (const octave_value& val);
6525eb2fba0f [project @ 2007-11-14 20:42:06 by jwe]
jwe
parents: 7168
diff changeset
664
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
665 void set_parent (const octave_value& val);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
666
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
667 void reparent (const graphics_handle& new_parent) { parent = new_parent; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
668
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
669 // Update data limits for AXIS_TYPE (xdata, ydata, etc.) in the parent
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
670 // axes object.
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
671
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
672 void update_axis_limits (const std::string& axis_type) const;
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
673
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
674 virtual void delete_children (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
675
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
676 protected:
7176
6525eb2fba0f [project @ 2007-11-14 20:42:06 by jwe]
jwe
parents: 7168
diff changeset
677 std::string tag;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
678 std::string type;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
679 bool __modified__;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
680 graphics_handle __myhandle__;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
681 graphics_handle parent;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
682 Matrix children;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
683 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
684
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
685 class base_graphics_object
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
686 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
687 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
688 friend class graphics_object;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
689
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
690 base_graphics_object (void) : count (1) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
691
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
692 base_graphics_object (const base_graphics_object&) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
693
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
694 virtual ~base_graphics_object (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
695
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
696 virtual void mark_modified (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
697 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
698 error ("base_graphics_object::mark_modified: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
699 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
700
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
701 virtual void override_defaults (base_graphics_object&)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
702 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
703 error ("base_graphics_object::override_defaults: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
704 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
705
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
706 virtual void set_from_list (property_list&)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
707 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
708 error ("base_graphics_object::set_from_list: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
709 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
710
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
711 virtual void set (const caseless_str&, const octave_value&)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
712 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
713 error ("base_graphics_object::set: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
714 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
715
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
716 virtual void set_defaults (const std::string&)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
717 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
718 error ("base_graphics_object::set_defaults: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
719 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
720
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
721 virtual octave_value get (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
722 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
723 error ("base_graphics_object::get: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
724 return octave_value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
725 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
726
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
727 virtual octave_value get (const caseless_str&) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
728 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
729 error ("base_graphics_object::get: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
730 return octave_value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
731 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
732
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
733 virtual octave_value get_default (const caseless_str&) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
734
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
735 virtual octave_value get_factory_default (const caseless_str&) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
736
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
737 virtual octave_value get_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
738 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
739 error ("base_graphics_object::get_defaults: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
740 return octave_value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
741 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
742
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
743 virtual octave_value get_factory_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
744 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
745 error ("base_graphics_object::get_factory_defaults: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
746 return octave_value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
747 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
748
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
749 virtual graphics_handle get_parent (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
750 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
751 error ("base_graphics_object::get_parent: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
752 return graphics_handle ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
753 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
754
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
755 virtual void remove_child (const graphics_handle&)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
756 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
757 error ("base_graphics_object::remove_child: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
758 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
759
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
760 virtual void adopt (const graphics_handle&)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
761 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
762 error ("base_graphics_object::adopt: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
763 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
764
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
765 virtual void reparent (const graphics_handle&)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
766 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
767 error ("base_graphics_object::reparent: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
768 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
769
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
770 virtual void defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
771 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
772 error ("base_graphics_object::default: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
773 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
774
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
775 virtual base_properties& get_properties (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
776 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
777 static base_properties properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
778 error ("base_graphics_object::get_properties: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
779 return properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
780 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
781
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
782 virtual void update_axis_limits (const std::string& axis_type)
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
783 {
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
784 error ("base_graphics_object::update_axis_limits: invalid graphics object");
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
785 }
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
786
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
787 virtual bool valid_object (void) const { return false; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
788
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
789 virtual std::string type (void) const { return "unknown"; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
790
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
791 bool isa (const std::string& go_name) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
792 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
793 return type () == go_name;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
794 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
795
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
796 protected:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
797 // A reference count.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
798 int count;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
799 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
800
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
801 class graphics_object
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
802 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
803 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
804 graphics_object (void) : rep (new base_graphics_object ()) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
805
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
806 graphics_object (base_graphics_object *new_rep)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
807 : rep (new_rep) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
808
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
809 graphics_object (const graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
810 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
811 rep = obj.rep;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
812 rep->count++;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
813 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
814
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
815 graphics_object& operator = (const graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
816 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
817 if (rep != obj.rep)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
818 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
819 if (--rep->count == 0)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
820 delete rep;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
821
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
822 rep = obj.rep;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
823 rep->count++;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
824 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
825
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
826 return *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
827 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
828
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
829 ~graphics_object (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
830 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
831 if (--rep->count == 0)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
832 delete rep;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
833 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
834
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
835 void mark_modified (void) { rep->mark_modified (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
836
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
837 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
838 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
839 rep->override_defaults (obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
840 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
841
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
842 void set_from_list (property_list& plist) { rep->set_from_list (plist); }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
843
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
844 void set (const caseless_str& name, const octave_value& val)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
845 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
846 rep->set (name, val);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
847 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
848
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
849 void set (const octave_value_list& args);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
850
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
851 void set_defaults (const std::string& mode) { rep->set_defaults (mode); }
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
852
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
853 octave_value get (void) const { return rep->get (); }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
854
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
855 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
856 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
857 return name.compare ("default")
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
858 ? get_defaults ()
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
859 : (name.compare ("factory")
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
860 ? get_factory_defaults () : rep->get (name));
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
861 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
862
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
863 octave_value get_default (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
864 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
865 return rep->get_default (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
866 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
867
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
868 octave_value get_factory_default (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
869 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
870 return rep->get_factory_default (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
871 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
872
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
873 octave_value get_defaults (void) const { return rep->get_defaults (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
875 octave_value get_factory_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
876 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
877 return rep->get_factory_defaults ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
878 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
879
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
880 graphics_handle get_parent (void) const { return rep->get_parent (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
881
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
882 void remove_child (const graphics_handle& h) { rep->remove_child (h); }
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
883
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
884 void adopt (const graphics_handle& h) { rep->adopt (h); }
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
885
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
886 void reparent (const graphics_handle& h) { rep->reparent (h); }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
887
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
888 void defaults (void) const { rep->defaults (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
889
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
890 bool isa (const std::string& go_name) const { return rep->isa (go_name); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
891
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
892 base_properties& get_properties (void) { return rep->get_properties (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
893
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
894 void update_axis_limits (const std::string& axis_type)
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
895 {
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
896 rep->update_axis_limits (axis_type);
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
897 }
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
898
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
899 bool valid_object (void) const { return rep->valid_object (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
900
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
901 operator bool (void) const { return rep->valid_object (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
902
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
903 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
904 base_graphics_object *rep;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
905 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
906
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
907 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
908
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
909 class root_figure : public base_graphics_object
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
910 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
911 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
912 class properties : public base_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
913 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
914 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
915 properties (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
916 : base_properties ("root figure", 0, graphics_handle ()),
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
917 currentfigure (),
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
918 visible ("on")
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
919 { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
920
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
921 ~properties (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
922
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
923 void set (const caseless_str& name, const octave_value& val);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
924
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
925 octave_value get (void) const;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
926
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
927 octave_value get (const caseless_str& name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
928
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
929 std::string graphics_object_name (void) const { return go_name; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
930
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
931 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
932 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
933
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
934 BEGIN_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
935 graphics_handle currentfigure S
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
936 octave_value visible
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
937 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
938
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
939 static std::string go_name;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
940 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
941
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
942 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
943 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
944
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
945 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
946
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
947 root_figure (void) : xproperties (), default_properties () { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
948
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
949 ~root_figure (void) { xproperties.delete_children (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
950
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
951 std::string type (void) const { return xproperties.graphics_object_name (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
952
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
953 void mark_modified (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
954
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
955 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
956 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
957 // Now override with our defaults. If the default_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
958 // list includes the properties for all defaults (line,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
959 // surface, etc.) then we don't have to know the type of OBJ
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
960 // here, we just call its set function and let it decide which
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
961 // properties from the list to use.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
962 obj.set_from_list (default_properties);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
963 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
964
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
965 void set_from_list (property_list& plist)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
966 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
967 xproperties.set_from_list (*this, plist);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
968 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
969
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
970 void set (const caseless_str& name, const octave_value& value)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
971 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
972 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
973 // strip "default", pass rest to function that will
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
974 // parse the remainder and add the element to the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
975 // default_properties map.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
976 default_properties.set (name.substr (7), value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
977 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
978 xproperties.set (name, value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
979 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
980
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
981 octave_value get (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
982 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
983 return xproperties.get ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
984 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
985
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
986 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
987 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
988 octave_value retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
989
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
990 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
991 return get_default (name.substr (7));
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
992 else if (name.compare ("factory", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
993 return get_factory_default (name.substr (7));
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
994 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
995 retval = xproperties.get (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
996
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
997 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
998 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
999
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1000 octave_value get_default (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1001 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1002 octave_value retval = default_properties.lookup (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1003
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1004 if (retval.is_undefined ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1005 error ("get: invalid default property `%s'", name.c_str ());
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1006
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1007 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1008 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1009
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1010 octave_value get_factory_default (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1011 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1012 octave_value retval = factory_properties.lookup (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1013
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1014 if (retval.is_undefined ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1015 error ("get: invalid factory default property `%s'", name.c_str ());
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1016
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1017 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1018 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1019
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1020 octave_value get_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1021 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1022 return default_properties.as_struct ("default");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1023 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1024
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1025 octave_value get_factory_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1026 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1027 return factory_properties.as_struct ("factory");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1028 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1029
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1030 graphics_handle get_parent (void) const { return xproperties.get_parent (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1031
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1032 void remove_child (const graphics_handle& h) { xproperties.remove_child (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1033
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1034 void adopt (const graphics_handle& h) { xproperties.adopt (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1035
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1036 void reparent (const graphics_handle& np) { xproperties.reparent (np); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1037
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1038 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1039
6890
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1040 void defaults (void) const
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1041 {
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1042 gripe_not_implemented ("root_figure::defaults");
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1043 }
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1044
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1045 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1046
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1047 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1048 property_list default_properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1049
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1050 static property_list factory_properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1051
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1052 static property_list::plist_map_type init_factory_properties (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1053 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1054
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1055 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1056
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1057 class figure : public base_graphics_object
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1058 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1059 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1060 class properties : public base_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1061 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1062 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1063 properties (const graphics_handle& mh, const graphics_handle& p);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1064
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1065 ~properties (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1066
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1067 void set (const caseless_str& name, const octave_value& val);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1068
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1069 octave_value get (void) const;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1070
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1071 octave_value get (const caseless_str& name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1072
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1073 void close (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1074
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1075 std::string graphics_object_name (void) const { return go_name; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1076
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1077 static property_list::pval_map_type factory_defaults (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1078
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1079 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1080 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1081
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1082 BEGIN_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1083 octave_value __plot_stream__
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1084 octave_value __enhanced__
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1085 octave_value nextplot
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1086 octave_value closerequestfcn
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1087 graphics_handle currentaxes S
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1088 colormap_property colormap
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1089 octave_value visible S
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1090 octave_value paperorientation
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1091 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1092
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1093 static std::string go_name;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1094 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1095
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1096 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1097 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1098
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1099 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1100 figure (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1101 : base_graphics_object (), xproperties (mh, p), default_properties ()
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1102 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1103 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1104 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1105
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1106 ~figure (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1107 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1108 xproperties.delete_children ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1109 xproperties.close ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1110 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1111
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1112 std::string type (void) const { return xproperties.graphics_object_name (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1113
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1114 void mark_modified (void) { xproperties.mark_modified (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1115
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1116 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1117 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1118 // Allow parent (root figure) to override first (properties knows how
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1119 // to find the parent object).
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1120 xproperties.override_defaults (obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1121
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1122 // Now override with our defaults. If the default_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1123 // list includes the properties for all defaults (line,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1124 // surface, etc.) then we don't have to know the type of OBJ
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1125 // here, we just call its set function and let it decide which
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1126 // properties from the list to use.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1127 obj.set_from_list (default_properties);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1128 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1129
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1130 void set_from_list (property_list& plist)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1131 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1132 xproperties.set_from_list (*this, plist);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1133 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1134
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1135 void set (const caseless_str& name, const octave_value& value)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1136 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1137 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1138 // strip "default", pass rest to function that will
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1139 // parse the remainder and add the element to the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1140 // default_properties map.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1141 default_properties.set (name.substr (7), value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1142 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1143 xproperties.set (name, value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1144 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1145
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1146 octave_value get (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1147 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1148 return xproperties.get ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1149 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1150
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1151 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1152 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1153 octave_value retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1154
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1155 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1156 retval = get_default (name.substr (7));
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1157 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1158 retval = xproperties.get (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1159
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1160 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1161 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1162
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1163 octave_value get_default (const caseless_str& name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1164
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1165 octave_value get_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1166 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1167 return default_properties.as_struct ("default");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1168 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1169
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1170 graphics_handle get_parent (void) const { return xproperties.get_parent (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1171
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1172 void remove_child (const graphics_handle& h) { xproperties.remove_child (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1173
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1174 void adopt (const graphics_handle& h) { xproperties.adopt (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1175
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1176 void reparent (const graphics_handle& np) { xproperties.reparent (np); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1177
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1178 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1179
6890
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1180 void defaults (void) const { gripe_not_implemented ("figure::defaults"); }
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1181
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1182 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1183
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1184 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1185 property_list default_properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1186 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1187
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1188 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1189
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1190 class axes : public base_graphics_object
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1191 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1192 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1193 class properties : public base_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1194 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1195 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1196 properties (const graphics_handle& mh, const graphics_handle& p);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1197
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1198 ~properties (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1199
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1200 void set (const caseless_str& name, const octave_value& val);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1201
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1202 void set_defaults (base_graphics_object& obj, const std::string& mode);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1203
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1204 octave_value get (void) const;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1205
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1206 octave_value get (const caseless_str& name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1207
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1208 void remove_child (const graphics_handle& h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1209
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1210 void delete_children (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1211
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1212 std::string graphics_object_name (void) const { return go_name; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1213
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1214 static property_list::pval_map_type factory_defaults (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1215
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1216 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1217 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1218
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1219 BEGIN_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1220 octave_value position
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1221 mutable graphics_handle title GSO
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1222 octave_value box
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1223 octave_value key
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1224 octave_value keybox
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1225 octave_value keypos
6962
9ac23c7f1c37 [project @ 2007-10-05 20:52:19 by jwe]
jwe
parents: 6938
diff changeset
1226 octave_value colororder
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1227 octave_value dataaspectratio m
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1228 octave_value dataaspectratiomode
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1229 octave_value xlim m
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1230 octave_value ylim m
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1231 octave_value zlim m
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1232 octave_value clim m
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1233 octave_value xlimmode
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1234 octave_value ylimmode
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1235 octave_value zlimmode
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1236 octave_value climmode
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1237 mutable graphics_handle xlabel GSO
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1238 mutable graphics_handle ylabel GSO
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1239 mutable graphics_handle zlabel GSO
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1240 octave_value xgrid
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1241 octave_value ygrid
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1242 octave_value zgrid
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1243 octave_value xminorgrid
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1244 octave_value yminorgrid
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1245 octave_value zminorgrid
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1246 octave_value xtick m
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1247 octave_value ytick m
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1248 octave_value ztick m
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1249 octave_value xtickmode
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1250 octave_value ytickmode
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1251 octave_value ztickmode
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1252 octave_value xticklabel m
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1253 octave_value yticklabel m
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1254 octave_value zticklabel m
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1255 octave_value xticklabelmode
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1256 octave_value yticklabelmode
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1257 octave_value zticklabelmode
7194
a927a2871a93 [project @ 2007-11-26 23:06:12 by jwe]
jwe
parents: 7189
diff changeset
1258 color_property xcolor
a927a2871a93 [project @ 2007-11-26 23:06:12 by jwe]
jwe
parents: 7189
diff changeset
1259 color_property ycolor
a927a2871a93 [project @ 2007-11-26 23:06:12 by jwe]
jwe
parents: 7189
diff changeset
1260 color_property zcolor
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1261 octave_value xscale l
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1262 octave_value yscale l
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1263 octave_value zscale l
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1264 octave_value xdir
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1265 octave_value ydir
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1266 octave_value zdir
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1267 octave_value xaxislocation
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1268 octave_value yaxislocation
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1269 octave_value view
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1270 octave_value visible
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1271 octave_value nextplot
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1272 octave_value outerposition
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1273 radio_property __colorbar__ a
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1274 END_PROPERTIES
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1275
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1276 static std::string go_name;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1277 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1278
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1279 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1280 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1281
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1282 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1283 axes (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1284 : base_graphics_object (), xproperties (mh, p), default_properties ()
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1285 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1286 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1287 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1288
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1289 ~axes (void) { xproperties.delete_children (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1290
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1291 std::string type (void) const { return xproperties.graphics_object_name (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1292
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1293 void mark_modified (void) { xproperties.mark_modified (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1294
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1295 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1296 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1297 // Allow parent (figure) to override first (properties knows how
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1298 // to find the parent object).
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1299 xproperties.override_defaults (obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1300
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1301 // Now override with our defaults. If the default_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1302 // list includes the properties for all defaults (line,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1303 // surface, etc.) then we don't have to know the type of OBJ
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1304 // here, we just call its set function and let it decide which
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1305 // properties from the list to use.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1306 obj.set_from_list (default_properties);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1307 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1308
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1309 void set_from_list (property_list& plist)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1310 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1311 xproperties.set_from_list (*this, plist);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1312 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1313
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1314 void set (const caseless_str& name, const octave_value& value)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1315 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1316 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1317 // strip "default", pass rest to function that will
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1318 // parse the remainder and add the element to the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1319 // default_properties map.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1320 default_properties.set (name.substr (7), value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1321 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1322 xproperties.set (name, value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1323 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1324
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1325 void set_defaults (const std::string& mode)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1326 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1327 xproperties.set_defaults (*this, mode);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1328 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1329
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1330 octave_value get (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1331 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1332 return xproperties.get ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1333 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1334
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1335 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1336 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1337 octave_value retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1338
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1339 // FIXME -- finish this.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1340 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1341 retval = get_default (name.substr (7));
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1342 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1343 retval = xproperties.get (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1344
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1345 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1346 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1347
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1348 octave_value get_default (const caseless_str& name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1349
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1350 octave_value get_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1351 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1352 return default_properties.as_struct ("default");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1353 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1354
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1355 graphics_handle get_parent (void) const { return xproperties.get_parent (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1356
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1357 void remove_child (const graphics_handle& h) { xproperties.remove_child (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1358
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1359 void adopt (const graphics_handle& h) { xproperties.adopt (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1360
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1361 void reparent (const graphics_handle& np) { xproperties.reparent (np); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1362
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1363 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1364
6890
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1365 void defaults (void) const { gripe_not_implemented ("axes::defaults"); }
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1366
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1367 void update_axis_limits (const std::string& axis_type);
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1368
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1369 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1370
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1371 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1372 property_list default_properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1373 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1374
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1375 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1376
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1377 class line : public base_graphics_object
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1378 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1379 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1380 class properties : public base_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1381 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1382 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1383 properties (const graphics_handle& mh, const graphics_handle& p);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1384
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1385 ~properties (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1386
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1387 void set (const caseless_str& name, const octave_value& val);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1388
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1389 octave_value get (void) const;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1390
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1391 octave_value get (const caseless_str& name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1392
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1393 std::string graphics_object_name (void) const { return go_name; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1394
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1395 static property_list::pval_map_type factory_defaults (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1396
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1397 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1398 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1399
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1400 BEGIN_PROPERTIES
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1401 data_property xdata l
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1402 data_property ydata l
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1403 data_property zdata l
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1404 data_property ldata l
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1405 data_property udata l
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1406 data_property xldata l
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1407 data_property xudata l
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1408 color_property color
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1409 octave_value linestyle
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1410 octave_value linewidth
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1411 octave_value marker
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1412 octave_value markeredgecolor
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1413 octave_value markerfacecolor
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1414 octave_value markersize
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1415 octave_value keylabel
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1416 radio_property interpreter a
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1417 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1418
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1419 static std::string go_name;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1420 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1421
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1422 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1423 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1424
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1425 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1426 line (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1427 : base_graphics_object (), xproperties (mh, p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1428 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1429 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1430 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1431
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1432 ~line (void) { xproperties.delete_children (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1433
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1434 std::string type (void) const { return xproperties.graphics_object_name (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1435
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1436 void mark_modified (void) { xproperties.mark_modified (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1437
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1438 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1439 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1440 // Allow parent (figure) to override first (properties knows how
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1441 // to find the parent object).
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1442 xproperties.override_defaults (obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1443 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1444
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1445 void set_from_list (property_list& plist)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1446 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1447 xproperties.set_from_list (*this, plist);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1448 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1449
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1450 void set (const caseless_str& name, const octave_value& val)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1451 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1452 xproperties.set (name, val);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1453 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1454
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1455 octave_value get (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1456 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1457 return xproperties.get ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1458 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1459
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1460 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1461 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1462 return xproperties.get (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1463 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1464
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1465 graphics_handle get_parent (void) const { return xproperties.get_parent (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1466
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1467 void remove_child (const graphics_handle& h) { xproperties.remove_child (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1468
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1469 void adopt (const graphics_handle& h) { xproperties.adopt (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1470
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1471 void reparent (const graphics_handle& h) { xproperties.reparent (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1472
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1473 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1474
6890
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1475 void defaults (void) const { gripe_not_implemented ("line::defaults"); }
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1476
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1477 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1478 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1479
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1480 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1481
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1482 class text : public base_graphics_object
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1483 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1484 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1485 class properties : public base_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1486 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1487 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1488 properties (const graphics_handle& mh, const graphics_handle& p);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1489
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1490 ~properties (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1491
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1492 void set (const caseless_str& name, const octave_value& val);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1493
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1494 octave_value get (void) const;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1495
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1496 octave_value get (const caseless_str& name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1497
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1498 std::string graphics_object_name (void) const { return go_name; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1499
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1500 static property_list::pval_map_type factory_defaults (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1501
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1502 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1503 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1504
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1505 BEGIN_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1506 octave_value string
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1507 octave_value units
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1508 octave_value position
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1509 octave_value rotation
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1510 octave_value horizontalalignment
6890
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1511 color_property color
7162
f2ba4aa9a5f9 [project @ 2007-11-12 19:56:07 by jwe]
jwe
parents: 7148
diff changeset
1512 octave_value fontname
f2ba4aa9a5f9 [project @ 2007-11-12 19:56:07 by jwe]
jwe
parents: 7148
diff changeset
1513 octave_value fontsize
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1514 radio_property fontangle a
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1515 radio_property fontweight a
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1516 radio_property interpreter a
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1517 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1518
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1519 static std::string go_name;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1520 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1521
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1522 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1523 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1524
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1525 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1526 text (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1527 : base_graphics_object (), xproperties (mh, p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1528 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1529 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1530 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1531
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1532 ~text (void) { xproperties.delete_children (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1533
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1534 std::string type (void) const { return xproperties.graphics_object_name (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1535
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1536 void mark_modified (void) { xproperties.mark_modified (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1537
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1538 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1539 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1540 // Allow parent (figure) to override first (properties knows how
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1541 // to find the parent object).
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1542 xproperties.override_defaults (obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1543 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1544
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1545 void set_from_list (property_list& plist)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1546 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1547 xproperties.set_from_list (*this, plist);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1548 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1549
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1550 void set (const caseless_str& name, const octave_value& val)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1551 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1552 xproperties.set (name, val);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1553 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1554
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1555 octave_value get (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1556 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1557 return xproperties.get ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1558 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1559
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1560 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1561 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1562 return xproperties.get (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1563 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1564
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1565 graphics_handle get_parent (void) const { return xproperties.get_parent (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1566
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1567 void remove_child (const graphics_handle& h) { xproperties.remove_child (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1568
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1569 void adopt (const graphics_handle& h) { xproperties.adopt (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1570
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1571 void reparent (const graphics_handle& h) { xproperties.reparent (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1572
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1573 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1574
6890
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1575 void defaults (void) const { gripe_not_implemented ("text::defaults"); }
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1576
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1577 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1578 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1579
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1580 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1581
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1582 class image : public base_graphics_object
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1583 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1584 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1585 class properties : public base_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1586 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1587 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1588 properties (const graphics_handle& mh, const graphics_handle& p);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1589
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1590 ~properties (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1591
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1592 void set (const caseless_str& name, const octave_value& val);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1593
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1594 octave_value get (void) const;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1595
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1596 octave_value get (const caseless_str& name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1597
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1598 std::string graphics_object_name (void) const { return go_name; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1599
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1600 static property_list::pval_map_type factory_defaults (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1601
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1602 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1603 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1604
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1605 BEGIN_PROPERTIES
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1606 data_property xdata l
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1607 data_property ydata l
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1608 data_property cdata l
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1609 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1610
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1611 static std::string go_name;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1612 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1613
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1614 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1615 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1616
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1617 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1618 image (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1619 : base_graphics_object (), xproperties (mh, p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1620 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1621 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1622 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1623
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1624 ~image (void) { xproperties.delete_children (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1625
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1626 std::string type (void) const { return xproperties.graphics_object_name (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1627
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1628 void mark_modified (void) { xproperties.mark_modified (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1629
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1630 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1631 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1632 // Allow parent (figure) to override first (properties knows how
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1633 // to find the parent object).
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1634 xproperties.override_defaults (obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1635 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1636
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1637 void set_from_list (property_list& plist)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1638 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1639 xproperties.set_from_list (*this, plist);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1640 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1641
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1642 void set (const caseless_str& name, const octave_value& val)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1643 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1644 xproperties.set (name, val);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1645 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1646
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1647 octave_value get (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1648 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1649 return xproperties.get ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1650 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1651
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1652 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1653 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1654 return xproperties.get (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1655 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1656
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1657 graphics_handle get_parent (void) const { return xproperties.get_parent (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1658
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1659 void remove_child (const graphics_handle& h) { xproperties.remove_child (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1660
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1661 void adopt (const graphics_handle& h) { xproperties.adopt (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1662
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1663 void reparent (const graphics_handle& h) { xproperties.reparent (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1664
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1665 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1666
6890
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1667 void defaults (void) const { gripe_not_implemented ("image::defaults"); }
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1668
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1669 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1670 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1671
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1672 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1673
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1674 class patch : public base_graphics_object
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1675 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1676 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1677 class properties : public base_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1678 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1679 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1680 properties (const graphics_handle& mh, const graphics_handle& p);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1681
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1682 ~properties (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1683
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1684 void set (const caseless_str& name, const octave_value& val);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1685
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1686 octave_value get (void) const;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1687
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1688 octave_value get (const caseless_str& name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1689
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1690 std::string graphics_object_name (void) const { return go_name; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1691
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1692 static property_list::pval_map_type factory_defaults (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1693
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1694 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1695 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1696
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1697 BEGIN_PROPERTIES
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1698 data_property xdata l
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1699 data_property ydata l
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1700 data_property zdata l
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1701 data_property cdata l
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7016
diff changeset
1702 octave_value faces
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7016
diff changeset
1703 octave_value vertices
6938
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents: 6931
diff changeset
1704 color_property facecolor a
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1705 octave_value facealpha
6938
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents: 6931
diff changeset
1706 color_property edgecolor a
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1707 octave_value linestyle
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1708 octave_value linewidth
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1709 octave_value marker
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1710 octave_value markeredgecolor
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1711 octave_value markerfacecolor
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1712 octave_value markersize
7148
735086cfd405 [project @ 2007-11-09 18:01:44 by jwe]
jwe
parents: 7108
diff changeset
1713 octave_value keylabel
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1714 radio_property interpreter a
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1715 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1716
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1717 static std::string go_name;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1718 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1719
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1720 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1721 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1722
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1723 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1724 patch (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1725 : base_graphics_object (), xproperties (mh, p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1726 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1727 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1728 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1729
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1730 ~patch (void) { xproperties.delete_children (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1731
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1732 std::string type (void) const { return xproperties.graphics_object_name (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1733
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1734 void mark_modified (void) { xproperties.mark_modified (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1735
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1736 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1737 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1738 // Allow parent (figure) to override first (properties knows how
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1739 // to find the parent object).
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1740 xproperties.override_defaults (obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1741 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1742
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1743 void set_from_list (property_list& plist)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1744 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1745 xproperties.set_from_list (*this, plist);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1746 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1747
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1748 void set (const caseless_str& name, const octave_value& val)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1749 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1750 xproperties.set (name, val);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1751 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1752
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1753 octave_value get (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1754 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1755 return xproperties.get ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1756 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1757
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1758 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1759 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1760 return xproperties.get (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1761 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1762
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1763 graphics_handle get_parent (void) const { return xproperties.get_parent (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1764
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1765 void remove_child (const graphics_handle& h) { xproperties.remove_child (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1766
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1767 void adopt (const graphics_handle& h) { xproperties.adopt (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1768
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1769 void reparent (const graphics_handle& h) { xproperties.reparent (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1770
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1771 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1772
6890
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1773 void defaults (void) const { gripe_not_implemented ("patch::defaults"); }
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1774
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1775 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1776 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1777
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1778 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1779
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1780 class surface : public base_graphics_object
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1781 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1782 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1783 class properties : public base_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1784 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1785 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1786 properties (const graphics_handle& mh, const graphics_handle& p);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1787
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1788 ~properties (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1789
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1790 void set (const caseless_str& name, const octave_value& val);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1791
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1792 octave_value get (void) const;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1793
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1794 octave_value get (const caseless_str& name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1795
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1796 std::string graphics_object_name (void) const { return go_name; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1797
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1798 static property_list::pval_map_type factory_defaults (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1799
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1800 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1801 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1802
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1803 BEGIN_PROPERTIES
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1804 data_property xdata l
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1805 data_property ydata l
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1806 data_property zdata l
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
1807 data_property cdata l
7108
60a1165732f9 [project @ 2007-11-06 22:05:18 by jwe]
jwe
parents: 7056
diff changeset
1808 color_property facecolor a
60a1165732f9 [project @ 2007-11-06 22:05:18 by jwe]
jwe
parents: 7056
diff changeset
1809 octave_value facealpha
60a1165732f9 [project @ 2007-11-06 22:05:18 by jwe]
jwe
parents: 7056
diff changeset
1810 color_property edgecolor a
60a1165732f9 [project @ 2007-11-06 22:05:18 by jwe]
jwe
parents: 7056
diff changeset
1811 octave_value linestyle
60a1165732f9 [project @ 2007-11-06 22:05:18 by jwe]
jwe
parents: 7056
diff changeset
1812 octave_value linewidth
60a1165732f9 [project @ 2007-11-06 22:05:18 by jwe]
jwe
parents: 7056
diff changeset
1813 octave_value marker
60a1165732f9 [project @ 2007-11-06 22:05:18 by jwe]
jwe
parents: 7056
diff changeset
1814 octave_value markeredgecolor
60a1165732f9 [project @ 2007-11-06 22:05:18 by jwe]
jwe
parents: 7056
diff changeset
1815 octave_value markerfacecolor
60a1165732f9 [project @ 2007-11-06 22:05:18 by jwe]
jwe
parents: 7056
diff changeset
1816 octave_value markersize
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1817 octave_value keylabel
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1818 radio_property interpreter a
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1819 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1820
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1821 static std::string go_name;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1822 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1823
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1824 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1825 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1826
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1827 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1828 surface (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1829 : base_graphics_object (), xproperties (mh, p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1830 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1831 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1832 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1833
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1834 ~surface (void) { xproperties.delete_children (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1835
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1836 std::string type (void) const { return xproperties.graphics_object_name (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1837
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1838 void mark_modified (void) { xproperties.mark_modified (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1839
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1840 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1841 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1842 // Allow parent (figure) to override first (properties knows how
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1843 // to find the parent object).
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1844 xproperties.override_defaults (obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1845 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1846
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1847 void set_from_list (property_list& plist)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1848 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1849 xproperties.set_from_list (*this, plist);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1850 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1851
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1852 void set (const caseless_str& name, const octave_value& val)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1853 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1854 xproperties.set (name, val);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1855 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1856
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1857 octave_value get (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1858 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1859 return xproperties.get ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1860 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1861
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
1862 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1863 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1864 return xproperties.get (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1865 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1866
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1867 graphics_handle get_parent (void) const { return xproperties.get_parent (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1868
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1869 void remove_child (const graphics_handle& h) { xproperties.remove_child (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1870
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1871 void adopt (const graphics_handle& h) { xproperties.adopt (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1872
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1873 void reparent (const graphics_handle& h) { xproperties.reparent (h); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1875 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1876
6890
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1877 void defaults (void) const { gripe_not_implemented ("surface::defaults"); }
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
1878
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1879 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1880 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1881
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1882 octave_value
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1883 get_property_from_handle (double handle, const std::string &property,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1884 const std::string &func);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1885 bool
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1886 set_property_in_handle (double handle, const std::string &property,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1887 const octave_value &arg, const std::string &func);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1888
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1889 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1890
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1891 class gh_manager
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1892 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1893 protected:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1894
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1895 gh_manager (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1896
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1897 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1898
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1899 static bool instance_ok (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1900 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1901 bool retval = true;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1902
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1903 if (! instance)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1904 instance = new gh_manager ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1905
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1906 if (! instance)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1907 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1908 ::error ("unable to create gh_manager!");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1909
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1910 retval = false;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1911 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1912
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1913 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1914 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1915
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1916 static void free (const graphics_handle& h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1917 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1918 if (instance_ok ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1919 instance->do_free (h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1920 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1921
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1922 static graphics_handle lookup (double val)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1923 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1924 return instance_ok () ? instance->do_lookup (val) : graphics_handle ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1925 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1926
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1927 static graphics_object get_object (const graphics_handle& h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1928 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1929 return instance_ok () ? instance->do_get_object (h) : graphics_object ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1930 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1931
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1932 static graphics_handle
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1933 make_graphics_handle (const std::string& go_name,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1934 const graphics_handle& parent)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1935 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1936 return instance_ok ()
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1937 ? instance->do_make_graphics_handle (go_name, parent)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1938 : graphics_handle ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1939 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1940
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1941 static graphics_handle make_figure_handle (double val)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1942 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1943 return instance_ok ()
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1944 ? instance->do_make_figure_handle (val) : graphics_handle ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1945 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1946
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1947 static void push_figure (const graphics_handle& h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1948 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1949 if (instance_ok ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1950 instance->do_push_figure (h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1951 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1952
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1953 static void pop_figure (const graphics_handle& h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1954 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1955 if (instance_ok ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1956 instance->do_pop_figure (h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1957 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1958
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1959 static graphics_handle current_figure (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1960 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1961 return instance_ok ()
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1962 ? instance->do_current_figure () : graphics_handle ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1963 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1964
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1965 static Matrix handle_list (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1966 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1967 return instance_ok () ? instance->do_handle_list () : Matrix ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1968 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1969
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1970 static Matrix figure_handle_list (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1971 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1972 return instance_ok () ? instance->do_figure_handle_list () : Matrix ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1973 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1974
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1975 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1976
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1977 static gh_manager *instance;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1978
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1979 typedef std::map<graphics_handle, graphics_object>::iterator iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1980 typedef std::map<graphics_handle, graphics_object>::const_iterator const_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1981
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1982 typedef std::set<graphics_handle>::iterator free_list_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1983 typedef std::set<graphics_handle>::const_iterator const_free_list_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1984
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1985 typedef std::list<graphics_handle>::iterator figure_list_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1986 typedef std::list<graphics_handle>::const_iterator const_figure_list_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1987
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1988 // A map of handles to graphics objects.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1989 std::map<graphics_handle, graphics_object> handle_map;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1990
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1991 // The available graphics handles.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1992 std::set<graphics_handle> handle_free_list;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1993
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1994 // The next handle available if handle_free_list is empty.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1995 graphics_handle next_handle;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1996
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1997 // The allocated figure handles. Top of the stack is most recently
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1998 // created.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1999 std::list<graphics_handle> figure_list;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2000
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2001 graphics_handle get_handle (const std::string& go_name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2002
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2003 void do_free (const graphics_handle& h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2004
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2005 graphics_handle do_lookup (double val)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2006 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2007 iterator p = handle_map.find (val);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2008
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2009 return (p != handle_map.end ()) ? p->first : graphics_handle ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2010 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2011
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2012 graphics_object do_get_object (const graphics_handle& h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2013 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2014 iterator p = handle_map.find (h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2015
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2016 return (p != handle_map.end ()) ? p->second : graphics_object ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2017 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2018
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2019 graphics_handle do_make_graphics_handle (const std::string& go_name,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2020 const graphics_handle& p);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2021
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2022 graphics_handle do_make_figure_handle (double val);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2023
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2024 Matrix do_handle_list (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2025 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2026 Matrix retval (1, handle_map.size ());
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2027 octave_idx_type i = 0;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2028 for (const_iterator p = handle_map.begin (); p != handle_map.end (); p++)
7056
2002804df782 [project @ 2007-10-24 00:32:44 by jwe]
jwe
parents: 7020
diff changeset
2029 {
2002804df782 [project @ 2007-10-24 00:32:44 by jwe]
jwe
parents: 7020
diff changeset
2030 graphics_handle h = p->first;
2002804df782 [project @ 2007-10-24 00:32:44 by jwe]
jwe
parents: 7020
diff changeset
2031 retval(i++) = h.value ();
2002804df782 [project @ 2007-10-24 00:32:44 by jwe]
jwe
parents: 7020
diff changeset
2032 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2033 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2034 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2035
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2036 Matrix do_figure_handle_list (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2037 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2038 Matrix retval (1, figure_list.size ());
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2039 octave_idx_type i = 0;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2040 for (const_figure_list_iterator p = figure_list.begin ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2041 p != figure_list.end ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2042 p++)
7056
2002804df782 [project @ 2007-10-24 00:32:44 by jwe]
jwe
parents: 7020
diff changeset
2043 {
2002804df782 [project @ 2007-10-24 00:32:44 by jwe]
jwe
parents: 7020
diff changeset
2044 graphics_handle h = *p;
2002804df782 [project @ 2007-10-24 00:32:44 by jwe]
jwe
parents: 7020
diff changeset
2045 retval(i++) = h.value ();
2002804df782 [project @ 2007-10-24 00:32:44 by jwe]
jwe
parents: 7020
diff changeset
2046 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2047 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2048 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2049
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2050 void do_push_figure (const graphics_handle& h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2051
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2052 void do_pop_figure (const graphics_handle& h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2053
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2054 graphics_handle do_current_figure (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2055 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2056 return figure_list.empty () ? graphics_handle () : figure_list.front ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2057 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2058 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2059
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2060
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2061 // This function is NOT equivalent to the scripting language function gcf.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2062 graphics_handle gcf (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2063
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2064 // This function is NOT equivalent to the scripting language function gca.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2065 graphics_handle gca (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2066
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2067 #endif
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2068
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2069 /*
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2070 ;;; Local Variables: ***
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2071 ;;; mode: C++ ***
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2072 ;;; End: ***
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2073 */