[Kstars-devel] Refined patch for wishlist 178232: List all objects within a rectangle

Khudyakov Alexey alexey.skladnoy at gmail.com
Fri Feb 5 17:06:18 CET 2010


В сообщении от Пятница 05 февраля 2010 07:23:24 Abhijit Apte написал:
> Two reasons:
> 1) Have added the function skyRegion() as a separate function because later
> on we can scale it up to support a user-defined region.. Then one has to
>  do, is to write overloaded functions for skyRegion(). Say user wants to
>  select from a circular region or a polygon for instance. I think it's fine
>  to add this skyRegion() function for now.
> 
Valid argument. But shouln'd it belong to SkyMesh then? It doesn't use 
SkyMapComposite at all.


> 2) The problem with making SkyPoint p1 and p2 const:
> While filling up the list with operator<<, it'd become a problem since
>  QList is instantiated with SkyPoint* whereas the arguments are of type
>  "const SkyPoint*".
> /home/kde-devel/kde/src/KDE/refactor/kdeedu/kstars/kstars/skycomponents/sky
> mapcomposite.cpp: In member function ‘QList<SkyObject*>
> SkyMapComposite::findObjectsInArea(const SkyPoint&, const SkyPoint&)’:
> /home/kde-devel/kde/src/KDE/refactor/kdeedu/kstars/kstars/skycomponents/sky
> mapcomposite.cpp:348: error: invalid conversion from ‘const SkyPoint*’ to
>  ‘SkyPoint*’
> /home/kde-devel/kde/src/KDE/refactor/kdeedu/kstars/kstars/skycomponents/sky
> mapcomposite.cpp:348: error:   initializing argument 1 of ‘QVector<T>&
> QVector<T>::operator<<(const T&) [with T = SkyPoint*]’
> 
Just copy them. It's possible to use const_cast. But copying is more robust 
and cheap anyway.

SkyPoint p1copy = p1;
SkyPoint p2copy = p2;



> > 4. If object doesn't visible it shouldn't get listed. You can use
> > `selected()'
> > to determine whether component visible.
> 
> You mean the objects below horizon?
> I didn't quite understand this -- I noticed each component has this
> selected() function. Did you mean the following because the component views
> can be toggled from toolbar?? If you are referring to it, it's a good catch
> ! :)
> if( m_Stars->selected() ) m_Stars->findObjectsInArea(p1,p2)
> if( m_DeepSky->selected() ) m_DeepSky->findObjectsInArea(p1,p2)
> 
Exactly 


More information about the Kstars-devel mailing list