1. xld转换为Region
生成与调用函数
gen_cross_contour_xld (CrossXld, Rows, UpdateCols, 6, 0)
get_xld_region (CrossXld, xldRegions)
函数实现 get_xld_region
* 计算XLD个数
count_obj (BaseXld, Number)
* 生成空的区域(结果)
gen_empty_region (xldRegions)* 循环生成区域
for Index := 1 to Number by 1* 选择单个xldselect_obj (BaseXld, ObjectSelected, Index)* 获取xld 坐标get_contour_xld (ObjectSelected, Rowxld, Colxld)* 生成区域gen_region_polygon(SubRegion, Rowxld, Colxld)* 添加到结果区域concat_obj (xldRegions, SubRegion, xldRegions)
endforunion1 (xldRegions, xldRegions)return ()
2. C++ 实现
头文件函数定义
void get_xld_region(HObject ho_BaseXld, HObject *ho_xldRegions);
void get_xld_region (HObject ho_BaseXld, HObject *ho_xldRegions)
{HObject ho_ObjectSelected, ho_SubRegion;HTuple hv_Number, hv_Index, hv_Rowxld, hv_Colxld;//计算XLD个数CountObj(ho_BaseXld, &hv_Number);//生成空的区域(结果)GenEmptyRegion(&(*ho_xldRegions));//循环生成区域HTuple end_val7 = hv_Number;HTuple step_val7 = 1;for (hv_Index=1; hv_Index.Continue(end_val7, step_val7); hv_Index += step_val7){//选择单个xldSelectObj(ho_BaseXld, &ho_ObjectSelected, hv_Index);//获取xld 坐标GetContourXld(ho_ObjectSelected, &hv_Rowxld, &hv_Colxld);//生成XLD区域GenRegionPolygon(&ho_SubRegion, hv_Rowxld, hv_Colxld);//添加到结果区域ConcatObj((*ho_xldRegions), ho_SubRegion, &(*ho_xldRegions));}Union1((*ho_xldRegions), &(*ho_xldRegions));return;
}
3.区域写入图片
区域写入图片