File indexing completed on 2025-01-19 09:46:00
0001 /* 0002 SPDX-FileCopyrightText: 2012 Jerome SONRIER <jsid@emor3j.fr.eu.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "localmeridiancomponent.h" 0008 0009 #include "kstarsdata.h" 0010 #include "Options.h" 0011 #include "linelist.h" 0012 #ifdef KSTARS_LITE 0013 #include "skymaplite.h" 0014 #else 0015 #include "skymap.h" 0016 #endif 0017 #include "skypainter.h" 0018 0019 LocalMeridianComponent::LocalMeridianComponent(SkyComposite *parent) 0020 : CoordinateGrid(parent, i18n("Local Meridian Component")) 0021 { 0022 //KStarsData *data = KStarsData::Instance(); 0023 0024 intro(); 0025 0026 double eps = 0.1; 0027 double maxAlt = 90.0; 0028 0029 std::shared_ptr<LineList> lineList; 0030 0031 for (double az = 0; az <= 180; az += 180) 0032 { 0033 lineList.reset(new LineList()); 0034 0035 for (double alt = 0; alt < maxAlt; alt += eps) 0036 { 0037 std::shared_ptr<SkyPoint> p(new SkyPoint()); 0038 p->setAz(az); 0039 p->setAlt(alt); 0040 lineList->append(std::move(p)); 0041 } 0042 0043 appendLine(lineList); 0044 } 0045 0046 0047 0048 summary(); 0049 } 0050 0051 bool LocalMeridianComponent::selected() 0052 { 0053 return (Options::showLocalMeridian() && !(Options::hideOnSlew() && 0054 #ifndef KSTARS_LITE 0055 SkyMap::IsSlewing())); 0056 #else 0057 SkyMapLite::IsSlewing())); 0058 #endif 0059 } 0060 0061 void LocalMeridianComponent::preDraw(SkyPainter *skyp) 0062 { 0063 KStarsData *data = KStarsData::Instance(); 0064 QColor color = data->colorScheme()->colorNamed("LocalMeridianColor"); 0065 0066 skyp->setPen(QPen(QBrush(color), 2, Qt::SolidLine)); 0067 } 0068 0069 void LocalMeridianComponent::update(KSNumbers *) 0070 { 0071 KStarsData *data = KStarsData::Instance(); 0072 0073 for (int i = 0; i < listList().count(); i++) 0074 { 0075 for (int j = 0; j < listList().at(i)->points()->count(); j++) 0076 { 0077 listList().at(i)->points()->at(j)->HorizontalToEquatorial(data->lst(), data->geo()->lat()); 0078 } 0079 } 0080 }