Skip to content

Commit

Permalink
Updated virtual tie points (3.0 -> 4.0), added thread local storage
Browse files Browse the repository at this point in the history
  • Loading branch information
mrihtar committed Nov 24, 2018
1 parent 0d84b37 commit 633544d
Show file tree
Hide file tree
Showing 44 changed files with 9,723 additions and 3,933 deletions.
33 changes: 19 additions & 14 deletions Makefile.mingw
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# For GNU make
SHELL = %SystemRoot%/System32/cmd.exe
# Use //switch instead of /switch for Windows commands' switches
#SHELL = %SystemRoot%/System32/cmd.exe
CC = gcc
CXX = g++
LD = ld
AR = ar
RANLIB = ranlib
RC = windres
RM = del /q
CP = copy /y
RM = rm -f
CP = cp

DEBUG = -O2
#DEBUG = -g
Expand All @@ -20,34 +21,38 @@ LPATH =
LIBS =
XLDFLAGS = -mwindows -s
#XLDFLAGS = -mwindows
XLPATH = -Lfltk\lib
XLPATH = -Lfltk/lib
XLIBS = -lfltk_images -lfltk -lfltk_png -lfltk_z -lfltk_jpeg -lpthread -lole32 -luuid -lcomctl32

TGTS = gk-slo.exe gk-shp.exe xgk-slo.exe
WOBJS = gk-slo.o conv_xyz.o util.o geo.o
SOBJS = gk-shp.o conv_shp.o util.o geo.o
INCL = common.h geo.h geoid_slo.h geoid_egm.h aft_gktm.h aft_tmgk.h
SHPOBJS = shapelib\shpopen.o shapelib\dbfopen.o shapelib\safileio.o shapelib\shptree.o
SHPINCL = shapelib\shapefil.h
SHPOBJS = shapelib/shpopen.o shapelib/dbfopen.o shapelib/safileio.o shapelib/shptree.o
SHPINCL = shapelib/shapefil.h
XOBJS = xgk-slo.o conv_xyz.o conv_shp.o util.o geo.o
XINCL =
XINCL = deelx.h
YOBJS = flo.o

.SUFFIXES: .cxx

all: $(TGTS)

gk-slo.exe: $(WOBJS)
-taskkill /F /IM $@
-taskkill //F //IM $@ //T
$(CC) -o $@ $(WOBJS) $(LDFLAGS) $(LPATH) $(LIBS)

gk-shp.exe: $(SOBJS) $(SHPOBJS)
-taskkill /F /IM $@
-taskkill //F //IM $@ //T
$(CC) -o $@ $(SOBJS) $(SHPOBJS) $(LDFLAGS) $(LPATH) $(LIBS)

xgk-slo.exe: $(XOBJS) $(SHPOBJS) xgk-slo.rc globe.ico
-taskkill /F /IM $@
-taskkill //F //IM $@ //T
$(RC) $(@:.exe=).rc $(@:.exe=).res.o
$(CXX) -o $@ $(XOBJS) $(SHPOBJS) $(@:.exe=).res.o $(XLDFLAGS) $(XLPATH) $(XLIBS)
flo.exe: $(YOBJS)
-taskkill //F //IM $@ //T
$(CXX) -o $@ $(YOBJS) $(XLDFLAGS) $(XLPATH) $(XLIBS)

$(WOBJS): $(INCL)
$(SOBJS): $(INCL)
Expand All @@ -56,18 +61,18 @@ $(XOBJS): $(XINCL)

test: $(TGTS)
gk-slo.exe -x > gk-slo.tmp
fc /l gk-slo.tmp refout-slo.txt
fc //l gk-slo.tmp refout-slo.txt
gk-slo.exe -x -g egm > gk-slo.tmp
fc /l gk-slo.tmp refout-egm.txt
fc //l gk-slo.tmp refout-egm.txt
@$(RM) gk-slo.tmp > NUL

install: $(TGTS)
@echo Copy gk-slo.exe, gk-shp.exe and xgk-slo.exe to a directory of your choice

clean:
-$(RM) $(WOBJS) $(SOBJS) $(SHPOBJS) $(XOBJS) *.res.o 2> NUL
-$(RM) $(WOBJS) $(SOBJS) $(SHPOBJS) $(XOBJS) *.res.o
cleanall: clean
-$(RM) $(TGTS) 2> NUL
-$(RM) $(TGTS)

.c.o:
$(CC) $(DEBUG) -c $(CFLAGS) $(IPATH) $< -o $@
Expand Down
4 changes: 2 additions & 2 deletions PREBERIME.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ For English version of this file see [README.md].
nadomestilo za uradni program za konverzijo [SiTra] &#40;s Helmertovimi
parametri za vso Slovenijo, brez regionalnih parametrov&#41; ali natančnejši,
če se uporabi vgrajena afina/trikotniška transformacija z referenčnimi
[virtualnimi veznimi točkami v3.0] &#40;za natančen opis glej [AFT.md]&#41;,
[virtualnimi veznimi točkami v4.0] &#40;za natančen opis glej [AFT.md]&#41;,
kar je podobno kot pri uradnem programu za konverzijo [3Tra].

<img src="images/GCC-Cover-Image.gif" width="660px">
Expand Down Expand Up @@ -323,7 +323,7 @@ lažje odpiranje v GIS programih.
[SiTra]: http://sitra.sitranet.si
[SiTraNet]: http://sitranet.si
[LIDAR]: http://www.evode.gov.si/podatki/lidar-podatki/
[virtualnimi veznimi točkami v3.0]: http://www.e-prostor.gov.si/zbirke-prostorskih-podatkov/drzavni-koordinatni-sistem/horizontalni-drzavni-koordinatni-sistem-d48gk/#tab2-1025
[virtualnimi veznimi točkami v4.0]: http://www.e-prostor.gov.si/zbirke-prostorskih-podatkov/drzavni-koordinatni-sistem/transformacija-v-novi-koordinatni-sistem/#tab2-1177
[AFT.md]: https://github.com/mrihtar/GeoCoordinateConverter/blob/master/aft/PREBERIME.md
[3Tra]: http://www.e-prostor.gov.si/zbirke-prostorskih-podatkov/drzavni-koordinatni-sistem/transformacija-v-novi-koordinatni-sistem/#tab2-1177
[ESRI shapefile]: https://en.wikipedia.org/wiki/Shapefile
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Za slovensko verzijo te datoteke glej [PREBERIME.md].
as a replacement for the official conversion program [SiTra] &#40;with
Helmert parameters for the whole Slovenia, no regional parameters&#41;
or more precise when used with the built-in affine/triangle-based
transformation using the reference [virtual tie points v3.0] &#40;for
transformation using the reference [virtual tie points v4.0] &#40;for
detailed description see [AFT.md]&#41;, which is similar as the official
conversion program [3Tra].

Expand Down Expand Up @@ -323,7 +323,7 @@ files can be easily opened by GIS programs.
[SiTra]: http://sitra.sitranet.si
[SiTraNet]: http://sitranet.si
[LIDAR]: http://www.evode.gov.si/podatki/lidar-podatki/
[virtual tie points v3.0]: http://www.e-prostor.gov.si/zbirke-prostorskih-podatkov/drzavni-koordinatni-sistem/horizontalni-drzavni-koordinatni-sistem-d48gk/#tab2-1025
[virtual tie points v4.0]: http://www.e-prostor.gov.si/zbirke-prostorskih-podatkov/drzavni-koordinatni-sistem/transformacija-v-novi-koordinatni-sistem/#tab2-1177
[AFT.md]: https://github.com/mrihtar/GeoCoordinateConverter/blob/master/aft/README.md
[3Tra]: http://www.e-prostor.gov.si/zbirke-prostorskih-podatkov/drzavni-koordinatni-sistem/transformacija-v-novi-koordinatni-sistem/#tab2-1177
[ESRI shapefile]: https://en.wikipedia.org/wiki/Shapefile
Expand Down
13 changes: 8 additions & 5 deletions aft/Makefile.mingw
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# For GNU make
SHELL = %SystemRoot%/System32/cmd.exe
# Use //switch instead of /switch for Windows commands' switches
#SHELL = %SystemRoot%/System32/cmd.exe
CC = gcc
CXX = g++
LD = ld
AR = ar
RANLIB = ranlib
RC = windres
RM = del /q
CP = copy /y
RM = rm -f
CP = cp

DEBUG = -O2
#DEBUG = -g
Expand All @@ -20,8 +21,8 @@ LPATH =
LIBS =

TGTS = ctt.exe triangle.exe
WOBJS = ctt.o ..\util.o
INCL = ..\common.h ..\geo.h
WOBJS = ctt.o ../util.o
INCL = ../common.h ../geo.h
TRIOBJS = triangle.o
TRIINCL = triangle.h

Expand All @@ -30,9 +31,11 @@ TRIINCL = triangle.h
all: $(TGTS)

ctt.exe: $(WOBJS)
-taskkill //F //IM $@ //T
$(CC) -o $@ $(WOBJS) $(LDFLAGS) $(LPATH) $(LIBS)

triangle.exe: $(TRIOBJS)
-taskkill //F //IM $@ //T
$(CC) -o $@ $(TRIOBJS) $(LDFLAGS) $(LPATH) $(LIBS)

$(WOBJS): $(INCL)
Expand Down
8 changes: 4 additions & 4 deletions aft/PREBERIME.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Ta sistem lahko rešimo z eliminacijsko metodo (operacije nad vrsticami ⇒
identična matrika) ali z drugimi metodami (Jacobi, Gauss-Seidel, ...).

### Predizračun
Za Slovenijo imamo 899 referenčnih [virtualih veznih točk] &#40;v3.0&#41; v
Za Slovenijo imamo 899 referenčnih [virtualih veznih točk] &#40;v4.0&#41; v
obeh koordinatnih systemih (GK in TM), ki formirajo 1776 trikotnikov:

<img src="../images/Slovenia-tie-points.gif" width="400px">
Expand All @@ -51,7 +51,7 @@ natančne Delaunayeve triangulacije.

#### Natančen opis procesa
- pridobi referenčne [virtualne vezne točke] &#40;že priložene&#41;:
⇒ datoteka ```virtualne_vezne_tocke_v3.0.txt```
⇒ datoteka ```virtualne_vezne_tocke_v4.0.txt```
- ekstraktaj GK in TM koordinate iz referenčne datoteke
- uporabi program [triangle] za kreiranje trikotnikov
- uporabi priložen program ```ctt``` za kreiranje tabel, ki se bodo vključile v program:
Expand All @@ -72,7 +72,7 @@ s parametri ```a..f``` (glej **Teorija** zgoraj).


[README.md]: https://github.com/mrihtar/GeoCoordinateConverter/blob/master/aft/README.md
[virtualih veznih točk]: http://www.e-prostor.gov.si/zbirke-prostorskih-podatkov/drzavni-koordinatni-sistem/horizontalni-drzavni-koordinatni-sistem-d48gk/#tab2-1025
[virtualne vezne točke]: http://www.e-prostor.gov.si/zbirke-prostorskih-podatkov/drzavni-koordinatni-sistem/horizontalni-drzavni-koordinatni-sistem-d48gk/#tab2-1025
[virtualih veznih točk]: http://www.e-prostor.gov.si/zbirke-prostorskih-podatkov/drzavni-koordinatni-sistem/transformacija-v-novi-koordinatni-sistem/#tab2-1177
[virtualne vezne točke]: http://www.e-prostor.gov.si/zbirke-prostorskih-podatkov/drzavni-koordinatni-sistem/transformacija-v-novi-koordinatni-sistem/#tab2-1177
[triangle]: http://www.cs.cmu.edu/~quake/triangle.html
[geo_api.md]: https://github.com/mrihtar/GeoCoordinateConverter/blob/master/geo_api.md
6 changes: 3 additions & 3 deletions aft/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ This system can be solved using elimination method (row operations ⇒ identity
matrix) or with other methods (Jacobi, Gauss-Seidel, ...).

### Pre-calculation
For Slovenia we have 899 reference [virtual tie points] &#40;v3.0&#41; in both
For Slovenia we have 899 reference [virtual tie points] &#40;v4.0&#41; in both
coordinate systems (GK and TM), which form 1776 triangles:

<img src="../images/Slovenia-tie-points.gif" width="400px">
Expand All @@ -52,7 +52,7 @@ exact Delaunay triangulations.

#### Exact description of process
- get the reference [virtual tie points] &#40;already supplied&#41;:
⇒ file ```virtualne_vezne_tocke_v3.0.txt```
⇒ file ```virtualne_vezne_tocke_v4.0.txt```
- extract GK and TM coordinates from the reference file
- use [triangle] program to create triangles
- use the supplied program ```ctt``` to create tables to be included in a program:
Expand All @@ -74,6 +74,6 @@ When/if such triangle is found, a simple transformation using parameters


