Example #1
0
void WizardPageController::applyLayout() {
    wc->clearControllers();
    qDeleteAll(controllers);
    controllers.clear();
    QLayout *old = wPage->layout();
    removeLayout(old);

    U2OpStatusImpl os;
    page->validate(wc->getCurrentActors(), os);
    if (os.hasError()) {
        coreLog.error(os.getError());
        setError(wPage);
        return;
    }

    PageContentCreator pcc(wc);
    page->getContent()->accept(&pcc);
    if (wc->isBroken()) {
        setError(wPage);
        return;
    }
    pcc.setPageTitle(page->getTitle());
    wPage->setLayout(pcc.getResult());
    controllers << pcc.getControllers();

    wPage->setFinalPage(page->isFinal());
}
Example #2
0
void FreeForAllGameModeSystem::OnStartGameMode( core::StartGameModeEvent const& Evt )
{
    if ( Evt.mMode != "ffa" )
    {
        return;
    }
    ::engine::Engine::Get().SetEnabled< ::engine::SoldierSpawnSystem>( true );
    ::engine::Engine::Get().SetEnabled< ::engine::ctf::CtfSoldierSpawnSystem>( false );
    ::engine::Engine::Get().SetEnabled< ::map::EditorSoldierSpawnSystem>( false );
    ::engine::Engine::Get().SetEnabled< ::map::RoomEditorSystem>( false );
    ::engine::Engine::Get().SetEnabled< ::map::EditorSystem>( false );
    ::engine::Engine::Get().SetEnabled< ::map::EditorTargetSystem>( false );
    ::engine::Engine::Get().SetEnabled< ::map::EditorGridSystem>( false );
    ::engine::Engine::Get().SetEnabled< ::map::EditorBrushSystem>( false );
    ::engine::Engine::Get().SetEnabled< ::core::FreeForAllGameModeSystem>( true );
    ::engine::Engine::Get().SetEnabled< ::core::CaptureTheFlagGameModeSystem>( false );
    ::engine::Engine::Get().SetEnabled< ::core::RogueGameModeSystem>( false );

    auto levelSelectionSystem = engine::Engine::Get().GetSystem<LevelSelectionSystem>();
    if ( levelSelectionSystem.IsValid() )
    {
        mScene.Load( levelSelectionSystem->GetSelectedLevel() );
    }
    else
    {
        L1("failed to retrieve LevelSelectionSystem\n");
        return;
    }
    //    glfwSetInputMode(engine::Engine::Get().GetSystem<engine::WindowSystem>()->GetWindow(),GLFW_CURSOR,GLFW_CURSOR_HIDDEN);
    Ui::Get().Load( "hud" );
    if ( ProgramState::Get().mMode == ProgramState::Client )
    {
        return;
    }

    if ( ProgramState::Get().mMode != ProgramState::Local )
    {
        return;
    }

    std::auto_ptr<Actor> Pl;
    for( int i = 0; i < 11; ++i )
    {
        Pl = ActorFactory::Get()( AutoId( "player" ) );

        Opt<IPositionComponent> positionC = Pl->Get<IPositionComponent>();
        positionC->SetX( -240 + i * 60 );
        positionC->SetY( 0.0 );
        Pl->Get<IInventoryComponent>();
        Opt<IInventoryComponent> inventoryC = Pl->Get<IInventoryComponent>();
        inventoryC->AddItem( AutoId( "plasma_gun" ) );
        inventoryC->SetSelectedWeapon( AutoId( "plasma_gun" ) );
        Opt<PlayerControllerComponent> pcc( Pl->Get<IControllerComponent>() );
        pcc->SetEnabled( false );
        pcc->mActive = false;
        pcc->mControllerId = i;
        Pl->Get<IMoveComponent>()->SetMoving( false );
        mScene.AddActor( Pl.release() );
    }
}
void GxsCommentTreeWidget::replyToComment()
{
	RsGxsGrpMsgIdPair msgId;
	msgId.first = mThreadId.first;
	msgId.second = mCurrentMsgId;
	GxsCreateCommentDialog pcc(mTokenQueue, mCommentService, msgId, mThreadId.second, this);
	pcc.exec();
}
Example #4
0
void PolygonClipTask::clipCircle(std::size_t k, std::size_t size) {
	std::size_t _crossCount = 0;						//相交数
	std::size_t _crossPointCount = 0;					//相交交点数
	std::size_t _noCrossCount = 0;						//无交点数
	std::size_t _insideCount = 0;						//界内数
	std::size_t _outsiedCount = 0;						//界外数

	std::vector<std::vector<std::pair<std::uint32_t, std::uint32_t>>> vec;
	vec.resize(9);
	for (size_t i = 0; i < 8; i++) {
		vec[i].reserve(600);
	}
	vec[8].reserve(6400);

	ClipCircleResult circleResult;
	auto end = k + size;
	for (std::size_t i = k; i < end; ++i) {
		PolygonCircleClip pcc(&boundary, &circles[i]);
		pcc.GetClipResult(circleResult);

		if (circleResult.relation == Relation::Inside)//在内部
		{
			_noCrossCount++;
			_insideCount++;
			Drawer::DrawCircle1(memoryBitmap_,
				std::uint32_t(circles[i].center.x), std::uint32_t(circles[i].center.y), std::uint32_t(circles[i].radius),
				MemoryBitmap::kBlueColor);
			continue;
		}
		if (circleResult.relation == Relation::Intersect) {
			_crossCount++;
			_crossPointCount += circleResult.clippedArgs.size() * 2;

			//Drawer::FillCircle2(vec, circles[i].center.x, circles[i].center.y, circles[i].radius);

			for (std::size_t j = 0; j < circleResult.clippedArgs.size(); j++) {
				//drawArc(circleResult.clippedArgs[j].startAngle, circleResult.clippedArgs[j].endAngle, vec);
				Drawer::DrawArc3(
					memoryBitmap_, 
					circles[i].center.x, circles[i].center.y, circles[i].radius, 
					circleResult.clippedArgs[j].startAngle, circleResult.clippedArgs[j].endAngle,
					MemoryBitmap::kBlueColor
					);
			}
		}
		else {
			_noCrossCount++;
			_outsiedCount++;
		}
	}

	std::lock_guard<std::mutex> lock(drawMutex_);
	crossCount += _crossCount;
	crossPointCount += _crossPointCount;
	noCrossCount += _noCrossCount;
	insideCount += _insideCount;
	outsiedCount += _outsiedCount;
}
int main(){
    struct node *head,*p1,*p2;
    FILE *fp;
    int i,j;
    float r;
    struct node *creat(struct node *head);
    int cal();
    float pcc(float a[NC],float b[NC]);
    //introduction and "do's and don'ts"
    printf("Welcome to use the PCC calculating software pcc.cpp!\n");
    printf("pcc.cpp is used for calculating the PCC for a series of gene samples,");
    printf("and the output format will be:\n");
    printf("gene1\tgene2\tpcc\n");
    printf("gene1\tgene3\tpcc\n");
    printf("......\n");
    printf("            ATTENTION!!!!There are some tips you must follow:\n");
    printf("1.The format of your datafile must be like this:\n");
    printf("ID\t*.txt\t*.txt\t*.txt...\n");
    printf("gene1\tsample1\tsample2\tsample3...\n");
    printf("gene2\tsample1\tsample2\tsample3...\n");
    printf("...................................\n");
   printf("2.Name of genes must be short than 15 chracters,otherwise change '#define NAME 15' at top of the source program.\n");
    printf("3.The samples should be small than 200,otherwise change '#define NC 200' at top the the source program.\n");
    //main body begins
    printf("Please enter 'Y' if you accept all the appoint above.\n");
    if(getchar()=='Y')
       printf("Now please enter route and name of your datafile,such as:  F:/data.txt\n");
    else return 0;
    scanf("%s",&infile);
    printf("Now please enter route and name of file you want to write the results in,such as:   F:/result.txt\n");
    scanf("%s",&outfile);
    //bulding of list
    cal();
    head=NULL;
    head=creat(head);
    p1=p2=(struct node*)malloc(sizeof(struct node));
    p1=p2=head;
    //output
    if((fp=fopen(outfile,"w+"))==NULL){
        printf("cannot open file.\n");
        return 0;
    }
    while(p1->next!=NULL){
        p2=p1->next;
        while(p2!=NULL){
        r=pcc(p1->sample,p2->sample);
        fprintf(fp,"%s\t%s\t",p1->name,p2->name);
        fprintf(fp,"%f\n",r);
        p2=p2->next;
        }
        p1=p1->next;
 }
 fclose(fp);
 return 0;
}
//==============================================================================
bool RPURU::loadReflectedProperties(UndoRedoHelperList& outPropertyCache, ISerializer& undoSerializer,
                                    ISerializer& redoSerializer, IObjectManager& objectManager,
                                    IDefinitionManager& definitionManager)
{
	PropertyCacheCreator pcc(outPropertyCache);
	const bool undoSuccess =
	loadReflectedProperties(pcc, undoSerializer, &undoPropertySetter, objectManager, definitionManager);

	PropertyCacheIterator pci(outPropertyCache);
	const bool redoSuccess =
	loadReflectedProperties(pci, redoSerializer, &redoPropertySetter, objectManager, definitionManager);

	return (undoSuccess && redoSuccess);
}
void GxsCommentTreeWidget::makeComment()
{
	GxsCreateCommentDialog pcc(mTokenQueue, mCommentService, mThreadId, mThreadId.second, this);
	pcc.exec();
}