勾配パターンを追加、修正する

勾配パターンとは、勾配の方向を表すために、2 本のコリドー計画線(通常は、グレーディング計画線と法面展開線)の間の領域に適用されるパターンです。SlopePattern オブジェクトのコリドーのコレクションは、その SlopePatterns コレクションに保持されます。このコレクションには Add() メソッドもあり、2 つの CorridorFeatureLine オブジェクトと、SlopePatternStyleObjectId によって定義された新しい SlopePattern を追加することができます。 SlopePattern を追加した後は、その開始および終了測点を設定することができます。

この例では、既存のすべての勾配パターンがリストされ、次に新しい SlopePattern がコリドーに追加され、その測点が設定されます。

// add slope pattern
CorridorFeatureLine featureLine1 = null;
CorridorFeatureLine featureLine2 = null;
string fl1name = "ETW";
string f2name = "Ditch_Out";

Baseline baseline = corridor.Baselines[0];
foreach (FeatureLineCollection fl in baseline.MainBaselineFeatureLines.FeatureLineCollectionMap)
{
    foreach (CorridorFeatureLine cfl in fl)
    {
        if (cfl.CodeName == fl1name)
        {
            featureLine1 = cfl;
            break;
        }
        if (cfl.CodeName == f2name)
        {
            featureLine2 = cfl;
            break;
        }
    }
}

// get a style for the slope pattern:
ObjectId slopePatterStyleId = _civilDoc.Styles.SlopePatternStyles["Standard"];

CorridorSlopePattern pattern = corridor.SlopePatterns.Add(featureLine1, featureLine2, slopePatterStyleId);
// set the stations:
_editor.WriteMessage("First station: {0} \nEnd station: {1}\n", baseline.StartStation, baseline.EndStation);
pattern.StartStation = baseline.StartStation;
pattern.EndStation = baseline.EndStation;