Public ReadOnly Property SelectedVariableProfile As VoxelVariableProfile
public VoxelVariableProfile SelectedVariableProfile {get;}
Public ReadOnly Property SelectedVariableProfile As VoxelVariableProfile
public VoxelVariableProfile SelectedVariableProfile {get;}
{
var x_max = voxelLayer.GetVolumes().Max(v => v.GetVolumeSize().X);
var y_max = voxelLayer.GetVolumes().Max(v => v.GetVolumeSize().Y);
var z_max = voxelLayer.GetVolumes().Max(v => v.GetVolumeSize().Z);
//Get the dimensions of just one volume
var dimensions = voxelLayer.GetVolumes().FirstOrDefault();
//Get the dimensions of the volume associated with the selected variable
var dimensions2 = voxelLayer.SelectedVariableProfile.Volume.GetVolumeSize();
}
{
MapMemberPropertiesChangedEvent.Subscribe((args) =>
{
var voxel = args.MapMembers.OfType<VoxelLayer>().FirstOrDefault();
if (voxel == null)
return;
//Anything changed on a voxel layer?
if (args.EventHints.Any(hint => hint == MapMemberEventHint.VoxelSelectedVariable))
{
//Voxel variable profile selection changed
var changed_variable_name = voxel.SelectedVariableProfile.Variable;
//TODO respond to change, use QueuedTask if needed
}
else if (args.EventHints.Any(hint => hint == MapMemberEventHint.Renderer))
{
//This can fire when a renderer becomes ready on a new layer; the selected variable profile
//is changed; visualization is changed, etc.
var renderer = voxel.SelectedVariableProfile.Renderer;
//TODO respond to change, use QueuedTask if needed
}
});
VoxelAssetChangedEvent.Subscribe((args) =>
{
//An asset changed on a voxel layer
System.Diagnostics.Debug.WriteLine("");
System.Diagnostics.Debug.WriteLine("VoxelAssetChangedEvent");
System.Diagnostics.Debug.WriteLine($" AssetType: {args.AssetType}, ChangeType: {args.ChangeType}");
if (args.ChangeType == VoxelAssetEventArgs.VoxelAssetChangeType.Remove)
return;
//Get "what"changed - add or update
//eg IsoSurface
VoxelLayer voxelLayer = null;
if (args.AssetType == VoxelAssetEventArgs.VoxelAssetType.Isosurface)
{
var surface = MapView.Active.GetSelectedIsosurfaces().FirstOrDefault();
//there will only be one selected...
if (surface != null)
{
voxelLayer = surface.Layer;
//TODO respond to change, use QueuedTask if needed
}
}
//Repeat for Slices, Sections, LockedSections...
//GetSelectedSlices(), GetSelectedSections(), GetSelectedLockedSections();
});
}
{
var sel_profile = voxelLayer.SelectedVariableProfile;
//Get the variable profile name
var profile_name = sel_profile.Variable;
}
{
//Get the variable profile on which to access the data
var variable = voxelLayer.SelectedVariableProfile;
//or use ...voxelLayer.GetVariableProfiles()
//Data range
var min = variable.Statistics.MinimumValue;
var max = variable.Statistics.MaximumValue;
//Color range (Continuous only)
double color_min, color_max;
if (variable.DataType == VoxelVariableDataType.Continuous)
{
var renderer = variable.Renderer as CIMVoxelStretchRenderer;
color_min = renderer.ColorRangeMin;
color_max = renderer.ColorRangeMax;
}
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)