recmap icon indicating copy to clipboard operation
recmap copied to clipboard

C++ vignette

Open cpanse opened this issue 7 years ago • 1 comments
trafficstars

document how to use recmap as cmd executable.

#include <fstream>
#include <iostream>

#define PI 3.14159265358979323846
#include <recmap.h>

// eg++ -o recmapCmd recmap_main.cpp -std=c++11 -I ~/__checkouts/R/recmap/src/ -lm -pedantic -Wall -O2
// g++ -o recmapCmd recmap_main.cpp  -std=c++11 -I ~/__checkouts/R/recmap/src/ -lm -pedantic -Wall -O2
using namespace std;

int main()
{
    double x, y, dx, dy, z;
    string name;

    int count = 0;

    crecmap::RecMap X;

    while (!cin.eof()) {
    cout << "# " << X.get_size() << endl;
	cin >> x >> y >> dx >> dy >> z >> name;
	X.push_region(x, y, dx, dy, z, name);
	count++;
    }

    X.run(true);

    for (int i = 0; i < X.get_size(); i++) {
	crecmap::map_region r = X.get_map_region(i);
	cout << r.x << "\t" << r.y << "\t" << r.dx << "\t" << r.
	    dy << "\t" << r.name << "\t" << r.dfs_num << "\t" << r.
	    topology_error << "\t" << r.
	    relative_position_error << "\t" << r.
	    relative_position_neighborhood_error << endl;
    }
    cout << "# " << X.get_size() << endl;

    return 0;
}

cpanse avatar Mar 20 '18 22:03 cpanse

rectangular_statistical_cartogram_construction_animation

cpanse avatar Sep 02 '19 14:09 cpanse