📄 property.c
字号:
#include <stdio.h>
#include <string.h>
#include "asixwin.h"
#include "asixapp.h"
#include "bitmap.h"
#include "asix_lb.h"
#include "measure.h"
U32 Index = 320000;
BYTE area[FLASH_LENGTH - 200];//定义全局数组来预存相关的文件
//BYTE *cur_dir = (BYTE *)area;//area前面一部分用来存放目录
BYTE *cur_area = (BYTE *)&area;//定义一个全局变量来指向全局数组
void Int2Char( DWORD inti, char *caption )//
{
int temp, j;
DWORD i;
char *temp_caption = (char *)Lmalloc( 16 );
if ( inti == 0 )//传入为0,则显示为00
for ( i = 0; i < 2; i++ )
*( caption + i ) = '0';
else
{
for ( i = inti, j = 0; i > 0; i = i / 0xa, j++ )
{
temp = i % 0xa;
*( temp_caption + j ) = temp + 0x30;
}
if ( j == 1 )//传入数字为1位
{
*( caption + 1 ) = *( temp_caption + j - 1);
}
else
{
for ( i = 0; j > 0; j--, i++ )
{
*( caption + i ) = *( temp_caption + j - 1);
}
}
}
}
void Double2Char( double src, char *caption )//double 类型的数据总长8个字节,但有效位为15-16位。
{
int temp, j, k;
U32 i;
double dec;
char *temp_caption = (char *)Lmalloc( 53 );
// *caption = (char *)Lmalloc( 4 * sizeof(U32) );
// memset( caption, 0, 4 * sizeof(U32) );
/*
* 读出整数部分
*/
for ( i = (U32)src, j = 0; i > 0; i = i / 0xa, j++ )
{
temp = i % 0xa;
*( temp_caption + j ) = temp + 0x30;
}
for ( k = 0; j > 0; j--, k++ )
*( caption + k ) = *( temp_caption + j - 1);
if ( k == 0 )
*( caption + k++ ) = '0';//小数点
*( caption + k++ ) = '.';//小数点
/*
* 读小数部分
*/
dec = src - (U32)src;//取出小数部分
for ( i = 0; i < 32; i++ )
{
temp = (int)(dec * 0xa);
// *( temp_caption + i ) = temp + 0x30;
*( caption + k + i ) = temp + 0x30;
dec = dec * 0xa - temp;
}
// for ( ; i > 0; i--, k++ )
// *( caption + k ) = *( temp_caption + i - 1);
// return caption;
}
void Unite2Char( BYTE hour, BYTE minute, char *caption )
{
int temp, j, k;
BYTE i;
char *temp_caption = (char *)Lmalloc( 5 );
// *caption = (char *)Lmalloc( 7 * sizeof(BYTE) );
// memset( caption, 0, 7 * sizeof(BYTE) );
//转换hour
for ( i = hour, j = 0; i > 0; i = i / 0xa, j++ )
{
temp = i % 0xa;
*( temp_caption + j ) = temp + 0x30;
}
for ( k = 0; j > 0; j--, k++ )
{
if ( j == 1 )//小时只有一位
*( caption + k + 1 ) = *( temp_caption + j - 1);
else
*( caption + k ) = *( temp_caption + j - 1);
}
if ( k == 0 )
{
*caption = '0';
*( caption + 1 ) = '0';
}
*( caption + 2 ) = ':';
//转换minute
for ( i = minute, j = 0; i > 0; i = i / 0xa, j++ )
{
temp = i % 0xa;
*( temp_caption + j ) = temp + 0x30;
}
for ( k = 3; j > 0; j--, k++ )
*( caption + k ) = *( temp_caption + j - 1);
if ( k == 3 )
for ( ; k < 5; k++ )
*( caption + k ) = '0';
// *( caption + k++ ) = ' ';
// *( caption + k++ ) = ':';
/*
//转换second
for ( i = second, j = 0; i > 0; i = i / 0xa, j++ )
{
temp = i % 0xa;
*( temp_caption + j ) = temp + 0x30;
}
for ( k = 0; j > 0; j--, k++ )
*( caption + k ) = *( temp_caption + j - 1);
*( caption + k++ ) = ' ';
*( caption + k++ ) = ':';
*/
// return caption;
}
// 权属性质
static struct LBOX_ITEM owner[] =
{
ICON_ENABLE, UNUNDERLINE, "国有土地",
ICON_ENABLE, UNUNDERLINE, "国有后备土地",
ICON_ENABLE, UNUNDERLINE, "农业系统",
ICON_ENABLE, UNUNDERLINE, "国营农牧鱼场",
ICON_ENABLE, UNUNDERLINE, "林业系统",
ICON_ENABLE, UNUNDERLINE, "水利系统",
ICON_ENABLE, UNUNDERLINE, "国土系统",
ICON_ENABLE, UNUNDERLINE, "工业系统",
ICON_ENABLE, UNUNDERLINE, "能源系统",
ICON_ENABLE, UNUNDERLINE, "铁路系统",
ICON_ENABLE, UNUNDERLINE, "交通系统",
ICON_ENABLE, UNUNDERLINE, "司法系统",
ICON_ENABLE, UNUNDERLINE, "林业系统",
ICON_ENABLE, UNUNDERLINE, "宗教系统",
ICON_ENABLE, UNUNDERLINE, "军队系统",
ICON_ENABLE, UNUNDERLINE, "其它系统",
ICON_ENABLE, UNUNDERLINE, "集体土地",
ICON_ENABLE, UNUNDERLINE, "乡集体",
ICON_ENABLE, UNUNDERLINE, "村集体",
ICON_END, UNUNDERLINE, NULL
};
// 权属特性
struct LBOX_ITEM character[] =
{
ICON_END, UNUNDERLINE, NULL
};
// 偏移参数
struct LBOX_ITEM offset[] =
{
ICON_ENABLE, UNUNDERLINE, "0",
ICON_ENABLE, UNUNDERLINE, "1",
ICON_ENABLE, UNUNDERLINE, "2",
ICON_END, UNUNDERLINE, NULL
};
// 地类级别
struct LBOX_ITEM type_L1[10];
struct LBOX_ITEM type_L2[10];
struct LBOX_ITEM type_L3[10];
void RecordInflexion( void )
{
MSG msg;
U32 mainwin;
U8 quit=0;
U32 st_promt[3], st_serial;
S8 *prompt[3] = { "拐点序号:", "拐点级别:", "拐点性质:" };
U32 bt_ok, bt_cancel;
U32 lb_level, lb_character;
U8 i;
U16 st_y[3];
char caption[16];
INFLEXION_INFO_S record;
// 拐点级别
struct LBOX_ITEM level[] =
{
ICON_ENABLE, UNUNDERLINE, "组界拐点",
ICON_ENABLE, UNUNDERLINE, "村界拐点",
ICON_ENABLE, UNUNDERLINE, "乡界拐点",
ICON_ENABLE, UNUNDERLINE, "县界拐点",
ICON_ENABLE, UNUNDERLINE, "市界拐点",
ICON_ENABLE, UNUNDERLINE, "省界拐点",
ICON_ENABLE, UNUNDERLINE, "国界拐点",
ICON_ENABLE, UNUNDERLINE, "宗地界址",
ICON_END, UNUNDERLINE, NULL
};
// 拐点性质
struct LBOX_ITEM character[] =
{
ICON_ENABLE, UNUNDERLINE, "确定界拐点",
ICON_ENABLE, UNUNDERLINE, "未定界拐点",
ICON_ENABLE, UNUNDERLINE, "争议界拐点",
ICON_ENABLE, UNUNDERLINE, "临时界拐点",
ICON_ENABLE, UNUNDERLINE, "其它界拐点",
ICON_END, UNUNDERLINE, NULL
};
const U16 bt_w = 40, bt_h = 20, bt_y = PHY_LCD_H - bt_h -5;
const U16 st_w = 60, st_h = 20, st_x = 5;
const U16 lb_w = 90, lb_h = 20, lb_x = PHY_LCD_W - lb_w -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 < 3; i++ )
{
st_promt[i] = CreateWindow(WNDCLASS_STATIC, prompt[i], WS_CHILD|SS_TEXT, st_x,st_y[i],st_w,st_h,mainwin,0,NULL);
st_y[i+1] = st_y[i] + 35;
}
// st_serial = CreateWindow(WNDCLASS_STATIC, "320001", WS_CHILD|SS_TEXT, lb_x,st_y[0],lb_w,lb_h,mainwin,0,NULL);
Index++;
Int2Char( Index, caption );
st_serial = CreateWindow(WNDCLASS_STATIC, caption, WS_CHILD|SS_TEXT, lb_x,st_y[0],lb_w,lb_h,mainwin,0,NULL);
lb_level = CreateWindow(WNDCLASS_LIST, NULL, WS_CHILD, lb_x,st_y[1],lb_w,lb_h,mainwin,0,level);
lb_character = CreateWindow(WNDCLASS_LIST, NULL, WS_CHILD, lb_x,st_y[2],lb_w,lb_h,mainwin,0,character);
while(!quit)
{
ASIXGetMessage(&msg, NULL, 0, 0);
switch(msg.message)
{
case WM_COMMAND:
if( msg.lparam == bt_ok )
{
record.index = Index;
record.magic = 0x1;
record.latitude = 0.0;
record.longitude = 0.0;
record.end_flag[0] = 'a';
record.end_flag[1] = 'a';
if ( Index == 320001 )//第一个数据
{
rootdir[DirPos].file_type = WBG_FILE;
memcpy( rootdir[DirPos].file_name, "G3201020000120020101.wbg", 22 );
rootdir[DirPos].file_address = FileCurrentAddress;
rootdir[DirPos].file_length += sizeof(INFLEXION_INFO_S);
DirPos++;
}
if ( cur_area + sizeof(INFLEXION_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(INFLEXION_INFO_S) );
cur_area += sizeof(INFLEXION_INFO_S);
// 确认
quit = 1;
}
else if( msg.lparam == bt_cancel )
{
// 取消
Index--;
quit = 1;
}
break;
case WM_LISTBOX:
if( msg.lparam == lb_level )//拐点级别
{
record.level = msg.wparam + 1;
}
else if( msg.lparam == lb_character )//拐点性质
{
record.charact = msg.wparam + 1;
}
break;
case WM_QUIT:
Index--;
quit = 1;
break;
}
DefWindowProc(msg.message, msg.lparam, msg.data, msg.wparam);
}
DestroyWindow( mainwin );
}
void RecordBorderline( void )
{
MSG msg;
U32 mainwin;
U8 quit=0;
U32 st_promt[5], st_serial;
S8 *prompt[5] = { "界线序号:", "界线级别:", "界线性质:", "左侧行政区名:", "右侧行政区名:" };
U32 bt_ok, bt_cancel;
U32 lb_level, lb_character;
U32 bt_left_reg, lb_right_reg;
U8 i;
U16 st_y[5];
S8 str1[60], str2[60];
char caption[16];
char file_name[22];
BORDER_LINE_INFO_S record;//Julias
// ROOT_DIR rootdir;
#ifdef DEBUG
BORDER_LINE_INFO_S *test;//Julias
#endif
// 界线级别
struct LBOX_ITEM level[] =
{
ICON_ENABLE, UNUNDERLINE, "组界",
ICON_ENABLE, UNUNDERLINE, "村界",
ICON_ENABLE, UNUNDERLINE, "乡界",
ICON_ENABLE, UNUNDERLINE, "县界",
ICON_ENABLE, UNUNDERLINE, "市界",
ICON_ENABLE, UNUNDERLINE, "省界",
ICON_ENABLE, UNUNDERLINE, "国界",
ICON_ENABLE, UNUNDERLINE, "宗地界",
ICON_END, UNUNDERLINE, NULL
};
// 界线性质
struct LBOX_ITEM character[] =
{
ICON_ENABLE, UNUNDERLINE, "确定界",
ICON_ENABLE, UNUNDERLINE, "未定界",
ICON_ENABLE, UNUNDERLINE, "争议界",
ICON_ENABLE, UNUNDERLINE, "临时界",
ICON_ENABLE, UNUNDERLINE, "其它界",
ICON_END, UNUNDERLINE, NULL
};
const U16 bt_w = 40, bt_h = 20, bt_y = PHY_LCD_H - bt_h -5;
const U16 st_w[5] = { 60, 60, 60, 84, 84 };
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 - 24, bt_x2 = PHY_LCD_W - bt_w2 -5;
memset( record.left_reg, 0, 60 );//Julias
memset( record.right_reg, 0, 60 );//Julias
memset( record.end_flag, 0, 2 );
memset( caption, 0, 16 );
record.level = 1;//Julias
record.charact = 1;//Julias
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++ )
{
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] + 35;
}
// st_serial = CreateWindow(WNDCLASS_STATIC, "320001", WS_CHILD|SS_TEXT, lb_x,st_y[0],lb_w,lb_h,mainwin,0,NULL);
Index++;
Int2Char( Index, caption );
st_serial = CreateWindow(WNDCLASS_STATIC, caption, WS_CHILD|SS_TEXT, lb_x,st_y[0],lb_w,lb_h,mainwin,0,NULL);
lb_level = CreateWindow(WNDCLASS_LIST, NULL, WS_CHILD, lb_x,st_y[1],lb_w,lb_h,mainwin,0,level);
lb_character = CreateWindow(WNDCLASS_LIST, NULL, WS_CHILD, lb_x,st_y[2],lb_w,lb_h,mainwin,0,character);
bt_left_reg = CreateWindow(WNDCLASS_BUTTON, NULL, WS_CHILD|BS_REGULAR, bt_x2,st_y[3],bt_w2,bt_h,mainwin,0,NULL);
lb_right_reg = CreateWindow(WNDCLASS_BUTTON, NULL, WS_CHILD|BS_REGULAR, bt_x2,st_y[4],bt_w2,bt_h,mainwin,0,NULL);
str1[0] = '\0';
str2[0] = '\0';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -