Skip to content

Commit

Permalink
SysCo cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmuller committed May 15, 2024
1 parent f1c36ad commit a9533b1
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 69 deletions.
6 changes: 3 additions & 3 deletions MMVII/Doc/CommandReferences/SysCo.tex
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ \subsection{MMVII Commands}
\end{itemize}

\subsection{SysCo definition}
The SysCo names to give to {\tt MMVII} commands can be:
The SysCo definitions to give to {\tt MMVII} commands can be:
\begin{itemize}
\item The name of a file in source sub-folder {\tt MMVII/MMVII-RessourceDir/SysCo} or in project sub-folder {MMVII-PhgrProj/SysCo}, without its extension.
\item Any {\tt libproj} definition (such as {\tt IGNF:LAMB93} or {\tt EPSG:4326})
Expand All @@ -56,9 +56,9 @@ \subsection{Examples}
\begin{itemize}
\item {\tt SysCo=L93} will set the SysCo to Lambert93 (IGNF:LAMB93), as definied in \\
{\tt MMVII/MMVII-RessourceDir/SysCo/L93.xml}.
\item {\tt SysCo=LocalPanel} will set the SysCo to a local system named "LocalPanel", that will not be convertible into any other SysCo.
\item {\tt SysCo=LocalPanel} will set the SysCo to a local system definied as "LocalPanel", that will not be convertible into any other SysCo.
\item {\tt SysCo=IGNF:LAMB93} will set the SysCo to Lambert93.
\item {\tt SysCo=RTL*0.67451979*45.18899334*0*EPSG:4326} will set the SysCo to a local euclidian frame where origin is $0.67451979, 45.18899334, 0$ in EPSG:4326.
\item {\tt SysCo=RTL*0.67451979*45.18899334*0*EPSG:4326} will set the SysCo to a tangent local euclidian frame where origin is $0.67451979, 45.18899334, 0$ in EPSG:4326.
\item {\tt SysCo=Toto} will use a project-defined SysCo if {MMVII-PhgrProj/SysCo/Toto.xml} exists. If not, "Toto" will be used as a libproj definition, and an error will occur.
\item {\tt SysCo=GeoC} will set the SysCo to geocentric coordinates.

Expand Down
2 changes: 1 addition & 1 deletion MMVII/MMVII-RessourceDir/SysCo/Geog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Version>"0.0.0"</Version>
<Data>
<SysCoData>
<Name>"+proj=latlong"</Name>
<Def>"+proj=latlong"</Def>
</SysCoData>
</Data>
</Root>
2 changes: 1 addition & 1 deletion MMVII/MMVII-RessourceDir/SysCo/L93.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Version>"0.0.0"</Version>
<Data>
<SysCoData>
<Name>"IGNF:LAMB93"</Name>
<Def>"IGNF:LAMB93"</Def>
</SysCoData>
</Data>
</Root>
2 changes: 1 addition & 1 deletion MMVII/include/MMVII_DeclareCste.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ extern const std::string MMVII_StdDest; ///< For destination parameter (TieP
extern const std::string MMVII_PrefRefBench; ///< Prefix for file used as reference in bench

extern const std::string MMVII_SysCoLocal; ///< Prefix for SysCo type
extern const std::string MMVII_SysCoLGeo; ///< Prefix for SysCo type
extern const std::string MMVII_SysCoLGeo; ///< Prefix for SysCo type
extern const std::string MMVII_SysCoRTL; ///< Prefix for SysCo type
extern const std::string MMVII_SysCoGeoC; ///< Prefix for SysCo type
extern const std::string MMVII_SysCoDefLatLong; ///< Definition for latlong
Expand Down
17 changes: 9 additions & 8 deletions MMVII/include/MMVII_SysCo.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace MMVII
class cSysCoData
{
public :
std::string mName; //< name / def
std::string mDef; //< definition
void AddData(const cAuxAr2007 & anAuxInit);
};

Expand All @@ -31,7 +31,8 @@ void AddData(const cAuxAr2007 & anAux, cSysCoData & aSysCoData);
*
* SysCo definitions are like this:
* "type*param1*param2*..."
* It is interpreted by the factory MakeSysCo() to create an object of the corresponding concrete class
* They entirely define a SysCo and are interpreted by the factory MakeSysCo() to create an object of the corresponding concrete class.
* The definitions are retrieved by command line argument or by deserialization of a cSysCoData.
*/
class cSysCo : public cDataInvertibleMapping<tREAL8,3>
{
Expand All @@ -43,22 +44,22 @@ public :
virtual tPt Inverse(const tPt &) const override = 0; //< from GeoC

virtual cRotation3D<tREAL8> getVertical(const tPt &) const; //< get rotation from SysCo origin to vertical at this point
virtual tREAL8 getRadiusApprox(const tPt &in) const;
virtual tREAL8 getDistHzApprox(const tPt & aPtA, const tPt & aPtB) const;
virtual tREAL8 getRadiusApprox(const tPt &in) const; //< approximate earth total curvature radius at a point
virtual tREAL8 getDistHzApprox(const tPt & aPtA, const tPt & aPtB) const; //< approximate horizontal distance (along ellipsoid) from one point to an other

static tPtrSysCo MakeSysCo(const std::string &aDef); //< factory from a sysco definition
static tPtrSysCo makeRTL(const cPt3dr & anOrigin, const std::string & aSysCoNameIn);
static tPtrSysCo makeRTL(const cPt3dr & anOrigin, const std::string & aSysCoInDef);
static tPtrSysCo FromFile(const std::string &aNameFile);

std::string Name() const { return mName; }
std::string Def() const { return mDef; }
cSysCoData toSysCoData();

eSysCo getType() const { return mType; }
bool isEuclidian() const;
protected :
cSysCo();
cSysCo(const std::string & def);
std::string mName; //< name / def
std::string mDef; //< definition
eSysCo mType;
static PJ* PJ_GeoC2Geog; //< for generic use
};
Expand All @@ -71,7 +72,7 @@ protected :
* Value() goes from mSysCoInit to mSysCoTarget
* Inverse() goes from mSysCoTarget to mSysCoInit
*
* It works with local cSysCo only if both have the same name.
* It works with cSysCoLocal only if both have the same definition.
* */
class cChangeSysCo : public cDataInvertibleMapping<tREAL8,3>
{
Expand Down
4 changes: 2 additions & 2 deletions MMVII/src/Sensors/cChangCoSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ cChSysSensImage::cChSysSensImage
{
mDirSensInit = aDirSens;
mNameImage = aSensInit->NameImage();
mSysCoOri = aChSys.SysOrigin()->Name();
SetCoordinateSystem(aChSys.SysTarget()->Name());
mSysCoOri = aChSys.SysOrigin()->Def();
SetCoordinateSystem(aChSys.SysTarget()->Def());

cChangCoordSensImage::CCSI_SetSensorAndMap(aSensInit,new cChangeSysCo(aChSys),false /* delete sens*/);
}
Expand Down
5 changes: 0 additions & 5 deletions MMVII/src/Sensors/cPhotogrammetricProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,6 @@ void cPhotogrammetricProject::FinishInit()
CreateDirectories(mDirSysCo,false);
CreateDirectories(mDirImportInitOri,false);

// cPt3dr aZeroNDP(652215.52,6861681.77,35.6);
// SaveSysCo(CreateSysCoRTL(aZeroNDP,"Lambert93"),"RTL_NotreDame");
// maintain it, who knows, but now replaced by
// SaveSysCo(cSysCoordV2::Lambert93(),E2Str(eSysCoGeo::eLambert93),true);
// SaveSysCo(cSysCoordV2::GeoC() ,E2Str(eSysCoGeo::eGeoC) ,true);
}


Expand Down
30 changes: 15 additions & 15 deletions MMVII/src/SysCo/CreateRTL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ private :

// Mandatory Arg
std::string mSpecIm;
std::string mNameSysIn;
std::string mNameSysOut;
std::string mDefSysCoIn;
std::string mDefSysCoOut;

