Exemple #1
0
void bench_delaunay()
{
    Pt2di sz (950,950);

    Disc_Pal       Pdisc  = Disc_Pal::P8COL();

    Elise_Set_Of_Palette SOP(NewLElPal(Pdisc));
    Video_Display Ecr((char *) NULL);
    Ecr.load(SOP);                         
    Video_Win   W  (Ecr,SOP,Pt2di(50,50),sz);  


    for (INT nb = 100; nb < 500 ; nb +=50)
    {

       std::list<PtDelTest> L;
       ElFilo<PtDelTest> Pts;

       for (INT k= 0; k< nb; k++)
       {
           PtDelTest pt
                     (
                             (INT)(  10 + (sz.x -20) * NRrandom3()),
                             (INT)(  10 + (sz.y -20) * NRrandom3())
                     );
            // Pts.pushlast(pt);
            L.push_back(pt);
            //W.draw_circle_loc(pt.pt(),4,Pdisc(P8COL::red));
            W.draw_circle_loc(Pt2dr(pt.pt()),4,Pdisc(P8COL::red)); // __NEW
       }
       DelTestAct Act(W);
       Delaunay_Mediatrice 
       (
             L.begin(),
             L.end(),
             Pt_of_DPT,
             Act,
	     200.0,
            (PtDelTest *) 0
       );

       // W.clik_in();
       W.clear();
    }
}
std::vector<Pt2dr> cICL_Courbe::GetPoly(INT NbPtsMax,bool ForceLosange)
{
    ELISE_ASSERT(pW!=0,"cICL_Courbe::GetPoly()");
    static bool First = true;
    if (! First)
        pW->clik_in();
    First = false;
    pW->clear();
    pW->draw_circle_loc
    (
        ToLoc(Pt2dr(0,0)),
        mScale,
        pW->pdisc()(P8COL::red)
    );
    std::vector<Pt2dr> aRes;

    while (true)
    {
        Clik aCl = pW->clik_in();
	Pt2dr aP = (Pt2dr(aCl._pt)-mP0) / mScale;

	if (NbPtsMax-1 == INT(aRes.size()))
            aCl._b = 3;

	if (ForceLosange && (aRes.size()==3))
        {
            aP = aRes[0]+ aRes[2] - aRes[1];
            aCl._b = 3;
	}
        pW->draw_circle_loc(ToLoc(aP),3.0,pW->pdisc()(P8COL::green));
        
	 if (! aRes.empty())
            pW->draw_seg(ToLoc(aRes.back()),ToLoc(aP),pW->pdisc()(P8COL::green));

	 aRes.push_back(aP);

	 if (aCl._b == 3)
	 {
            pW->draw_seg(ToLoc(aRes[0]),ToLoc(aP),pW->pdisc()(P8COL::green));
	    return aRes;
	 }
    }
    return aRes;
}
void TestXmlX11()
{
    Video_Win aW =  Video_Win::WStd(Pt2di(700,800),1.0);
     
    cElXMLTree aFullTreeParam("EnvVino.xml");
    cWXXVinoSelector aSelector("FXDiv10.tif");
    cElXMLTree aFilter("FilterVino.xml");

    cWindowXmlEditor aWX(aW,true,aFullTreeParam.Fils().front(),&aSelector,&aFilter);

    // cWXXTreeSelector aSelId;
  
    aWX.TopDraw();
    aWX.Interact();

    aW.clear(); aW.clik_in();


    aWX.TopDraw();
    aWX.Interact();

    aFullTreeParam.StdShow("SORTIE.xml");

}