⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 property.c

📁 国家ASIC工程中心使用的嵌入式操作系统
💻 C
📖 第 1 页 / 共 3 页
字号:
	while(!quit)
	{
		ASIXGetMessage(&msg, NULL, 0, 0);
		switch(msg.message)
		{
			case WM_COMMAND:
				if( msg.lparam == bt_ok )
				{
					// 确认
					record.index = Index;//Julias
					record.magic = 0x2;//Julias
					record.end_flag[0] = 'b';
					record.end_flag[1] = 'b';
					record.longitude = 0.000;
					record.latitude = 0.0000;
					
					if ( Index == 320001 )//第一个数据
					{
						rootdir[DirPos].file_type = WBG_FILE;
//						*file_name = "G320102";
						memcpy( rootdir[DirPos].file_name, "G3201020000120020101.wbg", 22 );
						rootdir[DirPos].file_address = FileCurrentAddress;
						rootdir[DirPos].file_length += sizeof(BORDER_LINE_INFO_S);
						DirPos++;
					}
					if ( cur_area + sizeof(BORDER_LINE_INFO_S) > area + FLASH_LENGTH )
					{
//						WriteRecord( area, FileCurrentAddress, cur_area - area );//Julias
//						FileCurrentAddress += cur_area - area;
						cur_area = (BYTE *)area;
					}

					memcpy( cur_area, &record, sizeof(BORDER_LINE_INFO_S) );
					cur_area += sizeof(BORDER_LINE_INFO_S);

#ifdef DEBUG
					test = (BORDER_LINE_INFO_S *)area;
#endif
					quit = 1;					
				}
				else if( msg.lparam == bt_cancel )
				{
					// 取消
					Index--;
					quit = 1;
				}
				else if( msg.lparam == bt_left_reg )	// 左侧行政区
				{
//					OpenSingleEditor( "输入", "行政区名称:", str1, 20, KBS_PINGYING );
//					SetWindowText( bt_left_reg, str1, NULL );
//					memcpy( record.left_reg, str1, 60 );//Julias
					OpenSingleEditor( "输入", "行政区名称:", record.left_reg, 20, KBS_PINGYING );
					SetWindowText( bt_left_reg, record.left_reg, NULL );
				}
				else if( msg.lparam == lb_right_reg )	// 右侧行政区
				{
//					OpenSingleEditor( "输入", "行政区名称:", str2, 20, KBS_PINGYING );
//					SetWindowText( lb_right_reg, str2, NULL );
//					memcpy( record.right_reg, str2, 60 );//Julias
					OpenSingleEditor( "输入", "行政区名称:", record.right_reg, 20, KBS_PINGYING );
					SetWindowText( lb_right_reg, record.right_reg, NULL );
				}
				break;
			case WM_LISTBOX:
				if( msg.lparam == lb_level )
				{
					record.level = msg.wparam + 1;//Julias
				}
				else if( msg.lparam == lb_character )
				{
					record.charact = msg.wparam + 1;//Julias
				}
				break;
			case WM_QUIT:
				Index--;
				quit = 1;
				break;
		}
		DefWindowProc(msg.message, msg.lparam, msg.data, msg.wparam); 
	}
	
	DestroyWindow( mainwin );
}

void RecordLinearTerrain( void )
{
	MSG 	msg;
 	U32		mainwin;
 	U8		quit=0;
	U32		st_promt[7], st_serial;
	S8		*prompt[7] = { "线状地物序号:", "权属性质:", "权属特性:", "偏移参数:", "地类名称:", "左侧宽度:", "右侧宽度:" };
	U32		bt_ok, bt_cancel;
	U32		lb_sel[4];
	U32		bt_sel[3];
	U8		i;
	U16		st_y[7];
	S8		str1[10], str2[10];
	char	caption[16];
	LINEEAR_TERRAIN_INFO_S	record;
	unsigned long	code;
//	BYTE	terrain_char;
//	ROOT_DIR	rootdir;

	struct LBOX_ITEM	*lb_item[3] =
	{
		owner,
		character,
		offset
	};

	const U16	bt_w = 40, bt_h = 20, bt_y = PHY_LCD_H - bt_h -5;
	const U16	st_w[7] = { 84, 60, 60, 60, 60, 60, 60 };
	const U16	st_h = 20, st_x = 5;
	const U16	lb_w = 90, lb_h = 20, lb_x = PHY_LCD_W - lb_w -5;
	const U16	bt_w2 = lb_w, bt_x2 = PHY_LCD_W - bt_w2 -5;

	memset( caption, 0, 16 );

 	mainwin = CreateWindow(	WNDCLASS_WIN,
							"线状地物信息",
							WS_OVERLAPPEDWINDOW,
							0,0,
							PHY_LCD_W,PHY_LCD_H,
							0,
							0,
							NULL);
	
	
	bt_ok = CreateWindow(WNDCLASS_BUTTON, "确认", WS_CHILD|BS_REGULAR, 27,bt_y,bt_w,bt_h,mainwin,0,NULL);
	bt_cancel = CreateWindow(WNDCLASS_BUTTON, "取消", WS_CHILD|BS_REGULAR, 93,bt_y,bt_w,bt_h,mainwin,0,NULL);
	

	st_y[0] = 35;
	for( i = 0; i < 7; i++ )
	{
		st_promt[i] = CreateWindow(WNDCLASS_STATIC, prompt[i], WS_CHILD|SS_TEXT, st_x,st_y[i],st_w[i],st_h,mainwin,0,NULL);
		st_y[i+1] = st_y[i] + 25;
	}
//	st_serial = CreateWindow(WNDCLASS_STATIC, "320001", WS_CHILD|SS_TEXT, (U16)(lb_x+24),st_y[0],(U16)(lb_w-24),lb_h,mainwin,0,NULL);
	Index++;
	Int2Char( Index, caption );
	st_serial = CreateWindow(WNDCLASS_STATIC, caption, WS_CHILD|SS_TEXT, (U16)(lb_x+24),st_y[0],(U16)(lb_w-24),lb_h,mainwin,0,NULL);
	for( i = 0; i < 3; i++ )
		lb_sel[i] = CreateWindow(WNDCLASS_LIST, NULL, WS_CHILD, lb_x,st_y[i+1],lb_w,lb_h,mainwin,0,(struct LBOX_ITEM	*)lb_item[i]);
	for( i = 0; i < 3; i++ )
		bt_sel[i] = CreateWindow(WNDCLASS_BUTTON, NULL, WS_CHILD|BS_REGULAR, bt_x2,st_y[i+4],bt_w2,bt_h,mainwin,0,NULL);

	str1[0] = '\0';
	str2[0] = '\0';

	while(!quit)
	{
		ASIXGetMessage(&msg, NULL, 0, 0);
		switch(msg.message)
		{
			case WM_COMMAND:
				if( msg.lparam == bt_ok )
				{
					// 确认
					record.index = Index;
					record.magic = 0x4;
					record.end_flag[0] = 'd';
					record.end_flag[1] = 'd';
					record.longitude = 0.0;
					record.latitude = 0.0;
					
					if ( Index == 320001 )//第一个数据
					{
						rootdir[DirPos].file_type = WBG_FILE;
//						*file_name = "G320102";
						memcpy( rootdir[DirPos].file_name, "G3201020000120020101.wbg", 22 );
						rootdir[DirPos].file_address = FileCurrentAddress;
						rootdir[DirPos].file_length += sizeof(LINEEAR_TERRAIN_INFO_S);
						DirPos++;
					}
					if ( cur_area + sizeof(LINEEAR_TERRAIN_INFO_S) < area + FLASH_LENGTH )
					{
//						WriteRecord( area, FileCurrentAddress, cur_area - area );//Julias
//						FileCurrentAddress += cur_area - area;
						cur_area = (BYTE *)area;
					}
					memcpy( cur_area, &record, sizeof(LINEEAR_TERRAIN_INFO_S) );
					cur_area += sizeof(LINEEAR_TERRAIN_INFO_S);

					quit = 1;					
				}
				else if( msg.lparam == bt_cancel )
				{
					// 取消
					Index--;
					quit = 1;
				}
				else if( msg.lparam == bt_sel[0] )	// 选择地类名称
				{
					S8	*str;

					str = SelectTerrainType( &code );

					if( str != NULL )
					{
						SetWindowText( bt_sel[0], str, NULL );
						Int2Char( code, record.terrain_name );
						Lfree( str );
					}

				}
				else if( msg.lparam == bt_sel[1] )	// 左侧宽度
				{
					OpenSingleEditor( "输入", "左侧宽度:", str1, 10, KBS_NUMBER );
					SetWindowText( bt_sel[1], str1, NULL );

					memcpy( &record.left_width, str1, 10 );
				}
				else if( msg.lparam == bt_sel[2] )	// 右侧宽度
				{
					OpenSingleEditor( "输入", "右侧宽度:", str2, 10, KBS_NUMBER );
					SetWindowText( bt_sel[2], str2, NULL );

					memcpy( &record.left_width, str1, 10 );

				}
				break;
			case WM_LISTBOX:
				if ( msg.lparam == lb_sel[0] )//权属性质
				{
//					terrain_char = msg.lparam + 1;
					Int2Char( msg.wparam + 1, record.terrain_char );
				}
				else if ( msg.lparam == lb_sel[1] )//权属特性
				{
					memcpy( record.earmark, "未完成", 6 );//未完成
				}
				else if ( msg.lparam == lb_sel[2] )//偏移参数
					record.offset = msg.wparam;

				break;
			case WM_QUIT:
				Index--;
				quit = 1;
				break;
		}
		DefWindowProc(msg.message, msg.lparam, msg.data, msg.wparam); 
	}
	
	DestroyWindow( mainwin );
}

