public void situateScenario ( Scenario scenario , Double2D position , Double2D alpha , Double2D beta , Double2D gamma ) throws ShanksException { Scenario2DPortrayal portrayal ; try { portrayal = ( Scenario2DPortrayal ) scenario . createScenarioPortrayal ( ) ; ContinuousPortrayal2D devicesPortrayal = ( ContinuousPortrayal2D ) portrayal . getPortrayals ( ) . get ( Scenario2DPortrayal . MAIN_DISPLAY_ID ) . get ( ScenarioPortrayal . DEVICES_PORTRAYAL ) ; Continuous2D devicesSpace = ( Continuous2D ) devicesPortrayal . getField ( ) ; Bag allElements = devicesSpace . getAllObjects ( ) ; Object [ ] all = allElements . objs ; for ( int i = 0 ; i < all . length ; i ++ ) { Device device = ( Device ) all [ i ] ; if ( device != null ) { Double2D devicePosition = devicesSpace . getObjectLocation ( device ) ; Double2D rotated = ShanksMath . rotate ( devicePosition , alpha , beta , gamma ) ; Double2D finalPosition = ShanksMath . add ( rotated , position ) ; this . situateDevice ( device , finalPosition . x , finalPosition . y ) ; } } HashMap < String , NetworkElement > elements = scenario . getCurrentElements ( ) ; for ( Entry < String , NetworkElement > entry : elements . entrySet ( ) ) { if ( entry . getValue ( ) instanceof Link ) { this . drawLink ( ( Link ) entry . getValue ( ) ) ; } } if ( scenario instanceof ComplexScenario ) { this . drawScenarioLinksLinks ( ( ComplexScenario ) scenario ) ; } } catch ( DuplicatedPortrayalIDException e ) { throw e ; } }
Situate the scenario in the complex scenario main display