new Point(this.figurePassingObject.getRootXAxisProgress(),
GraphicalConstants.DEFAULT_STARTPOINT.y
+ GraphicalConstants.SHAPE_SINGLESYSTEM_HEIGHT
* indexOfStaffDef));
StaffDef staffDef = (StaffDef) staffDefForm.getMeiNode();
ScoreDef scoreDef = (ScoreDef) scoreDefForm.getMeiNode();
int extentForLabel = 0; // extent for label if present
if (staffDef.isSetLabel()) {
extentForLabel = staffDef.getLabel().length()
* this.figurePassingObject.getLabelSylExtentBase();
}
int extentForBrackets = 0;
BasicElement parent = staffDefForm.getParent();
while (parent.getFormType() == BasicElement.FormType.StaffGroup) {
parent = parent.getParent();
extentForBrackets += GraphicalConstants.SHAPE_STAFFDEF_BRACKET_OFFSET;
}
int extentForClefs = 0; // extent for clef keys if present
if (staffDef.isSetClefShape()) {
extentForClefs = GraphicalConstants.SHAPE_STAFFDEF_CLEF_OFFSET;
if (staffDef.getClefShape() == DataCLEFSHAPE.GG) {
extentForClefs = GraphicalConstants.SHAPE_STAFFDEF_CLEF_OFFSET * 2;
}
} else {
if (scoreDef.isSetClefShape()) {
extentForClefs = GraphicalConstants.SHAPE_STAFFDEF_CLEF_OFFSET;
if (scoreDef.getClefShape() == DataCLEFSHAPE.GG) {
extentForClefs = GraphicalConstants.SHAPE_STAFFDEF_CLEF_OFFSET * 2;
}
}
}
int extentForKeySig = 0; // extent for key signatures if present
String keySignatureMEIString;
if (staffDef.isSetKeySigValue()) {
keySignatureMEIString = staffDef.getKeySigValue();
} else {
if (scoreDef.isSetKeySigValue()) {
keySignatureMEIString = scoreDef.getKeySigValue();
} else { // default: empty
keySignatureMEIString = GraphicalConstants.PROPCOMBO_STRING_ARRAY_KEYSIGVALUES[0];
}
}
if (keySignatureMEIString.length() == 2) {
// one of the numbered sharps or flats, not '0'
int countKeysigs = Integer.parseInt(keySignatureMEIString
.substring(0, 1));
extentForKeySig = countKeysigs * 5;
}
int extentForMeterSign = 0; // extent for meter sign if present
if (staffDef.isSetMeterSym() || staffDef.isSetMeterCount()
|| staffDef.isSetMeterUnit() || scoreDef.isSetMeterSym()
|| scoreDef.isSetMeterCount() || scoreDef.isSetMeterUnit()) {
extentForMeterSign = GraphicalConstants.SHAPE_STAFFDEF_METER_OFFSET;
}
FigureStaffDefPassingObject figureStaffDefPassingObject = new FigureStaffDefPassingObject(
extentForLabel, extentForBrackets, extentForClefs,
extentForKeySig, extentForMeterSign);