private final UnitGroup units;
private Type(String name, UnitGroup units) {
- this.name = name;
+ this.name = trans.get ("Databases.materials.types." + name);
this.units = units;
}
}
}
+ /**
+ * Return a new user defined material of the specified type and localizable key.
+ */
+ public static Material newUserMaterialWithKey(Type type, String key, String name, double density) {
+ switch (type) {
+ case LINE:
+ return new Material.Line(name, key, density, true);
+
+ case SURFACE:
+ return new Material.Surface(name, key, density, true);
+
+ case BULK:
+ return new Material.Bulk(name, key, density, true);
+
+ default:
+ throw new IllegalArgumentException("Unknown material type: " + type);
+ }
+ }
+
+
public String toStorableString() {
return getType().name() + "|" + key + "|" + name.replace('|', ' ') + '|' + density;