Beispiel #1
0
bool Stage2_IPF_Data::Save_Shares (PUMA_Data_Array *puma_ptr) 
{
	int cell, cells;
	double total, share;
	bool flag;

	//---- check the data record ----

	if (Num_Cells () == 0) return (false);

	//---- calculate the scaling factor ----

	cells = puma_ptr->Num_Cells ();
	total = 0.0;

	for (cell=1; cell <= cells; cell++) {
		total += Share (cell);
	}

	//---- copy the factored share to the zone record ----

	flag = (total != 0.0);
	if (!flag) share = 0.0;

	for (cell=1; cell <= cells; cell++) {
		if (flag) {
			share = Share (cell) / total;
		}
		puma_ptr->Zone_Share (cell, share);
	}
	return (true);
}
Beispiel #2
0
void MatchFactory::hash( Individual * i )
{
	int haps , het = i->numHet();
	
	if ( het == 0 || HAPLOID ) haps = 1;
	else haps = 2;

	if ( ALLOW_HOM && het <= WINDOWS_LIST.err_hom(position_ms) + WINDOWS_LIST.err_het(position_ms) ) 
		i->assertHomozygous();
	if ( HOM_ONLY ) 
		return;
	
	for ( int c = 0 ; c < haps ; c++ )
	{
		boost::dynamic_bitset<>& ms = i->getChromosome(c)->getMarkerSet()->getMarkerBits();
		if ( (iter = segments.find( ms )) == segments.end() )
		{
			segments.insert( make_pair ( ms , Share( i ) ) );
			mem_matchfactory+= sizeof(pair<boost::dynamic_bitset<>,Share>)
							+(ms.num_blocks()*sizeof(unsigned long))
							+sizeof(Share)
							+(3*sizeof(Individual*));
		}
		else
		{	
			iter->second.add( i );
			mem_matchfactory+= (3*sizeof(Individual*));
		}
	}
}
Beispiel #3
0
CString COXUNC::GetAbbreviation(int nMaxLength, BOOL bAtLeastFile /* = TRUE */) const
	// See also the MFC function AbbreviateName() in filelist.cpp
	{
	CString sUNC = Full();
	CString sServer;
	CString sShare;
	CString sDirectory;
	CString sFile;
	
	// If nMaxLength is more than enough to hold the full UNC name, we're done.
	// This is probably a pretty common case, so we'll put it first.
	if (sUNC.GetLength() <= nMaxLength)
		return Full();
	
	// If nMaxLength isn't enough to hold at least the filename, we're done
	sFile = File();
	if (nMaxLength < sFile.GetLength())
		{
		if (bAtLeastFile)
			return sFile;
		else
			return _T("");
		}
	
	// If nMaxLength isn't enough to hold at least <server><share>\...\<file>, the
	// result is the filename.
	sServer = Server();
	sShare = Share();
	sDirectory = Directory();
	CString sAbbr = PreferedSlash() + CString(_T("...")) + PreferedSlash();
	int nServerShareFileLength = sServer.GetLength() + sShare.GetLength() + sFile.GetLength();
	if (nMaxLength < nServerShareFileLength + sAbbr.GetLength())
		return sFile;
	
	// Now loop through the remaining directory components until something
	// of the form <server><share>\...\<one_or_more_dirs>\<file> fits.
	int nRemainingSpace = nMaxLength - nServerShareFileLength - sAbbr.GetLength();
	ASSERT(0 <= nRemainingSpace);
	LPCTSTR pszStartDirectory = (LPCTSTR)sDirectory;
	LPCTSTR pszSearchDirectory = pszStartDirectory + sDirectory.GetLength();
	LPCTSTR pszUsableDirectoryPart = pszSearchDirectory;
	// ... Add one to the remainings space for the directory
	//     bacause we are counting the number of characters in the directory
	//	   but we will remove its leading slash (so one extra character is allowed)
	nRemainingSpace++;
	while ((pszStartDirectory < pszSearchDirectory) && (0 < nRemainingSpace))
		{
		pszSearchDirectory--;
		nRemainingSpace--;
		if (_tcschr(m_pszSlashes, *pszSearchDirectory) != NULL) 
			// ... Do not include the leading slash
			pszUsableDirectoryPart = pszSearchDirectory + 1;
		}

	return sServer + sShare + sAbbr + pszUsableDirectoryPart + sFile;
	}
void CShareWin::Share(spSongInfoT song)
{
	ASSERT(song);
	CString stitle;
	stitle.Format(_T("%s-%s"),song->GetSongName(),song->GetArtistName());
	ui._title->SetText(stitle);
	ui._title->SetToolTip(stitle);

	Share(url::SOT_SONG,song->GetSongId(),stitle,NULL);
}
Beispiel #5
0
CString COXUNC::FileForm() const
	{
	CString sDir = Directory();
	CString sFile = File();
	if (sFile.IsEmpty() && (1 < sDir.GetLength()))
		{
		// ... Last character must be a slash
		ASSERT(_tcschr(m_pszSlashes, sDir[sDir.GetLength() - 1]) != NULL);
		// ... Remove it
		sDir = sDir.Left(sDir.GetLength() - 1);
		}
	CString sFileForm = Server() + Share() + sDir + sFile;
	return sFileForm;
	}
