Java Code Examples for processing.data.XML#getChild()
The following examples show how to use
processing.data.XML#getChild() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProjectiveDeviceCalibration.java From PapARt with GNU Lesser General Public License v3.0 | 6 votes |
@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(); }
Example 2
Source File: PlaneCalibration.java From PapARt with GNU Lesser General Public License v3.0 | 6 votes |
@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); }
Example 3
Source File: PlaneCalibrationTest.java From PapARt with GNU Lesser General Public License v3.0 | 6 votes |
@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); }
Example 4
Source File: ProjectiveDeviceCalibration.java From PapARt with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void replaceIn(XML xml) { XML intrNode = xml.getChild(INTRINSICS_XML_NAME); xml.removeChild(intrNode); XML extrNode = xml.getChild(EXTRINSICS_XML_NAME); xml.removeChild(extrNode); XML resNode = xml.getChild(RESOLUTION_XML_NAME); xml.removeChild(resNode); addTo(xml); }
Example 5
Source File: CameraConfiguration.java From PapARt with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void loadFrom(PApplet parent, String fileName) { // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. XML root = parent.loadXML(fileName); XML cameraNode = root.getChild(CAMERA_XML_NAME); loadCameraFrom(cameraNode); }
Example 6
Source File: PlaneCalibration.java From PapARt with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void replaceIn(XML xml) { XML planeNode = xml.getChild(PLANE_XML_NAME); setVectorIn(planeNode.getChild(PLANE_POS_XML_NAME), (Vec3D) plane); setVectorIn(planeNode.getChild(PLANE_NORMAL_XML_NAME), plane.normal); planeNode.getChild(PLANE_HEIGHT_XML_NAME).setFloat(PLANE_HEIGHT_XML_NAME, height); }
Example 7
Source File: PlanarTouchCalibration.java From PapARt with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void replaceIn(XML xml) { XML element = xml.getChild(PLANAR_TOUCH_CALIBRATION_XML_NAME); setIn(element); }
Example 8
Source File: PlanarTouchCalibration.java From PapARt with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void loadFrom(PApplet parent, String fileName) { XML root = parent.loadXML(fileName); XML planarTouchCalibNode = root.getChild(PLANAR_TOUCH_CALIBRATION_XML_NAME); getFrom(planarTouchCalibNode); }
Example 9
Source File: SurfaceMapper.java From sketch-mapper with MIT License | 4 votes |
/** * Load projection map from file * * @param file */ public void load(File file) { if (this.MODE == SurfaceMapper.MODE_CALIBRATE) { if (file.exists()) { this.setGrouping(false); selectedSurfaces.clear(); surfaces.clear(); try { XML root = new XML(file); for (int i = 0; i < root.getChildCount(); i++) { if (root.getChild(i).getName().equals("surface")) { SuperSurface loaded = null; if (SuperSurface.BEZIER == root.getChild(i).getInt("type")) { loaded = new BezierSurface(parent, this, root.getChild(i), root.getChild(i).getInt("id"), root.getChild(i).getString("name")); } else { loaded = new QuadSurface(parent, this, root.getChild(i), root.getChild(i).getInt("id"), root.getChild(i).getString("name")); } if (ccolor.length > 0) loaded.setColor(ccolor[numAddedSurfaces % ccolor.length]); loaded.setModeCalibrate(); final String sketch = root.getChild(i).getString("sketch"); if (null != sketch && sketch.trim().length() > 0) { loadSketch(loaded, sketch); } surfaces.add(loaded); numAddedSurfaces++; } } if (this.getDebug()) PApplet.println("Projection layout loaded from " + file.getName() + ". " + surfaces.size() + " surfaces were loaded!"); } catch (Exception e) { PApplet.println("Error loading configuration!!!"); e.printStackTrace(); } } else { if (this.getDebug()) PApplet.println("ERROR loading XML! No projection layout exists!"); } } }
Example 10
Source File: Manifest.java From APDE with GNU General Public License v2.0 | 4 votes |
/** * Save a new version of the manifest info to the build location. * Also fill in any missing attributes that aren't yet set properly. */ protected void writeCopy(File file, String className, ComponentTarget appComp) { // write a copy to the build location save(file); // load the copy from the build location and start messing with it try { XML mf = new XML(file); // package name, or default String p = mf.getString("package").trim(); if (p.length() == 0) { mf.setString("package", SketchProperties.defaultPackageName(context.getSketchName())); } // app name and label, or the class name XML app = mf.getChild("application"); String label = app.getString("android:label"); if (label.length() == 0) { app.setString("android:label", className); } app.setString("android:debuggable", "true"); // Services need the label also in the service section if (appComp == ComponentTarget.WALLPAPER || appComp == ComponentTarget.WATCHFACE) { XML serv = app.getChild("service"); if (serv == null) { serv = app.addChild("service"); serv.setString("android:label", className); } else { label = serv.getString("android:label"); if (label.length() == 0) { serv.setString("android:label", className); } } } save(file); } catch (Exception e) { e.printStackTrace(); } }
Example 11
Source File: ScreenConfiguration.java From PapARt with GNU Lesser General Public License v3.0 | 3 votes |
@Override public void loadFrom(PApplet parent, String fileName) { // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. XML root = parent.loadXML(fileName); XML screenNode = root.getChild(SCREEN_XML_NAME); loadScreenFrom(screenNode); }