本文整理汇总了C++中Part类的典型用法代码示例。如果您正苦于以下问题:C++ Part类的具体用法?C++ Part怎么用?C++ Part使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Part类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: throw
Sink&
Sink::operator<< (const RawMessage& m)
throw (ZmqErrorType)
{
if (m.deleter)
{
Part part(m.data.ptr, m.sz, m.deleter, m.hint);
send_owned(part);
}
else
{
Part part;
init_msg(m.data.cptr, m.sz, part.msg());
send_owned(part);
}
return *this;
}
示例2: startUndo
void Song::cmdGluePart(Track* track, Part* oPart)
{
PartList* pl = track->parts();
Part* nextPart = 0;
for (iPart ip = pl->begin(); ip != pl->end(); ++ip)
{
if (ip->second == oPart)
{
++ip;
if (ip == pl->end())
return;
nextPart = ip->second;
break;
}
}
Part* nPart = track->newPart(oPart);
nPart->setLenTick(nextPart->tick() + nextPart->lenTick() - oPart->tick());
// populate nPart with Events from oPart and nextPart
EventList* sl1 = oPart->events();
EventList* dl = nPart->events();
for (iEvent ie = sl1->begin(); ie != sl1->end(); ++ie)
dl->add(ie->second);
EventList* sl2 = nextPart->events();
//int frameOffset = nextPart->frame() - oPart->frame();
//for (iEvent ie = sl2->begin(); ie != sl2->end(); ++ie) {
// Event event = ie->second.clone();
// event.setFrame(event.frame() + frameOffset);
// dl->add(event);
// }
// p3.3.54 Changed.
{
int tickOffset = nextPart->tick() - oPart->tick();
for (iEvent ie = sl2->begin(); ie != sl2->end(); ++ie)
{
Event event = ie->second.clone();
event.setTick(event.tick() + tickOffset);
dl->add(event);
}
}
startUndo();
audio->msgRemovePart(nextPart, false);
// Indicate no undo, and do port controller values but not clone parts.
//audio->msgChangePart(oPart, nPart, false);
audio->msgChangePart(oPart, nPart, false, true, false);
endUndo(SC_PART_MODIFIED | SC_PART_REMOVED);
}
示例3: int
void TestScene::CreateOnionSkins()
{
// current part
Part *editPart = ¤tAnimation->parts[selectedPartIndex];
if (editPart)
{
Entity *editEntity = editPart->entity;
Sprite *editSprite = editPart->sprite;
int currentFrame = int(animationFrame);
const int numFramesToPreview = 5;
for (int i = 0; i < numFramesToPreview; i++)
{
int prevFrame = SafeFrameRange(currentFrame - i);
int nextFrame = SafeFrameRange(currentFrame + i);
const float dyeP = 0.25f;
if (prevFrame != currentFrame)
{
Entity *entity = editPart->CreateEntity(textureSheet);
eAnimation->Add(entity);
editPart->ApplyFrameToEntity(prevFrame, entity);
onionSkins.push_back(entity);
float oldA = entity->color.a;
entity->color = entity->color * (1.0f-dyeP) + Color::blue * dyeP;
entity->color.a = oldA * (0.25f - 0.05f*i);
}
if (nextFrame != currentFrame)
{
// spawn part at next frame
Entity *entity = editPart->CreateEntity(textureSheet);
eAnimation->Add(entity);
editPart->ApplyFrameToEntity(nextFrame, entity);
onionSkins.push_back(entity);
float oldA = entity->color.a;
entity->color = entity->color * (1.0f-dyeP) + Color::red * dyeP;
entity->color.a = oldA * (0.25f - 0.05f*i);
}
}
}
}
示例4: set_clear
static bool set_clear(const char *pname, const char **args) {
Part *part = get_part(pname);
if(part && args[0]) {
bool enable;
if(!strcmp(args[0], "true")) {
enable = true;
} else if(!strcmp(args[0], "false")) {
enable = false;
} else {
return false;
}
info("set_clear(%s, %s)", pname, enable ? "true" : "false");
part->set_clear(enable);
return true;
}
return false;
}
示例5: get_part_and_all_subsets
void get_part_and_all_subsets(const Part& part, ConstPartVector& part_and_all_subsets)
{
insert(part_and_all_subsets, part);
const PartVector& subsets = part.subsets();
for(size_t i=0; i<subsets.size(); ++i) {
get_part_and_all_subsets(*subsets[i], part_and_all_subsets);
}
}
示例6: catch
void PartController::Edit(const int partId, QWidget *caller)
{
Part part;
try { Databases::parts().findRecord("id", partId); }
catch (const std::exception &e)
{
showErrorDialog(e.what());
return;
}
if (part.null())
{
showErrorDialog(("Part with ID " + toString(partId) + " could not be found").c_str());
return;
}
Edit(part, caller);
}
示例7: Output
void Chain::Output (ostream& os) const
{
os << "\n5' ---- ";
int numP = listOfParts.size ();
for (int cnt =0; cnt < numP; cnt++)
{
Part* p = listOfParts[cnt];
os << "\n " << p->getPartRef ();
if (p->isBinded) os << "*";
os << "(" << p->getPartType ()
<< "," << p->getPartLabel ()
<< ") " ;
}
os << "\n---- 3'";
}
示例8: testNoteAccidentals
void testNoteAccidentals()
{
Sheet* sheet = new Sheet();
Bar* bar = sheet->addBar();
Part* part = sheet->addPart("part");
Voice* voice = part->addVoice();
Staff* staff = part->addStaff();
VoiceBar* vb = bar->voice(voice);
for (int a = -2; a <= 2; a++) {
Chord* c = new Chord(QuarterNote);
c->addNote(staff, 0, a);
vb->addElement(c);
}
validateOutput(sheet, "noteaccidentals.xml");
delete sheet;
}
示例9: testNotePitch
void testNotePitch()
{
Sheet* sheet = new Sheet();
Bar* bar = sheet->addBar();
Part* part = sheet->addPart("part");
Voice* voice = part->addVoice();
Staff* staff = part->addStaff();
VoiceBar* vb = bar->voice(voice);
for (int p = -20; p <= 20; p++) {
Chord* c = new Chord(QuarterNote);
c->addNote(staff, p);
vb->addElement(c);
}
validateOutput(sheet, "notepitch.xml");
delete sheet;
}
示例10: ChangePart
void MixerDetails::partNameChanged()
{
if (!_mti)
return;
QString text = partNameLineEdit->text();
Part* part = _mti->part();
if (part->partName() == text) {
return;
}
Score* score = part->score();
if (score) {
score->startCmd();
score->undo(new ChangePart(part, part->instrument(), text));
score->endCmd();
}
}
示例11: CVF_ASSERT
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void QSRSnippetWidget::showModelStatistics()
{
RenderSequence* renderSeq = m_snippet->renderSequence();
CVF_ASSERT(renderSeq);
size_t totPartCount = 0;
size_t totFaceCount = 0;
int numRenderings = renderSeq->renderingCount();
int ir;
for (ir = 0; ir < numRenderings; ir++)
{
Rendering* rendering = renderSeq->rendering(ir);
CVF_ASSERT(rendering);
Scene* scene = rendering->scene();
CVF_ASSERT(scene);
int numModels = scene->modelCount();
int im;
for (im = 0; im < numModels; im++)
{
Model* model = scene->model(im);
Collection<Part> allParts;
model->allParts(&allParts);
size_t numParts = allParts.size();
size_t ip;
for (ip = 0; ip < numParts; ip++)
{
Part* part = allParts[ip].p();
Drawable* drawable = part->drawable();
totPartCount++;
totFaceCount += drawable->faceCount();
}
}
}
cvf::Trace::show("Total number of parts: %ld", totPartCount);
cvf::Trace::show("Total number of faces: %ld", totFaceCount);
}
示例12: setVoiceMute
void MixerDetails::setVoiceMute(int staffIdx, int voice, bool shouldMute)
{
Part* part = _mti->part();
Staff* staff = part->staff(staffIdx);
switch (voice) {
case 0:
staff->undoChangeProperty(Pid::PLAYBACK_VOICE1, !shouldMute);
break;
case 1:
staff->undoChangeProperty(Pid::PLAYBACK_VOICE2, !shouldMute);
break;
case 2:
staff->undoChangeProperty(Pid::PLAYBACK_VOICE3, !shouldMute);
break;
case 3:
staff->undoChangeProperty(Pid::PLAYBACK_VOICE4, !shouldMute);
break;
}
}
示例13: movePartsTotheRight
Undo movePartsTotheRight(unsigned int startTicks, int moveTicks, bool only_selected, set<Track*>* tracklist)
{
if (moveTicks<=0)
return Undo();
Undo operations;
TrackList* tracks = MusEGlobal::song->tracks();
for (iTrack it = tracks->begin(); it != tracks->end(); ++it) {
Track* track = *it;
if ( (track == 0) ||
(only_selected && !track->selected()) ||
(tracklist && tracklist->find(track)==tracklist->end()) )
continue;
PartList* pl = track->parts();
for (riPart p = pl->rbegin(); p != pl->rend(); ++p) {
Part* part = p->second;
unsigned t = part->tick();
int l = part->lenTick();
if (t + l <= startTicks)
continue;
if (startTicks > t && startTicks < (t+l)) {
// split part to insert new space
Part* p1;
Part* p2;
part->splitPart(startTicks, p1, p2);
p2->setTick(startTicks+moveTicks);
MusEGlobal::song->informAboutNewParts(part,p1,p2);
operations.push_back(UndoOp(UndoOp::DeletePart, part));
operations.push_back(UndoOp(UndoOp::AddPart, p1));
operations.push_back(UndoOp(UndoOp::AddPart, p2));
}
else if (t >= startTicks) {
operations.push_back(UndoOp(UndoOp::ModifyPartTick, part, part->tick(), t + moveTicks));
}
}
}
adjustGlobalLists(operations, startTicks, moveTicks);
return operations;
}
示例14: Part
bool PartController::Destroy(Part &part, QWidget *caller)
{
if (Destroy(part.getId(), caller))
{
part = Part();
return true;
}
return false;
}
示例15: member
bool Bucket::member( const Part & part ) const
{
const unsigned * const i_beg = key() + 1 ;
const unsigned * const i_end = key() + key()[0] ;
const unsigned ord = part.mesh_meta_data_ordinal();
const unsigned * const i = std::lower_bound( i_beg , i_end , ord );
return i_end != i && ord == *i ;
}