public int getFeaturePosition ( AbstractFeature feature ) { AbstractFeature result = feature ; if ( ! featurePositions . containsKey ( feature ) ) { if ( feature instanceof FeatureGroup ) { FeatureGroup featureGroup = ( FeatureGroup ) feature ; List < Feature > features = featureGroup . getConcreteFeatures ( ) ; if ( ! features . isEmpty ( ) ) { Collections . sort ( features , new Comparator < Feature > ( ) { @ Override public int compare ( Feature feat1 , Feature feat2 ) { return getFeaturePosition ( feat1 ) - getFeaturePosition ( feat2 ) ; } } ) ; result = features . get ( 0 ) ; } } } return featurePositions . getOrDefault ( result , 0 ) ; }
Returns the absolute position of the feature or create if not exists