public void filterOnAllData ( final ALasDataManager lasHandler ) throws Exception { final ConcurrentSkipListSet < Double > angleSet = new ConcurrentSkipListSet < Double > ( ) ; final ConcurrentSkipListSet < Double > distanceSet = new ConcurrentSkipListSet < Double > ( ) ; if ( isFirstStatsCalculation ) { pm . beginTask ( "Calculating initial statistics..." , tinGeometries . length ) ; } else { pm . beginTask ( "Filtering all data on seeds tin..." , tinGeometries . length ) ; } try { final List < Coordinate > newTotalLeftOverCoordinateList = new ArrayList < Coordinate > ( ) ; if ( threadsNum > 1 ) { // multithreaded ThreadedRunnable tRun = new ThreadedRunnable ( threadsNum , null ) ; for ( final Geometry tinGeom : tinGeometries ) { tRun . executeRunnable ( new Runnable ( ) { public void run ( ) { List < Coordinate > leftOverList = runFilterOnAllData ( lasHandler , angleSet , distanceSet , tinGeom ) ; synchronized ( newTotalLeftOverCoordinateList ) { newTotalLeftOverCoordinateList . addAll ( leftOverList ) ; } } } ) ; } tRun . waitAndClose ( ) ; } else { for ( final Geometry tinGeom : tinGeometries ) { List < Coordinate > leftOverList = runFilterOnAllData ( lasHandler , angleSet , distanceSet , tinGeom ) ; newTotalLeftOverCoordinateList . addAll ( leftOverList ) ; } } pm . done ( ) ; leftOverCoordinateList . clear ( ) ; leftOverCoordinateList . addAll ( newTotalLeftOverCoordinateList ) ; /* * now recalculate the thresholds */ if ( angleSet . size ( ) > 1 ) { calculatedAngleThreshold = getMedianFromSet ( angleSet ) ; pm . message ( "Calculated angle threshold: " + calculatedAngleThreshold + " (range: " + angleSet . first ( ) + " to " + angleSet . last ( ) + ")" ) ; } else if ( angleSet . size ( ) == 0 ) { return ; } else { calculatedAngleThreshold = angleSet . first ( ) ; pm . message ( "Single angle left: " + calculatedAngleThreshold ) ; } if ( distanceSet . size ( ) > 1 ) { calculatedDistanceThreshold = getMedianFromSet ( distanceSet ) ; pm . message ( "Calculated distance threshold: " + calculatedDistanceThreshold + " (range: " + distanceSet . first ( ) + " to " + distanceSet . last ( ) + ")" ) ; } else if ( distanceSet . size ( ) == 0 ) { return ; } else { calculatedDistanceThreshold = distanceSet . first ( ) ; pm . message ( "Single distance left: " + calculatedDistanceThreshold ) ; } if ( isFirstStatsCalculation ) { isFirstStatsCalculation = false ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } }
Filter data on thresholds of all available data on the tin .