Extracts the surface major contour information from the terrain surface.

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

Syntax

C#
public ObjectIdCollection ExtractMajorContours(
	SurfaceExtractionSettingsType settingsType,
	ContourSmoothingType smoothType,
	int smoothFactor
)
Visual Basic
Public Function ExtractMajorContours ( _
	settingsType As SurfaceExtractionSettingsType, _
	smoothType As ContourSmoothingType, _
	smoothFactor As Integer _
) As ObjectIdCollection
Visual C++
public:
virtual ObjectIdCollection^ ExtractMajorContours(
	SurfaceExtractionSettingsType settingsType, 
	ContourSmoothingType smoothType, 
	int smoothFactor
) sealed

Parameters

settingsType
Type: Autodesk.Civil..::..SurfaceExtractionSettingsType
Specify SurfaceExtractionSettingsType.Plan to extract the contour information using the plan visual style settings, or SurfaceExtractionSettingsType.Model to use the model settings.
smoothType
Type: Autodesk.Civil.DatabaseServices.Styles..::..ContourSmoothingType
Currently, smoothType can be AddVertices only.
smoothFactor
Type: System..::..Int32
smoothFactor should be in the range [0, 10]. A value of 10 generates the smoothest contours.

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..::..ExtractMajorContours(SurfaceExtractionSettingsType, ContourSmoothingType, Int32)

Examples

CopyC#
 1// Setup: creates a new, random surface.                    
 2// 
 3TinSurface surface = CreateRandomSurface("Example Surface");
 4
 5// Surface must have a style that shows major contours.
 6// 
 7surface.StyleId = _civildoc.Styles.SurfaceStyles["Contours and Triangles"];
 8
 9// Extract major contours and print information about them:
10// 
11ObjectIdCollection majorContours;
12majorContours = surface.ExtractMajorContours(SurfaceExtractionSettingsType.Plan);
13write("# of extracted contours: " + majorContours.Count + "\n");
14int totalVertices = 0;
15for (int i = 0; i < majorContours.Count; i++)
16{
17    ObjectId contourId = majorContours[i];
18    // Contours are lightweight Polyline objects:
19    // 
20    Polyline contour = contourId.GetObject(OpenMode.ForRead) as Polyline;
21    write(String.Format("Contour #{0} length:{1}, # of vertices:{2}\n",
22        i, contour.Length, contour.NumberOfVertices));
23    totalVertices += contour.NumberOfVertices;
24}
25
26// Extract major contours with smoothing:
27// 
28majorContours = surface.ExtractMajorContours(SurfaceExtractionSettingsType.Plan,
29    ContourSmoothingType.AddVertices, 10);
30int totalVerticesSmoothed = 0;
31foreach (ObjectId contourId in majorContours)
32{
33    Polyline contour = contourId.GetObject(OpenMode.ForRead) as Polyline;
34    totalVerticesSmoothed += contour.NumberOfVertices;
35}
36
37// Compare smoothing by adding vertices:
38write(String.Format("Effects of smoothing:\n  total vertices no smoothing: {0}\n  total vertices with smoothing: {1}\n",
39    totalVertices, totalVerticesSmoothed));
CopyVB.NET
1!ERROR: See log file!

Exceptions

ExceptionCondition
System..::..ArgumentException Thrown when smoothFactor is not in the range [0, 10].

See Also