2626#include < PAX_SAPIENTICA/Simulation/Simulator.hpp>
2727
2828// シミュレータを使用する
29- // #define PAXS_USING_SIMULATOR
29+ #define PAXS_USING_SIMULATOR
3030
3131namespace paxs {
3232
@@ -40,18 +40,18 @@ namespace paxs {
4040 const std::string path8 = " ./../../../../../" ;
4141
4242 const std::vector<s3d::Font> font_pulldown = {
43- {16 , PAXS_S3D_RESOURCE (U" engine/font/noto-sans-jp/NotoSansJP-Regular.otf" ) },
44- {16 , PAXS_S3D_RESOURCE (U" engine/font/noto-sans-jp/NotoSansJP-Regular.otf" ) },
45- { 16 ,(U" engine/font/noto-sans-sc/NotoSansSC-Regular.otf" ) },
46- { 16 ,(U" engine/font/noto-sans-sc/NotoSansSC-Regular.otf" ) },
47- { 16 ,(U" engine/font/noto-sans-kr/NotoSansKR-Regular.otf" ) }
43+ {s3d::FontMethod::SDF, 16 , PAXS_S3D_RESOURCE (U" engine/font/noto-sans-jp/NotoSansJP-Regular.otf" ) },
44+ {s3d::FontMethod::SDF, 16 , PAXS_S3D_RESOURCE (U" engine/font/noto-sans-jp/NotoSansJP-Regular.otf" ) },
45+ { s3d::FontMethod::SDF, 16 ,(U" engine/font/noto-sans-sc/NotoSansSC-Regular.otf" ) },
46+ { s3d::FontMethod::SDF, 16 ,(U" engine/font/noto-sans-sc/NotoSansSC-Regular.otf" ) },
47+ { s3d::FontMethod::SDF, 16 ,(U" engine/font/noto-sans-kr/NotoSansKR-Regular.otf" ) }
4848 };
4949 const std::vector<s3d::Font> font = {
50- {18 , PAXS_S3D_RESOURCE (U" engine/font/noto-sans-jp/NotoSansJP-Regular.otf" ) },
51- {18 , PAXS_S3D_RESOURCE (U" engine/font/noto-sans-jp/NotoSansJP-Regular.otf" ) },
52- { 18 ,(U" engine/font/noto-sans-sc/NotoSansSC-Regular.otf" ) },
53- { 18 ,(U" engine/font/noto-sans-sc/NotoSansSC-Regular.otf" ) },
54- { 18 ,(U" engine/font/noto-sans-kr/NotoSansKR-Regular.otf" ) }
50+ {s3d::FontMethod::SDF, 18 , PAXS_S3D_RESOURCE (U" engine/font/noto-sans-jp/NotoSansJP-Regular.otf" ) },
51+ {s3d::FontMethod::SDF, 18 , PAXS_S3D_RESOURCE (U" engine/font/noto-sans-jp/NotoSansJP-Regular.otf" ) },
52+ { s3d::FontMethod::SDF, 18 ,(U" engine/font/noto-sans-sc/NotoSansSC-Regular.otf" ) },
53+ { s3d::FontMethod::SDF, 18 ,(U" engine/font/noto-sans-sc/NotoSansSC-Regular.otf" ) },
54+ { s3d::FontMethod::SDF, 18 ,(U" engine/font/noto-sans-kr/NotoSansKR-Regular.otf" ) }
5555 };
5656 const std::vector<std::vector<s3d::String>> items_pulldown = {
5757 {U" 日本語" },{U" English" },{U" 繁體中文" },{U" 简体中文" },{U" 한국어" }
@@ -217,15 +217,16 @@ namespace paxs {
217217 xyz_tile_soil_temperature->setDrawMaxZ (10 );
218218 xyz_tile_soil_temperature->setMapFilePath (path + U" Data/Map/XYZTile/Temperature/Image/SoilTemperature/2023/" );
219219
220- const std::unique_ptr<XYZTile> xyz_tile_line (new (std::nothrow) XYZTile (map_view->getWidth (), map_view->getHeight (), map_view->getCenterX (), map_view->getCenterY ()));
221- xyz_tile_line->setDefaultZ (8 );
222- xyz_tile_line->setDrawMinZ (5 );
223- const std::unique_ptr<XYZTile> xyz_tile_line2 (new (std::nothrow) XYZTile (map_view->getWidth (), map_view->getHeight (), map_view->getCenterX (), map_view->getCenterY ()));
224- xyz_tile_line2->setDefaultZ (10 );
225- xyz_tile_line2->setDrawMinZ (7 );
220+ // const std::unique_ptr<XYZTile> xyz_tile_line(new(std::nothrow) XYZTile(map_view->getWidth(), map_view->getHeight(), map_view->getCenterX(), map_view->getCenterY()));
221+ // xyz_tile_line->setDefaultZ(8);
222+ // xyz_tile_line->setDrawMinZ(5);
223+ // const std::unique_ptr<XYZTile> xyz_tile_line2(new(std::nothrow) XYZTile(map_view->getWidth(), map_view->getHeight(), map_view->getCenterX(), map_view->getCenterY()));
224+ // xyz_tile_line2->setDefaultZ(10);
225+ // xyz_tile_line2->setDrawMinZ(7);
226226 const std::unique_ptr<XYZTile> xyz_tile_line3 (new (std::nothrow) XYZTile (map_view->getWidth (), map_view->getHeight (), map_view->getCenterX (), map_view->getCenterY ()));
227- xyz_tile_line3->setDefaultZ (12 );
228- xyz_tile_line3->setDrawMinZ (9 );
227+ // xyz_tile_line3->setDefaultZ(12);
228+ // xyz_tile_line3->setDrawMinZ(12);
229+ // xyz_tile_line3->setDrawMaxZ(16);
229230
230231 const s3d::String map_license_name = U" Maptiles by\n 農研機構農業環境研究部門, under CC BY 2.1 JP.\n 20万分の1シームレス地質図V2.\n OpenStreetMap contributors, under ODbL." ;
231232 // const s3d::String map_license_name = U"Maptiles by MIERUNE, under CC BY. Data by OpenStreetMap contributors, under ODbL.\nMaptiles by 農研機構農業環境研究部門, under CC BY 2.1 JP";
@@ -257,7 +258,7 @@ namespace paxs {
257258
258259#ifdef PAXS_USING_SIMULATOR
259260 // エージェント
260- std::unique_ptr<PlaceNameLocation > agent_location (new (std::nothrow) PlaceNameLocation );
261+ std::unique_ptr<AgentLocation > agent_location (new (std::nothrow) AgentLocation );
261262 // agent_location->addKofun();
262263#endif
263264 // 古墳名
@@ -342,11 +343,13 @@ namespace paxs {
342343
343344 bool is_agent_update = true ; // エージェントの更新をするか
344345#ifdef PAXS_USING_SIMULATOR
345- paxs::Simulator<int > simlator (
346- path8 + " Data/Map/XYZTile/LandAndWater/Data/BlackAndWhiteBinary/1868/10" ,
347- paxs::Vector2<int >{861 , 350 },
348- paxs::Vector2<int >{950 , 450 }, 10 );
349- simlator.init ();
346+ paxs::Simulator<int > simlator;
347+ // 対馬のみ
348+ paxs::Vector2<int > start_position = paxs::Vector2<int >{ 879 , 406 };
349+ paxs::Vector2<int > end_position = paxs::Vector2<int >{ 881 , 409 };
350+ // paxs::Vector2<int> start_position = paxs::Vector2<int>{ 877, 381 };
351+ // paxs::Vector2<int> end_position = paxs::Vector2<int>{ 917, 422 };
352+ // simlator.init();
350353#endif
351354 // return;
352355/* ##########################################################################################
@@ -411,12 +414,12 @@ namespace paxs {
411414 xyz_tile_river_bw->update (map_view_width, map_view_height, map_view_center_x, map_view_center_y, paxs::XYZTileFileName::Z_Original);
412415 }
413416 // xyz_tile4->update(map_view_width, map_view_height, map_view_center_x, map_view_center_y, paxs::XYZTileFileName::Original);
414- if (menu_bar.getPulldown (MenuBarType::map).getIsItems (MapType::line1)) {
415- xyz_tile_line->update (map_view_width, map_view_height, map_view_center_x, map_view_center_y);
416- }
417- if (menu_bar.getPulldown (MenuBarType::map).getIsItems (MapType::line2)) {
418- xyz_tile_line2->update (map_view_width, map_view_height, map_view_center_x, map_view_center_y);
419- }
417+ // if (menu_bar.getPulldown(MenuBarType::map).getIsItems(MapType::line1)) {
418+ // xyz_tile_line->update(map_view_width, map_view_height, map_view_center_x, map_view_center_y);
419+ // }
420+ // if (menu_bar.getPulldown(MenuBarType::map).getIsItems(MapType::line2)) {
421+ // xyz_tile_line2->update(map_view_width, map_view_height, map_view_center_x, map_view_center_y);
422+ // }
420423 if (menu_bar.getPulldown (MenuBarType::map).getIsItems (MapType::line2)) {
421424 xyz_tile_line3->update (map_view_width, map_view_height, map_view_center_x, map_view_center_y);
422425 }
@@ -460,14 +463,14 @@ namespace paxs {
460463 }
461464 // xyz_tile3->draw(map_view_width, map_view_height, map_view_center_x, map_view_center_y);
462465 // xyz_tile4->draw(map_view_width, map_view_height, map_view_center_x, map_view_center_y);
463- if (menu_bar.getPulldown (MenuBarType::map).getIsItems (MapType::line1)) {
464- xyz_tile_line->drawLine (map_view_width, map_view_height, map_view_center_x, map_view_center_y, 0.8 , s3d::Color{ 95 ,99 ,104 }/* s3d::Palette::Black*/ );
465- }
466- if (menu_bar.getPulldown (MenuBarType::map).getIsItems (MapType::line2)) {
467- xyz_tile_line2->drawLine (map_view_width, map_view_height, map_view_center_x, map_view_center_y, 0.4 , s3d::Color{ 95 ,99 ,104 }/* s3d::Palette::Black*/ );
468- }
466+ // if (menu_bar.getPulldown(MenuBarType::map).getIsItems(MapType::line1)) {
467+ // xyz_tile_line->drawLine(map_view_width, map_view_height, map_view_center_x, map_view_center_y, 0.8, s3d::Color{ 95,99,104 }/*s3d::Palette::Black*/);
468+ // }
469+ // if (menu_bar.getPulldown(MenuBarType::map).getIsItems(MapType::line2)) {
470+ // xyz_tile_line2->drawLine(map_view_width, map_view_height, map_view_center_x, map_view_center_y, 0.4, s3d::Color{ 95,99,104 }/*s3d::Palette::Black*/);
471+ // }
469472 if (menu_bar.getPulldown (MenuBarType::map).getIsItems (MapType::line2)) {
470- xyz_tile_line3->drawLine (map_view_width, map_view_height, map_view_center_x, map_view_center_y, 0.4 , s3d::Color{ 95 ,99 ,104 }/* s3d::Palette::Black*/ );
473+ xyz_tile_line3->drawLine (map_view_width, map_view_height, map_view_center_x, map_view_center_y, 0.8 , s3d::Color{ 95 ,99 ,104 }/* s3d::Palette::Black*/ );
471474 xyz_tile_line3->drawXYZ (map_view_width, map_view_height, map_view_center_x, map_view_center_y);
472475 }
473476 // 地図上に描画する画像を描画する
@@ -495,19 +498,20 @@ namespace paxs {
495498 if (is_agent_update) {
496499 static int step = 0 ;
497500 if (step == 0 ) {
498- s3d::Print (U" Agent Size:" , simlator.getAgents ().size ());
499- for (int i = 0 ; i < 10 && i < simlator.getAgents ().size (); ++i) {
500- s3d::Print (U" Agent[" ,i,U" ]:X" ,simlator.getAgents ()[i].getLocation (10 ,256 ).x , U" , Y" , simlator.getAgents ()[i].getLocation (10 ,256 ).y );
501- }
501+ // s3d::Print(U"Agent Size:", simlator.getAgents().size());
502+ // for (int i = 0; i < 10 && i < simlator.getAgents().size(); ++i) {
503+ // s3d::Print(U"Agent[",i,U"]:X" ,simlator.getAgents()[i].getLocation(10,256).x, U", Y", simlator.getAgents()[i].getLocation(10,256).y);
504+ // }
502505 }
503- // ++step;
504- // if (step >= 300) {
506+ ++step;
507+ if (step >= 0 ) {
508+ // if (step >= 30) {
505509 step = 0 ;
506510 simlator.step ();
507- // }
508- agent_location->update (simlator.getAgents ());
511+ }
509512 }
510- ; agent_location->draw (map_view_width, map_view_height, map_view_center_x, map_view_center_y,
513+ // agent_location->update(simlator.getAgents());
514+ ; agent_location->draw (simlator.getAgents (), start_position, map_view_width, map_view_height, map_view_center_x, map_view_center_y,
511515 font[language], font[language]/* en_font*/ , pin_font);
512516#endif
513517 }
@@ -799,13 +803,24 @@ U"II-1",U"II-2",U"II-2/II-3",U"II-3",U"II-4",U"II-5",U"II-6",U"III-1"
799803 ).draw (s3d::TextStyle::Outline (0 , 0.6 , s3d::Palette::White),
800804 s3d::Arg::topRight = s3d::Vec2 (s3d::Scene::Width () - 60 , 590 ), s3d::Palette::Black);
801805
806+ #ifdef PAXS_USING_SIMULATOR
807+ if (s3d::SimpleGUI::Button (U" Init" , s3d::Vec2{ 10 ,60 })) {
808+ simlator = paxs::Simulator<int >(
809+ path8 + " Data/Map/XYZTile/LandAndWater/Data/BlackAndWhiteBinary/1868/10" ,
810+ // paxs::Vector2<int>{861, 350},
811+ // paxs::Vector2<int>{950, 450}, 10);
812+ start_position,
813+ end_position, 10 );
814+ simlator.init ();
815+ }
816+ if (s3d::SimpleGUI::Button (U" Start" , s3d::Vec2{ 110 ,60 })) {
817+ is_agent_update = true ;
818+ }
819+ if (s3d::SimpleGUI::Button (U" Stop" , s3d::Vec2{ 210 ,60 })) {
820+ is_agent_update = false ;
821+ }
822+ #endif
802823
803- // if (s3d::SimpleGUI::Button(U"Start", s3d::Vec2{ 10,60 })) {
804- // is_agent_update = true;
805- // }
806- // if (s3d::SimpleGUI::Button(U"Stop", s3d::Vec2{ 110,60 })) {
807- // is_agent_update = false;
808- // }
809824
810825 }
811826 }
0 commit comments