연구의 선진화와 생산성 향상에
필요한 최적의 소프트웨어와 컨설팅을
공급하도록 노력하겠습니다.
 

cGPSmapper DLL library

 

If you are developer and you want to include into your own program possibility of creating IMG maps, if you want to have *fast* and non memory consuming access to IMG files - you are at the right place.

First library - creating IMG files - free version available (distribution is allowed) with just a single banner window (with possibility of registration for 5 EUR only)

DLL developer package setup

 

int main(int argc, char* argv[])
{

//For the FREE version of DLL this is not required:
if( cg_setSecurityValue("aaa","123446-123450-12345A-12345J-12345A1-1234G-1234F8-123440-123444-134211") != 1 )
cout<<"Error!"<<endl;

//check what version of the library we have
cout<<cg_getSecurityVersion()<<endl;
unsigned char level[10];

level[0] = 22;
level[1] = 20;
level[2] = 19;
level[3] = 18;
level[4] = 17;

cg_coordinate coords[20];

cout<<"Check version of cGPSmapper :"<<cg_getVersion();

//create IMG from mp file
cg_init("a.img",2345,"test map",4,level);

cg_readMP("marine_types_new.mp");
if( cg_buildMap() != _CG_OK )
cout<<cg_getError()<<endl;
cg_done();

//create second IMG file
cg_init("test.img",2345,"test map",4,level);
cg_setOptional3(3,"M",1,24);

coords[0].ns = 54.40919;coords[0].we = 18.63023;
coords[1].ns = 54.40946;coords[1].we = 18.63126;
coords[2].ns = 54.40998;coords[2].we = 18.63195;
coords[3].ns = 54.41029;coords[3].we = 18.63202;
coords[4].ns = 54.41165;coords[4].we = 18.63243;
cg_addPolyline(4,0,0,3,"road",coords,5);

coords[0].ns = 54.410;coords[0].we = 18.63185;
cg_addPoint(2,0,0,1,"point",coords[0]);

if( cg_buildMap() != _CG_OK )
cout<<cg_getError()<<endl;
cg_done();

return 0;
}

 

MapRead DLL library

 

If you want to access several IMG files at the same time - e.g. for fast render on the screen - then you should take a look into mapRead library

Very fast, with very limited memory consumption.

DLL mapRead developer package setup

 

#include <iostream>
#include "mapReadDLL.h"

using namespace std;

long current_map;
long open_maps;
long maps[2];

int CALL_API readHeader(int map_index,int map_sub_index,const char* map_id,const char* map_name,const char*
copyright1,const char* copyright2,int levels,float &x0,float &x1,float &y0,float &y1,int locked,unsigned char level_def[10])
{//cout<<"submap index: "<<map_sub_index<<" "<<endl;
maps[open_maps] = map_index;
open_maps++;

cout<<"[IMG ID]"<<endl;
cout<<"Name="<<map_name<<endl;
cout<<"Copyright="<<copyright1<<endl;
cout<<"Levels="<<levels<<endl;
for( int i = 0; i < levels; ++i ) {
cout<<"Level"<<i<<"="<<(int)level_def[i]<<endl;
}
cout<<"[END]"<<endl<<endl;

return 1;
}

int CALL_API readDataI(int layer,int object_type,int type,int sub_type, unsigned int poi_address,
unsigned int net_address,const char* label,mapRead_coord_integer* coords,int coord_size,unsigned int l1) {
return 1;
}

int CALL_API readData(int layer,int object_type,int type,int sub_type, unsigned int poi_address, unsigned int net_address,const char* label,mapRead_coord* coords,int coord_size,mapRead_segment* segments,int segment_size,unsigned int l1) {
std::cout.precision(10);

cout<<"[RGN"<<hex<<object_type<<dec<<"]"<<endl;
cout<<"Type="<<type<<endl;
cout<<"SubType="<<sub_type<<endl;
if( label != NULL )
cout<<"Label="<<label<<endl;
cout<<"Data"<<layer<<"=";
if( object_type > 0x20 ) {
for( int i =0; i < coord_size; ++i ) {
cout<<"("<<coords[i].ns<<","<<coords[i].we<<")";
if( i+1 < coord_size )
cout<<",";
}
} else
cout<<"("<<coords[0].ns<<","<<coords[0].we<<")";
cout<<endl;
if( poi_address ) {
mapRead_readPOI(current_map,type,sub_type,poi_address);
}

if( net_address ) {
mapRead_readNET(current_map,net_address,segments,segment_size);
}

cout<<"[END]"<<endl<<endl;
return 1;
}

int CALL_API netData(const char* name1,const char* name2,const char* name3,const char* name4,int &records,
mapRead_address address[60]) {
if( strlen(name2) ) cout<<"Label2="<<name2<<endl;
if( strlen(name3) ) cout<<"Label3="<<name3<<endl;
if( strlen(name4) ) cout<<"Label4="<<name4<<endl;

if( records ) {
for(int i=0; i<records; ++i){
cout<<"Numbers"<<(i+1)<<"="<<address[i].segment<<","<<(address[i].left_type==0?"N":(address[i].left_type==1?"E":
address[i].left_type==2?"O":"B"))<<",";
cout<<address[i].left_start<<","<<address[i].left_end<<",";

cout<<(address[i].right_type==0?"N":(address[i].right_type==1?"E":address[i].right_type==2?"O":"B"))<<",";
cout<<address[i].right_start<<","<<address[i].right_end<<",";

cout<<address[i].city_left<<","<<address[i].region_left<<","<<address[i].country_left<<",";
cout<<address[i].city_right<<","<<address[i].region_right<<","<<address[i].country_right;
cout<<endl;
}
}

return 1;
}

int CALL_API poiData(const char* house_number,const char* street_name,const char* city, const char* region,
const char* country,const char* zip,const char* phone) {
if( strlen(house_number) ) cout<<"HouseNumber="<<house_number<<endl;
if( strlen(street_name) ) cout<<"StreetDesc="<<street_name<<endl;
if( strlen(zip) ) cout<<"Zip="<<zip<<endl;
if( strlen(phone) ) cout<<"Phone="<<phone<<endl;

if( strlen(city) ) cout<<"City="<<city<<endl;
if( strlen(region) ) cout<<"Region="<<region<<endl;
if( strlen(country) ) cout<<"Country="<<country<<endl;

return 1;
}

int main(int argc, char* argv[])
{

//For the FREE version of DLL this is not required:
if( cg_setSecurityValue("aaa","123446-123450-12345A-12345J-12345A1-1234G-1234F8-123440-123444-134211") != 1 )
cout<<"Error!"<<endl;

//we start by opening 2 maps
open_maps = 0;
int sub_maps;
if( mapRead_openIMG("48900058.img",sub_maps,readHeader,readData,NULL,poiData,netData)
!= _MR_OK ) { cout<<"Error"<<endl;
return 1;
}
if( mapRead_openIMG("08000001.img",sub_maps,readHeader,readData,NULL,poiData,netData)
!= _MR_OK ) { cout<<"Error"<<endl;
return 1;
}

//mapread is optimized for reading area of our interest - but in this case we want just to read a whole map
float x0 = -180.0;
float x1 = +180.0;
float y0 = -90.0;
float y1 = +90.0;
float min1=0;
float min2=0;

current_map = maps[0];
//lets read level 1 of the map
mapRead_readMap(current_map,0,x0,y0,x1,y1,min1,min2,1);

current_map = maps[1];
//and level 0 (most detailed)
mapRead_readMap(current_map,0,x0,y0,x1,y1,min1,min2,0);

mapRead_closeAll();

return 0;
}