-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3791 from rism-digital/develop-generic-layer-elem…
…ents Implementation for generic layer elements
- Loading branch information
Showing
10 changed files
with
237 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
///////////////////////////////////////////////////////////////////////////// | ||
// Name: genericlayerelement.h | ||
// Author: Laurent Pugin | ||
// Created: 2024 | ||
// Copyright (c) Authors and others. All rights reserved. | ||
///////////////////////////////////////////////////////////////////////////// | ||
|
||
#ifndef __VRV_GENERICLAYERELEMENT_H__ | ||
#define __VRV_GENERICLAYERELEMENT_H__ | ||
|
||
#include "layerelement.h" | ||
|
||
namespace vrv { | ||
|
||
//---------------------------------------------------------------------------- | ||
// GenericLayerElement | ||
//---------------------------------------------------------------------------- | ||
|
||
/** | ||
* This class holds generic elements existing within MEI <layer> but not supported by Verovio | ||
*/ | ||
class GenericLayerElement : public LayerElement { | ||
public: | ||
/** | ||
* @name Constructors, destructors, reset and class name methods | ||
* Reset method resets all attribute classes | ||
*/ | ||
///@{ | ||
GenericLayerElement(); | ||
GenericLayerElement(const std::string &name); | ||
virtual ~GenericLayerElement(); | ||
Object *Clone() const override { return new GenericLayerElement(*this); } | ||
void Reset() override; | ||
std::string GetClassName() const override { return m_className; } | ||
///@} | ||
|
||
/** | ||
* Return the MEI element original name | ||
*/ | ||
std::string GetMEIName() const { return m_meiName; } | ||
|
||
//----------// | ||
// Functors // | ||
//----------// | ||
|
||
/** | ||
* Interface for class functor visitation | ||
*/ | ||
///@{ | ||
FunctorCode Accept(Functor &functor) override; | ||
FunctorCode Accept(ConstFunctor &functor) const override; | ||
FunctorCode AcceptEnd(Functor &functor) override; | ||
FunctorCode AcceptEnd(ConstFunctor &functor) const override; | ||
///@} | ||
|
||
private: | ||
/** The class name */ | ||
std::string m_className; | ||
/** The MEI element name */ | ||
std::string m_meiName; | ||
|
||
public: | ||
// | ||
private: | ||
}; | ||
|
||
} // namespace vrv | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,6 +220,7 @@ enum ClassId : uint16_t { | |
DOTS, | ||
FLAG, | ||
FTREM, | ||
GENERIC_ELEMENT, | ||
GRACEGRP, | ||
HALFMRPT, | ||
KEYSIG, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
///////////////////////////////////////////////////////////////////////////// | ||
// Name: genericlayerelement.cpp | ||
// Author: Laurent Pugin | ||
// Created: 2024 | ||
// Copyright (c) Authors and others. All rights reserved. | ||
///////////////////////////////////////////////////////////////////////////// | ||
|
||
#include "genericlayerelement.h" | ||
//---------------------------------------------------------------------------- | ||
|
||
#include <cassert> | ||
#include <math.h> | ||
|
||
//---------------------------------------------------------------------------- | ||
|
||
#include "functor.h" | ||
#include "vrv.h" | ||
|
||
namespace vrv { | ||
|
||
//---------------------------------------------------------------------------- | ||
// Space | ||
//---------------------------------------------------------------------------- | ||
|
||
// static const ClassRegistrar<GenericLayerElement> s_factory("generic", GENERIC_ELEMENT); | ||
|
||
GenericLayerElement::GenericLayerElement() : LayerElement(GENERIC_ELEMENT, "generic-") | ||
{ | ||
LogError("Creating generic element without name"); | ||
m_className = "[unspecified]"; | ||
this->Reset(); | ||
} | ||
|
||
GenericLayerElement::GenericLayerElement(const std::string &name) : LayerElement(GENERIC_ELEMENT, name + "-") | ||
{ | ||
m_meiName = name; | ||
m_className = name; | ||
std::transform(m_className.begin(), m_className.begin() + 1, m_className.begin(), ::toupper); | ||
this->Reset(); | ||
} | ||
|
||
GenericLayerElement::~GenericLayerElement() {} | ||
|
||
void GenericLayerElement::Reset() | ||
{ | ||
LayerElement::Reset(); | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
// Functors methods | ||
//---------------------------------------------------------------------------- | ||
|
||
FunctorCode GenericLayerElement::Accept(Functor &functor) | ||
{ | ||
return functor.VisitGenericLayerElement(this); | ||
} | ||
|
||
FunctorCode GenericLayerElement::Accept(ConstFunctor &functor) const | ||
{ | ||
return functor.VisitGenericLayerElement(this); | ||
} | ||
|
||
FunctorCode GenericLayerElement::AcceptEnd(Functor &functor) | ||
{ | ||
return functor.VisitGenericLayerElementEnd(this); | ||
} | ||
|
||
FunctorCode GenericLayerElement::AcceptEnd(ConstFunctor &functor) const | ||
{ | ||
return functor.VisitGenericLayerElementEnd(this); | ||
} | ||
|
||
} // namespace vrv |
Oops, something went wrong.