Теперь для предсказуемых данных взяты места наложения из дизайна
This commit is contained in:
@@ -7,8 +7,8 @@ public static class OverlayPoints
|
|||||||
/// Список всех точек наложения по схеме 10-20
|
/// Список всех точек наложения по схеме 10-20
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly string[] Points = {
|
public static readonly string[] Points = {
|
||||||
"Fp1", "Fp2", "F3", "F4", "Fz", "C3", "C4", "Cz",
|
"Fp1", "Fp2", "F3", "F4", "FZ", "C3", "C4", "CZ",
|
||||||
"P3", "P4", "Pz", "F7", "F8", "T3", "T4", "T5", "T6", "O1", "O2"
|
"P3", "P4", "PZ", "F7", "F8", "T3", "T4", "T5", "T6", "O1", "O2"
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ namespace Server.DataGenerator;
|
|||||||
|
|
||||||
public class PredictableDataGenerator : IDataGenerator
|
public class PredictableDataGenerator : IDataGenerator
|
||||||
{
|
{
|
||||||
|
private static readonly string[] _overlayPoints = [ "F3", "F4", "C3", "CZ", "C4", "PZ", "O1", "O2", "ALL" ];
|
||||||
private long _currentFrameIndex = 0;
|
private long _currentFrameIndex = 0;
|
||||||
private Data[] _currentFrame;
|
private Data[] _currentFrame;
|
||||||
private int _currentPackageInFrame = 0;
|
private int _currentPackageInFrame = 0;
|
||||||
@@ -16,17 +17,16 @@ public class PredictableDataGenerator : IDataGenerator
|
|||||||
|
|
||||||
public PredictableDataGenerator(int frameDelay = 0)
|
public PredictableDataGenerator(int frameDelay = 0)
|
||||||
{
|
{
|
||||||
_delay = frameDelay;
|
_delay = 0;
|
||||||
_lastFrameTime = DateTime.Now;
|
_lastFrameTime = DateTime.Now;
|
||||||
_currentFrame = GenerateFrame(0, _lastFrameTime, _frameArtifact);
|
_currentFrame = GenerateFrame(_currentFrameIndex++, _lastFrameTime, _frameArtifact);
|
||||||
_currentFrameIndex = 1;
|
_delay = frameDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Data[] GenerateFrame(long frameIndex, DateTime frameTime, bool artifact)
|
private Data[] GenerateFrame(long frameIndex, DateTime frameTime, bool artifact)
|
||||||
{
|
{
|
||||||
Thread.Sleep(_delay);
|
Thread.Sleep(_delay);
|
||||||
var overlayPoints = OverlayPoints.Points.Take(8).Append(OverlayPoints.All).ToArray();
|
return _overlayPoints.Select((op, idx) => GeneratePredictableData(frameIndex, op, idx, frameTime, artifact)).ToArray();
|
||||||
return overlayPoints.Select((op, idx) => GeneratePredictableData(frameIndex, op, idx, frameTime, artifact)).ToArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Data GeneratePredictableData(long frameIndex, string overlayPoint, int index, DateTime frameTime, bool artifact)
|
private Data GeneratePredictableData(long frameIndex, string overlayPoint, int index, DateTime frameTime, bool artifact)
|
||||||
@@ -65,7 +65,7 @@ public class PredictableDataGenerator : IDataGenerator
|
|||||||
{
|
{
|
||||||
_frameArtifact = !_frameArtifact;
|
_frameArtifact = !_frameArtifact;
|
||||||
_lastFrameTime = _lastFrameTime.AddSeconds(1);
|
_lastFrameTime = _lastFrameTime.AddSeconds(1);
|
||||||
_currentFrame = GenerateFrame(Interlocked.Increment(ref _currentFrameIndex), _lastFrameTime, _frameArtifact);
|
_currentFrame = GenerateFrame(_currentFrameIndex++, _lastFrameTime, _frameArtifact);
|
||||||
_currentPackageInFrame = 0;
|
_currentPackageInFrame = 0;
|
||||||
}
|
}
|
||||||
return _currentFrame[_currentPackageInFrame++];
|
return _currentFrame[_currentPackageInFrame++];
|
||||||
@@ -75,6 +75,6 @@ public class PredictableDataGenerator : IDataGenerator
|
|||||||
{
|
{
|
||||||
_frameArtifact = !_frameArtifact;
|
_frameArtifact = !_frameArtifact;
|
||||||
_lastFrameTime = _lastFrameTime.AddSeconds(1);
|
_lastFrameTime = _lastFrameTime.AddSeconds(1);
|
||||||
return GenerateFrame(Interlocked.Increment(ref _currentFrameIndex), _lastFrameTime, _frameArtifact);
|
return GenerateFrame(_currentFrameIndex++, _lastFrameTime, _frameArtifact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user