Esempio n. 1
0
//=======================================================================================
// GmoShapeSlurTie implementation
//=======================================================================================
GmoShapeSlurTie::GmoShapeSlurTie(ImoObj* pCreatorImo, int objtype, ShapeId idx,
                                 UPoint* points, LUnits thickness, Color color)
    : GmoSimpleShape(pCreatorImo, objtype, idx, color)
    , VertexSource()
    , m_thickness(thickness)
{
    save_points(points);
    compute_vertices();
    compute_bounds();
    make_points_and_vertices_relative_to_origin();
}
Esempio n. 2
0
static int add_point (RoadMapGpsPosition *point, time_t time) {

   if (points_count == MAX_POINTS_IN_SEGMENT) {
      if (save_points(0) == -1) return -1;
   }

   TrackPoints[points_count].gps_point = *point;
   TrackPoints[points_count].time = time;

   return points_count++;
}
void polar_draw()
{
	int i,fxpos,mx,my,func_serial,arrayi;
	int lekhay=405;
	int axisi=1;
	int xaxisx,temp2;
	char buffer[10];
	double p1,p2,p3,p4;
	iSetColor(0,0,255);
	iShowBMP(0,0,"hipparchus.bmp");
	iSetColor(0,0,0);
	iFilledRectangle(0,0,670,700);
	iSetColor(100,100,100);
	iFilledRectangle(51,window_sizeY-620,600,600);
	iSetColor(255,255,255);
	iFilledRectangle(54,window_sizeY-617,594,594);
	iSetColor(0,0,255);
	iSetColor(0,0,0);
	iSetColor(112,128,144);
	mx=(54+594+53)/2;
	my=(window_sizeY-617+594+81)/2;
	alpha = mx;
	beta = my;
	iFilledRectangle(alpha,window_sizeY-617,2,594);
	iFilledRectangle(54,beta,594,2);
	iSetColor(176,196,222);
	for(i=0;i<=540;i=i+60)
	{
		if(i<=300)
			iCircle(alpha,beta,i);
	}
	iShowBMP(730,450,"func_input.bmp");
	iShowBMP(1000,100,"goback.bmp");
	iShowBMP(900,100,"reset.bmp");
	if(zoomflag<4){
		iShowBMP(823,609,"zoom_in.bmp");
	}
	if(zoomflag>0){
		iShowBMP(873,609,"zoom_out.bmp");
	}
	fxpos=399;
	if(current<3){
		iShowBMP(1040,newy1,"new.bmp");
	}
	if(current>1){
		iShowBMP(1080,newy1,"delete.bmp");
	}
	if(current<3||current>1){
		iShowBMP(1120,newy1,"save.bmp");
		iShowBMP(1080,newy1-35,"load.bmp");
	}
	for(func_serial=1;func_serial<=current;++func_serial)
		{
			iShowBMP(700,fxpos,"r=f(D).bmp");
			iFilledRectangle(735,fxpos+1,300,30);
			fxpos-=100;
		}
	iSetColor(0,0,0);
	for(func_serial=1;func_serial<=current;++func_serial){
		iText(750,lekhay,primary[func_serial],GLUT_BITMAP_TIMES_ROMAN_24);
		lekhay=lekhay-100;
	}
	xaxisx=alpha-10;
	for(axisi=0;axisi<6;++axisi){
		temp2=polar[axisi]*axisvalue;
		itoa(temp2,buffer,10);
		
		if(zoomflag==4 && (axisi==1 || axisi==3 || axisi==5)){
			if(axisi==1)iText(xaxisx,beta-8,"1.5");
			else if(axisi==3)iText(xaxisx,beta-8,"4.5");
			else if(axisi==5)iText(xaxisx,beta-8,"7.5");
		}
		else{
			iText(xaxisx,beta-8,buffer);
		}
		xaxisx=xaxisx+56;

	}
	if(calcuflag){
		calculate();
		calculated=current;
	}
		for(func_serial=1;func_serial<=calculated;++func_serial){
		for(arrayi=1;arrayi<=totalarray;++arrayi){
			finalx[func_serial][arrayi]=xvalue[func_serial][arrayi]*(zoom)+alpha;
			finaly[func_serial][arrayi]=yvalue[func_serial][arrayi]*(zoom)+beta;
		}
		for(arrayi=1;arrayi<totalarray;++arrayi){
			p1=finalx[func_serial][arrayi];
			p2=finaly[func_serial][arrayi];
			p3=finalx[func_serial][arrayi+1];
			p4=finaly[func_serial][arrayi+1];
			if(mapvalue[func_serial][arrayi]==0 && mapvalue[func_serial][arrayi+1]==0 && pointcheck(p1,p2,p3,p4)){
				if(func_serial==1) iSetColor(0,100,0);
				else if(func_serial==2) iSetColor(255,0,0);
				else if(func_serial==3) iSetColor(25,25,112);
				iLine(p1,p2,p3,p4);
			}
			

		}

		}

		if(func_save==1||func_save==2||func_save==3)
		save_points(func_save);
	if(func_load==1||func_load==2||func_load==3){
		load_function(func_load);
		calcuflag=1;
		calculated=func_load;
		func_load=0;
		primlength=1;
	}

}
void cartesian_draw()
{
	int i,mx,my,arrayi,count,fxpos,func_serial,lekhay=405;
	double p1,p2,p3,p4;
	int axisi=1;
	int yaxisy,xaxisx,temp2;
	char buffer[10];
	iSetColor(0,0,255);

	iShowBMP(670,0,"rene_descartes.bmp");
	iSetColor(0,0,0);
	iFilledRectangle(0,0,670,700);
	iSetColor(100,100,100);
	iFilledRectangle(51,window_sizeY-620,600,600);
	iSetColor(255,255,255);
	iFilledRectangle(54,window_sizeY-617,594,594);
	iShowBMP(730,450,"func_input.bmp");
	iShowBMP(1000,100,"goback.bmp");
	iShowBMP(900,100,"reset.bmp");
	if(zoomflag<4){
		iShowBMP(823,609,"zoom_in.bmp");
	}
	if(zoomflag>0){
		iShowBMP(873,609,"zoom_out.bmp");
	}
	fxpos=399;
	if(current<3){
		iShowBMP(1040,newy1,"new.bmp");
	}
	if(current>1){
		iShowBMP(1080,newy1,"delete.bmp");
	}
	if(current<3||current>1){
		iShowBMP(1120,newy1,"save.bmp");
		iShowBMP(1080,newy1-35,"load.bmp");
	}
	for(func_serial=1;func_serial<=current;++func_serial)
		{
			iShowBMP(700,fxpos,"y=f(x).bmp");
			iSetColor(204,255,153);
			iFilledRectangle(735,fxpos+1,300,30);
			fxpos-=100;
		}
	iSetColor(230,230,250);
	count=0;
	for(i=-3;(594-i)>0;i=i+10)
	{
		if(count%10==0) iSetColor(105,105,105);
		iRectangle(54+i,window_sizeY-617,594-i,594);
		count++;
		iSetColor(230,230,250);
	}
	iSetColor(230,230,250);
	count=0;
	for(i=-3;(594-i)>0;i=i+10)
	{
		if(count%10==0) iSetColor(205,133,63);
		iRectangle(54,window_sizeY-617+i,594,594-i);
		count++;
		iSetColor(230,230,250);
	}
	iSetColor(72,61,139);
	mx=(54+594+55)/2;
	my=(window_sizeY-617+594+82)/2;
	alpha = mx;
	beta = my;
	iFilledRectangle(mx,window_sizeY-617,2,594);
	iFilledRectangle(54,my,594,2);
	iSetColor(255,255,255);
	iFilledRectangle(50,window_sizeY-640,601,20);
	iFilledRectangle(12,window_sizeY-618,38,600);
	iSetColor(0,0,0);
	iRectangle(50,window_sizeY-640,601,22);
	iRectangle(12,window_sizeY-618,38,600);
	for(func_serial=1;func_serial<=current;++func_serial){
		iText(750,lekhay,primary[func_serial],GLUT_BITMAP_TIMES_ROMAN_24);
		lekhay=lekhay-100;
	}
	yaxisy=673;
	for(axisi=0;axisi<7;++axisi){
		temp2=axis[axisi]*axisvalue;
		itoa(temp2,buffer,10);
		
		if(zoomflag==4 && (axisi==0 || axisi==6 || axisi==2 || axisi==4)){
			if(axisi==0){
				iText(18,yaxisy,"7.5");
			}
			else if(axisi==6){
				iText(18,yaxisy,"-7.5");
			}
			else if(axisi==4){
				iText(18,yaxisy,"-2.5");
			}
			else if(axisi==2){
				iText(18,yaxisy,"2.5");
			}
		}
		else{
			iText(18,yaxisy,buffer);
		}
		yaxisy=yaxisy-98;

	}
	xaxisx=53;
	for(axisi=6;axisi>=0;--axisi){
		temp2=axis[axisi]*axisvalue;
		itoa(temp2,buffer,10);
		
		if(zoomflag==4 && (axisi==0 || axisi==6 || axisi==2 || axisi==4)){
			if(axisi==0){
				iText(xaxisx,70,"7.5");
			}
			else if(axisi==6){
				iText(xaxisx,70,"-7.5");
			}
			else if(axisi==4){
				iText(xaxisx,70,"-2.5");
			}
			else if(axisi==2){
				iText(xaxisx,70,"2.5");
			}
		}
		else{
			iText(xaxisx,70,buffer);
		}
		xaxisx=xaxisx+98;

	}
	iText(54,360,"X' ",GLUT_BITMAP_TIMES_ROMAN_24);
	iText(625,360,"X ",GLUT_BITMAP_TIMES_ROMAN_24);
	iText(330,360,"O ",GLUT_BITMAP_TIMES_ROMAN_24);
	iText(330,656,"Y ",GLUT_BITMAP_TIMES_ROMAN_24);
	iText(328,85,"Y' ",GLUT_BITMAP_TIMES_ROMAN_24);


	if(calcuflag){
		calculate();
		calculated=current;
	}
		for(func_serial=1;func_serial<=calculated;++func_serial){
		for(arrayi=1;arrayi<=totalarray;++arrayi){
			finalx[func_serial][arrayi]=xvalue[func_serial][arrayi]*(zoom)+alpha;
			finaly[func_serial][arrayi]=yvalue[func_serial][arrayi]*(zoom)+beta;
		}
		for(arrayi=1;arrayi<totalarray;++arrayi){
			p1=finalx[func_serial][arrayi];
			p2=finaly[func_serial][arrayi];
			p3=finalx[func_serial][arrayi+1];
			p4=finaly[func_serial][arrayi+1];
			if(mapvalue[func_serial][arrayi]==0 && mapvalue[func_serial][arrayi+1]==0 && pointcheck(p1,p2,p3,p4)){
				if(func_serial==1) iSetColor(0,100,0);
				else if(func_serial==2) iSetColor(255,0,0);
				else if(func_serial==3) iSetColor(25,25,112);
				iLine(p1,p2,p3,p4);
			}
		}

		}
			
	if(func_save==1||func_save==2||func_save==3)
		//iText(300,200,primary[func_save]);
		save_points(func_save);
	if(func_load==1||func_load==2||func_load==3){
		load_function(func_load);
		calcuflag=1;
		calculated=func_load;
		func_load=0;
		primlength=1;
	}


}
Esempio n. 5
0
static void track_end (void) {

   save_points(1);
}