28 main(
int argc,
char **argv )
40 string map_file( argv[1] );
41 int intervals = atoi( argv[2] );
43 vector<int> histogram;
44 vector<double> min_val;
45 vector<double> max_val;
46 map<double,int> values;
48 if ( intervals > 0 ) {
50 double interval = 1.0/intervals;
52 for (
int i = 0; i < intervals; ++i ) {
54 histogram.push_back( 0 );
55 min_val.push_back( i*interval );
56 max_val.push_back( min_val[i] + interval );
59 max_val[intervals-1] = max_val[intervals-1] + 0.1;
66 Coord xmin, ymin, xmax, ymax, xstep, ystep;
67 map->getRegion( &xmin, &ymin, &xmax, &ymax );
72 for (
Coord y = ymin; y < ymax; y += ystep ) {
74 for (
Coord x = xmin; x < xmax; x += xstep ) {
76 if ( map->
get( x, y, val ) ) {
78 if ( intervals > 0 ) {
80 for (
int i = 0; i < intervals; ++i ) {
82 if ( val[0] >= min_val[i] && val[0] < max_val[i] ) {
91 if ( values.find( val[0] ) != values.end() ) {
106 if ( intervals > 0 ) {
108 for (
int i = 0; i < intervals; ++i ) {
115 for ( std::map<double, int>::const_iterator it = values.begin(); it != values.end(); it++ ) {
123 catch ( std::exception& e ) {
void setPrefix(const char *pref)
int get(Coord x, Coord y, Scalar *val) const
double Scalar
Type of map values.
static Log * instance()
Returns the instance pointer, creating the object on the first call.
void setLevel(Level level)
int getCell(Coord *xcel, Coord *ycel) const
int main(int argc, char **argv)
static RasterFactory & instance()
void info(const char *format,...)
'Info' level.
double Coord
Type of map coordinates.