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 OutVctPointBeginEnd.cpp /* bool OutVctPointBeginEnd(short *ptALst); //输出vct点坐标 */ //------------------------------------------------------------ //实现 输出VCT点几何图形功能 OK bool OutVctPointBeginEnd(short *ptALst) { bool rbc = false; short ai; char* GeoVctType; char* FeatClassName; char* FeatureCode; char* FeatureName; //输出点坐标 long i,ln; D_DOT lxy; short len; double x,y; char* tmp; char* Lfilename; short LayerType; //ShowMsg(this, "正在输出点坐标信息"); //输出点坐标 f_WriteLine("PointBegin"); for(int k=1;k<=ptALst[0];k++) { //获取一个工作区 ai=ptALst[k]; //获取图层类型 LayerType=_GetAreaType(ptALst[k]); if(LayerType==PNT) { //输出vct点要素几何图形 //获取点层图元总个数 _GetPntNum(ai,&i,&ln); //获取工作区文件名 Lfilename=_GetAreaFileName(ai); //获取图层类型 GeoVctType=GetGeoVctType(ai); // FeatClassName =getfilenameNoExt_lc(Lfilename,"\\");; FeatureCode =FeatClassName;//a3u(GeoVctType,"_",i2cp(1)); FeatureName =FeatClassName;//FeatureCode; if (GeoVctType == "Point") { PNT_INFO inf; char *dat; //输出点对象 long lineNum = 0; for(i=1;i<ln;i++) //线要素总个数 { //short WINAPI _GetPnt(short ai,long pi,D_DOT *xyz,char **dat,short *len,PNT_INFO *inf,short dim=2); if(_GetPnt(ai,i,&lxy,&dat,&len,&inf,NULL)<=0) { continue; } lineNum += 1; f_WriteLine(l2cp(lineNum)); //第一行序号(目标标识码) f_WriteLine(FeatureCode); //第二行要素代码 f_WriteLine(FeatureName); //第三行要素名称 f_WriteLine("1"); //第四行几何要素段类型(1=独立点,2=结点,3=有向点) if (&lxy) { //获取地理坐标 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); // f_WriteLine(tmp); //第五行点坐标 } else { //当几何对象为空时 f_WriteLine(""); } if (lineNum % 100 == 0) { f_FlushFile(); } } } } } f_WriteLine("PointEnd"); f_WriteLine(""); //ShowMsg(this, "完成输出点坐标信息"); f_FlushFile(); rbc = true; return rbc; } //--the--end---