本文整理汇总了TypeScript中core/editorCore/model/DiagramNode.DiagramNode.getType方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DiagramNode.getType方法的具体用法?TypeScript DiagramNode.getType怎么用?TypeScript DiagramNode.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core/editorCore/model/DiagramNode.DiagramNode
的用法示例。
在下文中一共展示了DiagramNode.getType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createBlock
public createBlock(node: DiagramNode, outboundLinks: Link[], interpreter: Interpreter,
robotModels: RobotModel[]): AbstractBlock {
switch (node.getType()) {
case "InitialNode":
return new InitialBlock(node, outboundLinks);
case "FinalNode":
return new FinalBlock(node, outboundLinks);
case "IfBlock":
return new IfBlock(node, outboundLinks, interpreter);
case "Function":
return new FunctionBlock(node, outboundLinks, interpreter);
case "TrikV6EnginesForward":
return new MotorsForwardBlock(node, outboundLinks, robotModels, interpreter);
case "TrikV6EnginesBackward":
return new MotorsBackwardBlock(node, outboundLinks, robotModels, interpreter);
case "TrikV6EnginesStop":
return new MotorsStopBlock(node, outboundLinks, robotModels);
case "Timer":
return new TimerBlock(node, outboundLinks, interpreter);
case "SwitchBlock":
return new SwitchBlock(node, outboundLinks, interpreter);
case "MarkerUp":
return new MarkerUpBlock(node, outboundLinks, robotModels);
case "MarkerDown":
return new MarkerDownBlock(node, outboundLinks, robotModels);
case "VariableInit":
return new VariableInitBlock(node, outboundLinks, interpreter);
case "Randomizer":
return new RandomInitBlock(node, outboundLinks, interpreter);
case "FiBlock":
return new EndIfBlock(node, outboundLinks);
case "TrikSadSmile":
return new TrikSadSmileBlock(node, outboundLinks, robotModels);
case "TrikSmile":
return new TrikSmileBlock(node, outboundLinks, robotModels);
case "TrikSetPainterColor":
return new TrikSetPainterColorBlock(node, outboundLinks, interpreter);
case "TrikSetPainterWidth":
return new TrikSetPainterWidthBlock(node, outboundLinks, interpreter);
case "TrikDrawEllipse":
return new TrikDrawEllipseBlock(node, outboundLinks, interpreter, robotModels);
case "ClearScreen":
return new ClearScreenBlock(node, outboundLinks, robotModels);
case "TrikDrawPixel":
return new TrikDrawPixelBlock(node, outboundLinks, interpreter, robotModels);
case "TrikDrawLine":
return new TrikDrawLineBlock(node, outboundLinks, interpreter, robotModels);
case "TrikDrawRect":
return new TrikDrawRectBlock(node, outboundLinks, interpreter, robotModels);
case "TrikSetBackground":
return new TrikSetBackgroundBlock(node, outboundLinks, robotModels);
case "PrintText":
return new PrintTextBlock(node, outboundLinks, interpreter, robotModels);
default:
throw new Error("Block " + node.getType() + " is not supported");
}
}
示例2: exportNodes
protected exportNodes(graph: joint.dia.Graph, diagramParts: DiagramParts) {
var nodes = [];
for (var id in diagramParts.nodesMap) {
var node: DiagramNode = diagramParts.nodesMap[id];
var newNode = new TDefaultDiagramNode();
newNode.logicalId = node.getLogicalId();
newNode.graphicalId = node.getJointObject().id;
newNode.type = node.getType();
newNode.properties = this.exportProperties(node.getChangeableProperties());
var nameProperty = new TProperty();
nameProperty.name = "name";
nameProperty.value = node.getName();
nameProperty.type = "string";
newNode.properties.push(nameProperty);
var positionProperty = new TProperty();
positionProperty.name = "position";
positionProperty.value = "" + node.getX() + ", " + node.getY();
positionProperty.type = "QPointF";
newNode.properties.push(positionProperty);
var sizeProperty = new TProperty();
sizeProperty.name = "size";
sizeProperty.value = node.getSize();
sizeProperty.type = "string";
newNode.properties.push(sizeProperty);
nodes.push(newNode);
}
return nodes;
}
示例3: findInitialNodeId
private findInitialNodeId(nodesMap: Map<String, DiagramNode>): string {
for (var id in nodesMap) {
if (nodesMap.hasOwnProperty(id)) {
var node: DiagramNode = nodesMap[id];
if (node.getType() === "InitialNode") {
return node.getJointObject().id;
}
}
}
throw new Error("Initial node was not found");
}