Rose
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
rose::MapProjection Class Reference
Inheritance diagram for rose::MapProjection:
Inheritance graph
[legend]
Collaboration diagram for rose::MapProjection:
Collaboration graph
[legend]

Classes

struct  MapIcon
 

Public Types

enum  ShortCutCode : uint32_t {
  MercatorProjection, StationMercatorProjection, AzimuthalProjection, TerrainMap,
  CountryMap
}
 
using SignalType = std::vector< TrackedSatellite > &
 
- Public Types inherited from rose::Visual
using ValueMap = std::map< int, int >
 The std::map type for each hint class.
 
- Public Types inherited from rose::Node
using NodePtr = std::shared_ptr< Node >
 

Public Member Functions

 MapProjection (std::shared_ptr< TimerTick > timerTick, std::filesystem::path &xdgDataPath)
 
 MapProjection (const MapProjection &)=delete
 
 MapProjection (MapProjection &&)=delete
 
MapProjectionoperator= (const MapProjection &)=delete
 
MapProjectionoperator= (MapProjection &&)=delete
 
std::string_view nodeId () const noexcept override
 
void draw (gm::Context &context, const Position< int > &containerPosition) override
 Draw the MapProjection.
 
Rectangle layout (gm::Context &context, const Rectangle &screenRect) override
 Layout the MapProjection.
 
void addedToContainer () override
 Called when added to a container. More...
 
void cacheCurrentMaps ()
 Add the selected maps to the current cache list and invoke a load if required.
 
auto getQth () const
 
bool mapProjectionsValid () const
 Determine if map projections are valid. More...
 
auto getProjection () const
 Accessor for the type of projection. More...
 
void drawMapItem (const ImageId &mapItem, gm::Context &context, Rectangle mapRectangle, GeoPosition &geoPosition, MapProjectionType projection, int splitPixel)
 Render a single icon on the map. More...
 
int projectionSplitPixel (Size drawSize) const
 Computer the StationMercator split pixel given a map drawing size. More...
 
void drawMapLine (gm::Context &context, AntiAliasedDrawing &drawing, GeoPosition begin, Rectangle mapRectangle, const std::function< GeoPosition(GeoPosition &, bool fine)> &increment)
 Draw a line on the projected map. More...
 
void drawInterpolate (gm::Context &context, AntiAliasedDrawing &drawing, Rectangle mapRect, GeoPosition &geo0, GeoPosition &geo1)
 
template<typename Iterator >
void drawMapLine (gm::Context &context, AntiAliasedDrawing &drawing, Rectangle mapRect, Iterator first, Iterator last)
 Draw a line on the projected map using points in a standard container. More...
 
void drawLongitude (gm::Context &context, AntiAliasedDrawing &drawing, double longitude, double latitudeBound, Rectangle mapRect)
 Draw a line of Longitude at longitude. More...
 
void drawLatitude (gm::Context &context, AntiAliasedDrawing &drawing, double latitude, Rectangle mapRect)
 Draw a line of Latitude at latitude. More...
 
 MapProjection (std::shared_ptr< WebFileCache > mapCache, Size mapSize)
 
void initializeComposite () override
 See Widget::initializeComposite()
 
Rectangle widgetLayout (sdl::Renderer &renderer, Rectangle available, uint layoutStage) override
 Determine the desired size of the label with text and badge. More...
 
void draw (sdl::Renderer &renderer, Rectangle parentRect) override
 Draw the Label. More...
 
Position geoToMap (GeoPosition geo, ProjectionType projection, int splitPixel)
 Convert a GeoPosition in radians to a map Position in pixels. More...
 
void setMoonEphemerisFile (EphemerisFile item, const std::filesystem::path &filePath)
 Set the Moon ephemeris. More...
 
- Public Member Functions inherited from rose::Widget
 Widget (const Widget &)=delete
 
 Widget (Widget &&)=delete
 
Widgetoperator= (const Widget &)=delete
 
Widgetoperator= (Widget &&)=delete
 
std::shared_ptr< WidgetpointerWidget (const Position< int > &position, const Position< int > &containerPosition)
 Search for the Widget within which the position lies. More...
 
Position< int > computeScreenPosition ()
 Recursively compute the Widget Position on the Screen. More...
 
bool contains (const Position< int > &position)
 Determine if a given Screen Position is within the Widget Rectangle. More...
 
ApplicationgetApplication ()
 Get a reference to the Application object. More...
 
ApplicationgetApplication () const
 const version of getApplication()
 
std::shared_ptr< WindowgetWindow ()
 Get the Window ancestor of a Widget. More...
 
std::shared_ptr< WindowgetWindow () const
 const version of getWindow().
 
bool enterEvent ()
 Notify Widget of mouse pointer enter event. More...
 
void setEnterLeaveEventCallback (EventCallback eventCallback)
 Set the enter callback.
 
bool leaveEvent ()
 Notify Widget of mouse pointer leave event. More...
 
void setLeaveEventCallback (EventCallback eventCallback)
 Set the leave callback.
 
bool buttonEvent (bool pressed, uint button, uint clicks, bool passed)
 Notify Widget of mouse button events. More...
 
void setButtonEventCallback (ButtonCallback buttonCallback)
 Set the button callback.
 
bool mouseMotionEvent (bool pressed, uint button, const Position< int > &mousePos, const Position< int > &relativePos, bool passed)
 Notify Widget of mouse motion events. More...
 
void setMouseMotionEventCallback (MouseMotionCallback mouseMotionCallback)
 Set the mouse motion callback.
 
bool mouseScrollEvent (const Position< int > &deltaPos, bool passed)
 Notify Widget of mouse scroll wheel events. More...
 
void setMouseScrollEventCallback (ScrollCallback scrollCallback)
 Set the mouse scroll callback.
 
bool keyboardShortcutEvent (uint32_t shortcutCode, bool state, uint repeat)
 Notify the Widget of a keyboard shortcut invocation. More...
 
void setKeyboardShortcutCallback (KeyboardShortcutCallback keyboardShortcutCallback)
 Set the keyboard shortcut callback.
 
bool keyTextInputEvent (const std::string &text)
 Notify the Widget of text input. More...
 
void setTextInputCallback (TextInputCallback textInputCallback)
 Set the text input callback.
 
bool supportsKeyboardFocus () const
 
bool keyboardFocusEvent (bool hasFocus)
 Notify the Widget when it gains or looses keyboard focus. More...
 
void setKeyboardFocusCallback (KeyboardFocusCallback keyboardFocusCallback)
 Set the keyboard focus callback.
 
bool keyboardEvent (const SDL_KeyboardEvent &keyboardEvent)
 
void setKeyboardEvent (KeyboardEventCallback keyboardEventCallback)
 
- Public Member Functions inherited from rose::Visual
void setScreenRectangle (const Position< int > &containerPosition)
 Compute the screen rectangle from the Container screen Position. More...
 
Rectangle getScreenRectangle (const Position< int > &containerPosition) const
 Get the rectangle occupied by the Visual. More...
 
Position< int > drawPadding (const Position< int > &containerPosition)
 Pad the drawing location.
 
Rectangle layoutPadding (const Rectangle &screenRect)
 Pad the layout.
 
void setSize (const Size &size)
 Set preferred Size.
 
Size getSize () const
 Get the preferred size.
 
void setPosition (const Position< int > &position)
 Set preferred Position.
 
Position< int > getPosition () const
 Get the preferred Position.
 
void setPadding (const Padding &padding)
 Set Padding.
 
void setScreenRectangle (const Rectangle &screenRect)
 Set Screen Rectangle.
 
constexpr bool isVisible () const noexcept
 Check visibility.
 
void setVisible (bool visible) noexcept
 Set visibility.
 
void setLayoutHint (const LayoutHint &hint)
 Add a LayoutHint.
 
std::optional< int > getAttachmentHint (LayoutHint::Attachment attachment)
 Get an AttachmentHint value given a LayoutHint::Attachment. More...
 
std::optional< int > getGridHint (LayoutHint::GridLayoutHint gridLayoutHint)
 Get a GridLayoutHint value given a LayoutHint::GridLayoutHint. More...
 
template<size_t HintClass>
std::optional< const ValueMapgetHintMap () const
 
SemanticGesture supportedSemanticGestures () const
 Get supported SemanticGestures.
 
- Public Member Functions inherited from rose::Container
void remove (const std::shared_ptr< Node > &node)
 
- Public Member Functions inherited from rose::Node
 Node (const std::shared_ptr< Container > &container)
 Create a node and add it to a Container. More...
 
void setId (const Id &nodeId) noexcept
 Set Id.
 
std::string_view getId () const
 Get Id.
 
IdPath getIdPath () const
 Get the Id Path.
 
std::shared_ptr< Containercontainer ()
 
std::shared_ptr< Containercontainer () const
 
template<typename C >
std::shared_ptr< C > containerAs ()
 
template<typename C >
std::shared_ptr< C > containerAs () const
 
std::shared_ptr< const NodegetNode () const
 Get a const std::shared_ptr to this node. More...
 
std::shared_ptr< NodegetNode ()
 Get a std::shared_ptr to this node. More...
 
template<typename NodeType >
std::shared_ptr< const NodegetNode () const
 Get a std::shared_ptr<const NodeType> to this node. More...
 
template<typename NodeType >
std::shared_ptr< NodeType > getNode ()
 Get a std::shared_ptr<NodeType> to this node. More...
 
std::shared_ptr< Noderemove ()
 
- Public Member Functions inherited from rose::Manager
 Manager (const Manager &)=delete
 
 Manager (Manager &&)=delete
 
Manageroperator= (const Manager &)=delete
 
Manageroperator= (Manager &&)=delete
 
std::string_view nodeId () const noexcept override
 
void add (const std::shared_ptr< Node > &node) override
 Add a Node to the contents of the Manager. More...
 
void draw (gm::Context &context, const Position< int > &containerPosition) override
 Draw the manager and contents. More...
 
Rectangle layout (gm::Context &context, const Rectangle &screenRect) override
 Layout the Manager and contents. More...
 
void setLayoutManager (std::unique_ptr< LayoutManager > &&layoutManager)
 Set the layout manager. More...
 
std::unique_ptr< LayoutManager > & layoutManager ()
 Get the LayoutManager. More...
 

Static Public Member Functions

static std::tuple< double, double > subSolar ()
 Compute the sub-solar geographic coordinates, used in plotting the solar illumination. More...
 
static GeoPosition antipode (const GeoPosition posRadians)
 Compute an antipode. More...
 
static GeoPosition geoPosition (int x, int y, Size mapSize)
 Convert a map coordinate (x,y) into a GeoPosition(lat,lon) in radians. More...
 
static Position mapPosition (GeoPosition map, Size mapSize)
 Convert a GeoPosition(lat,lon) in radians to a map Position(x,y) in pixels. More...
 
- Static Public Member Functions inherited from rose::Node
template<typename NodeType >
static std::shared_ptr< NodeType > create ()
 Create a Node with no arguments. More...
 
template<typename NodeType , typename ... Args>
static std::shared_ptr< NodeType > create (Args ... args)
 Create a Node with arguments. More...
 
template<typename NodeType , typename ContainerType , typename ... Args>
static std::shared_ptr< NodeType > add (ContainerType container, Args ... args)
 Create a Node with arguments and add to a Container. More...
 

Public Attributes

std::shared_ptr< Slot< uint32_t > > mapFileRx {}
 Slot to receive notification of map files ready.
 
std::shared_ptr< Slot< int > > secondRx {}
 Slot to receive one-per-second signals from SecondTick.
 
std::shared_ptr< Slot< int > > minuteRx {}
 Slot to receive one-per-minute signals from SecondTick.
 
Signal< SignalType > trackedSatelliteTx {}
 Transmit satellite tracking data.
 
std::shared_ptr< Slot< RadioBehavior::SignalType > > satelliteSelectRx {}
 Receive satellite tracking selection.
 
- Public Attributes inherited from rose::Visual
std::map< size_t, ValueMapmHintsMap {}
 The std::map of hint class to ValueMap.
 

Static Public Attributes

static constexpr std::string_view id = "MapProjection"
 
- Static Public Attributes inherited from rose::Widget
static constexpr std::string_view id = "Widget"
 
- Static Public Attributes inherited from rose::Container
static constexpr std::string_view id = "Container"
 
- Static Public Attributes inherited from rose::Node
static constexpr std::string_view id = "Node"
 
- Static Public Attributes inherited from rose::Manager
static constexpr std::string_view id = "Manager"
 

Protected Member Functions

bool computeAzimuthalMaps ()
 Compute Azimuthal map projections. More...
 
bool setForegroundBackground ()
 Compute the sun illumination pattern. More...
 
Position< MapPositionType > geoToMap (GeoPosition geo, MapProjectionType projection, int splitPixel, Rectangle &mapRect) const
 Convert a GeoPosition in radians to a map Position in pixels. More...
 
void updateEphemerisFile ()
 Update ephemeris and start tracking.
 
void drawOrbitalPath (sdl::Renderer &renderer, TrackedSatellite &satellite, Position mapPos, int splitPixel)
 Draw a Satellite orbital path. More...
 
void drawFootprint (sdl::Renderer &renderer, TrackedSatellite &satellite, Position mapPos, int splitPixel)
 
bool computeAzimuthalMaps ()
 Compute Azimuthal map projections. More...
 
bool setForegroundBackground ()
 Compute the sun illumination pattern. More...
 
void setStationIcons (GeoPosition qth)
 
void setMoonPhase ()
 
void setCelestialIcons ()
 
void drawMapItem (const MapIcon &mapItem, sdl::Renderer &renderer, Rectangle mapRectangle, ProjectionType projection, int splitPixel)
 Render a single icon on the map. More...
 
template<typename InputIterator >
void drawMapItems (InputIterator first, InputIterator last, sdl::Renderer &renderer, Rectangle mapRect, ProjectionType projection, int splitPixel=0)
 Render a container of icons [first ... More...
 

Static Protected Member Functions

static void azimuthalProjection (gm::Surface &projectedSurface, const gm::Surface &mapSurface, Position< int > projected, Position< int > map)
 Compute Azimuthal map projection for one point. More...
 
static std::tuple< bool, double, double > xyToAzLatLong (int x, int y, const Size &mapSize, const GeoPosition &location, double sinY, double cosY)
 Transform a Mercator map pixel into an Azimuthal map latitude and longitude in radians. More...
 
template<size_t N>
static bool azimuthalProjectionSet (std::atomic_bool &abort, const GeoPosition &qthRad, const Size &mapImageSize, std::array< gm::Surface, N > &projected, std::array< gm::Surface, N > &map)
 Compute Azimuthal projection of a set of the same sized maps. More...
 
static std::tuple< bool, bool, double, double, double, DateTime, DateTimefindNextPass (const Satellite &satellite, const Observer &observer)
 Find the next pass of Satellite over Observer.
 

Protected Attributes

std::shared_ptr< TimerTickmTimerTick {}
 Source of timing information.
 
TickProtocol::slot_type mMapIlluminationTimer {}
 Slot to receive illumination update time signals on.
 
WebCacheProtocol::slot_type mMapSlot {}
 The pointer to the map cache. More...
 
MapProjectionType mProjection {}
 The map projection type.
 
MapDepiction mMapDepiction {MapDepiction::Terrain}
 The map depiction.
 
MapSize mMapSize {MapSize::Small}
 The map size.
 
bool mNewSurfaces {}
 True when new surfaces have been created.
 
Size mMapImgSize {}
 The size of the map image.
 
std::array< gm::Surface, 2 > mMapSurface {}
 
std::array< gm::Surface, 2 > mAzSurface {}
 
std::array< gm::Surface, 2 > mMercatorTemp {}
 
std::array< gm::Surface, 2 > mAzimuthalTemp {}
 
std::array< gm::Texture, 2 > mMercator {}
 The Mercator projection background and foreground maps.
 
std::array< gm::Texture, 2 > mAzimuthal {}
 The Azimuthal projection background and foreground maps.
 
std::atomic_bool mAbortFuture {}
 A flag to abort background processing. More...
 
GeoPosition mQth {45.,-75.}
 The station location in degrees. More...
 
GeoPosition mQthRad {mQth.toRadians()}
 The station location in radians.
 
std::future< bool > mComputeAzimuthalMapsFuture
 The std::future result of computeAzimuthalMaps()
 
bool mMapProjectionsInvalid {true}
 True when base maps have not been loaded or projected for use.
 
std::future< bool > mForegroundBackgroundFuture
 The std::future result of setForegroundBackground()
 
SignalSerialNumber mSignalSerialNumber {}
 
Rose::IconFileItem mMoonIconSpec {static_cast<ImageId>(set::AppImageId::Moon), Size{0, 0}, "full_moon.png"}
 
std::stack< set::AppImageId > mSatelliteIconStack {}
 A stack for managing the satellite icons.
 
bool mTerrestrialMode {}
 True when map is in Terrestrial mode, excludes SatelliteMode.
 
bool mSatelliteMode {}
 True when map is in SatelliteMode, excludes TerrestrialMode.
 
bool mCelestialMode {}
 True when map is displaying Celestial objects.
 
bool mAnnotationMode {}
 True when map is displaying Annotations.
 
std::string mSatelliteFavorite {}
 User selected favorite Satellite.
 
std::future< bool > mFutureAziProj {}
 A future for the map azimuthal projections.
 
std::future< bool > mFutureSun {}
 A future for the map sun illumination.
 
std::atomic_bool mNewSurfaces {}
 True when there are new Surfaces to render into Textures.
 
ProjectionType mProjection {ProjectionType::Mercator}
 The desired projection display.
 
std::shared_ptr< WebFileCachemMapCache {}
 
ImageId mDayMapImage {}
 The base day Mercator map image.
 
ImageId mNightMapImage {}
 The base night Mercator map image.
 
GeoPosition mAntipode {}
 The station antipode in radians.
 
Size mMapSize {}
 The size of the base maps in pixels.
 
int mSelectedSatellite {}
 The Satellite to display tracking for.
 
std::array< sdl::Surface, static_cast< std::size_t >MapDataType::MapCount)> mMapSurface {}
 
std::array< sdl::Surface, static_cast< std::size_t >MapDataType::MapCount)> mAzSurface {}
 
std::array< sdl::Surface, static_cast< std::size_t >MapDataType::MapCount)/2 > mMercatorTemp
 
std::array< sdl::Surface, static_cast< std::size_t >MapDataType::MapCount)/2 > mAzimuthalTemp
 
std::atomic_bool mUpdateEphemeris {false}
 
std::array< std::filesystem::path, 5 > mEphemerisFilePath {}
 The set of cached ephemeris files.
 
EphemerisFile mEphemerisFile {EphemerisFile::ClearSkyAll}
 The index to the ephemeris in use.
 
Observer mObserver {}
 The QTH Observer data.
 
std::vector< TrackedSatellitemSatelliteList {}
 The list of Satellites being tracked.
 
std::mutex mSatListMutex {}
 A mutex to protect write access to mSatelliteList.
 
double mMinimumElevation {15.}
 The minimum pass elevation to track satellite.
 
std::array< sdl::Texture, 2 > mMercator {}
 The Mercator projection background and foreground maps.
 
std::array< sdl::Texture, 2 > mAzimuthal {}
 The Azimuthal projection background and foreground maps.
 
sdl::Texture mNightAz {}
 The Texture with the Night Azimuthal map.
 
sdl::Texture mDayAz {}
 The Texture with the Day Azimuthal map.
 
std::shared_ptr< Slot< std::string > > mSettingsUpdateRx {}
 Slot to receive settings updates on.
 
std::unique_ptr< AntiAliasedDrawingmDrawingContext {}
 
std::array< MapIcon, 2 > mStationIcons {}
 Icons for QTH and Antipode.
 
std::array< MapIcon, 2 > mCelestialIcons {}
 Near earth objects (Sun, Moon, etc.).
 
Satellite mMoon {}
 Orbital data for the moon.
 
- Protected Attributes inherited from rose::Widget
EventCallback mEnterEventCallback {}
 The pointer has entered the Widget.
 
EventCallback mLeaveEventCallback {}
 The pointer has left the Widget.
 
ButtonCallback mButtonEventCallback {}
 The pointer button has been pressed with the pointer inside the Widget.
 
MouseMotionCallback mMouseMotionCallback {}
 The pointer is in motion, inside the Widget with a button pressed.
 
ScrollCallback mMouseScrollCallback {}
 The mouse scroll wheel has moved with the pointer inside the Widget.
 
KeyboardShortcutCallback mKeyboardShortcutCallback {}
 A keyboard button event while the Widget has keyboard focus.
 
TextInputCallback mTextInputCallback {}
 A text input event while the Widget has keyboard focus.
 
KeyboardFocusCallback mKeyboardFocusCallback {}
 Notification that this Widget has gained or lost keyboard focus.
 
KeyboardEventCallback mKeyboardEventCallback {}
 Notification that this Widget has received a keyboard event.
 
- Protected Attributes inherited from rose::Visual
SemanticGesture mSemanticGesture {}
 
Position< int > mPos {}
 Position relative to the container, arrived at by layout.
 
Size mSize {}
 The size on screen, arrived at by layout.
 
Position< int > mPreferredPos {}
 The preferred position.
 
Size mPreferredSize {}
 The preferred size.
 
Rectangle mScreenRect {}
 The screen Rectangle computed at drawing time.
 
Padding mPadding {}
 Immediately around the Visual, used for separation and alignment.
 
State mState {}
 The object state Id string.
 
bool mVisible {true}
 If true the object is visible.
 
- Protected Attributes inherited from rose::Node
std::weak_ptr< ContainermContainer {}
 The Container that holds the Node. More...
 
Id mId {}
 
- Protected Attributes inherited from rose::Manager
std::unique_ptr< LayoutManagermLayoutManager {}
 The layout manager which determines the presentation of contained Widgets.
 

Static Protected Attributes

static constexpr std::array< double, 3 > GrayLineCos
 Twilight specs: civil, nautical, astronomical. More...
 
static constexpr double GrayLinePow = .80
 Sets the speed of transitions, smaller is sharper. (.75)
 
static constexpr std::array< set::AppImageId, 5 > mSatelliteIconArray
 A list of satellite icons to initialize a stack that will be used to manage the icons. More...
 

Member Function Documentation

◆ addedToContainer()

void rose::MapProjection::addedToContainer ( )
overridevirtual

Called when added to a container.

Connects the map slot receiver for notification when maps are loaded, then calls cacheCurrentMaps().

Reimplemented from rose::Node.

◆ antipode()

static GeoPosition rose::MapProjection::antipode ( const GeoPosition  posRadians)
inlinestatic

Compute an antipode.

Parameters
posRadiansA GeoPosition in radians.
Returns
The GeoPosition of the Antipode in radians.

◆ azimuthalProjection()

void rose::MapProjection::azimuthalProjection ( gm::Surface projectedSurface,
const gm::Surface mapSurface,
Position< int >  projected,
Position< int >  map 
)
staticprotected

Compute Azimuthal map projection for one point.

Parameters
projectedSurfaceThe surface being projected (the result).
mapSurfaceThe map surface (the source)
projectedThe point on the projected surface.
mapThe point on the map surface.

◆ azimuthalProjectionSet()

template<size_t N>
static bool rose::MapProjection::azimuthalProjectionSet ( std::atomic_bool &  abort,
const GeoPosition qthRad,
const Size mapImageSize,
std::array< gm::Surface, N > &  projected,
std::array< gm::Surface, N > &  map 
)
inlinestaticprotected

Compute Azimuthal projection of a set of the same sized maps.

Template Parameters
NThe number of maps in the set.
Parameters
abortA reference to a std::atomic_bool that will cause an abort when true.
qthRadThe Latitude and Longitude of the projection origin in Radians.
mapImageSizeThe common size of all maps and projections.
projectedA std::array<gm::Surface,N> holding the projected (output) maps.
mapA std::array<gm::Surface,N> holding the source (intput) maps.
Returns
True if successful, false if aborted.

◆ computeAzimuthalMaps() [1/2]

bool rose::MapProjection::computeAzimuthalMaps ( )
protected

Compute Azimuthal map projections.

This should be called by creating the std::future mAzimuthalProjection which will be completed when the projection is done, and return true if the projection was successful. This method only generates the Surfaces which are then used to create Textures that are displayed. The Surface to Texture conversion must happen on the main thread so locking is not an issue and the normal render cycle can continue as long as the last Texture is valid.

◆ computeAzimuthalMaps() [2/2]

bool rose::MapProjection::computeAzimuthalMaps ( )
inlineprotected

Compute Azimuthal map projections.

This should be called by creating the std::future mAzimuthalProjection which will be completed when the projection is done, and return true if the projection was successful. This method only generates the Surfaces which are then used to create Textures that are displayed. The Surface to Texture conversion must happen on the main thread so locking is not an issue and the normal render cycle can continue as long as the last Texture is valid.

◆ draw()

void rose::MapProjection::draw ( sdl::Renderer renderer,
Rectangle  parentRect 
)
override

Draw the Label.

Parameters
rendererthe renderer used to draw.
parentRectThe layout size computed for this widget
parentPositionThe layout position computed for this widget

◆ drawInterpolate()

void rose::MapProjection::drawInterpolate ( gm::Context context,
AntiAliasedDrawing drawing,
Rectangle  mapRect,
GeoPosition geo0,
GeoPosition geo1 
)
inline

Plot a line between to GeoPositions if the line will not cross a gap. Return true if the plot would cross the gap.

◆ drawLatitude()

void rose::MapProjection::drawLatitude ( gm::Context context,
AntiAliasedDrawing drawing,
double  latitude,
Rectangle  mapRect 
)
inline

Draw a line of Latitude at latitude.

Parameters
contextThe graphics Context
drawingThe anti-aliased drawing context.
latitudeThe Latitude in degrees.
mapRectThe size of the map in pixels.

◆ drawLongitude()

void rose::MapProjection::drawLongitude ( gm::Context context,
AntiAliasedDrawing drawing,
double  longitude,
double  latitudeBound,
Rectangle  mapRect 
)
inline

Draw a line of Longitude at longitude.

Parameters
contextThe graphics Context
drawingThe anti-aliased drawing context.
longitudeThe Longitude in degrees.
mapRectThe size of the map in pixels.

◆ drawMapItem() [1/2]

void rose::MapProjection::drawMapItem ( const MapIcon mapItem,
sdl::Renderer renderer,
Rectangle  mapRectangle,
ProjectionType  projection,
int  splitPixel 
)
protected

Render a single icon on the map.

Parameters
mapItemThe MapItem data.
rendererThe Renderer.
projectionTrue if the projection is Azimuthal.
splitPixelThe split location for Mercator station centric projections.

◆ drawMapItem() [2/2]

void rose::MapProjection::drawMapItem ( const ImageId &  mapItem,
gm::Context context,
Rectangle  mapRectangle,
GeoPosition geoPosition,
MapProjectionType  projection,
int  splitPixel 
)

Render a single icon on the map.

Parameters
mapItemThe MapItem data.
rendererThe Renderer.
projectionTrue if the projection is Azimuthal.
splitPixelThe split location for Mercator station centric projections.

◆ drawMapItems()

template<typename InputIterator >
void rose::MapProjection::drawMapItems ( InputIterator  first,
InputIterator  last,
sdl::Renderer renderer,
Rectangle  mapRect,
ProjectionType  projection,
int  splitPixel = 0 
)
inlineprotected

Render a container of icons [first ...

last) on the map.

Parameters
firstThe first item in the container.
lastOne past the end of the container.
rendererThe Renderer.
projectionTrue if the projection is Azimuthal.
splitPixelThe split location for Mercator station centric projections.

◆ drawMapLine() [1/2]

void rose::MapProjection::drawMapLine ( gm::Context context,
AntiAliasedDrawing drawing,
GeoPosition  begin,
Rectangle  mapRectangle,
const std::function< GeoPosition(GeoPosition &, bool fine)> &  increment 
)
inline

Draw a line on the projected map.

The Line runs from begin to end inclusive but skips

Parameters
contextThe graphics Context
drawingThe anti-aliased drawing context.
beginThe starting geographic location.
mapRectangleThe map Rectangle on the screen.
incrementA function to increment the geographic location either fine or course and mark the end.

◆ drawMapLine() [2/2]

template<typename Iterator >
void rose::MapProjection::drawMapLine ( gm::Context context,
AntiAliasedDrawing drawing,
Rectangle  mapRect,
Iterator  first,
Iterator  last 
)
inline

Draw a line on the projected map using points in a standard container.

Template Parameters
IteratorThe iterator type of the container.
Parameters
contextThe graphics Context
drawingThe anti-aliased drawing context.
mapRectThe size of the map in pixels.
firstThe first point in the container to use.
lastOne past the last point in the container to use.

◆ drawOrbitalPath()

void rose::MapProjection::drawOrbitalPath ( sdl::Renderer renderer,
TrackedSatellite satellite,
Position  mapPos,
int  splitPixel 
)
protected

Draw a Satellite orbital path.

Parameters
satelliteThe Satellite

◆ geoPosition()

static GeoPosition rose::MapProjection::geoPosition ( int  x,
int  y,
Size  mapSize 
)
inlinestatic

Convert a map coordinate (x,y) into a GeoPosition(lat,lon) in radians.

Parameters
xThe x coordinate in pixels
yThe y coordinate in pixels
mapSizeThe Size of the map.
Returns
The GeoPosition.

◆ geoToMap() [1/2]

Position rose::MapProjection::geoToMap ( GeoPosition  geo,
ProjectionType  projection,
int  splitPixel 
)

Convert a GeoPosition in radians to a map Position in pixels.

Parameters
projectionTrue if the desired map is an Azimuthal projection.
Returns
The map Position.

◆ geoToMap() [2/2]

Position< MapPositionType > rose::MapProjection::geoToMap ( GeoPosition  geo,
MapProjectionType  projection,
int  splitPixel,
Rectangle mapRect 
) const
protected

Convert a GeoPosition in radians to a map Position in pixels.

Parameters
geoThe surface geographic position.
projectionThe map projection type.
splitPixelThe horizontal pixel to split SationMercator maps.
mapRectThe screen rectangle of the map.
Returns
The map Position<int>.

◆ getProjection()

auto rose::MapProjection::getProjection ( ) const
inline

Accessor for the type of projection.

Returns
A MapProjectionType.

◆ mapPosition()

static Position rose::MapProjection::mapPosition ( GeoPosition  map,
Size  mapSize 
)
inlinestatic

