/** * * @param xs * @param mp * @throws IOException */ public static void writeMotionPath(XmlSerializer xs, MotionPath mp) throws IOException{ xs.startTag(NAMESPACE, MOTION_PATH); String name = mp.getName(); if(name != null && !name.isEmpty()){ xs.attribute(NAMESPACE, MOTION_PATH_NAME, name); } XMLUtils.writeVersionProperty(xs, mp.getInterpolatorVersion(), INTERPOLATION_VERSION_TYPE); writeControlPoints(xs, mp.getControlPoints()); xs.endTag(NAMESPACE, MOTION_PATH); }
public static ConfigurationNode writeMotionPath(MotionPath mp){ if(mp == null){ return null; } ConfigurationNode node = XMLConfigUtils.node(MOTION_PATH); String name = mp.getName(); if(name != null && !name.isEmpty()){ node.addAttribute(XMLConfigUtils.node(MOTION_PATH_NAME, name)); } node.addChild(XMLConfigUtils.writeVersion(mp.getInterpolatorVersion(), INTERPOLATION_VERSION_TYPE)); node.addChild(writeControlPoints(mp.getControlPoints())); return node; }
private static MotionPathRecord packMotionPath(MotionPath path, int id){ MotionPathRecord pathRec = new MotionPathRecord(); pathRec.setName(path.getName()); pathRec.setMotionPathId(id); pathRec.setStartTime(path.getStartTime()); pathRec.setStopTime(path.getStopTime()); VersionProperty interpVersion = path.getInterpolatorVersion(); pathRec.setInterpolator(packInterpolatorType(interpVersion)); Schema arraySchema = Schema.createArray(ControlPointRecord.SCHEMA$); List<Point2D> pointList = path.getControlPoints(); GenericArray<ControlPointRecord> points = new Array<ControlPointRecord>(pointList.size(), arraySchema); for(Point2D p : pointList){ points.add(packControlPoint(p)); } pathRec.setControlPoints(points); return pathRec; }