Skip to content

Commit

Permalink
Merge pull request BRL-CAD#12 from SP23-CSCE482/parameters
Browse files Browse the repository at this point in the history
Parameters
  • Loading branch information
allyhoskinson authored Mar 27, 2023
2 parents b19c113 + 2e94a47 commit 30cf31c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
17 changes: 4 additions & 13 deletions FactsHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,15 @@ void makeTopSection(IFPainter& img, InformationGatherer& info, int offsetX, int
img.drawRect(offsetX, offsetY, offsetX + width, offsetY + height, -1, cv::Scalar(0,0,0));

//Draw text on top
std::string owner = "Owner: " + info.getInfo("owner");
img.drawText(offsetX+150, offsetY + 30, 1, 1, owner, false, true);

std::string version = "Version: " + info.getInfo("version");
img.drawText(offsetX + 550, offsetY + 30, 1, 1, version, false, true);

std::string lastUpdate = "Last Updated: " + info.getInfo("lastUpdate");
img.drawText(offsetX + 900, offsetY + 30, 1, 1, lastUpdate, false, true);

std::string classification = "Classification: " + info.getInfo("classification");
img.drawText(offsetX + 1250, offsetY + 30, 1, 1, classification, false, true);
std::string text = "Owner: " + info.getInfo("owner") + " Version: " + info.getInfo("version") + " Last Updated: " + info.getInfo("lastUpdate") + " Classification: " + info.getInfo("classification");
img.drawText(offsetX + width / 100, offsetY + height / 1.5, width / 1500, width / 2000, text, false, true);
}

void makeBottomSection(IFPainter& img, InformationGatherer& info, int offsetX, int offsetY, int width, int height) {
//Draw black rectangle
img.drawRect(offsetX, offsetY, offsetX + width, offsetY + height, -1, cv::Scalar(0, 0, 0));

//Draw text on top
std::string preparer = "Preparer: " + info.getInfo("preparer");
img.drawText(offsetX + 150, offsetY + 30, 1, 1, preparer, false, true);
std::string text = "Preparer: " + info.getInfo("preparer") + " Source File: " + info.getInfo("file") + " Date Generated: " + info.getInfo("dateGenerated") + " Model Checksum: " + info.getInfo("checksum");
img.drawText(offsetX + width / 100, offsetY + height / 1.5, width / 1500, width / 2000, text, false, true);
}
10 changes: 10 additions & 0 deletions InformationGatherer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,21 @@ bool InformationGatherer::gatherInformation(std::string filePath, std::string na
//Gather name of preparer
infoMap.insert(std::pair < std::string, std::string>("preparer", name));

//Gather filepath
infoMap.insert(std::pair < std::string, std::string>("file", filePath));

//Gather date of generation
std::time_t now = time(0);
tm* ltm = localtime(&now);
std::string date = std::to_string(ltm->tm_mon+1) + "/" + std::to_string(ltm->tm_mday) + "/" + std::to_string(ltm->tm_year+1900);
infoMap.insert(std::pair < std::string, std::string>("dateGenerated", date));

//Hard code other stuff into map for now
infoMap.insert(std::pair<std::string, std::string>("owner", "Ally Hoskinson"));
infoMap.insert(std::pair<std::string, std::string>("version", "1.1"));
infoMap.insert(std::pair<std::string, std::string>("lastUpdate", "3/24/2023"));
infoMap.insert(std::pair<std::string, std::string>("classification", "Confidential"));
infoMap.insert(std::pair<std::string, std::string>("checksum", "120EA8A25E5D487BF68B5F7096440019"));

//Close database
ged_close(g);
Expand Down
6 changes: 3 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main(int argc, char **argv) {
bu_log(" l = length of output and window\n");
bu_log(" F = path specified is a folder of models\n");
bu_log(" g = GUI output\n");
bu_log(" f = filename of png export, MUST end in .png\n");
bu_log(" f = filepath of png export, MUST end in .png\n");
bu_log(" n = name of preparer, to be used in report\n");
return 0;
}
Expand Down Expand Up @@ -127,9 +127,9 @@ void generateReport(Options opt)
// paintSidebar
// etc...

makeTopSection(img, info, 10, 10, 1590, 50);
makeTopSection(img, info, opt.getWidth() / 150, opt.getWidth() / 150, opt.getWidth() - opt.getWidth() / 150 * 2, opt.getLength() / 25);

makeBottomSection(img, info, 10, 990, 1590, 50);
makeBottomSection(img, info, opt.getWidth() / 150, opt.getLength() - opt.getLength() / 25 - opt.getWidth() / 150, opt.getWidth() - opt.getWidth() / 150 * 2, opt.getLength() / 25);


// optionally, display the scene
Expand Down
1 change: 1 addition & 0 deletions pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <cstdlib>
#include <string>
#include <fstream>
#include <ctime>

// BRL-CAD header files
#include "bu/getopt.h"
Expand Down

0 comments on commit 30cf31c

Please sign in to comment.