本文整理汇总了Java中com.graphhopper.routing.util.EdgeFilter类的典型用法代码示例。如果您正苦于以下问题:Java EdgeFilter类的具体用法?Java EdgeFilter怎么用?Java EdgeFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EdgeFilter类属于com.graphhopper.routing.util包,在下文中一共展示了EdgeFilter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createHeavyVehicleEdgeFilter
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
private EdgeFilter createHeavyVehicleEdgeFilter(RouteSearchParameters searchParams, FlagEncoder flagEncoder,
EdgeFilter edgeFilter)
{
if (searchParams.hasParameters(VehicleParameters.class))
{
GraphStorage gs = mGraphHopper.getGraphHopperStorage();
int vehicleType = searchParams.getVehicleType();
VehicleParameters vehicleParams = (VehicleParameters)searchParams.getProfileParameters();
if (vehicleParams.hasAttributes())
{
EdgeFilter ef = null;
if (searchParams.getProfileType() == RoutingProfileType.DRIVING_HGV)
ef = new HeavyVehicleEdgeFilter(flagEncoder, vehicleType, vehicleParams, gs);
else if (searchParams.getProfileType() == RoutingProfileType.DRIVING_EMERGENCY)
ef = new EmergencyVehicleEdgeFilter(flagEncoder, vehicleParams, gs);
if (ef != null)
edgeFilter = createEdgeFilter(ef, edgeFilter);
}
}
return edgeFilter;
}
开发者ID:GIScience,项目名称:openrouteservice,代码行数:26,代码来源:RoutingProfile.java
示例2: findClosestTest
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
@Test
public void findClosestTest() {
// hopper.
LocationIndex index = hopper.getLocationIndex();
System.out.println("LocationIndex");
double lat = 1.2992625;
double lon = 103.7866893;
// index.
QueryResult qr = index.findClosest(lat, lon, EdgeFilter.ALL_EDGES);
GHPoint3D result = qr.getSnappedPoint();
System.out.println(result.toString());
EdgeIteratorState edge = qr.getClosestEdge();
}
开发者ID:ianmalcolm,项目名称:DeadReckoning,代码行数:19,代码来源:GraphHopperTest.java
示例3: getNearestRoad
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
/**
* Gets a location on a road that is close(st) to the given location.
* @param loc the location that should be snapped to a road.
* @return a new location object fitting the description or null if there was no road found to snap to
*/
private Location getNearestRoad(Location loc){
QueryResult qr = GraphHopperManager.getHopper().getLocationIndex().findClosest(loc.getLat(), loc.getLon(),
EdgeFilter.ALL_EDGES);
try {
GHPoint3D snap = qr.getSnappedPoint();
return new Location(snap.getLon(), snap.getLat());
} catch(IllegalStateException ignored){
return null;
}
}
开发者ID:agentcontest,项目名称:massim,代码行数:16,代码来源:CityMap.java
示例4: getMatchedSegmentsInternal
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
private RouteSegmentInfo[] getMatchedSegmentsInternal(Coordinate[] locations,
double searchRadius, EdgeFilter edgeFilter, boolean bothDirections) {
if (mMapMatcher == null)
{
mMapMatcher = new HiddenMarkovMapMatcher();
mMapMatcher.setGraphHopper(mGraphHopper);
}
mMapMatcher.setSearchRadius(searchRadius);
mMapMatcher.setEdgeFilter(edgeFilter);
return mMapMatcher.match(locations, bothDirections);
}
开发者ID:GIScience,项目名称:openrouteservice,代码行数:14,代码来源:RoutingProfile.java
示例5: createWheelchairRestrictionsEdgeFilter
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
private EdgeFilter createWheelchairRestrictionsEdgeFilter(RouteSearchParameters searchParams,
FlagEncoder flagEncoder, EdgeFilter edgeFilter) throws Exception {
if (searchParams.hasParameters(WheelchairParameters.class))
{
EdgeFilter ef = null;
GraphStorage gs = mGraphHopper.getGraphHopperStorage();
ef = new WheelchairEdgeFilter((WheelchairParameters)searchParams.getProfileParameters(), (WheelchairFlagEncoder) flagEncoder, gs);
edgeFilter = createEdgeFilter(ef, edgeFilter);
}
return edgeFilter;
}
开发者ID:GIScience,项目名称:openrouteservice,代码行数:12,代码来源:RoutingProfile.java
示例6: getEdgeFilter
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
public EdgeFilter getEdgeFilter(Class<?> type)
{
for (int i = 0; i < filtersCount; i++) {
if (type.isAssignableFrom(edgeFilters.get(i).getClass()))
return edgeFilters.get(i);
}
return null;
}
开发者ID:GIScience,项目名称:openrouteservice,代码行数:10,代码来源:EdgeFilterSequence.java
示例7: setDestinationEdge
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
public void setDestinationEdge(EdgeIteratorState edge, Graph graph, FlagEncoder encoder, TraversalMode tMode)
{
if (edge != null)
{
int nodeId = edge.getBaseNode();
if (nodeId != -1)
{
mode = MODE_DESTINATION_EDGES;
Weighting weighting = new FastestWeighting(encoder);
CustomDijkstra dijkstraAlg = new CustomDijkstra(graph, encoder, weighting, tMode);
EdgeFilter edgeFilter = this;
dijkstraAlg.setEdgeFilter(edgeFilter);
dijkstraAlg.calcPath(nodeId, Integer.MIN_VALUE);
IntObjectMap<SPTEntry> destination = dijkstraAlg.getMap();
destinationEdges = new ArrayList<Integer>(destination.size());
for (IntObjectCursor<SPTEntry> ee : destination) {
if (!destinationEdges.contains(ee.value.edge)) // was originalEdge
destinationEdges.add(ee.value.edge);
}
if (!destinationEdges.contains(edge.getOriginalEdge()))
{
int vt = gsHeavyVehicles.getEdgeVehicleType(edge.getOriginalEdge(), buffer);
boolean dstFlag = buffer[1]!=0;// ((buffer[1] >> (vehicleType >> 1)) & 1) == 1;
if (((vt & vehicleType) == vehicleType) && (dstFlag))
destinationEdges.add(edge.getOriginalEdge());
}
if (destinationEdges.size() == 0)
destinationEdges = null;
}
}
mode = MODE_ROUTE;
}
开发者ID:GIScience,项目名称:openrouteservice,代码行数:39,代码来源:HeavyVehicleEdgeFilter.java
示例8: MatrixSearchContextBuilder
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
public MatrixSearchContextBuilder(LocationIndex index, EdgeFilter edgeFilter, ByteArrayBuffer buffer, boolean resolveNames)
{
_locIndex = index;
_edgeFilter = edgeFilter;
_buffer = buffer;
_resolveNames = resolveNames;
}
开发者ID:GIScience,项目名称:openrouteservice,代码行数:8,代码来源:MatrixSearchContextBuilder.java
示例9: getClosestPosition
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
public GeoPoint getClosestPosition(GeoPoint p) {
QueryResult qr = index.findClosest(p.lat, p.lon, EdgeFilter.ALL_EDGES);
GHPoint3D result = qr.getSnappedPoint();
GeoPoint snappedPosition = new GeoPoint(result.lat, result.lon,
p.ele, p.time);
return snappedPosition;
}
开发者ID:ianmalcolm,项目名称:DeadReckoning,代码行数:9,代码来源:GUILocalization.java
示例10: step
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
@Override
public GeoPoint step(GeoPoint p, GeoPoint q) {
// if p and q are on the same road, then estimated position
Vector3D v = GeoPoint.distance(p, q);
GHPoint3D snappedQ = index.findClosest(q.lat, q.lon,
EdgeFilter.ALL_EDGES).getSnappedPoint();
Vector3D snappedV = GeoPoint.distance(p, new GeoPoint(
snappedQ.lat, snappedQ.lon, q.ele, q.time.getTime()));
double dist = v.getNorm();
double snappedDist = snappedV.getNorm();
v = snappedV.scalarMultiply(dist / snappedDist);
GeoPoint scaledQ = p.add(new Step(v, q.time.getTime()));
QueryResult fromQR = index.findClosest(p.lat, p.lon,
EdgeFilter.ALL_EDGES);
QueryResult toQR = index.findClosest(scaledQ.lat, scaledQ.lon,
EdgeFilter.ALL_EDGES);
if (fromQR.getClosestEdge().getEdge() == toQR.getClosestEdge().getEdge()) {
GHPoint3D calibQ = toQR.getSnappedPoint();
return new GeoPoint(calibQ.lat, calibQ.lon, q.ele,
q.time.getTime());
} else {
return null;
}
}
开发者ID:ianmalcolm,项目名称:DeadReckoning,代码行数:28,代码来源:MapWrapper.java
示例11: lookupGPXEntries
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
/**
* Find the possible locations (edges) of each GPXEntry in the graph.
*/
private List<Collection<QueryResult>> lookupGPXEntries(List<GPXEntry> gpxList,
EdgeFilter edgeFilter) {
final List<Collection<QueryResult>> gpxEntryLocations = new ArrayList<>();
for (GPXEntry gpxEntry : gpxList) {
final List<QueryResult> queryResults = locationIndex.findNClosest(
gpxEntry.lat, gpxEntry.lon, edgeFilter, measurementErrorSigma);
gpxEntryLocations.add(queryResults);
}
return gpxEntryLocations;
}
开发者ID:graphhopper,项目名称:map-matching,代码行数:15,代码来源:MapMatching.java
示例12: RouteSearchContext
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
public RouteSearchContext(GraphHopper gh, EdgeFilter edgeFilter, FlagEncoder encoder)
{
_graphhopper = gh;
_edgeFilter = edgeFilter;
_encoder = encoder;
}
开发者ID:GIScience,项目名称:openrouteservice,代码行数:7,代码来源:RouteSearchContext.java
示例13: getEdgeFilter
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
public EdgeFilter getEdgeFilter() {
return _edgeFilter;
}
开发者ID:GIScience,项目名称:openrouteservice,代码行数:4,代码来源:RouteSearchContext.java
示例14: createAccessRestrictionFilter
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
public EdgeFilter createAccessRestrictionFilter(Coordinate[] wayPoints)
{
//rp.getGraphhopper()
return null;
}
开发者ID:GIScience,项目名称:openrouteservice,代码行数:6,代码来源:RoutingProfile.java
示例15: computeRoutes
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
public List<RouteResult> computeRoutes(RoutingRequest req, boolean invertFlow, boolean oneToMany) throws Exception
{
if (req.getCoordinates().length <= 1)
throw new Exception("Number of coordinates must be greater than 1.");
List<RouteResult> routes = new ArrayList<RouteResult>(req.getCoordinates().length - 1);
RoutingProfile rp = getRouteProfile(req, true);
RouteSearchParameters searchParams = req.getSearchParameters();
PathProcessor pathProcessor = null;
if (req.getExtraInfo() > 0)
{
// do not allow geometry simplification when extras are requested
req.setSimplifyGeometry(false);
pathProcessor = new ExtraInfoProcessor(rp.getGraphhopper(), req);
}
else
{
if (req.getIncludeElevation())
pathProcessor = new ElevationSmoothPathProcessor();
}
Coordinate[] coords = req.getCoordinates();
Coordinate c0 = coords[0];
int nSegments = coords.length - 1;
RouteProcessContext routeProcCntx = new RouteProcessContext(pathProcessor);
RouteResultBuilder routeBuilder = new RouteResultBuilder();
EdgeFilter customEdgeFilter = rp.createAccessRestrictionFilter(coords);
List<GHResponse> resp = new ArrayList<GHResponse>();
for(int i = 1; i <= nSegments; ++i)
{
if (pathProcessor != null)
pathProcessor.setSegmentIndex(i - 1, nSegments);
Coordinate c1 = coords[i];
GHResponse gr = null;
if (invertFlow)
gr = rp.computeRoute(c0.y, c0.x, c1.y, c1.x, null, null, false, searchParams, customEdgeFilter, req.getSimplifyGeometry(), routeProcCntx);
else
gr = rp.computeRoute(c1.y, c1.x, c0.y, c0.x, null, null, false, searchParams, customEdgeFilter, req.getSimplifyGeometry(), routeProcCntx);
//if (gr.hasErrors())
// throw new InternalServerException(RoutingErrorCodes.UNKNOWN, String.format("Unable to find a route between points %d (%s) and %d (%s)", i, FormatUtility.formatCoordinate(c0), i + 1, FormatUtility.formatCoordinate(c1)));
if (!gr.hasErrors())
{
resp.clear();
resp.add(gr);
RouteResult route = routeBuilder.createRouteResult(resp, req, (pathProcessor != null && (pathProcessor instanceof ExtraInfoProcessor)) ? ((ExtraInfoProcessor)pathProcessor).getExtras(): null);
route.setLocationIndex(req.getLocationIndex());
routes.add(route);
}
else
routes.add(null);
}
return routes;
}
开发者ID:GIScience,项目名称:openrouteservice,代码行数:61,代码来源:RoutingProfileManager.java
示例16: computeRoute
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
public RouteResult computeRoute(RoutingRequest req) throws Exception
{
List<GHResponse> routes = new ArrayList<GHResponse>();
RoutingProfile rp = getRouteProfile(req, false);
RouteSearchParameters searchParams = req.getSearchParameters();
PathProcessor pathProcessor = null;
if (req.getExtraInfo() > 0)
{
// do not allow geometry simplification when extras are requested
req.setSimplifyGeometry(false);
pathProcessor = new ExtraInfoProcessor(rp.getGraphhopper(), req);
}
else
{
if (req.getIncludeElevation())
pathProcessor = new ElevationSmoothPathProcessor();
}
Coordinate[] coords = req.getCoordinates();
Coordinate c0 = coords[0];
Coordinate c1;
int nSegments = coords.length - 1;
RouteProcessContext routeProcCntx = new RouteProcessContext(pathProcessor);
EdgeFilter customEdgeFilter = rp.createAccessRestrictionFilter(coords);
GHResponse prevResp = null;
WayPointBearing[] bearings = (req.getContinueStraight() || searchParams.getBearings() != null) ? new WayPointBearing[2] : null;
double[] radiuses = searchParams.getMaximumRadiuses() != null ? new double[2] : null;
for(int i = 1; i <= nSegments; ++i)
{
c1 = coords[i];
if (pathProcessor != null)
pathProcessor.setSegmentIndex(i - 1, nSegments);
if (bearings != null)
{
bearings[0] = null;
if (i > 1 && req.getContinueStraight())
{
bearings[0] = new WayPointBearing(getHeadingDirection(prevResp), Double.NaN);
}
if (searchParams.getBearings() != null)
{
bearings[0] = searchParams.getBearings()[i - 1];
bearings[1] = (i == nSegments && searchParams.getBearings().length != nSegments + 1) ? new WayPointBearing(Double.NaN, Double.NaN) : searchParams.getBearings()[i];
}
}
if (searchParams.getMaximumRadiuses() != null)
{
radiuses[0] = searchParams.getMaximumRadiuses()[i - 1];
radiuses[1] = searchParams.getMaximumRadiuses()[i];
}
GHResponse gr = rp.computeRoute(c0.y, c0.x, c1.y, c1.x, bearings, radiuses, c0.z == 1.0, searchParams, customEdgeFilter, req.getSimplifyGeometry(), routeProcCntx);
if (gr.hasErrors())
{
if (gr.getErrors().size() > 0)
throw new InternalServerException(RoutingErrorCodes.UNKNOWN, gr.getErrors().get(0).getMessage());
else
throw new InternalServerException(RoutingErrorCodes.UNKNOWN, String.format("Unable to find a route between points %d (%s) and %d (%s).", i, FormatUtility.formatCoordinate(c0), i + 1, FormatUtility.formatCoordinate(c1)));
}
prevResp = gr;
routes.add(gr);
c0 = c1;
}
return new RouteResultBuilder().createRouteResult(routes, req, (pathProcessor != null && (pathProcessor instanceof ExtraInfoProcessor)) ? ((ExtraInfoProcessor)pathProcessor).getExtras(): null);
}
开发者ID:GIScience,项目名称:openrouteservice,代码行数:77,代码来源:RoutingProfileManager.java
示例17: EdgeFilterSequence
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
/**
* Creates an edges filter which accepts both direction of the specified
* vehicle.
*/
public EdgeFilterSequence(ArrayList<EdgeFilter> edgeFilters) {
this.edgeFilters = edgeFilters;
this.filtersCount = edgeFilters.size();
}
开发者ID:GIScience,项目名称:openrouteservice,代码行数:9,代码来源:EdgeFilterSequence.java
示例18: addFilter
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
public void addFilter(EdgeFilter e) {
edgeFilters.add(e);
filtersCount++;
}
开发者ID:GIScience,项目名称:openrouteservice,代码行数:5,代码来源:EdgeFilterSequence.java
示例19: setEdgeFilter
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
public AbstractManyToManyRoutingAlgorithm setEdgeFilter(EdgeFilter additionalEdgeFilter) {
_additionalEdgeFilter = additionalEdgeFilter;
return this;
}
开发者ID:GIScience,项目名称:openrouteservice,代码行数:5,代码来源:AbstractManyToManyRoutingAlgorithm.java
示例20: setEdgeFilter
import com.graphhopper.routing.util.EdgeFilter; //导入依赖的package包/类
public AbstractOneToManyRoutingAlgorithm setEdgeFilter(EdgeFilter additionalEdgeFilter) {
this.additionalEdgeFilter = additionalEdgeFilter;
return this;
}
开发者ID:GIScience,项目名称:openrouteservice,代码行数:5,代码来源:AbstractOneToManyRoutingAlgorithm.java
注:本文中的com.graphhopper.routing.util.EdgeFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论