use of net.osmand.plus.views.OsmandMapLayer.DrawSettings in project Osmand by osmandapp.
the class MapInfoWidgetsFactory method createGPSInfoControl.
public TextInfoWidget createGPSInfoControl(final MapActivity map) {
final OsmandApplication app = map.getMyApplication();
final OsmAndLocationProvider loc = app.getLocationProvider();
final TextInfoWidget gpsInfoControl = new TextInfoWidget(map) {
private int u = -1;
private int f = -1;
@Override
public boolean updateInfo(DrawSettings d) {
GPSInfo gpsInfo = loc.getGPSInfo();
if (gpsInfo.usedSatellites != u || gpsInfo.foundSatellites != f) {
u = gpsInfo.usedSatellites;
f = gpsInfo.foundSatellites;
setText(gpsInfo.usedSatellites + "/" + gpsInfo.foundSatellites, "");
return true;
}
return false;
}
};
gpsInfoControl.setIcons(R.drawable.widget_gps_info_day, R.drawable.widget_gps_info_night);
gpsInfoControl.setText(null, null);
gpsInfoControl.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
new StartGPSStatus(map).run();
}
});
return gpsInfoControl;
}
use of net.osmand.plus.views.OsmandMapLayer.DrawSettings in project Osmand by osmandapp.
the class OsmAndMapSurfaceView method onDraw.
@Override
protected void onDraw(Canvas canvas) {
if (mapView == null) {
return;
}
boolean nightMode = mapView.getApplication().getDaynightHelper().isNightMode();
DrawSettings drawSettings = new DrawSettings(nightMode, false);
mapView.drawOverMap(canvas, mapView.getCurrentRotatedTileBox().copy(), drawSettings);
}
use of net.osmand.plus.views.OsmandMapLayer.DrawSettings in project Osmand by osmandapp.
the class OsmandMapTileView method refreshMap.
// this method could be called in non UI thread
public void refreshMap(final boolean updateVectorRendering) {
if (view != null && view.isShown()) {
boolean nightMode = application.getDaynightHelper().isNightMode();
Boolean currentNightMode = this.nightMode;
boolean forceUpdateVectorDrawing = currentNightMode != null && currentNightMode != nightMode;
if (forceUpdateVectorDrawing) {
resetDefaultColor();
}
this.nightMode = nightMode;
DrawSettings drawSettings = new DrawSettings(nightMode, updateVectorRendering || forceUpdateVectorDrawing);
sendRefreshMapMsg(drawSettings, 20);
refreshBufferImage(drawSettings);
}
}
use of net.osmand.plus.views.OsmandMapLayer.DrawSettings in project Osmand by osmandapp.
the class OsmAndMapLayersView method onDraw.
@Override
protected void onDraw(Canvas canvas) {
if (mapView == null) {
return;
}
boolean nightMode = mapView.getApplication().getDaynightHelper().isNightMode();
DrawSettings drawSettings = new DrawSettings(nightMode, false);
mapView.drawOverMap(canvas, mapView.getCurrentRotatedTileBox().copy(), drawSettings);
}
use of net.osmand.plus.views.OsmandMapLayer.DrawSettings in project Osmand by osmandapp.
the class RouteInfoWidgetsFactory method createNextInfoControl.
public NextTurnInfoWidget createNextInfoControl(final Activity activity, final OsmandApplication app, boolean horisontalMini) {
final OsmandSettings settings = app.getSettings();
final RoutingHelper routingHelper = app.getRoutingHelper();
final NextTurnInfoWidget nextTurnInfo = new NextTurnInfoWidget(activity, app, horisontalMini) {
NextDirectionInfo calc1 = new NextDirectionInfo();
@Override
public boolean updateInfo(DrawSettings drawSettings) {
boolean followingMode = routingHelper.isFollowingMode() || app.getLocationProvider().getLocationSimulation().isRouteAnimating();
TurnType turnType = null;
boolean deviatedFromRoute = false;
int turnImminent = 0;
int nextTurnDistance = 0;
if (routingHelper != null && routingHelper.isRouteCalculated() && followingMode) {
deviatedFromRoute = routingHelper.isDeviatedFromRoute();
if (deviatedFromRoute) {
turnImminent = 0;
turnType = TurnType.valueOf(TurnType.OFFR, settings.DRIVING_REGION.get().leftHandDriving);
setDeviatePath((int) routingHelper.getRouteDeviation());
} else {
NextDirectionInfo r = routingHelper.getNextRouteDirectionInfo(calc1, true);
if (r != null && r.distanceTo > 0 && r.directionInfo != null) {
turnType = r.directionInfo.getTurnType();
nextTurnDistance = r.distanceTo;
turnImminent = r.imminent;
}
}
}
setTurnType(turnType);
setTurnImminent(turnImminent, deviatedFromRoute);
setTurnDistance(nextTurnDistance);
return true;
}
};
nextTurnInfo.setOnClickListener(new View.OnClickListener() {
// int i = 0;
// boolean leftSide = false;
@Override
public void onClick(View v) {
// TurnPathHelper.calcTurnPath(nextTurnInfo.pathForTurn, nextTurnInfo.turnType,nextTurnInfo.pathTransform);
if (routingHelper.isRouteCalculated() && !routingHelper.isDeviatedFromRoute()) {
routingHelper.getVoiceRouter().announceCurrentDirection(null);
}
}
});
// initial state
return nextTurnInfo;
}
Aggregations