Examples of MapNode


Examples of net.sf.myway.map.da.entities.MapNode

    polyline.setForegroundColor(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));
    polyline.setLineWidth(5);
    polyline.setLineStyle(SWT.LINE_SOLID);
    polyline.setBackgroundColor(Display.getDefault().getSystemColor(SWT.COLOR_RED));
    for (final MapNodeRef ref : ((MapObjectNodes) getModel()).getObject().getNodes()) {
      final MapNode node = ref.getNode();
      final Point p = getCoordinateSystem().toPoint(node.getPosition());
      polyline.addPoint(p);
    }
    polyline.setPreferredSize(polyline.getBounds().width, polyline.getBounds().height);
    return polyline;
  }
View Full Code Here

Examples of org.apache.flink.compiler.dag.MapNode

  private static final DataSourceNode getSourceNode() {
    return new DataSourceNode(new GenericDataSourceBase<String, TextInputFormat>(new TextInputFormat(new Path("/")), new OperatorInformation<String>(BasicTypeInfo.STRING_TYPE_INFO)));
  }
 
  private static final MapNode getMapNode() {
    return new MapNode(new MapOperatorBase<String, String, MapFunction<String,String>>(new IdentityMapper<String>(), new UnaryOperatorInformation<String, String>(BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO), "map op"));
  }
View Full Code Here

