Package info.textgrid.lab.noteeditor.mei2013

Examples of info.textgrid.lab.noteeditor.mei2013.Layer


    return musicDiagram;
  }

  public static ScoreDef createScoreDef(int stavesCount) {
    ScoreDef scoreDef = new ScoreDef();
    StaffGrp staffGrp = new StaffGrp();
    for (int i = 0; i < stavesCount; i++) {
      StaffDef staffDef = new StaffDef();
      staffDef.setN(String.valueOf(i));
      if (i % 2 == 0)
        staffDef.setClefShape(GraphicalConstants.DEFAULT_SYSTEM_CLEF);
      else
        staffDef.setClefShape(GraphicalConstants.ALTERNATE_SYSTEM_CLEF);
      staffDef.setMeterCount(StringConstants.STRING_EMPTY + GraphicalConstants.DEFAULT_METER_COUNT);
      staffDef.setMeterUnit(new BigDecimal(
          GraphicalConstants.DEFAULT_METER_UNIT));
      staffDef.setKeySigValue("0");
      staffGrp.getInstrDevesAndGrpSymsAndStaffDeves().add(staffDef);
    }
    scoreDef.setStaffGrp(staffGrp);
    return scoreDef;
  }
View Full Code Here


    tpd.setDescription("Symbol");
    descriptors.add(cpd);
  }

  private void createDefaultStaffGrp() {
    setMeiNode(new StaffGrp());
  }
View Full Code Here

            contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof StaffGroupForm) {
      StaffGroupForm contentForm = (StaffGroupForm) childForm;
      StaffGrp contentNode = (StaffGrp) contentForm.getMeiNode();
      contentNode.getInstrDevesAndGrpSymsAndStaffDeves().clear();
      if(contentForm.getChildren().size() == 0) {
        //an empty staffGrp is not allowed and is being cut
        return null;
      }
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getInstrDevesAndGrpSymsAndStaffDeves().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof StaffDefForm) {
      StaffDefForm contentForm = (StaffDefForm) childForm;
      StaffDef contentNode = (StaffDef) contentForm.getMeiNode();
      contentNode.getMensursAndProportsAndClefGrps().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getMensursAndProportsAndClefGrps().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof MeasureForm) {
      MeasureForm measureForm = (MeasureForm) childForm;
      Measure measureNode = (Measure) measureForm.getMeiNode();
      measureNode.getAnnotsAndSlursAndTupletSpen().clear();
      for (BasicElement measureChildForm : measureForm.getChildren()) {
        measureNode.getAnnotsAndSlursAndTupletSpen().add(
            handleScoreChild(measureChildForm, saveAllVariants));
      }
      return measureNode;
    } else if (childForm instanceof StaffForm) {
      StaffForm contentForm = (StaffForm) childForm;
      Staff contentNode = (Staff) contentForm.getMeiNode();
      contentNode.getSbsAndSymbolsAndOrigs().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getSbsAndSymbolsAndOrigs().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof AppForm) {
      AppForm contentForm = (AppForm) childForm;
      App contentNode = (App) contentForm.getMeiNode();
      contentNode.getRdgs().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getRdgs().add(
            (Rdg) handleScoreChild(contentChildForm,
                saveAllVariants));
      }
      if (contentNode.isSetRdgs() && contentNode.getRdgs().isEmpty())
        contentNode.unsetRdgs();
      if (contentNode.isSetN() && contentNode.getN().isEmpty())
        contentNode.setN(null);
      if (!saveAllVariants) {
        for (BasicElement contentChildForm : contentForm.getChildren()) {
          if(contentChildForm instanceof ReadingForm && ((ReadingForm)contentChildForm).isActive() ) {
            MeiNode parentMeiNode = contentForm.getParent().getMeiNode();
            for(BasicElement grandChild : ((ReadingForm)contentChildForm).getChildren()){
              MeiNodeNavigator.addMeiNodeAsChild(parentMeiNode, grandChild.getMeiNode());
            }           
          }
        }
        return null;

      }
      return contentNode;
    } else if (childForm instanceof ReadingForm) {
      Rdg contentNode;
      ReadingForm contentForm = (ReadingForm) childForm;
      if (!saveAllVariants && !contentForm.isActive()) {
        // ignore this very reading
        return null;
      }
      contentNode = (Rdg) contentForm.getMeiNode();
      contentNode.getSources().clear();
      for (SourceBindingWrapper sbw : contentForm
          .getSourceBindingWrappers()) { // insert the wrapped sources
        contentNode.getSources().add(sbw.getSource().getId());
      }
      if (contentNode.getSources().isEmpty())
        contentNode.unsetSources();
      contentNode.getMRestsAndKeySigsAndProports().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getMRestsAndKeySigsAndProports().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof LayerForm) {
      LayerForm contentForm = (LayerForm) childForm;
      Layer contentNode = (Layer) contentForm.getMeiNode();
      contentNode.getBarLinesAndSyllablesAndGaps().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getBarLinesAndSyllablesAndGaps().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof ChordGroupForm) {
      ChordGroupForm contentForm = (ChordGroupForm) childForm;
      Chord contentNode = (Chord) contentForm.getMeiNode();
      contentNode.getRestoresAndArticsAndUnclears().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getRestoresAndArticsAndUnclears().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      if(contentNode.getArtics().isEmpty()) {
        contentNode.unsetArtics();
      }
      return contentNode;
    } else if (childForm instanceof BeamGroupForm) {
      BeamGroupForm contentForm = (BeamGroupForm) childForm;
      Beam contentNode = (Beam) contentForm.getMeiNode();
      contentNode.getFTremsAndChordsAndDamages().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        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;
View Full Code Here

        } catch (java.util.ConcurrentModificationException e) {
        }
      }
    } else {
      boolean verseAlreadyContained = false;
      Syl newSyl = new Syl();
      newSyl.getContent().add(0, newString);
      Verse verse = new Verse();
      for (Object contentElement : getNote()
          .getDamagesAndSylsAndCorrs()) {
        if (contentElement instanceof Verse) {
          verse = ((Verse) contentElement);
View Full Code Here

   * @param endPoint
   */
  public static void renderTie(Graphics graphics, TieForm tieForm,
      Point startPoint, Point endPoint) {
    graphics.setForegroundColor(calculateVariantColor(tieForm));
    Tie tieNode = (Tie) tieForm.getMeiNode();
    boolean isAbove = true;
    if (tieNode.isSetCurvedir()) {
      isAbove = tieNode.getCurvedir().equalsIgnoreCase(
          GraphicalConstants.PROPCOMBO_STRING_ARRAY_CURVEDIR[0]);
    }
    if (startPoint != null
        && endPoint != null
        && (isVisibleArea(MusicPlugin.getDefault().getActiveEditor()
View Full Code Here

      processSlur(graphics, (SlurForm) slurForm);
    }
  }

  private void processTie(Graphics graphics, TieForm tieForm) {
    Tie tieNode = (Tie) tieForm.getMeiNode();
    String startId = tieNode.getStartid();
    String endId = tieNode.getEndid();
    if (startId != null
        && endId != null
        && this.figurePassingObject.getNoteHeadLocationMap()
            .containsKey(startId)
        && this.figurePassingObject.getNoteHeadLocationMap()
View Full Code Here

            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;
View Full Code Here

  public static Mei createDefaultMeiTree(int stavesCount, int measureCount) {
    Mei mei = new Mei();
    MeiHead meiHead = new MeiHead();
    FileDesc fileDesc = new FileDesc();
    TitleStmt titleStmt = new TitleStmt();
    Title title = new Title();
    title.getContent().add("New MEI-2013 document");
    titleStmt.getTitles().add(title);
    fileDesc.setTitleStmt(titleStmt);
    PubStmt pubStmt = new PubStmt();
    fileDesc.setPubStmt(pubStmt);
    SourceDesc sourceDesc = new SourceDesc();
View Full Code Here

   */
  public static Mei createDefaultMeiTree(int stavesCount, int measureCount) {
    Mei mei = new Mei();
    MeiHead meiHead = new MeiHead();
    FileDesc fileDesc = new FileDesc();
    TitleStmt titleStmt = new TitleStmt();
    Title title = new Title();
    title.getContent().add("New MEI-2013 document");
    titleStmt.getTitles().add(title);
    fileDesc.setTitleStmt(titleStmt);
    PubStmt pubStmt = new PubStmt();
    fileDesc.setPubStmt(pubStmt);
    SourceDesc sourceDesc = new SourceDesc();
    Source source = new Source();
View Full Code Here

      }
    } else {
      boolean verseAlreadyContained = false;
      Syl newSyl = new Syl();
      newSyl.getContent().add(0, newString);
      Verse verse = new Verse();
      for (Object contentElement : getNote()
          .getDamagesAndSylsAndCorrs()) {
        if (contentElement instanceof Verse) {
          verse = ((Verse) contentElement);
          verseAlreadyContained = true;
          break;
        }
      }
      if (!verseAlreadyContained) {
        getNote().getDamagesAndSylsAndCorrs().add(verse);
      }
      verse.getSyls().clear();
      verse.getSyls().add(newSyl);
    }
  }
View Full Code Here

TOP

Related Classes of info.textgrid.lab.noteeditor.mei2013.Layer

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.