####说明 python调用c++ boost.python封装的A寻路算法 python调用c++ A寻路 采用boost 1.49 c++库封装成python的模块
2015/06/23 增加AStarEx高效寻路算法,AS3版本原作者(lizhi)
2015/11/14 增加setup.py Debian7.8系统下编译运行正常。
####导出函数 //2015/06/23 增加新版本
class_<AStarEx::IntList>("AStarExIntList")
.def(vector_indexing_suite<AStarEx::IntList>())
;
class_<AStarEx::Point>("AStarExPoint")
.def_readwrite("x",&AStarEx::Point::x)
.def_readwrite("y",&AStarEx::Point::y)
;
class_<AStarEx::PointList>("AStarExPointList")
.def( vector_indexing_suite<AStarEx::PointList> () )
;
class_<AStarEx::PointQue>("AStarExPointQue")
.def( vector_indexing_suite<AStarEx::PointQue> () )
;
class_<AstarEx>("AStarEx", no_init)
.def(init<>())
.def("Init", &AstarEx::Init)
.def("Find", &AstarEx::findPath)
.def("IsOpen", &AstarEx::IsOpen)
.def("FindBestPoint", &AstarEx::FindBestPoint)
.def("GetAstarPath", &AstarEx::GetAstarPath)
.def("setMapPoint", &AstarEx::setMapPoint)
.def("visual", &AstarEx::visual)
;
####boost编译 bjam --with-python --toolset=msvc-10.0 --build-type=complete stage
####运行效果图 F:\War\Astar\examples>simpletestAStarEx60x60.py ('Pathfinding take time:', 0.0) Whether route to go: False The path provided by the A* algorithm from (40, 47) to (1, 9) is: (40, 47) (39, 46) (38, 45) (37, 44) (36, 43) (35, 42) (34, 41) (33, 40) (32, 39) (31, 39) (30, 39) (29, 39) (28, 39) (27, 39) (26, 39) (25, 39) (24, 39) (23, 39) (22, 39) (21 , 39) (20, 39) (19, 39) (18, 39) (17, 39) (16, 39) (15, 39) (14, 39) (13, 39) (1 2, 39) (11, 38) (10, 37) (9, 36) (9, 35) (9, 34) (9, 33) (9, 32) (9, 31) (9, 30) (9, 29) (9, 28) (9, 27) (9, 26) (9, 25) (9, 24) (10, 23) (11, 22) (11, 21) (11, 20) (12, 19) (13, 18) (14, 17) (15, 16) (15, 15) (15, 14) (14, 13) (13, 12) (12 , 11) (11, 10) (10, 9) (9, 9) (8, 9) (7, 9) (6, 9) (5, 9) (4, 9) (3, 9) (2, 9) ( 1, 9) ..#########################################################. ##.........................................................# #..........................................................# #..........................................................# #..........................................................# #.............................#............................# #.............................#............................# #.............................#............................# #.............................#............................# #E*********...................#............................# #............................#............................# #............................#............................# #............................#............................# ######....................................................# #....#........#...........................................# #....#........#.....################################......# #....##########...........................................# #.........................................................# #.........................................................# #.........................................................# #..........###############################................# #.........................................................# #.........................................................# #..............................#............#.............# #..............................#............#.............# #..............................#............#.............# #..............................#............#.............# #..............................##############.............# #.........................................................# #.........................................................# #.........................................................# #..........###########################.........##.........# #..........#..............................................# #..........#..............................................# #..........#..............................................# #..........#..............................................# #..........#..............................................# #..........#..............................................# #...........###########............################.......# #...........*************..........................# #.........................................................# #.........................................................# #..................################.......................# #.........................................................# #.........................................................# #.........................................................# #...........#.............................................# #...........#...........................S..................# #...........#..............................................# #...........##.............................................# #............#.............................................# #............##............................................# #.............#............................................# #.............#............................................# #.............#............................................# #.............#............................................# #.............#............................................# #.............#............................................# #..........................................................# ############################################################