Beispiel #1
0
bool shp_polyline::read( FILE * f, int & bytesRead )	
{	
	shape::read( f, bytesRead );

	int type;
	fread(&type,sizeof(int),1,f);

	bytesRead += sizeof(int);
	if(type != API_SHP_POLYLINE)
	{	cout << "Shape type does not match in record."<<endl;
		return false;		
	}
	
	//input Bounding Box
	//Assign Class Variables topLeft && bottomRight
	double mybounds[4];
	fread(mybounds,sizeof(double),4,f);
	bytesRead += sizeof(double)*4;
	topLeft = api_point( mybounds[0], mybounds[3] );
	bottomRight = api_point( mybounds[2], mybounds[1] );

	//input Number of Parts and Number of Points
	int numParts = 0;
	int numPoints = 0;
	fread(&numParts,sizeof(int),1,f);
	bytesRead += sizeof(int);
	fread(&numPoints,sizeof(int),1,f);
	bytesRead += sizeof(int);
	
	//Allocate space for numparts
	int * p_parts = new int[numParts];
	fread(p_parts,sizeof(int),numParts,f);
	bytesRead += sizeof(int)*numParts;
	//Input parts
	for( int j = 0; j < numParts; j++ )
		parts.push_back( p_parts[j] );	
	
	//Input points
	double x,y;
	for(int i=0;i<numPoints;i++)
	{
		fread(&x,sizeof(double),1,f);
		bytesRead += sizeof(double);
		fread(&y,sizeof(double),1,f);
		bytesRead += sizeof(double);
		api_point p(x,y);
		insertPoint( p, i );
	}

	return true;
}
Beispiel #2
0
void HariMain(void)
{
    char *buf;
    int win;
    api_initmalloc();
    buf = api_malloc(150 * 100);
    win = api_openwin(buf, 150, 100, -1, "star1");
    api_boxfilwin(win,  6, 26, 143, 93, 0 /* 黒 */);
    api_point(win, 75, 59, 3 /* 黄 */);
    api_end();
}
Beispiel #3
0
void CHNMain(void)
{
	uchar *buf;
	uint winID;

	api_initmalloc();
	buf = api_malloc(150 * 100);
	winID = api_openwin(buf, 150, 100, -1, "star1");
	api_boxfilwin(winID, 6, 26, 143, 93, black);
	api_point(winID, 75, 59, yellow);
	for(;;){
		if(api_getkey(true) == 0x0a) break;
	}
	api_end();
}
Beispiel #4
0
void HariMain(void)
{
	char *buf;
	int win, i, x, y;
	api_initmalloc();
	buf = api_malloc(150 * 100);
	win = api_openwin(buf, 150, 100, -1, "stars");
	api_boxfilwin(win,  6, 26, 143, 93, 0 /* 黒 */);
	for (i = 0; i < 50; i++) {
		x = (rand() % 137) +  6;
		y = (rand() %  67) + 26;
		api_point(win, x, y, 3 /* 黄 */);
	}
	api_end();
}
Beispiel #5
0
void HariMain(void)
{
	char *buf;
	int win;
	api_initmalloc();
	buf = api_malloc(150 * 100);
	win = api_openwin(buf, 150, 100, -1, "star1");
	api_boxfilwin(win,  6, 26, 143, 93, 0 /* �� */);
	api_point(win, 75, 59, 3 /* �� */);
	for (;;) {
		if (api_getkey(1) == 0x0a) {
			break; /* Enter�Ȃ�break; */
		}
	}
	api_end();
}
Beispiel #6
0
void HariMain(void)
{
	char *buf;
	int win, i, x, y;
	api_initmalloc();
	buf = api_malloc(150 * 100);
	win = api_openwin(buf, 150, 100, -1, "stars");
	api_boxfilwin(win,  6, 26, 143, 93, 0 /* 검정 */);
	for (i = 0; i < 50; i++) {
		x = (rand() % 137) +  6;
		y = (rand() %  67) + 26;
		api_point(win, x, y, 3 /* 노랑 */);
	}
	for (;;) {
		if (api_getkey(1) == 0x0a) {
			break; /* Enter라면 break; */
		}
	}
	api_end();
}
Beispiel #7
0
shape::shape()
{	shapetype = API_SHP_NULLSHAPE;
	topLeft = api_point( 0.0, 0.0 );
	bottomRight = api_point( 0.0, 0.0 );
}