mapgis6.7二次开发vc6_demo 之五(输出VCT函数之表属性段)

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  OutVctAttributeBeginEnd.cpp
/*
bool OutVctAttributeBeginEnd(short *ptALst);    //输出vct属性值
*/
//------------------------------------------------------------
//输出vct属性值 OK
bool OutVctAttributeBeginEnd(short *ptALst)
{
    bool rbc = false; 
	short ai;
    char* GeoVctType = "";
    char* FeatClassName = "";
    char* FeatureCode = "";
    char* FeatureName = "";

	long i,ln; 
	short LayerType;

    //this.ShowMsg(this, "正在输出属性值信息");
    //输出属性值
    f_WriteLine("AttributeBegin");
	for(int k=1;k<=ptALst[0];k++)
    {   //获取一个工作区
			ai=ptALst[k];
			//获取图层类型
			LayerType=_GetAreaType(ai);
			switch(LayerType)
			{
			case LIN:				    
				    _GetLinNum(ai,&i,&ln); //获取线层总个数
				    break;
				case REG:
					_GetRegNum(ai,&i,&ln); //获取面层总个数
					break;
				case PNT:
					_GetPntNum(ai,&i,&ln); //获取点层总个数
					break;
				default:
					break;
			}
			GeoVctType=GetGeoVctType(ai);
			//获取工作区文件名
			char* Lfilename=_GetAreaFileName(ai);						
			//
			FeatClassName =getfilenameNoExt_lc(Lfilename,"\\");

			FeatureCode =FeatClassName;//a3u(GeoVctType,"_",i2cp(1));
			FeatureName =FeatClassName;//FeatureCode;                

			f_WriteLine(FeatClassName);
			if (ln > 0)
			{   //有要素个数>0
				char* AttrLine =NULL;
				char* fdval = NULL;
				long lineNum = 0; 
				CATT_STRU *stru=NULL;
				char *att=NULL;
				short numbfield=0;
				short ret_gt;
				//
				for(i=1;i<ln;i++)  //线要素总个数
				{
					lineNum += 1;
					AttrLine = l2cp(lineNum);
					//获取属性值
					ret_gt=_GetAtt(ai,LayerType,i,&stru,&att);
					short numbfield=stru->hd.numbfield;  //字段个数
					CFIELD_HEAD *pfd=stru[0].fldEntry;
					//
					for(short k=0;k<numbfield;k++)
					{
						//获取属性值的方法
						fdval=new char[pfd[k].msk_leng];
						memset(fdval,0,pfd[k].msk_leng);
						//_CvtFldToString(stru,att,k,fdval,pfd[k].msk_leng,NULL,NULL);
						_CvtFldToString1(stru,att,pfd[k].fieldname,fdval,pfd[k].msk_leng,NULL,NULL);
						//				
						char* t_val=trim_lc(fdval);  //去掉空格				
						if (strlen(AttrLine) <= 0)
						{
							AttrLine = t_val;
						}
						else
						{
							AttrLine =a3u(AttrLine,"," , t_val);
						}
					}            
					f_WriteLine(AttrLine);
					if (lineNum % 100 == 0)
					{
						f_FlushFile();
					}                
				}            
			}
	}
    f_WriteLine("TableEnd");
    f_WriteLine("");    
    f_WriteLine("AttributeEnd");    
    //this.ShowMsg(this, "完成输出属性值信息");
	f_FlushFile();
    rbc = true;
    return rbc;
}
//

--the--end---

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值