aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTraceGroup.h
blob: e96b4a6332e621993136ecf655ed22ed30e426a7 (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
/******************************************************************************
* 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 LTKTraceGroup which holds a sequence of LTKTrace
 *             type objects
 *
 * CONTENTS:
 *
 * AUTHOR:     Balaji R.
 *
 * DATE:       December 23, 2004
 * CHANGE HISTORY:
 * Author		Date		   Description of change
 * Deepu V.     March 7,2005   Added new assignment operator
 *                             LTKTraceGroup (const LTKTrace& trace)
 *                             and copy constructor
 *                             LTKTraceGroup& operator = (const LTKTrace& trace)
 * Thanigai		09-AUG-2005	   Added a function to empty the trace group
 *****************************************************************************/

#ifndef __LTKTRACEGROUP_H
#define __LTKTRACEGROUP_H

#include "LTKTypes.h"

class LTKTrace;

/**
* @ingroup Common_Classes
*/

/** @brief Contains set of traces that have similar characteristic.
 * @class LTKTraceGroup
 * This class contains set of traces that have similar characteristic.
 * Trace objects should be constructed and a vector that contains trace objects
 * should be passed to the constructor of the class.
 *
 */

class LTKTraceGroup
{

private:

	float m_xScaleFactor; //scale factor of the x channel

	float m_yScaleFactor; //scale factor of the y channel

	LTKTraceVector m_traceVector; //traces forming the trace group

public:

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

	/**
	 * Default constructor.
	 */


    LTKTraceGroup ();

	/**
	 * This constructor takes a vector of LTKTrace objects.
	 */

	LTKTraceGroup(const LTKTraceVector& inTraceVector,
		          float xScaleFactor=1.0, float yScaleFactor=1.0);

	/**
	 * Copy Constructor.
	 */

	LTKTraceGroup (const LTKTraceGroup& traceGroup);

	/**
	 * Constructor makes a Trace group with a single trace
	 */

	LTKTraceGroup (const LTKTrace& trace, float xScaleFactor=1.0,
		           float yScaleFactor=1.0);

	/**
	 * Destructor
	 */

	~LTKTraceGroup ();
	//@}

	/**
	 * @name Assignment operartor.
	 */
	//@{

	/**
	 * Assignment operator
	 * @param traceGroupObj The object to be copied by assignment
	 *
	 * @return LTKTraceGroup object
	 */

	LTKTraceGroup& operator = (const LTKTraceGroup& traceGroup);

		/**
	 * Assignment operator
	 * @param trace The trace object to be copied by assignment
	 *
	 * @return LTKTraceGroup object
	 */

	LTKTraceGroup& operator = (const LTKTrace& trace);

	//@}

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

	/**
	 * This function returns all traces that are present in the trace group.
	 *
	 * @param void
	 *
	 * @return Returns reference to vector of LTKTrace objects, that form a trace group.
	 *
	 */

	const LTKTraceVector& getAllTraces () const;


	/**
	 * This function gives a trace at a specified index in a trace group.
	 *
	 * @param traceIndex index of a trace in trace group
	 *
	 * @return Reference to LTKTrace object
	 */

	int getTraceAt (int traceIndex, LTKTrace& outTrace) const;

	/**
	 * This fucntion returns the number of traces present in trace group.
	 *
	 * @param void
	 *
	 * @return Number of traces present in trace group.
	 *
	 */

	int getNumTraces () const;

	float getXScaleFactor() const;
	float getYScaleFactor() const;

	//@}

	/**
	 * Setter Fucntions
	 */
	//@{

	/**
	 * This function is used to add traces to a trace group object.
	 *
	 * @param traceObj trace object that has to be added to trace group.
	 *
	 * @return void
	 *
	 */

	int addTrace (const LTKTrace& trace);

	/**
	 * This function replaces vector of all traces in a trace group with the
	 * new traces vector.
	 *
	 * @param tracesVector The new traces which to have accessed.
	 *
	 * @return void
	 */

    int setAllTraces (const LTKTraceVector& tracesVec, float xScaleFactor=1.0,
		              float yScaleFactor=1.0);

	/**
	 * This function empties the tracevector
	 *
	 * @param void
	 *
	 * @return int
	 */

    void emptyAllTraces();
    /**
	 * This function calculates the maximum and minimum of coordinates in a trace group.
	 *
	 * @param xMin reference to minimum value of x channel
	 *
	 * @param yMin reference to minimum value of y channel
	 *
	 * @param xMax reference to maximum value of x channel
	 *
	 * @param yMax reference to maximum value of y channel
	 *
	 * @return int error code
	 */

	int getBoundingBox(float& outXMin,float& outYMin,float& outXMax,float& outYMax) const;



	/**
	 * Scales the tracegroup according to the x and y scale factors taking into account the current scale factors.
	 * After scaling, the tracegroup is translated in order to preserve the "cornerToPreserve".
	 *
	 * @param xScaleFactor factor by which x dimension has to be scaled
	 * @param yScaleFactor factor by which y dimension has to be scaled
     * @param cornerToPreserve  corner to be retained after scaling
	 * @return int error code
	 */

	int scale(float xScaleFactor,float yScaleFactor,TGCORNER cornerToPreserve);



	/**
	 * Translates the tracegroup so that the "referenceCorner" is moved to (x,y)
     *
	 *
	 * @param x x value of the point to which referenceCorner has to be moved
	 * @param y y value of the point to which referenceCorner has to be moved
	 * @param referenceCorner - the reference corner in the tracegroup that has to be moved to (x,y)
	 * @return int error code
	 */

	int translateTo(float x,float y,TGCORNER referenceCorner);


	/**
	 * Scales the tracegroup according to the x and y scale factors.
	 * After scaling, the "referenceCorner" of the tracegroup is translated to
	 *(translateToX,translateToY)
	 *
	 * @param xScaleFactor factor by which x dimension has to be scaled
	 * @param yScaleFactor factor by which y dimension has to be scaled
	 * @param referenceCorner corner to be retained after scaling and moved to (translateToX,translateToY)
     * @return int error code
	 */

	int affineTransform(float xScaleFactor,float yScaleFactor,float translateToX,
		                float translateToY,TGCORNER referenceCorner);

        bool containsAnyEmptyTrace() const;


	//@}

};

#endif

//#ifndef __LTKTRACEGROUP_H
//#define __LTKTRACEGROUP_H