use of blue.components.lines.Line in project blue by kunstmusik.
the class BSBLineObject method setupForCompilation.
@Override
public void setupForCompilation(BSBCompilationUnit compilationUnit) {
for (Iterator iter = lines.iterator(); iter.hasNext(); ) {
Line line = (Line) iter.next();
String key = getObjectName() + "_" + line.getVarName();
String val = getLineString(line);
compilationUnit.addReplacementValue(key, val);
}
}
use of blue.components.lines.Line in project blue by kunstmusik.
the class BSBLineObject method setPresetValue.
@Override
public void setPresetValue(String val) {
String[] parts = val.split("@_@");
int version = 1;
int startIndex = 0;
if (parts[0].startsWith("version=")) {
version = Integer.parseInt(parts[0].substring(8));
startIndex = 1;
}
for (int i = startIndex; i < parts.length; i++) {
String lineStr = parts[i];
// System.out.println(lineStr);
String[] vals = lineStr.split(":");
String name = vals[0];
Line line = getLineByName(name);
if (line != null) {
line.clear();
double min = line.getMin();
double max = line.getMax();
double range = max - min;
for (int j = 1; j < vals.length; j += 2) {
LinePoint p = new LinePoint();
double x = (Double.parseDouble(vals[j]));
double y = (Double.parseDouble(vals[j + 1]));
if (version == 1) {
y = (y * range) + min;
}
p.setLocation(x, y);
line.addLinePoint(p);
}
}
}
if (propListeners != null) {
propListeners.firePropertyChange("presetValue", null, "preset");
}
}
use of blue.components.lines.Line in project blue by kunstmusik.
the class BSBLineObject method getPresetValue.
@Override
public String getPresetValue() {
StringBuilder buffer = new StringBuilder();
buffer.append("version=2");
for (Iterator iter = lines.iterator(); iter.hasNext(); ) {
buffer.append("@_@");
Line line = (Line) iter.next();
StringBuilder temp = new StringBuilder();
temp.append(line.getVarName());
for (int i = 0; i < line.size(); i++) {
LinePoint pt = line.getLinePoint(i);
temp.append(":").append(pt.getX());
temp.append(":").append(pt.getY());
}
buffer.append(temp.toString());
}
// System.out.println(buffer.toString());
return buffer.toString();
}
use of blue.components.lines.Line in project blue by kunstmusik.
the class LineObject method loadFromXML.
/* SERIALIZATION */
public static SoundObject loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
LineObject lObj = new LineObject();
SoundObjectUtilities.initBasicFromXML(data, lObj);
Elements lines = data.getElements();
int counter = 0;
while (lines.hasMoreElements()) {
Element node = lines.next();
if (node.getName().equals("line")) {
Line l = Line.loadFromXML(node);
lObj.getLines().add(l);
if (l.getColor() == null) {
l.setColor(LineColors.getColor(counter));
}
counter++;
}
}
return lObj;
}
use of blue.components.lines.Line in project blue by kunstmusik.
the class Sound method adjustLineType.
protected void adjustLineType(Parameter param) {
final Line line = param.getLine();
if (!(line instanceof SoundObjectParameterLine)) {
final SoundObjectParameterLine soundObjectParameterLine = new SoundObjectParameterLine(Sound.this, line);
param.setLine(soundObjectParameterLine);
}
}
Aggregations