Beispiel #6
0
Veh_Distribution::Veh_Distribution (void)
{
	Type (0);
	Sub_Type (0);
	Share (0.0);
}
pascal	OSErr	FSpShare(const FSSpec *spec)
{
	return ( Share(spec->vRefNum, spec->parID, spec->name) );
}
TrackScreen::TrackScreen(QWidget *parent)
:QDialog(parent),
ReturnBtn(this),
m_ListBox(this, g_rectListBoxBase.x(), g_rectListBoxBase.y(), g_rectListBoxBase.width(), g_rectListBoxBase.height())
{
   setGeometry(0, 0, __nWidth__, __nHeight__);

// Load background image
    m_pImageBackground = GetImg(IMG_LIST_BK);

// Set Title Text
    m_pLabelTitle = new QLabel(this);
    QFont font(g_strTitleFontFamily, g_iTitleFontPointSize);
    font.setStyleStrategy(QFont::PreferAntialias);
    m_pLabelTitle->setFont(font);
    QPalette qPalette;
    qPalette.setColor( QPalette::Foreground, QColor( __TitleTextColor__ ) );
    m_pLabelTitle->setPalette( qPalette );
    m_pLabelTitle->setGeometry(g_rectTitle);
    m_pLabelTitle->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
    m_pLabelTitle->setText(g_strTitleTrack);

// Load Home button
    m_pPushButtonHome = new RtPushButton(this);
    m_pPushButtonHome->setGeometry(g_rectButtonHome);
    m_pImageHome[BUTTON_UP] = GetImg(IMG_BTN_HOME_UP);
    m_pImageHome[BUTTON_DOWN] = GetImg(IMG_BTN_HOME_DOWN);
    m_pPushButtonHome->SetImages(m_pImageHome[BUTTON_UP], m_pImageHome[BUTTON_DOWN]);
    connect(m_pPushButtonHome, SIGNAL(clicked()), this, SLOT(Home()));

// Load View On Map button
    m_pPushButtonView = new RtPushButton(this);
    m_pPushButtonView->setGeometry(g_rectButtonView);
    m_pImageMapView[BUTTON_UP] = GetImg(IMG_BTN_VIEWMAP_UP);
    m_pImageMapView[BUTTON_DOWN] = GetImg(IMG_BTN_VIEWMAP_DOWN);
    m_pPushButtonView->SetImages(m_pImageMapView[BUTTON_UP], m_pImageMapView[BUTTON_DOWN]);
    QString strViewText = QString("View On Map");
    QRect rectViewText = QRect(1,45,63,12);
    m_pPushButtonView->SetButtonText(strViewText,rectViewText);
    connect(m_pPushButtonView, SIGNAL(clicked()), this, SLOT(ViewOnMap()));

// Load Elevation button
    m_pPushButtonElevation = new RtPushButton(this);
    m_pPushButtonElevation->setGeometry(g_rectButtonElevation);
    m_pImageElevation[BUTTON_UP] = GetImg(IMG_BTN_ELEVATION_UP);
    m_pImageElevation[BUTTON_DOWN] = GetImg(IMG_BTN_ELEVATION_DOWN);
    m_pPushButtonElevation->SetImages(m_pImageElevation[BUTTON_UP], m_pImageElevation[BUTTON_DOWN]);
    QString strElevationText = QString("Elev. Plot");
    QRect rectElevationText(1,45,63,12);
    m_pPushButtonElevation->SetButtonText(strElevationText,rectElevationText);
    connect(m_pPushButtonElevation, SIGNAL(clicked()), this, SLOT(Elevation()));

// Load Edit button
    m_pPushButtonEdit = new RtPushButton(this);
    m_pPushButtonEdit->setGeometry(g_rectButtonEdit);
    m_pImageEdit[BUTTON_UP] = GetImg(IMG_BTN_EDIT_UP);
    m_pImageEdit[BUTTON_DOWN] = GetImg(IMG_BTN_EDIT_DOWN);
    m_pPushButtonEdit->SetImages(m_pImageEdit[BUTTON_UP], m_pImageEdit[BUTTON_DOWN]);
    QString strEditText = QString("Edit");
    QRect rectEditText = QRect(1,45,63,12);
    m_pPushButtonEdit->SetButtonText(strEditText,rectEditText);
    connect(m_pPushButtonEdit, SIGNAL(clicked()), this, SLOT(Edit()));

// Load Share button
    m_pPushButtonShare = new RtPushButton(this);
    m_pPushButtonShare->setGeometry(g_rectButtonShare);
    m_pImageShare[BUTTON_UP] = GetImg(IMG_BTN_SHARE_UP);
    m_pImageShare[BUTTON_DOWN] = GetImg(IMG_BTN_SHARE_DOWN);
    m_pPushButtonShare->SetImages(m_pImageShare[BUTTON_UP], m_pImageShare[BUTTON_DOWN]);
    QString strShareText = QString("Share");
    QRect rectShareText = QRect(1,45,63,12);
    m_pPushButtonShare->SetButtonText(strShareText,rectShareText);
    connect(m_pPushButtonShare, SIGNAL(clicked()), this, SLOT(Share()));

    m_iSelect = -1;

// Load ListBox
    connect(&m_ListBox, SIGNAL(ButtonSelect(int)), this, SLOT(ListSelect(int)));
    connect(&m_ListBox, SIGNAL(ButtonScroll()), this, SLOT(ListScroll(void)));

/*
    for(int j=0;j<LIST_ICON_NUM;j++)
        m_pImageIcons[j] = GetImg((IMG_ID)(IMG_TRACK_LIST_ICON1+j));
*/
	EnableFunctionButton(false);

	//delay display content for better user experence
	m_pListTimer = new QTimer(this);
	connect(m_pListTimer, SIGNAL(timeout()), this, SLOT(UpdateListbox()));
	m_pListTimer->start(200);
}