Skip to content

Commit

Permalink
set offsets from GIS on receive
Browse files Browse the repository at this point in the history
KatKatKateryna committed Jul 2, 2024
1 parent 544eca8 commit 6545d19
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ CancellationToken cancellationToken
// get active CRS & offsets on Receive
SpatialReference activeSpatialRef = _contextStack.Current.Document.Map.SpatialReference;
// Browse for any trace of geolocation in non-GIS apps (e.g. Revit: implemented, Blender: todo on Blender side, Civil3d: ?)
// ATM, GIS commit CRS is stored per layer, but should be moved to the Root level too
// ATM, GIS commit CRS is stored per layer (in FeatureClass converter), but should be moved to the Root level too
CRSorigin? dataOrigin = null; // e.g. CRSorigin.FromRevitData(rootObject);
if (dataOrigin is CRSorigin crsOrigin)
{
Original file line number Diff line number Diff line change
@@ -89,7 +89,22 @@ public FeatureClass Convert(VectorLayer target)
}
// ATM, GIS commit CRS is stored per layer, but should be moved to the Root level too, and created once per Receive
ACG.SpatialReference spatialRef = ACG.SpatialReferenceBuilder.CreateSpatialReference(wktString);
_contextStack.Current.Document.ActiveCRSoffsetRotation = new CRSoffsetRotation(spatialRef);

double trueNorthRadians = System.Convert.ToDouble(
(target.crs == null || target.crs?.rotation == null) ? 0 : target.crs.rotation
);
double latOffset = System.Convert.ToDouble(
(target.crs == null || target.crs?.offset_y == null) ? 0 : target.crs.offset_y
);
double lonOffset = System.Convert.ToDouble(
(target.crs == null || target.crs?.offset_x == null) ? 0 : target.crs.offset_x
);
_contextStack.Current.Document.ActiveCRSoffsetRotation = new CRSoffsetRotation(
spatialRef,
latOffset,
lonOffset,
trueNorthRadians
);

// create Fields
List<FieldDescription> fields = _fieldsUtils.GetFieldsFromSpeckleLayer(target);

0 comments on commit 6545d19

Please sign in to comment.