📄 savemap.cpp
字号:
/* * LibRoadnav * savemap.cpp * * Copyright (c) 2004 - 2005 Richard L. Lynch <rllynch@users.sourceforge.net> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */#ifdef HAVE_CONFIG_H# include <config.h>#endif#ifdef _MSC_VER#pragma warning(disable: 4786)#endif#include <wx/wx.h>#include <wx/image.h>#include <wx/fs_zip.h>#include <wx/fs_inet.h>#include <wx/socket.h>#include "libroadnav/Map.h"#include "libroadnav/MapControl.h"#include "libroadnav/MapControlData_Tiles.h"// This line fixes some wxMSW bugs// http://lists.wxwidgets.org/archive/wx-users/msg42583.htmlstatic wxSocketClient g_sockDummy;class MyApp : public wxApp{ public: virtual bool OnInit();};IMPLEMENT_APP(MyApp)bool MyApp::OnInit(){ MapControl * pcMap; MapAppearanceSettings cMapAppearanceSettings; MapControlData_Tiles cMapRecords; wxMemoryDC dcMem; wxBitmap bmpOut(512, 512); wxBitmap bmpEmpty(1, 1); wxFrame frmEmpty(NULL, -1, wxT("")); // This line also helps with the wxMSW bugs. It's not necessary on other platforms. new wxSocketBase(); wxInitAllImageHandlers(); wxFileSystem::AddHandler(new wxZipFSHandler); wxFileSystem::AddHandler(new wxInternetFSHandler); MapInit(); pcMap = new MapControl ( &cMapRecords, &cMapAppearanceSettings, &frmEmpty, -1, wxDefaultPosition, wxDefaultSize ); pcMap->SetDetailLevel(0); pcMap->SetCenterCoordinates(Point(-71, 43)); dcMem.SelectObject(bmpOut); pcMap->DrawAll(&dcMem, wxSize(512, 512), true); dcMem.SelectObject(bmpEmpty); bmpOut.SaveFile(wxT("out.png"), wxBITMAP_TYPE_PNG); return false;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -