annotate pkg/imports/modelconvert.go @ 2563:dc4fae4bdb8f

Expose axis snapping tolerance to users
author Tom Gottfried <tom@intevation.de>
date Fri, 08 Mar 2019 19:15:47 +0100
parents 09f9ae3d0526
children a10022399e24
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2038
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 // This is Free Software under GNU Affero General Public License v >= 3.0
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2 // without warranty, see README.md and license for details.
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 //
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4 // SPDX-License-Identifier: AGPL-3.0-or-later
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 // License-Filename: LICENSES/AGPL-3.0.txt
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6 //
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7 // Copyright (C) 2018 by via donau
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 // – Österreichische Wasserstraßen-Gesellschaft mbH
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 // Software engineering by Intevation GmbH
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 //
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 // Author(s):
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 // * Sascha L. Teichmann <sascha.teichmann@intevation.de>
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 package imports
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 import (
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 "gemma.intevation.de/gemma/pkg/models"
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18 )
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19
2040
f1e32babb587 Imports: Moved constructor functions for import models to a table in the import package to be re-used by the configure/scheduled import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2038
diff changeset
20 var kindToImportModel = map[JobKind]func() interface{}{
f1e32babb587 Imports: Moved constructor functions for import models to a table in the import package to be re-used by the configure/scheduled import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2038
diff changeset
21 BNJobKind: func() interface{} { return new(models.BottleneckImport) },
f1e32babb587 Imports: Moved constructor functions for import models to a table in the import package to be re-used by the configure/scheduled import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2038
diff changeset
22 GMJobKind: func() interface{} { return new(models.GaugeMeasurementImport) },
f1e32babb587 Imports: Moved constructor functions for import models to a table in the import package to be re-used by the configure/scheduled import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2038
diff changeset
23 FAJobKind: func() interface{} { return new(models.FairwayAvailabilityImport) },
f1e32babb587 Imports: Moved constructor functions for import models to a table in the import package to be re-used by the configure/scheduled import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2038
diff changeset
24 WXJobKind: func() interface{} { return new(models.WaterwayAxisImport) },
f1e32babb587 Imports: Moved constructor functions for import models to a table in the import package to be re-used by the configure/scheduled import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2038
diff changeset
25 WAJobKind: func() interface{} { return new(models.WaterwayAreaImport) },
f1e32babb587 Imports: Moved constructor functions for import models to a table in the import package to be re-used by the configure/scheduled import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2038
diff changeset
26 WGJobKind: func() interface{} { return new(models.WaterwayGaugeImport) },
f1e32babb587 Imports: Moved constructor functions for import models to a table in the import package to be re-used by the configure/scheduled import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2038
diff changeset
27 DMVJobKind: func() interface{} { return new(models.DistanceMarksVirtualImport) },
f1e32babb587 Imports: Moved constructor functions for import models to a table in the import package to be re-used by the configure/scheduled import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2038
diff changeset
28 FDJobKind: func() interface{} { return new(models.FairwayDimensionImport) },
f1e32babb587 Imports: Moved constructor functions for import models to a table in the import package to be re-used by the configure/scheduled import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2038
diff changeset
29 DMAJobKind: func() interface{} { return new(models.DistanceMarksAshoreImport) },
f1e32babb587 Imports: Moved constructor functions for import models to a table in the import package to be re-used by the configure/scheduled import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2038
diff changeset
30 STJobKind: func() interface{} { return new(models.StretchImport) },
f1e32babb587 Imports: Moved constructor functions for import models to a table in the import package to be re-used by the configure/scheduled import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2038
diff changeset
31 }
f1e32babb587 Imports: Moved constructor functions for import models to a table in the import package to be re-used by the configure/scheduled import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2038
diff changeset
32
2042
d29ac997eb34 This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2040
diff changeset
33 func ImportModelForJobKind(kind JobKind) func() interface{} {
d29ac997eb34 This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2040
diff changeset
34 return kindToImportModel[kind]
d29ac997eb34 This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2040
diff changeset
35 }
d29ac997eb34 This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2040
diff changeset
36
2038
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 var convertModel = map[JobKind]func(interface{}) interface{}{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 BNJobKind: func(input interface{}) interface{} {
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 bi := input.(*models.BottleneckImport)
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 return &Bottleneck{
2563
dc4fae4bdb8f Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents: 2058
diff changeset
42 URL: bi.URL,
dc4fae4bdb8f Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents: 2058
diff changeset
43 Tolerance: bi.Tolerance,
dc4fae4bdb8f Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents: 2058
diff changeset
44 Insecure: bi.Insecure,
2038
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
45 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46 },
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 GMJobKind: func(input interface{}) interface{} {
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49 gi := input.(*models.GaugeMeasurementImport)
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50 return &GaugeMeasurement{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51 URL: gi.URL,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52 Insecure: gi.Insecure,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54 },
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56 FAJobKind: func(input interface{}) interface{} {
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 fai := input.(*models.FairwayAvailabilityImport)
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58 return &FairwayAvailability{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59 URL: fai.URL,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60 Insecure: fai.Insecure,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62 },
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64 WXJobKind: func(input interface{}) interface{} {
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
65 wxi := input.(*models.WaterwayAxisImport)
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66 return &WaterwayAxis{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67 URL: wxi.URL,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68 FeatureType: wxi.FeatureType,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69 SortBy: nilString(wxi.SortBy),
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71 },
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
73 WAJobKind: func(input interface{}) interface{} {
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 wai := input.(*models.WaterwayAreaImport)
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75 return &WaterwayArea{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76 URL: wai.URL,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
77 FeatureType: wai.FeatureType,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 SortBy: nilString(wai.SortBy),
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
80 },
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
81
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
82 WGJobKind: func(input interface{}) interface{} {
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83 wgi := input.(*models.WaterwayGaugeImport)
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84 return &WaterwayGauge{
2056
0a401d81c6a6 Waterway gauge import: Fixed model converter (missed URL).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2042
diff changeset
85 URL: wgi.URL,
2038
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
86 Username: nilString(wgi.User),
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
87 Password: nilString(wgi.Password),
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
88 Insecure: wgi.Insecure,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
89 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
90 },
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
91
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
92 DMVJobKind: func(input interface{}) interface{} {
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
93 dmvi := input.(*models.DistanceMarksVirtualImport)
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
94 return &DistanceMarksVirtual{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
95 URL: dmvi.URL,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
96 Username: nilString(dmvi.User),
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
97 Password: nilString(dmvi.Password),
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
98 Insecure: dmvi.Insecure,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
99 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
100 },
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
101
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
102 FDJobKind: func(input interface{}) interface{} {
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
103 fdi := input.(*models.FairwayDimensionImport)
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
104 return &FairwayDimension{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
105 URL: fdi.URL,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
106 FeatureType: fdi.FeatureType,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
107 SortBy: nilString(fdi.SortBy),
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
108 LOS: fdi.LOS,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
109 MinWidth: fdi.MinWidth,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
110 MaxWidth: fdi.MaxWidth,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
111 Depth: fdi.Depth,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
112 SourceOrganization: fdi.SourceOrganization,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
113 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
114 },
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
115
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
116 DMAJobKind: func(input interface{}) interface{} {
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
117 dmai := input.(*models.DistanceMarksAshoreImport)
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
118 return &DistanceMarksAshore{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
119 URL: dmai.URL,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
120 FeatureType: dmai.FeatureType,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
121 SortBy: nilString(dmai.SortBy),
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
122 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
123 },
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
124
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
125 STJobKind: func(input interface{}) interface{} {
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
126 sti := input.(*models.StretchImport)
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
127 return &Stretch{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
128 Name: sti.Name,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
129 From: sti.From,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
130 To: sti.To,
2563
dc4fae4bdb8f Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents: 2058
diff changeset
131 Tolerance: sti.Tolerance,
2038
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
132 ObjNam: sti.ObjNam,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
133 NObjNam: sti.NObjNam,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
134 Source: sti.Source,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
135 Date: sti.Date,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
136 Countries: sti.Countries,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
137 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
138 },
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
139 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
140
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
141 func nilString(s *string) string {
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
142 if s != nil {
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
143 return *s
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
144 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
145 return ""
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
146 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
147
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
148 func ConvertToInternal(kind JobKind, src interface{}) interface{} {
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
149 fn := convertModel[kind]
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
150 if fn == nil {
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
151 return nil
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
152 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
153 return fn(src)
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
154 }