Skip to content
Permalink
Browse files

.

  • Loading branch information...
ri
ri committed Apr 14, 2019
1 parent afa4700 commit fd13cb247d0854185570042d4e56f5a4941dcbc2
Showing with 37 additions and 159 deletions.
  1. +12 −18 SDlgOptions.cpp
  2. +0 −1 SDlgOptions.h
  3. +8 −0 SatViewer.cpp
  4. +4 −2 SatViewer.h
  5. +0 −48 crd/crd.cpp
  6. +0 −13 crd/crd.h
  7. +0 −47 ogl/GLSatAbstractWidget.cpp
  8. +0 −22 ogl/GLSatAbstractWidget.h
  9. +13 −8 ogl/RadarWidget.cpp
@@ -681,18 +681,14 @@ void SDlgOptions::addToLocList(const QModelIndex &index) {
void SDlgOptions::delFromSatList(const QModelIndex &index) {
QModelIndexList indexList = widget.listViewSat->selectionModel()->selectedIndexes();

std::vector<Satellite *> v {
std::vector<Satellite *> v (
m_satviewer->satellites().begin(),
m_satviewer->satellites().end()
};
);

for (const auto& i : indexList) {
m_satviewer->removeSatellite(v.at(i.row()));
// list.append(satWidget->satList.at(i.row()));
}
// for (const auto& sat : list) {
// satWidget->satviewer()->removeSatellite(sat);
// }

updateListViewSat();

@@ -701,7 +697,6 @@ void SDlgOptions::delFromSatList(const QModelIndex &index) {
if (mIndex.isValid()) {
widget.listViewSat->setCurrentIndex(mIndex);
}
satWidget->refreshAll();
}

void SDlgOptions::delFromLocList(const QModelIndex &index) {
@@ -714,19 +709,14 @@ void SDlgOptions::delFromLocList(const QModelIndex &index) {

for (const auto& i : indexList) {
m_satviewer->removeLocation(v.at(i.row()));
// list.append(satWidget->locList.at(i.row()));
}
// for (const auto& loc : list) {
// satWidget->satviewer()->removeLocation(loc);
// }

updateListViewLoc();
int position = index.isValid() ? index.row() : -1;
QModelIndex mIndex = widget.listViewLoc->model()->index(position, 0);
if (mIndex.isValid()) {
widget.listViewLoc->setCurrentIndex(mIndex);
}
satWidget->refreshAll();
}

void SDlgOptions::scriptParameters() {
@@ -793,7 +783,7 @@ void SDlgOptions::setSatWidget(GLSatAbstractWidget *w) {
// if (widget.stackedWidget->widget(7) != NULL) {
// widget.stackedWidget->removeWidget(widget.stackedWidget->widget(7));
// }
widget.tabWidgetSettings->insertTab(4, satWidget->settingsWidget, "Map");
widget.tabWidgetSettings->insertTab(4, satWidget->settingsWidget, tr("Map"));
satDialog->setSatWidget(satWidget);
locDialog->setSatWidget(satWidget);
}
@@ -803,11 +793,15 @@ void SDlgOptions::aboutQt() {
}

void SDlgOptions::clearSatList() {
widget.listViewSat->selectAll();
delFromSatList(widget.listViewSat->currentIndex());
// widget.listViewSat->selectAll();
// delFromSatList(widget.listViewSat->currentIndex());
m_satviewer->clearSatellites();
updateListViewSat();
}

void SDlgOptions::clearLocList() {
widget.listViewLoc->selectAll();
delFromLocList(widget.listViewLoc->currentIndex());
// widget.listViewLoc->selectAll();
// delFromLocList(widget.listViewLoc->currentIndex());
m_satviewer->clearLocations();
updateListViewLoc();
}
@@ -15,7 +15,6 @@
#include "zrvutils/ZrvIoList.h"
#include "jscalc/SScriptFrame.h"
#include "ogl/GLSatWidget.h"
#include "crd/crd.h"
#include "tleupd/SUpdater.h"
#include "jswidgets/SWidgetList.h"

@@ -66,6 +66,14 @@ void SatViewer::removeLocation(Location *loc) {
// setIndexLoc(pos - 1);
}

void SatViewer::clearSatellites() {
m_satellites.clear();
}

void SatViewer::clearLocations() {
m_locations.clear();
}

Satellite *SatViewer::currentSatellite() {
return m_currentSatellite;
// if ((m_currentSatellite >= 0) &&
@@ -23,13 +23,15 @@ class SatViewer : public QObject {
void appendLocation(Location* loc);
void removeSatellite(Satellite *sat);
void removeLocation(Location *loc);
void clearSatellites();
void clearLocations();
void setCurrentSatelliteIndex(long unsigned int index);
void setCurrentLocationIndex(long unsigned int index);
void setCurrentSatellite(Satellite* sat);
void setCurrentLocation(Location* loc);
void setTime(double value);
std::list<Satellite *> satellites() { return m_satellites; }
std::list<Location *> locations() { return m_locations; }
const std::list<Satellite *> &satellites() { return m_satellites; }
const std::list<Location *> &locations() { return m_locations; }
Satellite *currentSatellite();
Location *currentLocation();
ZrvIoList *ioList() { return &m_ioList; }

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
@@ -21,15 +21,10 @@
GLSatAbstractWidget::GLSatAbstractWidget(SatViewer *satviewer, QWidget *parent) : QOpenGLWidget(parent) {
m_satviewer = satviewer;
// initSatOgl();
// satList.clear();
// locList.clear();
setMouseTracking(true);

settingsWidget = new QWidget();

// m_indexLoc = -1;
// m_indexSat = -1;

m_colorNet = 0xFF8B8B8B;
clrNetFont = 0x0;
clrNight = 0x00666666;
@@ -61,14 +56,10 @@ GLSatAbstractWidget::GLSatAbstractWidget(SatViewer *satviewer, QWidget *parent)
// sun->modelInit(WGS84, 0, 0, 0, 0, 0, 0, 0, 0);
// sun->modelInit(0, 0);
// sun->setName("Sun");
// makeCurrent();
}

GLSatAbstractWidget::~GLSatAbstractWidget() {
makeCurrent();
// satList.clear();
// locList.clear();
// ioList.clear();
// TODO delete tex
doneCurrent();
}
@@ -229,44 +220,6 @@ void GLSatAbstractWidget::compileEventsList() {
glEndList();
}


//void GLSatAbstractWidget::setIndexSat(int index) {
// m_indexSat = index;
//// emit currentChanged(currentSat(), currentLoc(), &m_time);
//}
//
//void GLSatAbstractWidget::setIndexLoc(int index) {
// m_indexLoc = index;
// refreshAll();
//// emit currentChanged(currentSat(), currentLoc(), &m_time);
//}

//void GLSatAbstractWidget::addSat(Satellite* sat) {
// satList.append(sat);
//}
//
//void GLSatAbstractWidget::addLoc(Location* loc) {
// locList.append(loc);
//}
//
//void GLSatAbstractWidget::removeSat(Satellite *sat) {
// int pos = satList.indexOf(sat);
// if (pos == -1) return;
// ioList.deleteSat(satList.at(pos));
// satList.removeAt(pos);
// delete sat;
// setIndexSat(pos - 1);
//}
//
//void GLSatAbstractWidget::removeLoc(Location *loc) {
// int pos = locList.indexOf(loc);
// if (pos == -1) return;
// ioList.deleteLoc(locList.at(pos));
// locList.removeAt(pos);
// delete loc;
// setIndexLoc(pos - 1);
//}

float GLSatAbstractWidget::zoom(float value) {
m_zoom += value;
if (m_zoom < 1) m_zoom = 1;
@@ -22,8 +22,6 @@ typedef Satellite * (*CustomSat)(); // TODO remove this
class GLSatAbstractWidget : public QOpenGLWidget, protected QOpenGLFunctions_2_0 { // TODO QOpenGLWidget - to protected
Q_OBJECT
public:
// QList<Satellite *> satList;
// QList<Location *> locList;
// ZrvIoList ioList;
QWidget *settingsWidget;
typedef Satellite * (*CustomSat)();
@@ -62,26 +60,7 @@ class GLSatAbstractWidget : public QOpenGLWidget, protected QOpenGLFunctions_2_0
void showNight(bool value);

SatViewer *satviewer() { return m_satviewer; }
// int indexSat() const {return m_indexSat;}
// int indexLoc() const {return m_indexLoc;}

// Satellite * currentSat() {
// if ((m_indexSat < 0) || (m_indexSat >= satList.count())) return nullptr; // TODO move to cpp
// return satList.at(m_indexSat);
// }
//
// Location * currentLoc() {
// if ((m_indexLoc < 0) || (m_indexLoc >= locList.count())) return nullptr; // TODO move to cpp
// return locList.at(m_indexLoc);
// }

// void setIndexSat(int index);
// void setIndexLoc(int index);

// virtual void addSat(Satellite *sat);
// virtual void addLoc(Location *loc);
// void removeSat(Satellite *sat);
// void removeLoc(Location *loc);
public slots:
void refresh(); //TODO private this

@@ -103,7 +82,6 @@ public slots:
QFont fntNet;
bool shwSun, shwNight;
float m_zoom, m_dx, m_dy, m_dz;
// int m_indexLoc, m_indexSat;
QPoint pointMoveMap;
bool m_cursorOnSatellite, m_cursorOnLocation;
virtual void initializeGL();
@@ -45,15 +45,15 @@ void RadarWidget::compileMapList() {

// glColor4ub(192, 64, 64, 192);

glEnable(GL_LINE_STIPPLE);
glLineStipple(1, 0xF0F0);
// glEnable(GL_LINE_STIPPLE);
// glLineStipple(1, 0xF0F0);
glBegin(GL_LINES);
glVertex2f(-1.0, 0.0);
glVertex2f( 1.0, 0.0);
glVertex2f( 0.0, -1.0);
glVertex2f( 0.0, 1.0);
glEnd();
glDisable(GL_LINE_STIPPLE);
// glDisable(GL_LINE_STIPPLE);

glDisable(GL_BLEND);
glEndList();
@@ -86,7 +86,7 @@ void RadarWidget::compileSatList() {
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
glLineWidth(sat->linesWidth());
clr = 0xffffffff;//sat->colorTrack();
clr = sat->colorTrack();
glColor4ubv((GLubyte *)&clr);

glBegin(GL_LINE_STRIP);
@@ -100,6 +100,9 @@ void RadarWidget::compileSatList() {
for (double i = trackBegin; i < trackEnd; i += tper / 180.0) {
sat->model(i + m_satviewer->time());
SatViewer::aerv(loc->rg(), sat->rg(), aerv);
if (aerv[1] < 0.0) {
continue;
}
px = (M_PI_2 - aerv[1]) * sin(aerv[0]) / M_PI_2;
py = (aerv[1] - M_PI_2) * cos(aerv[0]) / M_PI_2;
if (fabs(px - tmpx) > 1.75) {
@@ -128,10 +131,12 @@ void RadarWidget::compileSatList() {
// px = sat->longitude() / M_PI;
// py = -2.0 * sat->latitude() / M_PI;
SatViewer::aerv(loc->rg(), sat->rg(), aerv);
px = (M_PI_2 - aerv[1]) * sin(aerv[0]) / M_PI_2;
py = (aerv[1] - M_PI_2) * cos(aerv[0]) / M_PI_2;
if (sat->satWObject) {
sat->satWObject->exec(px, py, 0.0);
if (aerv[1] >= 0.0) {
px = (M_PI_2 - aerv[1]) * sin(aerv[0]) / M_PI_2;
py = (aerv[1] - M_PI_2) * cos(aerv[0]) / M_PI_2;
if (sat->satWObject) {
sat->satWObject->exec(px, py, 0.0);
}
}
}

0 comments on commit fd13cb2

Please sign in to comment.
You can’t perform that action at this time.