Search in sources :

Example 6 with IntMap

use of com.jme3.util.IntMap in project jmonkeyengine by jMonkeyEngine.

the class DOMInputCapsule method readIntSavableMap.

public IntMap<? extends Savable> readIntSavableMap(String name, IntMap<? extends Savable> defVal) throws IOException {
    IntMap<Savable> ret = null;
    Element tempEl;
    if (name != null) {
        tempEl = findChildElement(currentElem, name);
    } else {
        tempEl = currentElem;
    }
    if (tempEl != null) {
        ret = new IntMap<Savable>();
        NodeList nodes = tempEl.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            Node n = nodes.item(i);
            if (n instanceof Element && n.getNodeName().equals("MapEntry")) {
                Element elem = (Element) n;
                currentElem = elem;
                int key = Integer.parseInt(currentElem.getAttribute("key"));
                Savable val = readSavable("Savable", null);
                ret.put(key, val);
            }
        }
    } else {
        return defVal;
    }
    currentElem = (Element) tempEl.getParentNode();
    return ret;
}
Also used : Savable(com.jme3.export.Savable)

Example 7 with IntMap

use of com.jme3.util.IntMap in project jmonkeyengine by jMonkeyEngine.

the class DOMOutputCapsule method writeIntSavableMap.

@Override
public void writeIntSavableMap(IntMap<? extends Savable> map, String name, IntMap<? extends Savable> defVal) throws IOException {
    if (map == null) {
        return;
    }
    if (map.equals(defVal)) {
        return;
    }
    Element stringMap = appendElement(name);
    for (Entry<? extends Savable> entry : map) {
        int key = entry.getKey();
        Element mapEntry = appendElement("MapEntry");
        mapEntry.setAttribute("key", Integer.toString(key));
        Savable s = entry.getValue();
        write(s, "Savable", null);
        currentElement = stringMap;
    }
    currentElement = (Element) stringMap.getParentNode();
}
Also used : Savable(com.jme3.export.Savable) Element(org.w3c.dom.Element)

Aggregations

IntMap (com.jme3.util.IntMap)4 Mesh (com.jme3.scene.Mesh)3 Savable (com.jme3.export.Savable)2 VertexBuffer (com.jme3.scene.VertexBuffer)2 AssetLoadException (com.jme3.asset.AssetLoadException)1 Vector3f (com.jme3.math.Vector3f)1 Geometry (com.jme3.scene.Geometry)1 Node (com.jme3.scene.Node)1 Spatial (com.jme3.scene.Spatial)1 IrMesh (com.jme3.scene.plugins.IrMesh)1 FbxAnimCurveNode (com.jme3.scene.plugins.fbx.anim.FbxAnimCurveNode)1 FbxCluster (com.jme3.scene.plugins.fbx.anim.FbxCluster)1 FbxLimbNode (com.jme3.scene.plugins.fbx.anim.FbxLimbNode)1 FbxMesh (com.jme3.scene.plugins.fbx.mesh.FbxMesh)1 FbxObject (com.jme3.scene.plugins.fbx.obj.FbxObject)1 Entry (com.jme3.util.IntMap.Entry)1 IOException (java.io.IOException)1 Field (java.lang.reflect.Field)1 FloatBuffer (java.nio.FloatBuffer)1 ArrayList (java.util.ArrayList)1