void RecordPiecesTerrain( void )
{
	MSG 	msg;
 	U32		mainwin;
 	U8		quit=0;
	U32		st_promt[4], st_serial;
	S8		*prompt[4] = { "零星地物序号:", "权属单位:", "地类名称:", "权属性质:" };
	U32		bt_ok, bt_cancel;
	U32		lb_terrain;
	U32		bt_sel[2];
	U8		i;
	U16		st_y[4];
	S8		str[20];
	unsigned long	code;
//	BYTE	terrain_char;
	char	caption[16];
	PIECES_TERRAIN_INFO_S	record;

	const U16	bt_w = 40, bt_h = 20, bt_y = PHY_LCD_H - bt_h -5;
	const U16	st_w[4] = { 84, 60, 60, 60 };
	const U16	st_h = 20, st_x = 5;
	const U16	lb_w = 90, lb_h = 20, lb_x = PHY_LCD_W - lb_w -5;
	const U16	bt_w2 = lb_w, bt_x2 = PHY_LCD_W - bt_w2 -5;

	memset( caption, 0, 16 );

	mainwin = CreateWindow(	WNDCLASS_WIN,
							"零星地物信息",
							WS_OVERLAPPEDWINDOW,
							0,0,
							PHY_LCD_W,PHY_LCD_H,
							0,
							0,
							NULL);
	
	
	bt_ok = CreateWindow(WNDCLASS_BUTTON, "确认", WS_CHILD|BS_REGULAR, 27,bt_y,bt_w,bt_h,mainwin,0,NULL);
	bt_cancel = CreateWindow(WNDCLASS_BUTTON, "取消", WS_CHILD|BS_REGULAR, 93,bt_y,bt_w,bt_h,mainwin,0,NULL);
	

	st_y[0] = 35;
	for( i = 0; i < 4; i++ )
	{
		st_promt[i] = CreateWindow(WNDCLASS_STATIC, prompt[i], WS_CHILD|SS_TEXT, st_x,st_y[i],st_w[i],st_h,mainwin,0,NULL);
		st_y[i+1] = st_y[i] + 25;
	}
//	st_serial = CreateWindow(WNDCLASS_STATIC, "320001", WS_CHILD|SS_TEXT, (U16)(lb_x+24),st_y[0],(U16)(lb_w-24),lb_h,mainwin,0,NULL);
	Index++;
	Int2Char( Index, caption );
	st_serial = CreateWindow(WNDCLASS_STATIC, caption, WS_CHILD|SS_TEXT, (U16)(lb_x+24),st_y[0],(U16)(lb_w-24),lb_h,mainwin,0,NULL);
	for( i = 0; i < 2; i++ )
		bt_sel[i] = CreateWindow(WNDCLASS_BUTTON, NULL, WS_CHILD|BS_REGULAR, bt_x2,st_y[i+1],bt_w2,bt_h,mainwin,0,NULL);
	lb_terrain = CreateWindow(WNDCLASS_LIST, NULL, WS_CHILD, lb_x,st_y[3],lb_w,lb_h,mainwin,0,owner);

	str[0] = '\0';

	while(!quit)
	{
		ASIXGetMessage(&msg, NULL, 0, 0);
		switch(msg.message)
		{
			case WM_COMMAND:
				if( msg.lparam == bt_ok )
				{
					// 确认
					record.index = Index;
					record.magic = 0x5;
					record.longitude = 0.0;
					record.latitude = 0.0;
					record.end_flag[0] = 'e';
					record.end_flag[1] = 'e';

					if ( Index == 320001 )//第一个数据
					{
						rootdir[DirPos].file_type = WBG_FILE;
//						*file_name = "G320102";
						memcpy( rootdir[DirPos].file_name, "G3201020000120020101.wbg", 22 );
						rootdir[DirPos].file_address = FileCurrentAddress;
						rootdir[DirPos].file_length += sizeof(PIECES_TERRAIN_INFO_S);
						DirPos++;
					}
					if ( cur_area + sizeof(PIECES_TERRAIN_INFO_S) < area + FLASH_LENGTH )
					{
//						WriteRecord( area, FileCurrentAddress, cur_area - area );//Julias
//						FileCurrentAddress += cur_area - area;
						cur_area = (BYTE *)area;
					}
					memcpy( cur_area, &record, sizeof(PIECES_TERRAIN_INFO_S) );
					cur_area += sizeof(PIECES_TERRAIN_INFO_S);

					quit = 1;					
				}
				else if( msg.lparam == bt_cancel )
				{
					// 取消
					Index--;
					quit = 1;
				}
				else if( msg.lparam == bt_sel[1] )	// 选择地类名称
				{
					S8	*str;

					str = SelectTerrainType( &code );

					if( str != NULL )
					{
						SetWindowText( bt_sel[1], str, NULL );
						Int2Char( code, record.terrain_name );
						Lfree( str );
					}

				}
				else if( msg.lparam == bt_sel[0] )	// 权属单位
				{
//					OpenSingleEditor( "输入", "单位名称:", str, 20, KBS_PINGYING );
//					SetWindowText( bt_sel[0], str, NULL );
					OpenSingleEditor( "输入", "单位名称:", record.owner_index, 20, KBS_PINGYING );
					SetWindowText( bt_sel[0], record.owner_index, NULL );
				}
				break;
			case WM_LISTBOX:
				if ( msg.lparam == lb_terrain )
				{
//					terrain_char = msg.wparam + 1;
					Int2Char( msg.wparam + 1, record.terrain_char );
				}

				break;
			case WM_QUIT:
				Index--;
				quit = 1;
				break;
		}
		DefWindowProc(msg.message, msg.lparam, msg.data, msg.wparam); 
	}
	
	DestroyWindow( mainwin );
}

