When a feature layer is extruded, this change has to be reflected in the globe height properties of the layer. So, the first step is to get a handle to the present globe height properties of the layer. The following code segment illustrates the steps to do this. This code makes use of an ESRI.ArcGIS.GlobeCore.IGlobe globe, an ESRI.ArcGIS.Carto.IFeatureLayer featureLayer, and a string sExtrusionExpression that should be defined earlier in the code.
[C#]
ESRI.ArcGIS.GlobeCore.IGlobeDisplayLayers globeDisplayLayers =
globe.GlobeDisplay as ESRI.ArcGIS.GlobeCore.IGlobeDisplayLayers;
ESRI.ArcGIS.GlobeCore.IGlobeLayerProperties globeLayerProperties =
globeDisplayLayers.FindGlobeProperties(featureLayer);
ESRI.ArcGIS.GlobeCore.IGlobeHeightProperties2 glbHeightProps =
globeLayerProperties.HeightProperties as IGlobeHeightProperties2;
There are five types of extrusion that can be used to apply a height specified in the extrusion expression string (IGlobeHeightProperties::ExtrusionExpressionString) to a feature layer using the enumeration 'esriExtrusionType'
esriExtrusionNone - Use this option to apply no extrusion to features in feature layer. In this case the features will have a height of 0.
esriExtrusionMinZ - Use this option to add height to the minimum Z value of each feature in the feature layer. In Figure 1, the extrusion height is applied to the vertex with minimum Z (represented by the green dot). In case of 2D features, the minimum Z value is always 0.
Figure 1: esriExtrusionMinZ
esriExtrusionMaxZ - Use this option to add height to the maximum Z value of each feature in the feature layer. In Figure 2, the extrusion height is applied to the vertex with maximum Z (represented by the green dot).In case of 2D features, the maximum Z value is always 0.
Figure 2: esriExtrusionMaxZ
esriExtrusionBase - Use this option to add height to each feature. The Z value of each vertex of the features is calculated using the base elevation defining the globe surface. In Figure 3, the extrusion height is applied to the both vertices (represented by the green dot) using the Z defined by the globe surface.
Figure 3: esriExtrusionBase
esriExtrusionAbsolute - Use this option to add an absolute height to each feature in the feature layer. In Figure 4, the extrusion height is applied to the vertices such that the feature is extruded to an absolute height (represented by the green arrow).
Figure 4: esriExtrusionAbsolute
The following code segments illustrates applying the extrusion properties.
After defining the extrusion properties, we need to apply the Globe Height properties to feature layer properties using the IGlobeLayerProperties::ValidateType() method.
[C#]
globeLayerProperties.ValidateType();
Applying extrusion invalidates the current scale (level of detail) of the feature layer and resets it to -1. The appropriate scale (LOD) of the extruded feature layer is determined using the IGlobeLayerProperties::EstimateFeatureLODRange() method and then applied to the layer by setting the IGlobeLayerProperties::MaxFeatureLevelOfDetail property.
[C#]
if (globeLayerProperties.MaxFeatureLevelOfDetail == - 1)
{
int minLOD;
int defaultLOD;
int maxLOD;
int minminLOD;
int maxmaxLOD;
globeLayerProperties.EstimateFeatureLODRange(out minLOD, out defaultLOD, out
maxLOD, out minminLOD, out maxmaxLOD);
globeLayerProperties.MaxFeatureLevelOfDetail = defaultLOD;
}
To reflect the changes made to the layer display and height properties, the layer is refreshed. [C#]
globeDisplayLayers.RefreshLayer(featureLayer as ILayer);