所以我有這樣的XAML代碼在我的「視圖」組件:WPF Helix如何在代碼中「縮放範圍」viewport3d?
<helix:HelixViewport3D ZoomExtentsWhenLoaded="True"
ShowCoordinateSystem="True"
IsMoveEnabled="False"
Margin="5,5,5,0">
<helix:HelixViewport3D.Camera>
<OrthographicCamera LookDirection="1,1,-1"
Position="{Binding CameraPosition}"
UpDirection="0,0,1">
</OrthographicCamera>
</helix:HelixViewport3D.Camera>
<ModelVisual3D Content="{Binding Lights}"/>
<local:ScatterPlotVisual3D Points="{Binding Data}"
SolutionPoints="{Binding Solution}"
SurfaceBrush="{Binding SurfaceBrush}"/>
</helix:HelixViewport3D>
在「視圖模型」集結號我加載一些數據ScatterPlotVisual3D這創造了新的陰謀(顯示某些點,boundarybox,標籤等
):
private Model3D CreateModel()
{
var plotModel = new Model3DGroup();
if (Points == null && SolutionPoints == null) return plotModel;
List<Point3D> allPoints = new List<Point3D>();
if (Points != null && Points.Length != 0)
{
plotModel.Children.Add(CreatePointsModel(Points, Brushes.Green));
allPoints.AddRange(Points);
}
if (SolutionPoints != null && SolutionPoints.Length != 0)
{
plotModel.Children.Add(CreatePointsModel(SolutionPoints, Brushes.Red));
allPoints.AddRange(SolutionPoints);
}
CreateBoundaryAxis(plotModel, allPoints);
return plotModel;
}
所以我需要做的是力HelixViewport3D到「做」 ZoomExtents()(或變焦攝像頭,以適應型號)當我加載我的數據的任何其它類似的方式。
問題:我不能叫ZoomExtents()因爲我沒有任何參考螺旋:HelixViewport3D在我的XAML聲明