diff --git a/src/main/org/audiveris/omr/classifier/AnnotationsBuilder.java b/src/main/org/audiveris/omr/classifier/AnnotationsBuilder.java index c845b2515..097838012 100644 --- a/src/main/org/audiveris/omr/classifier/AnnotationsBuilder.java +++ b/src/main/org/audiveris/omr/classifier/AnnotationsBuilder.java @@ -39,8 +39,6 @@ import org.audiveris.omr.sig.inter.BracketConnectorInter; import org.audiveris.omr.sig.inter.BracketInter; import org.audiveris.omr.sig.inter.EndingInter; -import org.audiveris.omr.sig.inter.FermataArcInter; -import org.audiveris.omr.sig.inter.FermataDotInter; import org.audiveris.omr.sig.inter.HeadChordInter; import org.audiveris.omr.sig.inter.HeadInter; import org.audiveris.omr.sig.inter.Inter; @@ -108,8 +106,6 @@ public class AnnotationsBuilder excludedInterClasses.add(BracketConnectorInter.class); excludedInterClasses.add(BracketInter.class); // TODO: should be defined in OmrShape? excludedInterClasses.add(EndingInter.class); - excludedInterClasses.add(FermataArcInter.class); - excludedInterClasses.add(FermataDotInter.class); excludedInterClasses.add(KeyInter.class); excludedInterClasses.add(RepeatDotInter.class); // Processed via BarlineInter excludedInterClasses.add(SegmentInter.class); diff --git a/src/main/org/audiveris/omr/glyph/Shape.java b/src/main/org/audiveris/omr/glyph/Shape.java index ff4a7a63b..de6b172b9 100644 --- a/src/main/org/audiveris/omr/glyph/Shape.java +++ b/src/main/org/audiveris/omr/glyph/Shape.java @@ -55,7 +55,6 @@ *
FermataArcInter
represents the arc part of a fermata, either upright or
* inverted.
* - * Combined with a FermataDotInter, it can lead to a (full) FermataInter. + * Combined with a FermataDotInter, it could lead to a (full) FermataInter. + *
+ * This class is now deprecated, since the full {@link FermataInter} can be directly recognized
+ * by the {@link SymbolsBuilder}.
*
* @author Hervé Bitteur
*/
+@Deprecated
@XmlRootElement(name = "fermata-arc")
public class FermataArcInter
extends AbstractInter
@@ -47,55 +46,8 @@ public class FermataArcInter
/**
* No-arg constructor meant for JAXB.
*/
+ @SuppressWarnings("unused")
private FermataArcInter ()
{
}
-
- /**
- * Creates a new FermataArcInter
object.
- *
- * @param glyph the fermata arc glyph
- * @param shape FERMATA_ARC or FERMATA_ARC_BELOW
- * @param grade the interpretation quality
- */
- private FermataArcInter (Glyph glyph,
- Shape shape,
- Double grade)
- {
- super(glyph, glyph.getBounds(), shape, grade);
- }
-
- //~ Static Methods -----------------------------------------------------------------------------
-
- //--------//
- // create //
- //--------//
- /**
- * (Try to) create a fermata arc inter.
- *
- * @param glyph the fermata arc glyph
- * @param shape FERMATA_ARC or FERMATA_ARC_BELOW
- * @param grade the interpretation quality
- * @param system the related system
- * @return the created fermata arc or null
- */
- public static FermataArcInter create (Glyph glyph,
- Shape shape,
- double grade,
- SystemInfo system)
- {
- // Look for proper staff
- final Point2D center = glyph.getCenter2D();
- final Staff staff = (shape == Shape.FERMATA_ARC) ? system.getStaffAtOrBelow(center)
- : system.getStaffAtOrAbove(center);
-
- if (staff == null) {
- return null;
- }
-
- final FermataArcInter arc = new FermataArcInter(glyph, shape, grade);
- arc.setStaff(staff);
-
- return arc;
- }
}
diff --git a/src/main/org/audiveris/omr/sig/inter/FermataDotInter.java b/src/main/org/audiveris/omr/sig/inter/FermataDotInter.java
index e0225b34b..d5a0b19d7 100644
--- a/src/main/org/audiveris/omr/sig/inter/FermataDotInter.java
+++ b/src/main/org/audiveris/omr/sig/inter/FermataDotInter.java
@@ -21,9 +21,7 @@
//
package org.audiveris.omr.sig.inter;
-import org.audiveris.omr.glyph.Glyph;
-import org.audiveris.omr.glyph.Shape;
-import org.audiveris.omr.sheet.Staff;
+import org.audiveris.omr.sheet.symbol.SymbolsBuilder;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -31,9 +29,13 @@
/**
* Class FermataDotInter
represents a dot in a fermata symbol.
+ *
+ * This class is now deprecated, since the full {@link FermataInter} can be directly recognized
+ * by the {@link SymbolsBuilder}.
*
* @author Hervé Bitteur
*/
+@Deprecated
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "fermata-dot")
public class FermataDotInter
@@ -44,39 +46,8 @@ public class FermataDotInter
/**
* No-arg constructor meant for JAXB.
*/
+ @SuppressWarnings("unused")
private FermataDotInter ()
{
}
-
- /**
- * Creates a new FermataDotInter
object.
- *
- * @param glyph underlying glyph
- * @param grade evaluation value
- */
- public FermataDotInter (Glyph glyph,
- Double grade)
- {
- super(glyph, null, Shape.FERMATA_DOT, grade);
- }
-
- //~ Methods ------------------------------------------------------------------------------------
-
- //----------//
- // getStaff //
- //----------//
- @Override
- public Staff getStaff ()
- {
- if (staff == null) {
- // Use staff information of containing FermataInter ensemble
- InterEnsemble ens = getEnsemble();
-
- if (ens != null) {
- staff = ens.getStaff();
- }
- }
-
- return staff;
- }
}
diff --git a/src/main/org/audiveris/omr/sig/inter/FermataInter.java b/src/main/org/audiveris/omr/sig/inter/FermataInter.java
index 59857bec9..f24c1b804 100644
--- a/src/main/org/audiveris/omr/sig/inter/FermataInter.java
+++ b/src/main/org/audiveris/omr/sig/inter/FermataInter.java
@@ -22,26 +22,30 @@
package org.audiveris.omr.sig.inter;
import org.audiveris.omr.constant.ConstantSet;
+import org.audiveris.omr.glyph.Glyph;
+import org.audiveris.omr.glyph.GlyphFactory;
+import org.audiveris.omr.glyph.GlyphIndex;
import org.audiveris.omr.glyph.Shape;
import org.audiveris.omr.math.GeoUtil;
import org.audiveris.omr.sheet.Scale;
import org.audiveris.omr.sheet.Staff;
import org.audiveris.omr.sheet.SystemInfo;
import org.audiveris.omr.sheet.rhythm.MeasureStack;
+import org.audiveris.omr.sheet.symbol.SymbolsBuilder;
+import org.audiveris.omr.sig.relation.Containment;
import org.audiveris.omr.sig.relation.FermataBarRelation;
import org.audiveris.omr.sig.relation.FermataChordRelation;
import org.audiveris.omr.sig.relation.Link;
-import org.audiveris.omr.util.Entities;
+import org.audiveris.omr.sig.relation.Relation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.Point;
-import java.awt.Rectangle;
import java.awt.geom.Point2D;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
@@ -59,13 +63,16 @@
* A fermata may also refer to a single or double barline, to indicate the end of a phrase.
*
* Such reference is implemented via a Relation instance. + *
+ * Initially, the fermata arc and the fermata dot were kept as separated inters because they were
+ * often too distant to be grabbed by the {@link SymbolsBuilder}.
+ * Since the SymbolsBuilder now accepts larger gaps, there is no more need for these member inters.
*
* @author Hervé Bitteur
*/
@XmlRootElement(name = "fermata")
public class FermataInter
extends AbstractInter
- implements InterEnsemble
{
//~ Static fields/initializers -----------------------------------------------------------------
@@ -73,16 +80,12 @@ public class FermataInter
private static final Logger logger = LoggerFactory.getLogger(FermataInter.class);
- // Arc then dot
- private static Comparator
+ * Since the (new) FermataInter is no longer an ensemble, we deal with Containment relations
+ * and former members directly.
*
- * @return the arc
+ * @return true if really upgraded
*/
- public FermataArcInter getArc ()
+ @SuppressWarnings("deprecation")
+ public boolean upgradeOldStuff ()
{
- final List
- * Purpose of this symbol is to allow the glyph classifier to recognize fermata arc and fermata dot
- * as two separate entities (they lie too far apart for the glyph classifier to be considered as
- * a single symbol candidate).
- *
- * @author Hervé Bitteur
- */
-public class FermataArcSymbol
- extends DecorableSymbol
-{
- //~ Constructors -------------------------------------------------------------------------------
-
- /**
- * Create a FermataArcSymbol standard size with no decoration.
- *
- * @param shape the precise shape
- * @param family the musicFont family
- */
- public FermataArcSymbol (Shape shape,
- MusicFamily family)
- {
- super(shape, family);
- }
-
- //~ Methods ------------------------------------------------------------------------------------
-
- //-----------//
- // getParams //
- //-----------//
- @Override
- protected MyParams getParams (MusicFont font)
- {
- MyParams p = new MyParams();
-
- // Full symbol (arc + dot)
- p.layout = font.layoutShapeByCode(shape);
- p.rect = p.layout.getBounds();
-
- // Dot layout
- p.dotLayout = font.layoutShapeByCode(Shape.DOT_set);
-
- return p;
- }
-
- //-------//
- // paint //
- //-------//
- @Override
- protected void paint (Graphics2D g,
- Params params,
- Point2D location,
- Alignment alignment)
- {
- // We paint the full fermata symbol first
- // Then we paint a dot using white or decoComposite
- MyParams p = (MyParams) params;
- Alignment align = (shape == Shape.FERMATA_ARC) ? BOTTOM_CENTER : TOP_CENTER;
- Point2D loc = alignment.translatedPoint(align, p.rect, location);
-
- MusicFont.paint(g, p.layout, loc, align); // Arc + Dot
-
- if (isDecorated) {
- // Paint dot in gray
- Composite oldComposite = g.getComposite();
- g.setComposite(decoComposite);
- MusicFont.paint(g, p.dotLayout, loc, align);
- g.setComposite(oldComposite);
- } else {
- // Erase dot using white color (?)
- Color oldColor = g.getColor();
- g.setColor(Color.WHITE);
- MusicFont.paint(g, p.dotLayout, loc, align);
- g.setColor(oldColor);
- }
- }
-
- //~ Inner Classes ------------------------------------------------------------------------------
-
- //--------//
- // Params //
- //--------//
- protected static class MyParams
- extends Params
- {
-
- // layout for full fermata
- // rect for full fermata
- TextLayout dotLayout; // For the dot
- }
-}
diff --git a/src/main/org/audiveris/omr/ui/symbol/FinaleJazzSymbols.java b/src/main/org/audiveris/omr/ui/symbol/FinaleJazzSymbols.java
index ad2b36fb8..68f537d0e 100644
--- a/src/main/org/audiveris/omr/ui/symbol/FinaleJazzSymbols.java
+++ b/src/main/org/audiveris/omr/ui/symbol/FinaleJazzSymbols.java
@@ -110,10 +110,7 @@ public int[] getCode (Shape shape)
case EIGHTH_REST -> ints(0xE4E6);
case FERMATA -> ints(0xE4C0);
- case FERMATA_ARC -> ints(0xE4C0);
- case FERMATA_ARC_BELOW -> ints(0xE4C1);
case FERMATA_BELOW -> ints(0xE4C1);
- case FERMATA_DOT -> ints(0xE044); // ? useful ?
///case FINAL_BARLINE -> ints(0xE032);
case FLAG_1 -> ints(0xE250);
case FLAG_1_DOWN -> ints(0xE251);
diff --git a/src/main/org/audiveris/omr/ui/symbol/MusicalSymbols.java b/src/main/org/audiveris/omr/ui/symbol/MusicalSymbols.java
index dab98100f..ae1bf73ff 100644
--- a/src/main/org/audiveris/omr/ui/symbol/MusicalSymbols.java
+++ b/src/main/org/audiveris/omr/ui/symbol/MusicalSymbols.java
@@ -100,10 +100,7 @@ public int[] getCode (Shape shape)
case EIGHTH_REST -> ints(0xF0E4);
case FERMATA -> ints(0xF055);
- case FERMATA_ARC -> ints(0xF055);
- case FERMATA_ARC_BELOW -> ints(0xF075);
case FERMATA_BELOW -> ints(0xF075);
- case FERMATA_DOT -> ints(0xF02E);
case FINAL_BARLINE -> ints(0xF0D3);
case FLAG_1 -> ints(0xF06A);
case FLAG_1_DOWN -> ints(0xF04A);
diff --git a/src/main/org/audiveris/omr/ui/symbol/Symbols.java b/src/main/org/audiveris/omr/ui/symbol/Symbols.java
index a1bf105bc..c3520c338 100644
--- a/src/main/org/audiveris/omr/ui/symbol/Symbols.java
+++ b/src/main/org/audiveris/omr/ui/symbol/Symbols.java
@@ -230,9 +230,6 @@ protected void populateSymbols ()
symbolMap.put(BEAM_SMALL, new SmallBeamSymbol(family()));
symbolMap.put(BEAM_HOOK, new BeamHookSymbol(family()));
- symbolMap.put(FERMATA_ARC, new FermataArcSymbol(FERMATA_ARC, family()));
- symbolMap.put(FERMATA_ARC_BELOW, new FermataArcSymbol(FERMATA_ARC_BELOW, family()));
-
symbolMap.put(LEDGER, new LedgerSymbol(family()));
symbolMap.put(OTTAVA, new OctaveShiftSymbol(OTTAVA, family()));
FermataInter
object.
*
+ * @param glyph the fermata glypg (arc + dot)
* @param shape the fermata shape (FERMATA or FERMATA_BELOW)
* @param grade the interpretation quality
*/
- public FermataInter (Shape shape,
+ public FermataInter (Glyph glyph,
+ Shape shape,
Double grade)
{
- super(null, null, shape, grade);
+ super(glyph, glyph.getBounds(), shape, grade);
}
//~ Methods ------------------------------------------------------------------------------------
- //-----------//
- // addMember //
- //-----------//
- @Override
- public void addMember (Inter member)
- {
- if (member instanceof FermataArcInter) {
- FermataArcInter arc = getArc();
-
- if (arc != null) {
- throw new IllegalStateException("Arc already defined");
- }
-
- EnsembleHelper.addMember(this, member);
- }
-
- if (member instanceof FermataDotInter) {
- FermataDotInter dot = getDot();
-
- if (dot != null) {
- throw new IllegalStateException("Dot already defined");
- }
-
- EnsembleHelper.addMember(this, member);
- }
- }
-
- //--------//
- // getArc //
- //--------//
+ //-----------------//
+ // upgradeOldStuff //
+ //-----------------//
/**
- * Report the arc part.
+ * Convert old fermata based on arc + dot ensemble.
+ * FermataArcSymbol
implements Fermata Arc symbols with the related dot
- * as decoration.
- *