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
|
////////////////////////////////////////////////////////////////////////////////
/*! @file DataListRecord.cpp A record with a data list (as a dependence).
- Part of RANet - Research Assistant Net Library.
- Copyright(C) 2010-2017, Viktor E. Bursian, St.Petersburg, Russia.
Viktor_dot_Bursian_at_mail_dot_ioffe_dot_ru
*///////////////////////////////////////////////////////////////////////////////
#include "DataListRecord.h"
//#include "Log.h"
namespace RA {
//------------------------------------------------------------------------------
//---------------------------------------------------------- sDataListRecord ---
sDataListRecord::~sDataListRecord ()
{
}
sDataListRecord::sDataListRecord ()
:sListDataFunction()
,sRecord()
{
}
sDataListRecord::sDataListRecord (rcsPhysPair multiplier)
:sListDataFunction(multiplier)
,sRecord()
{
}
sDataListRecord::sDataListRecord (std::istream & a_stream
,rcsVersion version)
:sListDataFunction(a_stream,version)
,sRecord(a_stream,version)
{
if( version <= sVersion(0,9) ){
sPhysPair M(a_stream,version);
TheMultiplier = M;
int NumberOfPoints;
sDataPoint DP;
realIOv14 R;
a_stream.READ_INTO(Sorted);
a_stream.READ_INTO(NumberOfPoints);
for( int PointNo=0 ; PointNo < NumberOfPoints ; PointNo++ ){
a_stream.READ_INTO(R); DP.X=R;
a_stream.READ_INTO(R); DP.Y=R;
ThePoints.push_back(DP);
}
}
}
void sDataListRecord::Store (std::ostream & a_stream) const
{
sListDataFunction::Store(a_stream);
sRecord::Store(a_stream);
}
void sDataListRecord::CopyFrom (psNode other)
{
sRecord::CopyFrom(other);
psDataListRecord Other = dynamic_cast<psDataListRecord>(other);
if( Other ){
Sorted = Other->Sorted;
ThePoints.clear();
for( std::list<sDataPoint>::const_iterator Finger = Other->ThePoints.begin()
; Finger != Other->ThePoints.end() ; Finger++ ){
ThePoints.push_back(*Finger);
};
MarkAsEdited();
}
}
//sCurve::psTracer sDataListRecord::GetCurveTracer (rcsScales scales) const
//{
// //!@patch Та же проблема, что и с границами: при просмотре редактируется
// //if( ! Sorted ){
// // ThePoints.sort();
// // Sorted=true;
// // MarkAsEdited();
// //}
// return new sDataListRecord::sTracer(this,scales);
//}
sString sDataListRecord::Text (eTextFormat format
,eTextDetalization detalization)
{
sString T;
T = sFunction::Text(format,detalization);
T += sRecord::Text(format,detalization);
if( detalization > Laconic ){
T += sString(" [") + TheMultiplier.Y.Units().Text(format)
+sString("(") + TheMultiplier.X.Units().Text(format) + sString(")]");
}
return T;
}
void sDataListRecord::SetAppearance (psAppearance appearance)
{
QMutexLocker BodyLocker(&BodyMutex);
sListDataFunction::SetAppearance(appearance);
MarkAsEdited();
}
psMathValue sDataListRecord::MathValue ()
{
QMutexLocker BodyLocker(&BodyMutex);
return Replica();
}
void sDataListRecord::AddNewPoint (sPoint P)
{
QMutexLocker BodyLocker(&BodyMutex);
sListDataFunction::AddNewPoint(P);
MarkAsEdited();
}
//------------------------------------------------------------------------------
} //namespace RA
|