com.supermap.analyst.networkanalyst

Class FacilityAnalyst

  • java.lang.Object
    • com.supermap.analyst.networkanalyst.FacilityAnalyst


  • public class FacilityAnalyst
    extends java.lang.Object
    The FacilityAnalyst class.

    The FacilityAnalyst class is a kind of network analyst. It mainly processes the connectivity analysis and the tracing analysis.

    The FacilityAnalyst class is t is a kind of network analyst. So before you can conduct a facility network analysis, you need to have the prerequisite knowledge:

    1. Understand the basic knowledge of the network analysis:
      • What is the network model and how to build the network model;
      • The terms in the network model include nodes, edges, barrier nodes, barrier edges and loops;
      • Know about the differences between the attribute table of the line dataset and the network dataset. Mainly know about the fields in the network dataset that differ from the fields in the common line dataset.
    2. How to create the dataset used in the facility analysis.
    3. The network used for the facility analysis has the flow direction. For example, the substance such as water and electricity will flow according to the network rules.

      The prerequisite for facility network analysis is the construction of facility network dataset.The basis for establishing a data set for facility network analysis is to create a network dataset. For more information, see the SuperMap iDesktop Help documentation for the facility network analysis.

    4. Know about the environment settings of the facility analysis:
    5. When building the network dataset for the facility analysis and performing the facility analysis you must use the FacilityAnalystSetting class to set the environment for the analysis. For more information, please refer to the FacilityAnalystSetting class.

    6. Know about the tracing analysis and the relevant concepts such as the upstreams, the downstreams, sources and sinks.

    When you have the above knowledge,you can use the FacilityAnalyst class provide a variety of methods to achieve a variety of facilities network analysis. Currently,FacilityAnalyst class.provided facilities Network analysis features include:

    1. Finds all the loops joined to the specified nodes according to the given array of the node IDs;
    2. Finds all the loops joined to the specified edges according to the given array of the edge IDs;
    3. Finds all the edges connected with the specified nodes according to the given array of the node IDs;
    4. Finds all the edges connected with the specified edges according to the given array of the edge IDs;
    5. Finds all the edges unconnected with the specified nodes according to the given array of the node IDs;
    6. Finds all the edges unconnected with the specified edges according to the given array of the edge IDs;
    7. Finds the common upstream edges of those node according to the given array of the node IDs;
    8. Finds the common upstream edges of those edges according to the given array of the edge IDs.
    9. Finds the common downstream edges of those nodes according to the given array of the node IDs;
    10. Finds the common downstream edges of those edges according to the given array of the edge IDs.
    11. Finds all the edges between the specified node and its sources;
    12. Finds all the edges between the specified edge and its sources;
    13. Finds all the edges between the specified node and its sinks;
    14. Finds all the edges between the specified edge and its sinks;
    15. Finds all the edges by tracing the upstream of the specified node.
    16. Finds all the edges by tracing the upstream of the specified edge.
    17. Finds all the edges by tracing the downstream of the specified node.
    18. Finds all the edges by tracing the downstream of the specified edge.
    19. The path analysis of the facility analysis, including: finds the path which is the optimal or has the least edges between the specified start node and end node, finds the path which is the optimal or has the least edges between the specified start edge and end edge, finds the path which is the optimal or has the least edges by tracing the upstream or the downstream of the specified node, and finds the path which is the optimal or has the least edges by tracing the upstream or the downstream of the specified edge.

    You also can read the 銆奆acility Network Analysis 銆�for more information about facility network analysis.

    Example:
    See the sample of findSourceFromNode, traceUpFromNode, findCommonAncestorsFromNodes, findPathFromNodes, and findPathDownFromNode method.
    • Constructor Summary

      Constructors 
      Constructor and Description
      FacilityAnalyst()
      Creates a new FacilityAnalyst object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int[] checkLoops()
      Checks the loops of the network and returns the array of the edge IDs that form the loops.
      void dispose()
      Disposes the resources occupied by the object.
      int[] findCommonAncestorsFromEdges(int[] edgeIDs, boolean isUncertainDirectionValid)
      Finds the common upstream edges of those edges according to the given array of the edge IDs.
      int[] findCommonAncestorsFromNodes(int[] nodeIDs, boolean isUncertainDirectionValid)
      Finds the common upstream edges of those nodes according to the given array of the node IDs.
      int[] findCommonCatchmentsFromEdges(int[] edgeIDs, boolean isUncertainDirectionValid)
      Finds the common downstream edges of those edges according to the given array of the edge IDs.
      int[] findCommonCatchmentsFromNodes(int[] nodeIDs, boolean isUncertainDirectionValid)
      Finds the common downstream edges of those nodes according to the given array of the node IDs.
      int[] findConnectedEdgesFromEdges(int[] edgeIDs)
      Finds all the edges connected with the specified edges according to the given array of the edge IDs.
      int[] findConnectedEdgesFromNodes(int[] nodeIDs)
      Finds all the edges connected with the specified nodes according to the given array of the node IDs.
      int[] findLoopsFromEdges(int[] edgeIDs)
      Finds all the loops connected with the specified edges according to the given array of the edge IDs.
      int[] findLoopsFromNodes(int[] nodeIDs)
      Finds all the loops joined with the specified nodes according to the given array of the node IDs.
      FacilityAnalystResult findPathDownFromEdge(int edgeID, java.lang.String weightName, boolean isUncertainDirectionValid)
      The find downstream path analysis.
      FacilityAnalystResult findPathDownFromNode(int nodeID, java.lang.String weightName, boolean isUncertainDirectionValid)
      FindPathUpFromEdge.
      FacilityAnalystResult findPathFromEdges(int startEdgeID, int endEdgeID, java.lang.String weightName, boolean isUncertainDirectionValid)
      The find path analysis.
      FacilityAnalystResult findPathFromNodes(int startNodeID, int endNodeID, java.lang.String weightName, boolean isUncertainDirectionValid)
      The find path analysis.
      FacilityAnalystResult findPathUpFromEdge(int edgeID, java.lang.String weightName, boolean isUncertainDirectionValid)
      FindPathUpFromEdge.
      FacilityAnalystResult findPathUpFromNode(int nodeID, java.lang.String weightName, boolean isUncertainDirectionValid)
      FindPathUpFromEdge.
      FacilityAnalystResult findSinkFromEdge(int edgeID, java.lang.String weightName, boolean isUncertainDirectionValid)
      Finds the sink according to the given edge ID. i.e., from the given edge, finding the downstream sink that flows out this edge according to the flow, and returning the edges, nodes and cost in least path cost from gien edge to this sink.
      FacilityAnalystResult findSinkFromNode(int nodeID, java.lang.String weightName, boolean isUncertainDirectionValid)
      Finds the sink according to the given node ID. i.e., from the given node, finding the downstream sink that flows out this node according to the flow, and returning the edges, nodes and cost in least path cost from given node to this sink.
      FacilityAnalystResult findSourceFromEdge(int edgeID, java.lang.String weightName, boolean isUncertainDirectionValid)
      Finds the source according to the given edge ID. i.e., from the given edge, finding the network source that flows to this edge according to the flow, and returning the edges, nodes and cost in least path cost.
      FacilityAnalystResult findSourceFromNode(int nodeID, java.lang.String weightName, boolean isUncertainDirectionValid)
      Finds the source according to the given node ID. i.e., from the given node, finding the network source that flows to this node according to the flow, and returning the edges, nodes and cost in least path cost.
      int[] findUnconnectedEdgesFromEdges(int[] edgeIDs)
      Finds all the edges not connected with the specified edges according to the given array of the edge IDs.
      int[] findUnconnectedEdgesFromNodes(int[] nodeIDs)
      Finds all the edges unconnected with the specified nodes according to the given array of the node IDs.
      FacilityAnalystSetting getAnalystSetting()
      Gets the environment settings of the facility analysis.
      boolean load()
      Loads the facility network model according to the FacilityAnalystSetting settings.
      void setAnalystSetting(FacilityAnalystSetting facilityAnalystSetting)
      Sets the environment settings of the facility analysis.
      FacilityAnalystResult traceDownFromEdge(int edgeID, java.lang.String weightName, boolean isUncertainDirectionValid)
      According to the given arc ID, perform the tracing downstream.
      FacilityAnalystResult traceDownFromNode(int nodeID, java.lang.String weightName, boolean isUncertainDirectionValid)
      According to the given node ID, perform the tracing downstream.
      FacilityAnalystResult traceUpFromEdge(int edgeID, java.lang.String weightName, boolean isUncertainDirectionValid)
      According to the given arc ID, perform the tracing upstream.
      FacilityAnalystResult traceUpFromNode(int nodeID, java.lang.String weightName, boolean isUncertainDirectionValid)
      According to the given node ID, perform the tracing upstream.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FacilityAnalyst

        public FacilityAnalyst()
        Creates a new FacilityAnalyst object.
    • Method Detail

      • getAnalystSetting

        public FacilityAnalystSetting getAnalystSetting()
        Gets the environment settings of the facility analysis. This property is used to set the environment for the facility analysis and the settings will influence the final analysis result. This property can provide all the parameters to the facility analysis, including Network Dataset (the network dataset that has the flow direction or has both the flow direction and hierarchy), Node ID Field, Edge ID Field, FNode ID Field, TNode ID Field, Weight Field Infos, Tolerance, Barrier Nodes, Barrier Edges and Direction Field. For more information, see setNetworkDataset()
        Returns:
        The environment settings of the facility analysis.
        See Also:
        FacilityAnalystSetting
        Default:
        The default value is a new FacilityAnalystSetting object.
      • setAnalystSetting

        public void setAnalystSetting(FacilityAnalystSetting facilityAnalystSetting)
        Sets the environment settings of the facility analysis.

        This property is used to set the environment for the facility analysis and the settings will influence the final analysis result. This property can provide all the parameters to the facility analysis, including NetworkDataset (the network dataset that has the flow direction or has both the flow direction and hierarchy), NodeIDField, EdgeIDField, FNodeIDField, TNodeIDField, WeightFieldInfos, Tolerance, BarrierNodes, BarrierEdges and DirectionField. For more information, see FacilityAnalystSetting class.

        Parameters:
        facilityAnalystSetting - The environment parameters of the facility analysis.
        See Also:
        FacilityAnalystSetting
      • load

        public boolean load()
        Loads the facility network model according to the FacilityAnalystSetting settings.

        Loads data used for facility analysis, according to the parameters in the FacilityAnalystSetting object. This method can be called after the AnalystSetting is set. Only when the load method is called, the parameters in the FacilityAnalystSetting object are valid. At this time, the methods in the FacilityAnalyst class can be called to perform facility analysis.

        Note:

        1. The following two situations must recall the Load method to load the network model. This dispose method need to be called for just once before the analysis, Release the resources occupied by the FacilityAnalyst object, otherwise it may go wrong.
          • If you modify the FacilityAnalystSetting parameters, you need to reload this method. Otherwise, the modification is invalid.
          • 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.
        2. If the Load method has been called for loading the network model, before calling the Load method again, the method must be called dispose method to dispose the resources, otherwise the load will fail.
        Returns:
        A boolean value denotes whether the facility network model loads successfully or not. True if successful; otherwise, false.
      • findLoopsFromNodes

        public int[] findLoopsFromNodes(int[] nodeIDs)
        Finds all the loops joined with the specified nodes according to the given array of the node IDs. The result is the array of the edge IDs that form the loops.

        In facility network, a closed route formed by two or more edges that the flow is 2 (namely the uncertain flow) is called as a loop. Please refer to checkLoops for more information.

        Parameters:
        nodeIDs - The specified array of the node IDs.
        Returns:
        The edge ID array of loops connected with the specified nodes.
        Example:
        See the sample of findLoopsFromEdges method.
      • findLoopsFromEdges

        public int[] findLoopsFromEdges(int[] edgeIDs)
        Finds all the loops connected with the specified edges according to the given array of the edge IDs. The result is the array of edge IDs that form the loops.

        In facility network, a closed route formed by two or more edges that the flow is 2 (namely the uncertain flow) is called as a loop. Please refer to checkLoops for more information.

        Parameters:
        edgeIDs - The specified array of the edge IDs.
        Returns:
        The edge ID array of loops connected with the specified edges.
        Example:
        The following sample code demonstrates how to find the loops joining the specified nodes or edges. The network dataset used by the function below is the dataset whose name is RoadNet in the datasource of changchun.udb under the directory of [Installation\SampleData\changchun\]. This network dataset has flow direction and hierarchi.es.For more information, see the SuperMap iDesktop Help documentation facility for network analysis
         public void BuildNetworkForFacilityAnalyst(DatasetVector networkDataset)
            {
                //Set up an environment for facility network analysis
                FacilityAnalystSetting facilityAnalystSetting = new FacilityAnalystSetting();
                facilityAnalystSetting.setNetworkDataset ( networkDataset);
                facilityAnalystSetting.setDirectionField ("Direction");
                facilityAnalystSetting.setEdgeIDField ("SmID");
                facilityAnalystSetting.setNodeIDField ( "SmNodeID");
                facilityAnalystSetting.setFNodeIDField ( "SmFNode");
                facilityAnalystSetting.setTNodeIDField ("SmTNode");
                facilityAnalystSetting.setTolerance ( 0.0015);
                WeightFieldInfo weightFieldInfo = new WeightFieldInfo();
                weightFieldInfo.setName ( "Length");
                weightFieldInfo.setFTWeightField ( "SmLength");
                weightFieldInfo.setTFWeightField ("SmLength");
                WeightFieldInfos weightFieldInfos = new WeightFieldInfos();
                weightFieldInfos.add(weightFieldInfo);
                facilityAnalystSetting.setWeightFieldInfos(weightFieldInfos);
                FacilityAnalyst facilityAnalyst = new FacilityAnalyst();
                facilityAnalyst.setAnalystSetting ( facilityAnalystSetting);
                facilityAnalyst.load();
        
                //Gets the arc or node that participates in the analysis
                int[] edgeIDs = new int[] { 3855, 9073 };
                int[] nodeIDs = new int[] { 2996, 2682 };
        
                //Find loops connected to a given arc
                int[] loopsFromEdges = facilityAnalyst.findLoopsFromEdges(edgeIDs);
        
                //Find loops connected to a given node
                int[] loopsFromNodes = facilityAnalyst.findLoopsFromNodes(nodeIDs);
            }
      • findConnectedEdgesFromNodes

        public int[] findConnectedEdgesFromNodes(int[] nodeIDs)
        Finds all the edges connected with the specified nodes according to the given array of the node IDs. The result is the array of edge IDs.
        Parameters:
        nodeIDs - The specified array of the node IDs.
        Returns:
        The array of the edge IDs.
        See Also:
        findConnectedEdgesFromEdges() sample.
      • findConnectedEdgesFromEdges

        public int[] findConnectedEdgesFromEdges(int[] edgeIDs)
        Finds all the edges connected with the specified edges according to the given array of the edge IDs. The result is the array of the edge IDs.
        Parameters:
        edgeIDs - The specified array of the edge IDs.
        Returns:
        The array of the edge IDs.
        Example:
        The following sample code demonstrates how to find the edges connected or disconnected with the specified nodes or edges. The network dataset used by the function below is the dataset whose name is RoadNet in the datasource of changchun.udb under the directory of [Installation\SampleData\changchun\]. This network dataset has flow direction and hierarchies.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
         public void TestFindConnectedandUnconnectedEdges(DatasetVector networkDataset)
            {
                //Set up an environment for facility network analysis
                FacilityAnalystSetting facilityAnalystSetting = new FacilityAnalystSetting();
                facilityAnalystSetting.setNetworkDataset ( networkDataset);
                facilityAnalystSetting.setDirectionField ("Direction");
                facilityAnalystSetting.setEdgeIDField ("SmID");
                facilityAnalystSetting.setNodeIDField ( "SmNodeID");
                facilityAnalystSetting.setFNodeIDField ( "SmFNode");
                facilityAnalystSetting.setTNodeIDField ("SmTNode");
                facilityAnalystSetting.setTolerance ( 0.0015);
                WeightFieldInfo weightFieldInfo = new WeightFieldInfo();
                weightFieldInfo.setName ( "Length");
                weightFieldInfo.setFTWeightField ( "SmLength");
                weightFieldInfo.setTFWeightField ("SmLength");
                WeightFieldInfos weightFieldInfos = new WeightFieldInfos();
                weightFieldInfos.add(weightFieldInfo);
                facilityAnalystSetting.setWeightFieldInfos(weightFieldInfos);
                FacilityAnalyst facilityAnalyst = new FacilityAnalyst();
                facilityAnalyst.setAnalystSetting ( facilityAnalystSetting);
                facilityAnalyst.load();
        
                //Gets the arc or node that participates in the analysis
                int[] edgeIDs = new int[] { 3855, 9073 };
                int[] nodeIDs = new int[] { 2996, 2682 };
        
                //Finds an arc that is connected to and not connected to a given arc
                int[] connectEdges = facilityAnalyst.findConnectedEdgesFromEdges(edgeIDs);
                int[] unconnectEdges = facilityAnalyst.findUnconnectedEdgesFromEdges(edgeIDs);
        
                //Finds a arc that is connected to and not connected to a given node
                int[] connectNodes = facilityAnalyst.findConnectedEdgesFromNodes(nodeIDs);
                int[] unconnectNodes = facilityAnalyst.findUnconnectedEdgesFromNodes(nodeIDs);
            }
      • findUnconnectedEdgesFromNodes

        public int[] findUnconnectedEdgesFromNodes(int[] nodeIDs)
        Finds all the edges unconnected with the specified nodes according to the given array of the node IDs. The result is the array of edge IDs.
        Parameters:
        nodeIDs - The specified array of the node IDs.
        Returns:
        The array of the edge IDs.
        See Also:
        findConnectedEdgesFromEdges() sample.
      • findUnconnectedEdgesFromEdges

        public int[] findUnconnectedEdgesFromEdges(int[] edgeIDs)
        Finds all the edges not connected with the specified edges according to the given array of the edge IDs. The result is the array of the edge IDs.
        Parameters:
        edgeIDs - The specified array of the edge IDs.
        Returns:
        The array of the edge IDs.
        See Also:
        findConnectedEdgesFromEdges() sample.
      • findCommonAncestorsFromNodes

        public int[] findCommonAncestorsFromNodes(int[] nodeIDs,
                                                  boolean isUncertainDirectionValid)
        Finds the common upstream edges of those nodes according to the given array of the node IDs. The result is the array of edge IDs.

        For "upstream" more information , please see the traceUpFromNode method.

        Common upstream refers to public upstream network of multiple nodes or edges. The method is used for finding common upstream edges of multiple nodes. That is, the intersection of the upstream edges of these nodes,Returns the ID number of these edges.

        As shown in the figure below, the arrow shows the flow direction. The first two figures show the results of Tracing Upstream for Node 1 and 2. The green part shows the upstream edges. The third figure (orange) shows the results of Tracing Common Upstream for Node 1 and 2. So the common upstream edges of Node 1 and 2 are the intersection of their upstream edges datasets.

        Parameters:
        nodeIDs - The specified array of the node IDs.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        The array of the edge IDs.
        Example:
        The following sample code demonstrates how to find the common upstreams and downstreams of the specified nodes or edges. The network dataset used by the function below is the dataset whose name is RoadNet in the datasource of changchun.udb under the directory of [Installation\SampleData\changchun\]. This network dataset has flow direction and hierarchies.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
         public void FindCommonAncestorsandCatchementsEdges(DatasetVector networkDataset)
            {
                //Set up an environment for facility network analysis
                FacilityAnalystSetting facilityAnalystSetting = new FacilityAnalystSetting();
                facilityAnalystSetting.setNetworkDataset ( networkDataset);
                facilityAnalystSetting.setDirectionField ("Direction");
                facilityAnalystSetting.setEdgeIDField ("SmID");
                facilityAnalystSetting.setNodeIDField ( "SmNodeID");
                facilityAnalystSetting.setFNodeIDField ( "SmFNode");
                facilityAnalystSetting.setTNodeIDField ("SmTNode");
                facilityAnalystSetting.setTolerance ( 0.0015);
                WeightFieldInfo weightFieldInfo = new WeightFieldInfo();
                weightFieldInfo.setName ( "Length");
                weightFieldInfo.setFTWeightField ( "SmLength");
                weightFieldInfo.setTFWeightField ("SmLength");
                WeightFieldInfos weightFieldInfos = new WeightFieldInfos();
                weightFieldInfos.add(weightFieldInfo);
                facilityAnalystSetting.setWeightFieldInfos(weightFieldInfos);
                FacilityAnalyst facilityAnalyst = new FacilityAnalyst();
                facilityAnalyst.setAnalystSetting ( facilityAnalystSetting);
                facilityAnalyst.load();
        
                //Gets the arc or node that participates in the analysis
                int[] edgeIDs = new int[] { 3855,9073};
                int[] nodeIDs = new int[] { 2996,2682};
        
                //Find the common upstream arc and common downstream arc of a given arc
                int[] commonAncestorsofEdges = facilityAnalyst.findCommonAncestorsFromEdges(edgeIDs,false);
                int[] commonCatchmentsofEdges = facilityAnalyst.findCommonCatchmentsFromEdges(edgeIDs, false);
        
                //Find the common upstream arc and common downstream arc of a given node
                int[] commonAncestorsofNodes = facilityAnalyst.findCommonAncestorsFromNodes(nodeIDs, false);
                int[] commonCatchementsofNodes = facilityAnalyst.findCommonCatchementsFromNodes(nodeIDs, false);
            }
      • findCommonAncestorsFromEdges

        public int[] findCommonAncestorsFromEdges(int[] edgeIDs,
                                                  boolean isUncertainDirectionValid)
        Finds the common upstream edges of those edges according to the given array of the edge IDs. The result is the array of the edge IDs.

        For "upstream" more information , please see the traceUpFromNode method.

        Common upstream refers to public upstream network of multiple nodes or edges. The method is used for finding common upstream edges of multiple edges. That is, take the intersection of the upstream edges of these edges ,Returns the ID number of these edges.

        For more information about "looking for common upstream edges" please see findCommonAncestorsFromNodes .method.

        Parameters:
        edgeIDs - The specified array of the edge IDs.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        The common upstream edges ID array of the given edge.
        Example:
        See the sample of findCommonAncestorsFromNodes method.
      • findCommonCatchmentsFromNodes

        public int[] findCommonCatchmentsFromNodes(int[] nodeIDs,
                                                   boolean isUncertainDirectionValid)
        Finds the common downstream edges of those nodes according to the given array of the node IDs. The result is the array of edge IDs.

        About "downstream" more information , please see the traceUpFromNode method.

        Common downstream refers to public downstream network of multiple nodes or edges. The method is used for finding common downstream edges of multiple nodes. That is, the intersection of the respective downstream edges of these nodes,Returns the ID number of these edges.

        As shown in the figure below, the arrow shows the flow direction. The first two figures show the results of Tracing Downstream for Node 1 and 2. The green part shows the upstream edges. The third figure (orange) shows the results of Tracing Common Downstream for Node 1 and 2. So the common downstream edges of Node 1 and 2 are the intersection of their downstream edges datasets.

        Parameters:
        nodeIDs - The specified array of the node IDs.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        The common downstream edges ID array of the given node.
        Example:
        See the sample of findCommonAncestorsFromNodes method.
      • findCommonCatchmentsFromEdges

        public int[] findCommonCatchmentsFromEdges(int[] edgeIDs,
                                                   boolean isUncertainDirectionValid)
        Finds the common downstream edges of those edges according to the given array of the edge IDs. The result is the array of the edge IDs.

        About "downstream" more information , please see the traceUpFromNode method.

        Common downstream refers to public downstream network of multiple nodes or edges. The method is used for finding common downstream edges of multiple edges. That is, take the intersection of the downstream edges of these edgesReturns ,ID number of these edges.

        edges

        For more information about "looking for common downstream edges", please see findCommonCatchmentsFromNodes method.

        Parameters:
        edgeIDs - The specified array of the edge IDs.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        The common upstream edges ID array of the given edge.
        Example:
        See the sample of findCommonAncestorsFromNodes method.
      • findSourceFromNode

        public FacilityAnalystResult findSourceFromNode(int nodeID,
                                                        java.lang.String weightName,
                                                        boolean isUncertainDirectionValid)
        Finds the source according to the given node ID. i.e., from the given node, finding the network source that flows to this node according to the flow, and returning the edges, nodes and cost in least path cost.

        From the given node, finding the network source that flows to this node according to the flow. The result is the edges, nodes and cost in least path cost. If there are many sources in the network, it will search the source that the least cost is the maximum. In order to understand, you can divide these into three steps:

        1. From the given node, according to the flow, find the node upstream of all the source.
        2. Analyze the least cost path that every source reaches the given node, and calculate the cost;
        3. Select the path corresponding to the max cost in the last step, and give the arc ID array, node Id array and cost of the path.

        Note: The node ID array in analysis result doesn't contain the node itself.

        The following figure is a simple facility network. The arrows of the edges show the flow direction of the network. The weight value is labeled beside the arrow. The figures shows the finding source analysis on Note M. There are 7 upstream sources of Node M and the 7 least cost paths from M to these sources are C-H-M, A-E-H-M, B-D-E-H-M, F-D-E-H-M, J-N-M, I-N-M and P-N-M. The costs of these paths can be calculated according to the network weight. B-D-E-H-M costs at most and the value is 18.4 and hence B is the source that we want to find.

        Parameters:
        nodeID - The specified Node ID.
        weightName - The name of the specified weight field information object, that is, the name (getName)of a weight information object (WeightFieldInfo) in the weight field information set (setWeightFieldInfos) specified in the facility network analysis environment.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        Facility Analysis Result.
        Example:
        The following sample code demonstrates how to find the source and sink according to the given nodes and edges. If there is a network dataset named "WaterNet" in the "FacilityNet.udb" datasource, the following code takes the Edge ID 336 and Node ID 311 as an example to show how to find the source and sink.
                /**
                 * Find the source or sink based on the given arc ID or node ID.
                 * @param datasource The datasource where the network dataset is laocated. 
                 */
                private void findSourceOrSinkExample(Datasource datasource) {
                        //Gets the network dataset for analysis
                        DatasetVector network = (DatasetVector)datasource.getDatasets().get("WaterNet");
        
                        //Constructs a settings object for facility network analysis environment ang sets related parameters
                        FacilityAnalystSetting facilityAnalystSetting = new FacilityAnalystSetting();
                        facilityAnalystSetting.setNetworkDataset(network);
                        facilityAnalystSetting.setDirectionField("direction");
                        facilityAnalystSetting.setEdgeIDField("SMEDGEID");
                        facilityAnalystSetting.setNodeIDField("SMNODEID");
                        facilityAnalystSetting.setFNodeIDField("SMFNODE");
                        facilityAnalystSetting.setTNodeIDField("SMTNODE");
                        facilityAnalystSetting.setTolerance(0.001);
        
                        WeightFieldInfo weightFieldInfo = new WeightFieldInfo();
                        weightFieldInfo.setName("Length");
                        weightFieldInfo.setFTWeightField("SMLENGTH");
                        weightFieldInfo.setTFWeightField("SMLENGTH");
                        WeightFieldInfos weightFieldInfos = new WeightFieldInfos();
                        weightFieldInfos.add(weightFieldInfo);
                        facilityAnalystSetting.setWeightFieldInfos(weightFieldInfos);
        
                        //The settings of obstacle nodes and obstacle arcs are valid for finding the source/sink
                        facilityAnalystSetting.setBarrierEdges(new int[] { 8, 199 });
                        facilityAnalystSetting.setBarrierNodes(new int[] { 372 });
        
                        //Constructs a facility network analysis object and sets a facility network analysis environment.
                        FacilityAnalyst facilityAnalyst = new FacilityAnalyst();
                        facilityAnalyst.setAnalystSetting(facilityAnalystSetting);
        
                        //Loading network model
                        Boolean isLoad = facilityAnalyst.load();
        
                        if (isLoad)     {
                                //Gets the ID of arc or node that participates in the analysis
                                int edgeID = 336;
                                int nodeID = 311;
        
                                //Finding the source according to the given arc
                                FacilityAnalystResult resultSourceFromEdge = facilityAnalyst.findSourceFromEdge(edgeID, "Length", true);
                                if (resultSourceFromEdge != null) {
                                        System.out.println("The cost from the arc " + edgeID + " to the source includes:: " + resultSourceFromEdge.Cost);
                                        System.out.println("The ID from the arc " + edgeID + " to the source are:");
                                        for (int i = 0; i < resultSourceFromEdge.Edges.Length; i++) {
                                                System.out.println(resultSourceFromEdge.Edges[i]);
                                        }
                                        System.out.println("The ID from the arc " + edgeID + " to the node of source includes: ");
                                        for (int i = 0; i < resultSourceFromEdge.Nodes.Length; i++)     {
                                                System.out.println(resultSourceFromEdge.Nodes[i]);
                                        }
                                }
                                //Finding the source according to the given node
        
                                //Find sinks based on a given node
                                FacilityAnalystResult resultSinkFromNode = facilityAnalyst.findSinkFromNode(nodeID, "Length", true);
                                if (resultSinkFromNode != null) {
                                        System.out.println("The cost from the node " + nodeID + " to sink is " + resultSinkFromNode.Cost);
                                        System.out.println("The arc ID from the node " + nodeID + " to sink includes: ");
                                        for (int i = 0; i < resultSinkFromNode.Edges.Length; i++) {
                                                System.out.println(resultSinkFromNode.Edges[i]);
                                        }
                                        System.out.println("The node ID from the node " + nodeID + " to sink includes:");
                                        for (int i = 0; i < resultSinkFromNode.Nodes.Length; i++) {
                                                System.out.println(resultSinkFromNode.Nodes[i]);
                                        }
                                }
                                //Find sinks based on a given arc
                        }
        
                        //Analyzed then release the resource occupied by the facility network analysis
                        facilityAnalyst.dispose();
                }
         
      • findSourceFromEdge

        public FacilityAnalystResult findSourceFromEdge(int edgeID,
                                                        java.lang.String weightName,
                                                        boolean isUncertainDirectionValid)
        Finds the source according to the given edge ID. i.e., from the given edge, finding the network source that flows to this edge according to the flow, and returning the edges, nodes and cost in least path cost.

        From the given edge, finding the network source that flows to this edge according to the flow. The result is the edges, nodes and cost in least path cost. If there are many sources in the network, it will search the source that the least cost is the maximum. In order to understand, you can divide these into three steps:

        1. From the given arc, find all the sources in the upstream according to the flow.

        2. Analyze the minimum cost path for each source to reach a given arc and calculate the cost;
        3. Select the path corresponding to the max cost in the last step, and give the arc ID array, node Id array and cost of the path.

        Note: The edge ID array in analysis result doesn't contain the edge itself.

        For more information, please see findSourceFromNode which is to find the source according to specified node ID.

        Parameters:
        edgeID - The specified edge ID.
        weightName - The name of the specified weight field information object, that is, the name (getName)of a weight information object (WeightFieldInfo) in the weight field information set (setWeightFieldInfos) specified in the facility network analysis environment.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        Facility Analysis Result.
        Example:
        See the sample of findSourceFromNode method.
      • findSinkFromNode

        public FacilityAnalystResult findSinkFromNode(int nodeID,
                                                      java.lang.String weightName,
                                                      boolean isUncertainDirectionValid)
        Finds the sink according to the given node ID. i.e., from the given node, finding the downstream sink that flows out this node according to the flow, and returning the edges, nodes and cost in least path cost from given node to this sink.

        From the given node, finding the downstream sink that flows out this node according to the flow. The result is the edges, nodes and cost in least path cost. If there are many sinks in the network, it will search the sink that the least cost is the maximum. In order to understand, you can divide these into three steps:

        1. From the given node, according to the flow, find the node upstream of all the source.
        2. Analyzes the least path cost from the given node to every sink.
        3. Select the path corresponding to the max cost in the last step, and give the arc ID array, node Id array and cost of the path.

        Note: The node ID array in analysis result doesn't contain the node itself.

        The following figure is a simple facility network. The arrows of the edges show the flow direction of the network. The weight value is labeled beside the arrow. The figures shows the finding sink analysis on Note D. There are 4 downstream sinks of Node D and the 7 least cost paths from D to these sinks are E-H-L-G, E-H-L-K, E-H-M-S and E-H-M-Q-R. The costs of these paths can be calculated according to the network weight. E-H-M-Q-R costs at most and the value is 16.6 and hence R is the sink that we try to find.

        Parameters:
        nodeID - The specified node ID.
        weightName - The name of the specified weight field information object, that is, the name (getName)of a weight information object (WeightFieldInfo) in the weight field information set (setWeightFieldInfos) specified in the facility network analysis environment.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        Facility Analysis Result.
        Example:
        See the sample of findSourceFromNode method.
      • findSinkFromEdge

        public FacilityAnalystResult findSinkFromEdge(int edgeID,
                                                      java.lang.String weightName,
                                                      boolean isUncertainDirectionValid)
        Finds the sink according to the given edge ID. i.e., from the given edge, finding the downstream sink that flows out this edge according to the flow, and returning the edges, nodes and cost in least path cost from gien edge to this sink.

        From the given edge, finding the downstream sink that flows out this edge according to the flow. The result is the edges, nodes and cost in least path cost. If there are many sinks in the network, it will search the sink that the least cost is the maximum. In order to understand, you can divide these into three steps:

        1. From the given arc, find all the sources in the upstream according to the flow.

        2. Analyzes the least path cost from the given node to every sink.
        3. Select the path corresponding to the max cost in the last step, and give the arc ID array, node Id array and cost of the path.

        Note: The edge ID array in analysis result doesn't contain the edge itself.

        For more information, please see findSinkFromNode which is to find the sink according to specified node ID.

        Parameters:
        edgeID - The specified edge ID.
        weightName - The name of the specified weight field information object, that is, the name (getName)of a weight information object (WeightFieldInfo) in the weight field information set (setWeightFieldInfos) specified in the facility network analysis environment.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        Facility Analysis Result.
        Example:
        See the sample of findSourceFromNode method.
      • traceUpFromNode

        public FacilityAnalystResult traceUpFromNode(int nodeID,
                                                     java.lang.String weightName,
                                                     boolean isUncertainDirectionValid)
        According to the given node ID, perform the tracing upstream. Namely, finding the arcs, nodes and cost of the upstream.
          Upstream and downstream

          For a specified node or edge of facility network, the network resources flow across nodes or edges and finally flow into the specified node or edge, then these passed nodes or edges are the upstream of it; similarly, the edges or nodes passed by the specified node into the sink are called its downstream.

          The following figure is a simple facility network. The arrows of the edges show the flow direction of the network. According to the flow directions, we know that the resources flow accords Node 2, 4, 3, 7 and 8 and Edge 10, 9, 3, 4 and 8, and finally flow into node 10, hence these nodes and edges are the upstream of Node 10, in which the nodes are called its upstream nodes and the edges are called its upstream edges. Similarly, resources flow out of Node 10 and across node 9, 11 and 12 as well as Edge 5, 7 and 11, and finally flow out of the network, hence these nodes are are called its downstream nodes, in which the nodes are called its downstream nodes and the edges are called its downstream edges.

        • Tracing Upstream and Tracing Downstream
        • Tracing Upstream is to find the upstream of a specified node or edge according to the flow direction. Similarly, Tracing Downstream is to find the downstream of a specified node or edge according to the flow direction. The FacilityAnalyst class provides the methods of Tracing Upstream and Tracing Downstream, and the analysis results are edges ID array, nodes ID array and upstream/downstream cost included by the upstream or downstream. This method is used for finding the upstream of a specified edge.

          Application Instance

          A common application of tracing upstream is to locate the pollution source of the rivers. The river is not only an important path of the earth's water cycle, but also the main human fresh water resources. Once the river is polluted, but the pollution source isn't discovered and eliminated immediately, then it is very likely to affect people's normal drinking water and their health. Since the river affected by gravity flows from the higher place to the lower place, when the river is polluted, you should consider that the upstream river may have the pollution source, such as the industrial wastewater emissions, domestic sewage, pesticides and fertilizers pollution, etc. The steps of tracing the pollution source of the river are:

          1. When the data of the water-quality monitoring stations show that an exception occurs, firstly you need to determine the location of the exception so as to identify the edge/node located the exception as the start point of the tracing upstream;
          2. If you know the water quality of an upstream position is normal which is nearest to the start point, then the position or its river segment can be set as obstacle so as to further minify the scope of the analysis. The upstream river down the position cannot exist the pollution source. After it is set as obstacle, the tracing upstream analysis will not trace the upstream part down the location;
          3. Performs the tracing upstream analysis, and finds all the river segments that flow into the polluted position;
          4. Uses the spatial query to find all the possible pollution source, such as chemical plants, garbage disposal plants, etc;
          5. Further selects the pollutions source according to the monitoring data which show the water quality is abnormal;
          6. Calculates the loads of the selected pollution sources and sorts them according to their power to pollute.
          7. Conducts the field survey to check the possible polluters according to the order so as to ultimately determine the pollution source.
        Parameters:
        nodeID - The specified Node ID.
        weightName - The name of the specified weight field information object, that is, the name (getName)of a weight information object (WeightFieldInfo) in the weight field information set (setWeightFieldInfos) specified in the facility network analysis environment.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        The array of the edge IDs.
        Example:
        The following sample code demonstrates how to trace downstream or upstream according to the given nodes and arcs. If there is a 3D network dataset named "FacilityNet" in the "datasource", the following code take the Edge ID 336 and Node ID 311 as an example to show how to perform tracing upstream and tracing downstream.
                /**
                 * Performs upstream or downstream tracking based on a given arc ID or node ID.
                 * @param datasource The data source where the specified network dataset is located.
                 */
                private void traceUpOrDownExample(Datasource datasource) {
                        //Gets the network dataset for analysis
                        DatasetVector network = (DatasetVector)datasource.getDatasets().get("WaterNet");
        
                        //Constructs a setting object of facility network analysis environment and sets related parameters.
                        FacilityAnalystSetting facilityAnalystSetting = new FacilityAnalystSetting();
                        facilityAnalystSetting.setNetworkDataset(network);
                        facilityAnalystSetting.setDirectionField("direction");
                        facilityAnalystSetting.setEdgeIDField("SMEDGEID");
                        facilityAnalystSetting.setNodeIDField("SMNODEID");
                        facilityAnalystSetting.setFNodeIDField("SMFNODE");
                        facilityAnalystSetting.setTNodeIDField("SMTNODE");
                        facilityAnalystSetting.setTolerance(0.001);
        
                        WeightFieldInfo weightFieldInfo = new WeightFieldInfo();
                        weightFieldInfo.setName("Length");
                        weightFieldInfo.setFTWeightField("SMLENGTH");
                        weightFieldInfo.setTFWeightField("SMLENGTH");
                        WeightFieldInfos weightFieldInfos = new WeightFieldInfos();
                        weightFieldInfos.add(weightFieldInfo);
                        facilityAnalystSetting.setWeightFieldInfos(weightFieldInfos);
        
                        //The settings of obstacle nodes and obstacle arc are valid for finding source/sink
                        facilityAnalystSetting.setBarrierEdges(new int[] { 8, 199 });
                        facilityAnalystSetting.setBarrierNodes(new int[] { 372 });
        
                        //Constructs a facility network analysis object and sets the facility network analysis environment.
                        FacilityAnalyst facilityAnalyst = new FacilityAnalyst();
                        facilityAnalyst.setAnalystSetting(facilityAnalystSetting);
        
                        //Loading the network model
                        Boolean isLoad = facilityAnalyst.load();
        
                        if (isLoad)     {
                                //Gets ID of arcs and nodes that participates in the analysis
                                int edgeID = 336;
                                int nodeID = 311;
        
                                //Perform a upstream trace of a given arc
                                FacilityAnalystResult resultTraceUpFromEdge = facilityAnalyst.TraceUpFromEdge(edgeID, "Length", true);
                                System.out.println("The cost for the tracking upstream from the arc" + edgeID + " is: " + resultTraceUpFromEdge.Cost);
                                System.out.println("Perfroms the upstream tracking from arc " + edgeID + ", the arc ID includes: ");
                                for (int i = 0; i < resultTraceUpFromEdge.Edges.Length; i++) {
                                        System.out.println(resultTraceUpFromEdge.Edges[i]);
                                }
                                System.out.println("Perfroms the upstream tracking from arc " + edgeID + ", the node ID includes:");
                                for (int i = 0; i < resultTraceUpFromEdge.Nodes.Length; i++) {
                                        System.out.println(resultTraceUpFromEdge.Nodes[i]);
                                }
                                //Prform the upstream tracking for the given nodes
        
                                //Prform the downstream tracking for the given nodes
                                FacilityAnalystResult resultTraceDownFromNode = facilityAnalyst.traceDownFromNode(nodeID, "Length", true);
                                System.out.println("The cost for the tracking downstream from the node " + nodeID + " is " + resultTraceDownFromNode.Cost);
                                System.out.println("Performs the tracking downstream from the node " + nodeID + " the arc ID includes:");
                                for (int i = 0; i < resultTraceDownFromNode.Edges.Length; i++) {
                                        System.out.println(resultTraceDownFromNode.Edges[i]);
                                }
                                System.out.println("Performs the tracking downstream from the node " + nodeID + " the node ID includes:");
                                for (int i = 0; i < resultTraceDownFromNode.Nodes.Length; i++) {
                                        System.out.println(resultTraceDownFromNode.Nodes[i]);
                                }
                                //Perform the downstream tracking for the given arc
                        }
        
                        //Analyzed, releases the resources occupied by facility network analysis object
                        facilityAnalyst.dispose();
                }
         
      • traceUpFromEdge

        public FacilityAnalystResult traceUpFromEdge(int edgeID,
                                                     java.lang.String weightName,
                                                     boolean isUncertainDirectionValid)
        According to the given arc ID, perform the tracing upstream. Namely, finding the arcs, nodes and cost of the upstream.

        Tracing Upstream is to find the upstream of a specified node or edge according to the flow direction. This method is used for finding the upstream of a specified edge. The analysis results are edges, nodes and upstream/downstream cost included by the upstream.

        A detailed description of "Upstream and downstream" and "Upstream and downstream tracking";For more information, see traceUpFromNode .

        Parameters:
        edgeID - The specified edge ID.
        weightName - The name of the specified weight field information object, that is, the name (getName)of a weight information object (WeightFieldInfo) in the weight field information set (setWeightFieldInfos) specified in the facility network analysis environment.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        Facility Analysis Result.
        Example:
        See the sample of traceUpFromNode method.
      • traceDownFromNode

        public FacilityAnalystResult traceDownFromNode(int nodeID,
                                                       java.lang.String weightName,
                                                       boolean isUncertainDirectionValid)
        According to the given node ID, perform the tracing downstream. Namely, finding the arcs, nodes and cost of the downstream.

        Tracing Downstream is to find the downstream of a specified node or edge according to the flow direction. This method is used for finding the downstream of a specified edge. The analysis results are edges, nodes and downstream cost included by the upstream.

        A detailed description of "Upstream and downstream" and "Upstream and downstream tracking";For more information, see traceUpFromNode .

        Tracing downstream is usually used on the analysis of the impact scope. For examples:

        • After the pipeline of tap water bursts, firstly you need to trace all the downstream pipelines out of the accident location by the tracing downstream analysis. And then you need to determine the affected areas of the water supply by spatial query. Thereby you can timely issue the notification, and take emergency measures, such as the fire engines or vehicles arranged by the water company deliver water for the residential areas without water.
        • When you find some location of the river is polluted, you can find all the possible downstream river segments by the tracing downstream analysis as shown in the figure below. Before the analysis, you can find all the downstream river segments or locations that are not polluted before the cleanup of the pollutants according to the types of the pollutants and their emissions combined with an appropriate water quality management model, and then set them as obstacles by FacilityAnalystSetting . The analysis will stop to trace once it find these obstacles so as to further minify the scope of the analysis. After finding all the possible polluted river segments, you can label all the companies and residential areas nearby the result river segments that are using the water by spatial query and analysis. Thereby you can timely issue the notification and take emergency measures to prevent the further expansion of the pollutants.
        Parameters:
        nodeID - The specified Node ID.
        weightName - The name of the specified weight field information object, that is, the name (getName)of a weight information object (WeightFieldInfo) in the weight field information set (setWeightFieldInfos) specified in the facility network analysis environment.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        Facility Analysis Result.
        Example:
        See the sample of traceUpFromNode method.
      • traceDownFromEdge

        public FacilityAnalystResult traceDownFromEdge(int edgeID,
                                                       java.lang.String weightName,
                                                       boolean isUncertainDirectionValid)
        According to the given arc ID, perform the tracing downstream. Namely, finding the arcs, nodes and cost of the downstream.

        Tracing Downstream is to find the downstream of a specified node or edge according to the flow direction. This method is used for finding the downstream of a specified edge. The analysis results are edges, nodes and downstream cost included by the upstream.

        A detailed description of "Upstream and downstream" and "Upstream and downstream tracking";For more information, see traceDownFromNode and traceUpFromNode .

        Parameters:
        edgeID - The specified edge ID.
        weightName - The name of the specified weight field information object, that is, the name (getName)of a weight information object (WeightFieldInfo) in the weight field information set (setWeightFieldInfos) specified in the facility network analysis environment.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        Facility Analysis Result.
        Example:
        See the sample of traceUpFromNode method.
      • checkLoops

        public int[] checkLoops()
        Checks the loops of the network and returns the array of the edge IDs that form the loops.

        In facility network, a closed path formed by two or more edges that the flow is 2 (namely the uncertain flow) is called as a loop. That means a loop should satisfy following two conditions:

        1. A closed path formed by at least two arcs;
        2. The flow directions of the edges constructing the loop are 2, which indicates that the flow direction is not sure.

        The following is part of facility network. Use different symbols to display the direction of network segmentation. Check the loop of this network and there are two loops , the red.

        Returns:
        the array of the edge IDs that form the loops.
        Example:
        The following sample code demonstrates how to find the network loops. The network dataset used by the function below is the dataset whose name is RoadNet in the datasource of changchun.udb under the directory of [Installation\SampleData\City\]. This network dataset has flow direction.
         public void TestCheckLoops(DatasetVector networkDataset)
             {
                //Sets the environment used to the facility network analysis
                FacilityAnalystSetting facilityAnalystSetting = new FacilityAnalystSetting();
                facilityAnalystSetting.setNetworkDataset ( networkDataset);
                facilityAnalystSetting.setDirectionField ("Direction");
                facilityAnalystSetting.setEdgeIDField ("SmID");
                facilityAnalystSetting.setNodeIDField ( "SmNodeID");
                facilityAnalystSetting.setFNodeIDField ( "SmFNode");
                facilityAnalystSetting.setTNodeIDField ("SmTNode");
                facilityAnalystSetting.setTolerance ( 0.0015);
                WeightFieldInfo weightFieldInfo = new WeightFieldInfo();
                weightFieldInfo.setName ( "Length");
                weightFieldInfo.setFTWeightField ( "SmLength");
                weightFieldInfo.setTFWeightField ("SmLength");
                WeightFieldInfos weightFieldInfos = new WeightFieldInfos();
                weightFieldInfos.add(weightFieldInfo);
                facilityAnalystSetting.setWeightFieldInfos(weightFieldInfos);
                FacilityAnalyst facilityAnalyst = new FacilityAnalyst();
                facilityAnalyst.setAnalystSetting ( facilityAnalystSetting);
                facilityAnalyst.load();
        
                //Calls the method to check loops.
                int[] edgeIDs = facilityAnalyst.checkLoops();
        
                //Output the arc which makes up the loop
                System.out.println("The ID array of arc which makes up the loop are:");
                for (int i = 0; i < edgeIDs.length; i++)
                {
                    System.out.println(edgeIDs[i]);
                }
            }
      • findPathFromNodes

        public FacilityAnalystResult findPathFromNodes(int startNodeID,
                                                       int endNodeID,
                                                       java.lang.String weightName,
                                                       boolean isUncertainDirectionValid)
        The find path analysis. Find the path which has the least edges between the specified start node and the end node. The loops are invalid in this analysis. Returns edges, nodes and cost of this path.

        Finding least cost path between two nodes: Finds all paths of the specified end node started from a specified start node according to flow directions, and then finds a least cost path.

        The following figure shows the least cost path between two nodes. There are 3 connected paths between the start node B and the end node P, which are B-D-L-P, B-C-G-I-J-K-P and E-E-F-H-M-N-O-P, respectively. B-C-G-I-J-K-P is the least cost path and the value is 105.

        Parameters:
        startNodeID - The specified start Node ID.
        endNodeID - The specified end Node ID.
        weightName - The name of the specified weight field information object, that is, the name (getName)of a weight information object (WeightFieldInfo) in the weight field information set (setWeightFieldInfos) specified in the facility network analysis environment.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        Facility Analysis Result.
        Example:
        The following sample code demonstrates how to find the least cost path between the two specified nodes or edges. The network dataset used by the function below is the dataset whose name is RoadNet in the datasource of changchun.udb under the directory of [Installation\SampleData\changchun\]. This network dataset has flow direction and hierarchies.For more information, see the SuperMap iDesktop Help documentation for network analysis.
         public void BuildNetworkForFacilityAnalyst(DatasetVector networkDataset)
            {
                //Sets the environment used to the facility network analysis
                FacilityAnalystSetting facilityAnalystSetting = new FacilityAnalystSetting();
                facilityAnalystSetting.setNetworkDataset ( networkDataset);
                facilityAnalystSetting.setDirectionField ("Direction");
                facilityAnalystSetting.setEdgeIDField ("SmID");
                facilityAnalystSetting.setNodeIDField ( "SmNodeID");
                facilityAnalystSetting.setFNodeIDField ( "SmFNode");
                facilityAnalystSetting.setTNodeIDField ("SmTNode");
                facilityAnalystSetting.setTolerance ( 0.0015);
                WeightFieldInfo weightFieldInfo = new WeightFieldInfo();
                weightFieldInfo.setName ( "Length");
                weightFieldInfo.setFTWeightField ( "SmLength");
                weightFieldInfo.setTFWeightField ("SmLength");
                WeightFieldInfos weightFieldInfos = new WeightFieldInfos();
                weightFieldInfos.add(weightFieldInfo);
                facilityAnalystSetting.setWeightFieldInfos(weightFieldInfos);
                FacilityAnalyst facilityAnalyst = new FacilityAnalyst();
                facilityAnalyst.setAnalystSetting ( facilityAnalystSetting);
                facilityAnalyst.load();
        
                //Gets the arc or node that participates in the analysis
                int startEdgeID = 3855;
                int32 endEdgeID = 7887;
                int startNodeID = 2996;
                int endNodeID = 4239;
        
                        //Finds the least cost path between two arcs.
                FacilityAnalystResult PathLeastE = facilityAnalyst.findPathFromEdges( startEdgeID, endEdgeID, "Length", true);
                //Finds the shortest path between two nodes.
                FacilityAnalystResult PathLeastN = facilityAnalyst.findPathFromNodes( startNodeID, endNodeID, "Length", true);
            }
         
      • findPathFromEdges

        public FacilityAnalystResult findPathFromEdges(int startEdgeID,
                                                       int endEdgeID,
                                                       java.lang.String weightName,
                                                       boolean isUncertainDirectionValid)
        The find path analysis. Find the path which has the least edges between the specified start node and the end node. The loops are invalid in this analysis. Returns edges, nodes and cost of this path.

        Finding least cost path between two nodes: Finds all paths of the specified end node started from a specified start node according to flow directions, and then finds a least cost path.For more information, please refers to findPathFromNodes .To get more information about "Facility Network Path Analysis", which is used to find the minimum cost path between two nodes.

        Note: If the flow value of the specified edge for analysis is 2, i.e., the flow direction is uncertain, then the analysis results are null.

        Parameters:
        startEdgeID - The specified start edge ID.
        endEdgeID - The specified end edge ID.
        weightName - The name of the specified weight field information object, that is, the name (getName)of a weight information object (WeightFieldInfo) in the weight field information set (setWeightFieldInfos) specified in the facility network analysis environment.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        Facility Analysis Result.
        Example:
        See the sample of findPathFromNodes method.
      • findPathUpFromNode

        public FacilityAnalystResult findPathUpFromNode(int nodeID,
                                                        java.lang.String weightName,
                                                        boolean isUncertainDirectionValid)
        FindPathUpFromEdge. Finds the least cost upstream path of the specified node and returns edges, nodes and cost o the path.

        For "upstream" more information , please see the traceUpFromNode method.

        Finding the least cost upstream path: Finds all the upstream paths of the specified node (or egde) according to the flow direction, and then return the least cost path. This method is used to find the least cost upstream path of the specified node.

        The following figure is a simple facility network, the arrows of the edges show the flow direction of the network. The weight value is labeled beside the arrow. The figures shows the least coast path analysis of node I. There are 6 upstream paths started from the node I, which are E-F-I, A-F-I, B-G-J-I, D-G-J-I, C-G-J-I and H-J-I. The costs of these paths can be calculated according to the network weight. E-F-I is the least cost path and the value is 8.2.

        Parameters:
        nodeID - The specified Node ID.
        weightName - The name of the specified weight field information object, that is, the name (getName)of a weight information object (WeightFieldInfo) in the weight field information set (setWeightFieldInfos) specified in the facility network analysis environment.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        Facility Analysis Result.
        Example:
        See the sample of findPathDownFromNode method.
      • findPathUpFromEdge

        public FacilityAnalystResult findPathUpFromEdge(int edgeID,
                                                        java.lang.String weightName,
                                                        boolean isUncertainDirectionValid)
        FindPathUpFromEdge. Finds the least cost upstream path of the specified edge and returns edges, nodes and cost of the path.

        For "upstream" more information , please see the traceUpFromNode method.

        Finding the least cost upstream path: Finds all the upstream paths of the specified node (or egde) according to the flow direction, and then return the least cost path. This method is used to find the least cost upstream path of the specified egde.

        Please refers to findPathUpFromNode for more information.

        Note: If the flow value of the specified edge for analysis is 2, i.e., the flow direction is uncertain, then the analysis results are null.

        Parameters:
        edgeID - The specified edge ID.
        weightName - The name of the specified weight field information object, that is, the name (getName)of a weight information object (WeightFieldInfo) in the weight field information set (setWeightFieldInfos) specified in the facility network analysis environment.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        Facility Analysis Result.
        Example:
        See the sample of findPathDownFromNode method.
      • findPathDownFromNode

        public FacilityAnalystResult findPathDownFromNode(int nodeID,
                                                          java.lang.String weightName,
                                                          boolean isUncertainDirectionValid)
        FindPathUpFromEdge. Finds the least cost downstream path of the specified node and returns edges, nodes and cost o the path.

        About "downstream" more information , please see the traceUpFromNode method.

        Finding the least cost downstreampath: Finds all the downstream paths of the specified node (or egde) according to the flow direction, and then return the least cost path. This method is used to find the least cost downstream path of the specified node.

        The following figure is a simple facility network, the arrows of the edges show the flow direction of the network. The weight value is labeled beside the arrow. The figures shows the least coast path analysis of node H. There are 4 downstream paths started from the node I, which are H-L-G, H-L-K, H-M-S and H-M-Q-R. The costs of these paths can be calculated according to the network weight. H-L-K is the least cost downstream path and the value is 11.1.

        Parameters:
        nodeID - The specified Node ID.
        weightName - The name of the specified weight field information object, that is, the name (getName)of a weight information object (WeightFieldInfo) in the weight field information set (setWeightFieldInfos) specified in the facility network analysis environment.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        Facility Analysis Result.
        Example:
        The following sample code demonstrates how to find the path which has the least cost edges down or up from the specified node or edge. The network dataset used by the function below is the dataset whose name is RoadNet in the datasource of changchun.udb under the directory of [Installation\SampleData\changchun\]. This network dataset has flow direction and hierarchies. public void BuildNetworkForFacilityAnalyst(DatasetVector networkDataset) { //Sets the environment used to the facility network analysis FacilityAnalystSetting facilityAnalystSetting = new FacilityAnalystSetting(); facilityAnalystSetting.setNetworkDataset ( networkDataset); facilityAnalystSetting.setDirectionField ("Direction"); facilityAnalystSetting.setEdgeIDField ("SmID"); facilityAnalystSetting.setNodeIDField ( "SmNodeID"); facilityAnalystSetting.setFNodeIDField ( "SmFNode"); facilityAnalystSetting.setTNodeIDField ("SmTNode"); facilityAnalystSetting.setTolerance ( 0.0015); WeightFieldInfo weightFieldInfo = new WeightFieldInfo(); weightFieldInfo.setName ( "Length"); weightFieldInfo.setFTWeightField ( "SmLength"); weightFieldInfo.setTFWeightField ("SmLength"); WeightFieldInfos weightFieldInfos = new WeightFieldInfos(); weightFieldInfos.add(weightFieldInfo); facilityAnalystSetting.setWeightFieldInfos(weightFieldInfos); FacilityAnalyst facilityAnalyst = new FacilityAnalyst(); facilityAnalyst.setAnalystSetting ( facilityAnalystSetting); facilityAnalyst.load(); //Gets the nodes that participates in the analysis int nodeID =2996; //Finds the least cost pathes for the upstream and downstream arcs of the given node. FacilityAnalystResult PathUpLeast = facilityAnalyst.findPathUpFromNode( nodeID, "Length", true); FacilityAnalystResult PathDownLeast = facilityAnalyst .findPathDownFromNode(nodeID, "Length", true); }
      • findPathDownFromEdge

        public FacilityAnalystResult findPathDownFromEdge(int edgeID,
                                                          java.lang.String weightName,
                                                          boolean isUncertainDirectionValid)
        The find downstream path analysis. Find the path which has the least cost by tracing the downstream of the specified node. The loops are invalid in this analysis.

        About "downstream" more information , please see the traceUpFromNode method.

        Finding the least cost downstreampath: Finds all the downstream paths of the specified node (or egde) according to the flow direction, and then return the least cost path. This method is used to find the least cost downstream path of the specified node.

        Please refers to findPathDownFromNode for more information.To get more information about the "downstream minimum cost path".

        Note: If the flow value of the specified edge for analysis is 2, i.e., the flow direction is uncertain, then the analysis results are null.

        Parameters:
        edgeID - The specified edge ID.
        weightName - The name of the specified weight field information object, that is, the name (getName)of a weight information object (WeightFieldInfo) in the weight field information set (setWeightFieldInfos) specified in the facility network analysis environment.
        isUncertainDirectionValid - Specifies whether the uncertain flow is valid. True represents it is valid. The edged that have the uncertain flow still in the analysis. If it is false, it will stop searching when meeting the uncertain flow. When the flow field is 2, it is an uncertain flow.For more information, see the SuperMap iDesktop Help documentation facility for network analysis.
        Returns:
        Facility Analysis Result.
      • dispose

        public void dispose()
        Disposes the resources occupied by the object. After calling this method, this object will not be usable.