Немного изменим наш проект, чтобы получить центр полигона.
theView = av.FindDoc("View1") if (theView<>nil) then theTheme = theView.FindTheme("base.shp") if (theTheme<>nil) then theFTab = theTheme.GetFTab shapeField = theFTab.FindField( "Shape" ) for each recNum in theFTab currentShape = theFTab.ReturnValue( shapeField, recNum ) pt=currentShape.ReturnCenter MsgBox.Info( pt.GetX.AsString + " " + pt.GetY.AsString, "") end else MsgBox.Info( "No Theme", "") end else MsgBox.Info( "No View", "") end
Смотрим результат.
Откуда я взял эти функции? Дело в том, что при получении объекта, объекта зависит от темы. Вот мы его получаем.
currentShape = theFTab.ReturnValue( shapeField, recNum )
Тема у нас площадная, поэтому мы получаем объект полигон. У объекта полигон есть метод.
aPolygon.ReturnCenter
Этот метод возвращает точку, из которой можно извлечь X и Y.
MsgBox.Info( pt.GetX.AsString + " " + pt.GetY.AsString, "")