本文整理汇总了C++中GetRow函数的典型用法代码示例。如果您正苦于以下问题:C++ GetRow函数的具体用法?C++ GetRow怎么用?C++ GetRow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetRow函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetRow
Screen* ScreenMgr::getScreen(ResourceID id){
uint32_t row = GetRow(id);
uint32_t col = GetCol(id);
if ( row-1 >=0 && col-1 >=0 && row -1 < getRowCount() && col -1 < getColCount()){
return screens_[GetRow(id)-1][GetCol(id)-1];
}else return 0;
}
示例2: drawXFormPixelWithAlpha
void drawXFormPixelWithAlpha(const uint32_t i, const uint32_t j,
const GRect &srcRect, const GIRect &dstRect,
const GBitmap &src, const GBitmap &dst,
const uint8_t alpha,
const BlendFunc blend = blend_srcover) {
GVec3f ctxPt(static_cast<float>(dstRect.fLeft + i) + 0.5f,
static_cast<float>(dstRect.fTop + j) + 0.5f,
1.0f);
ctxPt = m_CTMInv * ctxPt;
if(ContainsPoint(srcRect, ctxPt[0], ctxPt[1])) {
uint32_t x = static_cast<uint32_t>(ctxPt[0] - srcRect.fLeft);
uint32_t y = static_cast<uint32_t>(ctxPt[1] - srcRect.fTop);
GPixel *srcRow = GetRow(src, y);
GPixel *dstRow = GetRow(dst, j+dstRect.fTop) + dstRect.fLeft;
uint32_t srcA = fixed_multiply(GPixel_GetA(srcRow[x]), alpha);
uint32_t srcR = fixed_multiply(GPixel_GetR(srcRow[x]), alpha);
uint32_t srcG = fixed_multiply(GPixel_GetG(srcRow[x]), alpha);
uint32_t srcB = fixed_multiply(GPixel_GetB(srcRow[x]), alpha);
GPixel src = GPixel_PackARGB(srcA, srcR, srcG, srcB);
dstRow[i] = blend(dstRow[i], src);
}
}
示例3: assert
bool Board::DoesEnPassantCaptureCauseDiscoveredCheck(int square, int color)
{
assert(this->enPassantRights.HasEnPassant());
int attackerColor = OtherColor(color);
int kingSquare = GetKingSquare(color);
int kingRow = GetRow(kingSquare);
int pieceRow = GetRow(square);
int dr = pieceRow - kingRow;
ulong defenderKing = 1ULL << kingSquare;
if (dr == 0)
{
ulong myRankAttacks = MoveGenerator::rankAttacks[square][GetRankStatus(square)];
ulong theirRankAttacks = MoveGenerator::rankAttacks[enPassantRights.PawnSquare()][GetRankStatus(enPassantRights.PawnSquare())];
ulong defenderKing = 1ULL << kingSquare;
if ((defenderKing & myRankAttacks) != 0 || (defenderKing & theirRankAttacks) != 0)
{
ulong attackers = GetPieceBitBoard(Pieces::GetPiece(PieceTypes::Rook, attackerColor)) |
GetPieceBitBoard(Pieces::GetPiece(PieceTypes::Queen, attackerColor));
if ((myRankAttacks & attackers) != 0 || (theirRankAttacks & attackers) != 0)
{
return true;
}
}
}
return false;
}
示例4: switch
int RDMatrix::port(RDMatrix::Role role) const
{
switch(role) {
case RDMatrix::Primary:
return GetRow("PORT").toInt();
case RDMatrix::Backup:
return GetRow("PORT_2").toInt();
}
return -1;
}
示例5: GetPosition
void Pacman::Debug()
{
std::cout << std::endl;
std::cout << "<<< Pacmans' Data >>>" << std::endl;
std::cout << "actual position: (" << GetPosition().x << ", " << GetPosition().y << ")" << std::endl;
std::cout << "grid position: (" << GetRow() << "," << GetColumn() << ")" << std::endl;
std::cout << "map tile: " << map->getTile(GetRow(), GetColumn()) << std::endl;
std::cout << std::endl;
std::cout << "<<< END Pacmans' Data >>>" << std::endl;
std::cout << std::endl;
}
示例6: ToResourceID
ResourceID ScreenMgr::occupyScreenOut( ResourceID inputid){
Screen* screen = screens_[GetRow(inputid)-1][GetCol(inputid)-1];
for ( auto it = screen->outPort753_.begin(); it != screen->outPort753_.end(); ++it){
if ( it->second == 0){
ResourceID wnode = ToResourceID( GetInput(inputid), GetOutput(it->first), GetRow(inputid), GetCol(inputid));
it->second = wnode;
return wnode;
}
}
return 0;
}
示例7: connInOutRequest
void Screen::connInOutRequest(ResourceID inputid, ResourceID wnode){
if ( qbox_){
QboxDataMap value;
value["out"] = QString::number(GetOutput(wnode) ).toStdString();
if ( GetCol(inputid) == GetCol(wnode) && GetRow(inputid) == GetRow(wnode)){
value["in"] = QString::number(GetInput(inputid) ).toStdString();
}else{
value["in"] = QString::number(GetInput(wnode) ).toStdString();
}
qbox_->addAsyncRequest( PSetSwitchInputReq::uri , std::bind( ignoreCallback, std::placeholders::_1, std::placeholders::_2), value);
}
}
示例8: connInOutRequestCB
bool Screen::connInOutRequestCB(ResourceID inputid, ResourceID wnode, QboxCallback callback, uint32_t , QboxDataMap& v){
if ( qbox_){
QboxDataMap value;
value["out"] = QString::number(GetOutput(wnode) ).toStdString();
if ( GetCol(inputid) == GetCol(wnode) && GetRow(inputid) == GetRow(wnode)){
value["in"] = QString::number(GetInput(inputid) ).toStdString();
}else{
value["in"] = QString::number(GetInput(wnode) ).toStdString();
}
qbox_->addAsyncRequest( PSetSwitchInputReq::uri , callback, value);
return true;
}
return false;
}
示例9: GetRow
void Matrix3x3::Renormalization()
{
Vector3D Xorth, Yorth, Zorth, X = GetRow(0), Y = GetRow(1);
double Error = X * Y;
Xorth = X - Y * Error;
Yorth = Y - X * Error;
Zorth = Vector3D::Cross(Xorth, Yorth);
// Normalize via Taylor expansion
Xorth = Xorth * 0.5d * (3.0d - Xorth * Xorth);
Yorth = Yorth * 0.5d * (3.0d - Yorth * Yorth);
Zorth = Zorth * 0.5d * (3.0d - Zorth * Zorth);
SetRow(0, Xorth);
SetRow(1, Yorth);
SetRow(2, Zorth);
}
示例10: GetColumn
double FDSMesh::GetKnotValue(const double &x, const double &y) const
{
/// To Do: exception / warning when no knot is available for the pedestrian position
int col=0;
int row=0;
/// Which knot is the nearest one to (x,y)?
GetColumn(x, col);
GetRow(row, y);
//std::cout << _matrix[row][col].GetValue() << std::endl;
double value;
// Exception if a mesh can not provide an appropriately located value
if(row < _matrix.size() && col < _matrix[0].size())
value = _matrix[row][col].GetValue();
else
// needs to be fixed!!!
value = 0.0;//std::numeric_limits<double>::quiet_NaN();
// if(_matrix[row][col].GetValue() == 0.) {
// std::cout << "(" << row << " , " << col << ")" << std::endl;
// }
return value;
}
示例11:
void
InfoBoxesConfigWidget::RefreshEditContentDescription()
{
DataFieldEnum &df = (DataFieldEnum &)GetDataField(CONTENT);
WndFrame &description = (WndFrame &)GetRow(DESCRIPTION);
description.SetText(df.GetHelp() != nullptr ? df.GetHelp() : _T(""));
}
示例12: GetRow
void MyListModel::DeleteItems( const wxDataViewItemArray &items )
{
unsigned i;
wxArrayInt rows;
for (i = 0; i < items.GetCount(); i++)
{
unsigned int row = GetRow( items[i] );
if (row < m_textColValues.GetCount())
rows.Add( row );
}
if (rows.GetCount() == 0)
{
// none of the selected items were in the range of the items
// which we store... for simplicity, don't allow removing them
wxLogError( "Cannot remove rows with an index greater than %d", m_textColValues.GetCount() );
return;
}
// Sort in descending order so that the last
// row will be deleted first. Otherwise the
// remaining indeces would all be wrong.
rows.Sort( my_sort_reverse );
for (i = 0; i < rows.GetCount(); i++)
m_textColValues.RemoveAt( rows[i] );
// This is just to test if wxDataViewCtrl can
// cope with removing rows not sorted in
// descending order
rows.Sort( my_sort );
RowsDeleted( rows );
}
示例13: Epetra_Vector
//=============================================================================
double Epetra_MsrMatrix::NormOne() const {
if (NormOne_>-1.0) return(NormOne_);
if (!Filled()) EPETRA_CHK_ERR(-1); // Matrix must be filled.
Epetra_Vector * x = new Epetra_Vector(RowMatrixRowMap()); // Need temp vector for column sums
Epetra_Vector * xp = 0;
Epetra_Vector * x_tmp = 0;
// If we have a non-trivial importer, we must export elements that are permuted or belong to other processors
if (RowMatrixImporter()!=0) {
x_tmp = new Epetra_Vector(RowMatrixColMap()); // Create temporary import vector if needed
xp = x_tmp;
}
int i, j;
for (i=0; i < NumMyCols_; i++) (*xp)[i] = 0.0;
for (i=0; i < NumMyRows_; i++) {
int NumEntries = GetRow(i);
for (j=0; j < NumEntries; j++) (*xp)[Indices_[j]] += fabs(Values_[j]);
}
if (RowMatrixImporter()!=0) x->Export(*x_tmp, *RowMatrixImporter(), Add); // Fill x with Values from temp vector
x->MaxValue(&NormOne_); // Find max
if (x_tmp!=0) delete x_tmp;
delete x;
UpdateFlops(NumGlobalNonzeros());
return(NormOne_);
}
示例14: GetRow
//=============================================================================
int Epetra_MsrMatrix::InvRowSums(Epetra_Vector& x) const {
//
// Put inverse of the sum of absolute values of the ith row of A in x[i].
//
if (!OperatorRangeMap().SameAs(x.Map())) EPETRA_CHK_ERR(-2); // x must have the same distribution as the range of A
int ierr = 0;
int i, j;
for (i=0; i < NumMyRows_; i++) {
int NumEntries = GetRow(i); // Copies ith row of matrix into Values_ and Indices_
double scale = 0.0;
for (j=0; j < NumEntries; j++) scale += fabs(Values_[j]);
if (scale<Epetra_MinDouble) {
if (scale==0.0) ierr = 1; // Set error to 1 to signal that zero rowsum found (supercedes ierr = 2)
else if (ierr!=1) ierr = 2;
x[i] = Epetra_MaxDouble;
}
else
x[i] = 1.0/scale;
}
UpdateFlops(NumGlobalNonzeros());
EPETRA_CHK_ERR(ierr);
return(0);
}
示例15: if
// Gets the dimensions of the colour cell given by (row,col)
BOOL CColourPopup::GetCellRect(int nIndex, const LPRECT& rect)
{
if (nIndex == CUSTOM_BOX_VALUE)
{
::SetRect(rect,
m_CustomTextRect.left, m_CustomTextRect.top,
m_CustomTextRect.right, m_CustomTextRect.bottom);
return TRUE;
}
else if (nIndex == DEFAULT_BOX_VALUE)
{
::SetRect(rect,
m_DefaultTextRect.left, m_DefaultTextRect.top,
m_DefaultTextRect.right, m_DefaultTextRect.bottom);
return TRUE;
}
if (nIndex < 0 || nIndex >= m_nNumColours)
return FALSE;
rect->left = GetColumn(nIndex) * m_nBoxSize + m_nMargin;
rect->top = GetRow(nIndex) * m_nBoxSize + m_nMargin;
// Move everything down if we are displaying a default text area
if (m_strDefaultText.GetLength())
rect->top += (m_nMargin + m_DefaultTextRect.Height());
rect->right = rect->left + m_nBoxSize;
rect->bottom = rect->top + m_nBoxSize;
return TRUE;
}