您的位置:首页 > 其它

mapgis6.7二次开发vc6_demo 之五(输出VCT函数 总入口)

2012-04-20 16:25 162 查看
mapgis6.7二次开发vc6_demo
之五(输出VCT函数 总入口)

//////////////////////////////////////////////
//
//VCT 导出功能 version=1, topo=0
//vp:hsg
//create date:2012-04-20
//
//////////////////////////////////////////////
#include "stdafx.h"
#include "resource.h"
#include <math.h>
#include "win_area.h"
#include "win_oper.h"
#include "map_out.h"
//
#include "demo.h"
//-------------------------------------------------------
extern char* AppTitle;                    //应用程序名称
extern AREA_HINST    AHInst;
extern HWND         MainWnd;              //主窗口句柄
extern HWND         GrpWnd;               //图形窗口句柄
//-------------------------------------------------------
//------------------------------------------------------------
//define function style  Vct_Export.cpp
/*
void Vct_Export();   //输出VCT函数  总入口
*/
//------------------------------------------------------------
//输出VCT函数  总入口
void Vct_Export()
{
_StartClockCursor();
_GoingClockCursor();
_StartWait();
//
WriteToLog_f_delete();
//TestGetDiskSpace();
//取打开的工作区数
short n=_GetAreaNumber(AHInst);
char* n_str=l2cp(n);
ShowMsg(n_str);
//获取当前可执行文件目录
char* curdir=GetCurDir();
ShowMsg(curdir);

//WriteToLog(curdir);
//获取显示工作区表集合
short *ptALst=NULL;
if((ptALst=_GetDispAreaListAddr(GrpWnd))!=NULL)
{
if(ptALst==NULL)  return;
ShowMsg("工作区表不为空");

//short ai,LayerType;
//char* Lfilename;

char* total_str=i2cp(ptALst[0]);
char* tt_str=a2u("工作区表总个数:",total_str);
ShowMsg(tt_str);
//vct输出
char* t_fn="dgx.vct";//getfilename_lc(Lfilename,"\\");
WriteToLog(t_fn);
char* tmp_line_path=a2u("c:\\",t_fn);
WriteToLog(tmp_line_path);
//
f_SetFilePath(tmp_line_path);
f_OpenFile_w();
OutVctHeadBeginEnd();                 //1输出VCT文件头段
OutVctFeatureCodeBeginEnd(ptALst);    //2输出VCT要素代码段
OutVctTableStructureBeginEnd(ptALst); //3输出VCT表结构段
//ptALst[0]表示总个数
//1输出点要素几何图形
OutVctPointBeginEnd(ptALst);

//2输出线要素几何图形 OK
OutVctLineBeginEnd(ptALst);

//3输出面要素几何图形
OutVctPloygonBeginEnd(ptALst);

//4输出注记要素几何图形
OutVctAnnotationBeginEnd(ptALst);

//5输出属性表数据
OutVctAttributeBeginEnd(ptALst);
//
f_FlushFile();
f_CloseFile();
}
_EndWait();
_EndClockCursor();
ShowMsg("生成完毕!");
}

/*
//获取工作区文件名
Lfilename=_GetAreaFileName(ai);
//-------------------------------
//获原文件路径的文件名
char* t_dir=getdir_lc(Lfilename,"\\");
char* t_f_ext=getfilenameWithEx_lc(Lfilename,"\\");
char* t_fname=getfilenameNoExt_lc(Lfilename,"\\");
ShowMsg(t_dir);ShowMsg(t_f_ext);ShowMsg(t_fname);
//-------------------------------
*/

//获取线层总个数
/*
_GetLinNum(ai,&i,&ln);
f_WriteLine(UnionStr("线总个数:",i2cp(ln)));
for(i=1;i<ln;i++)
{
if(_GetLin(ai,i,&lxy,&len,NULL)<=0)
{
continue;
}
WriteToLog(i2cp(i));          //线序号
f_WriteLine(i2cp(i));
for(j=0;j<len;j++,lxy++)      //线节点
{
//获取窗口坐标
//x=(int)((lxy->x-wxy->x0)*wxy->r);
//y=(int)((lxy->y-wxy->y0)*wxy->r);
//获取地理坐标
x=lxy->x;
y=lxy->y;
//写入到文本中
char* x_s=d2cp(x);
char* y_s=d2cp(y);
tmp=a2u(x_s,",");
tmp=a2u(tmp,y_s);
WriteToLog(tmp);
f_WriteLine(tmp);
}
}*/

//删除线图层的所有要素
//_GetLin(lai,&logN,&n);
//for(i=1;i<n;i++) /*编者注:图元实体号应从1开始*/
//  _DelLin(lai,i);     /*应该是for(i=1;i<=n;i++)*/

//走钟光标
//void WINAPI _StartClockCursor(void);
//void WINAPI _GoingClockCursor(void);
//void WINAPI _EndClockCursor(void);
//void WINAPI _StartWait(void); //开始显示等待光标
//void WINAPI _EndWait(void);   //结束显示等待光标
---the---end---

---vp:hsg

---create date:2012-04-20
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: