|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
[PATCH] Show Magellanic CloudsHello,
I have made a patch to show Magellanic Clouds : http://bugs.kde.org/show_bug.cgi?id=77748 (bugs.kde.org is temporarily offline so I put the patch in attachment) I don't know the best way to implement it. Here's what I did : -MagellanicClouds is a copy of MilkyWay that has been modified to load lmc.dat and smc.dat instead of milkyway.dat -SkyMapComposite has been modifed to handle MagellanicClouds object -CMakeLists.txt files have been modified to build magellanicclouds.cpp and install lmc.dat and smc.dat I did my best to get precise coordinates of contour, but it's not easy, so please tell me if you have any good data about it. -- Jérôme SONRIER [kstars-magellanicclouds.diff] Index: kstars/skycomponents/magellanicclouds.cpp =================================================================== --- kstars/skycomponents/magellanicclouds.cpp (révision 0) +++ kstars/skycomponents/magellanicclouds.cpp (révision 0) @@ -0,0 +1,182 @@ +/*************************************************************************** + magellanicclouds.cpp - K Desktop Planetarium + ------------------- + begin : 12 Nov. 2005 + copyright : (C) 2005 by Jason Harris + email : kstars@... + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "magellanicclouds.h" + +#include <QList> +#include <QPointF> +#include <QPolygonF> +#include <QPainter> + +#include <klocale.h> + +#include "kstarsdata.h" +#include "skymap.h" +#include "skypoint.h" +#include "dms.h" +#include "Options.h" +#include "ksfilereader.h" + +#include "skymesh.h" + + +MagellanicClouds::MagellanicClouds( SkyComponent *parent ) : + SkipListIndex( parent, i18n("Magellanic Clouds") ) +{} + +void MagellanicClouds::init( KStarsData *data ) +{ + Q_UNUSED(data) + + intro(); + + char* fname = "lmc.dat"; + QString line; + double ra, dec, lastRa, lastDec; + SkipList *skipList = 0; + bool ok; + int iSkip = 0; + + lastRa = lastDec = -1000.0; + + KSFileReader fileReader; + if ( ! fileReader.open( fname ) ) return; + + fileReader.setProgress( i18n("Loading Large Magellanic Clouds"), 2136, 5 ); + + while ( fileReader.hasMoreLines() ) { + line = fileReader.readLine(); + + fileReader.showProgress(); + + QChar firstChar = line.at( 0 ); + if ( firstChar == '#' ) continue; + + ra = line.mid( 2, 8 ).toDouble(&ok); + if ( ok ) dec = line.mid( 11, 8 ).toDouble(&ok); + if ( !ok ) { + fprintf(stderr, "%s: conversion error on line: %d\n", + fname, fileReader.lineNumber()); + continue; + } + + if ( firstChar == 'M' ) { + if ( skipList ) appendBoth( skipList ); + skipList = 0; + iSkip = 0; + lastRa = lastDec = -1000.0; + } + + if ( ! skipList ) skipList = new SkipList(); + + if ( ra == lastRa && dec == lastDec ) { + fprintf(stderr, "%s: tossing dupe on line %4d: (%f, %f)\n", + fname, fileReader.lineNumber(), ra, dec); + continue; + } + + skipList->append( new SkyPoint(ra, dec) ); + lastRa = ra; + lastDec = dec; + if ( firstChar == 'S' ) skipList->setSkip( iSkip ); + iSkip++; + } + if ( skipList ) appendBoth( skipList ); + + fname = "smc.dat"; + skipList = 0; + iSkip = 0; + + lastRa = lastDec = -1000.0; + + if ( ! fileReader.open( fname ) ) return; + + fileReader.setProgress( i18n("Loading Small Magellanic Clouds"), 2136, 5 ); + + while ( fileReader.hasMoreLines() ) { + line = fileReader.readLine(); + + fileReader.showProgress(); + + QChar firstChar = line.at( 0 ); + if ( firstChar == '#' ) continue; + + ra = line.mid( 2, 8 ).toDouble(&ok); + if ( ok ) dec = line.mid( 11, 8 ).toDouble(&ok); + if ( !ok ) { + fprintf(stderr, "%s: conversion error on line: %d\n", + fname, fileReader.lineNumber()); + continue; + } + + if ( firstChar == 'M' ) { + if ( skipList ) appendBoth( skipList ); + skipList = 0; + iSkip = 0; + lastRa = lastDec = -1000.0; + } + + if ( ! skipList ) skipList = new SkipList(); + + if ( ra == lastRa && dec == lastDec ) { + fprintf(stderr, "%s: tossing dupe on line %4d: (%f, %f)\n", + fname, fileReader.lineNumber(), ra, dec); + continue; + } + + skipList->append( new SkyPoint(ra, dec) ); + lastRa = ra; + lastDec = dec; + if ( firstChar == 'S' ) skipList->setSkip( iSkip ); + iSkip++; + } + if ( skipList ) appendBoth( skipList ); + + summary(); + //printf("Done.\n"); +} + +bool MagellanicClouds::selected() +{ + return Options::showMilkyWay() && + ! ( Options::hideOnSlew() && Options::hideMilkyWay() && SkyMap::IsSlewing() ); +} + +void MagellanicClouds::draw( QPainter& psky ) +{ + if ( !selected() ) return; + + KStarsData *data = KStarsData::Instance(); + + QColor color = QColor( data->colorScheme()->colorNamed( "MWColor" ) ); + + psky.setPen( QPen( color, 3, Qt::SolidLine ) ); + psky.setBrush( QBrush( color ) ); + + // Uncomment these two lines to get more visible images for debugging. -jbb + // + //psky.setPen( QPen( QColor( "red" ), 1, Qt::SolidLine ) ); + //psky.setBrush( QBrush( QColor("green" ) ) ); + + if ( Options::fillMilkyWay() ) { + drawFilled( psky ); + } + else { + drawLines( psky ); + } +} + Index: kstars/skycomponents/magellanicclouds.h =================================================================== --- kstars/skycomponents/magellanicclouds.h (révision 0) +++ kstars/skycomponents/magellanicclouds.h (révision 0) @@ -0,0 +1,49 @@ +/*************************************************************************** + magellanicclouds.h - K Desktop Planetarium + ------------------- + begin : 2005/07/08 + copyright : (C) 2005 by Jason Harris + email : kstars@... + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef MAGELLANICCLOUDS +#define MAGELLANICCLOUDS + +#include "skiplistindex.h" + +/** + *@class MlkyWay + *This stores a SkipList for each chunk. + * + *@author James B. Bowlin + *@version 0.1 + */ +class MagellanicClouds : public SkipListIndex +{ +public: + /** + *@short Constructor + *@p parent pointer to the parent SkyComponent + */ + MagellanicClouds( SkyComponent *parent ); + + void init( KStarsData *data ); + + /** + *@short Draw the Magellanic Clouds on the sky map + *@p psky Reference to the QPainter on which to paint + */ + void draw( QPainter& psky ); + + bool selected(); +}; +#endif Index: kstars/skycomponents/skymapcomposite.h =================================================================== --- kstars/skycomponents/skymapcomposite.h (révision 843335) +++ kstars/skycomponents/skymapcomposite.h (copie de travail) @@ -39,6 +39,7 @@ class Ecliptic; class Equator; class HorizonComponent; class MilkyWay; +class MagellanicClouds; class SolarSystemComposite; class StarComponent; class SatelliteComposite; @@ -204,6 +205,7 @@ private: Ecliptic *m_Ecliptic; HorizonComponent *m_Horizon; MilkyWay *m_MilkyWay; + MagellanicClouds *m_MagellanicClouds; SolarSystemComposite *m_SolarSystem; SkyComposite *m_CustomCatalogs; StarComponent *m_Stars; Index: kstars/skycomponents/skymapcomposite.cpp =================================================================== --- kstars/skycomponents/skymapcomposite.cpp (révision 843335) +++ kstars/skycomponents/skymapcomposite.cpp (copie de travail) @@ -39,6 +39,7 @@ #include "horizoncomponent.h" #include "jupitermoonscomponent.h" #include "milkyway.h" +#include "magellanicclouds.h" #include "solarsystemcomposite.h" #include "starcomponent.h" #include "satellitecomposite.h" @@ -62,6 +63,8 @@ SkyMapComposite::SkyMapComposite(SkyComp //Add all components m_MilkyWay = new MilkyWay( this ); addComponent( m_MilkyWay ); + m_MagellanicClouds = new MagellanicClouds( this ); + addComponent( m_MagellanicClouds ); //Stars must come before constellation lines m_Stars = new StarComponent( this ); addComponent( m_Stars ); @@ -214,6 +217,8 @@ void SkyMapComposite::draw( QPainter& ps m_MilkyWay->draw( psky ); + m_MagellanicClouds->draw( psky ); + m_CoordinateGrid->draw( psky ); m_CBoundLines->draw( psky ); Index: kstars/data/lmc.dat =================================================================== --- kstars/data/lmc.dat (révision 0) +++ kstars/data/lmc.dat (révision 0) @@ -0,0 +1,33 @@ +M 4.93333 -66.0000 +D 4.86666 -66.3500 +D 4.83333 -66.7500 +D 4.83333 -67.2500 +D 4.88333 -68.0000 +D 4.86666 -68.8000 +D 4.91666 -69.5000 +D 4.90833 -69.7500 +D 4.91666 -70.2500 +D 5.00000 -70.8000 +D 5.15000 -71.1000 +D 5.33333 -71.0000 +D 5.41666 -71.0700 +D 5.53333 -71.1000 +D 5.66666 -70.8000 +D 5.75000 -70.4000 +D 5.86666 -69.7500 +D 5.88333 -69.1000 +D 5.88333 -68.5000 +D 5.85000 -68.0000 +D 5.80000 -67.6000 +D 5.81666 -67.2000 +D 5.80000 -66.7500 +D 5.75000 -66.4000 +D 5.68333 -66.3000 +D 5.51666 -66.5000 +D 5.36666 -66.2000 +D 5.31666 -66.2000 +D 5.26666 -66.4000 +D 5.25000 -66.8500 +D 5.18333 -67.0000 +D 5.15000 -66.9500 +D 5.00000 -66.1000 Index: kstars/data/CMakeLists.txt =================================================================== --- kstars/data/CMakeLists.txt (révision 843335) +++ kstars/data/CMakeLists.txt (copie de travail) @@ -9,6 +9,8 @@ install( FILES kstars.png geomap.png clines.dat cnames.dat milkyway.dat + lmc.dat + smc.dat cbounds.dat cbounds-3.idx cbounds-4.idx cbounds-5.idx cbounds-6.idx image_url.dat info_url.dat Index: kstars/data/smc.dat =================================================================== --- kstars/data/smc.dat (révision 0) +++ kstars/data/smc.dat (révision 0) @@ -0,0 +1,44 @@ +M 0.81666 -71.7000 +D 0.81666 -71.9200 +D 0.83333 -72.0500 +D 0.83333 -72.1800 +D 0.80000 -72.2850 +D 0.83333 -72.4650 +D 0.81666 -72.5150 +D 0.76666 -72.6250 +D 0.71666 -72.8333 +D 0.71666 -73.1500 +D 0.75000 -73.1900 +D 0.85000 -73.3750 +D 0.90000 -73.3750 +D 0.95000 -73.1400 +D 0.98333 -73.1400 +D 1.00000 -73.0600 +D 0.96666 -72.9400 +D 1.03333 -72.6250 +D 1.11666 -72.7400 +D 1.20000 -72.6700 +D 1.23333 -72.6900 +D 1.26666 -72.5800 +D 1.28333 -72.6200 +D 1.33333 -72.5000 +D 1.31666 -72.3100 +D 1.35000 -72.1900 +D 1.33333 -71.9800 +D 1.30000 -72.0200 +D 1.28333 -71.9200 +D 1.30000 -71.8300 +D 1.30000 -71.6250 +D 1.28333 -71.6600 +D 1.23333 -71.6250 +D 1.20000 -71.4700 +D 1.16666 -71.4500 +D 1.15000 -71.3400 +D 1.13333 -71.1950 +D 1.10000 -71.1500 +D 1.05000 -71.2250 +D 1.05000 -71.3300 +D 1.03333 -71.4200 +D 0.93333 -71.5000 +D 0.90000 -71.6250 +D 0.83333 -71.6550 Index: kstars/CMakeLists.txt =================================================================== --- kstars/CMakeLists.txt (révision 843335) +++ kstars/CMakeLists.txt (copie de travail) @@ -166,6 +166,7 @@ set(libkstarscomponents_SRCS skycomponents/equator.cpp skycomponents/horizoncomponent.cpp skycomponents/milkyway.cpp + skycomponents/magellanicclouds.cpp skycomponents/skycomponent.cpp skycomponents/skycomposite.cpp skycomponents/starblock.cpp _______________________________________________ Kstars-devel mailing list Kstars-devel@... https://mail.kde.org/mailman/listinfo/kstars-devel |
|
|
Re: [PATCH] Show Magellanic CloudsHi Jerome,
Thank you!!! I am a big fan of the Magellanic Clouds (they're my primary research targets), so I am especially glad to see this patch. I hope I'll have time to review and accept the patch soon. regards, Jason On 8/17/08, Jérôme SONRIER <jsid@...> wrote: > Hello, > > I have made a patch to show Magellanic Clouds : > http://bugs.kde.org/show_bug.cgi?id=77748 (bugs.kde.org is temporarily > offline so I put the patch in attachment) > > I don't know the best way to implement it. > > Here's what I did : > -MagellanicClouds is a copy of MilkyWay that has been modified to load > lmc.dat and smc.dat instead of milkyway.dat > -SkyMapComposite has been modifed to handle MagellanicClouds object > -CMakeLists.txt files have been modified to build magellanicclouds.cpp > and install lmc.dat and smc.dat > > I did my best to get precise coordinates of contour, but it's not easy, > so please tell me if you have any good data about it. > > > -- > Jérôme SONRIER > Kstars-devel mailing list Kstars-devel@... https://mail.kde.org/mailman/listinfo/kstars-devel |
|
|
Re: [PATCH] Show Magellanic CloudsHi Jerome,
The patch works great! Thanks again, I'm going to apply it now. Can I ask where you got the contour data, and how it is licensed? We need to make sure that we have the right to distribute them. Eventually, it might be nice to create a subclass of DeepSkyObject that defines such a contour for the object. With the current implementation, we can see the LMC and SMC, but the LMC is not clickable (so no Details window, no context menu, no image links, etc.). If we do this, we probably wouldn't make the entire contour area clickable, but just add a small symbol at its centroid for clicks. Other objects off the top of my head that could use a contour: Veil nebula, North American nebula, Barnard's Loop, Orion Nebula, etc. Thanks a lot! Jason On 8/17/08, Jérôme SONRIER <jsid@...> wrote: > Hello, > > I have made a patch to show Magellanic Clouds : > http://bugs.kde.org/show_bug.cgi?id=77748 (bugs.kde.org is temporarily > offline so I put the patch in attachment) > > I don't know the best way to implement it. > > Here's what I did : > -MagellanicClouds is a copy of MilkyWay that has been modified to load > lmc.dat and smc.dat instead of milkyway.dat > -SkyMapComposite has been modifed to handle MagellanicClouds object > -CMakeLists.txt files have been modified to build magellanicclouds.cpp > and install lmc.dat and smc.dat > > I did my best to get precise coordinates of contour, but it's not easy, > so please tell me if you have any good data about it. > > > -- > Jérôme SONRIER > Kstars-devel mailing list Kstars-devel@... https://mail.kde.org/mailman/listinfo/kstars-devel |
|
|
Re: [PATCH] Show Magellanic CloudsLe lundi 18 août 2008, Jason Harris a écrit :
> Hi Jerome, > > The patch works great! Thanks again, I'm going to apply it now. Can > I ask where you got the contour data, and how it is licensed? We > need to make sure that we have the right to distribute them. For SMC, the image I used can be found on this page : http://www.nrao.edu/pr/2007/brightburst/ I think we can use it : http://www.nrao.edu/imagegallery/image_use.shtml You can find the gimp file that I made that show the contour here : http://emor3j.fr.eu.org/dvlpt/kde/kstars/magellanicclouds/contours/smc.xcf For LMC, I used 3 images : http://commons.wikimedia.org/wiki/Image:Dorado_constellation_map.png http://www.jb.man.ac.uk/public/AList/Dorado.html http://www.aanda.org/articles/aa/full/2005/08/aa1074/img62.gif I don't know how they are licensed. You can find the gimp file that I made that show the contour here : http://emor3j.fr.eu.org/dvlpt/kde/kstars/magellanicclouds/contours/lmc.xcf > > Eventually, it might be nice to create a subclass of DeepSkyObject > that defines such a contour for the object. With the current > implementation, we can see the LMC and SMC, but the LMC is not > clickable (so no Details window, no context menu, no image links, > etc.). If we do this, we probably wouldn't make the entire contour > area clickable, but just add a small symbol at its centroid for > clicks. Other objects off the top of my head that could use a > contour: Veil nebula, North American nebula, Barnard's Loop, Orion > Nebula, etc. > Yes, I agree, it would be easier to show what we want with a subclass like this. -- Jérôme SONRIER _______________________________________________ Kstars-devel mailing list Kstars-devel@... https://mail.kde.org/mailman/listinfo/kstars-devel |
|
|
Re: [PATCH] Show Magellanic CloudsLe Monday 18 August 2008 18:32:49 Jérôme SONRIER, vous avez écrit :
> For SMC, the image I used can be found on this page : > http://www.nrao.edu/pr/2007/brightburst/ > > I think we can use it : http://www.nrao.edu/imagegallery/image_use.shtml > > You can find the gimp file that I made that show the contour here : > http://emor3j.fr.eu.org/dvlpt/kde/kstars/magellanicclouds/contours/smc.xcf > > > > For LMC, I used 3 images : > > http://commons.wikimedia.org/wiki/Image:Dorado_constellation_map.png > http://www.jb.man.ac.uk/public/AList/Dorado.html > http://www.aanda.org/articles/aa/full/2005/08/aa1074/img62.gif > > I don't know how they are licensed. > > You can find the gimp file that I made that show the contour here : > http://emor3j.fr.eu.org/dvlpt/kde/kstars/magellanicclouds/contours/lmc.xcf One possibility would be to use a FITS image, smooth it and get contours with ds9. We would directly have the coordinates of the isophote. Ideally the surface brightness threshold would be the same as for the milky way. Do you know any free, calibrated, let's say V band image of the LMC and the SMC Jason? Regards, Médéric _______________________________________________ Kstars-devel mailing list Kstars-devel@... https://mail.kde.org/mailman/listinfo/kstars-devel |
|
|
Re: [PATCH] Show Magellanic CloudsIf you constructed the contours yourself from images, then I think the
license is up to you. I don't think the copyright of the image extends to a hand-constructed outline of a shape in that image, but IANAL. Jason On Aug 18, 2008, at 3:32 PM, Jérôme SONRIER wrote: > Le lundi 18 août 2008, Jason Harris a écrit : >> Hi Jerome, >> >> The patch works great! Thanks again, I'm going to apply it now. Can >> I ask where you got the contour data, and how it is licensed? We >> need to make sure that we have the right to distribute them. > > For SMC, the image I used can be found on this page : > http://www.nrao.edu/pr/2007/brightburst/ > > I think we can use it : http://www.nrao.edu/imagegallery/image_use.shtml > > You can find the gimp file that I made that show the contour here : > http://emor3j.fr.eu.org/dvlpt/kde/kstars/magellanicclouds/contours/smc.xcf > > > > For LMC, I used 3 images : > > http://commons.wikimedia.org/wiki/Image:Dorado_constellation_map.png > http://www.jb.man.ac.uk/public/AList/Dorado.html > http://www.aanda.org/articles/aa/full/2005/08/aa1074/img62.gif > > I don't know how they are licensed. > > You can find the gimp file that I made that show the contour here : > http://emor3j.fr.eu.org/dvlpt/kde/kstars/magellanicclouds/contours/lmc.xcf > > >> >> Eventually, it might be nice to create a subclass of DeepSkyObject >> that defines such a contour for the object. With the current >> implementation, we can see the LMC and SMC, but the LMC is not >> clickable (so no Details window, no context menu, no image links, >> etc.). If we do this, we probably wouldn't make the entire contour >> area clickable, but just add a small symbol at its centroid for >> clicks. Other objects off the top of my head that could use a >> contour: Veil nebula, North American nebula, Barnard's Loop, Orion >> Nebula, etc. >> > > Yes, I agree, it would be easier to show what we want with a subclass > like this. > > > -- > Jérôme SONRIER > > _______________________________________________ > Kstars-devel mailing list > Kstars-devel@... > https://mail.kde.org/mailman/listinfo/kstars-devel _______________________________________________ Kstars-devel mailing list Kstars-devel@... https://mail.kde.org/mailman/listinfo/kstars-devel |
| Free Forum Powered by Nabble | Forum Help |