+ if ( anObj.IsNull() || anObj->IsRemoved() ) {
+ continue;
+ }
+
+ int aDisplayOrderIndex = module()->getObjectDisplayOrder( (size_t)aViewer, anObj );
+ if ( aDisplayOrderIndex > aMaxIndex ) {
+ anObjects.Append( anObj );
+ aMaxIndex = aDisplayOrderIndex;
+ } else {
+ anObjects.Prepend( anObj );
+ }
+ }
+
+ // Get existing Z layers
+ TColStd_SequenceOfInteger anExistingZLayers;
+ aViewer->getViewer3d()->GetAllZLayers( anExistingZLayers );
+ int aNbLayers = anExistingZLayers.Length();
+
+ // Display
+ for ( int i = 1, n = anObjects.Length(); i <= n; i++ )
+ {
+ Handle(HYDROData_Entity) anObj = anObjects.Value( i );