[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/kstars/kstars/skycomponents
From: Akarsh Simha <akarshsimha () gmail ! com>
Date: 2010-08-28 18:57:31
Message-ID: 20100828185731.DD2EDAC881 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1169231 by asimha:
Add a method that lists all stars in a circular aperture around a
point. This code is not tested to work, but compiles. It will be
tested when I finish the feature I'm working on.
This is different from SkyMesh::objectsInArea() because:
1. It rejects stars outside the circular aperture
2. It lists unnamed stars too
CCMAIL: kstars-devel@kde.org
M +41 -0 deepstarcomponent.cpp
M +18 -0 deepstarcomponent.h
M +27 -0 starcomponent.cpp
M +16 -0 starcomponent.h
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/deepstarcomponent.cpp #1169230:1169231
@@ -402,6 +402,47 @@
return oBest;
}
+bool DeepStarComponent::starsInAperture( QList<StarObject *> &list, const SkyPoint ¢er, \
float radius, float maglim ) +{
+
+ if( maglim < triggerMag )
+ return false;
+
+ // For DeepStarComponents, whether we use ra0() and dec0(), or
+ // ra() and dec(), should not matter, because the stars are
+ // repeated in all trixels that they will pass through, although
+ // the factuality of this statement needs to be verified
+
+ Q_ASSERT( center.ra0().Degrees() != 0 );
+ Q_ASSERT( center.dec0().Degrees() != 0 );
+ m_skyMesh->intersect( center.ra0().Degrees(), center.dec0().Degrees(), radius, (BufNum) \
OBJ_NEAREST_BUF ); +
+ MeshIterator region( m_skyMesh, OBJ_NEAREST_BUF );
+
+ if( maglim < -28 )
+ maglim = m_FaintMagnitude;
+
+ while ( region.hasNext() ) {
+ Trixel currentRegion = region.next();
+ // FIXME: Build a better way to iterate over all stars.
+ // Ideally, StarBlockList should have such a facility.
+ StarBlockList *sbl = m_starBlockList[ currentRegion ];
+ sbl->fillToMag( maglim );
+ for( int i = 0; i < sbl->getBlockCount(); ++i ) {
+ StarBlock *block = sbl->block( i );
+ for( int j = 0; j < block->getStarCount(); ++j ) {
+ StarObject *star = block->star( i );
+ if( star->mag() > maglim )
+ break; // Stars are organized by magnitude, so this should work
+ if( star->angularDistanceTo( ¢er ).Degrees() <= radius )
+ list.append( star );
+ }
+ }
+ }
+
+ return true;
+}
+
void DeepStarComponent::byteSwap( deepStarData *stardata ) {
stardata->RA = bswap_32( stardata->RA );
stardata->Dec = bswap_32( stardata->Dec );
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/deepstarcomponent.h #1169230:1169231
@@ -93,6 +93,24 @@
bool verifySBLIntegrity();
+ /**
+ *@short Add to the given list, the stars from this component,
+ * that lie within the specified circular aperture, and that are
+ * brighter than the limiting magnitude specified.
+ *@p center The center point of the aperture
+ *@p radius The radius around the center point that defines the
+ * aperture
+ *@p maglim Optional parameter indicating the limiting magnitude.
+ * If magnitude limit is numerically < -28, the limiting magnitude
+ * is assumed to be the limiting magnitude of the catalog (i.e. no
+ * magnitude limit)
+ *@p list The list to operate on
+ *@return false if the limiting magnitude is brighter than the
+ * trigger magnitude of the DeepStarComponent
+ */
+ bool starsInAperture( QList<StarObject*> &list, const SkyPoint ¢er, float radius, \
float maglim=-29 ); +
+
// TODO: Find the right place for this method
static void byteSwap( deepStarData *stardata );
static void byteSwap( starData *stardata );
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/starcomponent.cpp #1169230:1169231
@@ -626,6 +626,33 @@
return oBest;
}
+void StarComponent::starsInAperture( QList<StarObject*> &list, const SkyPoint ¢er, float \
radius, float maglim ) +{
+ m_skyMesh->intersect( center.ra0().Degrees(), center.dec0().Degrees(), radius, (BufNum) \
OBJ_NEAREST_BUF ); +
+ MeshIterator region( m_skyMesh, OBJ_NEAREST_BUF );
+
+ if( maglim < -28 )
+ maglim = m_FaintMagnitude;
+
+ while ( region.hasNext() ) {
+ Trixel currentRegion = region.next();
+ StarList* starList = m_starIndex->at( currentRegion );
+ for (int i=0; i < starList->size(); ++i) {
+ StarObject* star = starList->at( i );
+ if( !star ) continue;
+ if ( star->mag() > m_FaintMagnitude ) continue;
+ if( star->angularDistanceTo( ¢er ).Degrees() <= radius )
+ list.append( star );
+ }
+ }
+
+ // Add stars from the DeepStarComponents as well
+ for( int i =0; i < m_DeepStarComponents.size(); ++i ) {
+ m_DeepStarComponents.at( i )->starsInAperture( list, center, radius, maglim );
+ }
+}
+
void StarComponent::byteSwap( starData *stardata ) {
stardata->RA = bswap_32( stardata->RA );
stardata->Dec = bswap_32( stardata->Dec );
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/starcomponent.h #1169230:1169231
@@ -128,6 +128,22 @@
// FIXME: check whether return type should be StarObject*
SkyObject* findByHDIndex( int HDnum );
+ /**
+ *@short Add to the given list, the stars from this component,
+ * that lie within the specified circular aperture, and that are
+ * brighter than the limiting magnitude specified.
+ *@p center The center point of the aperture
+ *@p radius The radius around the center point that defines the
+ * aperture
+ *@p maglim Optional parameter indicating the limiting magnitude.
+ * If magnitude limit is numerically < -28, the limiting magnitude
+ * is assumed to be the limiting magnitude of the catalog (i.e. no
+ * magnitude limit)
+ *@p list The list to operate on
+ */
+ void starsInAperture( QList<StarObject*> &list, const SkyPoint ¢er, float radius, \
float maglim=-29 ); +
+
// TODO: Make byteSwap a template method and put it in byteorder.h
// It should ideally handle 32-bit, 16-bit fields and starData and
// deepStarData fields
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic