Exemple #1
0
 public Id createVisualTransition(Point2D point) {
   Id mathTransition =
       data.add("transition", HashTreePMap.<String, Object>empty().plus("name", "t0"));
   Id visualNode =
       data.add(
           "visualNode",
           HashTreePMap.<String, Object>empty()
               .plus("transform", AffineTransform.getTranslateInstance(point.getX(), point.getY()))
               .plus("parent", eval(currentLevel).getVisualGroupId()));
   return data.add(
       "visualTransition",
       HashTreePMap.<String, Object>empty()
           .plus("visualNode", visualNode)
           .plus("mathNode", mathTransition));
 }
Exemple #2
0
 public Id createVisualPlace(Point2D point, Color tokenColor) {
   Id mathPlace =
       data.add(
           "place",
           HashTreePMap.<String, Object>empty().plus("initialMarking", 0).plus("name", "p0"));
   Id visualNode =
       data.add(
           "visualNode",
           HashTreePMap.<String, Object>empty()
               .plus("transform", AffineTransform.getTranslateInstance(point.getX(), point.getY()))
               .plus("parent", eval(currentLevel).getVisualGroupId()));
   return data.add(
       "visualPlace",
       HashTreePMap.<String, Object>empty()
           .plus("tokenColor", tokenColor)
           .plus("visualNode", visualNode)
           .plus("mathNode", mathPlace));
 }
Exemple #3
0
  public VisualModel() {
    data = new DatabaseEngineImpl(RelationalPetriNet.createSchema().getSchema());
    Id rootVNode =
        data.add(
            "visualNode",
            HashTreePMap.<String, Object>empty()
                .plus("parent", null)
                .plus("transform", new AffineTransform()));
    rootVisualGroup =
        data.add("visualGroup", HashTreePMap.<String, Object>empty().plus("visualNode", rootVNode));
    root = TypeUnsafePetriNetWrapper.wrapVisualGroup(data, rootVisualGroup);
    currentLevel.setValue(root);

    System.out.println("root visual group id: " + rootVNode);

    createVisualPlace(new Point2D.Double(3, 3), Color.RED);
    createVisualTransition(new Point2D.Double(0, 0));
    createVisualPlace(new Point2D.Double(3, 0), Color.GREEN);
    createVisualTransition(new Point2D.Double(0, 3));
  }