diff --git a/src/boliu/ClusterGen.java b/src/boliu/ClusterGen.java index cfa149a..ee1c0bf 100755 --- a/src/boliu/ClusterGen.java +++ b/src/boliu/ClusterGen.java @@ -27,8 +27,11 @@ public class ClusterGen { private ArrayList m_idArray = new ArrayList(); private ArrayList m_lineSegmentPointArray = new ArrayList(); - - + + // this variable is to return the clustered tracks' id + public ArrayList> array_of_related_trajectories = new ArrayList>(); + + //used for performing the DBSCAN algorithm public static final int UNCLASSIFIED = -2; public static final int NOISE = -1; @@ -88,7 +91,6 @@ public ClusterGen(TraClusterDoc document) { m_vector1 = new CMDPoint(m_document.m_nDimensions); m_vector2 = new CMDPoint(m_document.m_nDimensions); m_projectionPoint = new CMDPoint( m_document.m_nDimensions); - m_idArray.clear(); m_lineSegmentPointArray.clear(); @@ -196,7 +198,7 @@ private void findOptimalPartition(Trajectory pTrajectory) { int nPoints = pTrajectory.getM_nPoints(); int startIndex = 0, length; - int fullPartitionMDLCost, partialPartitionMDLCost; + int fullPartitionMDLCost, partialPartitionMDLCost; //add the start point of a trajectory CMDPoint startP = pTrajectory.getM_pointArray().get(0); @@ -546,6 +548,9 @@ boolean constructLineSegmentCluster() { } Set trajectories = new HashSet(); + + + for(int i=0; i= (int)clusterEntry.candidatePointList.size()) // ... END int trajectoryId = m_idArray.get(lineSegmentId).trajectoryId; - // store the identifier of the trajectories that belong to this line segment cluster if(!clusterEntry.trajectoryIdList.contains(trajectoryId)) //if (std::find(clusterEntry.trajectoryIdList.begin(), clusterEntry->trajectoryIdList.end(), trajectoryId) == clusterEntry.trajectoryIdList.end()) diff --git a/src/boliu/TraClusterDoc.java b/src/boliu/TraClusterDoc.java index bf7da3c..d2ae4cd 100755 --- a/src/boliu/TraClusterDoc.java +++ b/src/boliu/TraClusterDoc.java @@ -22,6 +22,7 @@ public class TraClusterDoc { public int m_nClusters; public double m_clusterRatio; public int m_maxNPoints; + public ArrayList> array_related_trajectories; public ArrayList m_trajectoryList; public ArrayList m_clusterList; @@ -32,6 +33,8 @@ public TraClusterDoc() { m_clusterRatio = 0.0; m_trajectoryList = new ArrayList(); m_clusterList = new ArrayList(); + ClusterGen abc = new ClusterGen(); + } public class Parameter { @@ -192,7 +195,20 @@ boolean onClusterGenerate(String clusterFileName, double epsParam, int minLnsPar bw.write(x+" "+y+" "); } //System.out.println(); - } + } + + for(int i=0; i