}
public void setProperty(String propertyName, Object value, BitSet bsIgnored) {
// the following can be used with "select measures ({bitset})"
Measurement mt;
if ("clearModelIndex" == propertyName) {
for (int i = 0; i < measurementCount; i++)
((Measurement) measurements.get(i)).setModelIndex((short) 0);
return;
}
if ("color" == propertyName) {
setColor(value == null ? Graphics3D.INHERIT_ALL : Graphics3D.getColix(value));
return;
}
if ("delete" == propertyName) {
delete(value);
setIndices();
return;
}
if ("font" == propertyName) {
font3d = (Font3D) value;
return;
}
if ("hideAll" == propertyName) {
showHide(((Boolean) value).booleanValue());
return;
}
if ("pending" == propertyName) {
pending((MeasurementPending) value);
return;
}
boolean isRefresh;
if ((isRefresh = ("refresh" == propertyName))
|| "refreshTrajectories" == propertyName) {
for (int i = measurements.size(); --i >= 0;)
if ((mt = (Measurement) measurements.get(i)) != null
&& (isRefresh || mt.isTrajectory()))
mt.refresh();
return;
}
if ("select" == propertyName) {
BitSet bs = (BitSet) value;
if (bs == null || BitSetUtil.cardinalityOf(bs) == 0) {
bsSelected = null;
} else {
bsSelected = new BitSet();
bsSelected.or(bs);
}
return;
}
if ("setFormats" == propertyName) {
setFormats((String) value);
return;
}
//any one of the following clears the "select measures" business
bsSelected = null;
if ("maps" == propertyName) {
int[][] maps = (int[][]) value;
for (int i = 0; i < maps.length; i++) {
int len = maps[i].length;
if (len < 2 || len > 4)
continue;
int[] v = new int[len + 1];
v[0] = len;
System.arraycopy(maps[i], 0, v, 1, len);
toggleOn((int[]) v);
}
} else if ("measure" == propertyName) {
MeasurementData md = (MeasurementData) value;
tickInfo = md.tickInfo;
if (md.tickInfo != null && md.tickInfo.id.equals("default")) {
defaultTickInfo = md.tickInfo;
return;
}
rangeMinMax[0] = md.rangeMinMax[0];
rangeMinMax[1] = md.rangeMinMax[1];
mustBeConnected = md.mustBeConnected;
mustNotBeConnected = md.mustNotBeConnected;
strFormat = md.strFormat;
if (md.isAll) {
if (tickInfo != null)
define(md, Token.delete);
define(md, md.tokAction);
setIndices();
return;
}
Measurement pt = setSingleItem(md.points);
switch (md.tokAction) {
case Token.delete:
define(Integer.MIN_VALUE, pt, true, false, false);
setIndices();
break;
case Token.on:
showHide(pt, false);
break;
case Token.off:
showHide(pt, true);
break;
case Token.define:
delete(pt);
toggle(pt);
break;
case Token.opToggle:
toggle(pt);
}
return;
}
if ("clear" == propertyName) {
clear();
return;
}
if ("deleteModelAtoms" == propertyName) {
atoms = (Atom[])((Object[])value)[1];
int modelIndex = ((int[]) ((Object[]) value)[2])[0];
int firstAtomDeleted = ((int[])((Object[])value)[2])[1];
int nAtomsDeleted = ((int[])((Object[])value)[2])[2];
int atomMax = firstAtomDeleted + nAtomsDeleted;
for (int i = measurementCount; --i >= 0;) {
mt = (Measurement) measurements.get(i);
int[] indices = mt.getCountPlusIndices();
for (int j = 1; j <= indices[0]; j++) {
int iAtom = indices[j];
if (iAtom >= firstAtomDeleted) {
if (iAtom < atomMax) {
deleteMeasurement(i);
break;
}
indices[j] -= nAtomsDeleted;
} else if (iAtom < 0) {
Point3fi pt = mt.getAtom(j);
if (pt.modelIndex > modelIndex) {
pt.modelIndex--;
} else if (pt.modelIndex == modelIndex) {
deleteMeasurement(i);
break;
}
}
}
}
return;
}
if ("hide" == propertyName) {
showHide(new Measurement(modelSet, (int[]) value, null, null), true);
return;
}
if ("reformatDistances" == propertyName) {
reformatDistances();
return;
}
if ("show" == propertyName) {
showHide(new Measurement(modelSet, (int[]) value, null, null), false);
return;
}
if ("toggle" == propertyName) {
toggle(new Measurement(modelSet, (int[]) value, null, null));
return;
}
if ("toggleOn" == propertyName) {
toggleOn((int[]) value);