// Optional Arg
cPt3dr mOrigin;
Expand All @@ -55,21 +55,21 @@ cCollecSpecArg2007 & cAppli_CreateRTL::ArgObl(cCollecSpecArg2007 & anArgObl)
{
return anArgObl
<< Arg2007(mSpecIm ,"Name of Input File",{{eTA2007::MPatFile,"0"},{eTA2007::FileDirProj}})
<< Arg2007(mNameSysOut ,"Output coordinate system")
<< Arg2007(mDefSysCoOut ,"Output coordinate system name")
;
}

cCollecSpecArg2007 & cAppli_CreateRTL::ArgOpt(cCollecSpecArg2007 & anArgObl)
{

return anArgObl
<< mPhProj.DPOrient().ArgDirInOpt()
// << mPhProj.DPOrient().ArgDirOutOpt()
<< mPhProj.DPPointsMeasures().ArgDirInOpt()
return anArgObl
<< mPhProj.DPOrient().ArgDirInOpt()
// << mPhProj.DPOrient().ArgDirOutOpt()
<< mPhProj.DPPointsMeasures().ArgDirInOpt()
<< AOpt2007(mOrigin,"Origin","Force origin of RTL Measures",{{}})
<< AOpt2007(mZ0,"Z0","Force altitute of RTL Measures",{{}})
<< AOpt2007(mEpsDer,"EpsDer","Epislon 4 computing derivative",{{eTA2007::HDV}})
<< AOpt2007(mNameSysIn ,"SysIn" ,"Input coordinate system (default from GCP or Orient)")
<< AOpt2007(mDefSysCoIn ,"SysIn" ,"Input coordinate system (default from GCP or Orient)")
;
}

Expand All @@ -82,12 +82,12 @@ int cAppli_CreateRTL::Exe()
bool isInitSens =false;
bool isInitGCP =false;

std::string aNameSyIn;
std::string aDefSysCoIn;
if (mPhProj.DPOrient().DirInIsInit())
{
auto aSysIn = mPhProj.CurSysCoOri(true);
if (aSysIn.get())
aNameSyIn = aSysIn->Name();
aDefSysCoIn = aSysIn->Def();

for (const auto & aNameIm : VectMainSet(0))
{
Expand All @@ -110,7 +110,7 @@ int cAppli_CreateRTL::Exe()
{
auto aSysIn = mPhProj.CurSysCoGCP(true);
if (aSysIn.get())
aNameSyIn = aSysIn->Name();
aDefSysCoIn = aSysIn->Def();

mPhProj.LoadGCP(aMesIm);
for (const auto & aGCP : aMesIm.MesGCP())
Expand All @@ -119,7 +119,7 @@ int cAppli_CreateRTL::Exe()
isInitGCP = true;
}
}
SetIfNotInit(mNameSysIn,aNameSyIn);
SetIfNotInit(mDefSysCoIn,aDefSysCoIn);

if (! IsInit(&mOrigin))
{
Expand All @@ -137,9 +137,9 @@ int cAppli_CreateRTL::Exe()
mOrigin.z() = mZ0;


tPtrSysCo aSysRTL = mPhProj.CreateSysCoRTL(mOrigin,mNameSysIn);
tPtrSysCo aSysRTL = mPhProj.CreateSysCoRTL(mOrigin,mDefSysCoIn);

mPhProj.SaveSysCo(aSysRTL,mNameSysOut);
mPhProj.SaveSysCo(aSysRTL,mDefSysCoOut);


return EXIT_SUCCESS;
Expand All @@ -148,7 +148,7 @@ int cAppli_CreateRTL::Exe()

std::vector<std::string> cAppli_CreateRTL::Samples() const
{
return {"MMVII SysCoCreateRTL VolAllIm.xml Lambert93 RTLProj InOri=InitUPCalVol OutOri=RTLInitUPCalVol Z0=0 EpsDer=200"};
return {"MMVII SysCoCreateRTL AllIM.xml RTL InOri=SatWGS84 z0=0"};
}


Expand Down
Loading

0 comments on commit a9533b1

Please sign in to comment.