public static int calculateSingleNotePositionY(NoteForm noteForm, Point location) {
int octaveNumber = ((Note) noteForm.getMeiNode()).getOct();
List<BasicElement> staffDefList = MeiNodeNavigator.findDescendantForm(StaffDefForm.class, MusicPlugin.getDefault().getActiveDiagram().getScoreDefForm());
int staffNumber = (location.y - GraphicalConstants.DEFAULT_STARTPOINT.y) / GraphicalConstants.SHAPE_SINGLESYSTEM_HEIGHT;
DataCLEFSHAPE systemClef;
int clefLine = 2; //warum stand hier "3"? Wenn default G, dann w�re 2 korrekt?
// ist die Anzahl der Listeneintr�ge gr��er als der Z�hler der Notenzeile? Wann ist das nicht der Fall?
if (staffDefList.size() > staffNumber) {
systemClef = ((StaffDef) ((StaffDefForm) staffDefList.get(staffNumber)).getMeiNode()).getClefShape();
if(((StaffDef) ((StaffDefForm) staffDefList.get(staffNumber)).getMeiNode()).isSetClefLine()) {
clefLine = Integer.parseInt(((StaffDef) ((StaffDefForm) staffDefList.get(staffNumber)).getMeiNode()).getClefLine().toString());
} else {
switch (systemClef) {
case G:
clefLine = 2;
break;
case C:
clefLine = 3;
break;
case F:
clefLine = 4;
break;
}
}
}
else {
systemClef = GraphicalConstants.DEFAULT_SYSTEM_CLEF;
}
String pitchName = ((Note) noteForm.getMeiNode()).getPname();
int posY = GraphicalDynamicsSingleton.getInstance()
.getGraphicalDynamicsOS()
.translateNotePositionYStartpoint(location.y);
int octaveOffset = 0;
for(int i = 1; i <= octaveNumber; i++) {
if(i%2 == 1) {
octaveOffset += 17;
} else {
octaveOffset += 18;
}
}
posY -= (octaveOffset + 4);
// place the note with respect to clef, clefline and octave position
// starting position at this moment: upmost system line, "f-5" in G-Clef
int parseInt = pitchName.toLowerCase().codePointAt(0);
int cleffoffset = calculateClefOffsetPositionY(systemClef, clefLine);
int notepitchoffset = calculateNotePitchPlacement(parseInt);
int clefflineoffset = 10;
if (systemClef.equals(DataCLEFSHAPE.C)) {
clefflineoffset = 0;
} else {
if (systemClef.equals(DataCLEFSHAPE.F)) {
clefflineoffset = -10;
}
}
return posY + notepitchoffset + cleffoffset + clefflineoffset;