Changeset 29631 in osm for applications
- Timestamp:
- 2013-06-06T21:46:20+02:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/DirectUpload
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/DirectUpload
- Property svn:ignore
-
old new 2 2 build.log 3 3 build.err 4 bin
-
- Property svn:ignore
-
applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.java
r28014 r29631 32 32 33 33 import org.openstreetmap.josm.Main; 34 import org.openstreetmap.josm.data.gpx.GpxConstants; 34 35 import org.openstreetmap.josm.data.gpx.GpxData; 36 import org.openstreetmap.josm.data.gpx.GpxTrack; 35 37 import org.openstreetmap.josm.gui.ExtendedDialog; 36 38 import org.openstreetmap.josm.gui.JMultilineLabel; … … 140 142 141 143 List<String> descHistory = new LinkedList<String>(Main.pref.getCollection("directupload.description.history", new LinkedList<String>())); 142 // we have to reverse the history, because ComboBoxHistory will reverse it again in addElement()144 // we have to reverse the history, because ComboBoxHistory will reverse it again in addElement() 143 145 // XXX this should be handled in HistoryComboBox 144 146 Collections.reverse(descHistory); … … 175 177 176 178 private void initTitleAndDescriptionFromGpxData(GpxData gpxData) { 177 String description, title; 178 try { 179 description = gpxData.storageFile.getName().replaceAll("[&?/\\\\]"," ").replaceAll("(\\.[^.]*)$",""); 179 String description, title, tags = ""; 180 if (gpxData != null) { 181 GpxTrack firstTrack = gpxData.tracks.iterator().next(); 182 Object meta_desc = gpxData.attr.get(GpxConstants.META_DESC); 183 if (meta_desc != null) { 184 description = meta_desc.toString(); 185 } else if (firstTrack != null && gpxData.tracks.size() == 1 && firstTrack.get("desc") != null) { 186 description = firstTrack.getString("desc"); 187 } else { 188 description = gpxData.storageFile.getName().replaceAll("[&?/\\\\]"," ").replaceAll("(\\.[^.]*)$",""); 189 } 180 190 title = tr("Selected track: {0}", gpxData.storageFile.getName()); 191 Object meta_tags = gpxData.attr.get(GpxConstants.META_KEYWORDS); 192 if (meta_tags != null) { 193 tags = meta_tags.toString(); 194 } 181 195 } 182 catch(Exception e){196 else { 183 197 description = new SimpleDateFormat("yyMMddHHmmss").format(new Date()); 184 198 title = tr("No GPX layer selected. Cannot upload a trace."); … … 186 200 OutputDisplay.setText(title); 187 201 descriptionField.setText(description); 202 tagsField.setText(tags); 188 203 } 189 204 … … 191 206 * This is the actual workhorse that manages the upload. 192 207 * @param String Description of the GPX track being uploaded 193 * @param String Tags asso sciated with the GPX track being uploaded208 * @param String Tags associated with the GPX track being uploaded 194 209 * @param boolean Shall the GPX track be public 195 210 * @param GpxData The GPX Data to upload
Note:
See TracChangeset
for help on using the changeset viewer.