Extracts the surface contour information from the terrain surface at a specified elevation interval.

Namespace: Autodesk.Civil.DatabaseServices
Assembly: AeccDbMgd (in AeccDbMgd.dll) Version: 13.4.2516.0

Syntax

C#
public ObjectIdCollection ExtractContours(
	double interval
)
Visual Basic
Public Function ExtractContours ( _
	interval As Double _
) As ObjectIdCollection
Visual C++
public:
virtual ObjectIdCollection^ ExtractContours(
	double interval
) sealed

Parameters

interval
Type: System..::..Double
The specified elevation interval.

Return Value

An ObjectIdCollection of the extracted entities. The extracted entities are Polyline objects. If the surface has no contour information, this method returns an empty ObjectIdCollection.

Implements

ITerrainSurface..::..ExtractContours(Double)

Examples

CopyC#
 1// Setup: creates a new, random surface
 2// 
 3TinSurface surface = CreateRandomSurface("Example Surface");
 4
 5// Extract contours and print information about them:
 6ObjectIdCollection contours;
 7double contourInterval = 50.0;
 8contours = surface.ExtractContours(contourInterval);
 9write("# of extracted contours: " + contours.Count + "\n");
10int totalVertices = 0;
11for (int i = 0; i < contours.Count; i++)
12{
13    ObjectId contourId = contours[i];
14
15    // Contours are lightweight Polyline objects:
16    Polyline contour = contourId.GetObject(OpenMode.ForRead) as Polyline;
17    write(String.Format("Contour #{0} length:{1}, # of vertices:{2}\n",
18        i, contour.Length, contour.NumberOfVertices));
19    totalVertices += contour.NumberOfVertices;
20}
21
22// Extract contours with smoothing:
23contours = surface.ExtractContours(contourInterval, ContourSmoothingType.AddVertices, 10);
24int totalVerticesSmoothed = 0;
25foreach (ObjectId contourId in contours)
26{
27    Polyline contour = contourId.GetObject(OpenMode.ForRead) as Polyline;
28    totalVerticesSmoothed += contour.NumberOfVertices;
29}
30
31// Compare smoothing by adding vertices:
32write(String.Format("Effects of smoothing:\n  total vertices no smoothing: {0}\n  total vertices with smoothing: {1}\n",
33    totalVertices, totalVerticesSmoothed));
34
35// Extract contours in a range:
36double startRange = 130.0;
37double endRange = 190.0;
38contours = surface.ExtractContours(contourInterval, startRange, endRange);
39
40write("# of extracted contours in range: " + contours.Count + "\n");
41
42// You can also extract contours in a range with smoothing:
43// contours = surface.ExtractContours(contourInterval, startRange, endRange, 
44//    ContourSmoothingType.SplineCurve, 10);
CopyVB.NET
1!ERROR: See log file!

See Also