Convert a GeoPosition(lat,lon) in radians to a map Position(x,y) in pixels.

Parameters
mapThe GeoPosition.
mapSizeThe Size of the map.
Returns
The Position.

◆ mapProjectionsValid()

bool rose::MapProjection::mapProjectionsValid ( ) const
inline

Determine if map projections are valid.

Returns
Return true if valid, false otherwise.

◆ projectionSplitPixel()

int rose::MapProjection::projectionSplitPixel ( Size  drawSize) const
inline

Computer the StationMercator split pixel given a map drawing size.

Parameters
drawSizeThe size of the drawing area in use for the map.
Returns
The split pixel.

◆ setForegroundBackground() [1/2]

bool rose::MapProjection::setForegroundBackground ( )
protected

Compute the sun illumination pattern.

This creates a background foreground map pair. The background is the night map, the foreground is the day map which has had the Alpha channel modified to match the projected illumination from the sun. This method only generates the Surfaces which are then used to create Textures that are displayed. The Surface to Texture conversion must happen on the main thread so locking is not an issue and the normal render cycle can continue as long as the last Texture is valid.

◆ setForegroundBackground() [2/2]

bool rose::MapProjection::setForegroundBackground ( )
protected

Compute the sun illumination pattern.

This creates a background foreground map pair. The background is the night map, the foreground is the day map which has had the Alpha channel modified to match the projected illumination from the sun. This method only generates the Surfaces which are then used to create Textures that are displayed. The Surface to Texture conversion must happen on the main thread so locking is not an issue and the normal render cycle can continue as long as the last Texture is valid.

◆ setMoonEphemerisFile()

void rose::MapProjection::setMoonEphemerisFile ( EphemerisFile  item,
const std::filesystem::path &  filePath 
)
inline

Set the Moon ephemeris.

Parameters
fileNameThe ephemeris.

◆ subSolar()

std::tuple< double, double > rose::MapProjection::subSolar ( )
static

Compute the sub-solar geographic coordinates, used in plotting the solar illumination.

Returns
a tuple with the latitude, longitude in radians

◆ widgetLayout()

Rectangle rose::MapProjection::widgetLayout ( sdl::Renderer renderer,
Rectangle  available,
uint  layoutStage 
)
override

Determine the desired size of the label with text and badge.

Parameters
rendererthe Renderer to use if needed.
availableThe Rectangle available for layout.
Returns
Rectangle The layout Rectangle.

◆ xyToAzLatLong()

std::tuple< bool, double, double > rose::MapProjection::xyToAzLatLong ( int  x,
int  y,
const Size mapSize,
const GeoPosition location,
double  sinY,
double  cosY 
)
staticprotected

Transform a Mercator map pixel into an Azimuthal map latitude and longitude in radians.

Parameters
xThe map x pixel location 0 on the left
yThe map y pixel location 0 at the top
mapSizethe width (x) and height (y) of the map in pixels
locationthe longitude (x) and latitude (y) of the center of the projection
sinYpre-computed sine of the latitude
cosYpre-computed cosine of the latitude
Returns
[valid, latitude, longitude ], valid if the pixel is on the Earth, latitude -PI..+PI West to East, longitude +PI/2..-PI/2 North to South

Member Data Documentation

◆ GrayLineCos

static constexpr std::array< double, 3 > rose::MapProjection::GrayLineCos
staticprotected
Initial value:
= {-0.105,
-0.208,
-0.309}

Twilight specs: civil, nautical, astronomical.

Sets the width of the dawn/dusk period.

◆ mAbortFuture

std::atomic_bool rose::MapProjection::mAbortFuture {}
protected

A flag to abort background processing.

Set to true to abort a running std::future.

◆ mMapSlot

WebCacheProtocol::slot_type rose::MapProjection::mMapSlot {}
protected

The pointer to the map cache.

The slot to receive map cache events.

◆ mQth

GeoPosition rose::MapProjection::mQth {45.,-75.}
protected

The station location in degrees.

The station location.

◆ mSatelliteIconArray

constexpr std::array<set::AppImageId,5> rose::MapProjection::mSatelliteIconArray
staticprotected
Initial value:
{
set::AppImageId::DotPurple, set::AppImageId::DotYellow,
set::AppImageId::DotGreen, set::AppImageId::DotBlue, set::AppImageId::DotRed, }

A list of satellite icons to initialize a stack that will be used to manage the icons.


The documentation for this class was generated from the following files: