CMapPin v1.01
Welcome to CMapPin, a freeware MFC classes to provide map pins useful in GIS applications. If you have Microsoft AutoRoute Express (I think it's called AutoMap in the US) installed, you will probably have seem what I am talking about.
Here's a small sample of what the map pins look like when overlaid on a bitmap map:
Features |
Usage |
History |
API Reference |
Planned Enhancements |
Contacting the Author |
V1.0 (13th August 1998)
V1.01 (12th September 1998)
The API consists of the the public member functions of the class CMapPin:
CMapPin
~CMapPin
Create
SetIcon
GetIcon
SetPopupMenu
SetAllowDrag
GetAllowDrag
CMapPin();
Remarks
Standard C++ constructor. Just initializes internal variables to a default value.
~CMapPin();
Remarks
Standard C++ destructor. Internally it will free any resources used by this instance.
BOOL Create(LPCTSTR lpszTooltipText, DWORD dwStyle, const CPoint& p, CWnd* pParent, UINT nID);
Return Value
Nonzero if successful; otherwise 0.
Parameters
lpszTooltipText Specifies the tooltip text to use for the control. If NULL, no text will be visible.
dwStyle Specifies the control's window style. Normally this will just be WS_CHILD and WS_VISIBLE.
p Specifies the position of the control. The size will be taken from the attached icon.
pParentWnd Specifies the controls parent window, usually your CView derived class. It must not be NULL.
nID Specifies the control's control ID.
Remarks
Construct a CMapPin object in three steps. First call the constructor, then SetIcon and then call Create, which creates the Windows control and attaches it to the CMapPin object.
Apply the following window styles to a map pin control:
BOOL SetIcon(HINSTANCE hModule,
LPCTSTR lpszResourceName, BOOL bSmallIcon);
BOOL SetIcon(HINSTANCE hModule, UINT nIDResource,
BOOL bSmallIcon);
Return Value
Nonzero if successful; otherwise 0.
Parameters
hModule Handle to an instance of the module whose executable file contains the icon to be loaded.
lpszResourceName Pointer to a null-terminated string that contains the name of the icon resource to be loaded.
nIDResource The resource identifier of the icon resource to be loaded.
bSmallIcon Specifies whether a small (16 * 16) icon is being loaded, FALSE indicates that a standard 32 * 32 icon is being loaded.
Remarks
Modifies the icon to be displayed on the map pin.
HICON GetIcon() const;
Return Value
Returns the handle of the icon currently being used by this map pin instance.
void SetPopupMenu(LPCTSTR lpszResourceName);
void SetPopupMenu(UINT nIDResource);
Parameters
lpszResourceName Pointer to a null-terminated string that contains the name of the menu resource to be used.
nIDResource The resource identifier of the menu resource to be used.
Remarks
Sets which menu resource will be used in context menus for this map pin instance.
void SetAllowDrag(BOOL bAllowDrag);
Parameters
bAllowDrag TRUE if you want to allow the map pin be dragable, FALSE will disallow dragging.
Remarks
Changes whether or not the map pin can be dragged around.
BOOL GetAllowDrag() const;
Return Value
TRUE if the instance allows dragging, otherwise FALSE.
PJ Naughter
Email: pjn@indigo.ie
Web: http://indigo.ie/~pjn
12th September 1998