Skip to content

Commit

Permalink
Merge branch 'mpd'
Browse files Browse the repository at this point in the history
  • Loading branch information
deseilligny committed Feb 1, 2024
2 parents 647998d + c478b1e commit 187e7d2
Show file tree
Hide file tree
Showing 6 changed files with 192 additions and 15 deletions.
Binary file modified MMVII/Doc/Communication/Inscrits.txt.dcd
Binary file not shown.
2 changes: 1 addition & 1 deletion MMVII/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ In MMVII directory:
To generate pdf doc
-------------------

Require latex: `sudo apt install texalive`
Require latex: `sudo apt install texlive`

In MMVII/Doc directory:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,22 @@

namespace MMVII
{
#if (0)

/* ********************************************************** */
/* */
/* cAppli_ImportGCP */
/* cAppli_ImportM32 */
/* */
/* ********************************************************** */

class cAppli_ImportMesImGCP : public cMMVII_Appli
class cAppli_ImportM32 : public cMMVII_Appli
{
public :
cAppli_ImportMesImGCP(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli & aSpec);
cAppli_ImportM32(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli & aSpec);
int Exe() override;
cCollecSpecArg2007 & ArgObl(cCollecSpecArg2007 & anArgObl) override ;
cCollecSpecArg2007 & ArgOpt(cCollecSpecArg2007 & anArgOpt) override ;

std::vector<std::string> Samples() const override;
// std::vector<std::string> Samples() const override;
private :

cPhotogrammetricProject mPhProj;
Expand All @@ -46,7 +45,7 @@ class cAppli_ImportMesImGCP : public cMMVII_Appli
int mComment;
};

cAppli_ImportMesImGCP::cAppli_ImportMesImGCP(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli & aSpec) :
cAppli_ImportM32::cAppli_ImportM32(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli & aSpec) :
cMMVII_Appli (aVArgs,aSpec),
mPhProj (*this),
mL0 (0),
Expand All @@ -55,16 +54,16 @@ cAppli_ImportMesImGCP::cAppli_ImportMesImGCP(const std::vector<std::string> & aV
{
}

cCollecSpecArg2007 & cAppli_ImportMesImGCP::ArgObl(cCollecSpecArg2007 & anArgObl)
cCollecSpecArg2007 & cAppli_ImportM32::ArgObl(cCollecSpecArg2007 & anArgObl)
{
return anArgObl
<< Arg2007(mNameFile ,"Name of Input File")
<< Arg2007(mFormat ,"Format of file as for ex \"SNSXYZSS\" ")
<< Arg2007(mFormat ,"Format of file as for ex \"SijXYZS\" ")
<< mPhProj.DPPointsMeasures().ArgDirOutMand()
;
}

cCollecSpecArg2007 & cAppli_ImportMesImGCP::ArgOpt(cCollecSpecArg2007 & anArgObl)
cCollecSpecArg2007 & cAppli_ImportM32::ArgOpt(cCollecSpecArg2007 & anArgObl)
{
return anArgObl
<< AOpt2007(mL0,"NumL0","Num of first line to read",{eTA2007::HDV})
Expand All @@ -73,15 +72,15 @@ cCollecSpecArg2007 & cAppli_ImportMesImGCP::ArgOpt(cCollecSpecArg2007 & anArgObl
}


int cAppli_ImportTiePMul::Exe()
int cAppli_ImportM32::Exe()
{
mPhProj.FinishInit();
std::vector<std::vector<std::string>> aVNames;
std::vector<std::vector<double>> aVNums;
std::vector<cPt3dr> aVXYZ,aVWKP;


MMVII_INTERNAL_ASSERT_tiny(CptSameOccur(mFormat,"XYNI")==1,"Bad format vs NIXY");
MMVII_INTERNAL_ASSERT_tiny(CptSameOccur(mFormat,"XYZij")==1,"Bad format vs NIXY");

ReadFilesStruct
(
Expand All @@ -90,6 +89,7 @@ int cAppli_ImportTiePMul::Exe()
aVNames,aVXYZ,aVWKP,aVNums,
false
);
#if (0)

size_t aRankI_InF = mFormat.find('I');
size_t aRankP_InF = mFormat.find('N');
Expand Down Expand Up @@ -138,10 +138,12 @@ int cAppli_ImportTiePMul::Exe()
delete aVecMTp;
}
SaveInFile(aSetSave,mFileSelIm+"."+GlobTaggedNameDefSerial());
#endif

return EXIT_SUCCESS;
}

#if (0)

std::vector<std::string> cAppli_ImportTiePMul::Samples() const
{
Expand Down
6 changes: 3 additions & 3 deletions MMVII/src/ConvertFormat/ImportTiepMul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class cAppli_ImportTiePMul : public cMMVII_Appli
std::vector<std::string> Samples() const override;
private :

bool mModeTieP;
bool mModeTieP; // Mode TieP vs Mode XY
cPhotogrammetricProject mPhProj;

// Mandatory Arg
Expand Down Expand Up @@ -69,7 +69,7 @@ cCollecSpecArg2007 & cAppli_ImportTiePMul::ArgObl(cCollecSpecArg2007 & anArgObl)
cCollecSpecArg2007 &
aRes = anArgObl
<< Arg2007(mNameFile ,"Name of Input File")
<< Arg2007(mFormat ,"Format of file as for ex \"SNSXYZSS\" ")
<< Arg2007(mFormat ,"Format of file as for ex \"SINSXYSS\" ")
;

if (mModeTieP)
Expand Down Expand Up @@ -246,7 +246,7 @@ cSpecMMVII_Appli TheSpec_ImportTiePMul

/*********************************************************************/
/* */
/* ImportTiePMul */
/* ImportMesImGCP */
/* */
/*********************************************************************/

Expand Down
2 changes: 2 additions & 0 deletions MMVII/src/Sensors/cRPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,8 @@ int cAppliTestImportSensors::Exe()
<< " GroundConsist=" << aPGr2-aPGr
<< " ImConsist=" << aPIm-aPIm2
<< "\n";

getchar();
}
/*
cPt3dr aPtGr3 = aDataRPC.ImageZToGround(aPIm2,aPtGr1.z());
Expand Down
173 changes: 173 additions & 0 deletions MMVII/src/Utils/uti_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,171 @@ int CptSameOccur(const std::string & aStr,const std::string & aStr0)
return aRes;
}

class cReadFilesStruct
{
public :

cReadFilesStruct( const std::string & aNameFile,const std::string & aFormat,
int aL0,int aLastL, int aComment);

void Read();

const std::vector<std::string> & VNameIm () const; ///< Accessor + Check init
const std::vector<std::string> & VNamePt () const; ///< Accessor + Check init
const std::vector<cPt3dr> & VXYZ () const; ///< Accessor + Check init
const std::vector<cPt2dr> & Vij () const; ///< Accessor + Check init
const std::vector<cPt3dr> & VWPK () const; ///< Accessor + Check init
const std::vector<std::vector<double>> & VNums () const; ///< Accessor + Check init

private :
template <class Type> inline const std::vector<Type> & GetVect(const std::vector<Type> & aV) const
{
MMVII_INTERNAL_ASSERT_tiny((int)aV.size()==mNbLineRead,"cReadFilesStruct::GetV");
return aV;
}
// ============== copy of constructor parameters ===================

std::string mNameFile; /// name of file
std::string mFormat; /// format of each line
int mL0; /// num of first line
int mLastL; /// num of last line
int mComment; /// carac used for comment if any

int mNbLineRead; /// count number of line

std::vector<std::string> mVNameIm;
std::vector<std::string> mVNamePt;
std::vector<cPt3dr> mVXYZ;
std::vector<cPt2dr> mVij;
std::vector<cPt3dr> mVWPK;
std::vector<std::vector<double>> mVNums;
};

cReadFilesStruct::cReadFilesStruct
(
const std::string & aNameFile,
const std::string & aFormat,
int aL0,
int aLastL,
int aComment
) :
mNameFile (aNameFile),
mFormat (aFormat),
mL0 (aL0),
mLastL ((aLastL<0) ? 1000000 : mLastL),
mComment (aComment)
{
}



// const std::vector<std::vector<std::string>>& cReadFilesStruct::VNames () const { return GetVect(mVNames); }
const std::vector<cPt3dr>& cReadFilesStruct::VXYZ () const { return GetVect(mVXYZ); }
const std::vector<cPt3dr>& cReadFilesStruct::VWPK () const { return GetVect(mVWPK); }
const std::vector<cPt2dr>& cReadFilesStruct::Vij () const { return GetVect(mVij); }
const std::vector<std::vector<double>> & cReadFilesStruct::VNums () const {return GetVect(mVNums);}


void cReadFilesStruct::Read()
{
CurFile = mNameFile;

/*
if (CheckFormat)
{
CptSameOccur(aFormat,"NXYZ");
}
*/


mVNameIm.clear();
mVNamePt.clear();
mVXYZ.clear();
mVij.clear();
mVWPK.clear();
mVNums.clear();

if (! ExistFile(mNameFile))
{
MMVII_UsersErrror(eTyUEr::eOpenFile,std::string("For file ") + mNameFile);
}
std::ifstream infile(mNameFile);

std::string line;
mNbLineRead = 0;
int aNumL = 0;
while (std::getline(infile, line))
{
// JOE
MMVII_DEV_WARNING("Dont understand why must add \" \" at end of line ReadFilesStruct");
line += " ";
CurLine = aNumL+1; // editor begin at line 1, non 0
if ((aNumL>=mL0) && (aNumL<mLastL))
{
std::istringstream iss(line);
int aC0 = iss.get();
if (aC0 != mComment)
{
mNbLineRead++;
iss.unget(); // as C0 is not a comment it will have to be parsed (!!=> Ok because there is only one)

std::vector<double> aLNum;
cPt3dr aXYZ = cPt3dr::Dummy();
cPt3dr aWPK = cPt3dr::Dummy();
cPt2dr aij = cPt2dr::Dummy();
std::string aNameIm;
std::string aNamePt;
// std::string aNamePt;

int initXYZ=0;
int initWPK=0;
int initF=0;
int initij=0;
int initIm=0;
int initPt=0;


for (const auto & aCar : mFormat)
{
switch (aCar)
{
case 'F' : aLNum.push_back(GetV<tREAL8>(iss)); initF++; break;
case 'X' : aXYZ.x() = GetV<tREAL8>(iss); initXYZ++; break;
case 'Y' : aXYZ.y() = GetV<tREAL8>(iss); initXYZ++; break;
case 'Z' : aXYZ.z() = GetV<tREAL8>(iss); initXYZ++; break;

case 'W' : aWPK.x() = GetV<tREAL8>(iss); initWPK++; break;
case 'P' : aWPK.y() = GetV<tREAL8>(iss); initWPK++; break;
case 'K' : aWPK.z() = GetV<tREAL8>(iss); initWPK++; break;

case 'i' : aij.x() = GetV<tREAL8>(iss); initij++; break;
case 'j' : aij.y() = GetV<tREAL8>(iss); initij++; break;

case 'N' : aNamePt = GetV<std::string>(iss); initPt++; break;
case 'I' : aNameIm = GetV<std::string>(iss); initIm++; break;
case 'S' : GetV<std::string>(iss); break;

default :
MMVII_INTERNAL_ERROR(std::string(("Unhandled car in cReadFilesStruct::Read=") + aCar)+"]");
break;
}
}
if (initXYZ) mVXYZ.push_back(aXYZ);
if (initWPK) mVWPK.push_back(aWPK);
if (initij) mVij.push_back(aij);
if (initF) mVNums.push_back(aLNum);
if (initIm) mVNameIm.push_back(aNameIm);
if (initPt) mVNamePt.push_back(aNamePt);
}
}
aNumL++;
}
}





void ReadFilesStruct
(
const std::string & aNameFile,
Expand Down Expand Up @@ -287,10 +452,14 @@ line += " ";
case 'X' : aXYZ.x() = GetV<tREAL8>(iss); break;
case 'Y' : aXYZ.y() = GetV<tREAL8>(iss); break;
case 'Z' : aXYZ.z() = GetV<tREAL8>(iss); break;

case 'W' : aWKP.x() = GetV<tREAL8>(iss); break;
case 'P' : aWKP.y() = GetV<tREAL8>(iss); break;
case 'K' : aWKP.z() = GetV<tREAL8>(iss); break;

// case 'i' : aWKP.x() = GetV<tREAL8>(iss); break;
// case 'j' : aWKP.y() = GetV<tREAL8>(iss); break;

case 'N' : aLNames.push_back(GetV<std::string>(iss)); break;
case 'I' : aLNames.push_back(GetV<std::string>(iss)); break;
case 'A' : aLNames.push_back(GetV<std::string>(iss)); break;
Expand All @@ -310,6 +479,10 @@ line += " ";
}
}





void ReadFilesNum (const std::string & aNameFile,const std::string & aFormat,std::vector<std::vector<double>> & aVRes,int aComment)
{
std::vector<cPt3dr> aVXYZ;
Expand Down

0 comments on commit 187e7d2

Please sign in to comment.