本文整理汇总了C#中Dynamo.DSEngine.EngineController.GetMirror方法的典型用法代码示例。如果您正苦于以下问题:C# EngineController.GetMirror方法的具体用法?C# EngineController.GetMirror怎么用?C# EngineController.GetMirror使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dynamo.DSEngine.EngineController
的用法示例。
在下文中一共展示了EngineController.GetMirror方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GeneratedGraphicItems
public static List<IGraphicItem> GeneratedGraphicItems(this NodeModel node, EngineController engineController)
{
var ids = node.GetAllOutportAstIdentifiers();
var results = new List<IGraphicItem>();
foreach (var id in ids)
{
var mirror = engineController.GetMirror(id);
if (mirror == null) continue;
var mirrorData = mirror.GetData();
if (mirrorData == null) continue;
GetGraphicItemsFromMirrorData(mirrorData, results);
}
return results;
}
示例2: GetValue
/// <summary>
/// Gets the most recent value of this node stored in an EngineController that has evaluated it.
/// </summary>
/// <param name="outPortIndex"></param>
/// <param name="engine"></param>
/// <returns></returns>
public MirrorData GetValue(int outPortIndex, EngineController engine)
{
return engine.GetMirror(GetAstIdentifierForOutputIndex(outPortIndex).Value).GetData();
}
示例3: GetCachedValueFromEngine
/// <summary>
/// WARNING: This method is meant for unit test only. It directly accesses
/// the EngineController for the mirror data without waiting for any
/// possible execution to complete (which, in single-threaded nature of
/// unit test, is an okay thing to do). The right way to get the cached
/// value for a NodeModel is by going through its RequestValueUpdateAsync
/// method).
/// </summary>
/// <param name="engine">Instance of EngineController from which the node
/// value is to be retrieved.</param>
/// <returns>Returns the MirrorData if the node's value is computed, or
/// null otherwise.</returns>
///
internal MirrorData GetCachedValueFromEngine(EngineController engine)
{
if (cachedMirrorData != null)
return cachedMirrorData;
// Do not have an identifier for preview right now. For an example,
// this can be happening at the beginning of a code block node creation.
if (AstIdentifierForPreview.Value == null)
return null;
cachedMirrorData = null;
var runtimeMirror = engine.GetMirror(AstIdentifierForPreview.Value);
if (runtimeMirror != null)
cachedMirrorData = runtimeMirror.GetData();
return cachedMirrorData;
}
示例4: ComputeColorRange
public ColorRange1D ComputeColorRange(EngineController engine)
{
List<Color> colors;
List<double> parameters;
// If there are colors supplied
if (InPorts[0].Connectors.Any())
{
var colorsNode = InPorts[0].Connectors[0].Start.Owner;
var colorsIndex = InPorts[0].Connectors[0].Start.Index;
var startId = colorsNode.GetAstIdentifierForOutputIndex(colorsIndex).Name;
var colorsMirror = engine.GetMirror(startId);
colors = GetColorsFromMirrorData(colorsMirror);
}
else
{
colors = DefaultColorRanges.Analysis;
}
// If there are indices supplied
if (InPorts[1].Connectors.Any())
{
var valuesNode = InPorts[1].Connectors[0].Start.Owner;
var valuesIndex = InPorts[1].Connectors[0].Start.Index;
var endId = valuesNode.GetAstIdentifierForOutputIndex(valuesIndex).Name;
var valuesMirror = engine.GetMirror(endId);
parameters = GetValuesFromMirrorData(valuesMirror);
}
else
{
parameters = CreateParametersForColors(colors);
}
return ColorRange1D.ByColorsAndParameters(colors, parameters);
}