see on update notes

This commit is contained in:
KenanZhu111 committed 2024-11-05 20:05:36 +08:00
1 parent 93f218a113
commit 80e29d68c7
10 files changed
+322 -65

No files matched your search

+4
View File
@@ -67,6 +67,10 @@ class Configinit:
self.config.set('Options_Draw', 'N_Line', '0.80')
self.config.set('Options_Draw', 'U_Line', '0.80')
self.config.set('Options_Draw', 'Sat_Amount_Color', '#0080FF')
self.config.set('Options_Draw', 'Enable of track', '0')
self.config.set('Options_Draw', 'Track of prn', '01')
self.config.set('Options_Draw', 'Track sample rate','10')
### Config for input path
self.config.add_section('Input_Obs_Path')
self.config.set('Input_Obs_Path', '0', '')
+87 -28
View File
@@ -84,7 +84,8 @@ class CALLBACK:
position_y = int((hwnd.winfo_screenheight() - win_y) / 2)
hwnd.geometry(f'{win_x}x{win_y}+{position_x}+{position_y}')
def Calcuconfirm(self, cionbox, ctrobox, canglebox, systemv):
def Calcuconfirm(self, cionbox, ctrobox, canglebox, systemv,
trackprn, trackint):
# -------------------------------------------------------------------------------
# >
# Method: Calcuconfirm
@@ -101,6 +102,9 @@ class CALLBACK:
self.cfg_get.set('Options_Calc', 'Trop_model', self.trocormode.get(ctrobox.get()))
self.cfg_get.set('Options_Calc', 'Elev_angle', canglebox.get())
self.cfg_get.set('Options_Calc', 'Sat_system', str(systemv.get()))
self.cfg_get.set('Options_Draw', 'Track of prn', trackprn.get())
self.cfg_get.set('Options_Draw', 'Track sample rate', trackint.get())
self.cfg.save_config()
def Colorchoose(self, hwndparent, i, colorlab, mode):
@@ -306,6 +310,7 @@ class CALLBACK:
# Brief : Execute RINEX file into .ksln.
# Author: @KenanZhu All Right Reserved.
# -------------------------------------------------------------------------------
exten = "ksln"
statemsg = ""
state3 = ["","",""]
if not ObsSelectBoxVar.get():
@@ -327,9 +332,12 @@ class CALLBACK:
if AskOrNotCheckVar.get():
directory = DirectorySelectBoxVar.get()
directory = self.Dir_or_name_get(directory, 1)
syssign = self.system.get(int(self.cfg_get['Options_Calc']['sat_system']))
resname = syssign + '-' + self.Dir_or_name_get(obspath,0) + 'ksln'
if int(self.cfg_get['Options_Draw']['Enable of track'])==1:
exten="ssln"
resname = syssign + '-' + self.Dir_or_name_get(obspath,0) + exten
respath = (directory + resname)
ExecuteState.config(text='Processing...... file : %s' %resname)
@@ -343,7 +351,8 @@ class CALLBACK:
int(self.cfg_get['Options_Calc']['Sat_system']),
int(self.cfg_get['Options_Calc']['Elev_angle']),
int(self.cfg_get['Options_Calc']['Iono_Model']),
int(self.cfg_get['Options_Calc']['Trop_Model'])
int(self.cfg_get['Options_Calc']['Trop_Model']),
int(self.cfg_get['Options_Draw']['Enable of track'])
):
case 0.0:
ExecuteState.config(text='Generated successfully ! file : %s' %resname)
@@ -385,6 +394,7 @@ class CALLBACK:
path = filedialog.askopenfilename(title='Open as Pos Solution',
filetypes=[('Solution File(*.ksln)', '*.ksln'),
('All Files', '*.*')])
if not path: return
with open(path,'r')as f:
while 1:
line = f.readline()
@@ -524,56 +534,105 @@ class CALLBACK:
# Brief :
# Author: @KenanZhu All Right Reserved.
# -------------------------------------------------------------------------------
if self.cfg_get['Options_Draw']['Enable of track']=='0':
plotstate.config(text="Track plot is not avaliable now, Please enable it.")
return
satprn = int(self.cfg_get['Options_Draw']['Track of prn'])
anirat = int(self.cfg_get['Options_Draw']['Track sample rate'])
system = self.system.get(int(self.cfg_get['Options_Calc']['sat_system']))
path = filedialog.askopenfilename(title='Open as Sat Solution',
filetypes=[('Solution File(*.ksln)', '*.ksln'),
filetypes=[('Solution File(*.ssln)', '*.ssln'),
('All Files', '*.*')])
if not path: return
sattrack.clear()
sattrack.coastlines(resolution='110m')
sattrack.gridlines()
with open(path,'r') as f:
while 1:
line = f.readline()
if line.find('APPROX POSITION BLH')>=0:
apb = math.degrees( float(line[22:35]) )
apl = math.degrees( float(line[35:48]) )
plotstate.config(text="Plotting...")
sattrack.scatter(
apl,
apb,
color='r',
s=35,
transform=ccrs.PlateCarree()
)
sattrack.text(
apl,
apb,
blank*4+marker,
color='k',
fontsize=10,
fontweight='bold',
transform=ccrs.PlateCarree()
)
canvas2.draw()
elif line.find('GENERATE SOURCE')>=0:
marker = line[22:26]
elif line.find('INTERVAL')>=0:
ive = float(line[22:27])
elif line.find('<END OF HEADER')>=0:
break
epoch = 0
while 1:
line =f.readline()
if line[0:1]=='>':
epoch = int(line[1:6])
plotstate.config(text="Reading...%5d/%5d Mode: Sat track plot"
%(int(line[1:6]), int(86400/ive)))
elif line[0:1]==blank:
if line[0:1]==blank:
pass
elif line[0:1]==self.system.get(int(self.cfg_get['Options_Calc']['sat_system'])
) and line.find('END')==-1 and line.find('Rec')==-1:
if epoch % 10==0:
elif line[0:1]==system and line.find('END')==-1 and line.find('Rec')==-1:
epoch = int(line[41:46])
plotstate.config(text="Reading...%5d/%5d Mode: Sat track plot"
% (int(line[41:46]), int(86400 / ive)))
if int(line[1:3])==satprn and epoch%anirat==0:
b = math.degrees( float(line[ 4:13]) )
l = math.degrees( float(line[14:23]) )
sattrack.scatter(l,b,color='b',s=2,
transform=ccrs.PlateCarree())
sattrack.scatter(
l,
b,
color='b',
s=2,
transform=ccrs.PlateCarree()
)
canvas2.draw()
text = sattrack.text(
l,
b,
4*blank+system+'%02d'%satprn,
color='k',
fontsize=10,
fontweight='bold',
transform=ccrs.PlateCarree()
)
point = sattrack.scatter(
l,
b,
color='b',
s=10,
transform=ccrs.PlateCarree()
)
canvas2.draw()
text.remove()
point.remove()
else:
pass
elif line.find('END')>=0:
plotstate.config(text="Plotting...")
sattrack.scatter(apl, apb, color='#ff8000', s=35,
transform=ccrs.PlateCarree())
sattrack.text(apl, apb, blank * 4 + marker, color='#ff8000',
fontsize=12, fontweight='bold'
, transform=ccrs.PlateCarree())
plotstate.config(text="Reading...")
sattrack.coastlines(resolution='110m')
sattrack.gridlines()
canvas2.draw()
plotstate.config(text="Done !")
plotstate.config(text="Done ! Track plot form: sys=%s sat=%2d interval=%2d"
%(system, satprn, anirat))
def _Plot2polar(self, sattrack, plotstate, canvas2):
T = threading.Thread(
+1 -1
View File
@@ -389,7 +389,7 @@ class MAINGUI:
plt.rc('font', family='Segoe UI')
fig = plt.figure()
self.sattrack = fig.add_subplot(
projection=ccrs.PlateCarree()
projection=ccrs.Mercator()
)
self.sattrack.coastlines(resolution='110m')
self.sattrack.gridlines()
+82 -15
View File
@@ -42,6 +42,13 @@ class OPTGUI:
self.canglebox = None
self.angleentry = None
self.enable = tk.IntVar()
self.trackprn = tk.StringVar()
self.trackint = tk.StringVar()
self.enable.set(int(self.cfg_get['Options_Draw']['Enable of track']))
self.trackprn.set(self.cfg_get['Options_Draw']['Track of prn'])
self.trackint.set(self.cfg_get['Options_Draw']['Track sample rate'])
self.ulinewidth = None
self.nlinewidth = None
self.elinewidth = None
@@ -59,9 +66,9 @@ class OPTGUI:
self.opthwnd = tk.Toplevel(self.hwndparent)
self.opthwnd.title("Options")
self.opthwnd.resizable(0,0)
self.func.Move_center(self.opthwnd,320,250)
self.opthwnd.minsize(320,250)
self.opthwnd.maxsize(320,250)
self.func.Move_center(self.opthwnd,320,280)
self.opthwnd.minsize(320,280)
self.opthwnd.maxsize(320,280)
### Set icon
icon_ico = (b'AAABAAEAICAAAAAAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAADjsAAA47AAAAAA'
b'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
@@ -184,6 +191,9 @@ class OPTGUI:
# Elev option frame
# -------------------------------------------------------------------------------
self.HANGOPT()
# Sat track opt frame
# -------------------------------------------------------------------------------
self.TRACK()
# Syst option frame
# -------------------------------------------------------------------------------
self.SYSOPT()
@@ -252,6 +262,55 @@ class OPTGUI:
self.canglebox.current(int(pos))
self.canglebox.pack(side=tk.RIGHT,anchor='e')
def TRACK(self):
# -------------------------------------------------------------------------------
# >
# Method: TRACK
# Brief : Plot satellite track by dynamic
# Author: @KenanZhu All Right Reserved.
# -------------------------------------------------------------------------------
SattrackFrm = ttk.LabelFrame(self.CalcuFrame, text='Satellite Track', labelanchor='nw')
SattrackFrm.pack(side=tk.TOP, expand=tk.YES, padx='0px', pady='2px', fill=tk.BOTH)
Sattrack = ttk.Frame(SattrackFrm)
Sattrack.pack(side=tk.TOP, expand=tk.YES, padx='0px', pady='0px',fill=tk.X)
SatenableBut = ttk.Checkbutton(
Sattrack,
text='Enable : (s)PRN / Plot Interval',
variable=self.enable,
onvalue=1,
offvalue=0,
command=lambda :self.func.AskOrNotCheck(
self.enable,
RateEntry,
SattprnEntry
)
)
SatenableBut.pack(side=tk.LEFT, anchor='w')
# Interval of track plot
# -------------------------------------------------------------------------------
RateEntry = ttk.Entry(
Sattrack,
width=8,
state=tk.DISABLED,
textvariable=self.trackint,
)
RateEntry.pack(side=tk.RIGHT, anchor='e')
# SPRN of satellite ploted
# -------------------------------------------------------------------------------
SattprnEntry = ttk.Entry(
Sattrack,
width=8,
state=tk.DISABLED,
textvariable=self.trackprn
)
SattprnEntry.pack(side=tk.RIGHT, anchor='e')
if self.enable.get():
RateEntry.config(state=tk.NORMAL)
SattprnEntry.config(state=tk.NORMAL)
def SYSOPT(self):
# -------------------------------------------------------------------------------
# >
@@ -296,7 +355,7 @@ class OPTGUI:
LineoptFrame.pack(side=tk.RIGHT, expand=tk.YES, padx='1px', pady='1px', fill=tk.Y)
EFrame = tk.Frame(LineoptFrame)
EFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='0px')
EFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='2px')
elinewopt = tk.Label(
EFrame,
text='Eline:',
@@ -315,7 +374,7 @@ class OPTGUI:
self.elinewidth.pack(side=tk.LEFT, expand=tk.YES, padx='1px', pady='0px')
NFrame = tk.Frame(LineoptFrame)
NFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='0px')
NFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='2px')
nlinewopt = tk.Label(
NFrame,
text='Nline:',
@@ -334,7 +393,7 @@ class OPTGUI:
self.nlinewidth.pack(side=tk.LEFT, expand=tk.YES, padx='1px', pady='0px')
UFrame = tk.Frame(LineoptFrame)
UFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='0px')
UFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='2px')
ulinewopt = tk.Label(
UFrame,
text='Uline:',
@@ -353,7 +412,7 @@ class OPTGUI:
self.ulinewidth.pack(side=tk.LEFT, expand=tk.YES, padx='1px', pady='0px')
LineCon = tk.Frame(LineoptFrame)
LineCon.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='0px')
LineCon.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='2px')
linewre = ttk.Button(
LineCon,
text='Undo',
@@ -375,11 +434,11 @@ class OPTGUI:
# Author: @KenanZhu All Right Reserved.
# -------------------------------------------------------------------------------
# Satnum plot options#
SatvisFrame = ttk.LabelFrame(self.PlotFrame, text='Satn configs', labelanchor='nw')
SatvisFrame = ttk.LabelFrame(self.PlotFrame, text='SatN configs', labelanchor='nw')
SatvisFrame.pack(side=tk.BOTTOM, expand=tk.YES, padx='1px', pady='1px', fill=tk.BOTH)
SatnFrame = tk.Frame(SatvisFrame)
SatnFrame.pack(side=tk.LEFT, expand=tk.YES, padx='5px', pady='0px')
SatnFrame.pack(side=tk.LEFT, expand=tk.YES, padx='5px', pady='2px')
satncollab = tk.Label(
SatnFrame,
width=5,
@@ -409,7 +468,7 @@ class OPTGUI:
LinecolorFrame.pack(side=tk.LEFT, expand=tk.YES, padx='1px', pady='1px', fill=tk.Y)
EFrame = tk.Frame(LinecolorFrame)
EFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='0px')
EFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='2px')
ecollab = tk.Label(
EFrame,
width=5,
@@ -425,7 +484,7 @@ class OPTGUI:
ecolopt.pack(side=tk.RIGHT, expand=tk.YES, padx='5px', pady='0px')
NFrame = tk.Frame(LinecolorFrame)
NFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='0px')
NFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='2px')
ncollab = tk.Label(
NFrame,
width=5,
@@ -443,7 +502,7 @@ class OPTGUI:
UFrame = tk.Frame(LinecolorFrame)
UFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='0px')
UFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='2px')
ucollab = tk.Label(
UFrame,
width=5,
@@ -460,7 +519,7 @@ class OPTGUI:
ucolopt.pack(side=tk.RIGHT, expand=tk.YES, padx='5px', pady='0px')
ColorCon = tk.Frame(LinecolorFrame)
ColorCon.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='0px')
ColorCon.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='2px')
colorcon = ttk.Button(
ColorCon,
text='Undo',
@@ -496,7 +555,10 @@ class OPTGUI:
text='Confirm',
width=10,
command=lambda :[
self.func.Colorchoose(self.opthwnd, 0, None, 2),
self.func.Colorchoose(
self.opthwnd,
0, None, 2
),
self.func.Linewchoose(
self.elinewidth,
self.nlinewidth,
@@ -507,8 +569,13 @@ class OPTGUI:
self.cionbox,
self.ctrobox,
self.canglebox,
self.systemv
self.systemv,
self.trackprn,
self.trackint
),
self.cfg_get.set('Options_Draw',
'Enable of track',
'%d' % self.enable.get()),
self.opthwnd.destroy()
]
)
+55 -14
View File
@@ -23,10 +23,12 @@ class VIEWGUI:
def __init__(self, hwndparent, func):
# init
# -------------------------------------------------------------------------------
self.text = None
self.func = func
self.hwndparent = hwndparent
self.view = None
self.f_path=""
self.initGUI()
@@ -224,8 +226,13 @@ class VIEWGUI:
### File > Oprn File
filemenu.add_command(
label="Open File",
command=lambda: self.View_windowshow(text, self.view),
accelerator='Ctrl+F'
command=self.View_windowshow,
accelerator='Ctrl+O'
)
filemenu.add_command(
label="Save File",
command=self.Save_file,
accelerator='Ctrl+S'
)
### File > Exit
filemenu.add_command(
@@ -242,7 +249,7 @@ class VIEWGUI:
xbar = tk.Scrollbar(self.view, orient=tk.HORIZONTAL)
xbar.pack(side=tk.BOTTOM, fill=tk.X)
text = tk.Text(
self.text = tk.Text(
self.view,
xscrollcommand=xbar.set,
yscrollcommand=ybar.set,
@@ -251,23 +258,57 @@ class VIEWGUI:
autoseparators=False,
wrap='none'
)
text.pack(side=tk.TOP, fill=tk.BOTH)
ybar.config(command=text.yview)
xbar.config(command=text.xview)
self.text.pack(side=tk.TOP, fill=tk.BOTH)
ybar.config(command=self.text.yview)
xbar.config(command=self.text.xview)
def View_windowshow(self, text, view):
def View_windowshow(self):
# -------------------------------------------------------------------------------
# >
# Method:
# Brief :
# Author: @KenanZhu All Right Reserved.
# -------------------------------------------------------------------------------
f_path = filedialog.askopenfilename(parent=view)
if not f_path:
self.f_path = filedialog.askopenfilename(parent=self.view)
if not self.f_path:
return 0
self.view.title('Viewing: %s' % f_path)
text.delete('1.0', 'end')
with open(f_path, 'r') as f:
self.view.title('Viewing: %s' % self.f_path)
self.text.delete('1.0', 'end')
with open(self.f_path,'r',encoding='utf-8') as f:
fcon = f.read()
text.insert('insert', fcon)
text.config()
self.text.insert('insert', fcon)
self.text.config()
def Save_file(self):
filecontent = self.text.get('1.0', 'end')
if self.f_path:
with open(self.f_path,'w',encoding='utf-8') as f:
f.write(filecontent)
else:
if not filecontent=='\n':
fpath = filedialog.asksaveasfilename(
defaultextension='.txt',
parent=self.view,
title='Save As:',
filetypes=[
('Text File(*.txt)', '*.txt'),
('Solution File(*.ksln)', '*.ksln'),
('Solution File(*.ssln)', '*.ssln'),
('RINEX NAV File(*.*nav.*.hnav.*.gnav.*.qnav.*.*n.*.*g.*.*h.*.*q.*.*p)',
'*.*nav;*.hnav;*.gnav;*.qnav;*.*n;*.*g;*.*h;*.*q;*.*p'),
('RINEX OBS File(*.o*.*.*obs.*.*d)', '*.*o;*.*obs;*.*d'),
('All Files', '*.*')])
try:
with open(fpath,'w',encoding='utf-8') as f:
f.write(filecontent)
except FileNotFoundError:
self.view.title('Fail to save: %s' % fpath)
return
self.view.title('Viewing : %s' % fpath)
else:
return