String ident = matcher.group(1);
String paramName = matcher.group(3);
Parameter param = res.getParameterByName(paramName);
if (param == null)
throw new IllegalArgumentException(currLines.get(i));
Envelope envelope = new Envelope();
param.setEnvelope(envelope);
while (i < currLines.size() - 1) {
i++;
// view
{
Matcher subMatcher = envelopeViewPattern.matcher(currLines.get(i));
if (subMatcher.find()) {
String subIdent = subMatcher.group(1);
if (subIdent.length() < ident.length())
throw new IllegalArgumentException(currLines.get(i));
try {
envelope.setViewXMin(Tools.FTOI(Double.parseDouble(subMatcher.group(3))));
envelope.setViewXMax(Tools.FTOI(Double.parseDouble(subMatcher.group(5))));
envelope.setViewYMin(Double.parseDouble(subMatcher.group(7)));
envelope.setViewYMax(Double.parseDouble(subMatcher.group(9)));
}
catch (Exception ex) {
throw new IllegalArgumentException(currLines.get(i));
}
continue;
}
}
// points
{
Matcher subMatcher = envelopePointsPattern.matcher(currLines.get(i));
if (subMatcher.find()) {
String subIdent = subMatcher.group(1);
if (subIdent.length() < ident.length())
throw new IllegalArgumentException(currLines.get(i));
try {
String points[] = subMatcher.group(2).trim().split(" ");
int x[] = new int[points.length / 2];
double y[] = new double[points.length / 2];
for (int j = 0; j < points.length; j += 2) {
x[j / 2] = Tools.FTOI(Double.parseDouble(points[j]));
y[j / 2] = Double.parseDouble(points[j + 1]);
}
envelope.setValues(x, y);
}
catch (Exception ex) {
throw new IllegalArgumentException(currLines.get(i));
}
continue;
}
}
// selected
{
Matcher subMatcher = envelopeSelectedPattern.matcher(currLines.get(i));
if (subMatcher.find()) {
String subIdent = subMatcher.group(1);
if (subIdent.length() < ident.length())
throw new IllegalArgumentException(currLines.get(i));
try {
envelope.setSelectedIdx(Tools.FTOI(Double.parseDouble(subMatcher.group(3))));
}
catch (Exception ex) {
throw new IllegalArgumentException(currLines.get(i));
}
continue;
}
}
// interpolation
{
Matcher subMatcher = envelopeInterpolationPattern.matcher(currLines.get(i));
if (subMatcher.find()) {
String subIdent = subMatcher.group(1);
if (subIdent.length() < ident.length())
throw new IllegalArgumentException(currLines.get(i));
try {
String interpolationStr = subMatcher.group(3);
envelope.setInterpolation(Envelope.Interpolation.valueOf(interpolationStr));
}
catch (Exception ex) {
throw new IllegalArgumentException(currLines.get(i));
}
continue;
}
}
// locked
{
Matcher subMatcher = envelopeLockedPattern.matcher(currLines.get(i));
if (subMatcher.find()) {
String subIdent = subMatcher.group(1);
if (subIdent.length() < ident.length())
throw new IllegalArgumentException(currLines.get(i));
try {
String lockedStr = subMatcher.group(3);
envelope.setLocked(lockedStr.equalsIgnoreCase("true"));
}
catch (Exception ex) {
throw new IllegalArgumentException(currLines.get(i));
}
continue;