本文整理汇总了C++中Staff::GetN方法的典型用法代码示例。如果您正苦于以下问题:C++ Staff::GetN方法的具体用法?C++ Staff::GetN怎么用?C++ Staff::GetN使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Staff
的用法示例。
在下文中一共展示了Staff::GetN方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDrawingStemDir
data_STEMDIRECTION Layer::GetDrawingStemDir(const ArrayOfBeamElementCoords *coords)
{
assert(!coords->empty());
// Adjust the x position of the first and last element for taking into account the stem width
LayerElement *first = dynamic_cast<LayerElement *>(coords->front()->m_element);
LayerElement *last = dynamic_cast<LayerElement *>(coords->back()->m_element);
if (!first || !last) {
return m_drawingStemDir;
}
Measure *measure = dynamic_cast<Measure *>(this->GetFirstParent(MEASURE));
assert(measure);
// First check if there is any <space> in the measure - if not we can return the layer stem direction
if (!measure->FindChildByType(SPACE)) {
return m_drawingStemDir;
}
Alignment *alignmentFirst = first->GetAlignment();
assert(alignmentFirst);
Alignment *alignmentLast = last->GetAlignment();
assert(alignmentLast);
// We are ignoring cross-staff situation here because this should not be called if we have one
Staff *staff = dynamic_cast<Staff *>(first->GetFirstParent(STAFF));
assert(staff);
double time = alignmentFirst->GetTime();
double duration = alignmentLast->GetTime() - time + last->GetAlignmentDuration();
duration = durRound(duration);
return GetDrawingStemDir(time, duration, measure, staff->GetN());
}
示例2: if
std::vector<Staff *> TimePointInterface::GetTstampStaves(Measure *measure)
{
std::vector<Staff *> staves;
std::vector<int>::iterator iter;
std::vector<int> staffList;
if (this->HasStaff()) {
staffList = this->GetStaff();
}
else if (m_start) {
Staff *staff = dynamic_cast<Staff *>(m_start->GetFirstParent(STAFF));
if (staff) staffList.push_back(staff->GetN());
}
for (iter = staffList.begin(); iter != staffList.end(); iter++) {
AttCommonNComparison comparison(STAFF, *iter);
Staff *staff = dynamic_cast<Staff *>(measure->FindChildByAttComparison(&comparison, 1));
if (!staff) {
// LogDebug("Staff with @n '%d' not found in measure '%s'", *iter, measure->GetUuid().c_str());
continue;
}
staves.push_back(staff);
}
if (staves.empty())
LogDebug("Empty @staff array");
return staves;
}
示例3: AddChild
void Measure::AddChild(Object *child)
{
if (child->IsControlElement()) {
assert(dynamic_cast<ControlElement *>(child));
}
else if (child->IsEditorialElement()) {
assert(dynamic_cast<EditorialElement *>(child));
}
else if (child->Is(STAFF)) {
Staff *staff = dynamic_cast<Staff *>(child);
assert(staff);
if (staff && (staff->GetN() < 1)) {
// This is not 100% safe if we have a <app> and <rdg> with more than
// one staff as a previous child.
staff->SetN(this->GetChildCount());
}
}
else {
LogError("Adding '%s' to a '%s'", child->GetClassName().c_str(), this->GetClassName().c_str());
assert(false);
}
child->SetParent(this);
m_children.push_back(child);
Modify();
}
示例4: PrepareProcessingLists
int Layer::PrepareProcessingLists(FunctorParams *functorParams)
{
PrepareProcessingListsParams *params = dynamic_cast<PrepareProcessingListsParams *>(functorParams);
assert(params);
// Alternate solution with StaffN_LayerN_VerseN_t
// StaffN_LayerN_VerseN_t *tree = static_cast<StaffN_LayerN_VerseN_t*>((*params).at(0));
Staff *staff = dynamic_cast<Staff *>(this->GetFirstParent(STAFF));
assert(staff);
params->m_layerTree.child[staff->GetN()].child[this->GetN()];
return FUNCTOR_CONTINUE;
}
示例5: AddFloatingElement
void Measure::AddFloatingElement( FloatingElement *element )
{
element->SetParent( this );
m_children.push_back( element );
if (element->Is() == STAFF) {
Staff *staff = dynamic_cast<Staff*>(element);
assert( staff );
if ( staff->GetN() < 1) {
// This is not 100% safe if we have a <app> and <rdg> with more than
// one staff as a previous child.
staff->SetN( this->GetChildCount() );
}
}
}
示例6: IsOnStaff
bool TimePointInterface::IsOnStaff(int n)
{
if (this->HasStaff()) {
std::vector<int> staffList = this->GetStaff();
std::vector<int>::iterator iter;
for (iter = staffList.begin(); iter != staffList.end(); iter++) {
if (*iter == n) return true;
}
return false;
}
else if (m_start) {
Staff *staff = dynamic_cast<Staff *>(m_start->GetFirstParent(STAFF));
if (staff && (staff->GetN() == n)) return true;
}
return false;
}
示例7: PrepareProcessingLists
int Verse::PrepareProcessingLists(FunctorParams *functorParams)
{
PrepareProcessingListsParams *params = dynamic_cast<PrepareProcessingListsParams *>(functorParams);
assert(params);
// StaffN_LayerN_VerseN_t *tree = static_cast<StaffN_LayerN_VerseN_t*>((*params).at(0));
Staff *staff = dynamic_cast<Staff *>(this->GetFirstParent(STAFF));
Layer *layer = dynamic_cast<Layer *>(this->GetFirstParent(LAYER));
assert(staff && layer);
params->m_verseTree.child[staff->GetN()].child[layer->GetN()].child[this->GetN()];
// Alternate solution with StaffN_LayerN_VerseN_t
//(*tree)[ staff->GetN() ][ layer->GetN() ][ this->GetN() ] = true;
return FUNCTOR_SIBLINGS;
}
示例8: PrepareProcessingLists
int Verse::PrepareProcessingLists(ArrayPtrVoid *params)
{
// param 0: the IntTree* for staff/layer/verse
// param 1: the IntTree* for staff/layer (unused)
IntTree *tree = static_cast<IntTree *>((*params).at(0));
// Alternate solution with StaffN_LayerN_VerseN_t
// StaffN_LayerN_VerseN_t *tree = static_cast<StaffN_LayerN_VerseN_t*>((*params).at(0));
Staff *staff = dynamic_cast<Staff *>(this->GetFirstParent(STAFF));
Layer *layer = dynamic_cast<Layer *>(this->GetFirstParent(LAYER));
assert(staff && layer);
tree->child[staff->GetN()].child[layer->GetN()].child[this->GetN()];
// Alternate solution with StaffN_LayerN_VerseN_t
//(*tree)[ staff->GetN() ][ layer->GetN() ][ this->GetN() ] = true;
return FUNCTOR_SIBLINGS;
}
示例9: AlignHorizontallyEnd
int Layer::AlignHorizontallyEnd(FunctorParams *functorParams)
{
AlignHorizontallyParams *params = dynamic_cast<AlignHorizontallyParams *>(functorParams);
assert(params);
params->m_scoreDefRole = SCOREDEF_CAUTIONARY;
params->m_time = params->m_measureAligner->GetMaxTime();
if (this->GetCautionStaffDefClef()) {
GetCautionStaffDefClef()->AlignHorizontally(params);
}
if (this->GetCautionStaffDefKeySig()) {
GetCautionStaffDefKeySig()->AlignHorizontally(params);
}
if (this->GetCautionStaffDefMensur()) {
GetCautionStaffDefMensur()->AlignHorizontally(params);
}
if (this->GetCautionStaffDefMeterSig()) {
GetCautionStaffDefMeterSig()->AlignHorizontally(params);
}
params->m_scoreDefRole = SCOREDEF_NONE;
Staff *staff = dynamic_cast<Staff *>(this->GetFirstParent(STAFF));
assert(staff);
int graceAlignerId = params->m_doc->GetOptions()->m_graceRhythmAlign.GetValue() ? 0 : staff->GetN();
int i;
for (i = 0; i < params->m_measureAligner->GetChildCount(); ++i) {
Alignment *alignment = dynamic_cast<Alignment *>(params->m_measureAligner->GetChild(i));
assert(alignment);
if (alignment->HasGraceAligner(graceAlignerId)) {
alignment->GetGraceAligner(graceAlignerId)->AlignStack();
}
}
return FUNCTOR_CONTINUE;
}
示例10: SetCurrentScoreDef
int Object::SetCurrentScoreDef( ArrayPtrVoid params )
{
// param 0: the current scoreDef
ScoreDef *currentScoreDef = static_cast<ScoreDef*>(params[0]);
StaffDef **currentStaffDef = static_cast<StaffDef**>(params[1]);
assert( currentScoreDef );
// starting a new page
Page *page = dynamic_cast<Page*>(this);
if ( page ) {
if ( page->m_parent->GetChildIndex( page ) == 0 ) {
currentScoreDef->SetRedrawFlags( true, true, true, true );
currentScoreDef->SetDrawLabels( true );
}
else {
currentScoreDef->SetRedrawFlags( true, true, false, false );
currentScoreDef->SetDrawLabels( false );
}
page->m_drawingScoreDef = *currentScoreDef;
return FUNCTOR_CONTINUE;
}
// starting a new system
System *system = dynamic_cast<System*>(this);
if ( system ) {
currentScoreDef->SetRedrawFlags( true, true, false, false );
return FUNCTOR_CONTINUE;
}
// starting a new scoreDef
ScoreDef *scoreDef= dynamic_cast<ScoreDef*>(this);
if ( scoreDef ) {
bool drawClef = false;
bool drawKeySig = false;
bool drawMensur = false;
bool drawMeterSig = false;
if (scoreDef->GetClef()) {
currentScoreDef->ReplaceClef(scoreDef->GetClef());
drawClef = true;
}
if (scoreDef->GetKeySig()) {
currentScoreDef->ReplaceKeySig(scoreDef->GetKeySig());
drawKeySig = true;
}
if (scoreDef->GetMensur()) {
currentScoreDef->ReplaceMensur(scoreDef->GetMensur());
drawMensur = true;
}
if (scoreDef->GetMeterSig()) {
currentScoreDef->ReplaceMeterSig(scoreDef->GetMeterSig());
drawMeterSig = true;
}
// Replace the current scoreDef with the new one, including its content (staffDef)
currentScoreDef->Replace(scoreDef);
currentScoreDef->SetRedrawFlags( drawClef, drawKeySig, drawMensur, drawMeterSig );
return FUNCTOR_CONTINUE;
}
// starting a new staffDef
// Because staffDef have to be included in a scoreDef, a new staffDef was already
// replaced by the new scoreDef (see above). Here we only need to reset the drawing flags
StaffDef *staffDef= dynamic_cast<StaffDef*>(this);
if ( staffDef ) {
StaffDef *tmpStaffDef = currentScoreDef->GetStaffDef( staffDef->GetN() );
if (staffDef->GetClef()) {
tmpStaffDef->SetDrawClef( true );
}
if (staffDef->GetKeySig()) {
tmpStaffDef->SetDrawKeySig( true );
}
if (staffDef->GetMensur()) {
tmpStaffDef->SetDrawMensur( true );
}
if (staffDef->GetMeterSig()) {
tmpStaffDef->SetDrawMeterSig( true );
}
}
// starting a new staff
Staff *staff = dynamic_cast<Staff*>(this);
if ( staff ) {
(*currentStaffDef) = currentScoreDef->GetStaffDef( staff->GetN() );
return FUNCTOR_CONTINUE;
}
// starting a new layer
Layer *layer = dynamic_cast<Layer*>(this);
if ( layer ) {
// setting the layer stem direction. Alternatively, this could be done in
// View::DrawLayer. If this (and other things) is kept here, renaming the method to something more
// generic (PrepareDrawing?) might be a good idea...
if (layer->m_parent->GetChildCount() > 1) {
if (layer->m_parent->GetChildIndex(layer)==0) {
layer->SetDrawingStemDir(STEMDIRECTION_up);
}
else {
layer->SetDrawingStemDir(STEMDIRECTION_down);
//.........这里部分代码省略.........