void RecordMapBlock( void )
{
	MSG 	msg;
 	U32		mainwin;
 	U8		quit=0;
	U32		st_promt[5], st_serial;
	S8		*prompt[5] = { "图斑序号:", "权属单位:", "坐落单位:", "地类名称:", "权属性质:" };
	U32		bt_ok, bt_cancel;
	U32		lb_terrain;
	U32		bt_sel[3];
	U8		i;
	U16		st_y[5];
	S8		str1[20], str2[20];
	unsigned long	code;
	char	caption[16];
	MAP_BLOCK_INFO_S	record;

	const U16	bt_w = 40, bt_h = 20, bt_y = PHY_LCD_H - bt_h -5;
	const U16	st_w = 60;
	const U16	st_h = 20, st_x = 5;
	const U16	lb_w = 90, lb_h = 20, lb_x = PHY_LCD_W - lb_w -5;
	const U16	bt_w2 = lb_w, bt_x2 = PHY_LCD_W - bt_w2 -5;

 	memset( caption, 0, 16 );

	mainwin = CreateWindow(	WNDCLASS_WIN,
							"图斑信息",
							WS_OVERLAPPEDWINDOW,
							0,0,
							PHY_LCD_W,PHY_LCD_H,
							0,
							0,
							NULL);
	
	
	bt_ok = CreateWindow(WNDCLASS_BUTTON, "确认", WS_CHILD|BS_REGULAR, 27,bt_y,bt_w,bt_h,mainwin,0,NULL);
	bt_cancel = CreateWindow(WNDCLASS_BUTTON, "取消", WS_CHILD|BS_REGULAR, 93,bt_y,bt_w,bt_h,mainwin,0,NULL);
	

	st_y[0] = 35;
	for( i = 0; i < 5; i++ )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -