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


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

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


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

示例1: init

// ----------------------------------------------------------------------------
//
void ActorSelectField::init( ActorPtrArray& actors, UIDArray& selected_actor_uids )
{
    if ( actors.size() == 0 )
        return;

    CString default_value;
    CString values;

    std::map<UID,CString> actor_to_id;

    for ( SceneActor * actor : actors ) {
        CString label;
        CString id;

        if ( actor->isGroup() ) {
            FixtureGroup* group = m_venue->getFixtureGroup( actor->getActorUID() );
            label.Format( "%s", group->getName() );
            id.Format( "G%lu", group->getNumber() );
        }
        else {
            Fixture* pf = m_venue->getFixture( actor->getActorUID() );
            label.Format( "%s @ %d", pf->getFullName(), pf->getAddress() );
            id.Format( "%lu", pf->getFixtureNumber() );
        }

        m_entries[ id ] = ActorSelectField::entry( id, label, *actor );
        actor_to_id[ actor->getActorUID() ] = id;

        if ( default_value.GetLength() == 0 )
            default_value = id;
    }

    // Preseve selected actor order
    for ( UID selected_uid : selected_actor_uids ) {
        std::map<UID,CString>::iterator it = actor_to_id.find( selected_uid );
        if ( it != actor_to_id.end() ) {
            if ( values.GetLength() != 0 )
                values += ",";
            values.Append( (*it).second );
        }
    }

    if ( values.GetLength() == 0 )
        setValue( default_value );
    else
        setValue( values );
}
开发者ID:sthdsnts,项目名称:DMXStudio,代码行数:49,代码来源:DMXTextForms.cpp

示例2: query_scenes

// ----------------------------------------------------------------------------
//
bool HttpRestServices::query_scenes( CString& response, LPCSTR data )
{
    if ( !studio.getVenue() || !studio.getVenue()->isRunning() )
        return false;

    JsonBuilder json( response );
    json.startArray();

    ScenePtrArray scenes = studio.getVenue()->getScenes();

    std::sort( scenes.begin(), scenes.end(), CompareObjectNumber );

    Scene* default_scene = studio.getVenue()->getDefaultScene();

    UID active_uid = studio.getVenue()->getCurrentSceneUID();

    for ( ScenePtrArray::iterator it=scenes.begin(); it != scenes.end(); it++ ) {
        Scene* scene = (*it);

        json.startObject();
        json.add( "id", scene->getUID() );
        json.add( "number", scene->getSceneNumber() );
        json.add( "name", scene->getName() );
        json.add( "bpm_rating", scene->getBPMRating() );
        json.add( "description", scene->getDescription() );
        json.add( "is_default", (scene == default_scene) );
        json.add( "is_running", (active_uid == scene->getUID()) );
        json.addArray<Acts>( "acts", scene->getActs() );

        json.startArray( "actors" );

        ActorPtrArray actors = scene->getActors();

        for ( ActorPtrArray::iterator it=actors.begin(); it != actors.end(); ++it ) {
            Fixture* fixture = NULL;

            json.startObject();
            json.add( "id", (*it)->getActorUID() );
            json.add( "is_group", (*it)->isGroup() );

            if ( (*it)->isGroup() ) {
                fixture = studio.getVenue()->getGroupRepresentative( (*it)->getActorUID() );
            }
            else {
                fixture = studio.getVenue()->getFixture( (*it)->getActorUID() );
                json.add( "address", (int)fixture->getAddress() );
            }

            json.startArray( "channels" );
            if ( fixture != NULL ) {
                for ( channel_t channel=0; channel < fixture->getNumChannels(); channel++ ) {
                    Channel* ch = fixture->getChannel( channel );
                    BYTE value = (*it)->getChannelValue( fixture->mapChannel( channel ) );
                    ChannelValueRange* range = ch->getRange( value );
                    LPCSTR range_name = range ? range->getName() : "";

                    json.startObject();
                    json.add( "channel", (int)channel );
                    json.add( "name", ch->getName() );
                    json.add( "value", value );
                    json.add( "range_name", range_name );
                    json.endObject();
                }
            }
            json.endArray( "channels" );

            json.endObject();
        }

        json.endArray( "actors" );

        json.startArray( "animations" );

        for ( size_t a=0; a < scene->getNumAnimations(); a++ ) {
            AbstractAnimation* animation = scene->getAnimation( a );

            json.startObject();
            json.add( "class_name", animation->getClassName() );
            json.add( "name", animation->getName() );
            json.add( "number", animation->getNumber() );
            json.addArray<UIDArray>( "actors", animation->getActors() );

            // Add common signal data
            AnimationSignal& signal = animation->signal();
            json.startObject( "signal" );
            json.add( "sample_rate_ms", signal.getSampleRateMS() );
            json.add( "input_type", signal.getInputType() );
            json.add( "input_low", signal.getInputLow() );
            json.add( "input_high", signal.getInputHigh() );
            json.add( "sample_decay_ms", signal.getSampleDecayMS() );
            json.add( "scale_factor", signal.getScaleFactor() );
            json.add( "max_threshold", signal.getMaxThreshold() );
            json.add( "apply_to", signal.getApplyTo() );
            json.endObject();

            // Add animation specific data
            CString json_anim_name = JsonObject::encodeJsonString( animation->getClassName() );
            json.startObject( json_anim_name );
//.........这里部分代码省略.........
开发者ID:sthdsnts,项目名称:DMXStudio,代码行数:101,代码来源:HttpRestScene.cpp


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