use of org.yaml.snakeyaml.Yaml in project BoofCV by lessthanoptimal.
the class CalibrationIO method save.
public static void save(Se3_F64 rigidBody, Writer outputWriter) {
Map<String, Object> map = new HashMap<>();
map.put("model", MODEL_RIGID_BODY);
map.put(VERSION, 0);
map.put("parameters", putSe3(rigidBody));
PrintWriter out = new PrintWriter(outputWriter);
out.println("# Rigid Body transformation");
Yaml yaml = createYmlObject();
yaml.dump(map, out);
out.close();
}
use of org.yaml.snakeyaml.Yaml in project BoofCV by lessthanoptimal.
the class CalibrationIO method createYmlObject.
private static Yaml createYmlObject() {
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
return new Yaml(options);
}
use of org.yaml.snakeyaml.Yaml in project BoofCV by lessthanoptimal.
the class CalibrationIO method save.
/**
* Saves stereo camera model to disk
*
* @param parameters Camera parameters
* @param outputWriter Stream to save the parameters to
*/
public static void save(StereoParameters parameters, Writer outputWriter) {
Map<String, Object> map = new HashMap<>();
map.put("model", MODEL_STEREO);
map.put(VERSION, 0);
map.put("left", putModelRadial(parameters.left, null));
map.put("right", putModelRadial(parameters.right, null));
map.put("rightToLeft", putSe3(parameters.rightToLeft));
PrintWriter out = new PrintWriter(outputWriter);
out.println("# Intrinsic and extrinsic parameters for a stereo camera pair");
Yaml yaml = createYmlObject();
yaml.dump(map, out);
out.close();
}
use of org.yaml.snakeyaml.Yaml in project pentaho-platform by pentaho.
the class MagicAceDefinition method parseYamlMagicAceDefinitions.
@SuppressWarnings("unchecked")
public static List<MagicAceDefinition> parseYamlMagicAceDefinitions(InputStream yamlFileInputStream, SessionImpl systemSession) throws RepositoryException {
List<MagicAceDefinition> magicAceDefinitions = new ArrayList<MagicAceDefinition>();
try {
Yaml yaml = new Yaml();
Map<String, Object> map = (Map<String, Object>) yaml.load(yamlFileInputStream);
List<Map<String, Object>> magicAceList = (List<Map<String, Object>>) map.get("MagicAces");
for (Map<String, Object> magicAceMap : magicAceList) {
MagicAceDefinition pam = parseMagicAceDefinition(magicAceMap, systemSession);
magicAceDefinitions.add(pam);
}
} catch (Exception e) {
throw new RuntimeException("Could not parse magic ace configurations from Yaml file.", e);
}
return magicAceDefinitions;
}
use of org.yaml.snakeyaml.Yaml in project incubator-servicecomb-java-chassis by apache.
the class YAMLUtil method yaml2Properties.
@SuppressWarnings("unchecked")
public static Map<String, Object> yaml2Properties(InputStream input) {
Map<String, Object> configurations = new LinkedHashMap<>();
Yaml yaml = new Yaml();
yaml.loadAll(input).forEach(data -> configurations.putAll(retrieveItems("", (Map<String, Object>) data)));
return configurations;
}
Aggregations