fixed scaling in routing animation
This commit is contained in:
parent
02d053f189
commit
307a50b840
1 changed files with 8 additions and 9 deletions
|
@ -48,8 +48,9 @@ public class BRouterView extends View
|
||||||
|
|
||||||
private int centerLon;
|
private int centerLon;
|
||||||
private int centerLat;
|
private int centerLat;
|
||||||
private double scaleLon;
|
private double scaleLon; // ilon -> pixel
|
||||||
private double scaleLat;
|
private double scaleLat; // ilat -> pixel
|
||||||
|
private double scaleMeter2Pixel;
|
||||||
private List<OsmNodeNamed> wpList;
|
private List<OsmNodeNamed> wpList;
|
||||||
private List<OsmNodeNamed> nogoList;
|
private List<OsmNodeNamed> nogoList;
|
||||||
private List<OsmNodeNamed> nogoVetoList;
|
private List<OsmNodeNamed> nogoVetoList;
|
||||||
|
@ -517,9 +518,9 @@ public class BRouterView extends View
|
||||||
|
|
||||||
scaleLon = imgw / ( difflon * 1.5 );
|
scaleLon = imgw / ( difflon * 1.5 );
|
||||||
scaleLat = imgh / ( difflat * 1.5 );
|
scaleLat = imgh / ( difflat * 1.5 );
|
||||||
double scaleMin = scaleLon < scaleLat ? scaleLon : scaleLat;
|
scaleMeter2Pixel = scaleLon < scaleLat ? scaleLon : scaleLat;
|
||||||
scaleLat *= dlon2m;
|
scaleLon = scaleMeter2Pixel*dlon2m;
|
||||||
scaleLon *= dlat2m;
|
scaleLat = scaleMeter2Pixel*dlat2m;
|
||||||
|
|
||||||
startTime = System.currentTimeMillis();
|
startTime = System.currentTimeMillis();
|
||||||
RoutingContext.prepareNogoPoints( nogoList );
|
RoutingContext.prepareNogoPoints( nogoList );
|
||||||
|
@ -636,8 +637,7 @@ public class BRouterView extends View
|
||||||
int x = imgw / 2 + (int) ( scaleLon * lon );
|
int x = imgw / 2 + (int) ( scaleLon * lon );
|
||||||
int y = imgh / 2 - (int) ( scaleLat * lat );
|
int y = imgh / 2 - (int) ( scaleLat * lat );
|
||||||
|
|
||||||
double[] lonlat2m = CheapRulerSingleton.getLonLatToMeterScales( centerLat );
|
int ir = (int) ( n.radius * scaleMeter2Pixel );
|
||||||
int ir = (int) ( n.radius * scaleLat / lonlat2m[1]);
|
|
||||||
if ( ir > minradius )
|
if ( ir > minradius )
|
||||||
{
|
{
|
||||||
Paint paint = new Paint();
|
Paint paint = new Paint();
|
||||||
|
@ -662,8 +662,7 @@ public class BRouterView extends View
|
||||||
|
|
||||||
private void paintPolygon( Canvas canvas, OsmNogoPolygon p, int minradius )
|
private void paintPolygon( Canvas canvas, OsmNogoPolygon p, int minradius )
|
||||||
{
|
{
|
||||||
double[] lonlat2m = CheapRulerSingleton.getLonLatToMeterScales( centerLat );
|
final int ir = (int) ( p.radius * scaleMeter2Pixel );
|
||||||
final int ir = (int) ( p.radius * scaleLat / lonlat2m[1] );
|
|
||||||
if ( ir > minradius )
|
if ( ir > minradius )
|
||||||
{
|
{
|
||||||
Paint paint = new Paint();
|
Paint paint = new Paint();
|
||||||
|
|
Loading…
Reference in a new issue