Skip to content

Commit

Permalink
Set icon, description, autor and URL of cartige to Locus map point. C…
Browse files Browse the repository at this point in the history
…orrect line style for Locus zones.
  • Loading branch information
Dratenik authored and bekuno committed Feb 27, 2023
1 parent 5d13ac3 commit 664ae8b
Showing 1 changed file with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@

package menion.android.whereyougo.maps.utils;

import menion.android.whereyougo.R;
import menion.android.whereyougo.gui.activity.MainActivity;
import menion.android.whereyougo.gui.activity.wherigo.DetailsActivity;
import menion.android.whereyougo.gui.utils.UtilsWherigo;
import menion.android.whereyougo.utils.Images;
import menion.android.whereyougo.utils.Utils;

import android.graphics.Color;

Expand All @@ -35,6 +38,7 @@
import locus.api.objects.geoData.Point;
import locus.api.objects.geoData.Track;
import locus.api.objects.styles.GeoDataStyle;
import locus.api.objects.styles.LineStyle;

public class LocusMapDataProvider implements MapDataProvider {
private static LocusMapDataProvider instance = null;
Expand Down Expand Up @@ -64,8 +68,9 @@ public void addAll() {
public void addCartridges(Vector<CartridgeFile> cartridges) {
if (cartridges == null)
return;
// Bitmap b = Images.getImageB(R.drawable.wherigo, (int) Utils.getDpPixels(32.0f));
// pack.setBitmap(b);

pack.setBitmap(Images.getImageB(R.drawable.icon_gc_wherigo, (int) Utils.getDpPixels(32.0f)));

for (CartridgeFile cartridge : cartridges) {
// do not show waypoints that are "Play anywhere" (with zero
// coordinates)
Expand All @@ -76,9 +81,15 @@ public void addCartridges(Vector<CartridgeFile> cartridges) {
// construct waypoint
Location loc = new Location(cartridge.latitude, cartridge.longitude);
Point wpt = new Point(cartridge.name, loc);
wpt.addParameter(GeoDataExtra.PAR_DESCRIPTION, cartridge.description);
wpt.addParameter(GeoDataExtra.PAR_SOURCE, cartridge.url);
//TODO wpt.addUrl(cartridge.url);

final GeoDataExtra gde = new GeoDataExtra();
gde.addParameter(GeoDataExtra.PAR_DESCRIPTION, cartridge.description);
gde.addParameter(GeoDataExtra.PAR_COMMENT, cartridge.author);
if (cartridge.url != null && cartridge.url.length() > 0) {
gde.addAttachment(GeoDataExtra.AttachType.URL, null, cartridge.url);
}
wpt.setExtraData(gde);

pack.addPoint(wpt);
}
}
Expand All @@ -103,10 +114,17 @@ public void addZone(Zone z, boolean mark) {
if (locs.size() >= 3)
locs.add(locs.get(0));

LineStyle lineStyle = new LineStyle();
lineStyle.setColoring(LineStyle.Coloring.SIMPLE);
lineStyle.setColorBase(Color.MAGENTA);
lineStyle.setWidth(2.0f);
lineStyle.setUnits(LineStyle.Units.PIXELS);

GeoDataStyle geoDataStyle = new GeoDataStyle();
geoDataStyle.setLineStyle(lineStyle);

Track track = new Track();
GeoDataStyle style = new GeoDataStyle();
style.setLineStyle(Color.MAGENTA, 2.0f);
track.setStyleNormal(style);
track.setStyleHighlight(geoDataStyle);
track.setPoints(locs);
track.setName(z.name);

Expand All @@ -128,7 +146,6 @@ public void addZones(Vector<Zone> zones, EventTable mark) {

public void clear() {
tracks.clear();
//TODO pack.reset();
}

public PackPoints getPoints() {
Expand Down

0 comments on commit 664ae8b

Please sign in to comment.