[PREBERIME.md]: https://github.com/mrihtar/GeoCoordinateConverter/blob/master/aft/PREBERIME.md
[virtual tie points]: http://www.e-prostor.gov.si/zbirke-prostorskih-podatkov/drzavni-koordinatni-sistem/horizontalni-drzavni-koordinatni-sistem-d48gk/#tab2-1025
[virtual tie points]: http://www.e-prostor.gov.si/zbirke-prostorskih-podatkov/drzavni-koordinatni-sistem/transformacija-v-novi-koordinatni-sistem/#tab2-1177
[triangle]: http://www.cs.cmu.edu/~quake/triangle.html
[geo_api.md]: https://github.com/mrihtar/GeoCoordinateConverter/blob/master/geo_api.md
8 changes: 4 additions & 4 deletions aft/ctt.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// GK - Converter between Gauss-Krueger/TM and WGS84 coordinates for Slovenia
// Copyright (c) 2014-2016 Matjaz Rihtar <[email protected]>
// Copyright (c) 2014-2018 Matjaz Rihtar <[email protected]>
// All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
Expand All @@ -21,7 +21,7 @@
#include "geo.h"

#define SW_VERSION "2.07"
#define SW_BUILD "Oct 20, 2016"
#define SW_BUILD "Nov 24, 2018"

typedef struct triang {
int t1, t2, t3;
Expand Down Expand Up @@ -183,7 +183,7 @@ void print_header(FILE *out, char *outname)
char *errtxt;

fprintf(out, "// GK - Converter between Gauss-Krueger/TM and WGS84 coordinates for Slovenia\n");
fprintf(out, "// Copyright (c) 2014-2016 Matjaz Rihtar <[email protected]>\n");
fprintf(out, "// Copyright (c) 2014-2018 Matjaz Rihtar <[email protected]>\n");
fprintf(out, "// All rights reserved.\n");
fprintf(out, "//\n");
fprintf(out, "// This program is free software: you can redistribute it and/or modify\n");
Expand Down Expand Up @@ -216,7 +216,7 @@ void print_header(FILE *out, char *outname)
// ----------------------------------------------------------------------------
void usage(int ver_only)
{
fprintf(stderr, "%s %s Copyright (c) 2014-2016 Matjaz Rihtar (%s)\n",
fprintf(stderr, "%s %s Copyright (c) 2014-2018 Matjaz Rihtar (%s)\n",
prog, SW_VERSION, SW_BUILD);
if (ver_only) return;
fprintf(stderr, "Usage: %s [<options>] <gknodename> <tmnodename> <elename>\n", prog);
Expand Down
4 changes: 2 additions & 2 deletions aft/cvvt.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ if not exist %awk% echo There is a problem with %awk%
@rem
@rem Extract GK points from GURS data
@rem
%awk% -f extgk.awk virtualne_vezne_tocke_v3.0.txt > vvt-gk.node
%awk% -f extgk.awk virtualne_vezne_tocke_v4.0.txt > vvt-gk.node
if errorlevel 1 exit /b 1
.\triangle.exe vvt-gk.node
if errorlevel 1 exit /b 1
@rem
@rem Extract TM points from GURS data
@rem
%awk% -f exttm.awk virtualne_vezne_tocke_v3.0.txt > vvt-tm.node
%awk% -f exttm.awk virtualne_vezne_tocke_v4.0.txt > vvt-tm.node
if errorlevel 1 exit /b 1
.\triangle.exe vvt-tm.node
if errorlevel 1 exit /b 1
Expand Down
4 changes: 2 additions & 2 deletions aft/cvvt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#
# Extract GK points from GURS data
#
awk -f extgk.awk virtualne_vezne_tocke_v3.0.txt > vvt-gk.node
awk -f extgk.awk virtualne_vezne_tocke_v4.0.txt > vvt-gk.node
[ $? -ne 0 ] && exit 1
./triangle vvt-gk.node
[ $? -ne 0 ] && exit 1
#
# Extract TM points from GURS data
#
awk -f exttm.awk virtualne_vezne_tocke_v3.0.txt > vvt-tm.node
awk -f exttm.awk virtualne_vezne_tocke_v4.0.txt > vvt-tm.node
[ $? -ne 0 ] && exit 1
./triangle vvt-tm.node
[ $? -ne 0 ] && exit 1
Expand Down
Loading

0 comments on commit 633544d

Please sign in to comment.