=========================================================== float geogr_length; int nPolygons,Segment,node_Num; CString strCommand;
mapinfo.Do(Dim i As Integer);
sprintf(str,Fetch First From %s,Table_name); mapinfo.Do(str);
num=493; for(int i=0;i{ sprintf(str,ObjectInfo(%s,20),Table_obj); node_Num = atoi (mapinfo.Eval(str));//OBJ_INFO_NPNTS sprintf(str,ObjectInfo(%s,21),Table_obj); Segment = atoi (mapinfo.Eval(str));//OBJ_INFO_NPOLYGONS
sprintf(str,ObjectNodeX(%s,1,1),Table_obj); x1[i] = (float)atof(mapinfo.Eval(str)); sprintf(str,ObjectNodeY(%s,1,1),Table_obj); y1[i] = (float)atof(mapinfo.Eval(str));
sprintf(str,ObjectNodeX(%s,1,ObjectInfo(%s, 20)),Table_obj,Table_obj); x2[i] = (float)atof(mapinfo.Eval(str));
sprintf(str,ObjectNodeY(%s,1,ObjectInfo(%s, 20)),Table_obj,Table_obj); y2[i] = (float)atof(mapinfo.Eval(str));
geogr_length = atof( mapinfo.Eval(ObjectLen(JPN1RAIL.obj, km) )); sprintf(str,Fetch Next From %s,Table_name); mapinfo.Do(str); } mapinfo.Do(Print Number of undeleted records: + i );
Fetch First From world Note world.obj
counter = ObjectInfo(CHINAHWY.obj, OBJ_INFO_NPNTS)表示一个多边形有多少个点(segment+section)。
ObjectNodeX(xxx.obj, 1, counter)
一个polyline Object有line segments 和line sections组成。属性有节点数,长度,节点坐标,segment数和section数。 用函数counter = ObjectInfo(JPN1RAIL.obj, OBJ_INFO_NPOLYGONS) ObjectNodeX(JPN1RAIL.obj, 1, 1) ' read x ObjectNodeY(JPN1RAIL.obj, 1, 1) ' read y ObjectLen(JPN1RAIL.obj, km) 等求出。
(责任编辑:admin) |