Extracts the surface contour information from the terrain surface at a specified elevation interval with smoothing.
public ObjectIdCollection ExtractContours( double interval, ContourSmoothingType smoothType, int smoothFactor )
Public Function ExtractContours ( interval As Double, smoothType As ContourSmoothingType, smoothFactor As Integer ) As ObjectIdCollection
public: virtual ObjectIdCollection^ ExtractContours( double interval, ContourSmoothingType smoothType, int smoothFactor ) sealed
| Exception | Condition |
|---|---|
| ArgumentException | Thrown when smoothFactor is not between the range [0, 10]. |
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);
1!ERROR: See log file!