当前位置: 首页>>代码示例>>C++>>正文


C++ Fixture::address方法代码示例

本文整理汇总了C++中Fixture::address方法的典型用法代码示例。如果您正苦于以下问题:C++ Fixture::address方法的具体用法?C++ Fixture::address怎么用?C++ Fixture::address使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fixture的用法示例。


在下文中一共展示了Fixture::address方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: paintFixtureLabelAll

//
// Paint all visible fixture labels
//
void Monitor::paintFixtureLabelAll(QRegion region, int x_offset, int y_offset,
				   int unitW, int unitH, int unitsX)
{
	int x = 0;
	int y = 0;
	int w = 0;
	int wcur = 0;
	int h = 0;
	
	t_fixture_id id = KNoID;
	Fixture* fxi = NULL;
	
	// Draw fixture names and their channel spaces
	for (id = 0; id < KFixtureArraySize; id++)
	{
		fxi = _app->doc()->fixture(id);
		if (fxi == NULL) continue;
		if (fxi->universe() != m_universe) continue;
		
		// Calculate x and y positions for this fixture label
		x = ((fxi->address() % unitsX) * unitW);
		x += x_offset;
		
		y = static_cast<int> 
			(floor((fxi->address() / unitsX)) * (unitH * 3));
		y += y_offset;
		
		// Get width and height for this fixture label
		w = (fxi->channels() * unitW) - X_OFFSET;
		h = unitH;
			
		// Check if this label needs to be painted at all
		if (region.contains(QRect(x, y, w, h)) == false)
			continue;

		if ((x + w + X_OFFSET) <= width())
		{
			// The label fits to one line, just draw it
			paintFixtureLabel(x, y, w, h, fxi->name());
		}
		else
		{
			// The label needs to be drawn on at least two lines
			while (w > 0)
			{	
				wcur = MIN(w, (unitsX * unitW) - (x));
				
				// Draw the label
				paintFixtureLabel(x, y, wcur, h, fxi->name());
			
				// Calculate remaining width
				w = w - wcur - X_OFFSET;
				
				// Next line
				y += (unitH * 3);
				x = x_offset;
			}
		}
	}
}
开发者ID:speakman,项目名称:qlc,代码行数:63,代码来源:monitor.cpp

示例2: setPointPanTilt

void EFXFixture::setPointPanTilt(QList<Universe *> universes, float pan, float tilt)
{
    Fixture* fxi = doc()->fixture(head().fxi);
    Q_ASSERT(fxi != NULL);

    /* Write coarse point data to universes */
    if (fxi->panMsbChannel(head().head) != QLCChannel::invalid())
    {
        if (m_parent->isRelative())
            universes[fxi->universe()]->writeRelative(fxi->address() + fxi->panMsbChannel(head().head), static_cast<char>(pan));
        else
            universes[fxi->universe()]->write(fxi->address() + fxi->panMsbChannel(head().head), static_cast<char>(pan));
    }
    if (fxi->tiltMsbChannel(head().head) != QLCChannel::invalid())
    {
        if (m_parent->isRelative())
            universes[fxi->universe()]->writeRelative(fxi->address() + fxi->tiltMsbChannel(head().head), static_cast<char> (tilt));
        else
            universes[fxi->universe()]->write(fxi->address() + fxi->tiltMsbChannel(head().head), static_cast<char> (tilt));
    }

    /* Write fine point data to universes if applicable */
    if (fxi->panLsbChannel(head().head) != QLCChannel::invalid())
    {
        /* Leave only the fraction */
        char value = static_cast<char> ((pan - floor(pan)) * double(UCHAR_MAX));
        if (m_parent->isRelative())
            universes[fxi->universe()]->writeRelative(fxi->address() + fxi->panLsbChannel(head().head), value);
        else
            universes[fxi->universe()]->write(fxi->address() + fxi->panLsbChannel(head().head), value);
    }

    if (fxi->tiltLsbChannel(head().head) != QLCChannel::invalid())
    {
        /* Leave only the fraction */
        char value = static_cast<char> ((tilt - floor(tilt)) * double(UCHAR_MAX));
        if (m_parent->isRelative())
            universes[fxi->universe()]->writeRelative(fxi->address() + fxi->tiltLsbChannel(head().head), value);
        else
            universes[fxi->universe()]->write(fxi->address() + fxi->tiltLsbChannel(head().head), value);
    }
}
开发者ID:stev96,项目名称:qlcplus,代码行数:42,代码来源:efxfixture.cpp

示例3: writeUniverse

