@@ -137,80 +137,80 @@ private void RunSimpleAnimation(string name, Vector3 translation, Vector3 localT
137
137
138
138
internal void RunSensorLog ( DEMDataSet largeDataSet , DEMDataSet localDataset )
139
139
{
140
- // sensor log needs data filtering
141
- // => some coordinates are null (not in the json data)
142
- // => most accurate is RelativeElevation
143
- // => this is height above initial point, need to sum with start elevation
144
- try
145
- {
146
- string outputDir = Path . GetFullPath ( "." ) ;
147
- //string _gpxFile = Path.Combine("SampleData", "20191022-Puch-Pöllau.gpx");
148
- string sensorLogFile = Path . Combine ( "SampleData" , "20191023-Puch-Pöllau-sensorlog.json" ) ;
149
- var sensorLog = SensorLog . FromJson ( sensorLogFile ) ;
150
- //sensorLog.Plot("sensorLog.png");
151
- string balloonModel = Path . Combine ( "SampleData" , "OE-SOE.glb" ) ;
152
- float Z_FACTOR = 2f ;
153
- float trailWidthMeters = 5f ;
154
-
155
-
156
- ModelRoot balloon = ModelRoot . Load ( balloonModel ) ;
157
-
158
- //=======================
159
- /// Line strip from SensorLog
160
- ///
161
- var pointsGpx = sensorLog . ToGPX ( ) . ToList ( ) ;
162
- var geoPoints = sensorLog . ToGeoPoints ( ) . ToList ( ) ;
163
-
164
- var firstElevation = _elevationService . GetPointElevation ( geoPoints . First ( ) , localDataset ) ;
165
- foreach ( var p in pointsGpx ) p . Elevation += firstElevation . Elevation . Value ;
166
- foreach ( var p in geoPoints ) p . Elevation += firstElevation . Elevation . Value ;
167
-
168
- var model = _sharpGltfService . CreateNewModel ( ) ;
169
- //var largeMesh = GetMeshFromGpxTrack(outputDir, largeDataSet, geoPoints
170
- // , bboxScale: 5
171
- // , zFactor: Z_FACTOR
172
- // , generateTIN: false
173
- // , tinPrecision: 500d
174
- // , drawGpxOnTexture: false
175
- // , ImageryProvider.OpenTopoMap);
176
- //meshes.Add(largeMesh);
177
-
178
- model = GetMeshFromGpxTrack ( model , outputDir , localDataset , geoPoints
179
- , bboxScale : ( 1.05 , 1.05 )
180
- , zFactor : Z_FACTOR
181
- , generateTIN : false
182
- , tinPrecision : 50d
183
- , drawGpxOnTexture : true
184
- , ImageryProvider . EsriWorldImagery ) ;
185
-
186
-
187
- var gpxPoints = geoPoints . ReprojectGeodeticToCartesian ( ) . ZScale ( Z_FACTOR ) ;
188
-
189
- model = _sharpGltfService . AddLine ( model , gpxPoints , new Vector4 ( 0 , 1 , 0 , 0.5f ) , trailWidthMeters ) ;
190
-
191
- // model export
192
- Console . WriteLine ( "GenerateModel..." ) ;
193
-
194
- var node = model . LogicalNodes . First ( ) ;
195
- pointsGpx = pointsGpx . ReprojectGeodeticToCartesian ( ) . ZScale ( Z_FACTOR ) ;
196
- // animations
197
- node = CreateAnimationFromGpx ( "GPX" , node , pointsGpx , 1f ) ;
198
- node = CreateAnimationFromGpx ( "GPX x500" , node , pointsGpx , 500f ) ;
199
-
200
-
201
- //var sceneBuilderBalloon = balloon.DefaultScene.ToSceneBuilder();
202
-
203
- //var sceneBuilderTerrain = model.DefaultScene.ToSceneBuilder();
204
- //sceneBuilderBalloon.
205
-
206
-
207
-
208
- model . SaveGLB ( Path . Combine ( Directory . GetCurrentDirectory ( ) , $ "{ GetType ( ) . Name } .glb") ) ;
209
- }
210
- catch ( Exception ex )
211
- {
212
- _logger . LogError ( ex , ex . Message ) ;
213
- }
140
+ //// sensor log needs data filtering
141
+ //// => some coordinates are null (not in the json data)
142
+ //// => most accurate is RelativeElevation
143
+ //// => this is height above initial point, need to sum with start elevation
144
+ // try
145
+ // {
146
+ // string outputDir = Path.GetFullPath(".");
147
+ // //string _gpxFile = Path.Combine("SampleData", "20191022-Puch-Pöllau.gpx");
148
+ // string sensorLogFile = Path.Combine("SampleData", "20191023-Puch-Pöllau-sensorlog.json");
149
+ // var sensorLog = SensorLog.FromJson(sensorLogFile);
150
+ // //sensorLog.Plot("sensorLog.png");
151
+ // string balloonModel = Path.Combine("SampleData", "OE-SOE.glb");
152
+ // float Z_FACTOR = 2f;
153
+ // float trailWidthMeters = 5f;
154
+
155
+
156
+ // ModelRoot balloon = ModelRoot.Load(balloonModel);
157
+
158
+ // //=======================
159
+ // /// Line strip from SensorLog
160
+ // ///
161
+ // var pointsGpx = sensorLog.ToGPX().ToList();
162
+ // var geoPoints = sensorLog.ToGeoPoints().ToList();
163
+
164
+ // var firstElevation = _elevationService.GetPointElevation(geoPoints.First(), localDataset);
165
+ // foreach (var p in pointsGpx) p.Elevation += firstElevation.Elevation.Value;
166
+ // foreach (var p in geoPoints) p.Elevation += firstElevation.Elevation.Value;
167
+
168
+ // var model = _sharpGltfService.CreateNewModel();
169
+ // //var largeMesh = GetMeshFromGpxTrack(outputDir, largeDataSet, geoPoints
170
+ // // , bboxScale: 5
171
+ // // , zFactor: Z_FACTOR
172
+ // // , generateTIN: false
173
+ // // , tinPrecision: 500d
174
+ // // , drawGpxOnTexture: false
175
+ // // , ImageryProvider.OpenTopoMap);
176
+ // //meshes.Add(largeMesh);
177
+
178
+ // model = GetMeshFromGpxTrack(model, outputDir, localDataset, geoPoints
179
+ // , bboxScale: (1.05, 1.05)
180
+ // , zFactor: Z_FACTOR
181
+ // , generateTIN: false
182
+ // , tinPrecision: 50d
183
+ // , drawGpxOnTexture: true
184
+ // , ImageryProvider.EsriWorldImagery);
185
+
186
+
187
+ // var gpxPoints = geoPoints.ReprojectGeodeticToCartesian().ZScale(Z_FACTOR);
188
+
189
+ // model = _sharpGltfService.AddLine(model, gpxPoints, new Vector4(0, 1, 0, 0.5f), trailWidthMeters);
190
+
191
+ // // model export
192
+ // Console.WriteLine("GenerateModel...");
193
+
194
+ // var node = model.LogicalNodes.First();
195
+ // pointsGpx = pointsGpx.ReprojectGeodeticToCartesian().ZScale(Z_FACTOR);
196
+ // // animations
197
+ // node = CreateAnimationFromGpx("GPX", node, pointsGpx, 1f);
198
+ // node = CreateAnimationFromGpx("GPX x500", node, pointsGpx, 500f);
199
+
200
+
201
+ // //var sceneBuilderBalloon = balloon.DefaultScene.ToSceneBuilder();
202
+
203
+ // //var sceneBuilderTerrain = model.DefaultScene.ToSceneBuilder();
204
+ // //sceneBuilderBalloon.
205
+
206
+
207
+
208
+ // model.SaveGLB(Path.Combine(Directory.GetCurrentDirectory(), $"{GetType().Name}.glb"));
209
+ // }
210
+ // catch (Exception ex)
211
+ // {
212
+ // _logger.LogError(ex, ex.Message);
213
+ // }
214
214
215
215
}
216
216
0 commit comments