Search in sources :

Example 96 with Node

use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Node in project osmosis by openstreetmap.

the class BoundingBoxFilterTest method setUp.

/**
 * Performs pre-test activities.
 */
@Before
public void setUp() {
    OsmUser user;
    List<Tag> tags;
    user = new OsmUser(12, "OsmosisTest");
    // All nodes have an empty tags list.
    tags = new ArrayList<Tag>();
    entityInspector = new SinkEntityInspector();
    // simpleAreaFilter doesn't cross antimeridian; no complete ways or relations
    simpleAreaFilter = new BoundingBoxFilter(IdTrackerType.Dynamic, -20, 20, 20, -20, false, false, false, false);
    simpleAreaFilter.setSink(entityInspector);
    intersectingBound = new Bound(30, 10, 30, 10, "intersecting");
    nonIntersectingBound = new Bound(-30, -50, 10, -10, "nonintersecting");
    inAreaNode = new Node(new CommonEntityData(1234, 0, new Date(), user, 0, tags), 10, 10);
    outOfAreaNode = new Node(new CommonEntityData(1235, 0, new Date(), user, 0, tags), 30, 30);
    edgeNodeEast = new Node(new CommonEntityData(1236, 0, new Date(), user, 0, tags), 10, 20);
    edgeNodeWest = new Node(new CommonEntityData(1237, 0, new Date(), user, 0, tags), 10, -20);
    edgeNodeNorth = new Node(new CommonEntityData(1238, 0, new Date(), user, 0, tags), 20, 10);
    edgeNodeSouth = new Node(new CommonEntityData(1239, 0, new Date(), user, 0, tags), -20, 10);
}
Also used : CommonEntityData(org.openstreetmap.osmosis.core.domain.v0_6.CommonEntityData) OsmUser(org.openstreetmap.osmosis.core.domain.v0_6.OsmUser) Node(org.openstreetmap.osmosis.core.domain.v0_6.Node) Bound(org.openstreetmap.osmosis.core.domain.v0_6.Bound) Tag(org.openstreetmap.osmosis.core.domain.v0_6.Tag) SinkEntityInspector(org.openstreetmap.osmosis.testutil.v0_6.SinkEntityInspector) Date(java.util.Date) Before(org.junit.Before)

Example 97 with Node

use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Node in project osmosis by openstreetmap.

the class PolygonFilterTest method setUp.

/**
 * Performs pre-test activities.
 */
@Before
public void setUp() {
    OsmUser user;
    List<Tag> tags;
    user = new OsmUser(12, "OsmosisTest");
    // All nodes have an empty tags list.
    tags = new ArrayList<Tag>();
    polygonFile = new File(getClass().getResource("testPolygon.txt").getFile());
    entityInspector = new SinkEntityInspector();
    // polyAreaFilter has a notch out of the Northeast corner.
    polyAreaFilter = new PolygonFilter(IdTrackerType.Dynamic, polygonFile, false, false, false, false);
    polyAreaFilter.setSink(entityInspector);
    intersectingBound = new Bound(30, 0, 30, 0, "intersecting");
    crossingIntersectingBound = new Bound(-10, 10, 30, -30, "crossing intersecting");
    nonIntersectingBound = new Bound(30, 15, 30, 15, "nonintersecting");
    inAreaNode = new Node(new CommonEntityData(1234, 0, new Date(), user, 0, tags), 5, 10);
    outOfAreaNode = new Node(new CommonEntityData(1235, 0, new Date(), user, 0, tags), 15, 15);
    edgeNode = new Node(new CommonEntityData(1236, 0, new Date(), user, 0, tags), 15, 10);
}
Also used : CommonEntityData(org.openstreetmap.osmosis.core.domain.v0_6.CommonEntityData) OsmUser(org.openstreetmap.osmosis.core.domain.v0_6.OsmUser) Node(org.openstreetmap.osmosis.core.domain.v0_6.Node) Bound(org.openstreetmap.osmosis.core.domain.v0_6.Bound) Tag(org.openstreetmap.osmosis.core.domain.v0_6.Tag) SinkEntityInspector(org.openstreetmap.osmosis.testutil.v0_6.SinkEntityInspector) File(java.io.File) Date(java.util.Date) Before(org.junit.Before)

Example 98 with Node

use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Node in project osmosis by openstreetmap.

the class NodeKeyFilter method process.

/**
 * {@inheritDoc}
 */
public void process(NodeContainer container) {
    Node node = container.getEntity();
    boolean matchesFilter = false;
    for (Tag tag : node.getTags()) {
        if (allowedKeys.contains(tag.getKey())) {
            matchesFilter = true;
            break;
        }
    }
    if (matchesFilter) {
        sink.process(container);
    }
}
Also used : Node(org.openstreetmap.osmosis.core.domain.v0_6.Node) Tag(org.openstreetmap.osmosis.core.domain.v0_6.Tag)

Example 99 with Node

use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Node in project osmosis by openstreetmap.

the class NodeKeyValueFilter method process.

/**
 * {@inheritDoc}
 */
public void process(NodeContainer container) {
    Node node = container.getEntity();
    boolean matchesFilter = false;
    for (Tag tag : node.getTags()) {
        String keyValue = tag.getKey() + "." + tag.getValue();
        if (allowedKeyValues.contains(keyValue)) {
            matchesFilter = true;
            break;
        }
    }
    if (matchesFilter) {
        sink.process(container);
    }
}
Also used : Node(org.openstreetmap.osmosis.core.domain.v0_6.Node) Tag(org.openstreetmap.osmosis.core.domain.v0_6.Tag)

Example 100 with Node

use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Node in project osmosis by openstreetmap.

the class TagFilterTest method setUp.

/**
 * Performs pre-test activities.
 */
@Before
public void setUp() {
    OsmUser user;
    List<Tag> tags;
    user = new OsmUser(12, "OsmosisTest");
    tags = Arrays.asList(new Tag("amenity", "bank"), new Tag("Akey", "Avalue"));
    amenityNode = new Node(new CommonEntityData(1101, 0, new Date(), user, 0, tags), 1, 2);
    amenityNodeContainer = new NodeContainer(amenityNode);
    tags = new ArrayList<Tag>();
    taglessNode = new Node(new CommonEntityData(1102, 0, new Date(), user, 0, tags), 3, 4);
    taglessNodeContainer = new NodeContainer(taglessNode);
    tags = Arrays.asList(new Tag("highway", "motorway"), new Tag("Bkey", "Bvalue"));
    motorwayWay = new Way(new CommonEntityData(2201, 0, new Date(), user, 0, tags), new ArrayList<WayNode>());
    motorwayWayContainer = new WayContainer(motorwayWay);
    tags = Arrays.asList(new Tag("highway", "residential"), new Tag("Ckey", "Cvalue"));
    residentialWay = new Way(new CommonEntityData(2202, 0, new Date(), user, 0, tags), new ArrayList<WayNode>());
    residentialWayContainer = new WayContainer(residentialWay);
    tags = Arrays.asList(new Tag("Dkey", "Dvalue"));
    testRelation = new Relation(new CommonEntityData(3301, 0, new Date(), user, 0, tags), new ArrayList<RelationMember>());
    testRelationContainer = new RelationContainer(testRelation);
}
Also used : CommonEntityData(org.openstreetmap.osmosis.core.domain.v0_6.CommonEntityData) WayContainer(org.openstreetmap.osmosis.core.container.v0_6.WayContainer) OsmUser(org.openstreetmap.osmosis.core.domain.v0_6.OsmUser) WayNode(org.openstreetmap.osmosis.core.domain.v0_6.WayNode) Node(org.openstreetmap.osmosis.core.domain.v0_6.Node) ArrayList(java.util.ArrayList) NodeContainer(org.openstreetmap.osmosis.core.container.v0_6.NodeContainer) Date(java.util.Date) Way(org.openstreetmap.osmosis.core.domain.v0_6.Way) Relation(org.openstreetmap.osmosis.core.domain.v0_6.Relation) RelationContainer(org.openstreetmap.osmosis.core.container.v0_6.RelationContainer) Tag(org.openstreetmap.osmosis.core.domain.v0_6.Tag) Before(org.junit.Before)

Aggregations

Node (org.openstreetmap.osmosis.core.domain.v0_6.Node)52 Test (org.junit.Test)27 CommonEntityData (org.openstreetmap.osmosis.core.domain.v0_6.CommonEntityData)26 WayNode (org.openstreetmap.osmosis.core.domain.v0_6.WayNode)21 Date (java.util.Date)18 NodeContainer (org.openstreetmap.osmosis.core.container.v0_6.NodeContainer)17 Tag (org.openstreetmap.osmosis.core.domain.v0_6.Tag)16 Node (org.flyte.api.v1.Node)15 Test (org.junit.jupiter.api.Test)15 ArrayList (java.util.ArrayList)14 OsmUser (org.openstreetmap.osmosis.core.domain.v0_6.OsmUser)14 Way (org.openstreetmap.osmosis.core.domain.v0_6.Way)13 TaskNode (org.flyte.api.v1.TaskNode)10 Bound (org.openstreetmap.osmosis.core.domain.v0_6.Bound)10 List (java.util.List)9 Map (java.util.Map)9 Node (org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Node)9 Node (org.openhab.binding.mqtt.homie.internal.homie300.Node)9 EntityContainer (org.openstreetmap.osmosis.core.container.v0_6.EntityContainer)9 Node (ch.ethz.globis.phtree.v16.Node)8