11#include " ..\include\NavKit\Airg.h"
22#include " ..\include\NavKit\FileUtil.h"
3-
3+ # include " ../include/NavKit/Logger.h "
44Airg::Airg (NavKit *navKit) : navKit(navKit) {
55 airgName = " Load Airg" ;
66 lastLoadAirgFile = airgName;
@@ -77,7 +77,7 @@ void Airg::drawMenu() {
7777 std::string msg = " Loading Airg.Json file: '" ;
7878 msg += fileName;
7979 msg += " '..." ;
80- navKit-> log (RC_LOG_PROGRESS, msg.data ());
80+ Logger:: log (RC_LOG_PROGRESS, msg.data ());
8181 std::thread loadAirgThread (&Airg::loadAirg, this , fileName, true );
8282 loadAirgThread.detach ();
8383 } else if (extension == " AIRG" ) {
@@ -86,7 +86,7 @@ void Airg::drawMenu() {
8686 std::string msg = " Loading Airg file: '" ;
8787 msg += fileName;
8888 msg += " '..." ;
89- navKit-> log (RC_LOG_PROGRESS, msg.data ());
89+ Logger:: log (RC_LOG_PROGRESS, msg.data ());
9090 std::thread loadAirgThread (&Airg::loadAirg, this , fileName, false );
9191 loadAirgThread.detach ();
9292 }
@@ -107,7 +107,7 @@ void Airg::drawMenu() {
107107 msg += " file: '" ;
108108 msg += fileName;
109109 msg += " '..." ;
110- navKit-> log (RC_LOG_PROGRESS, msg.data ());
110+ Logger:: log (RC_LOG_PROGRESS, msg.data ());
111111 std::thread saveAirgThread (&Airg::saveAirg, this , fileName, extension == " JSON" );
112112 saveAirgThread.detach ();
113113 }
@@ -117,11 +117,11 @@ void Airg::drawMenu() {
117117 if (lastSpacing != spacing) {
118118 saveSpacing (spacing);
119119 lastSpacing = spacing;
120- navKit-> log (RC_LOG_PROGRESS, (" Setting spacing to: " + std::to_string (spacing)).c_str ());
120+ Logger:: log (RC_LOG_PROGRESS, (" Setting spacing to: " + std::to_string (spacing)).c_str ());
121121 }
122122 }
123123 if (imguiButton (" Reset Defaults" )) {
124- navKit-> log (RC_LOG_PROGRESS, " Resetting Airg Default settings" );
124+ Logger:: log (RC_LOG_PROGRESS, " Resetting Airg Default settings" );
125125 resetDefaults ();
126126 }
127127 if (imguiButton (" Build Airg from Navp" ,
@@ -130,15 +130,15 @@ void Airg::drawMenu() {
130130 delete reasoningGrid;
131131 reasoningGrid = new ReasoningGrid ();
132132 std::string msg = " Building Airg from Navp" ;
133- navKit-> log (RC_LOG_PROGRESS, msg.data ());
133+ Logger:: log (RC_LOG_PROGRESS, msg.data ());
134134 std::thread buildAirgThread (&ReasoningGrid::build, reasoningGrid, navKit->navp ->navMesh , navKit, spacing,
135135 zSpacing, tolerance, zTolerance);
136136 buildAirgThread.detach ();
137137 }
138138 if (imguiButton (" Connect Waypoint" , (airgLoaded && selectedWaypointIndex != -1 && !connectWaypointModeEnabled))) {
139139 connectWaypointModeEnabled = true ;
140140 std::string msg = " Entering Connect Waypoint mode. Start waypoint: " + std::to_string (selectedWaypointIndex);
141- navKit-> log (RC_LOG_PROGRESS, msg.data ());
141+ Logger:: log (RC_LOG_PROGRESS, msg.data ());
142142 }
143143 imguiSeparatorLine ();
144144 imguiLabel (" Selected Waypoint" );
@@ -219,7 +219,7 @@ void Airg::connectWaypoints(int startWaypointIndex, int endWaypointIndex) {
219219 }
220220 startWaypoint.nNeighbors [bestDirection] = endWaypointIndex;
221221 endWaypoint.nNeighbors [(bestDirection + 4 ) % 8 ] = startWaypointIndex;
222- navKit-> log (RC_LOG_PROGRESS,
222+ Logger:: log (RC_LOG_PROGRESS,
223223 (" Connected waypoints: " + std::to_string (startWaypointIndex) + " and " + std::to_string (
224224 endWaypointIndex)).c_str ());
225225}
@@ -497,7 +497,7 @@ void Airg::renderAirgForHitTest() {
497497
498498void Airg::setSelectedAirgWaypointIndex (int index) {
499499 if (index == -1 && selectedWaypointIndex != -1 ) {
500- navKit-> log (RC_LOG_PROGRESS, (" Deselected waypoint: " + std::to_string (selectedWaypointIndex)).c_str ());
500+ Logger:: log (RC_LOG_PROGRESS, (" Deselected waypoint: " + std::to_string (selectedWaypointIndex)).c_str ());
501501 }
502502 selectedWaypointIndex = index;
503503 if (index != -1 && index < reasoningGrid->m_WaypointList .size ()) {
@@ -509,8 +509,8 @@ void Airg::setSelectedAirgWaypointIndex(int index) {
509509 msg += " : Neighbor " + std::to_string (i) + " : " + std::to_string (neighborIndex);
510510 }
511511 }
512- navKit-> log (RC_LOG_PROGRESS, msg.c_str ());
513- navKit-> log (RC_LOG_PROGRESS,
512+ Logger:: log (RC_LOG_PROGRESS, msg.c_str ());
513+ Logger:: log (RC_LOG_PROGRESS,
514514 (" Waypoint position: X: " + std::to_string (waypoint.vPos .x ) + " Y: " +
515515 std::to_string (waypoint.vPos .y ) + " Z: " + std::to_string (waypoint.vPos .z ) + " XI: " +
516516 std::to_string (waypoint.xi ) + " YI: " + std::to_string (waypoint.yi ) + " ZI: " + std::to_string (
@@ -529,7 +529,7 @@ void Airg::setSelectedAirgWaypointIndex(int index) {
529529
530530 char numHex[3 ];
531531 msg += " Visibility Data Type: " + std::to_string (waypointVisibilityData[0 ]); // +" Visibility data:";
532- navKit-> log (RC_LOG_PROGRESS, msg.c_str ());
532+ Logger:: log (RC_LOG_PROGRESS, msg.c_str ());
533533 for (int count = 2 ; count < waypointVisibilityData.size (); count++) {
534534 uint8_t num = waypointVisibilityData[count];
535535 sprintf (numHex, " %02X" , num);
@@ -543,14 +543,14 @@ void Airg::setSelectedAirgWaypointIndex(int index) {
543543 waypointVisibilityDataString += " " ;
544544 }
545545 if ((count - 1 ) % 96 == 0 ) {
546- // navKit-> log(RC_LOG_PROGRESS, (" " + waypointVisibilityDataString).c_str());
546+ // Logger:: log(RC_LOG_PROGRESS, (" " + waypointVisibilityDataString).c_str());
547547 waypointVisibilityDataString = " " ;
548548 }
549549 }
550- // navKit-> log(RC_LOG_PROGRESS, (" " + waypointVisibilityDataString).c_str());
550+ // Logger:: log(RC_LOG_PROGRESS, (" " + waypointVisibilityDataString).c_str());
551551 const unsigned int colorRgb = (waypoint.nLayerIndex << 6 ) | 0xC0000000 ;
552552 std::string hexColor = std::format (" {:x}" , colorRgb);
553- navKit-> log (RC_LOG_PROGRESS, (" Layer Index RGB " + hexColor).c_str ());
553+ Logger:: log (RC_LOG_PROGRESS, (" Layer Index RGB " + hexColor).c_str ());
554554 }
555555}
556556
@@ -560,7 +560,7 @@ void Airg::saveAirg(Airg *airg, std::string fileName, bool isJson) {
560560 std::time_t start_time = std::chrono::system_clock::to_time_t (std::chrono::system_clock::now ());
561561 std::string msg = " Saving Airg to file at " ;
562562 msg += std::ctime (&start_time);
563- airg-> navKit -> log (RC_LOG_PROGRESS, msg.data ());
563+ Logger:: log (RC_LOG_PROGRESS, msg.data ());
564564 auto start = std::chrono::high_resolution_clock::now ();
565565
566566 std::string tempJsonFile = fileName;
@@ -584,7 +584,7 @@ void Airg::saveAirg(Airg *airg, std::string fileName, bool isJson) {
584584 msg = " Finished saving Airg to " + std::string{fileName} + " in " ;
585585 msg += std::to_string (duration.count ());
586586 msg += " seconds" ;
587- airg-> navKit -> log (RC_LOG_PROGRESS, msg.data ());
587+ Logger:: log (RC_LOG_PROGRESS, msg.data ());
588588 airg->airgSaveState .push_back (true );
589589}
590590
@@ -593,7 +593,7 @@ void Airg::loadAirg(Airg *airg, char *fileName, bool isFromJson) {
593593 std::time_t start_time = std::chrono::system_clock::to_time_t (std::chrono::system_clock::now ());
594594 std::string msg = " Loading Airg from file at " ;
595595 msg += std::ctime (&start_time);
596- airg-> navKit -> log (RC_LOG_PROGRESS, msg.data ());
596+ Logger:: log (RC_LOG_PROGRESS, msg.data ());
597597 auto start = std::chrono::high_resolution_clock::now ();
598598
599599 std::string jsonFileName = fileName;
@@ -613,8 +613,8 @@ void Airg::loadAirg(Airg *airg, char *fileName, bool isFromJson) {
613613 msg = " Finished loading Airg in " ;
614614 msg += std::to_string (duration.count ());
615615 msg += " seconds" ;
616- airg-> navKit -> log (RC_LOG_PROGRESS, msg.data ());
617- airg-> navKit -> log (RC_LOG_PROGRESS,
616+ Logger:: log (RC_LOG_PROGRESS, msg.data ());
617+ Logger:: log (RC_LOG_PROGRESS,
618618 (" Waypoint count: " + std::to_string (airg->reasoningGrid ->m_WaypointList .size ()) +
619619 " , Visibility Data size: " + std::to_string (airg->reasoningGrid ->m_pVisibilityData .size ()) +
620620 " , Visibility Data points per waypoint: " + std::to_string (
@@ -631,7 +631,7 @@ void Airg::loadAirg(Airg *airg, char *fileName, bool isFromJson) {
631631 total += visionDataSize;
632632 if (lastVisionDataSize != visionDataSize) {
633633 lastVisionDataSize = visionDataSize;
634- airg-> navKit -> log (RC_LOG_PROGRESS,
634+ Logger:: log (RC_LOG_PROGRESS,
635635 (" Vision Data Offset[" + std::to_string (i - 1 ) + " ]: " +
636636 std::to_string (w1.nVisionDataOffset ) + " Vision Data Offset[" + std::to_string (i) + " ]: "
637637 + std::to_string (w2.nVisionDataOffset ) + " Difference : " +
@@ -649,21 +649,21 @@ void Airg::loadAirg(Airg *airg, char *fileName, bool isFromJson) {
649649 }
650650 int finalVisionDataSize = airg->reasoningGrid ->m_pVisibilityData .size () - airg->reasoningGrid ->m_WaypointList [
651651 airg->reasoningGrid ->m_WaypointList .size () - 1 ].nVisionDataOffset ;
652- airg-> navKit -> log (RC_LOG_PROGRESS,
652+ Logger:: log (RC_LOG_PROGRESS,
653653 (" Vision Data Offset[" + std::to_string (airg->reasoningGrid ->m_WaypointList .size () - 1 ) + " ]: " +
654654 std::to_string (
655655 airg->reasoningGrid ->m_WaypointList [airg->reasoningGrid ->m_WaypointList .size () - 1 ].
656656 nVisionDataOffset) + " Max Visibility: " + std::to_string (
657657 airg->reasoningGrid ->m_pVisibilityData .size ()) + " Difference : " + std::to_string (
658658 finalVisionDataSize)).c_str ());
659659 total += finalVisionDataSize;
660- airg-> navKit -> log (RC_LOG_PROGRESS,
660+ Logger:: log (RC_LOG_PROGRESS,
661661 (" Total: " + std::to_string (total) + " Max Visibility: " + std::to_string (
662662 airg->reasoningGrid ->m_pVisibilityData .size ())).c_str ());
663- airg-> navKit -> log (RC_LOG_PROGRESS, " Visibility data offset map:" );
663+ Logger:: log (RC_LOG_PROGRESS, " Visibility data offset map:" );
664664 for (auto &pair: visionDataOffsetCounts) {
665665 VisionData visionData = VisionData::GetVisionDataType (pair.first );
666- airg-> navKit -> log (RC_LOG_PROGRESS,
666+ Logger:: log (RC_LOG_PROGRESS,
667667 (" Offset difference: " + std::to_string (pair.first ) + " Color: " + visionData.getName () +
668668 " Count: " + std::to_string (pair.second )).c_str ());
669669 }
0 commit comments