Skip to content

Commit

Permalink
Added Eclipse RCP project directory for each of the KNOT nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
luistar committed Apr 20, 2021
1 parent de3a81b commit 0f813de
Show file tree
Hide file tree
Showing 145 changed files with 9,675 additions and 0 deletions.
10 changes: 10 additions & 0 deletions nodes/FcdTrajectoryManipulator/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/okio-1.13.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/okhttp-3.9.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/json-20210307.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
28 changes: 28 additions & 0 deletions nodes/FcdTrajectoryManipulator/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.unina.spatialanalysis.routecalculator</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
18 changes: 18 additions & 0 deletions nodes/FcdTrajectoryManipulator/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: RouteCalculator-Node extension for KNIME Workbench
Bundle-SymbolicName: org.unina.spatialanalysis.routecalculator;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-ClassPath: routecalculator.jar,
lib/json-20210307.jar,
lib/okhttp-3.9.0.jar,
lib/okio-1.13.0.jar
Bundle-Activator: org.unina.spatialanalysis.routecalculator.RouteCalculatorNodePlugin
Bundle-Vendor: Sinogrante
Require-Bundle: org.eclipse.core.runtime,
org.knime.workbench.core,
org.knime.workbench.repository,
org.knime.base
Bundle-ActivationPolicy: lazy
Export-Package: org.unina.spatialanalysis.routecalculator

1 change: 1 addition & 0 deletions nodes/FcdTrajectoryManipulator/bin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/org/
8 changes: 8 additions & 0 deletions nodes/FcdTrajectoryManipulator/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source.routecalculator.jar = src/
bin.includes = plugin.xml,\
routecalculator.jar,\
META-INF/,\
lib/json-20210307.jar,\
lib/okhttp-3.9.0.jar,\
lib/okio-1.13.0.jar

Binary file not shown.
Binary file not shown.
Binary file not shown.
23 changes: 23 additions & 0 deletions nodes/FcdTrajectoryManipulator/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>

<!--<extension
point="org.knime.workbench.repository.categories">
<category
description="Category containing my nodes"
icon="src/org/unina/spatialanalysis/routecalculator/road-route-map-16.png"
level-id="mobility"
name="My nodes"
path="/community/mobility"/>
</extension>-->

<extension
point="org.knime.workbench.repository.nodes">
<node
category-path="/"
factory-class="org.unina.spatialanalysis.routecalculator.RouteCalculatorNodeFactory"
id="org.knime.spatialanalysis.routecalculator.RouteCalculatorNodeFactory"/>
</extension>

</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
package org.unina.spatialanalysis.routecalculator;

import java.util.Arrays;

import javax.swing.ToolTipManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

import org.knime.core.node.defaultnodesettings.DefaultNodeSettingsPane;
import org.knime.core.node.defaultnodesettings.DialogComponentNumberEdit;
import org.knime.core.node.defaultnodesettings.DialogComponentString;
import org.knime.core.node.defaultnodesettings.DialogComponentStringSelection;
import org.knime.core.node.defaultnodesettings.SettingsModelIntegerBounded;
import org.knime.core.node.defaultnodesettings.SettingsModelString;

/**
* @author Sinogrante Principe
*/
public class RouteCalculatorNodeDialog extends DefaultNodeSettingsPane {

private static final String [] avaibleRoutingServices = {"OSRM"};

private static final String [] OSRMAvailableModes = {"shortest"};

private static final String PAIR_TYPE_TOOLTIP = "<html>"
+ "This setting informs the node about the type of points present"
+ "<br>in the input data.</br>"
+ "</html>";

private static final String OSRM_SERVER_TOOLTIP = "<html>"
+ "The url inserted here must correspond to a running instance"
+ "<br>of the OSRM routing machine.</br>"
+ "</html>";

private static final String ROUTING_MODE_TOOLTIP = "<html>"
+ "Choosing match means that a set of positions belonging to the same route"
+ "<br>will be all used to found the most likely traversed path.</br>"
+ "<br>Choosing shortest means that only the starting and ending position will be</br>"
+ "<br>used to determine the shortest possible path between them.</br>"
+ "</html>";

private static final String MIN_ROUTE_DISTANCE_TOOLTIP = "<html>"
+ "This value (meters) is used to determine wether a route should be considered valid."
+ "<br>Routes that are less long than this value will be discarded.</br>"
+ "</html>";

private static final String MIN_ROUTE_DURATION_TOOLTIP = "<html>"
+ "This value (minutes) is used to determine wether a route should be considered valid."
+ "<br>Routes that last less than this value will be discarded.</br>"
+ "</html>";


/**
* New dialog pane for configuring the node. The dialog created here
* will show up when double clicking on a node in KNIME Analytics Platform.
*/
protected RouteCalculatorNodeDialog() {
super();


ToolTipManager.sharedInstance().setDismissDelay(15000);

SettingsModelString routingService = RouteCalculatorNodeModel.createRoutingServiceSettings();
DialogComponentStringSelection routingServiceSelector = new DialogComponentStringSelection(routingService, "Select the Routing Machine: ", avaibleRoutingServices);
this.addDialogComponent(routingServiceSelector);

SettingsModelString osrmHost = RouteCalculatorNodeModel.createRoutingServiceHostSettings();
DialogComponentString osrmServerSelector = new DialogComponentString(osrmHost, "Insert OSRM server: ", true, 40);
osrmServerSelector.setToolTipText(OSRM_SERVER_TOOLTIP);
osrmHost.setEnabled(true);
addDialogComponent(osrmServerSelector);

SettingsModelString routingMode = RouteCalculatorNodeModel.createRoutingModeSettings();
DialogComponentStringSelection routingModeSelector = new DialogComponentStringSelection(routingMode, "Routing mode :", OSRMAvailableModes);
routingModeSelector.setToolTipText(ROUTING_MODE_TOOLTIP);
routingMode.setEnabled(true);
addDialogComponent(routingModeSelector);

SettingsModelString coordinatePairType = RouteCalculatorNodeModel.createCoordinatePairTypeSettings();
DialogComponentStringSelection pairTypeSelector = new DialogComponentStringSelection(coordinatePairType, "Select the coordinates pair type of the input data:","{lat,lon}","{lon,lat}") ;
pairTypeSelector.setToolTipText(PAIR_TYPE_TOOLTIP);
coordinatePairType.setEnabled(true);
addDialogComponent(pairTypeSelector);

SettingsModelIntegerBounded minRouteDistance = RouteCalculatorNodeModel.createMinRouteDistanceSettings();
DialogComponentNumberEdit minRouteDistanceSelector = new DialogComponentNumberEdit(minRouteDistance, "Ignore al routes that are less than this value (meters) long : ", 10);
minRouteDistanceSelector.setToolTipText(MIN_ROUTE_DISTANCE_TOOLTIP);
minRouteDistance.setEnabled(true);
addDialogComponent(minRouteDistanceSelector);

SettingsModelIntegerBounded minRouteDuration = RouteCalculatorNodeModel.createMinRouteDurationSettings();
DialogComponentNumberEdit minRouteDurationSelector = new DialogComponentNumberEdit(minRouteDuration, "Ignore al routes that are less than this value (minutes) long : ", 10);
minRouteDurationSelector.setToolTipText(MIN_ROUTE_DURATION_TOOLTIP);
minRouteDuration.setEnabled(true);
addDialogComponent(minRouteDurationSelector);


routingService.addChangeListener(new ChangeListener() {

@Override
public void stateChanged(ChangeEvent e) {
switch(routingService.getStringValue()) {
case("OSRM"):{
osrmHost.setEnabled(true);
routingModeSelector.replaceListItems(Arrays.asList(OSRMAvailableModes), "shortest");
routingMode.setEnabled(true);
minRouteDistance.setEnabled(true);
minRouteDuration.setEnabled(true);
break;
}
}
}
});
}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package org.unina.spatialanalysis.routecalculator;

import org.knime.core.node.NodeDialogPane;
import org.knime.core.node.NodeFactory;
import org.knime.core.node.NodeView;

/**
* This is an example implementation of the node factory of the
* "RouteCalculator" node.
*
* @author Sinogrante
*/
public class RouteCalculatorNodeFactory
extends NodeFactory<RouteCalculatorNodeModel> {

/**
* {@inheritDoc}
*/
@Override
public RouteCalculatorNodeModel createNodeModel() {
// Create and return a new node model.
return new RouteCalculatorNodeModel();
}

/**
* {@inheritDoc}
*/
@Override
public int getNrNodeViews() {
// The number of views the node should have, in this cases there is none.
return 1;
}

/**
* {@inheritDoc}
*/
@Override
public NodeView<RouteCalculatorNodeModel> createNodeView(final int viewIndex,
final RouteCalculatorNodeModel nodeModel) {
// We return null as this example node does not provide a view. Also see "getNrNodeViews()".
return null;
}

/**
* {@inheritDoc}
*/
@Override
public boolean hasDialog() {
// Indication whether the node has a dialog or not.
return true;
}

/**
* {@inheritDoc}
*/
@Override
public NodeDialogPane createNodeDialogPane() {
// This example node has a dialog, hence we create and return it here. Also see "hasDialog()".
return new RouteCalculatorNodeDialog();
}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<knimeNode icon="./road-route-map-16.png" type="Manipulator" xmlns="http://knime.org/node/v2.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://knime.org/node/v2.10 http://knime.org/node/v2.10.xsd">
<name>FCD Trajectory Restorator</name>

<shortDescription>
Performs trajectory restoration from Floating Car Data (FCD).
</shortDescription>

<fullDescription>
<intro>The Node takes as input the table Positions in Routes of the node Trajectory Assigner and proceeds to match it to routes,
shown as a Linestring of lon/lat pairs (accordingly to WKT). The node assumes that the input data contains at least the following information:
an id of the vehicle, an id of the route, a time, a Point.
The routing calculations are done via an external API (the current version supports only Project OSRM).</intro>
<option name="Coordinate Pair Type" > Specifies if the input data positions are either lat/lon or lon/lat.
</option>

<option name="Routing Service">The routing service to be used. </option>

<option name="Routing Server Host" > Specifies the host for the routing service.
</option>

<option name="Routing Mode" > Allows the user to select how the routes should be calculated.
</option>

<option name="Minum Duration">A route that lasts less than this number of minutes will be discarded.
</option>

<option name="Minum Distance">A route that lasts less than this number of meters will be discarded.
</option>


</fullDescription>




<ports>
<inPort index="0" name="Positions Data-Set">The input table must contains at least the following columns:
<ul>
<li>route_id, a long identifying the route.</li>
<li>owner_id, an integer identifying the owner of the position;</li>
<li>timestamp, a String identifying when this position was recorded;</li>
<li>location, a String containing the location similar to POINT( coordinate1 coordinate2).</li>
</ul>
The input data must be sorted by route_id. The best way to achieve this conditions is to use
the node Trajectory Assigner of the KNOT toolkit.
</inPort>
<outPort index="0" name="Routes">This port contains the routes calculated accordingly to the route type chosen in the settings</outPort>
</ports>
</knimeNode>
Loading

0 comments on commit 0f813de

Please sign in to comment.