Jay Peak provides some enhancements to the ‘ProfileView’ object. One of them is the ability to create multiple profile views at once. The code is very simple, since it is just one straight call to a static method of ‘ProfileView’. Yet, it is a very powerful call since it takes a ‘MultipleProfileViewsCreationOptions’ object that allows to customize the behavior of the profile views being created. The following code shows how to create multiple profile views.
C#
private void createProfileViews()
{
ProfileView.CreateMultiple(_alignmentId, _insertionPoint,
_creationOptions);
}
private MultipleProfileViewsCreationOptions _creationOptions
{
get
{
MultipleProfileViewsCreationOptions options =
new MultipleProfileViewsCreationOptions();
options.DrawOrder = ProfileViewPlotType.ByRows;
options.GapBetweenViewsInColumn = 1000;
options.GapBetweenViewsInRow = 1000;
options.MaxViewInRowOrColumn = 3;
options.StartCorner =
ProfileViewStartCornerType.UpperLeft;
return options;
}
}
VB.NET
Private Sub createProfileViews()
ProfileView.CreateMultiple(_alignmentId, _insertionPoint,
_creationOptions)
End Sub
Private ReadOnly Property _creationOptions() _
As MultipleProfileViewsCreationOptions
Get
Dim options As New MultipleProfileViewsCreationOptions()
options.DrawOrder = ProfileViewPlotType.ByRows
options.GapBetweenViewsInColumn = 1000
options.GapBetweenViewsInRow = 1000
options.MaxViewInRowOrColumn = 3
options.StartCorner = ProfileViewStartCornerType.UpperLeft
Return options
End Get
End Property
We use an alignment id, an insertion point, and the ‘MultipleProfileViewsCreationOptions’ object to create the multiple views. The ‘MultipleProvileViewsCreationOption’ object allows you to customize the draw order of the profile views, and things like the gap between rows and columns, maximum views in each row or column (depending on the draw order option), and the start corner to which the insertion point refers. The ‘CreateMultiple’ method provides other overloads that allow you to customize further how the views are created.
You can download the entire implementation of the command from the Civilized Development repository at BitBucket.
Comments
You can follow this conversation by subscribing to the comment feed for this post.