Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ vignette #7

Open
cpanse opened this issue Mar 20, 2018 · 1 comment
Open

C++ vignette #7

cpanse opened this issue Mar 20, 2018 · 1 comment

Comments

@cpanse
Copy link
Owner

cpanse commented Mar 20, 2018

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
Copy link
Owner Author

cpanse commented Sep 2, 2019

rectangular_statistical_cartogram_construction_animation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant