Skip to content

Commit d8e9c5e

Browse files
author
Peter
committed
Merge branch 'master' into public
2 parents c71a68e + fff4e12 commit d8e9c5e

File tree

7 files changed

+53
-5
lines changed

7 files changed

+53
-5
lines changed

core/src/main/java/com/graphhopper/GraphHopper.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ public GraphHopper setCHShortcuts( String weighting )
198198
return this;
199199
}
200200

201+
public String getCHWeighting()
202+
{
203+
return chWeighting;
204+
}
205+
201206
/**
202207
* Disables contraction hierarchies. Enabled by default.
203208
*/

core/src/main/java/com/graphhopper/routing/util/EncodingManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import com.graphhopper.reader.OSMTurnRelation;
3434
import com.graphhopper.reader.OSMTurnRelation.TurnCostTableEntry;
3535
import com.graphhopper.reader.OSMWay;
36-
import com.graphhopper.routing.util.TurnCostEncoder.NoTurnCostsEncoder;
3736

3837
/**
3938
* Manager class to register encoder, assign their flag values and check objects with all encoders

core/src/main/java/com/graphhopper/storage/GraphHopperStorage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,8 +1413,8 @@ public boolean loadExisting()
14131413
int hash = nodes.getHeader(0);
14141414
if (hash != getClass().getName().hashCode())
14151415
{
1416-
throw new IllegalStateException("Cannot load the graph - it wasn't create via "
1417-
+ getClass().getName() + "! " + dir);
1416+
throw new IllegalStateException("Cannot load the graph - use instance "
1417+
+ getClass().getName() + " to load it! " + dir);
14181418
}
14191419
nodeEntryBytes = nodes.getHeader(1 * 4);
14201420
nodeCount = nodes.getHeader(2 * 4);

core/src/main/java/com/graphhopper/storage/StorableProperties.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ public StorableProperties put( String key, String val )
8484
return this;
8585
}
8686

87+
/**
88+
* Before it saves this value it creates a string out of it.
89+
*/
8790
public StorableProperties put( String key, Object val )
8891
{
8992
map.put(key, val.toString());

core/src/main/java/com/graphhopper/util/StopWatch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public StopWatch stop()
6060
}
6161

6262
/**
63-
* @return the delta nanoTime in milliseconds
63+
* @return the time delta in milliseconds
6464
*/
6565
public long getTime()
6666
{

core/src/main/java/com/graphhopper/util/shapes/CoordTrig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public double getLat()
5151

5252
public boolean isValid()
5353
{
54-
return lat != Double.NaN && lon != Double.NaN;
54+
return !Double.isNaN(lat) && !Double.isNaN(lon);
5555
}
5656

5757
public void setValue( T t )
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Licensed to Peter Karich under one or more contributor license
3+
* agreements. See the NOTICE file distributed with this work for
4+
* additional information regarding copyright ownership.
5+
*
6+
* Peter Karich licenses this file to you under the Apache License,
7+
* Version 2.0 (the "License"); you may not use this file except
8+
* in compliance with the License. You may obtain a copy of the
9+
* License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
package com.graphhopper.util.shapes;
20+
21+
import org.junit.Test;
22+
import static org.junit.Assert.*;
23+
24+
/**
25+
*
26+
* @author Peter Karich
27+
*/
28+
public class CoordTrigTest
29+
{
30+
@Test
31+
public void testIsValid()
32+
{
33+
CoordTrig instance = new CoordTrig();
34+
assertFalse(instance.isValid());
35+
instance.lat = 1;
36+
assertFalse(instance.isValid());
37+
instance.lon = 1;
38+
assertTrue(instance.isValid());
39+
}
40+
41+
}

0 commit comments

Comments
 (0)