您的位置:首页 > 其它

mapgis6.7二次开发vc6_demo 之五(输出VCT函数之线图层)

2012-04-20 17:02 274 查看
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  OutVctLineBeginEnd.cpp
/*
bool OutVctLineBeginEnd(short *ptALst);    //输出vct线坐标
*/
//------------------------------------------------------------
//输出vct线坐标 OK
bool OutVctLineBeginEnd(short *ptALst)
{
bool rbc = false;
short ai;
char* GeoVctType;
char* FeatClassName;
char* FeatureCode;
char* FeatureName;

//this.ShowMsg(this, "正在输出线坐标信息");
//输出线坐标
long i,j,ln;
D_DOT *lxy;

long  len;
double   x,y;
char* tmp;
char* Lfilename;
short LayerType;

f_WriteLine("LineBegin");
for(int k=1;k<=ptALst[0];k++)
{   //获取一个工作区
ai=ptALst[k];
//获取图层类型
LayerType=_GetAreaType(ptALst[k]);
if(LayerType==LIN)
{  //输出vct线要素几何图形
//获取线层总个数
_GetLinNum(ai,&i,&ln);
//获取工作区文件名
Lfilename=_GetAreaFileName(ai);
//获取图层类型
GeoVctType=GetGeoVctType(ai);
//
FeatClassName =getfilenameNoExt_lc(Lfilename,"\\");;

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

if (GeoVctType == "Line")
{
long lineNum = 0;
LIN_INFO inf;
for(i=1;i<ln;i++)  //线要素总个数
{
//short WINAPI _GetLin(short ai,long li,D_DOT **dat,long *len,LIN_INFO *inf,short *dim=NULL);
if(_GetLin(ai,i,&lxy,&len,&inf,NULL)<=0)
{
continue;
}
lineNum += 1;
f_WriteLine(l2cp(lineNum));      //第一行序号(目标标识码)
f_WriteLine(FeatureCode);        //第二行要素代码
f_WriteLine(FeatureName);        //第三行要素名称
f_WriteLine("1");                //第四行几何要素段类型(1=折线,2=圆弧,3=圆,4=椭圆,5=光滑曲线,6=B样条曲线,100=间接坐标)

if(len>0)
{
f_WriteLine(l2cp(len));       //第五行点数
for(j=0;j<len;j++)      //线节点j++,lxy++
{
//获取地理坐标
x=lxy[j].x;
y=lxy[j].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("0");      //第五行点数
}
if (lineNum % 100 == 0)
{
f_FlushFile();
}
} //end for
}//end if
}//end LIN
} //end for
f_WriteLine("LineEnd");
f_WriteLine("");
f_FlushFile();
//this.ShowMsg(this, "完成输出线坐标信息");
rbc = true;
return rbc;
}
//
--the--end---
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: