Search in sources :

Example 6 with LinkerMsg

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);
    }
}
Also used : LinkerMsg(com.cas.circuit.msg.LinkerMsg)

Example 7 with LinkerMsg

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);
}
Also used : LinkerMsg(com.cas.circuit.msg.LinkerMsg)

Example 8 with LinkerMsg

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);
        }
    }
}
Also used : InputCapsule(com.jme3.export.InputCapsule) ArrayList(java.util.ArrayList) LinkerMsg(com.cas.circuit.msg.LinkerMsg)

Example 9 with LinkerMsg

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;
}
Also used : Cable(com.cas.circuit.vo.Cable) Pipe(com.cas.gas.vo.Pipe) Wire(com.cas.circuit.vo.Wire) Jack(com.cas.circuit.vo.Jack) LinkerMsg(com.cas.circuit.msg.LinkerMsg)

Example 10 with LinkerMsg

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);
}
Also used : LinkerMsg(com.cas.circuit.msg.LinkerMsg)

Aggregations

LinkerMsg (com.cas.circuit.msg.LinkerMsg)13 Wire (com.cas.circuit.vo.Wire)4 Cable (com.cas.circuit.vo.Cable)3 ArrayList (java.util.ArrayList)3 ConnectionHandler (com.cas.circuit.ConnectionHandler)1 IConnectScreenControl (com.cas.circuit.IConnectScreenControl)1 MultimeterState_MF47 (com.cas.circuit.state.MultimeterState_MF47)1 Jack (com.cas.circuit.vo.Jack)1 Terminal (com.cas.circuit.vo.Terminal)1 Pipe (com.cas.gas.vo.Pipe)1 InputCapsule (com.jme3.export.InputCapsule)1 OutputCapsule (com.jme3.export.OutputCapsule)1 HostedConnection (com.jme3.network.HostedConnection)1 Node (com.jme3.scene.Node)1 Spatial (com.jme3.scene.Spatial)1 AbstractControl (com.jme3.scene.control.AbstractControl)1 Nifty (de.lessvoid.nifty.Nifty)1 ScreenController (de.lessvoid.nifty.screen.ScreenController)1