Garmin Fleet Management Controller  2.19.0
CMapViewerDlg Class Reference

Browser-based container for listing the Custom Avoidances library. More...

#include <CMapViewerDlg.h>

+ Inheritance diagram for CMapViewerDlg:

Public Types

enum  { IDD = IDD_MAP_VIEWER }
 

Public Member Functions

 CMapViewerDlg (CWnd *pParent, FmiApplicationLayer &aCom)
 Constructor. More...
 
virtual ~CMapViewerDlg ()
 Destructor. More...
 
void OnBeforeNavigate2 (LPDISPATCH pDisp, VARIANT *URL, VARIANT *Flags, VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers, BOOL *Cancel)
 This catches navigation attempts for the purpose of handling application-specific navigation. More...
 
void onEvent (EventId aEventId, uint32 aEventData, void *aEventDataPtr, BOOL handleNow)
 Handles event callbacks by translating an EventId into a windows message. More...
 

Protected Member Functions

BOOL activateStopOnDevice (int itemId)
 This function activates the specified route on the device. More...
 
BOOL addAvoidanceToCatalog (int itemId, LPCTSTR name, LPCTSTR description, long north, long east, long south, long west)
 This function adds an item to the catalog. More...
 
BOOL addRouteToCatalog (CStringArray &args)
 This function adds an item to the catalog. More...
 
BOOL addStopToCatalog (CStringArray &args)
 This function adds an item to the catalog. More...
 
BOOL completeStopOnDevice (int itemId)
 This function marks the specified route as done on the device. More...
 
BOOL deleteAvoidanceFromDevice (int itemId)
 This function deletes the specified region from the device. More...
 
BOOL deleteRouteFromDevice (int itemId)
 This function deletes the specified route from the device. More...
 
virtual void DoDataExchange (CDataExchange *pDX)
 Perform dialog data exchange and validation. More...
 
BOOL moveStopOnDevice (int itemId, short newPosition)
 This function repositions the specified stop on the device. More...
 
BOOL OnInitDialog ()
 This function is called when the window is created. More...
 
afx_msg void OnSize (UINT aType, int aClientWidth, int aClientHeight)
 Called after the dialog is resized; repositions the contents of the display. More...
 
void refreshCatalog ()
 This function is called to reload the catalog document. More...
 
BOOL removeAvoidanceFromCatalog (int itemId)
 This function removes specific regions from the catalog. More...
 
BOOL removeItemsFromCatalog (LPCTSTR selector)
 This function removes specific routes from the catalog. More...
 
BOOL removeRouteFromCatalog (int itemId)
 This function removes specific routes from the catalog. More...
 
BOOL removeStopFromCatalog (int itemId)
 
BOOL sendAvoidanceToDevice (int itemId, LPCTSTR name, long north, long east, long south, long west)
 This function sends the specified region to the device. More...
 
BOOL sendRouteToDevice (int itemId)
 This function sends the specified route to the device. More...
 
BOOL sendStopToDevice (int itemId)
 This function sends the specified stop to the device. More...
 
BOOL setAvoidanceEnabled (int itemId, BOOL enabled=TRUE)
 This function toggles enabled for the region on the device. More...
 

Protected Attributes

CWebBrowser2 m_browser
 
FmiApplicationLayermCom
 Reference to the FMI communication controller. More...
 

Private Attributes

CStringArray m_addRouteArguments
 List of arguments that are accumulated across several calls from browser. More...
 

Detailed Description

Browser-based container for listing the Custom Avoidances library.

Definition at line 24 of file CMapViewerDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator
IDD 

Definition at line 36 of file CMapViewerDlg.h.

Constructor & Destructor Documentation

CMapViewerDlg::CMapViewerDlg ( CWnd *  pParent,
FmiApplicationLayer aCom 
)

Constructor.

Definition at line 39 of file CMapViewerDlg.cpp.

CMapViewerDlg::~CMapViewerDlg ( )
virtual

Destructor.

Definition at line 48 of file CMapViewerDlg.cpp.

Member Function Documentation

BOOL CMapViewerDlg::activateStopOnDevice ( int  id)
protected

This function activates the specified route on the device.

Returns
TRUE if the operation completed successfully

Definition at line 814 of file CMapViewerDlg.cpp.

References REQUEST_ACTIVATE_STOP, and TRUE.

BOOL CMapViewerDlg::addAvoidanceToCatalog ( int  itemId,
LPCTSTR  name,
LPCTSTR  description,
long  north,
long  east,
long  south,
long  west 
)
protected

This function adds an item to the catalog.

Load the catalog document, create the new region element, add that to the catalog element, and then save the document

Returns
TRUE if the operation completed successfully

Definition at line 382 of file CMapViewerDlg.cpp.

References FALSE, and TRUE.

BOOL CMapViewerDlg::addRouteToCatalog ( CStringArray &  args)
protected

This function adds an item to the catalog.

Load the catalog document, create the new route element, add that to the catalog element, and then save the document

Returns
TRUE if the operation completed successfully

Definition at line 595 of file CMapViewerDlg.cpp.

References FALSE, and TRUE.

BOOL CMapViewerDlg::addStopToCatalog ( CStringArray &  args)
protected

This function adds an item to the catalog.

Load the catalog document, create the new stop element, add that to the catalog element, and then save the document

Returns
TRUE if the operation completed successfully

Definition at line 500 of file CMapViewerDlg.cpp.

References FALSE, StopListItem::setCurrentName(), StopListItem::setStopStatus(), ClientListItem::setValid(), STOP_STATUS_UNREAD, and TRUE.

BOOL CMapViewerDlg::completeStopOnDevice ( int  id)
protected

This function marks the specified route as done on the device.

Returns
TRUE if the operation completed successfully

Definition at line 824 of file CMapViewerDlg.cpp.

References REQUEST_MARK_STOP_DONE, and TRUE.

BOOL CMapViewerDlg::deleteAvoidanceFromDevice ( int  id)
protected

This function deletes the specified region from the device.

Returns
TRUE if the operation completed successfully

Definition at line 465 of file CMapViewerDlg.cpp.

References FMI_CUSTOM_AVOID_DEL_REQUEST, TRUE, and custom_avoid_delete_type::unique_id.

BOOL CMapViewerDlg::deleteRouteFromDevice ( int  id)
protected

This function deletes the specified route from the device.

Returns
TRUE if the operation completed successfully

Definition at line 804 of file CMapViewerDlg.cpp.

References REQUEST_DELETE_STOP, and TRUE.

void CMapViewerDlg::DoDataExchange ( CDataExchange *  pDX)
protectedvirtual

Perform dialog data exchange and validation.

Parameters
aDataExchangeThe DDX context

Definition at line 57 of file CMapViewerDlg.cpp.

References IDC_EMBEDDED_BROWSER.

BOOL CMapViewerDlg::moveStopOnDevice ( int  id,
short  newPosition 
)
protected

This function repositions the specified stop on the device.

Returns
TRUE if the operation completed successfully

Definition at line 834 of file CMapViewerDlg.cpp.

References REQUEST_MOVE_STOP, and TRUE.

void CMapViewerDlg::OnBeforeNavigate2 ( LPDISPATCH  pDisp,
VARIANT *  URL,
VARIANT *  Flags,
VARIANT *  TargetFrameName,
VARIANT *  PostData,
VARIANT *  Headers,
BOOL *  Cancel 
)

This catches navigation attempts for the purpose of handling application-specific navigation.

Handle application-specific navigation URLs.

Definition at line 159 of file CMapViewerDlg.cpp.

References FALSE, TRUE, and CWebBrowser2::URLDecode().

Referenced by refreshCatalog().

void CWndEventListener::onEvent ( EventId  aEventId,
uint32  aEventData,
void *  aEventDataPtr,
BOOL  handleNow 
)
virtualinherited

Handles event callbacks by translating an EventId into a windows message.

Casts this to a CWnd then posts a Windows message to it. The use of dynamic_cast is used as an alternative to the "dreaded diamond" caused by C++ multiple inheritance.

Parameters
aEventIdThe event ID
aEventDataThe event data
aEventDataPtrPointer to more event data
Note
Interested parties receive these events as Windows messages, i.e., ON_MESSAGE( aEventId, CallbackFunction ). aEventData is the WPARAM, and aEventDataPtr is the LPARAM.

Implements EventListener.

Definition at line 29 of file CWndEventListener.cpp.

References EVENT_ID_CNT, and WM_EVENT.

BOOL CMapViewerDlg::OnInitDialog ( )
protected

This function is called when the window is created.

Returns
TRUE, since this function does not set focus to a control

Definition at line 67 of file CMapViewerDlg.cpp.

References OnSize(), and TRUE.

void CMapViewerDlg::OnSize ( UINT  aType,
int  aClientWidth,
int  aClientHeight 
)
protected

Called after the dialog is resized; repositions the contents of the display.

Moves/sizes the contents as follows:

  • Moves the search box to the bottom-left corner, keeping its size
  • Moves the packet list to the top-left, expands vertically
  • Moves the packet detail to the right of the list, expands horizontally to fill the dialog and vertically to match the height of the packet list
  • Centers the buttons under the packet detail.
    Parameters
    aTypeThe type of resizing requested (maximized, etc.)
    aClientWidthThe new width of the client area
    aClientHeightThe new height of the client area

Definition at line 94 of file CMapViewerDlg.cpp.

Referenced by OnInitDialog().

void CMapViewerDlg::refreshCatalog ( )
protected

This function is called to reload the catalog document.

Definition at line 120 of file CMapViewerDlg.cpp.

References IDC_EMBEDDED_BROWSER, OnBeforeNavigate2(), and write().

BOOL CMapViewerDlg::removeAvoidanceFromCatalog ( int  id)
protected

This function removes specific regions from the catalog.

Load the catalog document, search for all regions by id, remove them, and then save the document

Returns
TRUE if the operation completed successfully

Definition at line 426 of file CMapViewerDlg.cpp.

BOOL CMapViewerDlg::removeItemsFromCatalog ( LPCTSTR  selector)
protected

This function removes specific routes from the catalog.

Load the catalog document, search for all routes by id, remove them, and then save the document

Returns
TRUE if the operation completed successfully

Definition at line 848 of file CMapViewerDlg.cpp.

References FALSE, and TRUE.

BOOL CMapViewerDlg::removeRouteFromCatalog ( int  id)
protected

This function removes specific routes from the catalog.

Load the catalog document, search for all routes by id, remove them, and then save the document

Returns
TRUE if the operation completed successfully

Definition at line 645 of file CMapViewerDlg.cpp.

BOOL CMapViewerDlg::removeStopFromCatalog ( int  itemId)
protected
BOOL CMapViewerDlg::sendAvoidanceToDevice ( int  itemId,
LPCTSTR  name,
long  north,
long  east,
long  south,
long  west 
)
protected

This function sends the specified region to the device.

This passes data directly to the device. It does not load any information from the catalog

Returns
TRUE if the operation completed successfully

Definition at line 439 of file CMapViewerDlg.cpp.

References custom_avoid_type::enable, FMI_CUSTOM_AVOID_ADD_REQUEST, sc_position_type::lat, sc_position_type::lon, custom_avoid_type::name, custom_avoid_type::point1, custom_avoid_type::point2, TRUE, and custom_avoid_type::unique_id.

BOOL CMapViewerDlg::sendRouteToDevice ( int  itemId)
protected

This function sends the specified route to the device.

This passes data directly to the device. It does load information from the catalog

Returns
TRUE if the operation completed successfully

Definition at line 658 of file CMapViewerDlg.cpp.

References FALSE, FMI_FILE_TYPE_PATH_SPECIFIC_ROUTE, sc_position_type::lat, sc_position_type::lon, minval, SEND_ROUTE_TEMP_FILE, StopListItem::setCurrentName(), StopListItem::setStopStatus(), ClientListItem::setValid(), STOP_STATUS_UNREAD, TRUE, UTIL_get_current_garmin_time(), and write().

BOOL CMapViewerDlg::sendStopToDevice ( int  itemId)
protected

This function sends the specified stop to the device.

This passes data directly to the device. It does load information from the catalog

Returns
TRUE if the operation completed successfully

Definition at line 549 of file CMapViewerDlg.cpp.

References FALSE, and TRUE.

BOOL CMapViewerDlg::setAvoidanceEnabled ( int  id,
BOOL  enabled = TRUE 
)
protected

This function toggles enabled for the region on the device.

Returns
TRUE if the operation completed successfully

Definition at line 481 of file CMapViewerDlg.cpp.

References custom_avoid_enable_type::enable, FMI_CUSTOM_AVOID_TOGGLE_REQUEST, TRUE, and custom_avoid_enable_type::unique_id.

Member Data Documentation

CStringArray CMapViewerDlg::m_addRouteArguments
private

List of arguments that are accumulated across several calls from browser.

Definition at line 81 of file CMapViewerDlg.h.

CWebBrowser2 CMapViewerDlg::m_browser
protected

Definition at line 73 of file CMapViewerDlg.h.

FmiApplicationLayer& CMapViewerDlg::mCom
protected

Reference to the FMI communication controller.

Definition at line 76 of file CMapViewerDlg.h.


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