📄 field.c
字号:
if(value==FALSE){ line_D4G= gnome_canvas_item_new(group,gnome_canvas_line_get_type(), "points",point1,"fill_color", cr,"width_units",4.0, "join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); }if(value==TRUE){ gnome_canvas_item_set( line_D4G,"points",point1,"fill_color", cr,"width_units", 4.0,"join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); gnome_canvas_item_request_update(line_D4G); gnome_canvas_item_show(line_D4G); }}/*_____________________________________*/if(i==24){ if(value==FALSE){ line_SJG= gnome_canvas_item_new(group,gnome_canvas_line_get_type(), "points",point1,"fill_color", cr,"width_units",4.0, "join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); }if(value==TRUE){ gnome_canvas_item_set( line_SJG,"points",point1,"fill_color", cr,"width_units", 4.0,"join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); gnome_canvas_item_request_update(line_SJG); gnome_canvas_item_show(line_SJG); }} gnome_canvas_points_unref(point1); return 1;}/*-------------------------1个道岔区段--------------------------------------*/int draw_onesw_fd(double fx,double fy,double f1x,double f1y,double f2x,double f2y, double f3x,double f3y,double f4x,double f4y,double f8x,double f8y,double f9x, double f9y,int dir,gchar*cr,GtkWidget*canvas){ GnomeCanvasPoints *point1,*point2; GnomeCanvasGroup *group; group=gnome_canvas_root(GNOME_CANVAS(canvas)); double c1x,c1y,c2x,c2y,c3x,c3y,c4x,c4y; if(dir==0){/*一岔区段里的道岔为定位*/ point1=gnome_canvas_points_new(2); point1->coords[0]=fx; point1->coords[1]=fy; point1->coords[2]=f2x; point1->coords[3]=f2y; point2=gnome_canvas_points_new(4); point2->coords[0]=fx; point2->coords[1]=fy; point2->coords[2]=f1x; point2->coords[3]=f1y; point2->coords[4]=f3x; point2->coords[5]=f3y; point2->coords[6]=f4x; point2->coords[7]=f4y; if(i==5) { /*1DG*/ if(Ctr_1_DB==TRUE){ gtk_object_destroy(GTK_OBJECT(dot1_1DB)); gtk_object_destroy(GTK_OBJECT(dot1_2DB)); Ctr_1_DB=FALSE; } if(Ctr_1_FB==TRUE){ gtk_object_destroy(GTK_OBJECT(dot1_1FB)); gtk_object_destroy(GTK_OBJECT(dot1_2FB)); Ctr_1_FB=FALSE; } if(value==FALSE){ line_1DB_DG= gnome_canvas_item_new(group,gnome_canvas_line_get_type(), "points",point1,"fill_color", cr,"width_units",4.0, "join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); line_1FB_DG= gnome_canvas_item_new(group,gnome_canvas_line_get_type(), "points",point2,"fill_color", cr,"width_units",4.0, "join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); } if(value==TRUE){ gnome_canvas_item_set( line_1DB_DG,"points",point1,"fill_color", cr,"width_units", 4.0,"join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); gnome_canvas_item_request_update(line_1DB_DG); gnome_canvas_item_show(line_1DB_DG); gnome_canvas_item_hide(line_1FB_DG); } if(Ctr_1_DB==FALSE){ c1x=f1x-2.0; c1y=f1y-2.0; c2x=f1x+2.0; c2y=f1y+2.0; dot1_1DB=gnome_canvas_item_new(group, /*1号道岔两个小点*/ gnome_canvas_ellipse_get_type(), "x1",c1x,"y1",c1y,"x2",c2x,"y2",c2y,"fill_color","green", NULL); c3x=f8x-2.0; c3y=f8y-2.0; c4x=f8x+2.0; c4y=f8y+2.0; dot1_2DB=gnome_canvas_item_new(group, gnome_canvas_ellipse_get_type(), "x1",c3x,"y1",c3y,"x2",c4x,"y2",c4y,"fill_color","green", NULL); Ctr_1_DB=TRUE; /* 两个点已经存在*/ } } if(i==6){ /*3DG*/ if(Ctr_3_DB==TRUE){ gtk_object_destroy(GTK_OBJECT(dot3_1DB)); gtk_object_destroy(GTK_OBJECT(dot3_2DB)); Ctr_3_DB=FALSE; } if(Ctr_3_FB==TRUE){ gtk_object_destroy(GTK_OBJECT(dot3_1FB)); gtk_object_destroy(GTK_OBJECT(dot3_2FB)); Ctr_3_FB=FALSE; } if(value==FALSE){ line_3DB_DG= gnome_canvas_item_new(group,gnome_canvas_line_get_type(), "points",point1,"fill_color", cr,"width_units",4.0, "join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); line_3FB_DG= gnome_canvas_item_new(group,gnome_canvas_line_get_type(), "points",point2,"fill_color", cr,"width_units",4.0, "join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); } if(value==TRUE){ gnome_canvas_item_set( line_3DB_DG,"points",point1,"fill_color", cr,"width_units", 4.0,"join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); gnome_canvas_item_request_update(line_3DB_DG); gnome_canvas_item_show(line_3DB_DG); gnome_canvas_item_hide(line_3FB_DG); } if(Ctr_3_DB==FALSE){ c1x=f1x-2.0; c1y=f1y-2.0; c2x=f1x+2.0; c2y=f1y+2.0; dot3_1DB=gnome_canvas_item_new(group, /*3号道岔两个小点*/ gnome_canvas_ellipse_get_type(), "x1",c1x,"y1",c1y,"x2",c2x,"y2",c2y,"fill_color","green", NULL); c3x=f8x-2.0; c3y=f8y-2.0; c4x=f8x+2.0; c4y=f8y+2.0; dot3_2DB=gnome_canvas_item_new(group, gnome_canvas_ellipse_get_type(), "x1",c3x,"y1",c3y,"x2",c4x,"y2",c4y,"fill_color","green", NULL); Ctr_3_DB=TRUE; /* 两个点已经存在*/ } } if(i==9){ /*13DG*/ if(Ctr_13_DB==TRUE){ gtk_object_destroy(GTK_OBJECT(dot13_1DB)); gtk_object_destroy(GTK_OBJECT(dot13_2DB)); Ctr_13_DB=FALSE; } if(Ctr_13_FB==TRUE){ gtk_object_destroy(GTK_OBJECT(dot13_1FB)); gtk_object_destroy(GTK_OBJECT(dot13_2FB)); Ctr_13_FB=FALSE; } if(value==FALSE){ line_13DB_DG= gnome_canvas_item_new(group,gnome_canvas_line_get_type(), "points",point1,"fill_color", cr,"width_units",4.0, "join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); line_13FB_DG= gnome_canvas_item_new(group,gnome_canvas_line_get_type(), "points",point2,"fill_color", cr,"width_units",4.0, "join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); } if(value==TRUE){ gnome_canvas_item_set( line_13DB_DG,"points",point1,"fill_color", cr,"width_units", 4.0,"join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); gnome_canvas_item_request_update(line_13DB_DG); gnome_canvas_item_show(line_13DB_DG); gnome_canvas_item_hide(line_13FB_DG); } if(Ctr_13_DB==FALSE){ c1x=f1x-2.0; c1y=f1y-2.0; c2x=f1x+2.0; c2y=f1y+2.0; dot13_1DB=gnome_canvas_item_new(group, /*13号道岔两个小点*/ gnome_canvas_ellipse_get_type(), "x1",c1x,"y1",c1y,"x2",c2x,"y2",c2y,"fill_color","green", NULL); c3x=f8x-2.0; c3y=f8y-2.0; c4x=f8x+2.0; c4y=f8y+2.0; dot13_2DB=gnome_canvas_item_new(group, gnome_canvas_ellipse_get_type(), "x1",c3x,"y1",c3y,"x2",c4x,"y2",c4y,"fill_color","green", NULL); Ctr_13_DB=TRUE; /* 两个点已经存在*/ } }if(i==10){ if(Ctr_15_DB==TRUE){ gtk_object_destroy(GTK_OBJECT(dot15_1DB)); gtk_object_destroy(GTK_OBJECT(dot15_2DB)); Ctr_15_DB=FALSE; } if(Ctr_15_FB==TRUE){ gtk_object_destroy(GTK_OBJECT(dot15_1FB)); gtk_object_destroy(GTK_OBJECT(dot15_2FB)); Ctr_15_FB=FALSE; } if(value==FALSE){ line_15DB_DG= gnome_canvas_item_new(group,gnome_canvas_line_get_type(), "points",point1,"fill_color", cr,"width_units",4.0, "join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); line_15FB_DG= gnome_canvas_item_new(group,gnome_canvas_line_get_type(), "points",point2,"fill_color", cr,"width_units",4.0, "join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); } if(value==TRUE){ gnome_canvas_item_set( line_15DB_DG,"points",point1,"fill_color", cr,"width_units", 4.0,"join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); gnome_canvas_item_request_update(line_15DB_DG); gnome_canvas_item_show(line_15DB_DG); gnome_canvas_item_hide(line_15FB_DG); } if(Ctr_15_DB==FALSE){ c1x=f1x-2.0; c1y=f1y-2.0; c2x=f1x+2.0; c2y=f1y+2.0; dot15_1DB=gnome_canvas_item_new(group, /*15号道岔定位两个小点*/ gnome_canvas_ellipse_get_type(), "x1",c1x,"y1",c1y,"x2",c2x,"y2",c2y,"fill_color","green", NULL); c3x=f8x-2.0; c3y=f8y-2.0; c4x=f8x+2.0; c4y=f8y+2.0; dot15_2DB=gnome_canvas_item_new(group, gnome_canvas_ellipse_get_type(), "x1",c3x,"y1",c3y,"x2",c4x,"y2",c4y,"fill_color","green", NULL); Ctr_15_DB=TRUE; /* 两个点已经存在*/ }}if(i==11){ if(Ctr_17_DB==TRUE){ gtk_object_destroy(GTK_OBJECT(dot17_1DB)); gtk_object_destroy(GTK_OBJECT(dot17_2DB)); Ctr_17_DB=FALSE; } if(Ctr_17_FB==TRUE){ gtk_object_destroy(GTK_OBJECT(dot17_1FB)); gtk_object_destroy(GTK_OBJECT(dot17_2FB)); Ctr_17_FB=FALSE; } if(value==FALSE){ line_17DB_DG= gnome_canvas_item_new(group,gnome_canvas_line_get_type(), "points",point1,"fill_color", cr,"width_units",4.0, "join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); line_17FB_DG= gnome_canvas_item_new(group,gnome_canvas_line_get_type(), "points",point2,"fill_color", cr,"width_units",4.0, "join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); } if(value==TRUE){ gnome_canvas_item_set( line_17DB_DG,"points",point1,"fill_color", cr,"width_units", 4.0,"join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); gnome_canvas_item_request_update(line_17DB_DG); gnome_canvas_item_show(line_17DB_DG); gnome_canvas_item_hide(line_17FB_DG); } if(Ctr_17_DB==FALSE){ c1x=f1x-2.0; c1y=f1y-2.0; c2x=f1x+2.0; c2y=f1y+2.0; dot17_1DB=gnome_canvas_item_new(group, /*17号道岔两个小点*/ gnome_canvas_ellipse_get_type(), "x1",c1x,"y1",c1y,"x2",c2x,"y2",c2y,"fill_color","green", NULL); c3x=f8x-2.0; c3y=f8y-2.0; c4x=f8x+2.0; c4y=f8y+2.0; dot17_2DB=gnome_canvas_item_new(group, gnome_canvas_ellipse_get_type(), "x1",c3x,"y1",c3y,"x2",c4x,"y2",c4y,"fill_color","green", NULL); Ctr_17_DB=TRUE; /* 两个点已经存在*/ }} if(i==12){ if(Ctr_19_DB==TRUE){ gtk_object_destroy(GTK_OBJECT(dot19_1DB)); gtk_object_destroy(GTK_OBJECT(dot19_2DB)); Ctr_19_DB=FALSE; } if(Ctr_19_FB==TRUE){ gtk_object_destroy(GTK_OBJECT(dot19_1FB)); gtk_object_destroy(GTK_OBJECT(dot19_2FB)); Ctr_19_FB=FALSE; } if(value==FALSE){ line_19DB_DG= gnome_canvas_item_new(group,gnome_canvas_line_get_type(), "points",point1,"fill_color", cr,"width_units",4.0, "join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); line_19FB_DG= gnome_canvas_item_new(group,gnome_canvas_line_get_type(), "points",point2,"fill_color", cr,"width_units",4.0, "join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); }if(value==TRUE){ gnome_canvas_item_set( line_19DB_DG,"points",point1,"fill_color", cr,"width_units", 4.0,"join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); gnome_canvas_item_request_update(line_19DB_DG); gnome_canvas_item_show(line_19DB_DG); gnome_canvas_item_hide(line_19FB_DG); } if(Ctr_19_DB==FALSE){ c1x=f1x-2.0; c1y=f1y-2.0; c2x=f1x+2.0; c2y=f1y+2.0; dot19_1DB=gnome_canvas_item_new(group, /*19号道岔两个小点*/ gnome_canvas_ellipse_get_type(), "x1",c1x,"y1",c1y,"x2",c2x,"y2",c2y,"fill_color","green", NULL); c3x=f8x-2.0; c3y=f8y-2.0; c4x=f8x+2.0; c4y=f8y+2.0; dot19_2DB=gnome_canvas_item_new(group, gnome_canvas_ellipse_get_type(), "x1",c3x,"y1",c3y,"x2",c4x,"y2",c4y,"fill_color","green", NULL); Ctr_19_DB=TRUE; /* 两个点已经存在*/ }}if(i==22){ if(Ctr_10_DB==TRUE){ gtk_object_destroy(GTK_OBJECT(dot10_1DB)); gtk_object_destroy(GTK_OBJECT(dot10_2DB)); Ctr_10_DB=FALSE; } if(Ctr_10_FB==TRUE){ gtk_object_destroy(GTK_OBJECT(dot10_1FB)); gtk_object_destroy(GTK_OBJECT(dot10_2FB)); Ctr_10_FB=FALSE; } if(value==FALSE){ line_10DB_DG= gnome_canvas_item_new(group,gnome_canvas_line_get_type(), "points",point1,"fill_color", cr,"width_units",4.0, "join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); line_10FB_DG= gnome_canvas_item_new(group,gnome_canvas_line_get_type(), "points",point2,"fill_color", cr,"width_units",4.0, "join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); } if(value==TRUE){ gnome_canvas_item_set( line_10DB_DG,"points",point1,"fill_color", cr,"width_units", 4.0,"join_style", GDK_CAP_BUTT,"line_style", GDK_LINE_SOLID,NULL); gnome_canvas_item_request_update(line_10DB_DG); gnome_canvas_item_show(line_10DB_DG); gnome_canvas_item_hide(line_10FB_DG); } if(Ctr_10_DB==FALSE){ c1x=f1x-2.0; c1y=f1y-2.0; c2x=f1x+2.0; c2y=f1y+2.0; dot10_1DB=gnome_canvas_item_new(group, /*1号道岔两个小点*/ gnome_canvas_ellipse_get_type(), "x1",c1x,"y1",c1y,"x2",c2x,"y2",c2y,"fill_color","green", NULL); c3x=f8x-2.0; c3y=f8y-2.0; c4x=f8x+2.0; c4y=f8y+2.0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -