Здравствуйте, взял пример отслеживания координат из myfirst
Но координаты не совпадают с показываемыми в Панораме и с метрикой объекта: (мышь наведена на узел сети)
x и y из QDMapView в какой системе координат приходят, не влияет ли смещение окна компонента на вычисление координат, там у меня слев еще панель и сверху toolBar
| Код |
|---|
// x, y - в пикселях из QDMapView::SignalMouseMove(int x, int y, int modkeys)
void QGISWidget::updateCurrentCoordinates(int x, int y)
{
HMAP mapHandle = map->GetMapHandle();
int mapX, mapY;
map->GetMapLeftTop(&mapX, &mapY);
mapX += x;
mapY += y;
ppPicturePlane->SetPlaceIn(PP_PICTURE);
ppPicturePlane->SetPlaceOut(PP_PLANE);
ppPicturePlane->SetPoint(x, y);
ppPicturePlane->GetPoint(&pointInPlane.X, &pointInPlane.Y);
double height = mapGetPrecisionHeightTriangle(mapHandle, pointInPlane.x, pointInPlane.y);
HANDLE egmMatrixHandle = 0;
if (height > ERRORHEIGHT)
egmMatrixHandle = mapOpenEgmPro(0, 0);
mapSetCurrentPointFormat(mapHandle, CoordinatesType);
WCHAR coordinatesStringWide[128]; coordinatesStringWide[0] = 0;
mapPlaneToPointFormatStringPro(mapHandle, &pointInPlane.x, &pointInPlane.y, &height, egmMatrixHandle,
coordinatesStringWide, sizeof(coordinatesStringWide));
QString coordinatesQString = WcharToQString(coordinatesStringWide);
ui->text2->setText(coordinatesQString);
} |
x и y из QDMapView в какой системе координат приходят, не влияет ли смещение окна компонента на вычисление координат, там у меня слев еще панель и сверху toolBar