📄 readme.txt
字号:
========================================================================
MICROSOFT FOUNDATION CLASS LIBRARY : Gis
========================================================================
AppWizard has created this Gis application for you. This application
not only demonstrates the basics of using the Microsoft Foundation classes
but is also a starting point for writing your application.
This file contains a summary of what you will find in each of the files that
make up your Gis application.
Gis.dsp
This file (the project file) contains information at the project level and
is used to build a single project or subproject. Other users can share the
project (.dsp) file, but they should export the makefiles locally.
Gis.h
This is the main header file for the application. It includes other
project specific headers (including Resource.h) and declares the
CGisApp application class.
Gis.cpp
This is the main application source file that contains the application
class CGisApp.
Gis.rc
This is a listing of all of the Microsoft Windows resources that the
program uses. It includes the icons, bitmaps, and cursors that are stored
in the RES subdirectory. This file can be directly edited in Microsoft
Visual C++.
Gis.clw
This file contains information used by ClassWizard to edit existing
classes or add new classes. ClassWizard also uses this file to store
information needed to create and edit message maps and dialog data
maps and to create prototype member functions.
res\Gis.ico
This is an icon file, which is used as the application's icon. This
icon is included by the main resource file Gis.rc.
res\Gis.rc2
This file contains resources that are not edited by Microsoft
Visual C++. You should place all resources not editable by
the resource editor in this file.
/////////////////////////////////////////////////////////////////////////////
For the main frame window:
MainFrm.h, MainFrm.cpp
These files contain the frame class CMainFrame, which is derived from
CFrameWnd and controls all SDI frame features.
res\Toolbar.bmp
This bitmap file is used to create tiled images for the toolbar.
The initial toolbar and status bar are constructed in the CMainFrame
class. Edit this toolbar bitmap using the resource editor, and
update the IDR_MAINFRAME TOOLBAR array in Gis.rc to add
toolbar buttons.
/////////////////////////////////////////////////////////////////////////////
AppWizard creates one document type and one view:
GisDoc.h, GisDoc.cpp - the document
These files contain your CGisDoc class. Edit these files to
add your special document data and to implement file saving and loading
(via CGisDoc::Serialize).
GisView.h, GisView.cpp - the view of the document
These files contain your CGisView class.
CGisView objects are used to view CGisDoc objects.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named Gis.pch and a precompiled types file named StdAfx.obj.
Resource.h
This is the standard header file, which defines new resource IDs.
Microsoft Visual C++ reads and updates this file.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
If your application uses MFC in a shared DLL, and your application is
in a language other than the operating system's current language, you
will need to copy the corresponding localized resources MFC42XXX.DLL
from the Microsoft Visual C++ CD-ROM onto the system or system32 directory,
and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation.
For example, MFC42DEU.DLL contains resources translated to German.) If you
don't do this, some of the UI elements of your application will remain in the
language of the operating system.
/////////////////////////////////////////////////////////////////////////////
// BindLayer Object
// Fields Object
void CSampleProjectView::CreateXYTable() {
{
CMapXODBCQueryInfo QueryInfo;
COleVariant BindLayerVt,FieldsVt,QueryInfoVt;
CMapXFields Fields;
CMapXBindLayer BindLayer;
// Create new instances of the Fields, ODBCQueryInfo, and BindLayer objects
if(!Fields.CreateDispatch(Fields.GetClsid())) {
TRACE0("Failed to Create Fields Object");
return;
}
if(!QueryInfo.CreateDispatch(QueryInfo.GetClsid())) {
TRACE0("Failed to Create ODBCQueryInfo Object!");
return;
}
if(!BindLayer.CreateDispatch(BindLayer.GetClsid())) {
TRACE0("Failed to Create BindLayer Object!");
return;
}
try {
// You can specify a username and password in the Connect String
QueryInfo.SetConnectString("ODBC;");
// Not specifying a datasource will pop up a datasource dialog
// If the data source name is known in advance, you can avoid relying on
// the user to find the Mapstats.mdb database
QueryInfo.SetDataSource("");
// The US_CUST recordset is in the Mapstats.mdb database
// Note: It is possible to only select the fields you want
// For example: QueryInfo.SetSqlQuery("select COMPANY,X,Y,ORDER_AMT from US_CUST");
// Or other more complex SQL querys
QueryInfo.SetSqlQuery("select * from US_CUST");
QueryInfoVt.vt = VT_DISPATCH;
QueryInfoVt.pdispVal = QueryInfo;
QueryInfoVt.pdispVal->AddRef();
// Create a permanent layer in the MapX directory (if the layer already exists,
// the user will get an error in Datasets.Add)
// This layer will have one column, which is the GeoField specified in Datasets.Add
// In this case, it is the company name
BindLayer.SetFilespec("C:\\Program Files\\MapInfo MapX\\Maps\\CustLayer.tab");
BindLayer.SetLayerName("Customers");
BindLayer.SetLayerType(miBindLayerTypeXY);
// For layers of type miBindLayerTypeXY, RefColumn1 must be the column that contains
// X coordinates, and RefColumn2 must be the column that contains Y coordinates
BindLayer.SetRefColumn1("X");
BindLayer.SetRefColumn2("Y");
BindLayerVt.vt = VT_DISPATCH;
BindLayerVt.pdispVal = BindLayer;
BindLayerVt.pdispVal->AddRef();
// This specifies which fields from the source data to add and how to add them
Fields.Add(COleVariant("COMPANY"),COleVariant("Company"),COleVariant((long)miAggregationIndividual),COleVariant((long)miTypeString));
Fields.Add(COleVariant("X"),COleVariant("X"),COleVariant((long)miAggregationAverage),COleVariant((long)miTypeNumeric));
Fields.Add(COleVariant("Y"),COleVariant("Y"),COleVariant((long)miAggregationAverage),COleVariant((long)miTypeNumeric));
Fields.Add(COleVariant("ORDER_AMT"),COleVariant("Order_Amt"),COleVariant((long)miAggregationSum),COleVariant((long)miTypeNumeric));
FieldsVt.vt = VT_DISPATCH;
FieldsVt.pdispVal = Fields;
FieldsVt.pdispVal->AddRef();
// The Company Field is the used as the unique GeoField
m_Map.GetDatasets().Add(miDataSetODBC,QueryInfoVt,COleVariant("Customers Data"),COleVariant("Company"),COptionalVariant(),BindLayerVt,FieldsVt,COptionalVariant());
} catch (COleDispatchException *e) {
e->ReportError();
e->Delete();
} catch (COleException *e) {
e->ReportError();
e->Delete();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -