- int cropIndex = inTrackInfo.getTrack().getNumPoints() - _numLoaded;\r
- inTrackInfo.getTrack().cropTo(cropIndex);\r
+ if (_numPoints > 0)\r
+ {\r
+ cropIndex = inTrackInfo.getTrack().getNumPoints() - _numPoints;\r
+ inTrackInfo.getTrack().cropTo(cropIndex);\r
+ }\r
+ else\r
+ {\r
+ // Loop through the points (if any) and detach them\r
+ for (int i=0; i<_numPhotos; i++)\r
+ {\r
+ Photo photo = inTrackInfo.getPhotoList().getPhoto(inTrackInfo.getPhotoList().getNumPhotos() - 1 - i);\r
+ if (photo.isConnected()) {\r
+ DataPoint point = photo.getDataPoint();\r
+ if (point != null) {point.setPhoto(null);}\r
+ }\r
+ }\r
+ }\r