Skip to content

Commit

Permalink
Add compound structure support
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyNefyodov committed Dec 19, 2024
1 parent 82ac83d commit 31ef3c3
Showing 1 changed file with 144 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ public Func<IVariants> Resolve(Document context, string target, ParameterInfo[]
nameof(CompoundStructure.GetRegionsAssociatedToLayer) => ResolveGetRegionsAssociatedToLayer,
nameof(CompoundStructure.GetSegmentCoordinate) => ResolveGetSegmentCoordinate,
nameof(CompoundStructure.GetSegmentOrientation) => ResolveGetSegmentOrientation,
nameof(CompoundStructure.GetWallSweepsInfo) => ResolveGetWallSweepsInfo,
nameof(CompoundStructure.GetWidth) when parameters.Length == 1 => ResolveGetWidth,
nameof(CompoundStructure.IsCoreLayer) => ResolveIsCoreLayer,
nameof(CompoundStructure.IsRectangularRegion) => ResolveIsRectangularRegion,
nameof(CompoundStructure.IsSimpleRegion) => ResolveIsSimpleRegion,
nameof(CompoundStructure.IsStructuralDeck) => ResolveIsStructuralDeck,
nameof(CompoundStructure.ParticipatesInWrapping) => ResolveParticipatesInWrapping,
_ => null
};

Expand All @@ -58,10 +65,10 @@ IVariants ResolveCanLayerBeStructuralMaterial()
var result = compoundStructure.CanLayerBeStructuralMaterial(i);
variants.Add(result, $"Layer {i}: {result}");
}

return variants;
}

IVariants ResolveCanLayerBeVariable()
{
var layerCount = compoundStructure.LayerCount;
Expand All @@ -71,10 +78,10 @@ IVariants ResolveCanLayerBeVariable()
var result = compoundStructure.CanLayerBeVariable(i);
variants.Add(result, $"Layer {i}: {result}");
}

return variants;
}

IVariants ResolveCanLayerWidthBeNonZero()
{
var layerCount = compoundStructure.LayerCount;
Expand All @@ -84,38 +91,39 @@ IVariants ResolveCanLayerWidthBeNonZero()
var result = compoundStructure.CanLayerWidthBeNonZero(i);
variants.Add(result, $"Layer {i}: {result}");
}

return variants;
}

IVariants ResolveGetAdjacentRegions()
{
var regionsCount = compoundStructure.GetRegionIds().Count;
var variants = new Variants<IList<int>>(regionsCount);

for (var i = 0; i < regionsCount; i++)
{
var result = compoundStructure.GetAdjacentRegions(i);
variants.Add(result, $"Region" +
$" {i}");
}

return variants;
}

IVariants ResolveGetCoreBoundaryLayerIndex()
{
var values = Enum.GetValues(typeof(ShellLayerType));
var variants = new Variants<int>(values.Length);

foreach (ShellLayerType value in values)
{
var result = compoundStructure.GetCoreBoundaryLayerIndex(value);
variants.Add(result, $"{value.ToString()}: {result}");
}

return variants;
}

IVariants ResolveGetDeckEmbeddingType()
{
var layerCount = compoundStructure.LayerCount;
Expand All @@ -125,24 +133,24 @@ IVariants ResolveGetDeckEmbeddingType()
var result = compoundStructure.GetDeckEmbeddingType(i);
variants.Add(result, $"Layer {i}: {result}");
}

return variants;
}

IVariants ResolveGetLayerAssociatedToRegion()
{
var regionsCount = compoundStructure.GetRegionIds().Count;
var variants = new Variants<int>(regionsCount);

for (var i = 0; i < regionsCount; i++)
{
var result = compoundStructure.GetLayerAssociatedToRegion(i);
variants.Add(result, $"Region {i}: {result}");
}

return variants;
}

IVariants ResolveGetLayerFunction()
{
var layerCount = compoundStructure.LayerCount;
Expand All @@ -152,10 +160,10 @@ IVariants ResolveGetLayerFunction()
var result = compoundStructure.GetLayerFunction(i);
variants.Add(result, $"Layer {i}: {result}");
}

return variants;
}

IVariants ResolveGetDeckProfileId()
{
var layerCount = compoundStructure.LayerCount;
Expand All @@ -165,10 +173,10 @@ IVariants ResolveGetDeckProfileId()
var result = compoundStructure.GetDeckProfileId(i);
variants.Add(result, $"Layer {i}: {result}");
}

return variants;
}

IVariants ResolveGetLayerWidth()
{
var layerCount = compoundStructure.LayerCount;
Expand All @@ -178,10 +186,10 @@ IVariants ResolveGetLayerWidth()
var result = compoundStructure.GetLayerWidth(i);
variants.Add(result, $"Layer {i}: {result}");
}

return variants;
}

IVariants ResolveGetMaterialId()
{
var layerCount = compoundStructure.LayerCount;
Expand All @@ -191,38 +199,38 @@ IVariants ResolveGetMaterialId()
var result = compoundStructure.GetMaterialId(i);
variants.Add(result, $"Layer {i}: {result}");
}

return variants;
}

