Skip to content

Commit

Permalink
fix adornments when no imagery
Browse files Browse the repository at this point in the history
  • Loading branch information
xfischer committed Apr 1, 2021
1 parent 9b3fae8 commit ce613f9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions DEM.Net.Core/Services/Adornments/AdornmentsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,17 @@ public TriangulationList<Vector3> CreateModelAdornments(DEMDataSet dataset, Imag
.RotateZ(PI / 2f)
.Translate(new Vector3(projWidth / 2, -projHeight / 2 - projHeight * 0.05f, zCenter));

var text = this.CreateText($"{dataset.Attribution.Subject}: {dataset.Attribution.Text}{Environment.NewLine}{imageryProvider.Attribution.Subject}: {imageryProvider.Attribution.Text}", VectorsExtensions.CreateColor(255, 255, 255)).ToGlTFSpace();
var textWidth = (float)text.GetBoundingBox().Width;
var text = $"{dataset.Attribution.Subject}: {dataset.Attribution.Text}";
if (imageryProvider != null)
text = string.Concat(text, $"{Environment.NewLine}{imageryProvider.Attribution.Subject}: {imageryProvider.Attribution.Text}");
var text3D = this.CreateText(text, VectorsExtensions.CreateColor(255, 255, 255)).ToGlTFSpace();
var textWidth = (float)text3D.GetBoundingBox().Width;
var scale = (float)(((projWidth - scaleBarSize) * 0.9f) / textWidth);

text = text.Scale((float)scale)
text3D = text3D.Scale((float)scale)
.RotateX(-PI / 2)
.Translate(new Vector3((-projWidth + textWidth * scale) / 2f, -projHeight * 0.55f, zCenter));
adornments += text;
adornments += text3D;

return adornments;

Expand Down

0 comments on commit ce613f9

Please sign in to comment.