當前位置: 首頁>>代碼示例>>C++>>正文


C++ Cell函數代碼示例

本文整理匯總了C++中Cell函數的典型用法代碼示例。如果您正苦於以下問題:C++ Cell函數的具體用法?C++ Cell怎麽用?C++ Cell使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Cell函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: tmp

bool Command::setFromString(const QString &inp_str)
{
    QString delim = ";";

    QString tmp(inp_str);
    if ( !tmp.contains(QRegExp("[0-7],[0-7]"+delim+"( |F|K|Q|R|B|P|Kn)"+delim+"[wb]"+delim+delim+"[0-7],[0-7]"+delim+"( |F|K|Q|R|B|P|Kn)"+delim+"[wb]\n")) )
        return false;

    tmp.remove("\n");

    QStringList line = tmp.split(delim+delim);

    QStringList b_info_list = line[0].split(delim);
    QStringList b_cell_list = b_info_list[0].split(",");
    b_cell_info_.cell_ = Cell(b_cell_list[0].toInt(), b_cell_list[1].toInt());
    b_cell_info_.ftype_ = b_info_list[1];

    QString b_color = b_info_list[2];
    if (b_color == "w")
        b_cell_info_.fcolor_ = WHITE;
    else if(b_color == "b")
        b_cell_info_.fcolor_ = BLACK;
    else
        b_cell_info_.fcolor_ = NONE;

    QStringList e_info_list = line[1].split(delim);
    QStringList e_cell_list = e_info_list[0].split(",");
    e_cell_info_.cell_ = Cell(e_cell_list[0].toInt(), e_cell_list[1].toInt());
    e_cell_info_.ftype_ = e_info_list[1];

    QString e_color = e_info_list[2];
    if (e_color == "w")
        e_cell_info_.fcolor_ = WHITE;
    else if(e_color == "b")
        e_cell_info_.fcolor_ = BLACK;
    else
        e_cell_info_.fcolor_ = NONE;

    return true;
}
開發者ID:Andriks,項目名稱:Chess,代碼行數:40,代碼來源:command.cpp

示例2: Cell

double GlobalPlanner::getRisk(Cell & cell) {
  double risk = explorePenalty;
  if (occProb.find(cell) != occProb.end()) {
    risk = octomap::probability(occProb[cell]);
  }
  Cell front = Cell(cell.x()+1, cell.y(), cell.z());
  Cell back = Cell(cell.x()-1, cell.y(), cell.z());
  Cell right = Cell(cell.x(), cell.y()+1, cell.z());
  Cell left = Cell(cell.x(), cell.y()-1, cell.z());
  Cell up = Cell(cell.x(), cell.y(), cell.z()+1);
  Cell down = Cell(cell.x(), cell.y(), cell.z()-1);
  if (occProb.find(front) != occProb.end()) {
    risk += octomap::probability(occProb[front]);
  }
  if (occProb.find(back) != occProb.end()) {
    risk += octomap::probability(occProb[back]);
  }
  if (occProb.find(right) != occProb.end()) {
    risk += octomap::probability(occProb[right]);
  }
  if (occProb.find(left) != occProb.end()) {
    risk += octomap::probability(occProb[left]);
  }
  if (occProb.find(up) != occProb.end()) {
    risk += octomap::probability(occProb[up]);
  }
  if (occProb.find(down) != occProb.end()) {
    risk += octomap::probability(occProb[down]);
  }
  double prior = heightPrior[floor(cell.z())];
  // ROS_INFO("risk: %f \t prior: %f \n", risk, prior);
  return risk * prior;
}
開發者ID:vilhjalmur89,項目名稱:rotors_simulator,代碼行數:33,代碼來源:global_planner.cpp

示例3: FancyTable

 // Colored table
 void FancyTable(wxArrayString& header, wxArrayPtrVoid& data)
 {
   // Colors, line width and bold font
   SetFillColour(wxColour(255,0,0));
   SetTextColour(255);
   SetDrawColour(wxColour(128,0,0));
   SetLineWidth(.3);
   SetFont(wxT(""),wxT("B"));
   //Header
   double w[4] = {40,35,40,45};
   size_t i;
   for (i = 0; i < header.GetCount(); i++)
   {
     Cell(w[i],7,header[i],wxPDF_BORDER_FRAME, 0, wxPDF_ALIGN_CENTER, 1);
   }
   Ln();
   // Color and font restoration
   SetFillColour(wxColour(224,235,255));
   SetTextColour(0);
   SetFont(wxT(""));
   // Data
   int fill = 0;
   size_t j;
   for (j = 0; j < data.GetCount(); j++)
   {
     wxArrayString* row = (wxArrayString*) data[j];
     Cell(w[0],6,(*row)[0],wxPDF_BORDER_LEFT | wxPDF_BORDER_RIGHT,0,wxPDF_ALIGN_LEFT,fill);
     Cell(w[1],6,(*row)[1],wxPDF_BORDER_LEFT | wxPDF_BORDER_RIGHT,0,wxPDF_ALIGN_LEFT,fill);
     Cell(w[2],6,(*row)[2],wxPDF_BORDER_LEFT | wxPDF_BORDER_RIGHT,0,wxPDF_ALIGN_RIGHT,fill);
     Cell(w[3],6,(*row)[3],wxPDF_BORDER_LEFT | wxPDF_BORDER_RIGHT,0,wxPDF_ALIGN_RIGHT,fill);
     Ln();
     fill = 1 - fill;
   }
   Cell((w[0]+w[1]+w[2]+w[3]),0,wxT(""),wxPDF_BORDER_TOP);
 }
開發者ID:simple-codeblocks,項目名稱:Codeblocks,代碼行數:36,代碼來源:tutorial5.cpp

示例4: ImprovedTable

 // Better table
 void ImprovedTable(wxArrayString& header,wxArrayPtrVoid& data)
 {
   // Column widths
   double w[4] = {40,35,40,45};
   // Header
   size_t i;
   for (i = 0; i <header.GetCount(); i++)
   {
     Cell(w[i],7,header[i],wxPDF_BORDER_FRAME,0,wxPDF_ALIGN_CENTER);
   }
   Ln();
   // Data
   size_t j;
   for (j = 0; j < data.GetCount(); j++)
   {
     wxArrayString* row = (wxArrayString*) data[j];
     Cell(w[0],6,(*row)[0],wxPDF_BORDER_LEFT | wxPDF_BORDER_RIGHT);
     Cell(w[1],6,(*row)[1],wxPDF_BORDER_LEFT | wxPDF_BORDER_RIGHT);
     Cell(w[2],6,(*row)[2],wxPDF_BORDER_LEFT | wxPDF_BORDER_RIGHT,0,wxPDF_ALIGN_RIGHT);
     Cell(w[3],6,(*row)[3],wxPDF_BORDER_LEFT | wxPDF_BORDER_RIGHT,0,wxPDF_ALIGN_RIGHT);
     Ln();
   }
   // Closure line
   Cell((w[0]+w[1]+w[2]+w[3]),0,wxS(""),wxPDF_BORDER_TOP);
 }
開發者ID:maxmods,項目名稱:wx.mod,代碼行數:26,代碼來源:tutorial5.cpp

示例5: pk

void TileMap::set_cell(int p_x,int p_y,int p_tile,bool p_flip_x,bool p_flip_y,bool p_transpose) {

	PosKey pk(p_x,p_y);

	Map<PosKey,Cell>::Element *E=tile_map.find(pk);
	if (!E && p_tile==INVALID_CELL)
		return; //nothing to do

	PosKey qk(p_x/_get_quadrant_size(),p_y/_get_quadrant_size());
	if (p_tile==INVALID_CELL) {
		//erase existing
		tile_map.erase(pk);
		Map<PosKey,Quadrant>::Element *Q = quadrant_map.find(qk);
		ERR_FAIL_COND(!Q);
		Quadrant &q=Q->get();
		q.cells.erase(pk);
		if (q.cells.size()==0)
			_erase_quadrant(Q);
		else
			_make_quadrant_dirty(Q);

		return;
	}

	Map<PosKey,Quadrant>::Element *Q = quadrant_map.find(qk);

	if (!E) {
		E=tile_map.insert(pk,Cell());
		if (!Q) {
			Q=_create_quadrant(qk);
		}
		Quadrant &q=Q->get();
		q.cells.insert(pk);
	} else {
		ERR_FAIL_COND(!Q); // quadrant should exist...

		if (E->get().id==p_tile && E->get().flip_h==p_flip_x && E->get().flip_v==p_flip_y && E->get().transpose==p_transpose)
			return; //nothing changed

	}


	Cell &c = E->get();

	c.id=p_tile;
	c.flip_h=p_flip_x;
	c.flip_v=p_flip_y;
	c.transpose=p_transpose;

	_make_quadrant_dirty(Q);

}
開發者ID:FEDE0D,項目名稱:godot,代碼行數:52,代碼來源:tile_map.cpp

示例6: GetMap

void Transport::UpdatePosition(float x, float y, float z, float o)
{
    bool newActive = GetMap()->IsGridLoaded(x, y);

    Relocate(x, y, z, o);

    UpdatePassengerPositions(_passengers);

    /* There are four possible scenarios that trigger loading/unloading passengers:
      1. transport moves from inactive to active grid
      2. the grid that transport is currently in becomes active
      3. transport moves from active to inactive grid
      4. the grid that transport is currently in unloads
    */
    if (_staticPassengers.empty() && newActive) // 1. and 2.
        LoadStaticPassengers();
    else if (!_staticPassengers.empty() && !newActive && Cell(x, y).DiffGrid(Cell(GetPositionX(), GetPositionY()))) // 3.
        UnloadStaticPassengers();
    else
        UpdatePassengerPositions(_staticPassengers);
    // 4. is handed by grid unload
}
開發者ID:Caydan,項目名稱:WoWSCore548,代碼行數:22,代碼來源:Transport.cpp

示例7: resources

CCMSDIntegrator::CCMSDIntegrator(void)
:
		resources((std::vector<IObjectPtr>&) Resource().objects()),
		cells((std::vector<IObjectPtr>&) Cell().objects()),
		parts((std::vector<IObjectPtr>&) Part().objects()),
		processplans((std::vector<IObjectPtr>&) ProcessPlan().objects()),
		jobs((std::vector<IObjectPtr>&) Job().objects()),
		distributions((std::vector<IObjectPtr>&) Distribution().objects()),
		calendars((std::vector<IObjectPtr>&) Calendar().objects()),
		layouts((std::vector<IObjectPtr>&) Layout().objects())

{
}
開發者ID:amanrenishaw,項目名稱:MTConnectGadgets,代碼行數:13,代碼來源:ResourceIntegrator.cpp

示例8: TEST

TEST(Parser, correctParsCels) {


    int m(3), n(3);
    std::istringstream inp( "...\n"
                            ".*.\n"
                            ".**");

   std::vector<Cell> corr_cell = {
            Cell(0, 0, Status::DEAD), Cell(1, 0, Status::DEAD), Cell(2, 0, Status::DEAD),
            Cell(0, 1, Status::DEAD), Cell(1, 1, Status::LIVE), Cell(2, 1, Status::DEAD),
            Cell(0, 2, Status::DEAD), Cell(1, 2, Status::LIVE), Cell(2, 2, Status::LIVE)
    };

    Parser parser(inp);
std::vector<Cell> g_inp = parser.getGrid(m, n);

    EXPECT_EQ(g_inp, corr_cell);
}
開發者ID:DimaKolesnyk,項目名稱:just-for-fun,代碼行數:19,代碼來源:test_Parser.cpp

示例9: switch

const list<Cell> Combo::getList() {
	int r, c;

	list<Cell> cells;

	switch (getState()) {
	case Combo::VERT:
		r = down()->row;
		c = down()->col;
		for (r; r <= up()->row; ++r) {
			cells.push_back(Cell(r, c));
		}
		break;

	case Combo::HORI:
		r = left()->row;
		c = left()->col;
		for (c; c <= right()->col; ++c) {
			cells.push_back(Cell(r, c));
		}
		break;

	case Combo::MULTI:
		r = left()->row;
		c = left()->col;
		for (c; c <= right()->col; ++c) {
			cells.push_back(Cell(r, c));
		}
		
		c = down()->col;
		r = down()->row;
		for (r; r <= up()->row; ++r) {
			cells.push_back(Cell(r, c));
		}
	}

	return cells;
}
開發者ID:bhinesley,項目名稱:triforce,代碼行數:38,代碼來源:combo.cpp

示例10: parts

TileCell::TileCell(String const& rString, bool remoteFlag) {
    Strings const parts(rString, SEPARATOR);
    ASSERT(parts.Count() == 2); // TODO recovery

    String const first = parts.First();
    mTile = Tile(IndexType(first), remoteFlag);

    mSwapFlag = true;
    String const second = parts.Second();
    if (second != SWAP) {
        mCell = Cell(second);
        mSwapFlag = false;
    }
}
開發者ID:stephengold,項目名稱:gold-tiles,代碼行數:14,代碼來源:tilecell.cpp

示例11: addChild

void
TableLayout::addComponent(size_t col, size_t row, Component* component)
{
    if(row >= rowproperties.size())
        throw std::runtime_error("row out of range");
    if(col >= colproperties.size())
        throw std::runtime_error("col out of range");

    if(cells[row * colproperties.size() + col].childid >= 0)
        throw std::runtime_error("Already a component in this cell.");
    
    addChild(component);
    cells[row * colproperties.size() + col] = Cell(childs.size()-1);
}
開發者ID:SirIvanMoReau,項目名稱:lincity-ng,代碼行數:14,代碼來源:TableLayout.cpp

示例12: DBObjTableField

void DBNetworkIF::SetMagnitude ()

	{
	DBInt cellID;
	DBObjRecord *cellRec, *toCellRec;
	if (MagnitudeFLD == (DBObjTableField *) NULL)
		{
		MagnitudeFLD = new DBObjTableField (DBrNMagnitude,DBTableFieldInt,"%4d",sizeof (DBShort));
		CellTable->AddField (MagnitudeFLD);
		}
	for (cellID = 0;cellID < CellNum ();++cellID)
		{
		cellRec = Cell (cellID);
		MagnitudeFLD->Int (cellRec,(FromCellDirs (cellRec) == 0x0) ? 1 : 0);
		}
	for (cellID = 0;cellID < CellNum ();++cellID)
		{
		cellRec = Cell (cellID);
		DBPause ((CellNum () - cellRec->RowID ()) * 100 / CellNum ());
		if ((toCellRec = ToCell (cellRec)) != (DBObjRecord *) NULL)
			MagnitudeFLD->Int (toCellRec,MagnitudeFLD->Int (toCellRec) + MagnitudeFLD->Int (cellRec));
		}
	}
開發者ID:rjs80,項目名稱:RGIS,代碼行數:23,代碼來源:DBNetMisc.C

示例13: start_c

void BuyerParser::getAdCampaign(std::vector<std::vector<float> >& v) {
  v.clear();
  Cell start_c('c',41);

  for( int b=0; b<N_BRANDS; b++ ) {
    v.push_back(std::vector<float>(N_TIME_INTERVALS));
    Cell c = Cell(start_c.first + b, start_c.second);

    for( int t=0; t<N_TIME_INTERVALS; t++ ) {
      v[b][t] = std::atof( getCell(c).c_str() );
      c.second++;
    }
  }
}
開發者ID:stokedover9k,項目名稱:buyer,代碼行數:14,代碼來源:parser.cpp

示例14: Cell

inline
typename SlicedCartesian<ScalarParam,dimensionParam,VScalarParam>::Cell
SlicedCartesian<ScalarParam,dimensionParam,VScalarParam>::Cell::getNeighbour(
	int neighbourIndex) const
	{
	Index neighbourCellIndex=index;
	int face=neighbourIndex>>1;
	if(neighbourIndex&0x1)
		{
		++neighbourCellIndex[face];
		if(neighbourCellIndex[face]<grid->numCells[face])
			return Cell(grid,neighbourCellIndex);
		else
			return Cell();
		}
	else
		{
		--neighbourCellIndex[face];
		if(neighbourCellIndex[face]>=0)
			return Cell(grid,neighbourCellIndex);
		else
			return Cell();
		}
	}
開發者ID:jrevote,項目名稱:3DA-3DVisualizer,代碼行數:24,代碼來源:SlicedCartesian.cpp

示例15: switch

    Node *findLeaf(Node *node, Cell const &at, bool canSubdivide)
    {
        if(node->isLeaf()) return node;

        // Into which quadrant do we need to descend?
        Node::Quadrant q = node->quadrant(at);

        // Has this quadrant been initialized yet?
        Node **childAdr = &node->children[q];
        if(!*childAdr)
        {
            if(!canSubdivide) return 0;

            // Subdivide the space.
            uint const subSize = node->size >> 1;
            switch(q)
            {
            case Node::TopLeft:
                *childAdr = newNode(node->cell, subSize);
                break;

            case Node::TopRight:
                *childAdr = newNode(Cell(node->cell.x + subSize, node->cell.y), subSize);
                break;

            case Node::BottomLeft:
                *childAdr = newNode(Cell(node->cell.x, node->cell.y + subSize), subSize);
                break;
            case Node::BottomRight:
                *childAdr = newNode(Cell(node->cell.x + subSize, node->cell.y + subSize), subSize);
                break;
            }
        }

        return findLeaf(*childAdr, at, canSubdivide);
    }
開發者ID:gnuzinho,項目名稱:Doomsday-Engine,代碼行數:36,代碼來源:blockmap.cpp


注:本文中的Cell函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。