Examples of org.apache.flink.compiler.dag.MapNode

        DataSourceNode dsn = new DataSourceNode((GenericDataSourceBase<?, ?>) c);
        this.sources.add(dsn);
        n = dsn;
      }
      else if (c instanceof MapOperatorBase) {
        n = new MapNode((MapOperatorBase<?, ?, ?>) c);
      }
      else if (c instanceof MapPartitionOperatorBase) {
        n = new MapPartitionNode((MapPartitionOperatorBase<?, ?, ?>) c);
      }
      else if (c instanceof org.apache.flink.api.common.operators.base.CollectorMapOperatorBase) {
View Full Code Here

Examples of org.jboss.dna.graph.connector.map.MapNode

    }

    @Test
    public void shouldCreateNodesByPath() {
        Name name_a = nameFactory.create("a");
        MapNode node_a = workspace.createNode(context, workspace.getRoot(), name_a, null);
        assertThat(node_a, is(notNullValue()));
        assertThat(node_a.getParent(), is(workspace.getRoot()));
        assertThat(node_a.getName().getName(), is(name_a));
        assertThat(node_a.getName().hasIndex(), is(false));

        Name name_b = nameFactory.create("b");
        MapNode node_b = workspace.createNode(context, node_a, name_b, null);
        assertThat(node_b, is(notNullValue()));
        assertThat(node_b.getParent(), is(node_a));
        assertThat(node_b.getName().getName(), is(name_b));
        assertThat(node_b.getName().hasIndex(), is(false));

        Name name_c = nameFactory.create("c");
        MapNode node_c = workspace.createNode(context, node_b, name_c, null);
        assertThat(node_c, is(notNullValue()));
        assertThat(node_c.getParent(), is(node_b));
        assertThat(node_c.getName().getName(), is(name_c));
        assertThat(node_c.getName().hasIndex(), is(false));

        assertThat(workspace.size(), is(4));
        assertThat(workspace.getNode(pathFactory.create("/")), is(sameInstance(workspace.getRoot())));
        assertThat(workspace.getNode(pathFactory.create("/a")), is(sameInstance(node_a)));
        assertThat(workspace.getNode(pathFactory.create("/a/b")), is(sameInstance(node_b)));
View Full Code Here

Examples of org.jboss.dna.graph.connector.map.MapNode

        assertThat(workspace.getNode(pathFactory.create("/a/b/c")), is(sameInstance(node_c)));
    }

    @Test
    public void shouldNotFindNodesThatDoNotExist() {
        MapNode node_a = workspace.createNode(context, workspace.getRoot(), nameFactory.create("a"), null);
        MapNode node_b = workspace.createNode(context, node_a, nameFactory.create("b"), null);
        /*Node node_c =*/workspace.createNode(context, node_b, nameFactory.create("c"), null);

        assertThat(workspace.size(), is(4));
        assertThat(workspace.getNode(pathFactory.create("/a")), is(node_a));
        assertThat(workspace.getNode(pathFactory.create("/a/b")), is(node_b));
View Full Code Here

Examples of org.jboss.dna.graph.connector.map.MapNode

    }

    @Test
    public void shouldCorrectlyManageIndexesOfSiblingsWithSameNames() {
        Name name_a1 = nameFactory.create("a");
        MapNode node_a1 = workspace.createNode(context, workspace.getRoot(), name_a1, null);
        assertThat(node_a1, is(notNullValue()));
        assertThat(node_a1.getParent(), is(workspace.getRoot()));
        assertThat(node_a1.getName().getName(), is(name_a1));
        assertThat(node_a1.getName().hasIndex(), is(false));

        Name name_a2 = nameFactory.create("a");
        MapNode node_a2 = workspace.createNode(context, workspace.getRoot(), name_a2, null);
        assertThat(node_a2, is(notNullValue()));
        assertThat(node_a2.getParent(), is(workspace.getRoot()));
        assertThat(node_a2.getName().getName(), is(name_a2));
        assertThat(node_a2.getName().hasIndex(), is(true));
        assertThat(node_a2.getName().getIndex(), is(2));

        // node 1 should now have an index ..
        assertThat(node_a1.getName().getIndex(), is(1));

        // Add another node without the same name ..
        Name name_b = nameFactory.create("b");
        MapNode node_b = workspace.createNode(context, workspace.getRoot(), name_b, null);
        assertThat(node_b, is(notNullValue()));
        assertThat(node_b.getParent(), is(workspace.getRoot()));
        assertThat(node_b.getName().getName(), is(name_b));
        assertThat(node_b.getName().hasIndex(), is(false));

        // Add a third node with the same name ..
        Name name_a3 = nameFactory.create("a");
        MapNode node_a3 = workspace.createNode(context, workspace.getRoot(), name_a3, null);
        assertThat(node_a3, is(notNullValue()));
        assertThat(node_a3.getParent(), is(workspace.getRoot()));
        assertThat(node_a3.getName().getName(), is(name_a3));
        assertThat(node_a3.getName().hasIndex(), is(true));
        assertThat(node_a3.getName().getIndex(), is(3));

        // Check the number of children ..
        assertThat(workspace.getRoot().getChildren().size(), is(4));
        assertThat(workspace.getRoot().getChildren(), hasItems(node_a1, node_a2, node_b, node_a3));
        assertThat(workspace.size(), is(5));
        assertThat(workspace.getNode(pathFactory.create("/a[1]")), is(sameInstance(node_a1)));
        assertThat(workspace.getNode(pathFactory.create("/a[2]")), is(sameInstance(node_a2)));
        assertThat(workspace.getNode(pathFactory.create("/a[3]")), is(sameInstance(node_a3)));
        assertThat(workspace.getNode(pathFactory.create("/b")), is(sameInstance(node_b)));

        // Removing a node with the same name will reduce the index ..
        workspace.removeNode(context, node_a2);
        assertThat(workspace.getRoot().getChildren().size(), is(3));
        assertThat(workspace.getRoot().getChildren(), hasItems(node_a1, node_b, node_a3));
        assertThat(node_a1.getName().getIndex(), is(1));
        assertThat(node_b.getName().hasIndex(), is(false));
        assertThat(node_a3.getName().getIndex(), is(2));

        // Removing a node with the same name will reduce the index ..
        workspace.removeNode(context, node_a1);
        assertThat(workspace.getRoot().getChildren().size(), is(2));
        assertThat(workspace.getRoot().getChildren(), hasItems(node_b, node_a3));
        assertThat(node_b.getName().hasIndex(), is(false));
        assertThat(node_a3.getName().hasIndex(), is(false));
        assertThat(workspace.size(), is(3));
    }
View Full Code Here

