当前位置: 首页>>代码示例>>C++>>正文


C++ Star类代码示例

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


在下文中一共展示了Star类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: debug

void	HipparcosTest::testWindowIterator() {
	debug(LOG_DEBUG, DEBUG_LOG, 0, "testWindowIterator() begin");
	RaDec	center(0, 0);
	center.ra().hours(6.75247702777777777777);
	center.dec().degrees(-16.71611583333333333333);
	Angle	width; width.hours(1);
	Angle	height; height.degrees(15);
	SkyWindow	window(center, width, height);
	CatalogIterator	i = catalog->findIter(window,
					MagnitudeRange(-30, 4.5));
	unsigned long long	counter = 0;
	for (; !i.isEnd(); ++i) {
		counter++;
		Star	s = *i;
		debug(LOG_DEBUG, DEBUG_LOG, 0, "%s", s.toString().c_str());
	}
	CPPUNIT_ASSERT(counter == 10);
	debug(LOG_DEBUG, DEBUG_LOG, 0, "testWindowIterator() end");
}
开发者ID:felipebetancur,项目名称:AstroPhotography-2,代码行数:19,代码来源:HipparcosTest.cpp

示例2: constructEdgeStarMap

void constructEdgeStarMap(EdgeStarMap& esmap, StarSet& stars, bool low){
  esmap.clear();
  for (StarSet::iterator it=stars.begin(); it!=stars.end(); it++){
    Star* s = *it;
    if (low) {
      for (HyperGraph::EdgeSet::iterator it = s->lowLevelEdges().begin();
          it!=s->lowLevelEdges().end(); it++){
        HyperGraph::Edge* e=*it;
        esmap.insert(make_pair(e,s));
      }
    } else {
      for (HyperGraph::EdgeSet::iterator it = s->starEdges().begin();
          it!=s->starEdges().end(); it++){
        HyperGraph::Edge* e=*it;
        esmap.insert(make_pair(e,s));
      }
    }
  }
}
开发者ID:2maz,项目名称:g2o,代码行数:19,代码来源:simple_star_ops.cpp

示例3: onUpdate

void PopStar::onUpdate(float delta)
{
	for (int row = 0; row < ROW_NUM; ++row)
	{
		for (int col = 0; col < COL_NUM; ++col)
		{
			Star* star = stars[row][col];
			if (star)
			{
				star->onUpdate(delta);
			}
		}
	}

	if (currentState)
	{
		currentState->execute(delta);
	}
}
开发者ID:wsmn123123,项目名称:popStar,代码行数:19,代码来源:PopStar.cpp

示例4: genBombList

//产生炸弹的消除队列
void StarMatrix::genBombList(Star* s){
	selectedList.clear();
	selectedList.push_back(s);
	Star* linkStar = nullptr;
	int index_i = s->getIndexI();
	int index_j = s->getIndexJ();
	//上
	if(index_i-1 >= 0 && (linkStar = stars[index_i-1][index_j]) ){
		if(!linkStar->isSelected())
			selectedList.push_back(stars[index_i-1][index_j]);
	}
	//左上
	if(index_i-1 >= 0 && index_j-1 >= 0&& (linkStar = stars[index_i-1][index_j-1]) ){
		if(!linkStar->isSelected())
			selectedList.push_back(stars[index_i-1][index_j-1]);
	}
	//右上
	if(index_i-1 >= 0 && index_j+1 <= COL_NUM && (linkStar = stars[index_i-1][index_j+1]) ){
		if(!linkStar->isSelected())
			selectedList.push_back(stars[index_i-1][index_j+1]);
	}
	//下
	if(index_i+1 < ROW_NUM  && (linkStar = stars[index_i+1][index_j]) ){
		if(!linkStar->isSelected())
			selectedList.push_back(stars[index_i+1][index_j]);
	}
	//左下
	if(index_i+1 < ROW_NUM  && index_j-1 >= 0 && (linkStar = stars[index_i+1][index_j-1]) ){
		if(!linkStar->isSelected())
			selectedList.push_back(stars[index_i+1][index_j-1]);
	}
	//右下
	if(index_i+1 < ROW_NUM  &&  index_j+1 <= COL_NUM && (linkStar = stars[index_i+1][index_j+1]) ){
		if(!linkStar->isSelected())
			selectedList.push_back(stars[index_i+1][index_j+1]);
	}
	//左
	if(index_j-1 >= 0 && (linkStar = stars[index_i][index_j-1]) ){
		if(!linkStar->isSelected())
			selectedList.push_back(stars[index_i][index_j-1]);
	}
	//右
	if(index_j+1 < COL_NUM && (linkStar = stars[index_i][index_j+1]) ){
		if(!linkStar->isSelected())
			selectedList.push_back(stars[index_i][index_j+1]);
	}
}
开发者ID:joyfish,项目名称:cocos2d,代码行数:48,代码来源:StarMatrix.cpp

示例5: ofSetFrameRate

//--------------------------------------------------------------
void testApp::setup(){
    ofSetFrameRate(60);
    ofBackground(0, 0, 0);
    
    //blink speed
        for(int i=0; i<10; i++){
            Star blink;
            blink.init();
            
            stars.push_back(blink);
        }
    
    //stars
    for (int i = 0; i <10; i++) {
        Star dead;
        dead.init();
        stars.push_back(dead);
    }

}
开发者ID:Sussesj,项目名称:Code4Art,代码行数:21,代码来源:testApp.cpp

示例6: printStars

void printStars()
{
    if(linkList.GetListLength() == 0)        //if no file is open, do nothing.
    {
        cout << "No stars have been read.\n";
        return;
    }
    Star *star = 0;
    Node *curNode = linkList.GetFirstNode();     //Set curNode to the first node in list
    while(true)
    {
        star = (Star*)(curNode->data_);     //cast void pointer as Star
        star->PrintToConsole();
        if(curNode->next_ == 0)     //next_ == 0 implies curNode == last_, prevents program from trying to read outside the linked list
        {
            break;
        }
        curNode = curNode->next_;       //Go to next node
    }
}
开发者ID:cognar,项目名称:CS162A03,代码行数:20,代码来源:main.cpp

示例7: readFromFile

void readFromFile()
{
    ifstream inFile;
    char name[NAME_SZ] = "";
    long temp = 0, starCount = 0;
    double lumin = 0, mass = 0, radius = 0;
    Star *newStar;

    clearStars();       //clear any residual data
    cout << "Please enter the file path.\n";
    cin >> Star::filePath_;
    inFile.open(Star::filePath_);
    while(inFile >> name)
    {
        name[strlen(name)-1] = '\0';     //strips comma from name.
        newStar = new Star(name);
        if(newStar == 0)        //Abort if memory allocation fails.
        {
            cout << "Memory allocation failed.\n";
            break;
        }
        inFile.ignore();    //ignore coma, name entry actually grabs first comma, all others are caught by ignore()
        inFile >> temp;     //read temperature
        newStar->SetTemperature(temp);
        inFile.ignore();
        inFile >> lumin;    //read luminosity
        newStar->SetLuminosity(lumin);
        inFile.ignore();
        inFile >> mass;     //read mass
        newStar->SetMass(mass);
        inFile.ignore();
        inFile >> radius;   //read radius
        newStar->SetRadius(radius);
        inFile.ignore();
        starCount++;
        linkList.AddLinkToBack(newStar);
    }
    inFile.close();
    inFile.clear(std::ios_base::goodbit);       //reset flags to prevent errors on certain compilers
    cout << "Successfully loaded " << starCount << " star entries.\n";
}
开发者ID:cognar,项目名称:CS162A03,代码行数:41,代码来源:main.cpp

示例8: while

void SolarSystemBrowser::slotRefreshTree()
{
    Simulation* sim = appCore->getSimulation();
    
    // Update the browser with the solar system closest to the active observer
    SolarSystem* solarSys = sim->getUniverse()->getNearestSolarSystem(sim->getActiveObserver()->getPosition());

    // Don't update the solar system browser if no solar system is nearby
    if (!solarSys)
        return;

    Star* rootStar = solarSys->getStar();

    // We want to show all gravitationally associated stars in the
    // browser; follow the chain up the parent star or barycenter.
    while (rootStar->getOrbitBarycenter() != NULL)
    {
        rootStar = rootStar->getOrbitBarycenter();
    }

    bool groupByClass = groupCheckBox->checkState() == Qt::Checked;

    solarSystemModel->buildModel(rootStar, groupByClass);

    treeView->resizeColumnToContents(SolarSystemTreeModel::NameColumn);

    treeView->clearSelection();

    // Automatically expand stars in the model (to a max depth of 2)
    QModelIndex primary = solarSystemModel->index(0, 0, QModelIndex());
    if (primary.isValid() && solarSystemModel->objectAtIndex(primary).star() != NULL)
    {
        treeView->setExpanded(primary, true);
        QModelIndex secondary = solarSystemModel->index(0, 0, primary);
        if (secondary.isValid() && solarSystemModel->objectAtIndex(secondary).star() != NULL)
        {
            treeView->setExpanded(secondary, true);
        }
    }
    
}
开发者ID:sanyaade-embedded-systems,项目名称:STA,代码行数:41,代码来源:qtsolarsystembrowser.cpp

示例9: srand

bool StarMatrix::init_matrix()
{
    // make matrix
    auto width = m_nWidth / 10;
    auto height = m_nHeight / 13;
    srand(static_cast<unsigned int>(time(nullptr)));
    for (int i = 0; i != 10; ++i) {
        for (int j = 0; j != 13; ++j) {
            auto t = random(0, 4);
            Star* child = Star::create(t, width, height);
            child->setAnchorPoint(Vec2(0, 0));
            child->setPosition(Vec2(i*width, j*height));
            this->addChild(child);
        }
    }
	// callback
	auto listener = EventListenerTouchOneByOne::create();
	listener->onTouchBegan = CC_CALLBACK_2(StarMatrix::OnTouchBegin, this);
	Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, this);
    return true;
}
开发者ID:likebeta,项目名称:code-snippets,代码行数:21,代码来源:StarMatrix.cpp

示例10: toMatrix

Star StarMap::nearestNeighbor(const Star& star, double threshold) const
{
    auto c = star.getCoords();
    int index[2] = { 0 };
    double dist[2] = { 0 };
    flann::Matrix<int> i = toMatrix(index, 1, 2);
    flann::Matrix<double> d = toMatrix(dist, 1, 2);

    spatial_index_->knnSearch(toMatrix(&c), i, d, 2, flann::SearchParams());

    return (dist[1] < threshold*threshold) ? byIndex().at(index[1]) : Star();
}
开发者ID:Fifty-Nine,项目名称:StellarCartographer,代码行数:12,代码来源:StarMap.cpp

示例11: if

/**
 * @brief Draws all of the outbound edges from this star.
 *
 * @warning Internal use only. Call only in GL_BEGIN context in
 * GL_LINES mode!
 */
void Star::drawEdges()
{
#ifndef NO_GFX
    std::vector<Star *>::iterator i;

    for(i = this->edges.begin(); i != this->edges.end(); i++)
    {
        Star * other = *i;
        if(other->getID() < this->getID())
        {
            if(other == this->path_next || other->path_next == this)
                this->glColor4d(0.8);
            else if(std::count(this->mst_edges.begin(), this->mst_edges.end(), other))
                ::glColor4d(0.0,0.33,0.66,0.6);
            else
                ::glColor4d(0.2,0.2,0.2,0.5);

            this->glVertex3d();

            if(other == this->path_next || other->path_next == this)
                other->glColor4d(0.8);

            other->glVertex3d();
        }

    }

    for(i = this->mst_edges.begin(); i != this->mst_edges.end(); i++)
    {
        Star * other = *i;
        if(other->getID() < this->getID())
        {
            if(other == this->path_next || other->path_next == this)
                this->glColor4d(0.8);
            else
                ::glColor4d(0.66,0.0,0.66,0.6);

            if(!std::count(this->edges.begin(), this->edges.end(), other))
                this->glVertex3d();

            if(other == this->path_next || other->path_next == this)
                other->glColor4d(0.8);

            if(!std::count(this->edges.begin(), this->edges.end(), other))
                other->glVertex3d();
        }

    }
#endif
}
开发者ID:arcticmatt,项目名称:CS2,代码行数:56,代码来源:star.cpp

示例12: showStarParticleEffect

