[Qgis-developer] Re: [QGIS Commit] SVN [mhugent] r5489 - in
trunk/qgis: images/themes/default src/gui
humarco
marco.hugentobler at karto.baug.ethz.ch
Tue Jul 11 02:23:46 EDT 2006
Brendan,
I would be extremely carefull to commit 'extensive remodelling' to svn head
before 0.8 is out. In my opinion, this is a good thing for after 0.8 or for a
branch. I think we will have a lot of new bugs when making changes in the
core of qgis and i am worried that 0.8 will never come out.
Marco
Am Dienstag, 11. Juli 2006 00:52 schrieben Sie:
> Marco,
>
> Don't worry about making the changes - I have done extensive remodelling
> over the last few days (not yet committed to svn though). I wouldn't
> want to waste your time.
>
> I did realise a bug with my original implementation: That if you panned
> a selected geometry off the canvas, it would subsequently not be picked
> up in a Copy operation.
>
> I've also noticed that there's also a Copy operation on the attributes
> table! I will have to merge the two Copy operations together.
>
> Also, the intent of mCachedGeometries was only ever to cache those
> geometries that were last drawn to the canvas. If all geometries were
> cached, it blows out the memory usage on large tables (which I have a
> few of). My remodelling restores this meaning (therefore the current
> function of cacheGeometries() is obsolete).
>
> Please feel free to cross post this to the Qgis-developers list.
>
>
> Brendan
>
> On Mon, 2006-07-10 at 10:33 +0200, humarco wrote:
> > Hi Brendan,
> >
> > Sorry, i forgot to reenable the feature of copying attributes when i did
> > this change.
> >
> > I did these changes when i tried to make memory management/ changed,
> > cachedGeometries, etc. stable for 0.8.
> > The nice thing with using the cached geometries (like it is now in
> > selectedFeatures() ) is that it is sure they contain the latest geometry
> > changes. The disadvantage is that there are no attributes. I think to
> > reenable the attributes copying it is needed to look at the changed
> > features, the added features, the deleted features and the changed
> > geometries.
> >
> > I'll try to fix this in the next days.
> >
> > Marco
> >
> > Am Sonntag, 9. Juli 2006 05:55 schrieben Sie:
> > > Hi Marco,
> > >
> > > I was wondering why QgsVectorLayer::selectedFeatures() no longer
> > > selects the *attributes* of features and only the *geometries* as of
> > > your change r5489?
> > >
> > > The main thing I mind about this change is that it really should just
> > > be called selectedGeometries() if that's all it does now.
> > >
> > > In my mind's eye, I wanted cut-copy-paste to include all attributes of
> > > a feature, not just the geometry.
> > >
> > >
> > > Brendan
> > >
> > > On Fri, 2006-05-26 at 09:40 +0100, noreply at qgis.org wrote:
> > > > Author: mhugent
> > > > Date: 2006-05-26 09:40:36 +0100 (Fri, 26 May 2006)
> > > > New Revision: 5489
> > > >
> > > > Added:
> > > > trunk/qgis/images/themes/default/mActionEditCopy.png
> > > > trunk/qgis/images/themes/default/mActionEditCut.png
> > > > trunk/qgis/images/themes/default/mActionEditPaste.png
> > > > Modified:
> > > > trunk/qgis/src/gui/qgisapp.cpp
> > > > trunk/qgis/src/gui/qgisapp.h
> > > > trunk/qgis/src/gui/qgsvectorlayer.cpp
> > > > trunk/qgis/src/gui/qgsvectorlayer.h
> > > > Log:
> > > > reenabled the possibility to copy/cut-paste geometries (in the
> > > > digitizing toolbar)
> > >
> > > [...]
> > >
> > > > Modified: trunk/qgis/src/gui/qgsvectorlayer.cpp
> > > > ===================================================================
> > > > --- trunk/qgis/src/gui/qgsvectorlayer.cpp 2006-05-24 15:18:20 UTC
> > > > (rev 5488) +++ trunk/qgis/src/gui/qgsvectorlayer.cpp 2006-05-26
> > > > 08:40:36 UTC (rev 5489)
> > >
> > > [...]
> > >
> > > > @@ -2447,93 +2451,51 @@
> > > > return true;
> > > > }
> > > >
> > > > -
> > > > std::vector<QgsFeature>* QgsVectorLayer::selectedFeatures()
> > > > {
> > > > -#ifdef QGISDEBUG
> > > > - std::cout << "QgsVectorLayer::selectedFeatures: entering"
> > > > - << "." << std::endl;
> > > > -#endif
> > > > -
> > > > if (!dataProvider)
> > > > {
> > > > return 0;
> > > > }
> > > > -
> > > > - //TODO: Maybe make this a bit more heap-friendly (i.e. see where
> > > > we can use references instead of copies) +
> > > > std::vector<QgsFeature>* features = new std::vector<QgsFeature>;
> > > > + if(mSelected.size() == 0)
> > > > + {
> > > > + return features;
> > > > + }
> > > >
> > > > - for (std::set<int>::iterator it = mSelected.begin();
> > > > - it != mSelected.end();
> > > > - ++it)
> > > > + //we need to cache all the features first (which has already been
> > > > done if a layer is editable) + if(!mEditable)
> > > > + {
> > > > + deleteCachedGeometries();
> > > > + cacheGeometries();
> > > > + }
> > > > +
> > > > + for (std::set<int>::iterator it = mSelected.begin(); it !=
> > > > mSelected.end(); ++it) {
> > > > - // Check this selected item against the committed or changed
> > > > features + // Check this selected item against the committed or
> > > > cached features if ( mCachedGeometries.find(*it) !=
> > > > mCachedGeometries.end() ) { -#ifdef QGISDEBUG
> > > > - std::cout << "QgsVectorLayer::selectedFeatures: found a cached
> > > > geometry: " - << std::endl;
> > > > -#endif
> > > > -
> > > > QgsFeature* f = new QgsFeature();
> > > > - int row = 0; //TODO: Get rid of this
> > > > -
> > > > - dataProvider->getFeatureAttributes(*it, row, f);
> > > > -
> > > > - // TODO: Should deep-copy here
> > > > - f->setGeometry(*mCachedGeometries[*it]);
> > > > -
> > > > -#ifdef QGISDEBUG
> > > > - std::cout << "QgsVectorLayer::selectedFeatures: '" <<
> > > > f->geometry()->wkt().toLocal8Bit().data() << "'" - << "." <<
> > > > std::endl;
> > > > -#endif
> > > > -
> > > > - // TODO: Mutate with uncommitted attributes / geometry
> > > > -
> > > > - // TODO: Retrieve details from provider
> > > > - /* features.push_back(
> > > > - QgsFeature(mCachedFeatures[*it],
> > > > - mChangedAttributes,
> > > > - mChangedGeometries)
> > > > - );*/
> > > > -
> > > > + f->setGeometry(*mCachedGeometries[*it]);//makes a deep copy of
> > > > the geometry features->push_back(*f);
> > > > -
> > > > -#ifdef QGISDEBUG
> > > > - std::cout << "QgsVectorLayer::selectedFeatures: added to
> > > > feature vector" - << "." << std::endl;
> > > > -#endif
> > > > -
> > > > + continue;
> > > > }
> > > > -
> > > > +
> > > > // Check this selected item against the uncommitted added
> > > > features - for (std::vector<QgsFeature*>::iterator iter =
> > > > mAddedFeatures.begin(); + /*for
> > > > (std::vector<QgsFeature*>::iterator iter = mAddedFeatures.begin();
> > > > iter != mAddedFeatures.end(); ++iter)
> > > > {
> > > > if ( (*it) == (*iter)->featureId() )
> > > > {
> > > > -#ifdef QGISDEBUG
> > > > - std::cout << "QgsVectorLayer::selectedFeatures: found an
> > > > added geometry: " - << std::endl;
> > > > -#endif
> > > > - features->push_back( **iter );
> > > > + features->push_back( **iter ); //shouldn't we make a deep
> > > > copy here? break;
> > > > }
> > > > - }
> > > > + }*/
> > > >
> > > > -#ifdef QGISDEBUG
> > > > - std::cout << "QgsVectorLayer::selectedFeatures: finished with
> > > > feature ID " << (*it) - << "." << std::endl;
> > > > -#endif
> > > > -
> > > > } // for each selected
> > > >
> > > > -#ifdef QGISDEBUG
> > > > - std::cout << "QgsVectorLayer::selectedFeatures: exiting"
> > > > - << "." << std::endl;
> > > > -#endif
> > > > -
> > > > return features;
> > > > }
> > >
> > > [...]
> > >
> > > > _______________________________________________
> > > > QGIS-commit mailing list
> > > > QGIS-commit at lists.qgis.org
> > > > http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-commit
More information about the Qgis-developer
mailing list