Examples of org.jboss.dna.graph.connector.map.MapNode

        assertThat(workspace.size(), is(3));
    }

    @Test
    public void shouldMoveNodesWithinSameWorkspace() {
        MapNode root = workspace.getRoot();
        MapNode node_a = workspace.createNode(context, root, nameFactory.create("a"), null);
        MapNode node_b = workspace.createNode(context, node_a, nameFactory.create("b"), null);
        MapNode node_c = workspace.createNode(context, node_b, nameFactory.create("c"), null);
        MapNode node_d = workspace.createNode(context, root, nameFactory.create("d"), null);
        MapNode node_e = workspace.createNode(context, node_d, nameFactory.create("e"), null);
        MapNode node_b2 = workspace.createNode(context, node_d, nameFactory.create("b"), null);

        assertThat(workspace.size(), is(7));
        assertThat(workspace.getNode(pathFactory.create("/")), is(sameInstance(workspace.getRoot())));
        assertThat(workspace.getNode(pathFactory.create("/a")), is(sameInstance(node_a)));
        assertThat(workspace.getNode(pathFactory.create("/a/b")), is(sameInstance(node_b)));
View Full Code Here

Examples of org.jboss.dna.graph.connector.map.MapNode

        assertThat(workspace.getNode(pathFactory.create("/d/b")), is(sameInstance(node_b2)));
    }

    @Test
    public void shouldMoveNodeBeforeAnother() {
        MapNode root = workspace.getRoot();
        MapNode node_a = workspace.createNode(context, root, nameFactory.create("a"), null);
        MapNode node_b = workspace.createNode(context, node_a, nameFactory.create("b"), null);
        MapNode node_c = workspace.createNode(context, node_b, nameFactory.create("c"), null);
        MapNode node_d = workspace.createNode(context, root, nameFactory.create("d"), null);
        MapNode node_e = workspace.createNode(context, node_d, nameFactory.create("e"), null);
        MapNode node_b2 = workspace.createNode(context, node_d, nameFactory.create("b"), null);
        Name propName = nameFactory.create("prop");
        node_b.setProperty(propertyFactory.create(propName, "node_b"));
        node_b2.setProperty(propertyFactory.create(propName, "node_b2"));

        assertThat(workspace.size(), is(7));
        assertThat(workspace.getNode(pathFactory.create("/")), is(sameInstance(workspace.getRoot())));
        assertThat(workspace.getNode(pathFactory.create("/a")), is(sameInstance(node_a)));
        assertThat(workspace.getNode(pathFactory.create("/a/b")), is(sameInstance(node_b)));
View Full Code Here

Examples of org.osm2world.core.map_data.data.MapNode

        if (x % PATCH_SIZE_POINTS == 0 || x == posGrid.sizeX() - 1
            || z % PATCH_SIZE_POINTS == 0 || z == posGrid.sizeZ() - 1) {
         
          VectorXZ pos = posGrid.get(x, z);
         
          MapNode mapNode = new MapNode(pos, EMPTY_SURFACE_NODE);
         
          nodeGrid[x][z] = mapNode;
          mapNodes.add(mapNode);
         
        }
View Full Code Here

Examples of org.osm2world.core.map_data.data.MapNode

            VectorXZ intersection = getLineSegmentIntersection(
                side.p1, side.p2, r1, r2);
           
            if (intersection != null) {
           
              MapNode intersectionNode;
             
              if (intersection.equals(r1)) {
                intersectionNode = coastline.get(i);
              } else if (intersection.equals(r2)) {
                intersectionNode = coastline.get(i + 1);
              } else {
               
                intersectionNode = createFakeMapNode(intersection,
                    ++highestNodeId, osmData, nodeMap, mapNodes);
               
                coastline.add(i + 1, intersectionNode);
               
                i += 1;
               
              }
             
              intersectionsSide.add(new NodeOnBBox(intersectionNode,
                  isRightOf(r1, side.p1, side.p2)));
             
            }
           
          }
         
        }
       
        /* add intersections for this side of the bbox,
         * sorted by distance from corner */
       
        Collections.sort(intersectionsSide, new Comparator<NodeOnBBox>() {
          @Override public int compare(NodeOnBBox n1, NodeOnBBox n2) {
            return Double.compare(
                n1.node.getPos().distanceTo(side.p1),
                n2.node.getPos().distanceTo(side.p1));
          }
        });
       
        bBoxNodes.addAll(intersectionsSide);
       
        MapNode cornerNode = createFakeMapNode(side.p2,
            ++highestNodeId, osmData, nodeMap, mapNodes);
        bBoxNodes.add(new NodeOnBBox(cornerNode, null));
       
      }
     
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.