diff options
| author | Keith Packard <keithp@keithp.com> | 2015-05-26 23:05:49 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2015-05-26 23:05:49 -0700 | 
| commit | 103a50db50be55c2293468d273dd94472dd89d94 (patch) | |
| tree | 406a5d725af1811a595e954bd4377fad72986c44 /altoslib/AltosMap.java | |
| parent | 2509b664df6a13e6ae9e6753dc9fa0d696a4f6c7 (diff) | |
altosdroid: Place icons on screen instead of drawing path
This makes drawing a bunch faster, and locating stuff on the screen easier.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosMap.java')
| -rw-r--r-- | altoslib/AltosMap.java | 36 | 
1 files changed, 24 insertions, 12 deletions
| diff --git a/altoslib/AltosMap.java b/altoslib/AltosMap.java index bdb60f0c..762054a3 100644 --- a/altoslib/AltosMap.java +++ b/altoslib/AltosMap.java @@ -58,8 +58,9 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {  	LinkedList<AltosMapMark> marks = new LinkedList<AltosMapMark>(); -	AltosMapPath	path; -	AltosMapLine	line; +	AltosMapPath		path; +	AltosMapLine		line; +	public AltosLatLon	last_position;  	boolean		have_boost = false;  	boolean		have_landed = false; @@ -195,8 +196,6 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {  		if (!gps.locked && gps.nsat < 4)  			return; -		AltosMapRectangle	damage = path.add(gps.lat, gps.lon, state.state); -  		switch (state.state) {  		case AltosLib.ao_flight_boost:  			if (!have_boost) { @@ -212,8 +211,15 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {  			break;  		} -		if (damage != null) -			repaint(damage, AltosMapPath.stroke_width); +		if (path != null) { +			AltosMapRectangle	damage = path.add(gps.lat, gps.lon, state.state); + +			if (damage != null) +				repaint(damage, AltosMapPath.stroke_width); +		} + +		last_position = new AltosLatLon(gps.lat, gps.lon); +  		maybe_centre(gps.lat, gps.lon);  	} @@ -323,9 +329,11 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {  				mark.paint(transform);  		} -		path.paint(transform); +		if (path != null) +			path.paint(transform); -		line.paint(transform); +		if (line != null) +			line.paint(transform);  	}  	/* AltosMapTileListener methods */ @@ -368,13 +376,17 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {  	}  	private void line_start(int x, int y) { -		line.pressed(new AltosPointInt(x, y), transform); -		repaint(); +		if (line != null) { +			line.pressed(new AltosPointInt(x, y), transform); +			repaint(); +		}  	}  	private void line(int x, int y) { -		line.dragged(new AltosPointInt(x, y), transform); -		repaint(); +		if (line != null) { +			line.dragged(new AltosPointInt(x, y), transform); +			repaint(); +		}  	}  	public void touch_start(int x, int y, boolean is_drag) { | 
