Skip to content

Commit

Permalink
3.2.1: FOIF total station import added and update Nikon RAW import
Browse files Browse the repository at this point in the history
  • Loading branch information
zvezdochiot committed Oct 30, 2022
1 parent 81bbf74 commit 3271cc7
Show file tree
Hide file tree
Showing 33 changed files with 9,519 additions and 30 deletions.
16 changes: 8 additions & 8 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ TCL_CRUNCHER = cat
#-----------------------------------------------------------------------
GE_SOURCES = adjgeo.tcl animate.tcl arcgeo.tcl calcgeo.tcl com_easy.tcl \
dtmgeo.tcl dxfgeo.tcl gamaxml.tcl gc3.tcl geodimet.tcl graphgeo.tcl \
grid.tcl helpgeo.tcl icons.tcl idex.tcl lbgeo.tcl leica.tcl loadgeo.tcl \
maskgeo.tcl nikon.tcl profigeo.tcl proj.tcl reggeo.tcl sdr.tcl sokkia.tcl \
survce.tcl topcon.tcl trackmaker.tcl transgeo.tcl travgeo.tcl trimble.tcl \
xmlgeo.tcl zsenigeo.tcl sqlgeo.tcl \
grid.tcl foif.tcl helpgeo.tcl icons.tcl idex.tcl lbgeo.tcl leica.tcl \
loadgeo.tcl maskgeo.tcl nikon.tcl profigeo.tcl proj.tcl reggeo.tcl \
sdr.tcl sokkia.tcl survce.tcl topcon.tcl trackmaker.tcl transgeo.tcl \
travgeo.tcl trimble.tcl xmlgeo.tcl zsenigeo.tcl sqlgeo.tcl \
geo_easy.tcl
CE_SOURCES = com_easy.tcl helpgeo.tcl maincom_easy.tcl
#
# tcldoc cannot process gamaxml.tcl, it is removed from doc sources :(
DOC_SOURCES = adjgeo.tcl animate.tcl arcgeo.tcl calcgeo.tcl com_easy.tcl \
dtmgeo.tcl dxfgeo.tcl gc3.tcl geodimet.tcl graphgeo.tcl \
grid.tcl helpgeo.tcl icons.tcl idex.tcl lbgeo.tcl leica.tcl loadgeo.tcl \
maskgeo.tcl nikon.tcl profigeo.tcl proj.tcl reggeo.tcl sdr.tcl sokkia.tcl \
survce.tcl topcon.tcl trackmaker.tcl transgeo.tcl travgeo.tcl trimble.tcl \
xmlgeo.tcl zsenigeo.tcl sqlgeo.tcl \
grid.tcl foif.tcl helpgeo.tcl icons.tcl idex.tcl lbgeo.tcl leica.tcl \
loadgeo.tcl maskgeo.tcl nikon.tcl profigeo.tcl proj.tcl reggeo.tcl \
sdr.tcl sokkia.tcl survce.tcl topcon.tcl trackmaker.tcl transgeo.tcl \
travgeo.tcl trimble.tcl xmlgeo.tcl zsenigeo.tcl sqlgeo.tcl \
geo_easy.tcl
#
# files for debian package
Expand Down
17 changes: 9 additions & 8 deletions src/animate.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
# @param rw name of top level window
# @return none
proc init_animate {rw} {
global animate geoEasyMsg
global animate geoEasyMsg
global tcl_platform
global home
global f1_icon f2_icon
global globe_icon
global icon_status
global f1_icon f2_icon
global globe_icon
global icon_status

if {! [info exists icon_status]} {
source $home/icons.tcl
Expand Down Expand Up @@ -51,9 +51,9 @@ proc init_animate {rw} {
# @param option on/off
# @return none
proc Animate {w option} {
global animate
global animate

switch -exact $option {
switch -exact $option {
on {
set animate(curBitmap) $animate(lastBitmap)
update
Expand All @@ -66,13 +66,14 @@ proc Animate {w option} {
#
# Continue with next bitmap
#
if { $animate(curBitmap) >= 0 } {
if { $animate(curBitmap) >= 0 } {
set bmap [format globe_%0.2d $animate(curBitmap)]
catch "$w configure -image $bmap"
incr animate(curBitmap)
if { $animate(curBitmap) >= 29 } {
set animate(curBitmap) 0
}
after 100 Animate $w continue
}
}
}

4 changes: 2 additions & 2 deletions src/com_easy.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -709,8 +709,8 @@ proc tk_optMenu {w varName args} {
# Display About dialog box
proc ComAbout {} {
global comEasyMsg
global about_icon
global icon_status
global about_icon
global icon_status

set w [focus]
if {$w == ""} { set w "." }
Expand Down
237 changes: 237 additions & 0 deletions src/foif.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
#
# Copyright (C) 2017 Zoltan Siki siki1958 (at) gmail (dot) com
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

# Read in FOIF data files into memory
# Input data format (field separator is comma), used fields marked by *
# first character defines the recond type
#
# header record (first line)
# space
# file name *
# point count
# point count with deleted points
# year *
# month *
# day *
# hour *
# minute *
# second *
# target type
# distance measure mode
# prism type
# prism constant
# pressure
# temperature
# average elevation
# PPM
# orientation marker
#
# Station (occupied point)
# A
# point number *
# N *
# E *
# Z *
# instrument height *
# position mark
# year
# month
# day
# hour
# minute
# second
#
# orientation point
# B
# point number *
# instruction
# N
# E
# Z
#
# angle and distance measure
# F/G
# point number *
# horizontal angle * (half second unit)
# vertical angle * (half second unit)
# horizontal distance
# slope distance *
# height difference
# prism height *
# N *
# E *
# Z *
# measure status mark
# position mark
# year
# month
# day
# hour
# minute
# second
#
# @param fn path to FOIF file
# @param fa internal name of dataset
# @return 0 on success
proc Foif {fn fa} {
global reg
global geoEasyMsg
global RO

if {[string length $fa] == 0} {return -1}
global ${fa}_geo ${fa}_coo ${fa}_ref ${fa}_par
if {[catch {set f1 [open $fn r]}] != 0} {
return -1 ;# cannot open input file
}
set ${fa}_par [list [list 55 "FOIF"]]
set lines 0 ;# number of lines in output
set src 1 ;# input line number
set points 0 ;# number of points in coord list
# get header
if {[gets $f1 header] == 0} { return }
if {[string index $header 0] != " "} { return $src } ;# invalid header
set bl [split [string trim $header] ","]
set ${fa}_par [list [list 51 "[lindex $bl 3]-[lindex $bl 4]-[lindex $bl 5]"]]
set ${fa}_par [list [list 52 "[lindex $bl 6]:[lindex $bl 7]:[lindex $bl 8]"]]
set prev_sd 0
set prev_ha -1
set prev_va -1
while {! [eof $f1]} {
incr src
if {[gets $f1 buf] == 0} continue
set bl [split [string trim $buf] ","] ;# comma separated
set buflist ""
foreach a $bl {
lappend buflist [string trim $a]
}
set n [llength $buflist]

if {$n == 0} { continue } ;# empty line
set obuf "" ;# output buffer
switch -exact [lindex $buflist 0] {
A {
# station
set pn [lindex $buflist 1]
set x [lindex $buflist 2]
set y [lindex $buflist 3]
set z ""
if {[string length [lindex $buflist 4]]} {
set z [lindex $buflist 4]
}
set ih [lindex $buflist 5]
AddCoo $fa $pn $x $y $z
lappend obuf [list 2 $pn] ;# station number
lappend obuf [list 3 $ih] ;# instrument height
}
B -
H {
# orientation/reference target
set pn [lindex $buflist 1]
set x [lindex $buflist 3]
set y [lindex $buflist 4]
set z ""
if {[string length [lindex $buflist 5]]} {
set z [lindex $buflist 5]
}
AddCoo $fa $pn $x $y $z
}
C -
D -
E {
# orientation measure/orientaion result/orientation adjusment/
}
F -
G {
# angle and distance measurement
set pn [lindex $buflist 1]
set ha [expr {[lindex $buflist 2] / 2.0 / $RO}]
set va [expr {[lindex $buflist 3] / 2.0 / $RO}]
set sd [lindex $buflist 5]
set th [lindex $buflist 7]
set x [lindex $buflist 8]
set y [lindex $buflist 9]
set z ""
if {[string length [lindex $buflist 10]]} {
set z [lindex $buflist 10]
}
AddCoo $fa $pn $x $y $z
lappend obuf [list 5 $pn]
lappend obuf [list 7 $ha] ;# horizontal angle
lappend obuf [list 8 $va] ;# zenith angle
if {$sd > 0.1 && ([expr {abs($sd - $prev_sd)}] > 0.1 || \
([expr {abs($ha - $prev_ha)}] < 0.001 &&
[expr {abs($va - $prev_va)}] < 0.001))} {
# store distance if it changes or the same direction (3')
lappend obuf [list 9 $sd] ;# slope distance
}
lappend obuf [list 6 $th]
set prev_sd $sd
set prev_ha $ha
set prev_va $va
}
}

if {[llength $obuf] > 1} {
# check numeric values
foreach l $obuf {
if {[lsearch -exact \
{3 6 7 8 9 10 11 21 24 25 26 27 28 29 37 38 39 49} \
[lindex $l 0]] != -1 && \
[regexp $reg(2) [lindex $l 1]] == 0} {
return $src
}
}
set face2 0
if {[string length [GetVal 5 $obuf]] > 0} { ;# observation record
# average of two faces
set li [expr {$lines - 1}]
while {$li > 0} {
if {[string length \
[GetVal 2 [set ${fa}_geo($li)]]] != 0} {
break ;# stop previous station record reached
}
if {[GetVal 5 [set ${fa}_geo($li)]] == $pn} {
# really second face?
set obuf1 [set ${fa}_geo($li)]
set avgbuf [AvgFaces $obuf1 $obuf]
if {[llength $avgbuf]} {
set face2 1
} else {
GeoLog1 [format $geoEasyMsg(noface2) \
[GetVal {5 62} $obuf]]
}
break
}
incr li -1
}
}
if {$face2} {
#store average for 2 faces
set ${fa}_geo($li) $avgbuf
} else {
set ${fa}_geo($lines) $obuf
if {[info exists ${fa}_ref($pn)] == -1} {
set ${fa}_ref($pn) $lines
} else {
lappend ${fa}_ref($pn) $lines
}
incr lines
}
}
}
close $f1
return 0
}
8 changes: 5 additions & 3 deletions src/geo_easy.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ proc GeoEasy {top} {
global geoEasyMsg
global geoLoaded geoLoadedDir
global tinLoaded
global f1_icon f2_icon about_icon zoom_in_icon zoom_out_icon zoom_prev_icon pan_icon area_icon newp_icon ruler_icon sp1_icon reg_icon zdtm_icon breakline_icon hole_icon xchgtri_icon
global icon_status
global f1_icon f2_icon about_icon zoom_in_icon zoom_out_icon zoom_prev_icon pan_icon area_icon newp_icon ruler_icon sp1_icon reg_icon zdtm_icon breakline_icon hole_icon xchgtri_icon
global icon_status
global PI PI2 RO R PISEC PI2SEC FOOT2M OL2M SEC2CC E
global topw
global logName
Expand Down Expand Up @@ -993,7 +993,9 @@ proc MenuLoad {w {def ""}} {
*.raw {
set res [NikonRAW $fn $f]
}

*.mes {
set res [Foif $fn $f]
}
*.dxf {
set res [GeoDXFin $fn $f]
}
Expand Down
4 changes: 2 additions & 2 deletions src/helpgeo.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ proc GeoAbout {} {
global tcl_platform
global build_date
global home
global f1_icon f2_icon about_icon zoom_in_icon zoom_out_icon zoom_prev_icon pan_icon area_icon newp_icon ruler_icon sp1_icon reg_icon zdtm_icon breakline_icon hole_icon xchgtri_icon
global icon_status
global f1_icon f2_icon about_icon zoom_in_icon zoom_out_icon zoom_prev_icon pan_icon area_icon newp_icon ruler_icon sp1_icon reg_icon zdtm_icon breakline_icon hole_icon xchgtri_icon
global icon_status

if {! [info exists icon_status]} {
source $home/icons.tcl
Expand Down
1 change: 1 addition & 0 deletions src/i18n/geo_easy.cze
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ set fileTypes {
{"n4ce txt" {.n4c N4C}}
{"Nikon DTM-300" {.nik .NIK}}
{"Nikon RAW format" {.raw .RAW}}
{"FOIF format" {.mes .MES}}
{"Geodat 124" {.gdt .GDT}}
{"GeoProfi" {.mjk .MJK}}
{"Souřadnice GeoProfi" {.eov .szt .her .hkr .hdr .EOV .SZT .HER .HKR .HDR}}
Expand Down
1 change: 1 addition & 0 deletions src/i18n/geo_easy.eng
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ set fileTypes {
{"n4ce txt format" {.n4c N4C}}
{"Nikon DTM-300 format" {.nik .NIK}}
{"Nikon RAW format" {.raw .RAW}}
{"FOIF format" {.mes .MES}}
{"Geodat 124 format" {.gdt .GDT}}
{"GeoProfi format" {.mjk .MJK}}
{"GeoProfi coordinates" {.eov .szt .her .hkr .hdr .EOV .SZT .HER .HKR .HDR}}
Expand Down
1 change: 1 addition & 0 deletions src/i18n/geo_easy.es
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ set fileTypes {
{"Formato n4ce txt" {.n4c N4C}}
{"Formato Nikon DTM-300" {.nik .NIK}}
{"Formato Nikon RAW" {.raw .RAW}}
{"Formato FOIF" {.mes .MES}}
{"Formato Geodat 124" {.gdt .GDT}}
{"Formato GeoProfi" {.mjk .MJK}}
{"Cordenadas GeoProfi" {.eov .szt .her .hkr .hdr .EOV .SZT .HER .HKR .HDR}}
Expand Down
1 change: 1 addition & 0 deletions src/i18n/geo_easy.ger
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ set fileTypes {
{"n4ce txt Format" {.n4c N4C}}
{"Nikon DTM-300 Format" {.nik .NIK}}
{"Nikon RAW format" {.raw .RAW}}
{"FOIF format" {.mes .MES}}
{"Geodat 124 Format" {.gdt .GDT}}
{"GeoProfi Format" {.mjk .MJK}}
{"GeoProfi Koordinaten" {.eov .szt .her .hkr .hdr .EOV .SZT .HER .HKR .HDR}}
Expand Down
1 change: 1 addition & 0 deletions src/i18n/geo_easy.hun
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ set fileTypes {
{"n4ce szöveg formátum" {.n4c .N4C}}
{"Nikon DTM-300 formátum" {.nik .NIK}}
{"Nikon RAW formátum" {.raw .RAW}}
{"FOIF formátum" {.mes .MES}}
{"Geodat 124 formátum" {.gdt .GDT}}
{"GeoProfi formátum" {.mjk .MJK}}
{"GeoProfi koordináták" {.eov .szt .her .hkr .hdr .EOV .SZT. .HER .HKR .HDR}}
Expand Down
Loading

0 comments on commit 3271cc7

Please sign in to comment.