Вот тестовый код. Карта Грузии, может это как-то поможет. Еще повторюсь, я делал эксперимент в котором пробовал установить путь, а затем прочитать его и это были два разных пути. У
[CODE]#include <iostream>
#include <iomanip>
#ifdef WIN32
# include <windows.h>
#endif
#include "mapapi.h"
#include "sitapi.h"
#include "vecexapi.h"
#ifdef WIN32
# include "gislink.h"
#else
# include "gsslink.h"
#endif
#ifdef WIN32
# define DYNLIB_HANDLE HMODULE
# define DYNLIB_LOAD( a ) LoadLibraryEx( a, 0, LOAD_WITH_ALTERED_SEARCH_PATH )
# define DYNLIB_GETSYM( a, b ) GetProcAddress( a, b )
# define DYNLIB_UNLOAD( a ) !FreeLibrary( a )
#else
# define DYNLIB_HANDLE void*
# define DYNLIB_LOAD( a ) dlopen( a, RTLD_LAZY | RTLD_GLOBAL)
# define DYNLIB_GETSYM( a, b ) dlsym( a, b )
# define DYNLIB_UNLOAD( a ) dlclose( a )
#endif
#ifdef WIN32
# define GISACCESS_DYNLIB_NAME "gisacces.dll"
# define GISVECEX_DYNLIB_NAME "gisvecex.dll"
#else
# define GISACCESS_DYNLIB_NAME "./libqdmapacces.so"
# define GISVECEX_DYNLIB_NAME "./libqdmapvecex.so"
#endif
#ifndef _MSC_VER
#define DYNLIB_MAP_DECL(retType, name, decl) \
typedef retType (_MAPAPI *name ## Func) decl;
#else
#define DYNLIB_MAP_DECL(retType, name, decl, ... ) \
typedef retType (_MAPAPI *name ## Func) decl __VA_ARGS__;
#endif
#define DYNLIB_MAP_DEF(lib, name) \
name ## Func name ## Inst = (name ## Func) DYNLIB_GETSYM(lib, #name);
#define DYNLIB_MAP_CALL(name, decl) \
name ## Inst decl
namespace
{
DYNLIB_MAP_DECL(HMAP, mapOpenDataEx, (const char*, long int, long int*));
DYNLIB_MAP_DECL(void, mapCloseData, (HMAP hMap));
DYNLIB_MAP_DECL(long int, mapGetParametersForEPSG, (long int epsgCode, MAPREGISTEREX* map, DATUMPARAM* datum, ELLIPSOIDPARAM* ellparm));
DYNLIB_MAP_DECL(long int, mapSetDocProjection, (HMAP hMap, MAPREGISTEREX* map, DATUMPARAM* datum, ELLIPSOIDPARAM* ellparm));
DYNLIB_MAP_DECL(const char*, mapGetPathShell, ());
DYNLIB_MAP_DECL(void, mapSetPathShell, (const char*));
DYNLIB_HANDLE gisaccessInstance = DYNLIB_LOAD(GISACCESS_DYNLIB_NAME);
DYNLIB_MAP_DEF(gisaccessInstance, mapOpenDataEx);
DYNLIB_MAP_DEF(gisaccessInstance, mapCloseData);
DYNLIB_MAP_DEF(gisaccessInstance, mapGetParametersForEPSG);
DYNLIB_MAP_DEF(gisaccessInstance, mapSetDocProjection);
DYNLIB_MAP_DEF(gisaccessInstance, mapGetPathShell);
DYNLIB_MAP_DEF(gisaccessInstance, mapSetPathShell);
int setProjection(HMAP mapHandle, long int epsgCode);
}
int main(int argc, char* argv[])
{
#ifdef _WIN32
gisLink();
#else
gssLink();
#endif
mapMessageEnable(false);
std::cout << "panorama path shell: " << DYNLIB_MAP_CALL(mapGetPathShell, ()) << std::endl;
DYNLIB_MAP_CALL(mapSetPathShell, ("..."));
static const char* mapPath = "...";
long int error;
HMAP mapHandle = DYNLIB_MAP_CALL(mapOpenDataEx, (mapPath, 0, &error));
if (mapHandle == 0)
{
std::cerr << "mapOpenDataEx error: " << error << std::endl;
return 1;
}
if (setProjection(mapHandle, 28418) != 0)
{
return 2;
}
DYNLIB_MAP_CALL(mapCloseData, (mapHandle));
std::cout << "ok" << std::endl;
return 0;
}
namespace
{
int setProjection(HMAP mapHandle, long int epsgCode)
{
MAPREGISTEREX mapCard;
DATUMPARAM datum;
ELLIPSOIDPARAM ellipsoid;
::memset(&mapCard, 0, sizeof(mapCard));
mapCard.Length = sizeof(mapCard);
if (DYNLIB_MAP_CALL(mapGetParametersForEPSG, (epsgCode, &mapCard, &datum, &ellipsoid)) == 0)
{
std::cerr << "mapGetParametersForEPSG error" << std::endl;
return 1;
}
if (DYNLIB_MAP_CALL(mapSetDocProjection, (mapHandle, &mapCard, &datum, &ellipsoid)) == 0)
{
std::cerr << "mapSetDocProjection error" << std::endl;
return 1;
}
return 0;
}
}[/CODE]