コード例 #1
0
void
BCI2000Viewer::UpdateChannelLabels()
{
  if( mFile.IsOpen() )
  {
    vector<string> signalLabels;
    if( mFile.Parameters()->Exists( "ChannelNames" ) )
    {
      ParamRef labelParam = mFile.Parameter( "ChannelNames" );
      for( int k = 0; k < labelParam->NumValues(); ++k )
        signalLabels.push_back( labelParam( k ) );
    }
    for( int i = static_cast<int>( signalLabels.size() ); i < mFile.SignalProperties().Channels(); ++i )
    {
      ostringstream oss;
      oss << i + 1;
      signalLabels.push_back( oss.str() );
    }

    LabelList channelLabels;
    int numMarkerChannels = 0;
    int j = 1;
    while( j < ui->channelList->count()
           && ( ui->channelList->item( j )->flags() & Qt::ItemIsUserCheckable ) )
      ++j;
    int chBase = ++j;
    for( ; j < ui->channelList->count()
           && ( ui->channelList->item( j )->flags() & Qt::ItemIsUserCheckable ); ++j )
      if( ui->channelList->item( j )->checkState() == Qt::Checked )
        channelLabels.push_back(
          Label(
            static_cast<int>( channelLabels.size() ),
            signalLabels[ j - chBase ]
          )
        );
    for( int i = 1; i < ui->channelList->count()
                    && ( ui->channelList->item( i )->flags() & Qt::ItemIsUserCheckable ); ++i )
      if( ui->channelList->item( i )->checkState() == Qt::Checked )
      {
        channelLabels.push_back(
          Label(
            static_cast<int>( channelLabels.size() ),
            ui->channelList->item( i )->text().toLocal8Bit().constData()
          )
        );
        ++numMarkerChannels;
      }
    mNumSignalChannels = static_cast<int>( channelLabels.size() ) - numMarkerChannels;
    ui->signalDisplay->Display().SetNumMarkerChannels( numMarkerChannels )
                                .SetChannelLabels( channelLabels )
                                .SetChannelLabelsVisible( true );
  }
  else
  {
    mNumSignalChannels = 0;
    ui->signalDisplay->Display().SetNumMarkerChannels( 0 )
                                .SetChannelLabels( LabelList() );
  }
}
コード例 #2
0
ファイル: mmSceneApp.cpp プロジェクト: frantic0/MotionMachine
void MoMa::SceneApp::draw( LabelList labelList ) {

    for( int l=0; l<labelList.size(); l++ ) {

        ofPushStyle();

        float labelHue = ofGetStyle().color.getHue();

        if( labelList[l].state == UNSELECTED ) {

            ofColor unselected; unselected.setHsb( labelHue, 128, 255 );
            ofSetColor( unselected, 180 ); ofSetLineWidth( 1.2 );

        } else if ( labelList[l].state == HOVERED ) {

            ofColor hovered; hovered.setHsb( labelHue, 180, 255 );
            ofSetColor( hovered, 180 ); ofSetLineWidth( 3 );

        } else if (labelList[l].state == SELECTED) {

            ofColor selected; selected.setHsb( labelHue, 240, 255 );
            ofSetColor( selected, 200 ); ofSetLineWidth( 3 );
        }

        float labPos = ofMap( labelList[l].idx, idxMin, idxMax, 0, ofGetWidth() );
        ofLine( labPos, 0, labPos, ofGetHeight() ); // We draw labels line & names
        ofDrawBitmapString( labelList[l].name, labPos+6, 14 );

        ofPopStyle();
    }
}
コード例 #3
0
ファイル: offlinejob.cpp プロジェクト: snakamura/q3
std::auto_ptr<OfflineJob> qmimap4::SetLabelOfflineJob::create(InputStream* pStream)
{
	wstring_ptr wstrFolder;
	READ_STRING(WSTRING, wstrFolder);
	if (!wstrFolder.get())
		return std::auto_ptr<OfflineJob>(0);
	
	unsigned int nSize = 0;
	READ(&nSize, sizeof(nSize));
	if (nSize == 0)
		return std::auto_ptr<OfflineJob>(0);
	UidList listUid;
	listUid.resize(nSize);
	READ(&listUid[0], nSize*sizeof(UidList::value_type));
	
	wstring_ptr wstrLabel;
	READ_STRING(WSTRING, wstrLabel);
	
	unsigned int nLabelSize = 0;
	READ(&nLabelSize, sizeof(nLabelSize));
	LabelList listLabel;
	listLabel.reserve(nLabelSize);
	CONTAINER_DELETER(free, listLabel, &freeWString);
	for (unsigned int n = 0; n < nLabelSize; ++n) {
		wstring_ptr wstrLabel;
		READ_STRING(WSTRING, wstrLabel);
		listLabel.push_back(wstrLabel.release());
	}
	
	return std::auto_ptr<OfflineJob>(new SetLabelOfflineJob(wstrFolder.get(), listUid,
		wstrLabel.get(), const_cast<const WCHAR**>(&listLabel[0]), listLabel.size()));
}
コード例 #4
0
ファイル: starcomponent.cpp プロジェクト: Bugsbane/kstars
void StarComponent::drawLabels()
{
    if( m_hideLabels )
        return;

    SkyLabeler *labeler = SkyLabeler::Instance();
    labeler->setPen( QColor( KStarsData::Instance()->colorScheme()->colorNamed( "SNameColor" ) ) );

    int max = int( m_zoomMagLimit * 10.0 );
    if ( max < 0 ) max = 0;
    if ( max > MAX_LINENUMBER_MAG ) max = MAX_LINENUMBER_MAG;

    for ( int i = 0; i <= max; i++ ) {
        LabelList* list = m_labelList[ i ];
        for ( int j = 0; j < list->size(); j++ ) {
            labeler->drawNameLabel( list->at(j).obj, list->at(j).o );
        }
        list->clear();
    }

}