• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java RouteController类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中application.controllers.RouteController的典型用法代码示例。如果您正苦于以下问题:Java RouteController类的具体用法?Java RouteController怎么用?Java RouteController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

RouteController类属于application.controllers包,在下文中一共展示了RouteController类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: displayRoute

点赞 2

import application.controllers.RouteController; //导入依赖的package包/类
public boolean displayRoute(geography.GeographicPoint start, geography.GeographicPoint end, int toggle) {
    if(routeLine == null) {
    	if(markerManager.getVisualization() != null) {
    		markerManager.clearVisualization();
    	}

    	if(toggle == RouteController.DIJ || toggle == RouteController.A_STAR ||
    			toggle == RouteController.BFS) {
    		markerManager.initVisualization();
        	Consumer<geography.GeographicPoint> nodeAccepter = markerManager.getVisualization()::acceptPoint;
        	List<geography.GeographicPoint> path = null;
        	if (toggle == RouteController.BFS) {
        		path = markerManager.getDataSet().getGraph().bfs(start, end, nodeAccepter);
        	}
        	else if (toggle == RouteController.DIJ) {
        		path = markerManager.getDataSet().getGraph().dijkstra(start, end, nodeAccepter);
        	}
        	else if (toggle == RouteController.A_STAR) {
        		path = markerManager.getDataSet().getGraph().aStarSearch(start, end, nodeAccepter);
        	}

        	if(path == null) {
                // System.out.println("In displayRoute : PATH NOT FOUND");
                MapApp.showInfoAlert("Routing Error : ", "No path found");
            	return false;
            }
        	List<LatLong> mapPath = constructMapPath(path);
            //List<LatLong> mapPath = new ArrayList<LatLong>();
            //for(geography.GeographicPoint point : path) {
            //    mapPath.add(new LatLong(point.getX(), point.getY()));
            //}


            markerManager.setSelectMode(false);
            return displayRoute(mapPath);
		}

		return false;
    }
    return false;
}
 

开发者ID:sanekas,
项目名称:map-graph,
代码行数:42,
代码来源:RouteService.java

示例2: displayRoute

点赞 2

import application.controllers.RouteController; //导入依赖的package包/类
public boolean displayRoute(geography.GeographicPoint start, geography.GeographicPoint end, int toggle) {
    if(routeLine == null) {
    	if(markerManager.getVisualization() != null) {
    		markerManager.clearVisualization();
    	}

    	if(toggle == RouteController.DIJ || toggle == RouteController.A_STAR ||
    			toggle == RouteController.BFS) {
    		markerManager.initVisualization();
        	Consumer<geography.GeographicPoint> nodeAccepter = markerManager.getVisualization()::acceptPoint;
        	List<geography.GeographicPoint> path = null;
        	if (toggle == RouteController.BFS) {
        		path = markerManager.getDataSet().getGraph().bfs(start, end, nodeAccepter);
        	}
        	else if (toggle == RouteController.DIJ) {
        		path = markerManager.getDataSet().getGraph().dijkstra(start, end, nodeAccepter);
        	}
        	else if (toggle == RouteController.A_STAR) {
        		path = markerManager.getDataSet().getGraph().aStarSearch(start, end, nodeAccepter);
        	}

        	if(path == null) {
                // System.out.println("In displayRoute : PATH NOT FOUND");
                MapApp.showInfoAlert("Routing Error : ", "No path found");
            	return false;
            }
            // TODO -- debug road segments
        	List<LatLong> mapPath = constructMapPath(path);
            //List<LatLong> mapPath = new ArrayList<LatLong>();
            //for(geography.GeographicPoint point : path) {
            //    mapPath.add(new LatLong(point.getX(), point.getY()));
            //}


            markerManager.setSelectMode(false);
            return displayRoute(mapPath);
		}

		return false;
    }
    return false;
}
 

开发者ID:anand9522,
项目名称:MapsApplication,
代码行数:43,
代码来源:RouteService.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)