int main (int argc, char **argv) { int cnt; if (argc < 4 || argc > 5) { Usage(); return 1; } std::string etable = argv[1]; std::string vtable = argv[2]; std::string rtable = argv[3]; std::string fnames = etable + ".osrm.names"; std::string fosrm = etable + ".osrm"; std::string frestrict = etable + ".osrm.restrictions"; const char *dbconn = "dbname=osrm_test user=postgres host=localhost"; if (argc == 5) dbconn = argv[4]; try { pqxx::connection conn( dbconn ); pqxx::work txn(conn); txn.exec( "set client_min_messages to warning" ); txn.commit(); std::cout << " Creating names table ...\n"; createNames( conn, etable ); std::cout << " Writing " << fnames << " file ... "; cnt = writeNames( conn, fnames, etable ); std::cout << cnt << " records\n"; std::ofstream out( fosrm.c_str(), std::ios::out | std::ios::binary ); writeHeader( out ); std::cout << " Writing vertices to " << fosrm << " file ... "; cnt = writeVertices( conn, out, vtable ); std::cout << cnt << " records\n"; std::cout << " Writing edges to " << fosrm << " file ... "; cnt = writeEdges( conn, out, etable ); std::cout << cnt << " records\n"; out.close(); std::cout << " Writing restrictions to " << frestrict << " file ... "; cnt = writeRestrictions( conn, frestrict, rtable ); std::cout << cnt << " records\n"; std::cout << " Done!\n"; } catch (const std::exception &e) { std::cerr << e.what() << std::endl; return 1; } }
ColorManager::ColorManager() { m_colorMaps.resize(TOTAL_COLORS); initColors(); createNames(); m_uneditableColors = 3; // Make sure these are in the same order as in PredefinedTypes // These indicate the number of ramps for each ramp type setNumColorRamps(SEQUENTIAL, 7); setNumColorRamps(DIVERGING, 6); setNumColorRamps(QUALITATIVE, 5); setNumColorRamps(LINK_REL2, 3); setNumColorRamps(LINK_CON2, 2); setNumColorRamps(LINK_REL5, 2); m_strat = ORDER; }
void DSO::load() { dsoHeader_t dsoHead; SkFile pf("resources/dso/dso.dat"); if (!pf.open(SkFile::ReadOnly)) { return; } pf.read((char *)&dsoHead.id, 4); pf.read((char *)&dsoHead.numDso, sizeof(qint32)); pf.read((char *)&dsoHead.textSegSize, sizeof(qint32)); pf.read((char *)&dsoHead.galClassSize, sizeof(qint32)); pf.read((char *)&dsoHead.catNamesSize, sizeof(qint32)); m_names = pf.read(dsoHead.textSegSize); m_classes = pf.read(dsoHead.galClassSize); m_catNnames = pf.read(dsoHead.catNamesSize); for (qint32 i = 0; i < dsoHead.numDso; i++) { dso_t dso; pf.read((char *)&dso.nameOffs, sizeof(qint32)); pf.read((char *)&dso.rd.ra, sizeof(double)); pf.read((char *)&dso.rd.dec, sizeof(double)); pf.read((char *)&dso.mag, sizeof(signed short)); pf.read((char *)&dso.pa, sizeof(unsigned short)); pf.read((char *)&dso.sx, sizeof(quint32)); pf.read((char *)&dso.sy, sizeof(quint32)); pf.read((char *)&dso.type, sizeof(unsigned char)); pf.read((char *)&dso.cataloque, sizeof(unsigned char)); pf.read((char *)&dso.shape, sizeof(unsigned short)); pf.read((char *)&dso.galType, sizeof(unsigned short)); SkMath::range(dso.rd.ra, R360); if (dso.sx > 0 && dso.sy == 0) { dso.sy = dso.sx; } m_dso.append(dso); } qDebug() << "dso" << dsoHead.numDso; pf.close(); /* if (!addCustomFile("data/custom.dst")) { qDebug() << m_lastCustomError; } */ // sort dso by size qSort(m_dso.begin(), m_dso.end(), dsoCompare); assignToSectors(); createSectors(); createNames(&m_names); loadCommonNames(); }