use of net.osmand.plus.GPXUtilities.GPXFile in project Osmand by osmandapp.
the class MapContextMenu method addNewWptToGPXFile.
public AlertDialog addNewWptToGPXFile(final LatLon latLon, final String title, final String categoryName, final int categoryColor, final boolean skipDialog) {
CallbackWithObject<GPXFile[]> callbackWithObject = new CallbackWithObject<GPXFile[]>() {
@Override
public boolean processResult(GPXFile[] result) {
GPXFile gpxFile;
if (result != null && result.length > 0) {
gpxFile = result[0];
} else {
gpxFile = mapActivity.getMyApplication().getSavingTrackHelper().getCurrentGpx();
}
getWptPtPointEditor().add(gpxFile, latLon, title, categoryName, categoryColor, skipDialog);
return true;
}
};
return GpxUiHelper.selectSingleGPXFile(mapActivity, true, callbackWithObject);
}
use of net.osmand.plus.GPXUtilities.GPXFile in project Osmand by osmandapp.
the class MapContextMenu method addWptPt.
public void addWptPt(LatLon latLon, String title, String categoryName, int categoryColor, boolean skipDialog) {
final List<SelectedGpxFile> list = mapActivity.getMyApplication().getSelectedGpxHelper().getSelectedGPXFiles();
if (list.isEmpty() || (list.size() == 1 && list.get(0).getGpxFile().showCurrentTrack)) {
GPXFile gpxFile = mapActivity.getMyApplication().getSavingTrackHelper().getCurrentGpx();
getWptPtPointEditor().add(gpxFile, latLon, title, categoryName, categoryColor, skipDialog);
} else {
addNewWptToGPXFile(latLon, title, categoryName, categoryColor, skipDialog);
}
}
use of net.osmand.plus.GPXUtilities.GPXFile in project Osmand by osmandapp.
the class WptPtEditorFragment method syncGpx.
private void syncGpx(GPXFile gpxFile) {
File gpx = new File(gpxFile.path);
if (gpx.exists()) {
MapMarkersHelper helper = getMyApplication().getMapMarkersHelper();
helper.runSynchronization(helper.getOrCreateGroup(gpx));
}
}
use of net.osmand.plus.GPXUtilities.GPXFile in project Osmand by osmandapp.
the class WptPtEditorFragment method doAddWpt.
private void doAddWpt(String name, String category, String description) {
wpt.name = name;
wpt.category = category;
wpt.desc = description;
if (color != 0) {
wpt.setColor(color);
}
GPXFile gpx = editor.getGpxFile();
if (gpx != null) {
if (gpx.showCurrentTrack) {
wpt = savingTrackHelper.insertPointData(wpt.getLatitude(), wpt.getLongitude(), System.currentTimeMillis(), description, name, category, color);
if (!editor.isGpxSelected()) {
selectedGpxHelper.setGpxFileToDisplay(gpx);
}
} else {
addWpt(gpx, description, name, category, color);
new SaveGpxAsyncTask(getMyApplication(), gpx, editor.isGpxSelected()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
syncGpx(gpx);
}
}
use of net.osmand.plus.GPXUtilities.GPXFile in project Osmand by osmandapp.
the class WptPtEditorFragment method doUpdateWpt.
private void doUpdateWpt(String name, String category, String description) {
GPXFile gpx = editor.getGpxFile();
if (gpx != null) {
if (gpx.showCurrentTrack) {
savingTrackHelper.updatePointData(wpt, wpt.getLatitude(), wpt.getLongitude(), System.currentTimeMillis(), description, name, category, color);
if (!editor.isGpxSelected()) {
selectedGpxHelper.setGpxFileToDisplay(gpx);
}
} else {
gpx.updateWptPt(wpt, wpt.getLatitude(), wpt.getLongitude(), System.currentTimeMillis(), description, name, category, color);
new SaveGpxAsyncTask(getMyApplication(), gpx, editor.isGpxSelected()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
syncGpx(gpx);
}
}
Aggregations