本文整理汇总了C#中NodeFactory类的典型用法代码示例。如果您正苦于以下问题:C# NodeFactory类的具体用法?C# NodeFactory怎么用?C# NodeFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NodeFactory类属于命名空间,在下文中一共展示了NodeFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
nodeFactory = new NodeFactory(ModelType.Truss2D);
node1 = nodeFactory.CreateFor2DTruss(0, 0);
node2 = nodeFactory.CreateFor2DTruss(0, 1);
SUT = new ElementFactory(ModelType.Truss2D);
}
示例2: GetData
public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
{
ObjectDataBuilder objData = new ObjectDataBuilder(factory);
objData.RequirePointerAlignment();
objData.DefinedSymbols.Add(this);
ObjectAndOffsetSymbolNode startNode = new ObjectAndOffsetSymbolNode(this, 0, "__modules_a");
ObjectAndOffsetSymbolNode endNode = new ObjectAndOffsetSymbolNode(this, 0, "__modules_z");
if (factory.Target.OperatingSystem != Internal.TypeSystem.TargetOS.Windows)
{
// Temporary work-around for Linux / OSX until CLI is updated
objData.DefinedSymbols.Add(startNode);
}
objData.EmitPointerReloc(factory.ReadyToRunHeader);
if (factory.Target.OperatingSystem != Internal.TypeSystem.TargetOS.Windows)
{
// Temporary work-around for Linux / OSX until CLI is updated
endNode.SetSymbolOffset(objData.CountBytes);
objData.DefinedSymbols.Add(endNode);
objData.EmitZeroPointer();
}
return objData.ToObjectData();
}
示例3: Main
public static int Main()
{
NodeFactory f = new NodeFactory();
Node notNode = new Node("NotNode");
notNode.NodeType = NodeType.Not;
notNode.Child = new Node("otherNode");
notNode.Child.NodeType = NodeType.Other;
Node trueNode = new Node("True");
Node falseNode = new Node("False");
Node resultNode = f.Conditional(notNode, trueNode, falseNode);
if (resultNode.name == "True")
{
System.Console.WriteLine("pass");
return 100;
}
else
{
System.Console.WriteLine("Failed");
return -1;
}
}
示例4: UpdateNode
public void UpdateNode(NodeFactory.Node node) {
lock (this) {
// validate sitemap
BuildSiteMap();
SiteMapNode n;
if (!m_nodes.ContainsKey(node.Id.ToString())) {
n = createNode(node.Id.ToString(),
node.Name,
node.GetProperty(m_defaultDescriptionAlias) != null ? node.GetProperty(m_defaultDescriptionAlias).Value : "",
node.Url,
findRoles(node.Id, node.Path));
string parentNode = node.Parent == null ? "-1" : node.Parent.Id.ToString();
try {
AddNode(n, m_nodes[parentNode]);
} catch (Exception ex) {
BusinessLogic.Log.Add(
LogTypes.Error,
-1,
String.Format("Error adding node with url '{0}' to SiteMapProvider: {1}", node.Name, ex));
}
} else {
n = m_nodes[node.Id.ToString()];
n.Url = node.Url;
n.Description = node.GetProperty(m_defaultDescriptionAlias) != null ? node.GetProperty(m_defaultDescriptionAlias).Value : "";
n.Title = node.Name;
n.Roles = findRoles(node.Id, node.Path).Split(",".ToCharArray());
}
}
}
示例5: LoadWorkspaceFromJson
/// <summary>
/// Load a WorkspaceModel from json. If the WorkspaceModel is a HomeWorkspaceModel
/// it will be set as the current workspace.
/// </summary>
/// <param name="json"></param>
public static WorkspaceModel LoadWorkspaceFromJson(string json, LibraryServices libraryServices,
EngineController engineController, DynamoScheduler scheduler, NodeFactory factory,
bool isTestMode, bool verboseLogging, CustomNodeManager manager)
{
var settings = new JsonSerializerSettings
{
Error = (sender, args) =>
{
args.ErrorContext.Handled = true;
Console.WriteLine(args.ErrorContext.Error);
},
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
TypeNameHandling = TypeNameHandling.Auto,
Formatting = Formatting.Indented,
Converters = new List<JsonConverter>{
new ConnectorConverter(),
new AnnotationConverter(),
new WorkspaceConverter(engineController, scheduler, factory, isTestMode, verboseLogging),
new NodeModelConverter(manager, libraryServices),
},
ReferenceResolverProvider = () => { return new IdReferenceResolver(); }
};
var result = ReplaceTypeDeclarations(json, true);
var ws = JsonConvert.DeserializeObject<WorkspaceModel>(result, settings);
return ws;
}
示例6: CreateFiniteElement1D
private void CreateFiniteElement1D(double startX, double startY, double startZ, double endX, double endY, double endZ)
{
nodeFactory = new NodeFactory(ModelType.Truss3D);
start = nodeFactory.Create(startX, startY, startZ);
end = nodeFactory.Create(endX, endY, endZ);
elementFactory = new ElementFactory(ModelType.Truss3D);
SUT = elementFactory.CreateLinearConstantSpring(start, end, 0);
}
示例7: CustomNodeWorkspaceModel
/// <summary>
/// Initializes a new instance of the <see cref="CustomNodeWorkspaceModel"/> class
/// by given information about it and node factory
/// </summary>
/// <param name="info">Information for creating custom node workspace</param>
/// <param name="factory">Node factory to create nodes</param>
public CustomNodeWorkspaceModel(WorkspaceInfo info, NodeFactory factory)
: this(factory,
Enumerable.Empty<NodeModel>(),
Enumerable.Empty<NoteModel>(),
Enumerable.Empty<AnnotationModel>(),
Enumerable.Empty<PresetModel>(),
new ElementResolver(),
info) { }
示例8: Calc
public Calc()
{
m_NodeFactory = new NodeFactory();
m_NodeFactory.Register("+", typeof(AdditionNode));
m_NodeFactory.Register("*", typeof(MultiplicationNode));
m_NodeFactory.Register("-", typeof(SubtractionNode));
m_NodeFactory.Register("/", typeof(DivisionNode));
}
示例9: LoadNodesFromXml
private static IEnumerable<NodeModel> LoadNodesFromXml(XmlDocument xmlDoc, NodeFactory nodeFactory, ElementResolver resolver)
{
XmlNodeList elNodes = xmlDoc.GetElementsByTagName("Elements");
if (elNodes.Count == 0)
elNodes = xmlDoc.GetElementsByTagName("dynElements");
XmlNode elNodesList = elNodes[0];
return from XmlElement elNode in elNodesList.ChildNodes
select LoadNodeFromXml(elNode, SaveContext.File, nodeFactory, resolver);
}
示例10: CustomNodeWorkspaceModel
public CustomNodeWorkspaceModel(
WorkspaceInfo info,
NodeFactory factory)
: this(
factory,
Enumerable.Empty<NodeModel>(),
Enumerable.Empty<NoteModel>(),
Enumerable.Empty<AnnotationModel>(),
info) { }
示例11: SetUp
public void SetUp()
{
this.nodeFactory = new NodeFactory(ModelType.Truss1D);
this.start = nodeFactory.Create(0);
this.end = nodeFactory.Create(1);
this.elementFactory = new ElementFactory(ModelType.Truss1D);
this.spring = elementFactory.CreateLinearConstantSpring(start, end, 2);
this.SUT = new LinearTrussStiffnessMatrixBuilder(spring);
}
示例12: CanCreateAndAddtoTheRepository
public void CanCreateAndAddtoTheRepository()
{
NodeRepository repository = new NodeRepository(ModelType.Truss1D);
this.SUT = new NodeFactory(ModelType.Truss1D, repository);
Assert.AreEqual(0, repository.Count);
this.SUT.Create(0);
Assert.AreEqual(1, repository.Count);
}
示例13: CreateAndStore2DSpringFromOriginTo
protected void CreateAndStore2DSpringFromOriginTo(double x, double z)
{
this.nodeFactory = new NodeFactory(ModelType.Truss2D);
this.start = nodeFactory.CreateFor2DTruss(0, 0);
this.end = nodeFactory.CreateFor2DTruss(x, z);
this.elementFactory = new ElementFactory(ModelType.Truss2D);
this.spring = elementFactory.CreateLinearConstantSpring(this.start, this.end, 1);
this.SUT = new LinearTrussStiffnessMatrixBuilder(this.spring);
}
示例14: CreateAndStore3DSpringFromOriginTo
protected void CreateAndStore3DSpringFromOriginTo(double x, double y, double z)
{
nodeFactory = new NodeFactory(ModelType.Truss3D);
start = nodeFactory.Create(0, 0, 0);
end = nodeFactory.Create(x, y, z);
elementFactory = new ElementFactory(ModelType.Truss3D);
this.spring = elementFactory.CreateLinearConstantSpring(start, end, 1);
this.SUT = new LinearTrussStiffnessMatrixBuilder(this.spring);
}
示例15: SetUp
public void SetUp()
{
nodeFactory = new NodeFactory(ModelType.Frame2D);
start = nodeFactory.CreateFor2DTruss(0, 0);
end = nodeFactory.CreateFor2DTruss(1, 0);
elementFactory = new ElementFactory(ModelType.Frame2D);
material = new GenericElasticMaterial(0, 1, 0, 1);
section = new GenericCrossSection(1, 1, 1, 1);
beam = elementFactory.CreateLinear3DBeam(start, end, material, section);
SUT = new Linear3DBernoulliBeamStiffnessMatrixBuilder(beam);
}