void MonitorGraphicsView::writeUniverse(int index, const QByteArray &ua)
{
    QHashIterator <quint32, MonitorFixtureItem*> it(m_fixtures);
    while (it.hasNext() == true)
    {
        it.next();
        quint32 fid = it.key();
        Fixture *fxi = m_doc->fixture(fid);
        // preliminary validity checks
        if (fxi == NULL ||
            fxi->universe() != (quint32)index ||
            fxi->address() > (quint32)ua.size())
        {
            continue;
        }

        MonitorFixtureItem *item = it.value();
        item->updateValues(ua);
    }
}
开发者ID:Jeija,项目名称:qlcplus,代码行数:20,代码来源:monitorgraphicsview.cpp

示例4: loader

void Fixture_Test::loader()
{
    QBuffer buffer;
    buffer.open(QIODevice::WriteOnly | QIODevice::Text);
    QXmlStreamWriter xmlWriter(&buffer);

    xmlWriter.writeStartElement("Fixture");

    xmlWriter.writeTextElement("Channels", "18");
    xmlWriter.writeTextElement("Name", "Foobar");
    xmlWriter.writeTextElement("Universe", "3");
    xmlWriter.writeTextElement("Model", "Foobar");
    xmlWriter.writeTextElement("Mode", "Foobar");
    xmlWriter.writeTextElement("Manufacturer", "Foobar");
    xmlWriter.writeTextElement("ID", "42");
    xmlWriter.writeTextElement("Address", "21");

    xmlWriter.writeEndDocument();
    xmlWriter.setDevice(NULL);
    buffer.close();

    buffer.open(QIODevice::ReadOnly | QIODevice::Text);
    QXmlStreamReader xmlReader(&buffer);
    xmlReader.readNextStartElement();

    QVERIFY(m_doc != NULL);
    QVERIFY(m_doc->fixtures().size() == 0);

    QVERIFY(Fixture::loader(xmlReader, m_doc) == true);
    QVERIFY(m_doc->fixtures().size() == 1);
    QVERIFY(m_doc->fixture(0) == NULL); // No ID auto-assignment

    Fixture* fxi = m_doc->fixture(42);
    QVERIFY(fxi != NULL);
    QVERIFY(fxi->name() == "Foobar");
    QVERIFY(fxi->channels() == 18);
    QVERIFY(fxi->address() == 21);
    QVERIFY(fxi->universe() == 3);
    QVERIFY(fxi->fixtureDef() != NULL);
    QVERIFY(fxi->fixtureMode() != NULL);
}
开发者ID:PML369,项目名称:qlcplus,代码行数:41,代码来源:fixture_test.cpp

示例5: slotChannelStyleChanged

void MonitorFixture::slotChannelStyleChanged(Monitor::ChannelStyle style)
{
    QString str;
    int i = 0;

    m_channelStyle = style;

    /* Check that this MonitorFixture represents a fixture */
    if (m_fixture == Fixture::invalidId())
        return;

    Fixture* fxi = m_doc->fixture(m_fixture);
    Q_ASSERT(fxi != NULL);

    /* Start channel numbering from this fixture's address */
    if (style == Monitor::DMXChannels)
        i = fxi->address() + 1;
    else
        i = 1;

    QListIterator <QLabel*> it(m_channelLabels);
    while (it.hasNext() == true)
        it.next()->setText(str.sprintf("<B>%.3d</B>", i++));
}
开发者ID:OnceBe,项目名称:qlcplus,代码行数:24,代码来源:monitorfixture.cpp

示例6: channelValueStyles

void MonitorFixture_Test::channelValueStyles()
{
    QWidget w;

    Fixture* fxi = new Fixture(m_doc);
    fxi->setChannels(6);
    fxi->setAddress(10);
    fxi->setName("Foobar");
    m_doc->addFixture(fxi);
    QVERIFY(fxi->id() != Fixture::invalidId());

    MonitorFixture mof(&w, m_doc);
    mof.setFixture(fxi->id());

    mof.updateLabelStyles();
    for (int i = 0; i < mof.m_channelLabels.size(); i++)
    {
        QString str;
        QVERIFY(mof.m_channelLabels[i] != NULL);
        QCOMPARE(mof.m_channelLabels[i]->text(), str.sprintf("<B>%.3d</B>", i + fxi->address() + 1));

        QVERIFY(mof.m_valueLabels[i] != NULL);
        QCOMPARE(mof.m_valueLabels[i]->text(), QString("000"));
    }

    mof.slotChannelStyleChanged(Monitor::RelativeChannels);
    mof.updateLabelStyles();
    for (int i = 0; i < mof.m_channelLabels.size(); i++)
    {
        QString str;
        QVERIFY(mof.m_channelLabels[i] != NULL);
        QCOMPARE(mof.m_channelLabels[i]->text(), str.sprintf("<B>%.3d</B>", i + 1));

        QVERIFY(mof.m_valueLabels[i] != NULL);
        QCOMPARE(mof.m_valueLabels[i]->text(), QString("000"));
    }

    mof.slotChannelStyleChanged(Monitor::DMXChannels);
    for (int i = 0; i < mof.m_channelLabels.size(); i++)
    {
        QString str;
        QVERIFY(mof.m_channelLabels[i] != NULL);
        QCOMPARE(mof.m_channelLabels[i]->text(), str.sprintf("<B>%.3d</B>", i + fxi->address() + 1));

        QVERIFY(mof.m_valueLabels[i] != NULL);
        QCOMPARE(mof.m_valueLabels[i]->text(), QString("000"));
    }

    for (int i = 0; i < mof.m_valueLabels.size(); i++)
    {
        QString str;
        mof.m_valueLabels[i]->setText(str.sprintf("%.3d", (i + 1) * 10));
    }

    mof.slotValueStyleChanged(Monitor::PercentageValues);
    for (int i = 0; i < mof.m_channelLabels.size(); i++)
    {
        QString str;
        QVERIFY(mof.m_channelLabels[i] != NULL);
        QCOMPARE(mof.m_channelLabels[i]->text(), str.sprintf("<B>%.3d</B>", i + fxi->address() + 1));

        QVERIFY(mof.m_valueLabels[i] != NULL);
        QCOMPARE(mof.m_valueLabels[i]->text(), str.sprintf("%.3d", (int) ceil(SCALE(qreal((i + 1) * 10), 
                                                                                    qreal(0), qreal(UCHAR_MAX), 
                                                                                    qreal(0), qreal(100)))));
    }
}
开发者ID:CCLinck21,项目名称:qlcplus,代码行数:67,代码来源:monitorfixture_test.cpp

示例7: handleSetFixture

QString Script::handleSetFixture(const QList<QStringList>& tokens, QList<Universe *> universes)
{
    qDebug() << Q_FUNC_INFO;

    if (tokens.size() > 4)
        return QString("Too many arguments");

    bool ok = false;
    quint32 id = 0;
    quint32 ch = 0;
    uchar value = 0;
    double time = 0;

    id = tokens[0][1].toUInt(&ok);
    if (ok == false)
        return QString("Invalid fixture (ID: %1)").arg(tokens[0][1]);

    for (int i = 1; i < tokens.size(); i++)
    {
        QStringList list = tokens[i];
        list[0] = list[0].toLower().trimmed();
        if (list.size() == 2)
        {
            ok = false;
            if (list[0] == "val" || list[0] == "value")
                value = uchar(list[1].toUInt(&ok));
            else if (list[0] == "ch" || list[0] == "channel")
                ch = list[1].toUInt(&ok);
            else if (list[0] == "time")
                time = list[1].toDouble(&ok);
            else
                return QString("Unrecognized keyword: %1").arg(list[0]);

            if (ok == false)
                return QString("Invalid value (%1) for keyword: %2").arg(list[1]).arg(list[0]);
        }
    }

    Doc* doc = qobject_cast<Doc*> (parent());
    Q_ASSERT(doc != NULL);

    Fixture* fxi = doc->fixture(id);
    if (fxi != NULL)
    {
        if (ch < fxi->channels())
        {
            int address = fxi->address() + ch;
            if (address < 512)
            {
                GenericFader* gf = fader();
                Q_ASSERT(gf != NULL);

                FadeChannel fc;
                fc.setFixture(doc, fxi->id());
                fc.setChannel(ch);
                fc.setTarget(value);
                fc.setFadeTime(time);

                // If the script has used the channel previously, it might still be in
                // the bowels of GenericFader so get the starting value from there.
                // Otherwise get it from universes (HTP channels are always 0 then).
                quint32 uni = fc.universe();
                if (gf->channels().contains(fc) == true)
                    fc.setStart(gf->channels()[fc].current());
                else
                    fc.setStart(universes[uni]->preGMValue(address));
                fc.setCurrent(fc.start());

                gf->add(fc);

                return QString();
            }
            else
            {
                return QString("Invalid address: %1").arg(address);
            }
        }
        else
        {
            return QString("Fixture (%1) has no channel number %2").arg(fxi->name()).arg(ch);
        }
    }
    else
    {
        return QString("No such fixture (ID: %1)").arg(id);
    }
}
开发者ID:Babbsdrebbler,项目名称:qlcplus,代码行数:87,代码来源:script.cpp


注:本文中的Fixture::address方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。