Приветствую!
ГИС Конструктор для Qt Designer x64 (версия 12.3.0), ОС Astra Linux
Столкнулся с проблемой: сохранение объектов после вставки точки метрики работает через раз.
Тест:
Результат:
С уважением,
Матвеев П.В.
ГИС Конструктор для Qt Designer x64 (версия 12.3.0), ОС Astra Linux
Столкнулся с проблемой: сохранение объектов после вставки точки метрики работает через раз.
Тест:
Код |
---|
#include <QString> #include <QDebug> #include "mapapi.h" #include "sitapi.h" #include "rscapi.h" #include "mapcreat.h" #include "maptype.h" void appentPointPicture(HMAP hmap, HOBJ hobj, int x, int y) { double xp = x; double yp = y; mapPictureToPlane(hmap, &xp, &yp); mapAppendPointPlane(hobj, xp, xp, 0); } void insertPointPicture(HMAP hmap, HOBJ hobj, int x, int y, int index) { double xp = x; double yp = y; mapPictureToPlane(hmap, &xp, &yp); mapInsertPointPlane(hobj, xp, xp, index, 0); } void checkPointCount(HMAP hmap, HSITE hsite, long int number) { HOBJ hobj = mapCreateSiteObject(hmap,hsite); mapReadObjectByNumber(hmap,hsite,hobj,1,number); qDebug() << "points count: " << mapPointCount(hobj, 0); mapFreeObject(hobj); } // тест изменения метрики int main(int argc, char ** argv) { QString* siteName = new QString("/home/user/temp/testMetrics.sitx"); QString* rscName = new QString("/home/user/temp/operator.rsc"); CREATESITEUN cs; memset((void*) &cs, 0, sizeof(cs)); cs.Length = sizeof(CREATESITEUN); cs.EllipsoideKind = 9; cs.MapType = 16; HMAP hmap = mapCreateSiteUn((const WCHAR*) siteName->constData(), (const WCHAR*) rscName->constData(), &cs); if (hmap != 0) { HSITE hsite = hmap; HOBJ hobj = mapCreateSiteObject(hmap, hsite); if (hobj != 0) { mapSetRealShowScale(hmap, 10000.); //создадим объект if (mapRegisterObjectByKey(hobj, "11102500032503") != 0) { appentPointPicture(hmap, hobj, 10, 10); appentPointPicture(hmap, hobj, 100, 100); mapCommitObject(hobj); qDebug() << "points count after create: " << mapPointCount(hobj, 0); long int objNumber = mapObjectNumber(hobj); qDebug() << "real:"; checkPointCount(hmap,hsite,objNumber); //вставим точку после первой insertPointPicture(hmap, hobj, 20, 50, 1); mapCommitObject(hobj); qDebug() << "points count after first insert: " << mapPointCount(hobj, 0); qDebug() << "real:"; checkPointCount(hmap,hsite,objNumber); insertPointPicture(hmap, hobj, 20, 50, 1); mapCommitObject(hobj); qDebug() << "points count after second insert: " << mapPointCount(hobj, 0); qDebug() << "real:"; checkPointCount(hmap,hsite,objNumber); } else { qDebug() << "mapRegisterObjectByKey error"; } //освобождаем объект mapFreeObject(hobj); } else { qDebug() << "mapCreateObject error"; } mapCloseMap(hmap); } } |
Код |
---|
points count after create: 2 real: points count: 2 points count after first insert: 3 real: points count: 2 points count after second insert: 4 real: points count: 4 |
Матвеев П.В.