feat: 增加南网谱图结构解析
parent
594271831d
commit
4bd1c833d1
@ -0,0 +1,52 @@
|
||||
package com.xydl.cac.model.spectrogram;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SouthYsp extends SpectrogramModel {
|
||||
Float version;
|
||||
Float fileVersion;
|
||||
Short type;
|
||||
Long createTime;
|
||||
Integer flag;
|
||||
String name;
|
||||
Float xInterval;
|
||||
Float yMax;
|
||||
Integer xUnit;
|
||||
Integer yUnit;
|
||||
Integer k;
|
||||
Integer m;
|
||||
List<SouthYspChannel> channels = new ArrayList<>();
|
||||
|
||||
public void readFrom(DataInputStream dis) throws Exception {
|
||||
version = dis.readFloat();
|
||||
fileVersion = dis.readFloat();
|
||||
type = dis.readShort();
|
||||
createTime = dis.readLong();
|
||||
flag = dis.read();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < 32; i++) {
|
||||
char c = (char) dis.readByte();
|
||||
sb.append(c);
|
||||
}
|
||||
name = sb.toString();
|
||||
xInterval = dis.readFloat();
|
||||
yMax = dis.readFloat();
|
||||
xUnit = dis.read();
|
||||
yUnit = dis.read();
|
||||
k = dis.readInt();
|
||||
m = dis.read();
|
||||
for (int i = 0; i < m; i++) {
|
||||
SouthYspChannel channel = new SouthYspChannel();
|
||||
channel.readFrom(dis);
|
||||
channels.add(channel);
|
||||
}
|
||||
for (SouthYspChannel channel : channels) {
|
||||
channel.readDataFrom(dis, k);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.xydl.cac.model.spectrogram;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SouthYspChannel {
|
||||
Integer n;
|
||||
List<YspChannelCrest> crests = new ArrayList<>();
|
||||
List<Float> data = new ArrayList<>();
|
||||
|
||||
public void readFrom(DataInputStream dis) throws Exception {
|
||||
n = dis.read();
|
||||
for (int i = 0; i < n; i++) {
|
||||
YspChannelCrest crest = new YspChannelCrest();
|
||||
crest.readFrom(dis);
|
||||
crests.add(crest);
|
||||
}
|
||||
}
|
||||
|
||||
public void readDataFrom(DataInputStream dis, Integer k) throws Exception {
|
||||
for (int i = 0; i < k; i++) {
|
||||
Float v = dis.readFloat();
|
||||
data.add(v);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue