- Maps can be saved to server's memory (not to the database jet)
[public/netxms.git] / src / console / win32 / MapView.h
CommitLineData
3bf7e95e
VK
1#if !defined(AFX_MAPVIEW_H__9082BB7F_2C80_4E6E_9FDB_A4D4039C2CB1__INCLUDED_)
2#define AFX_MAPVIEW_H__9082BB7F_2C80_4E6E_9FDB_A4D4039C2CB1__INCLUDED_
3
4#if _MSC_VER > 1000
5#pragma once
6#endif // _MSC_VER > 1000
7// MapView.h : header file
8//
9
5d8a7f11
VK
10#include <netxms_maps.h>
11
e044d21c
VK
12#define MAX_ZOOM 3
13#define NEUTRAL_SCALE 2
14#define MAX_HISTORY_SIZE 256
5d8a7f11
VK
15
16
17//
2ef00554
VK
18// Map object states
19//
20
21#define MOS_SELECTED 0x01
22
23
24//
ca246498
VK
25// Map view states
26//
27
28#define STATE_NORMAL 0
29#define STATE_OBJECT_LCLICK 1
30#define STATE_DRAGGING 2
31#define STATE_SELECTING 3
32
33
34//
5d8a7f11
VK
35// Scale-dependent elements
36//
37
38struct SCALE_INFO
39{
40 int nFactor;
41 POINT ptObjectSize;
42 POINT ptIconOffset;
43 POINT ptTextOffset;
44 POINT ptTextSize;
45 int nImageList;
46 int nFontIndex;
47};
48
49
50//
51// Additional information about objects on map
52//
53
54struct OBJINFO
55{
56 DWORD dwObjectId;
57 RECT rcObject;
58 RECT rcText;
59};
60
61
3bf7e95e
VK
62/////////////////////////////////////////////////////////////////////////////
63// CMapView window
64
5d8a7f11 65class CMapView : public CWnd
3bf7e95e
VK
66{
67// Construction
68public:
69 CMapView();
70
71// Attributes
72public:
73
74// Operations
75public:
76
77// Overrides
78 // ClassWizard generated virtual function overrides
79 //{{AFX_VIRTUAL(CMapView)
80 protected:
5d8a7f11 81 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
3bf7e95e
VK
82 //}}AFX_VIRTUAL
83
84// Implementation
85public:
e044d21c
VK
86 void OnObjectChange(DWORD dwObjectId, NXC_OBJECT *pObject);
87 BOOL CanGoForward(void);
88 BOOL CanGoBack(void);
89 void OpenRoot(void);
90 void GoForward(void);
91 void GoBack(void);
92 BOOL CanGoToParent(void);
93 void GoToParentObject(void);
e769762b
VK
94 BOOL CanZoomOut(void);
95 void ZoomOut(void);
96 BOOL CanZoomIn(void);
97 void ZoomIn(void);
e044d21c 98 void OpenSubmap(DWORD dwId, BOOL bAddToHistory = TRUE);
ca246498
VK
99 void GetMinimalSelectionRect(RECT *pRect);
100 int GetSelectionCount(void);
101 void ClearSelection(BOOL bRedraw = TRUE);
2ef00554 102 DWORD PointInObject(POINT pt);
5d8a7f11
VK
103 void Update(void);
104 void SetMap(nxMap *pMap);
3bf7e95e
VK
105 virtual ~CMapView();
106
107 // Generated message map functions
108protected:
e044d21c
VK
109 void AddToHistory(DWORD dwId);
110 DWORD m_dwHistory[MAX_HISTORY_SIZE];
111 DWORD m_dwHistoryPos;
112 DWORD m_dwHistorySize;
e769762b
VK
113 POINT m_ptMapSize;
114 int CalculateNewScrollPos(UINT nScrollBar, UINT nSBCode, UINT nPos);
8adb6e6f 115 POINT m_ptOrg;
e769762b
VK
116 void UpdateScrollBars(BOOL bForceUpdate);
117 void ScalePosMapToScreen(POINT *pt);
118 void ScalePosScreenToMap(POINT *pt);
7643e048
VK
119 POINT m_ptDragOffset;
120 void SelectObjectsInRect(RECT &rcSelection);
121 void StartObjectDragging(POINT point);
ca246498
VK
122 CImageList *m_pDragImageList;
123 void MoveSelectedObjects(int nOffsetX, int nOffsetY);
ca246498
VK
124 DWORD m_dwFocusedObjectIndex;
125 DWORD m_dwFocusedObject;
7643e048 126 POINT m_ptMouseOpStart;
ca246498
VK
127 RECT m_rcSelection;
128 int m_nState;
129 COLORREF m_rgbSelBkColor;
130 COLORREF m_rgbSelTextColor;
131 COLORREF m_rgbSelRectColor;
132 COLORREF m_rgbBkColor;
133 COLORREF m_rgbTextColor;
2ef00554
VK
134 void SetObjectRect(DWORD dwObjectId, RECT *pRect, BOOL bTextRect);
135 OBJINFO *m_pObjectInfo;
136 DWORD m_dwNumObjects;
e769762b 137 CFont m_fontList[3];
5d8a7f11
VK
138 int m_nScale;
139 void DoSubmapLayout(void);
ca246498
VK
140 void DrawObject(CDC &dc, DWORD dwIndex, CImageList *pImageList,
141 POINT ptOffset, BOOL bUpdateInfo);
142 void DrawOnBitmap(CBitmap &bitmap, BOOL bSelectionOnly, RECT *prcSel);
5d8a7f11
VK
143 CBitmap m_bmpMap;
144 nxSubmap *m_pSubmap;
145 nxMap *m_pMap;
3bf7e95e 146 //{{AFX_MSG(CMapView)
5d8a7f11 147 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
6e953858 148 afx_msg void OnPaint();
2ef00554
VK
149 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
150 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
151 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
4a403ebb 152 afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
e769762b
VK
153 afx_msg void OnSize(UINT nType, int cx, int cy);
154 afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
155 afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
3bf7e95e
VK
156 //}}AFX_MSG
157 DECLARE_MESSAGE_MAP()
8b56eec1
VK
158
159public:
160 nxMap *GetMap(void) { return m_pMap; }
3bf7e95e
VK
161};
162
163/////////////////////////////////////////////////////////////////////////////
164
165//{{AFX_INSERT_LOCATION}}
166// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
167
168#endif // !defined(AFX_MAPVIEW_H__9082BB7F_2C80_4E6E_9FDB_A4D4039C2CB1__INCLUDED_)