IVariants ResolveGetNumberOfShellLayers()
{
var values = Enum.GetValues(typeof(ShellLayerType));
var variants = new Variants<int>(values.Length);

foreach (ShellLayerType value in values)
{
var result = compoundStructure.GetNumberOfShellLayers(value);
variants.Add(result, $"{value.ToString()}: {result}");
}

return variants;
}

IVariants ResolveGetOffsetForLocationLine()
{
var values = Enum.GetValues(typeof(WallLocationLine));
var variants = new Variants<double>(values.Length);

foreach (WallLocationLine value in values)
{
var result = compoundStructure.GetOffsetForLocationLine(value);
variants.Add(result, $"{value.ToString()}: {result}");
}

return variants;
}

IVariants ResolveGetPreviousNonZeroLayerIndex()
{
var layerCount = compoundStructure.LayerCount;
Expand All @@ -232,24 +240,24 @@ IVariants ResolveGetPreviousNonZeroLayerIndex()
var result = compoundStructure.GetPreviousNonZeroLayerIndex(i);
variants.Add(result, $"Layer {i}: {result}");
}

return variants;
}

IVariants ResolveGetRegionEnvelope()
{
var regionsCount = compoundStructure.GetRegionIds().Count;
var variants = new Variants<BoundingBoxUV>(regionsCount);

for (var i = 0; i < regionsCount; i++)
{
var result = compoundStructure.GetRegionEnvelope(i);
variants.Add(result, $"Region {i}: {result}");
variants.Add(result, $"Region {i}");
}

return variants;
}

IVariants ResolveGetRegionsAssociatedToLayer()
{
var layerCount = compoundStructure.LayerCount;
Expand All @@ -259,10 +267,10 @@ IVariants ResolveGetRegionsAssociatedToLayer()
var result = compoundStructure.GetRegionsAssociatedToLayer(i);
variants.Add(result, $"Layer {i}");
}

return variants;
}

IVariants ResolveGetSegmentCoordinate()
{
var segmentCount = compoundStructure.GetSegmentIds().Count;
Expand All @@ -272,10 +280,10 @@ IVariants ResolveGetSegmentCoordinate()
var result = compoundStructure.GetSegmentCoordinate(i);
variants.Add(result, $"Segment {i}: {result}");
}

return variants;
}

IVariants ResolveGetSegmentOrientation()
{
var segmentCount = compoundStructure.GetSegmentIds().Count;
Expand All @@ -285,7 +293,102 @@ IVariants ResolveGetSegmentOrientation()
var result = compoundStructure.GetSegmentOrientation(i);
variants.Add(result, $"Segment {i}: {result}");
}


return variants;
}

IVariants ResolveGetWallSweepsInfo()
{
var values = Enum.GetValues(typeof(WallSweepType));
var variants = new Variants<IList<WallSweepInfo>>(values.Length);

foreach (WallSweepType value in values)
{
var result = compoundStructure.GetWallSweepsInfo(value);
variants.Add(result, value.ToString());
}

return variants;
}

IVariants ResolveGetWidth()
{
var regionsCount = compoundStructure.GetRegionIds().Count;
var variants = new Variants<double>(regionsCount);

for (var i = 0; i < regionsCount; i++)
{
var result = compoundStructure.GetWidth(i);
variants.Add(result, $"Region {i}: {result}");
}

return variants;
}

IVariants ResolveIsCoreLayer()
{
var layerCount = compoundStructure.LayerCount;
var variants = new Variants<bool>(layerCount);
for (var i = 0; i < layerCount; i++)
{
var result = compoundStructure.IsCoreLayer(i);
variants.Add(result, $"Layer {i}: {result}");
}

return variants;
}

IVariants ResolveIsRectangularRegion()
{
var regionsCount = compoundStructure.GetRegionIds().Count;
var variants = new Variants<bool>(regionsCount);

for (var i = 0; i < regionsCount; i++)
{
var result = compoundStructure.IsRectangularRegion(i);
variants.Add(result, $"Region {i}: {result}");
}

return variants;
}

IVariants ResolveIsSimpleRegion()
{
var regionsCount = compoundStructure.GetRegionIds().Count;
var variants = new Variants<bool>(regionsCount);

for (var i = 0; i < regionsCount; i++)
{
var result = compoundStructure.IsSimpleRegion(i);
variants.Add(result, $"Region {i}: {result}");
}

return variants;
}

IVariants ResolveIsStructuralDeck()
{
var layerCount = compoundStructure.LayerCount;
var variants = new Variants<bool>(layerCount);
for (var i = 0; i < layerCount; i++)
{
var result = compoundStructure.IsStructuralDeck(i);
variants.Add(result, $"Layer {i}: {result}");
}

return variants;
}

IVariants ResolveParticipatesInWrapping()
{
var layerCount = compoundStructure.LayerCount;
var variants = new Variants<bool>(layerCount);
for (var i = 0; i < layerCount; i++)
{
var result = compoundStructure.ParticipatesInWrapping(i);
variants.Add(result, $"Layer {i}: {result}");
}

return variants;
}
}
Expand Down

0 comments on commit 31ef3c3

Please sign in to comment.