using System;
using Deltares.Geotechnics;
using Deltares.Geotechnics.ConePenetrationTest;
using Deltares.Standard;
using Deltares.Standard.EventPublisher.Enum;
namespace Deltares.DSoilModel.Forms
{
public class DSoilModelSelectionRedirector : ISelectionRedirector
{
///
/// Initializes a new instance of the class.
///
public DSoilModelSelectionRedirector()
{
RedirectingTypes = new[]
{
typeof (ConePenetrationTestLookup1D),
typeof (ConePenetrationTestLookup2D),
typeof (BoringLookup1D),
typeof (BoringLookup2D)
};
}
///
/// Gets the redirected object.
///
/// The source.
/// Type of the reaction.
///
public object GetRedirectedObject(object source, ref PropertyEditorReactionType reactionType)
{
reactionType = PropertyEditorReactionType.Update;
// redirect selection of soil layer in geometry view to material of the layer so this is highlighted in the materials table
var lookupCpt1D = source as ConePenetrationTestLookup1D;
if (lookupCpt1D != null)
{
return lookupCpt1D.ConePenetrationTestData;
}
var lookupCpt2D = source as ConePenetrationTestLookup2D;
if (lookupCpt2D != null)
{
return lookupCpt2D.ConePenetrationTestData;
}
var lookupBoring1D = source as BoringLookup1D;
if (lookupBoring1D != null)
{
return lookupBoring1D.Boring;
}
var lookupBoring2D = source as BoringLookup2D;
if (lookupBoring2D != null)
{
return lookupBoring2D.Boring;
}
return source;
}
///
/// All types handled by this selection redirector.
///
public Type[] RedirectingTypes { get; private set; }
}
}