| 1 | // |
| 2 | // Copyright (C) 2017 James Turner [email protected] |
| 3 | // |
| 4 | // This program is free software; you can redistribute it and/or |
| 5 | // modify it under the terms of the GNU General Public License as |
| 6 | // published by the Free Software Foundation; either version 2 of the |
| 7 | // License, or (at your option) any later version. |
| 8 | // |
| 9 | // This program is distributed in the hope that it will be useful, but |
| 10 | // WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | // General Public License for more details. |
| 13 | // |
| 14 | // You should have received a copy of the GNU General Public License |
| 15 | // along with this program; if not, write to the Free Software |
| 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | |
| 18 | #include "fgqcanvasmap.h" |
| 19 | |
| 20 | #include <QDebug> |
| 21 | |
| 22 | #include "localprop.h" |
| 23 | #include "fgcanvaspaintcontext.h" |
| 24 | |
| 25 | FGQCanvasMap::FGQCanvasMap(FGCanvasGroup* pr, LocalProp* prop) : |
| 26 | FGCanvasGroup(pr, prop) |
| 27 | { |
| 28 | |
| 29 | } |
| 30 | |
| 31 | void FGQCanvasMap::doPaint(FGCanvasPaintContext *context) const |
| 32 | { |
| 33 | |
| 34 | FGCanvasGroup::doPaint(context); |
| 35 | } |
| 36 | |
| 37 | bool FGQCanvasMap::onChildAdded(LocalProp *prop) |
| 38 | { |
| 39 | const QByteArray nm = prop->name(); |
| 40 | if ((nm == "ref-lon") || (nm == "ref-lat") || (nm == "hdg") || (nm == "range") |
| 41 | || (nm == "screen-range")) { |
| 42 | connect(prop, &LocalProp::valueChanged, this, &FGQCanvasMap::markProjectionDirty); |
| 43 | return true; |
| 44 | } |
| 45 | |
| 46 | if (FGCanvasGroup::onChildAdded(prop)) { |
| 47 | return true; |
| 48 | } |
| 49 | |
| 50 | qDebug() << Q_FUNC_INFO << "deal with:" << prop->name(); |
| 51 | return false; |
| 52 | } |
| 53 | |
| 54 | void FGQCanvasMap::markProjectionDirty() |
| 55 | { |
| 56 | _projectionChanged = true; |
| 57 | } |