📄 testgeodatabaseview.cpp
字号:
// TestGeoDatabaseView.cpp : implementation of the CTestGeoDatabaseView class
//
#include "stdafx.h"
#include "TestGeoDatabase.h"
#include "TestGeoDatabaseDoc.h"
#include "TestGeoDatabaseView.h"
#include "GeoPolyGonFeature.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTestGeoDatabaseView
IMPLEMENT_DYNCREATE(CTestGeoDatabaseView, CView)
BEGIN_MESSAGE_MAP(CTestGeoDatabaseView, CView)
//{{AFX_MSG_MAP(CTestGeoDatabaseView)
ON_COMMAND(test, Ontest)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTestGeoDatabaseView construction/destruction
CTestGeoDatabaseView::CTestGeoDatabaseView()
{
// TODO: add construction code here
}
CTestGeoDatabaseView::~CTestGeoDatabaseView()
{
}
BOOL CTestGeoDatabaseView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CTestGeoDatabaseView drawing
void CTestGeoDatabaseView::OnDraw(CDC* pDC)
{
CTestGeoDatabaseDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CTestGeoDatabaseView printing
BOOL CTestGeoDatabaseView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CTestGeoDatabaseView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CTestGeoDatabaseView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CTestGeoDatabaseView diagnostics
#ifdef _DEBUG
void CTestGeoDatabaseView::AssertValid() const
{
CView::AssertValid();
}
void CTestGeoDatabaseView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CTestGeoDatabaseDoc* CTestGeoDatabaseView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTestGeoDatabaseDoc)));
return (CTestGeoDatabaseDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CTestGeoDatabaseView message handlers
void CTestGeoDatabaseView::Ontest()
{
// TODO: Add your command handler code here
// TODO: Add your command handler code here
CGeoPolyGonFeature aa;
m_geo.CreateAccessWorkspace("test");
IFeatureDatasetPtr ipFDataset;
m_fea.CreateDataset(&m_geo,"test",ipFDataset);
IFeatureClassPtr ipFClass;
m_fea.CreateGeoFeatureClass("polygon",esriFTSimple, ipFClass);
IPointPtr pt(CLSID_Point);
pt->PutCoords(0,0);
aa.AddPoint(pt);
pt->PutCoords(0,120);
aa.AddPoint(pt);
pt->PutCoords(120,120);
aa.AddPoint(pt);
pt->PutCoords(120,0);
aa.AddPoint(pt);
aa.CreatePolygonWithPointCollection(ipFClass);
aa.createMultipartPolygonRingPointCollection(ipFClass);
// m_geo.m_ipWorkspace->Release();
AfxMessageBox("创建结束");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -