Class TransportationAnalyst3D
- java.lang.Object
-
- com.supermap.data.InternalHandle
-
- com.supermap.data.InternalHandleDisposable
-
- com.supermap.analyst.networkanalyst3d.TransportationAnalyst3D
-
public class TransportationAnalyst3D extends InternalHandleDisposable
The TransportationAnalyst3D class is used to provide the transportation analyst function based on the 3D network dataset. Currently, it only supports the optimal path analysis.
Roads, railways, building channels and mine tunnels can be simulated using the transportation network. Unlike the facility network model, the transportation network model doesn't has direction. Through you can specify direction for the network arc, the circulation media (such as the pedestrian or transmission resources) can decide the direction, speed and destination. Of course, it is also possible to carry out certain restrictions, for example, setting the traffic rules such as one-way street and forbidden line.
The 3D transportation analysis is based on the 3D network dataset, which is the important content of 3D network analysis. Currently it supports the optimal path analysis. For the transportation network, especially the network that can not be displayed clearly in the 2D plane such as building channels and mine tunnels, the 3D network can give a more real display on the spatial topological structure and analysis results of the network.
Basic steps:Sets the environment of the 3D transportation network analysis (the
setAnalystSetting()
property).2. (Optional) Checks the data for the network dataset to be analyzed (the
check()
method).Loads the network model (the
load()
method);4. Performs the various transportation network analysis method provided by the TransportationAnalyst3D class.
-
-
Constructor Summary
Constructors Constructor and Description TransportationAnalyst3D()
Constructs a new TransportationAnalyst3D object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description TransportationAnalystCheckResult3D
check()
Checks the data for the 3D transportation network dataset, and returns the results object of the Check class.void
dispose()
Release the resource occupy by this object.TransportationAnalystResult3D
findPath(TransportationAnalystParameter3D parameter)
Optimal path analysis.TransportationAnalystSetting3D
getAnalystSetting()
Returns the environmental settings of the 3D transportation network analysis.boolean
load()
Loads the network model according to the TransportationAnalyst3D settings.void
setAnalystSetting(TransportationAnalystSetting3D value)
Sets the environmental settings of the 3D transportation network analysis.
-
-
-
Constructor Detail
-
TransportationAnalyst3D
public TransportationAnalyst3D()
Constructs a new TransportationAnalyst3D object.
-
-
Method Detail
-
dispose
public void dispose()
Release the resource occupy by this object.
-
load
public boolean load()
Loads the network model according to the TransportationAnalyst3D settings. Loads the network model according to the environment parameters of theTransportationAnalystSetting3D
class. Only when the load method is called, the parameters in the TransportationAnalystSetting3D object are valid. This method needs to be called after setting thesetAnalystSetting()
property. Note: The following two situations must recall theload()
method to load the network model. Thisdispose()
method need to be called for just once before the analysis, there is no needed to call it every time before every analysis. 1. If you modify the parameters of the TransportationAnalystSetting3D object, you need to reload this method. Otherwise, the modification is invalid. 2. Any modifications to the network dataset, such as the data change, dataset replace, must reload the network model. Otherwise, the analysis may result in error. 3. If the Load method has been called for loading the network model, before calling the Load method again, the Dispose method must be called to dispose the resources, otherwise the load will fail.- Returns:
- A boolean value denotes whether the network model loads successfully or not. True if successful; otherwise, false.
-
getAnalystSetting
public TransportationAnalystSetting3D getAnalystSetting()
Returns the environmental settings of the 3D transportation network analysis.- Returns:
- The environmental settings of the 3D transportation network analysis.
-
setAnalystSetting
public void setAnalystSetting(TransportationAnalystSetting3D value)
Sets the environmental settings of the 3D transportation network analysis.- Parameters:
value
- The environmental settings of the 3D transportation network analysis.
-
findPath
public TransportationAnalystResult3D findPath(TransportationAnalystParameter3D parameter)
Optimal path analysis. The optimal path analysis is used to find the optimal path that passes through the specified N points of the network dataset, which has the flowing two features: 1. This path must pass through the N points according to the specified order, i.e., these points are ordinal; 2. The cost of this path must be the least. The cost is determined by the specified weight according to the parameters of the transportation network analysis. The weight can be length, time, traffic situation, cost, etc. Hence, the optimal path can be the shortest path, the least time-consuming path, the best traffic condition path, the lowest cost path, etc. There are two ways for specifying the points to be analyzed: 1. Node mode: The nodes' ID passed by the optimal path analysis can be specified by thesetNodes()
method of theTransportationAnalystParameter3D
class. The order of the network nodes is the order of the node ID array; 2. Arbitrary coordinate point mode: The coordinates of the point passed by the optimal path analysis can be specified by thesetPoints(
method of theTransportationAnalystParameter3D
class. Now, the points in the analysis is the corresponding dataset of the coordinate points, and the order of the points in the analysis is the order of the coordinate points in the point dataset. Note: You can not use the two modes at the same time.- Parameters:
parameter
- The specified environmental settings of the 3D transportation network analysis.- Returns:
- The results of the 3D transportation network analysis.
- Example:
- The following codes demonstrate how to perform the 3D optimal path analysis.
If there is a 3D network dataset named "networkDataset" in the datasource and a traffic rule field name "TrafficRule", the following codes use the length of the edge as the weight to analyze the optimal path passing through nodes 69, 106 and 43, and ultimately export the ID number of all the nodes and edges passed by the optimal path.
private void findPathExample(DatasetVector networkDataset) { //Constructs an environment setting object for 3D traffic network analysis TransportationAnalystSetting3D transportationAnalystSetting = new TransportationAnalystSetting3D(); transportationAnalystSetting.setNetworkDataset(networkDataset); transportationAnalystSetting.setNodeIDField("SMNODEID"); transportationAnalystSetting.setEdgeIDField("SMEDGEID"); transportationAnalystSetting.setFNodeIDField("SMFNODE"); transportationAnalystSetting.setTNodeIDField("SMTNODE"); transportationAnalystSetting.setTolerance(20); //Sets the weight information WeightFieldInfo3D weightFieldInfo = new WeightFieldInfo3D(); weightFieldInfo.setName("Length"); weightFieldInfo.setFTWeightField("SMLENGTH"); weightFieldInfo.setTFWeightField("SMLENGTH"); WeightFieldInfos3D weightFieldInfos = new WeightFieldInfos3D(); weightFieldInfos.add(weightFieldInfo); transportationAnalystSetting.setWeightFieldInfos(weightFieldInfos); //Sets the barrier nodes and edges transportationAnalystSetting.setBarrierNodes(new int[] { 17, 104 }); transportationAnalystSetting.setBarrierEdges(new int[] { 80, 310, 309 }); //Sets the traffic rules transportationAnalystSetting.setRuleField("TrafficRule"); transportationAnalystSetting.setFTSingleWayRuleValues(new String[] { "FT" }); transportationAnalystSetting.setTFSingleWayRuleValues(new String[] { "TF" }); transportationAnalystSetting.setTwoWayRuleValues(new String[] { "Two" }); transportationAnalystSetting.setProhibitedWayRuleValues(new String[] { "Prohibite" }); //Constructs an object for 3D traffic network analysis TransportationAnalyst3D transportationAnalyst = new TransportationAnalyst3D(); transportationAnalyst.setAnalystSetting(transportationAnalystSetting); //Loads the network model Boolean isLoad = transportationAnalyst.load(); if (isLoad) { //Constructs a parameter object for 3D traffic network analysis TransportationAnalystParameter3D parameter = new TransportationAnalystParameter3D(); parameter.setNodes(new int[] { 69, 106, 43 }); parameter.setWeightName("Length"); parameter.setNodesReturn(true); parameter.setEdgesReturn(true); parameter.setRoutesReturn(true); parameter.setStopIndexesReturn(true); //Sets the best path analysis TransportationAnalystResult3D result = transportationAnalyst.findPath(parameter); //Outputs the nodes that the best path passes int[][] nodes = result.getNodes(); System.out.println("The nodes that the best path passes are:"); for (int i = 0; i < nodes[0].length; i++) { System.out.print(nodes[0][i] + " "); } System.out.println(); //段Outputs the arcs that the best path passes int[][] edges = result.getEdges(); System.out.println("The arcs that the best path passes are:"); for (int i = 0; i < edges[0].length; i++) { System.out.print(edges[0][i] + " "); } System.out.println(); } //Releases the resources transportationAnalyst.dispose(); }
-
check
public TransportationAnalystCheckResult3D check()
Checks the data for the 3D transportation network dataset, and returns the results object of the Check class. This method will check the 3D transportation network dataset and offer the error information for users, which is convenient for them to modify the data. So it avoids the analysis errors because of the data error. Note:This method will be called after setting the transportation analyst environment (setAnalystSetting). But you needn't the method of loading network model Load. This method returns an TransportationAnalystCheckResult3D object. Gets the arc/node error information by getArcErrorInfos and getNodeErrorInfos. The error information will be stored in the dictionary. The key denotes the SMID of the error arcs/nodes, and the value denotes the error type represented by the digital number (the meaning of the number is showed in the table below).- Returns:
- The data check result of the 3D transportation network analysis.
-
-