• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Cell函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Cell函数的典型用法代码示例。如果您正苦于以下问题:C++ Cell函数的具体用法?C++ Cell怎么用?C++ Cell使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Cell函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16:

void StructuredGrid2D::init(Size nCellsI, Size nCellsJ, std::pair<Scalar, Scalar> xb, std::pair<Scalar, Scalar> yb)
{
    _nCellsI = nCellsI;
    _nCellsJ = nCellsJ;
    _xb = xb;
    _yb = yb;

    Scalar dx = (_xb.second - _xb.first) / _nCellsI;
    Scalar dy = (_yb.second - _yb.first) / _nCellsJ;

    _nodes.clear();

    for (auto j = 0; j < nNodesJ(); ++j)
        for (auto i = 0; i < nNodesI(); ++i)
            _nodes.push_back(Point2D(i * dx + _xb.first, j * dy + _yb.first));

    _cells.clear();

    for(auto j = 0; j < _nCellsJ; ++j)
        for(auto i = 0; i < _nCellsI; ++i)
            _cells.push_back(Cell(*this, i, j));

    _ifaces.clear();

    for(int j = 0; j < _nCellsJ; ++j)
        for(int i = 0; i < nNodesI(); ++i)
        {
            _ifaces.push_back(Face(*this, Coordinates::I, i, j));
        }

    _jfaces.clear();

    for(int i = 0; i < _nCellsI; ++i)
        for(int j = 0; j < nNodesJ(); ++j)
        {
            _jfaces.push_back(Face(*this, Coordinates::J, i, j));
        }

    _faces.clear();
    for(const Face &f: _ifaces)
        _faces.push_back(f);

    for(const Face &f: _jfaces)
        _faces.push_back(f);

    _localCells.add(_cells.begin(), _cells.end());
    _ownership.resize(_cells.size(), _comm->rank());
}
开发者ID:obrienadam,项目名称:Phase,代码行数:48,代码来源:StructuredGrid2D.cpp


示例17: FCube

std::vector<Cell> MxField::cells() const
{
    std::vector<Cell> result;
    for (uint32_t x = 0; x < m_sides.x; ++x) {
        for (uint32_t y = 0; y < m_sides.y; ++y) {
            for (uint32_t z = 0; z < m_sides.z; ++z) {
                if (m_field[x][y][z] != 0) {
                    result.push_back(Cell(//new FCube(side()),
                                          new FSphere(radius()),
                                          dCoord(x * side(), y * side(), z * side())));
                }
            }
        }
    }
    return result;
}
开发者ID:rue-ryuzaki,项目名称:AeroGen-src,代码行数:16,代码来源:mxfield.cpp


示例18: width

Ground::Ground(int w, int h, Frame *fr) : width(w), height(h), frame(fr)
{
	cell_rows = height/CELL_SZ;
	cell_cols = width/CELL_SZ;

	cells.reserve(cell_rows*cell_cols);
	for(int i=0; i<cell_rows*cell_cols; ++i){
		cells.push_back(Cell(CELL_SZ, CELL_SZ, i%cell_cols, i/cell_cols, this));
	}

	surf = SDL_CreateRGBSurface(0, width, height, 32, 0, 0, 0, 0);
	pixels = static_cast<Uint32 *>(surf->pixels);
//	pixels = new Uint32[width*height];
	std::memset(pixels, 0, width*height*sizeof(Uint32));
	calcMinerals();
}
开发者ID:pmslavin,项目名称:miner,代码行数:16,代码来源:Ground.cpp


示例19: return

DBObjRecord *DBNetworkIF::ToCell (const DBObjRecord *cellRec) const

	{
	DBInt toCell;
	DBPosition pos;

	if (cellRec == (DBObjRecord *) NULL) return ((DBObjRecord *) NULL);
	toCell = ToCellFLD->Int (cellRec);
	pos = PositionFLD->Position (cellRec);

	if (toCell == 0x0L) return ((DBObjRecord *) NULL);
	if ((toCell == DBNetDirNW) || (toCell == DBNetDirN) || (toCell == DBNetDirNE)) pos.Row++;
	if ((toCell == DBNetDirSE) || (toCell == DBNetDirS) || (toCell == DBNetDirSW)) pos.Row--;
	if ((toCell == DBNetDirNE) || (toCell == DBNetDirE) || (toCell == DBNetDirSE)) pos.Col++;
	if ((toCell == DBNetDirNW) || (toCell == DBNetDirW) || (toCell == DBNetDirSW)) pos.Col--;
	return (Cell (pos));
	}
开发者ID:rjs80,项目名称:RGIS,代码行数:17,代码来源:DBNetMisc.C


示例20:

  vector<Cell> ConnectionsPerformanceTest::randomSDR(UInt n, UInt w)
  {
    set<UInt> sdrSet = set<UInt>();
    vector<Cell> sdr = vector<Cell>();

    for (UInt i = 0; i < w; i++)
    {
      sdrSet.insert(rand() % (UInt)n);
    }

    for (UInt c : sdrSet)
    {
      sdr.push_back(Cell(c));
    }

    return sdr;
  }
开发者ID:Petr-Kovalev,项目名称:nupic.core.net,代码行数:17,代码来源:ConnectionsPerformanceTest.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CenterOnParent函数代码示例发布时间:2022-05-30
下一篇:
C++ Cdr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap