Esempio n. 1
0
void dump(const cFileOriMnt &aFileOriMnt, const string &aPrefix = string(), ostream &aStream = cout)
{
	aStream << aPrefix << "NameFileMnt     = [" << aFileOriMnt.NameFileMnt() << ']' << endl;
	if (aFileOriMnt.NameFileMasque().IsInit()) aStream << aPrefix << "NameFileMasque  = [" << aFileOriMnt.NameFileMasque().Val() << ']' << endl;
	aStream << aPrefix << "NombrePixels    = " << aFileOriMnt.NombrePixels() << endl;
	aStream << aPrefix << "OriginePlani    = " << aFileOriMnt.OriginePlani() << endl;
	aStream << aPrefix << "ResolutionPlani = " << aFileOriMnt.ResolutionPlani() << endl;
	aStream << aPrefix << "OrigineAlti     = " << aFileOriMnt.OrigineAlti() << endl;
	aStream << aPrefix << "ResolutionAlti  = " << aFileOriMnt.ResolutionAlti() << endl;
	if (aFileOriMnt.NumZoneLambert().IsInit()) aStream << aPrefix << "NumZoneLambert  = " << aFileOriMnt.NumZoneLambert().Val() << endl;
	aStream << aPrefix << "Geometrie       = " << eToString(aFileOriMnt.Geometrie()) << endl;
	if (aFileOriMnt.OrigineTgtLoc().IsInit()) aStream << aPrefix << "OrigineTgtLoc  = " << aFileOriMnt.OrigineTgtLoc().Val() << endl;
	if (aFileOriMnt.Rounding().IsInit()) aStream << aPrefix << "Rounding  = " << aFileOriMnt.Rounding().Val() << endl;
}
Fonc_Num  AdaptFonc2FileOriMnt
          (
                 const std::string & aContext,
                 const cFileOriMnt & anOriCible,
                 const cFileOriMnt &  aOriInit,
                 Fonc_Num            aFonc,
                 bool                aModifDyn,
                 double              aZOffset,
                 const Pt2dr &       CropInOriCible

          ) 
{
    if (! SameGeometrie(aOriInit,anOriCible))
    {
       cElWarning::GeomIncompAdaptF2Or.AddWarn
       (
            aContext,
             __LINE__,
             __FILE__
       );
       // std::cout  << "Geometrie incompatible Cible/Xml, AdaptFoncFileOriMnt\n" ;
    }


    Pt2dr aSxyC = anOriCible.ResolutionPlani();
    Pt2dr aSxyI = aOriInit.ResolutionPlani();

    double aSx = aSxyC.x / aSxyI.x;
    double aSy = aSxyC.y / aSxyI.y;

    if ((aSx<=0) || (aSy <=0))
    {
        std::cout << "Context = " << aContext << "\n";
        ELISE_ASSERT
        (
            false,
            "Signe incompatibles dans AdaptFoncFileOriMnt"
        );
    }

    Pt2dr aTr = anOriCible.OriginePlani() -  aOriInit.OriginePlani();

// std::cout << aTr << CropInOriCible << aSxyI << " " << aSx << "\n";
    aTr =  Pt2dr(aTr.x/aSxyI.x,aTr.y/aSxyI.y);
    aTr =  aTr +CropInOriCible.mcbyc(Pt2dr(aSx,aSy));

    aFonc =  StdFoncChScale_Bilin
             (
                  aFonc,
                  aTr,
                  // Pt2dr(aTr.x/aSxyI.x,aTr.y/aSxyI.y) + CropInOriCible,
                  Pt2dr(aSx,aSy)
             );

    if (aModifDyn)
    {
       double aZ0I = aOriInit.OrigineAlti();
       double aZ0C = anOriCible.OrigineAlti();
       double aStZC = anOriCible.ResolutionAlti();
       double aStZI = aOriInit.ResolutionAlti();
       aFonc = (aZOffset+ aZ0I-aZ0C)/aStZC + (aStZI/aStZC)*aFonc;
    }

    return aFonc;
}