本文整理汇总了Java中processing.data.XML类的典型用法代码示例。如果您正苦于以下问题:Java XML类的具体用法?Java XML怎么用?Java XML使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XML类属于processing.data包,在下文中一共展示了XML类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setXmlTo
import processing.data.XML; //导入依赖的package包/类
private void setXmlTo(XML xml, PMatrix3D matrix) {
xml.setFloat("m00", matrix.m00);
xml.setFloat("m01", matrix.m01);
xml.setFloat("m02", matrix.m02);
xml.setFloat("m03", matrix.m03);
xml.setFloat("m10", matrix.m10);
xml.setFloat("m11", matrix.m11);
xml.setFloat("m12", matrix.m12);
xml.setFloat("m13", matrix.m13);
xml.setFloat("m20", matrix.m20);
xml.setFloat("m21", matrix.m21);
xml.setFloat("m22", matrix.m22);
xml.setFloat("m23", matrix.m23);
xml.setFloat("m30", matrix.m30);
xml.setFloat("m31", matrix.m31);
xml.setFloat("m32", matrix.m32);
xml.setFloat("m33", matrix.m33);
}
示例2: getMatFrom
import processing.data.XML; //导入依赖的package包/类
private void getMatFrom(XML node, PMatrix3D matrix) {
matrix.m00 = node.getFloat("m00");
matrix.m01 = node.getFloat("m01");
matrix.m02 = node.getFloat("m02");
matrix.m03 = node.getFloat("m03");
matrix.m10 = node.getFloat("m10");
matrix.m11 = node.getFloat("m11");
matrix.m12 = node.getFloat("m12");
matrix.m13 = node.getFloat("m13");
matrix.m20 = node.getFloat("m20");
matrix.m21 = node.getFloat("m21");
matrix.m22 = node.getFloat("m22");
matrix.m23 = node.getFloat("m23");
matrix.m30 = node.getFloat("m30");
matrix.m31 = node.getFloat("m31");
matrix.m32 = node.getFloat("m32");
matrix.m33 = node.getFloat("m33");
}
示例3: loadFrom
import processing.data.XML; //导入依赖的package包/类
@Override
public void loadFrom(PApplet parent, String fileName) {
XML root = parent.loadXML(fileName);
XML resolutionNode = root.getChild(RESOLUTION_XML_NAME);
this.width = resolutionNode.getInt(WIDTH_XML_NAME);
this.height = resolutionNode.getInt(HEIGHT_XML_NAME);
XML intrinsicsNode = root.getChild(INTRINSICS_XML_NAME);
getMatFrom(intrinsicsNode, intrinsics);
XML extrinsicsNode = root.getChild(EXTRINSICS_XML_NAME);
if (extrinsicsNode == null) {
this.hasExtrinsics = false;
return;
}
getMatFrom(extrinsicsNode, extrinsics);
checkExtrinsics();
}
示例4: setHomographyTo
import processing.data.XML; //导入依赖的package包/类
private void setHomographyTo(XML xml) {
xml.setFloat("m00", pmatrix.m00);
xml.setFloat("m01", pmatrix.m01);
xml.setFloat("m02", pmatrix.m02);
xml.setFloat("m03", pmatrix.m03);
xml.setFloat("m10", pmatrix.m10);
xml.setFloat("m11", pmatrix.m11);
xml.setFloat("m12", pmatrix.m12);
xml.setFloat("m13", pmatrix.m13);
xml.setFloat("m20", pmatrix.m20);
xml.setFloat("m21", pmatrix.m21);
xml.setFloat("m22", pmatrix.m22);
xml.setFloat("m23", pmatrix.m23);
xml.setFloat("m30", pmatrix.m30);
xml.setFloat("m31", pmatrix.m31);
xml.setFloat("m32", pmatrix.m32);
xml.setFloat("m33", pmatrix.m33);
}
示例5: loadFrom
import processing.data.XML; //导入依赖的package包/类
@Override
public void loadFrom(PApplet parent, String fileName) {
XML root = parent.loadXML(fileName);
XML homographyNode = root.getChild(HOMOGRAPHY_XML_NAME);
pmatrix = new PMatrix3D();
pmatrix.m00 = homographyNode.getFloat("m00");
pmatrix.m01 = homographyNode.getFloat("m01");
pmatrix.m02 = homographyNode.getFloat("m02");
pmatrix.m03 = homographyNode.getFloat("m03");
pmatrix.m10 = homographyNode.getFloat("m10");
pmatrix.m11 = homographyNode.getFloat("m11");
pmatrix.m12 = homographyNode.getFloat("m12");
pmatrix.m13 = homographyNode.getFloat("m13");
pmatrix.m20 = homographyNode.getFloat("m20");
pmatrix.m21 = homographyNode.getFloat("m21");
pmatrix.m22 = homographyNode.getFloat("m22");
pmatrix.m23 = homographyNode.getFloat("m23");
pmatrix.m30 = homographyNode.getFloat("m30");
pmatrix.m31 = homographyNode.getFloat("m31");
pmatrix.m32 = homographyNode.getFloat("m32");
pmatrix.m33 = homographyNode.getFloat("m33");
initMat();
}
示例6: loadFrom
import processing.data.XML; //导入依赖的package包/类
@Override
public void loadFrom(PApplet parent, String fileName) {
XML root = parent.loadXML(fileName);
XML planeNode = root.getChild(PLANE_XML_NAME);
XML posNode = planeNode.getChild(PLANE_POS_XML_NAME);
XML normalNode = planeNode.getChild(PLANE_NORMAL_XML_NAME);
XML heightNode = planeNode.getChild(PLANE_HEIGHT_XML_NAME);
Vec3D position = getVectorFrom(posNode);
Vec3D normal = getVectorFrom(normalNode);
float h = heightNode.getFloat(PLANE_HEIGHT_XML_NAME);
this.plane = new Plane();
plane.set(position);
plane.normal.set(normal);
setHeight(h);
}
示例7: checkXML
import processing.data.XML; //导入依赖的package包/类
@Test
public void checkXML() {
sketch = new Sketch(); String[] args = new String[]{"--present", "test.fr.inria.papart.calibration.ProjectiveCalibrationTest"}; PApplet.runSketch(args, sketch);
instance = new PlaneCalibration();
XML root = sketch.loadXML(Common.currentPath + Common.PlaneCalibration);
assertTrue(root.getName() == Calibration.CALIBRATION_XML_NAME);
XML planeNode = root.getChild(PlaneCalibration.PLANE_XML_NAME);
assertNotNull(planeNode);
XML posNode = planeNode.getChild(PlaneCalibration.PLANE_POS_XML_NAME);
assertNotNull(posNode);
XML normalNode = planeNode.getChild(PlaneCalibration.PLANE_NORMAL_XML_NAME);
assertNotNull(normalNode);
XML heightNode = planeNode.getChild(PlaneCalibration.PLANE_HEIGHT_XML_NAME);
assertNotNull(heightNode);
assertTrue(heightNode.getFloat(PlaneCalibration.PLANE_HEIGHT_XML_NAME) == DEFAULT_PLANE_HEIGHT);
}
示例8: loadFrom
import processing.data.XML; //导入依赖的package包/类
@Override
public void loadFrom(PApplet parent, String fileName) {
XML root = parent.loadXML(fileName);
XML resolutionNode = root.getChild(RESOLUTION_XML_NAME);
this.width = resolutionNode.getInt(WIDTH_XML_NAME);
this.height = resolutionNode.getInt(HEIGHT_XML_NAME);
XML intrinsicsNode = root.getChild(INTRINSICS_XML_NAME);
getMatFrom(intrinsicsNode, intrinsics);
XML extrinsicsNode = root.getChild(EXTRINSICS_XML_NAME);
if(extrinsicsNode == null){
this.hasExtrinsics = false;
return;
}
getMatFrom(extrinsicsNode, extrinsics);
checkExtrinsics();
}
示例9: loadShapeImpl
import processing.data.XML; //导入依赖的package包/类
static protected PShape loadShapeImpl(PGraphics pg, String filename,
String extension) {
PShapeSVG svg = null;
if (extension.equals("svg")) {
svg = new PShapeSVG(pg.parent.loadXML(filename));
} else if (extension.equals("svgz")) {
try {
InputStream input =
new GZIPInputStream(pg.parent.createInput(filename));
XML xml = new XML(PApplet.createReader(input));
svg = new PShapeSVG(xml);
} catch (Exception e) {
e.printStackTrace();
}
}
if (svg != null) {
PShapeOpenGL p2d = PShapeOpenGL.createShape2D(pg.parent, svg);
return p2d;
} else {
return null;
}
}
示例10: loadShape
import processing.data.XML; //导入依赖的package包/类
@Override
public PShape loadShape(String filename, String options) {
String extension = PApplet.getExtension(filename);
PShapeSVG svg = null;
if (extension.equals("svg")) {
svg = new PShapeSVG(parent.loadXML(filename));
} else if (extension.equals("svgz")) {
try {
InputStream input = new GZIPInputStream(parent.createInput(filename));
XML xml = new XML(PApplet.createReader(input), options);
svg = new PShapeSVG(xml);
} catch (Exception e) {
e.printStackTrace();
}
} else {
PGraphics.showWarning("Unsupported format: " + filename);
}
return svg;
}
示例11: loadModel
import processing.data.XML; //导入依赖的package包/类
public static void loadModel(String fileName)
{
try {
xml = new XML(new File("res/obj/"+fileName+".rbxm"));
} catch (Exception e) {e.printStackTrace();}
XML child = xml.getChild("Item"); //workspace?
XML[] children = child.getChildren("Item");
ArrayList<String> temp = new ArrayList<String>();
for (int i = 0; i < children.length; i++)
{
if (children[i].getString("class").equals("Part"))
temp.add(XMLToText(children[i]));
else if (children[i].getString("class").equals("Model"))
{
for (int j = 0; j < children[i].getChildCount(); j++)
if (children[i].getString("class").equals("Part"))
temp.add(XMLToText(children[i].getChild(j)));
}
}
temp.add(0,Math.abs(maxX-minX)/2 + "," + maxX + "," + Math.abs(maxY-minY)/2 + "," + maxY + "," + Math.abs(maxZ-minZ)/2 + "," + maxZ);
/*String[] toFile = new String[temp.size()];
for (int i = 0; i < temp.size(); i++)
toFile[i] = temp.get(i);*/
saveStrings("res/parsedObj/"+fileName,temp);
}
示例12: ReadDataGeneRegion
import processing.data.XML; //导入依赖的package包/类
public void ReadDataGeneRegion(Gene g,XML element){
if(element.hasAttribute("name")) {
String name=element.getString("name");
Region region=p.rm.getRegion(name);
if(region==null) region=p.rm.addRegion(name);
if(element.hasAttribute("value")) {
String value=element.getString("value");
String[] values = p.split(value,';');
for(int j=0;j<values.length;j++){
String []tv=p.split(values[j],':');
if(tv.length==2) g.Expression[region.number][p.parseInt(tv[0])]=p.parseInt(tv[1]);
}
}
}
}
示例13: readModelDomain
import processing.data.XML; //导入依赖的package包/类
public ModelDomain readModelDomain(Model model,XML element){
ModelDomain md=null;
if(element.hasAttribute("Name")) {
String Name=element.getString("Name");
md=model.getDomain(Name);
if(md==null){
Domain dom=p.dm.getDomain(Name); //The Domain was created before the model even exist !
if(dom!=null) md=new ModelDomain(p, dom);
}
}
if(md!=null){
XML[]children=element.getChildren();
for(int j=0;j<children.length;j++)
if(children[j].getName().equals("Step")) readModelStep(model, children[j], md);
} else p.mm.addMessage("We don't have this domain " + element.getString("Name"));
return md;
}
示例14: readModelStep
import processing.data.XML; //导入依赖的package包/类
public void readModelStep(Model model, XML element,ModelDomain md){
int s=-1; if(element.hasAttribute("Number")) s=element.getInt("Number");
int hpf=-1; if(element.hasAttribute("hpf")) hpf=element.getInt("hpf");
int d=-1; if(element.hasAttribute("Draw")) d=element.getInt("Draw");
if(s>=0){
model.step=p.max(model.step,s);
model.ActualStep=model.step;
model.Correspons[s]=hpf;
XML[]children=element.getChildren();
for(int j=0;j<children.length;j++)
if(children[j].getName().equals("Gene"))
readModelGene(children[j], md, s);
} else p.mm.addMessage("We didn't fint step number " );
}
示例15: readModelGene
import processing.data.XML; //导入依赖的package包/类
public void readModelGene(XML element,ModelDomain md,int s){
Gene g=null;
if(element.hasAttribute("Name")) g=p.gm.getGene(element.getString("Name"));
if(g!=null){
boolean v=true; boolean blueState=false; //It's true by default
boolean Manual=false;
if(element.hasAttribute("Manual")){Manual=true; v=p.uf.parseBool(element.getString("Manual"));}
if(element.hasAttribute("BlueState"))blueState=p.uf.parseBool(element.getString("BlueState"));
int i=p.gm.getNumGene(g);
md.GenesStates[i][s]=v;
md.Manual[i][s]=Manual;
md.isBlueState[i][s]=blueState;
// addMessage("Add Genes "+element.getString("Name") + " to domain " +dom.Name);
} else p.mm.addMessage("This gene doesn't exist " + element.getString("Name"));
}