use of org.w3c.dom.Element in project atlas by alibaba.
the class Configuration method readDexPatternsFromXml.
private void readDexPatternsFromXml(Node node) throws IOException {
NodeList childNodes = node.getChildNodes();
if (childNodes.getLength() > 0) {
for (int j = 0, n = childNodes.getLength(); j < n; j++) {
Node child = childNodes.item(j);
if (child.getNodeType() == Node.ELEMENT_NODE) {
Element check = (Element) child;
String tagName = check.getTagName();
String value = check.getAttribute(ATTR_VALUE);
if (tagName.equals(ATTR_DEX_MODE)) {
if (value.equals("raw")) {
mDexRaw = true;
}
} else if (tagName.equals(ATTR_PATTERN)) {
addToPatterns(value, mDexFilePattern);
} else if (tagName.equals(ATTR_LOADER)) {
mDexLoaderPattern.add(value);
} else {
System.err.println("unknown dex tag " + tagName);
}
}
}
}
}
use of org.w3c.dom.Element in project android_frameworks_base by ParanoidAndroid.
the class ColladaParser method getRenderable.
private void getRenderable(Element shape, Transform t) {
String geoURL = shape.getAttribute("url").substring(1);
String geoName = mMeshIdNameMap.get(geoURL);
if (geoName != null) {
geoURL = geoName;
}
//RenderableGroup group = new RenderableGroup();
//group.setName(geoURL.substring(1));
//mScene.appendRenderable(group);
NodeList nl = shape.getElementsByTagName("instance_material");
if (nl != null) {
for (int i = 0; i < nl.getLength(); i++) {
Element materialRef = (Element) nl.item(i);
String meshIndexName = materialRef.getAttribute("symbol");
String materialName = materialRef.getAttribute("target");
Renderable d = new Renderable();
d.setMesh(geoURL, meshIndexName);
d.setMaterialName(materialName.substring(1));
d.setName(geoURL);
//Log.v(TAG, "Created drawable geo " + geoURL + " index " + meshIndexName + " material " + materialName);
d.setTransform(t);
//Log.v(TAG, "Set source param " + t.getName());
// Now find all the parameters that exist on the material
ArrayList<ShaderParam> materialParams;
materialParams = mEffectsParams.get(materialName.substring(1));
for (int pI = 0; pI < materialParams.size(); pI++) {
d.appendSourceParams(materialParams.get(pI));
//Log.v(TAG, "Set source param i: " + pI + " name " + materialParams.get(pI).getParamName());
}
mScene.appendRenderable(d);
//group.appendChildren(d);
}
}
}
use of org.w3c.dom.Element in project android_frameworks_base by ParanoidAndroid.
the class ColladaParser method getNode.
private void getNode(Element node, Transform parent, String indent) {
String name = node.getAttribute("name");
String id = node.getAttribute("id");
CompoundTransform current = new CompoundTransform();
current.setName(name);
if (parent != null) {
parent.appendChild(current);
} else {
mScene.appendTransform(current);
}
mScene.addToTransformMap(current);
//Log.v(TAG, indent + "|");
//Log.v(TAG, indent + "[" + name + "]");
Node childNode = node.getFirstChild();
while (childNode != null) {
if (childNode.getNodeType() == Node.ELEMENT_NODE) {
Element field = (Element) childNode;
String fieldName = field.getTagName();
String description = field.getAttribute("sid");
if (fieldName.equals("translate")) {
Float3 value = getFloat3(field);
current.addTranslate(description, value);
//Log.v(TAG, indent + " translate " + description + toString(value));
} else if (fieldName.equals("rotate")) {
Float4 value = getFloat4(field);
//Log.v(TAG, indent + " rotate " + description + toString(value));
Float3 axis = new Float3(value.x, value.y, value.z);
current.addRotate(description, axis, value.w);
} else if (fieldName.equals("scale")) {
Float3 value = getFloat3(field);
//Log.v(TAG, indent + " scale " + description + toString(value));
current.addScale(description, value);
} else if (fieldName.equals("instance_geometry")) {
getRenderable(field, current);
} else if (fieldName.equals("instance_light")) {
updateLight(field, current);
} else if (fieldName.equals("instance_camera")) {
updateCamera(field, current);
} else if (fieldName.equals("node")) {
getNode(field, current, indent + " ");
}
}
childNode = childNode.getNextSibling();
}
}
use of org.w3c.dom.Element in project android_frameworks_base by ParanoidAndroid.
the class ColladaParser method convertMaterials.
private void convertMaterials(Element mat) {
String id = mat.getAttribute("id");
NodeList nl = mat.getElementsByTagName("instance_effect");
if (nl != null && nl.getLength() == 1) {
Element ref = (Element) nl.item(0);
String url = ref.getAttribute("url");
ArrayList<ShaderParam> params = mEffectsParams.get(url.substring(1));
mEffectsParams.put(id, params);
}
}
use of org.w3c.dom.Element in project android_frameworks_base by ParanoidAndroid.
the class ColladaParser method convertEffects.
private void convertEffects(Element fx) {
String id = fx.getAttribute("id");
ArrayList<ShaderParam> params = new ArrayList<ShaderParam>();
NodeList nl = fx.getElementsByTagName("newparam");
if (nl != null) {
for (int i = 0; i < nl.getLength(); i++) {
Element field = (Element) nl.item(i);
field.setIdAttribute("sid", true);
}
}
nl = fx.getElementsByTagName("blinn");
if (nl != null) {
for (int i = 0; i < nl.getLength(); i++) {
Element field = (Element) nl.item(i);
//Log.v(TAG, "blinn");
extractParams(field, params);
}
}
nl = fx.getElementsByTagName("lambert");
if (nl != null) {
for (int i = 0; i < nl.getLength(); i++) {
Element field = (Element) nl.item(i);
//Log.v(TAG, "lambert");
extractParams(field, params);
}
}
nl = fx.getElementsByTagName("phong");
if (nl != null) {
for (int i = 0; i < nl.getLength(); i++) {
Element field = (Element) nl.item(i);
//Log.v(TAG, "phong");
extractParams(field, params);
}
}
mEffectsParams.put(id, params);
}
Aggregations