single_select.patch

Jeremy Palmer, 2010-08-30 06:45 PM

Download (901 Bytes)

View differences:

src/app/qgsmaptoolselectutils.cpp (working copy)
134 134
  QgsFeatureIds newSelectedFeatures;
135 135
  QgsFeature f;
136 136
  int closestFeatureId = 0;
137
  bool foundSingleFeature = false;
137 138
  double closestFeatureDist = std::numeric_limits<double>::max();
138 139
  while ( vlayer->nextFeature( f ) )
139 140
  {
......
144 145
    }
145 146
    if ( singleSelect )
146 147
    {
148
      foundSingleFeature = true;
147 149
      double distance = g->distance( selectGeomTrans );
148 150
      if ( distance <= closestFeatureDist )
149 151
      {
......
156 158
      newSelectedFeatures.insert( f.id() );
157 159
    }
158 160
  }
159
  if ( singleSelect && closestFeatureId > 0 )
161
  if ( singleSelect && foundSingleFeature )
160 162
  {
161 163
    newSelectedFeatures.insert( closestFeatureId );
162 164
  }