Example #1
0
			bool LoadDataSets(
				const BBox& osmBBox,
				const int width,
				const int height,
				QueryIntermediateData& qid)
			{
				const double DesiredDataDensity = (256 / 1) / VectorTiles::MapWidth; // unit: (pixel / tile) / meter
				const double densityX = width / (osmBBox.maxX - osmBBox.minX);
				const double densityY = height / (osmBBox.maxY - osmBBox.minY);
				const double maxDensity = Max(densityX, densityY);

				const double numTilesDesired = maxDensity / DesiredDataDensity;
				const int zoomLevel = Min(MaxOSMZoomLevel, (int)ceil(log2(numTilesDesired)));
				const int numTiles = 1 << zoomLevel;

				// TODO: Take distance DistanceDomain into account ensure all geometries 
				// outside of requested area but within DistanceDomain are loaded as well
				const int left = Max(0, (int)floor(numTiles * ((osmBBox.minX - VectorTiles::MapLeft) / VectorTiles::MapWidth)));
				const int right = Min(numTiles, 1 + (int)ceil(numTiles * ((osmBBox.maxX - VectorTiles::MapLeft) / VectorTiles::MapWidth)));
				const int bottom = Max(0, (int)floor(numTiles * ((osmBBox.minY - VectorTiles::MapBottom) / VectorTiles::MapHeight)));
				const int top = Min(numTiles, 1 + (int)ceil(numTiles * ((osmBBox.maxY - VectorTiles::MapBottom) / VectorTiles::MapHeight)));

				for (int y = bottom; y < top; y++)
				{
					for (int x = left; x < right; x++)
					{
						if (!LoadDataSet(zoomLevel, x, y, qid))
						{
							return false;
						}
					}
				}

				return true;
			}
int
main(int argc,char *argv[])
{

    double val;
    double ts;
    void *data_set;
    int size;
    int c;
    int curr;
    int ierr;
    char fname[255];

    if(argc < 2)
    {
        fprintf(stderr,"usage: testinput -f filename\n");
        fflush(stderr);
        exit(1);
    }

    fname[0] = 0;
    memset(fname,0,sizeof(fname));

    while((c = getopt(argc,argv,PRED_ARGS)) != EOF)
    {
        switch(c)
        {
        case 'f':
            strncpy(fname,optarg,sizeof(fname));
            break;
        default:
            fprintf(stderr,"unrecognized argument %c\n",
                    c);
            fflush(stderr);
            break;
        }
    }

    if(fname[0] == 0)
    {
        fprintf(stderr,"usage: testinput -f fname\n");
        fflush(stderr);
        exit(1);
    }

    ierr = InitDataSet(&data_set,2);

    if(ierr == 0)
    {
        fprintf(stderr,"testinput error: InitDataSet failed\n");
        exit(1);
    }

    SetBlockSize(data_set,14);

    ierr = LoadDataSet(fname,data_set);
    if(ierr == 0)
    {
        fprintf(stderr,
                "testinput error: LoadDataSet failed for %s\n",
                fname);
        exit(1);
    }

    while(ReadEntry(data_set,&ts,&val))
    {
        fprintf(stdout,"%d %f\n",(int)ts,val);
        fflush(stdout);
    }

    FreeDataSet(data_set);

    exit(0);
}
Example #3
0
void THSRooFit::LoadWorkSpaceData(RooWorkspace* ws){
  LoadWorkSpace(ws);
  LoadDataSet(ws->allData().front());//assumes only 1 data set!!
}
Example #4
0
FeaturesTable::FeaturesTable(std::string f) {
	Folder = f;
	LoadDataSet();
	removed = false;
}