MuseScore  3.4
Music composition and notation
omr.h
Go to the documentation of this file.
1 //=============================================================================
2 // MusE Reader
3 // Music Score Reader
4 //
5 // Copyright (C) 2010 Werner Schweer
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19 
20 #ifndef __OMR_H__
21 #define __OMR_H__
22 
23 #include "config.h"
24 
25 namespace Ms {
26 
27 class OmrView;
28 class XmlWriter;
29 class Pdf;
30 class OmrPage;
31 class Ocr;
32 class Score;
33 class ScoreView;
34 class XmlReader;
35 class Pattern;
36 
37 #ifdef OMR
38 
39 //---------------------------------------------------------
40 // Omr
41 //---------------------------------------------------------
42 
43 class Omr {
44  QString _path;
45  double _spatium;
46  double _dpmm;
47  Pdf* _doc;
48  QList<OmrPage*> _pages;
49  Ocr* _ocr;
50  Score* _score;
51 
52  static void initUtils();
53 
54  void process1(int page);
55 
56 
57  enum ActionID { READ_PDF, INIT_PAGE, FINALIZE_PARMS, SYSTEM_IDENTIFICATION, ACTION_NUM};
58  QList<QString>ActionNames;
59 
60 public:
61  Omr(Score*);
62  Omr(const QString& path, Score*);
63 
64  static char bitsSetTable[256];
65 
66  bool readPdf();
67  int pagesInDocument() const;
68  int numPages() const {
69  return _pages.size();
70  }
71  OmrPage* page(int idx) {
72  return _pages[idx];
73  }
74  OmrView* newOmrView(ScoreView*);
75  const QList<OmrPage*>& pages() const {
76  return _pages;
77  }
78 #ifdef OCR
79  Ocr* ocr() const {
80  return _ocr;
81  }
82 #endif
83  void write(XmlWriter&) const;
84  void read(XmlReader&);
85 
86  double spatiumMM() const; // spatium in millimeter
87  double spatium() const {
88  return _spatium;
89  }
90  void setSpatium(double val) {
91  _spatium = val;
92  }
93  double dpmm() const {
94  return _dpmm;
95  }
96  void setDpmm(double val) {
97  _dpmm = val;
98  }
99  double staffDistance() const;
100  double systemDistance() const;
101  Score* score() const {
102  return _score;
103  }
104  const QString& path() const {
105  return _path;
106  }
107  bool omrActions(int &ID, int page = 0);
108 
109  static Pattern* quartheadPattern;
110  static Pattern* halfheadPattern;
111  static Pattern* sharpPattern;
112  static Pattern* flatPattern;
113  static Pattern* naturalPattern;
114  static Pattern* trebleclefPattern;
115  static Pattern* bassclefPattern;
116  static Pattern* timesigPattern[10];
117  };
118 
119 #else
120 //---------------------------------------------------------
121 // Omr
122 //---------------------------------------------------------
123 
124 class Omr {
125  QString _path;
126  QList<OmrPage*> _pages;
127 
128 public:
129  Omr(Score*) {
130  }
131  Omr(const QString&, Score*) {
132  }
133  bool readPdf() {
134  return false;
135  }
136  int pagesInDocument() const {
137  return 0;
138  }
139  int numPages() const {
140  return 0;
141  }
142  OmrPage* page(int) {
143  return 0;
144  }
145  const QList<OmrPage*>& pages() const {
146  return _pages;
147  }
149  return 0;
150  }
151 #ifdef OCR
152  Ocr* ocr() const {
153  return 0;
154  }
155 #endif
156  void write(XmlWriter&) const {
157  }
158  void read(XmlReader&) {
159  }
160 
161  double spatiumMM() const {
162  return 0;
163  }
164  double spatium() const {
165  return 0;
166  }
167  double dpmm() const {
168  return 0;
169  }
170  double staffDistance() const {
171  return 0;
172  }
173  double systemDistance() const {
174  return 0;
175  }
176  Score* score() const {
177  return 0;
178  }
179  const QString& path() const {
180  return _path;
181  }
182  };
183 
184 #endif
185 }
186 #endif
const QList< OmrPage * > & pages() const
Definition: omr.h:145
OmrView * newOmrView(ScoreView *)
Definition: omr.h:148
Definition: xml.h:67
Definition: omr.h:124
QString _path
Definition: omr.h:125
Definition: scoreview.h:90
double spatium() const
Definition: omr.h:164
double spatiumMM() const
Definition: omr.h:161
OmrPage * page(int)
Definition: omr.h:142
Definition: score.h:391
int pagesInDocument() const
Definition: omr.h:136
Definition: ocr.h:52
Score * score() const
Definition: omr.h:176
void read(XmlReader &)
Definition: omr.h:158
double staffDistance() const
Definition: omr.h:170
double systemDistance() const
Definition: omr.h:173
Definition: aeolus.cpp:26
double dpmm() const
Definition: omr.h:167
int numPages() const
Definition: omr.h:139
Definition: xml.h:218
Definition: omrview.h:51
Definition: xmlwriter.h:26
bool readPdf()
Definition: omr.h:133
Omr(Score *)
Definition: omr.h:129
Definition: xmlreader.h:28
Omr(const QString &, Score *)
Definition: omr.h:131
void write(XmlWriter &) const
Definition: omr.h:156
const QString & path() const
Definition: omr.h:179
QList< OmrPage * > _pages
Definition: omr.h:126
Definition: omrpage.h:187