Package info.textgrid.lab.noteeditor.model

Examples of info.textgrid.lab.noteeditor.model.NoteForm


   * determines the note with the highest notehead within the chord
   *
   * @return
   */
  public static NoteForm getHighestNoteInChord(List<BasicElement> noteList) {
    NoteForm highestNote = null;
    for (BasicElement listMember : noteList) {
      if (listMember instanceof NoteForm) {
        highestNote = (NoteForm) listMember;
        break;
      }
View Full Code Here


   * determines the note with the highest notehead within the chord
   *
   * @return
   */
  public static NoteForm getLowestNoteInChord(List<BasicElement> noteList) {
    NoteForm lowestNote = null;
    for (BasicElement listMember : noteList) {
      if (listMember instanceof NoteForm) {
        lowestNote = (NoteForm) listMember;
        break;
      }
    }
    for (BasicElement listMember : noteList) {
      if (listMember instanceof NoteForm) {
        NoteForm higher = getHigherPitchedNoteForm(
            (NoteForm) listMember, lowestNote);
        if (!higher.getId().equals(listMember.getId())) {
          lowestNote = higher;
        }
      }
    }
    return lowestNote;
View Full Code Here

        .findAncestorForm(BeamGroupForm.class, chordGroupForm);
    if (ancestorBeam != null) {
      stemDirUp = ancestorBeam.isStemDirUp();
    }
    ConcurrentSkipListSet<Integer> posYLocationSet = new ConcurrentSkipListSet<Integer>();
    NoteForm highestNote = null;
    Point highestLocation = null;
    NoteForm lowestNote = null;
    Point lowestLocation = null;
    for (BasicElement child : MeiNodeNavigator.findActiveDescendantForm(
        NoteForm.class, chordGroupForm)) {
      NoteForm noteForm = (NoteForm) child;
      boolean noteHeadRight = false;
      Point noteHeadCenterLocation = calculateNoteHeadLocation(noteForm,
          location);
      if (highestNote == null) {
        highestNote = noteForm;
        highestLocation = noteHeadCenterLocation;
      } else {
        if (noteHeadCenterLocation.y > highestLocation.y) {
          highestNote = noteForm;
          highestLocation = noteHeadCenterLocation;
        }
      }
      if (lowestNote == null) {
        lowestNote = noteForm;
        lowestLocation = noteHeadCenterLocation;
      } else {
        if (noteHeadCenterLocation.y < lowestLocation.y) {
          lowestNote = noteForm;
          lowestLocation = noteHeadCenterLocation;
        }
      }

      if (posYLocationSet.contains(noteHeadCenterLocation.y + 2)
          || posYLocationSet.contains(noteHeadCenterLocation.y + 3)
          || posYLocationSet.contains(noteHeadCenterLocation.y - 2)
          || posYLocationSet.contains(noteHeadCenterLocation.y - 3)) {
        noteHeadRight = true;
      }
      posYLocationSet.add(noteHeadCenterLocation.y);
      processNote(graphics, noteForm, location, noteHeadRight);
    }
    // draw flag if not in a beam
    NoteForm noteClosestToFlagInChord;
    NoteForm noteFarthestFromFlagInChord;
    if (chordGroupForm.getChildren().size() > 1) {
      if (stemDirUp) {
        noteClosestToFlagInChord = highestNote;
        noteFarthestFromFlagInChord = lowestNote;
      } else {
View Full Code Here

    return candidate.equals(NoteForm.class);
  }

  @Override
  public void run() {
    this.child = new NoteForm();
    super.run();
  }
View Full Code Here

        contentNode.getFTremsAndChordsAndDamages().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof NoteForm) {
      NoteForm contentForm = (NoteForm) childForm;
      Note contentNode = (Note) contentForm.getMeiNode();
      if (contentNode.getArtics().isEmpty())
        contentNode.unsetArtics();
      return contentNode;
    } else if (childForm instanceof RestForm) {
      RestForm contentForm = (RestForm) childForm;
      Rest contentNode = (Rest) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof MRestForm) {
      MRestForm contentForm = (MRestForm) childForm;
      MRest contentNode = (MRest) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof SpaceForm) {
      SpaceForm contentForm = (SpaceForm) childForm;
      Space contentNode = (Space) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof DynamForm) {
      DynamForm contentForm = (DynamForm) childForm;
      Dynam contentNode = (Dynam) contentForm.getMeiNode();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getContent().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof TieForm) {
      TieForm contentForm = (TieForm) childForm;
      Tie contentNode = (Tie) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof SlurForm) {
      SlurForm contentForm = (SlurForm) childForm;
      Slur contentNode = (Slur) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof FermataForm) {
      FermataForm contentForm = (FermataForm) childForm;
      Fermata contentNode = (Fermata) contentForm.getMeiNode();
      return contentNode;
    } else {
      // write back a node of a currently unknown type
      UnknownMeiNodeForm contentForm = (UnknownMeiNodeForm) childForm;
      return contentForm.getMeiNode();
    }
  }
View Full Code Here

    }
    return staffForm;
  }

  private static BasicElement handleNote(Note note, BasicElement parentForm) {
    NoteForm noteForm = new NoteForm();
    noteForm.setMeiNode(note);
    noteForm.setParent(parentForm);
    return noteForm;
  }
View Full Code Here

TOP

Related Classes of info.textgrid.lab.noteeditor.model.NoteForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.