WEB开发网
开发学院软件开发VC 用VC++实现矢量地图背景下的实时显示 阅读

用VC++实现矢量地图背景下的实时显示

 2008-11-14 19:35:22 来源:WEB开发网   
核心提示: 程序清单2 MapAppView.cpp文件void CMapAppView::OnInitialUpdate(){char str[256];CView::OnInitialUpdate();char str[256];///创建航显底图mapinfo.Do("Open Tab

程序清单2 MapAppView.cpp文件

  void CMapAppView::OnInitialUpdate()
  {
  char str[256];
  CView::OnInitialUpdate();
  char str[256];
  ///创建航显底图
  mapinfo.Do("Open Table "F:Province.tab" ReadOnly Interactive");
  mapinfo.Do("Open Table "f:Capitals.tab" ReadOnly Interactive");
  mapinfo.Do("Open Table "f:China.tab" ReadOnly Interactive");
  sprintf(str,"Set Next Document Parent %lu Style 2 ",(long)(UINT)m_hWnd);
  mapinfo.Do(str);//创建地图窗口
  /*设置地图窗口的图层,由最上一层开始是中国疆域,各省疆域,省会城市,并标注上省会城市的名字*/
  mapinfo.Do("Map From Capitals, Province, China");
  mapinfo.Do("Set Map Layer 1 Label With Capital_Character_Name Parallel On Auto On Visibility On");
  //获取地图窗口的ID号和句柄
  m_lWindowid = atol(mapinfo.Eval("WindowID(0)")); file://窗口ID
  sprintf(str,"WindowInfo(0, %u)", WIN_INFO_WND); file://窗口HWND
  m_hWindowHwnd = (HWND)atol(mapinfo.Eval(str));
  //调整地图窗口尺寸,将地图窗口放置在右半屏上
  sprintf(str,
  "Set Window %lu Position (8.3,0) Width 8.4 Height 6.05 ScrollBars Off SysMenuClose Off", m_lWindowid);
  mapinfo.Do(str);
  //调整地图窗口视野和中心点
  double m_dView_center_x=113.35; file://地图窗口中心点,经纬度
  double m_dView_center_y=35.04;
  double m_dView_zoom = 4000.0; file://地图窗口视野,"km"
  sprintf(str,"Set Map Window %lu Zoom %lf Units "km" Center (%lf,%lf) XY Units "degree"", m_lWindowid,m_dView_zoom,m_dView_center_x,m_dView_center_y);
  mapinfo.Do(str);//设置地图窗口中心点窗口视野
  //设置地图窗口漫游缩放的右键菜单
  mapinfo.Do("Create Menu "MapshellShortcut" ID 17 as "漫游" calling 1702,"缩小" calling 1706, "放大" calling 1705 ,"(-"");
  //创建实时航迹显示图层
  mapinfo.Do("Create Table plane (ID Integer) File "f:plane.tab" ");
  mapinfo.Do("Create Map For plane");
  sprintf(str,"Add Map Window %lu Layer plane Animate",m_lWindowid);
  mapinfo.Do(str); file://实时航迹图层设置为快速刷新}

上一页  1 2 3 4  下一页

Tags:VC 实现 矢量

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接