use of com.cas.circuit.msg.LinkerMsg in project TeachingInSimulation by ScOrPiOzzy.
the class ConnectionHandler method connectBySaveData.
/**
* 加载接线
*/
private void connectBySaveData(LinkerData linkerData, boolean modifiable) {
if (linkerData == null) {
log.warn("接线存档信息linkerData为空!");
return;
}
List<LinkerMsg> msgs = linkerData.getLinkerDatas();
linkerData.getLinkerMapForSave().clear();
for (LinkerMsg msg : msgs) {
onlineOrSaveLinker(msg, modifiable);
}
}
use of com.cas.circuit.msg.LinkerMsg in project TeachingInSimulation by ScOrPiOzzy.
the class ConnectionHandler method modifyWireNum.
public void modifyWireNum(String wireNum) {
// 保存导线号码
List<LinkerMsg> reqMsgs = linkerData.modifyWireNum(modifyLinker, wireNum);
if (!alone) {
for (LinkerMsg reqMsg : reqMsgs) {
reqMsg.setType(LinkerMsg.MARK_LINKER);
ClientMgr.send(reqMsg);
}
}
modifyWireNum(modifyLinker, wireNum);
}
use of com.cas.circuit.msg.LinkerMsg in project TeachingInSimulation by ScOrPiOzzy.
the class LinkerData method read.
@SuppressWarnings("unchecked")
@Override
public void read(JmeImporter im) throws IOException {
InputCapsule in = im.getCapsule(this);
linkerDatas = in.readSavableArrayList("LinkerDatas", new ArrayList<LinkerMsg>());
// stationInCharge = in.readByte("StationInCharge", StationConsts.NONE_STATION);
userid = in.readString("Userid", null);
for (LinkerMsg linker : linkerDatas) {
int key1 = linker.getKey();
if (linkerMapForRead.containsKey(key1)) {
linkerMapForRead.get(key1).add(linker);
} else {
List<LinkerMsg> list = new ArrayList<LinkerMsg>();
list.add(linker);
linkerMapForRead.put(key1, list);
}
String key2 = linker.getElecCompKey() + linker.getTargetKey();
if (linkerMapForCheck.containsKey(key2)) {
linkerMapForCheck.get(key2).add(linker);
} else {
List<LinkerMsg> list = new ArrayList<LinkerMsg>();
list.add(linker);
linkerMapForCheck.put(key2, list);
}
}
}
use of com.cas.circuit.msg.LinkerMsg in project TeachingInSimulation by ScOrPiOzzy.
the class LinkerData method addLinker.
// /**
// * 所负责工作站
// */
// private byte stationInCharge;
public LinkerMsg addLinker(ILinker linker, ILinkTarget target, String wireMark) {
// 封装LinkerInfo
LinkerMsg linkInfo = new LinkerMsg();
if (linker instanceof Wire) {
linkInfo.setLinkType(LinkerMsg.WIRE);
} else if (linker instanceof Pipe) {
linkInfo.setLinkType(LinkerMsg.PIPE);
} else if (linker instanceof Cable) {
if (target instanceof Jack) {
linkInfo.setLinkType(LinkerMsg.CABLE_JACK);
linkInfo.setElecComp(((Cable) linker).isElecComp());
} else {
linkInfo.setLinkType(LinkerMsg.CABLE_TERM);
// A、B、C
linkInfo.setWireMark(wireMark);
}
linkInfo.setCableKey(((Cable) linker).getPO().getId());
}
linkInfo.setKey(linker.hashCode());
linkInfo.setColor(linker.getColor());
linkInfo.setElecCompKey(target.getElecCompKey());
linkInfo.setTargetKey(target.getTargetKey());
// 线号
linkInfo.setNumMark(linker.getWireNum());
linkerMapForSave.put(linker.hashCode() + "_" + target.hashCode(), linkInfo);
return linkInfo;
}
use of com.cas.circuit.msg.LinkerMsg in project TeachingInSimulation by ScOrPiOzzy.
the class LinkerData method modifyTargetWireNum.
private void modifyTargetWireNum(List<LinkerMsg> msgs, int hashCode, ILinkTarget target, String wireNum) {
if (target == null) {
return;
}
LinkerMsg linkerInfo = linkerMapForSave.get(hashCode + "_" + target.hashCode());
if (linkerInfo == null) {
return;
}
linkerInfo.setNumMark(wireNum);
msgs.add(linkerInfo);
}
Aggregations