void StarMatrix::deleteSelectedList(){
	//播放消除音效
	Audio::getInstance()->playPop();

	for(auto it = selectedList.begin();it != selectedList.end();it++){
		Star* star = *it;
		m_layer->showEveryScore(selectedListSize,5+(selectedListSize-selectedList.size())*5,selectedListSize-selectedList.size(),star->getPosition(),touchLeft);
		selectedList.pop_front();
		//粒子效果
		showStarParticleEffect(star->getColor(),star->getPosition(),this);
		stars[star->getIndexI()][star->getIndexJ()] = nullptr;
		star->removeFromParentAndCleanup(true);
		return;
	}
	clearOneByOne =false;
	//COMBO效果
	showComboEffect(selectedListSize,this);
	m_layer->showLinkNum(selectedListSize);
	selectedListSize=0;
	acceptTouch =true;
	adjustMatrix();
	if(isEnded()){
		acceptTouch=false;
		m_layer->hideProps();
		m_layer->floatLeftStarMsg(getLeftStarNum());//通知layer弹出剩余星星的信息
		CCLOG("ENDED");
	}
}
开发者ID:joyfish,项目名称:cocos2d,代码行数:28,代码来源:StarMatrix.cpp

示例13: showStarParticleEffect

void StarMatrix::deleteSelectedList()
{
	if(selectedList.size() <= 1)
	{
		m_layer->hideLinkNum();
		selectedList.at(0)->setSelected(false);
		return;
	}

	for(auto it = selectedList.begin();it != selectedList.end();it++)
	{
		Star* star = *it;

		showStarParticleEffect(star->getColor(),star->getPosition(),this);
		stars[star->getIndexI()][star->getIndexJ()] = nullptr;
		star->removeFromParentAndCleanup(true);

		Audio::getInstance()->playPop();
	}

	showComboEffect(selectedList.size(),this);
	Audio::getInstance()->playCombo(selectedList.size());

	refreshScore();
	m_layer->showLinkNum(selectedList.size());
	adjustMatrix();

	if(isEnded())
	{
		m_layer->floatLeftStarMsg(getLeftStarNum());
		CCLOG("ENDED");
	}

}
开发者ID:JiangWeiGitHub,项目名称:Cocos2d-X,代码行数:34,代码来源:StarMatrix.cpp

示例14: addStar

void addStar()
{
    char name[NAME_SZ] = "";
    long temp = 0;
    double lumin = 0, mass = 0, radius = 0;
    Star *newStar;

    if(strcmp(Star::filePath_, "") == 0)        //if no file is open, do nothing.
    {
        cout << "No file to write to, please load a file.\n";
        return;
    }
    cout << "Please enter the following information: \nName: ";
    cin >> name;
    newStar = new Star(name);       //instantiate star with name
    if(newStar == 0)        //Abort if memory allocation fails.
    {
        cout << "Memory allocation failed.\n";
        return;
    }
    cout << "Temperature: ";
    cin >> temp;
    newStar->SetTemperature(temp);
    cout << "Luminosity: ";
    cin >> lumin;
    newStar->SetLuminosity(lumin);
    cout << "Mass: ";
    cin >> mass;
    newStar->SetMass(mass);
    cout << "Radius: ";
    cin >> radius;
    newStar->SetRadius(radius);
    linkList.AddLinkToBack(newStar);        //add star to linked list
    newStar->AppendToFile();
}
开发者ID:cognar,项目名称:CS162A03,代码行数:35,代码来源:main.cpp

示例15: throw

StringPimpl Person2::getString() const
	throw(InternalProgrammerErrorException &)
{
	try
	{
		if(m_pimpl->m_atomic)
		{
			//This is an atomic element shortcut
			Star star;
			StringPimpl returnString = star.getString();
			return FrameworkFactory::getInstance()->getGraphBuilderFramework()->person2Substitute(returnString);
		}
		else
		{
			return FrameworkFactory::getInstance()->getGraphBuilderFramework()->person2Substitute(InnerTemplateListImpl::getString());
		}
	}
	catch(Exception &)
	{
		//Fatal exception occured"
		return StringPimpl();
	}
}
开发者ID:Tiger66639,项目名称:librebecca,代码行数:23,代码来源:Person2.cpp


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