缓冲区分析(3)

缓冲区分析(3)
  下面是AO中缓冲区分析的代码,熟悉AO编程的对下面代码应该很了解了:

ESRI.ArcGIS.Geometry.ITopologicalOperator topop = (ESRI.ArcGIS.Geometry.ITopologicalOperator)ipnt;
double bufferDistance = map.Extent.Width / 6;
ESRI.ArcGIS.Geometry.IPolygon bufferPolygon;
bufferPolygon = (ESRI.ArcGIS.Geometry.IPolygon)topop.Buffer(bufferDistance);

    bufferPolygon就是缓冲区分析的结果,但它还不是我们最后想要的,因为ESRI.ArcGIS.Geometry.IPolygon无法在adf web control中显示,还需要做一次转换:

// 定义valueobject的点
ESRI.ArcGIS.ADF.ArcGISServer.PolygonN buffer_polyn;
// 进行comobjectvalueobject之间的转换
buffer_polyn = (ESRI.ArcGIS.ADF.ArcGISServer.PolygonN)ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.ComObjectToValueObject(bufferPolygon, serverContext, typeof(ESRI.ArcGIS.ADF.ArcGISServer.PolygonN));

    buffer_polyn就是我们最后想要的结果,定义一种渲染方式:

ESRI.ArcGIS.ADF.ArcGISServer.RgbColor rgb1 = new ESRI.ArcGIS.ADF.ArcGISServer.RgbColor();
rgb1.Red = 200;
rgb1.Green = 200;
rgb1.Blue = 20;
// 设置区的填充色
ESRI.ArcGIS.ADF.ArcGISServer.SimpleFillSymbol sfs1 = new ESRI.ArcGIS.ADF.ArcGISServer.SimpleFillSymbol();
sfs1.Style = ESRI.ArcGIS.ADF.ArcGISServer.esriSimpleFillStyle.esriSFSHorizontal;
sfs1.Color = rgb1;
ESRI.ArcGIS.ADF.ArcGISServer.PolygonElement polyelement1 = 
new ESRI.ArcGIS.ADF.ArcGISServer.PolygonElement();
polyelement1.Symbol = sfs1;
polyelement1.Polygon = buffer_polyn;

 
缓冲区的代码 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "stream.h" int quit; #define DELAY_MAX 5000 //最大延时5000毫秒 #define IN_NUM (2) #define MAIN_STREAM (0) #define SLAVE_STREAM (1) void Init_Interface(int Msg_id) { int qid; if(ApproDrvInit(Msg_id)) exit(1); if (func_get_mem(&qid)) { ApproDrvExit(); exit(1); } } void Clean_Interface(void) { ApproInterfaceExit(); } static int alarm_rec_enable; static unsigned int deltime; static unsigned int GetTimeStamp(void) { struct timeval timeval; gettimeofday(&timeval, NULL); return (timeval.tv_sec * 1000) + (timeval.tv_usec + 500) / 1000;; } void *get_frame(void *arg) { FILE *filefd=NULL; char filename[80]; int ch=0; stream_rpos_t rpos; frame_head_t frame_head; int first_frame_type=0; int first_frame=0; char *frame_pos; char *data; unsigned int cur_time; printf("get ch %d stream\n", ch); memset(&rpos, 0, sizeof(rpos)); st_stream_getStartPos(ch, MAIN_STREAM, &rpos); st_stream_getOneFrame(ch, MAIN_STREAM, 10, &rpos); while(!quit) { if(alarm_rec_enable) { if(st_stream_getOneFrame(ch, MAIN_STREAM, 200, &rpos) <= 0) { usleep(10*1000); continue; } frame_pos = &rpos.p_buf_data[rpos.data_start_pos]; memcpy(&frame_head,&rpos.p_buf_data[rpos.data_start_pos],sizeof(frame_head)); data=frame_pos+sizeof(frame_head_t
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值