Search in sources :

Example 1 with TagNameControl

use of com.cas.sim.tis.app.control.TagNameControl in project TeachingInSimulation by ScOrPiOzzy.

the class CircuitState method toggleTagName.

private void toggleTagName() {
    for (ElecCompDef elecCompDef : compList) {
        Spatial elecCompMdl = elecCompDef.getSpatial();
        TagNameControl control = elecCompMdl.getControl(TagNameControl.class);
        if (control == null) {
            BitmapText tag = new BitmapText(tagFont);
            tag.setName(elecCompDef.getProxy().getUuid());
            guiNode.attachChild(tag);
            control = new TagNameControl(cam, tag);
            elecCompMdl.addControl(control);
        }
        control.setTagName(elecCompDef.getProxy().getTagName());
        control.setEnabled(tagVisible);
    }
    for (Wire wire : wireList) {
        Spatial wireMdl = wire.getSpatial();
        WireNumberControl control = wireMdl.getControl(WireNumberControl.class);
        if (control == null) {
            BitmapText tag = new BitmapText(tagFont);
            tag.setLocalScale(0.75f);
            tag.setName(String.format("%s-%s", wire.getProxy().getComp1Uuid(), wire.getProxy().getComp2Uuid()));
            control = new WireNumberControl(cam, guiNode, tag, wire.getProxy().getPointList());
            wireMdl.addControl(control);
        }
        control.setNumber(wire.getProxy().getNumber());
        control.setEnabled(tagVisible);
    }
}
Also used : ElecCompDef(com.cas.circuit.vo.ElecCompDef) BitmapText(com.jme3.font.BitmapText) Spatial(com.jme3.scene.Spatial) TagNameControl(com.cas.sim.tis.app.control.TagNameControl) WireNumberControl(com.cas.sim.tis.app.control.WireNumberControl) Wire(com.cas.circuit.vo.Wire)

Aggregations

ElecCompDef (com.cas.circuit.vo.ElecCompDef)1 Wire (com.cas.circuit.vo.Wire)1 TagNameControl (com.cas.sim.tis.app.control.TagNameControl)1 WireNumberControl (com.cas.sim.tis.app.control.WireNumberControl)1 BitmapText (com.jme3.font.BitmapText)1 Spatial (com.jme3.scene.Spatial)1