aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTrace.h
blob: f114cd7afc529d307284c0c92e069a327a8962f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
/******************************************************************************
* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE
********************************************************************************/

/************************************************************************
 * SVN MACROS
 *
 * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
 * $Revision: 561 $
 * $Author: sharmnid $
 *
 ************************************************************************/
/************************************************************************
 * FILE DESCR: Definition of LTKTrace which holds series of points from a pen down event to the next
 *			   immediate pen up event
 *
 * CONTENTS:
 *
 * AUTHOR:     Balaji R.
 *
 * DATE:       December 23, 2004
 * CHANGE HISTORY:
 * Author		Date			Description of change
 * Thanigai		09-AUG-2005		Added emptyTrace function to empty the trace
 ************************************************************************/

#ifndef __LTKTRACE_H
#define __LTKTRACE_H

#include "LTKTypes.h"
#include "LTKTraceFormat.h"

class LTKTraceFormat;

/** @defgroup Common_Classes  Common classes
*/

/**
* @ingroup Common_Classes
*/

/** @brief Stores contiguous series of coordinates for one stroke.
 * @class LTKTrace
 * This class contains contiguous series of coordinates for one stroke.
 * All channel values are stored internally as float. Hence the coordinates to be
 * passed to LTKTrace should be first converted to "float" type.
 */

class LTKTrace
{

private:

    vector<floatVector> m_traceChannels;//values of channels which make up the trace

	LTKTraceFormat m_traceFormat;


public:

	/**
	 * @name Constructors and Destructor
	 */
	//@{

	/**
	 * Default Constructor
	 */

	LTKTrace();

	/**
	 * This constructor initialises a vector of channel values with a vector of float.
	 *
	 * @param allChannelValues    A vector of float that contains contiguous channel values
	 * @param channelFormat       An object of LTKTraceFormat that provides information about
	 *                            the channel positions.
	 */

    LTKTrace(const floatVector& allChannelsVec, const LTKTraceFormat& channelformat);

	/**
	 * This constructor initialises a trace according to the specified trace format
	 *
	 * @param channelFormat       An object of LTKTraceFormat that provides information about
	 *                            the channel positions
	 */

    LTKTrace(const LTKTraceFormat& channelformat);

	/**
	 * Copy Constructor
	 */

	LTKTrace(const LTKTrace& trace);

	/**
	 * Destructor
	 */

	virtual ~LTKTrace();
	//@}

	/**
	 * @name Assignment operator
	 */
	//@{

	/**
	 * Assignment operator
	 * @param traceObj The object to be copied by assignment
	 *
	 * @return LTKTrace object
	 */

	LTKTrace& operator=(const LTKTrace& trace);
	//@}

	/**
	 * @name Getter Functions
	 */
	//@{

	/**
	 * This function returns the number of points that a stroke contains.
	 * Number of points is obtained by dividing the total number of contiguous channel values
	 * with the number of channels in trace format.
	 *
	 * @param void
	 *
	 * @return number of points in trace are returned.
	 *
	 */

	int getNumberOfPoints() const;

	/**
	 * This method returns a specific point in a stroke.
	 * @param pointIndex    The point index at which channel values are desired.
	 *
	 * @return A vector of float that contains channel values of a desired point.
	 *
	 */

	int getPointAt(int pointIndex, floatVector& outPointCoordinates) const;

	/**
	 * This method returns vector of float that contains all values
	 * of a specific channel in the stroke.
	 *
	 * @param channelName   The name of the channel, whose coordinates are required.
	 *
	 * @return A vector of float that contains all values of a desired channel.
	 */

	int getChannelValues(const string& channelName, floatVector& outChannelValues) const;

	/**
	 * This method returns vector of float that contains all values
	 * a channel at a specific position.
	 *
	 * @param channelIndex    Index of the channel,at which all coordinates are required.
	 *
	 * @return A vector of float that contains all values of a desired channel
	 */

	int getChannelValues(int channelIndex, floatVector& outChannelValues) const;

	/**
	 * This method returns a channel value at a specific point.
	 *
	 * @param Name of the channel whose value is required.
	 * @param the point number at which a channel's value is required.
	 *
	 * @return channel value at the specified point. This is a float.
	 *
	 */

	int getChannelValueAt(const string& channelName, int pointIndex,
						  float& outValue) const;



     //@}

	/**
	 * @name SetFunctions
	 */
	// @{

	/**
	 * This method reassigns the values of the channel specified. The size of the
	 * vector is expected to be same as that of the current channel size.
	 *
	 * @param channelName     Name of the channel
	 * @param channelValues   Vector that holds the new channel values
	 *
	 *
	 * @return errorCode
	 *
	 */

    int reassignChannelValues(const string& channelName,
						 const floatVector& channelValues);

	/**
	 * This method reassigns the values of all the channels. The number of rows
	 * in the input 2D vector must be equal to the current number of channels with
	 * each row having the same length. And this assumes one-to-one correspondence
	 * with the channel vector.
	 *
	 * @param allChannelValues new values of all the channels
	 *
	 * @return errorCode
	 *
	 */
	int setAllChannelValues(const float2DVector& allChannelValues);


	/**
	 * This method adds a point of coordinates to the existing set of points,
	 * of a trace.
	 *
	 * @param pointVec    vector of coordinates of a point.
	 *
	 * @return void
	 *
	 */
	int addPoint(const floatVector& pointVec);


	/**
	 * This function adds channel values of a new channel.
	 *
	 * @param channelValuesVec The channel values of the new channel.
	 * @param channelName The new channel to be added.
	 *
	 * @return void
	 */

    int addChannel(const floatVector &channelValuesVec,const LTKChannel& channel);

	/**
	 * This function empties the trace
	 *
	 * @param
	 *
	 * @return int
	 */

    void emptyTrace();

	/**
	 * Returns true if the data vector is empty
	 *
	 * @param
	 *
	 * @return bool
	 */

	bool isEmpty() const;


	/**
     * Getter on the current trace format
	 *
	 * @param
	 *
	 * @return const LTKTraceFormat&
	 */

   const LTKTraceFormat& getTraceFormat() const;


    int setChannelValues(const string& channelName,
                         const floatVector &inputChannelValuesVec);
	//@}



};

#endif

//#ifndef __LTKTRACE_H
//#define __LTKTRACE_H