• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript DiagramNode.DiagramNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中core/editorCore/model/DiagramNode.DiagramNode的典型用法代码示例。如果您正苦于以下问题:TypeScript DiagramNode类的具体用法?TypeScript DiagramNode怎么用?TypeScript DiagramNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了DiagramNode类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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");
     }
 }
开发者ID:qreal,项目名称:wmp,代码行数:57,代码来源:BlockFactory.ts


示例2: 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");
 }
开发者ID:qreal,项目名称:wmp,代码行数:11,代码来源:Interpreter.ts


示例3: 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;
    }
开发者ID:qreal,项目名称:wmp,代码行数:34,代码来源:DiagramThriftExporter.ts


示例4: getEntities

    private getEntities(nodesMap: Map<String, DiagramNode>, linksMap: Map<String, Link>) {
        var nodes = [];
        for (var id in nodesMap) {
            var node: DiagramNode = nodesMap[id];
            if (node.getName() === "entity") {
                var newNode = new TNode();
                newNode.name = node.getChangeableProperties()['name'].value;
                newNode.image = GeneralConstants.APP_ROOT_PATH + "images/" + node.getChangeableProperties()['image'].value + ".svg";
                newNode.properties = this.getProperties(nodesMap, linksMap, node);

                nodes.push(newNode);
            }
        }
        return nodes;
    }
开发者ID:qreal,项目名称:wmp,代码行数:15,代码来源:PaletteExporter.ts


示例5: getOutboundLinks

 private getOutboundLinks(graph: joint.dia.Graph, node: DiagramNode, linksMap: Map<String, Link>): Link[] {
     var links: Link[] = [];
     var cell = graph.getCell(node.getJointObject().id);
     var jointOutboundLinks: joint.dia.Link[] = graph.getConnectedLinks(cell, { outbound : true });
     jointOutboundLinks.forEach((jointLink) => links.push(linksMap[jointLink.id]));
     return links;
 }
开发者ID:qreal,项目名称:wmp,代码行数:7,代码来源:Interpreter.ts


示例6: exportNodes

    protected exportNodes(nodesMap: Map<String, DiagramNode>, linksMap: Map<String, Link>) {
        var nodes = [];

        var initial: string;
        for (var i in nodesMap) {
            var target: boolean = false;
            var node: DiagramNode = nodesMap[i];
            for (var id in linksMap) {
                var link = linksMap[id];
                var jointObject = link.getJointObject();
                if (nodesMap[jointObject.get('target').id] === node) {
                    target = true;
                    break;
                }
            }
            if (target === false) {
                initial = i;
                break;
            }
        }

        var existNext: boolean = true;
        while (existNext) {
            existNext = false;
            var node: DiagramNode = nodesMap[initial];
            var newNode = new TNode();
            newNode.name = node.getName();
            newNode.properties = this.exportProperties(node.getChangeableProperties());
            for (var id in linksMap) {
                var link = linksMap[id];
                var jointObject = link.getJointObject();
                if (nodesMap[jointObject.get('source').id] === node) {
                    initial = jointObject.get('target').id;
                    existNext = true;
                }
            }
            nodes.push(newNode);
        }

        return nodes;
    }
开发者ID:qreal,项目名称:wmp,代码行数:41,代码来源:ModelExporter.ts


示例7: checkRangeNumberOfOutboundLinks

 public checkRangeNumberOfOutboundLinks(minNumber: number, maxNumber: number): void {
     if (this.outboundLinks.length < minNumber) {
         throw new Error("There must be at least " + minNumber + " links from " + this.node.getName());
     }
     if (this.outboundLinks.length > maxNumber) {
         throw new Error("There more than " + maxNumber + " links from " + this.node.getName());
     }
 }
开发者ID:qreal,项目名称:wmp,代码行数:8,代码来源:AbstractBlock.ts


示例8: checkExpectedNumberOfOutboundLinks

 public checkExpectedNumberOfOutboundLinks(expectedNumber: number): void {
     if (this.outboundLinks.length !== expectedNumber) {
         throw new Error("There must be exact " + expectedNumber + " links from " + this.node.getName());
     }
 }
开发者ID:qreal,项目名称:wmp,代码行数:5,代码来源:AbstractBlock.ts



注:本文中的core/editorCore/model/DiagramNode.DiagramNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript entityTags.read.service.EntityTagsReader类代码示例发布时间:2022-05-24
下一篇:
TypeScript IStage.IStage类代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap