Skip to content

Commit

Permalink
** Reimplemented getNextFeature() so features are visible again
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@2264 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
larsl committed Nov 16, 2004
1 parent f7bcfee commit e4bf3e8
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 38 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Expand Up @@ -3,6 +3,9 @@ QGIS Change Log
------------------------------------------------------------------------------
Version 0.6 'Simon' .... development version

2004-11-16 [larsl] 0.5.0devel24
** Reimplemented getNextFeature() so features are visible again

2004-11-13 [larsl] 0.5.0devel23
** Changed QgsIdentifyResults and QgsVectorLayer to show all attributes
automatically (expand the feature node) if only one feature is identified
Expand Down
2 changes: 1 addition & 1 deletion configure.in
Expand Up @@ -26,7 +26,7 @@ dnl ---------------------------------------------------------------------------
MAJOR_VERSION=0
MINOR_VERSION=5
MICRO_VERSION=0
EXTRA_VERSION=23
EXTRA_VERSION=24
if test $EXTRA_VERSION -eq 0; then
VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}
else
Expand Down
48 changes: 20 additions & 28 deletions providers/gpx/qgsgpxprovider.cpp
Expand Up @@ -167,24 +167,18 @@ QgsFeature * QgsGPXProvider::getNextFeature(std::list<int>& attlist) {

bool QgsGPXProvider::getNextFeature(QgsFeature* feature,
std::list<int>& attlist) {
bool result = false;
bool result = false;

/*std::list<int>::const_iterator iter;
std::list<int>::const_iterator iter;

if (mFeatureType == WaypointType) {
// go through the list of waypoints and return the first one that is in
// the bounds rectangle
int maxFid = data->getNumberOfWaypoints() +
(getnotcommitted ? mAddedFeatures.size() : 0);
int maxFid = data->getNumberOfWaypoints();

for (; mFid < maxFid; ++mFid) {
const Waypoint* wpt;
if (mFid < data->getNumberOfWaypoints())
wpt = &(data->getWaypoint(mFid));
else {
wpt = dynamic_cast<Waypoint*>
(mAddedFeatures[mFid - data->getNumberOfWaypoints()]);
}
wpt = &(data->getWaypoint(mFid));
if (boundsCheck(wpt->lon, wpt->lat)) {
feature->setFeatureId(mFid);
result = true;
Expand Down Expand Up @@ -241,17 +235,11 @@ bool QgsGPXProvider::getNextFeature(QgsFeature* feature,
else if (mFeatureType == RouteType) {
// go through the routes and return the first one that is in the bounds
// rectangle
int maxFid = data->getNumberOfRoutes() +
(getnotcommitted ? mAddedFeatures.size() : 0);
int maxFid = data->getNumberOfRoutes();
for (; mFid < maxFid; ++mFid) {
const Route* rte;
if (mFid < data->getNumberOfRoutes())
rte = &(data->getRoute(mFid));
else {
rte = dynamic_cast<Route*>
(mAddedFeatures[mFid - data->getNumberOfRoutes()]);
}
rte = &(data->getRoute(mFid));

if (rte->points.size() == 0)
continue;
const Routepoint& rtept(rte->points[0]);
Expand Down Expand Up @@ -306,16 +294,10 @@ bool QgsGPXProvider::getNextFeature(QgsFeature* feature,
else if (mFeatureType == TrackType) {
// go through the tracks and return the first one that is in the bounds
// rectangle
int maxFid = data->getNumberOfTracks() +
(getnotcommitted ? mAddedFeatures.size() : 0);
int maxFid = data->getNumberOfTracks();
for (; mFid < maxFid; ++mFid) {
const Track* trk;
if (mFid < data->getNumberOfTracks())
trk = &(data->getTrack(mFid));
else {
trk = dynamic_cast<Track*>
(mAddedFeatures[mFid - data->getNumberOfTracks()]);
}
trk = &(data->getTrack(mFid));

if (trk->segments.size() == 0)
continue;
Expand Down Expand Up @@ -369,7 +351,6 @@ bool QgsGPXProvider::getNextFeature(QgsFeature* feature,
}
}
}
*/
return result;
}

Expand Down Expand Up @@ -549,7 +530,18 @@ bool QgsGPXProvider::isValid(){
return mValid;
}


bool QgsGPXProvider::addFeatures(std::list<QgsFeature*> flist) {
for (std::list<QgsFeature*>::const_iterator iter = flist.begin();
iter != flist.end(); ++iter) {
if (!addFeature(*iter))
return false;
}
return true;
}


bool QgsGPXProvider::addFeature(QgsFeature* f) {
return false;
}

Expand Down
14 changes: 5 additions & 9 deletions providers/gpx/qgsgpxprovider.h
Expand Up @@ -129,16 +129,13 @@ class QgsGPXProvider : public QgsVectorDataProvider {
*/
bool isValid();

/**Returns true if the provider is in editing mode*/
virtual bool isEditable() const { return mEditable; }

/**Returns true if the provider has been modified since the last commit*/
virtual bool isModified() const { return mAddedFeatures.size() > 0; }

/**Adds a feature
/**Adds a list of features
@return true in case of success and false in case of failure*/
bool addFeatures(std::list<QgsFeature*> flist);

/** Adds one feature (used by addFeatures()) */
bool QgsGPXProvider::addFeature(QgsFeature* f);

/**Returns the default value for attribute @c attr for feature @c f. */
QString getDefaultValue(const QString& attr, QgsFeature* f);

Expand All @@ -151,15 +148,14 @@ class QgsGPXProvider : public QgsVectorDataProvider {
*/
bool boundsCheck(double x, double y);

bool supportsFeatureAddition(){return true;}
bool supportsFeatureAddition(){return false;}

private:

/** Internal function used by the other getNextFeature() functions. */
bool getNextFeature(QgsFeature* feature, std::list<int>& attlist);

bool mEditable;
std::vector<GPSObject*> mAddedFeatures;
GPSData* data;
void fillMinMaxCash();
//! Fields
Expand Down

0 comments on commit e4bf3e8

Please sign in to comment.