Working with Topography Surfaces in BimRv SDK (Part 1 of 3)

Evgeniy Tikhonov

December 26, 2019

In BimRv SDK, a TopographySurface element represents an actual topography surface based on a collection of points that can have an arbitrary boundary.

A TopographySurface element is represented by the OdBmSiteSurface class. Because the set of surface points effects other surface data and is managed by more than one method, in order to keep the integrity of the surface data, the BimRv API provides a helper class OdBmSiteSurfaceHelper.

Creating a Topography Surface

As with any other element, you can create a topography surface by calling the OdBmSiteSurface::CreateObject() method.

Accessing and Editing Surface Data

As mentioned earlier, due to the requirement for data integrity, OdBmSiteSurface provides only retrieval methods. Any changes to the surface data must be made using the OdBmSiteSurfaceHelper class. A helper class can be used to manipulate its own data, then apply changes to a related topography surface.

Retrieval methods (which are similar for the OdBmSiteSurface class):

  • bool arePointsEditable(); — Returns true if the points of the topography surface can be edited independently.
  • bool containsPoint(const OdGePoint3d& point); — Returns true if the given point exists in the topography surface, otherwise false.
  • OdGePoint3dArray findPoints(const OdGeExtents3d& boundingBox); — Returns only the points of the topography surface which lie within the input bounding box.
  • OdGePoint3dArray getBoundaryPoints(); — Returns points that are on the boundary of the topography surface.
  • OdGePoint3dArray getInteriorPoints(); — Returns points of the topography surface that are not boundary points.
  • OdGePoint3dArray getPoints(); — Returns points that define this topography surface.
Setting Up the Surface Points and Facets

A topography surface created with points and facets cannot be modified; a surface created only with points is editable, and you can add, delete and manipulate the points of these surfaces.

A topography surface can be set using the OdBmSiteSurfaceHalper::setSurface method. This method allows you to set the surface by points or by points and facets based on the points:

  • OdResult setSurface(const OdGePoint3dArray& points, OdArray& facets); — Creates a new topography surface element from points and facets. A surface created with facets cannot be edited.
  • OdResult setSurface(const OdGePoint3dArray& points); — Creates a new topography surface element from points. Points of this surface are editable.
Modifying Surface Points

Topography surface points can be modified using these methods:

  • OdResult addPoints(const OdGePoint3dArray& points); — Adds points to a topography surface. Returns eInvalidInput if the topography surface already contains a point with the same XY location, otherwise returns eOk. Returns eInvalidInput in the case of an empty input array.
  • OdResult deletePoints(const OdGePoint3dArray& points); — Points are deleted if they matched in XY. Points that do not exist in a topography surface are ignored, unless all of the input points do not exist, which returns eInvalidInput. Returns eInvalidInput in the case of an empty input array.
  • OdResult changePointElevation(const OdGePoint3d& point, double elevValue); — Changes the elevation value for a point. Returns eInvalidInput if the input point does not exist in the topography surface or if the given value for elevValue is more than 30000 feet in absolute value. Returns eNotApplicable if the points of the topography surface are not editable.
  • OdResult changePointsElevation(const OdGePoint3dArray& points, double elevValue); — Changes the elevation value for points. Returns eInvalidInput if all input points do not exist in the topography surface or if the given value for elevValue is more than 30000 feet in absolute value. Returns eNotApplicable if the points of the topography surface are not editable.
  • OdResult movePoint(const OdGePoint3d& moved, const OdGePoint3d& target); — Moves a point in a topography surface to a new location. Returns eInvalidInput if the moved point does not exist in the topography surface or if there is another point with the same XY as the target. Returns eNotApplicable if the points of the topography surface are not editable.
  • OdResult movePoints(const OdGePoint3dArray& moved, const OdGeVector3d& dir); — Moves points in a topography surface to a new location. Returns eInvalidInput if all moved points do not exist in the topography surface or if there is another point with the same XY as one of the target points. Returns eNotApplicable if the points of the topography surface are not editable.
Applying the Changes

Use the following method to apply the changes to the topography surface for which the helper was created:

  • void applyToSurface(); — Applies data to the topography surface.

The next article in this series will show code examples for creating and modifying topography surfaces.