Search in sources :

Example 1 with TransducersAdapter

use of com.cas.circuit.event.TransducersAdapter in project TeachingInSimulation by ScOrPiOzzy.

the class ConnectionHandler method bindSaveTransEvent.

private Cable bindSaveTransEvent(String elecCompKey, Cable cable, boolean modifiable) {
    ElecComp elecComp = eleCompMap.get(elecCompKey);
    if (elecComp == null) {
        System.err.println("找不到elecCompKey : " + elecCompKey);
        return null;
    // throw new RuntimeException("找不到elecCompKey : " + elecCompKey);
    }
    ElecCompDef def = elecComp.getDef();
    def.buildCompLogic();
    Node elecCompMdl = (Node) parent.getChild(elecComp.getPO().getMdlName());
    JmeUtil.setSpatialHighLight(elecCompMdl, ColorRGBA.BlackNoAlpha);
    // MouseEventState.cleanEvent(elecCompMdl);
    elecCompMdl.setUserData("MouseEvent", null);
    Jack jack = def.getJackMap().values().iterator().next();
    TransducersHandler handler = new TransducersHandler(this, elecComp, jack, modifiable);
    cable.bind(jack);
    cable.setElecComp(true);
    cable.getModels().put(elecCompMdl, jack);
    if (modifiable) {
        linkerData.addLinker(cable, jack, null);
    }
    handler.setCable(cable);
    addMouseEvent(elecCompMdl, new TransducersAdapter(handler));
    return cable;
}
Also used : TransducersHandler(com.cas.circuit.event.TransducersHandler) ElecCompDef(com.cas.circuit.vo.ElecCompDef) TransducersAdapter(com.cas.circuit.event.TransducersAdapter) Node(com.jme3.scene.Node) ElecComp(com.cas.circuit.vo.ElecComp) Jack(com.cas.circuit.vo.Jack)

Aggregations

TransducersAdapter (com.cas.circuit.event.TransducersAdapter)1 TransducersHandler (com.cas.circuit.event.TransducersHandler)1 ElecComp (com.cas.circuit.vo.ElecComp)1 ElecCompDef (com.cas.circuit.vo.ElecCompDef)1 Jack (com.cas.circuit.vo.Jack)1 Node (com.jme3.scene.Node)1