Skip to content
Permalink
Browse files
** Reimplemented getNextFeature() so features are visible again
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 e4bf3e86834863fc8a719d22506f2657ffcb1eeb
Showing with 29 additions and 38 deletions.
  1. +3 −0 ChangeLog
  2. +1 −1 configure.in
  3. +20 −28 providers/gpx/qgsgpxprovider.cpp
  4. +5 −9 providers/gpx/qgsgpxprovider.h
@@ -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
@@ -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
@@ -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;
@@ -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]);
@@ -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;
@@ -369,7 +351,6 @@ bool QgsGPXProvider::getNextFeature(QgsFeature* feature,
}
}
}
*/
return result;
}

@@ -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;
}

@@ -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);

@@ -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

0 comments on commit e4bf3e8

Please sign in to comment.