Skip to content

Commit

Permalink
Initial topds4 app and cmake updates to include inja (#4207)
Browse files Browse the repository at this point in the history
* Removed compile and deprication warnings. Fixes #4110

* temp add of to pds 4 test

* Inintal topds4 app and cmake updates to include inja

* Delete extra headers

* Fixed inja include

Co-authored-by: ssides <ssides@usgs.gov>
  • Loading branch information
kberryUSGS and scsides committed Dec 17, 2020
1 parent 67b7713 commit 1631994
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 0 deletions.
1 change: 1 addition & 0 deletions isis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ find_package(Kakadu)
find_package(Geos 3.5.0 REQUIRED)
find_package(Armadillo REQUIRED)
find_package(Threads)
find_package(Inja REQUIRED)


# In this case, we specify the version numbers being searched for in the non-traditional installs.
Expand Down
14 changes: 14 additions & 0 deletions isis/cmake/FindInja.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# CMake module for find_package(Inja)
# Finds include directory and all applicable libraries
#
# Sets the following:
# INJA_INCLUDE_DIR
# INJA_LIBRARY

find_path(INJA_INCLUDE_DIR
NAME inja.hpp
PATH_SUFFIXES "inja"
)

message(STATUS "INJA INCLUDE DIR: " ${INJA_INCLUDE_DIR} )

12 changes: 12 additions & 0 deletions isis/src/base/apps/topds4/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "Isis.h"

#include "topds4.h"

using namespace std;
using namespace Isis;

void IsisMain() {
UserInterface &ui = Application::GetUserInterface();
PvlGroup results = topds4(ui);
Application::Log(results);
}
42 changes: 42 additions & 0 deletions isis/src/base/apps/topds4/topds4.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include <iostream>

#include <inja.hpp>

#include "topds4.h"

using namespace std;
using namespace inja;
using json = nlohmann::json;


namespace Isis {



PvlGroup topds4(UserInterface &ui) {
Cube *icube = new Cube();
icube->open(ui.GetFileName("FROM"));
return topds4(icube, ui);
}


PvlGroup topds4(Cube *cube, UserInterface &ui) {
Process p;
p.SetInputCube(cube);

Pvl &label = *cube->label();



json data;
data["name"] = "world";
render("Hello {{ name }}!", data); // Returns std::string "Hello world!"
render_to(std::cout, "Hello {{ name }}!", data); // Writes "Hello world!" to stream




std::cout << label << std::endl;
return label.findGroup("Dimensions", Pvl::Traverse);
}
}
18 changes: 18 additions & 0 deletions isis/src/base/apps/topds4/topds4.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef topds4_h
#define topds4_h

#include "Cube.h"
#include "Pvl.h"
#include "Process.h"
#include "SpecialPixel.h"
#include "LineManager.h"
#include "FileName.h"
#include "IException.h"
#include "UserInterface.h"

namespace Isis {
extern PvlGroup topds4(Cube* cube, UserInterface &ui);
extern PvlGroup topds4(UserInterface &ui);
}

#endif
63 changes: 63 additions & 0 deletions isis/src/base/apps/topds4/topds4.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>

<application name="topds4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://isis.astrogeology.usgs.gov/Schemas/Application/application.xsd">
<brief>
dummy
</brief>

<description>
dummy
</description>

<category>
<categoryItem>Trim and Mask</categoryItem>
</category>

<history>
<change name="Jeffrey Covington" date="2015-01-15">
Removed unreachable code.
</change>
</history>

<groups>
<group name="Files">
<parameter name="FROM">
<type>cube</type>
<fileMode>input</fileMode>
<brief>
Input cube
</brief>
<description>
This is the input cube that will be cropped.
</description>
<filter>
*.cub
</filter>
</parameter>

<parameter name="TEMPLATE">
<fileMode>input</fileMode>
<brief>
Input template
</brief>
<description>
Input template
</description>
<filter>
*
</filter>
</parameter>

<parameter name="TO">
<type>file</type>
<fileMode>output</fileMode>
<brief>
Output PDS4 label
</brief>
<description>
The.
</description>
</parameter>
</group>
</groups>
</application>

0 comments on commit 1631994

Please sign in to comment.