Skip to content

Commit 3f39dda

Browse files
committed
More strict horizontal assignment of inters to measures
1 parent 7a84e06 commit 3f39dda

File tree

7 files changed

+20
-25
lines changed

7 files changed

+20
-25
lines changed

app/src/main/java/org/audiveris/omr/sheet/Part.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,7 @@ public List<LyricLineInter> getLyrics ()
784784
// getMeasureAt //
785785
//--------------//
786786
/**
787-
* Report the measure that contains a given point (assumed to be in the containing
788-
* part).
787+
* Report the measure that contains a given point (assumed to be in the containing part).
789788
*
790789
* @param point coordinates of the given point
791790
* @return the containing measure
@@ -799,8 +798,7 @@ public Measure getMeasureAt (Point2D point)
799798
// getMeasureAt //
800799
//--------------//
801800
/**
802-
* Report the measure that contains a given point (assumed to be in the containing
803-
* part).
801+
* Report the measure that contains a given point (assumed to be in the containing part).
804802
*
805803
* @param point coordinates of the given point
806804
* @param staff related staff
@@ -813,10 +811,10 @@ public Measure getMeasureAt (Point2D point,
813811
return null;
814812
}
815813

816-
if ((point.getX() >= staff.getAbscissa(LEFT)) && (point.getX() <= staff.getAbscissa(
817-
RIGHT))) {
814+
if ((point.getX() >= staff.getAbscissa(LEFT)) //
815+
&& (point.getX() <= staff.getAbscissa(RIGHT))) {
818816
for (Measure measure : measures) {
819-
PartBarline barline = measure.getRightPartBarline();
817+
final PartBarline barline = measure.getRightPartBarline();
820818

821819
if ((barline == null) || (point.getX() <= barline.getRightX(this, staff))) {
822820
return measure;

app/src/main/java/org/audiveris/omr/sheet/SystemInfo.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,9 @@
9090
* @author Hervé Bitteur
9191
*/
9292
@XmlAccessorType(XmlAccessType.NONE)
93-
@XmlType(propOrder =
94-
{
93+
@XmlType(propOrder = {
9594
/** NOTA: Sig must be marshalled last. */
96-
"id",
97-
"indented",
98-
"stacks",
99-
"parts",
100-
"partGroups",
101-
"freeGlyphs",
102-
"sig" })
95+
"id", "indented", "stacks", "parts", "partGroups", "freeGlyphs", "sig" })
10396
public class SystemInfo
10497
implements Comparable<SystemInfo>
10598
{
@@ -1173,7 +1166,7 @@ public MeasureStack getStackAt (Point2D point,
11731166
}
11741167
}
11751168

1176-
if ((x >= x1) && (x <= x2)) {
1169+
if ((x > x1) && (x <= x2)) { // Away from left, include right
11771170
return stack;
11781171
}
11791172
}

app/src/main/java/org/audiveris/omr/sheet/note/ChordsBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ private void dispatchChords ()
405405

406406
if (measure != null) {
407407
// Case of chord which have changed of containing measure
408-
// while being build head after head
408+
// while being built head after head
409409
final Measure chordMeasure = chord.getMeasure();
410410
if ((chordMeasure != null) && (chordMeasure != measure)) {
411411
chordMeasure.removeInter(chord);

app/src/main/java/org/audiveris/omr/sheet/rhythm/Measure.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public RestChordInter getChord ()
380380
public void addInter (Inter inter)
381381
{
382382
if (inter.isVip()) {
383-
logger.info("VIP addInter {} into {}", inter, this);
383+
logger.info("VIP {} addInter {}", this, inter);
384384
}
385385

386386
switch (inter) {
@@ -599,7 +599,8 @@ public List<Inter> filter (Collection<Inter> inters)
599599
}
600600

601601
// Precise abscissa limits
602-
if ((getAbscissa(LEFT, staff) <= center.x) && (center.x <= getAbscissa(RIGHT, staff))) {
602+
if ((getAbscissa(LEFT, staff) < center.x) // Away from left
603+
&& (center.x <= getAbscissa(RIGHT, staff))) { // Include right
603604
kept.add(inter);
604605
}
605606
}

app/src/main/java/org/audiveris/omr/sheet/rhythm/MeasureStack.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,10 @@ public List<Inter> filter (Collection<Inter> systemInters)
621621
}
622622

623623
// Precise abscissa limits
624-
if ((measure != null) && (measure.getAbscissa(LEFT, staff) <= center.x)
625-
&& (center.x <= measure.getAbscissa(RIGHT, staff))) {
624+
if ((measure != null) //
625+
&& measures.contains(measure) //
626+
&& (measure.getAbscissa(LEFT, staff) < center.x) // Away from left
627+
&& (center.x <= measure.getAbscissa(RIGHT, staff))) { // Include right
626628
kept.add(inter);
627629
}
628630
}

app/src/main/java/org/audiveris/omr/sig/SigReducer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -944,8 +944,9 @@ private int checkIsolatedAlters ()
944944
Part part = staff.getPart();
945945
Measure measure = part.getMeasureAt(center);
946946

947-
if ((measure != null) && (measure == part.getLastMeasure()) && (measure
948-
.getPartBarlineOn(HorizontalSide.RIGHT) == null)) {
947+
if ((measure != null) //
948+
&& (measure == part.getLastMeasure()) //
949+
&& (measure.getPartBarlineOn(HorizontalSide.RIGHT) == null)) {
949950
// Empty measure?
950951
// Measure width?
951952
continue;

app/src/main/java/org/audiveris/omr/sig/inter/RestInter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public static RestInter createValid (Glyph glyph,
197197

198198
final Point center = inter.getCenter();
199199

200-
return (center.x >= left) && (center.x <= right);
200+
return (center.x > left) && (center.x <= right); // Away from left, include right
201201
});
202202

203203
for (Inter chord : measureChords) {

0 commit comments

Comments
 (0)