/*
 *  ChangeOrientation.java
 *  Cookbook
 *
 *  Copyright (c) 2001-2009 Flagstone Software Ltd. All rights reserved.
 *
 *  This code is distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
 *  EXPRESS OR IMPLIED, AND Flagstone HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING
 *  WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 *  PURPOSE, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
 */

import com.flagstone.transform.*;

import java.util.*;

/*
 * This example shows how to change the size of a shape:
 *
 * To run this example, type the following on a command line:
 *
 *     java -cp cookbook.jar ChangeOrientation file-out
 *
 * where
 *
 *     file-out is the path where the file will be written. If no output file 
 *     is specified then a file named after the example will be written to the 
 *     current directory.
*/
public class ChangeOrientation
{
	public static void main(String[] args)
	{
        try
        {
        	String out = args.length == 0 ? "ChangeOrientation.swf" : args[0];
        	ChangeOrientation example = new ChangeOrientation();         
            FSMovie movie = new FSMovie();            
            example.createMovie(movie);
            movie.encodeToFile(out);
        }
        catch (Exception e)
        {
        	e.printStackTrace();
        }
	}
    
	void createMovie(FSMovie movie)
    {
        int xLower = 0;
        int yLower = 0;
        int xUpper = 8000;
        int yUpper = 8000;
        
        float framesPerSecond = 12.0f;

		movie.setFrameRate(framesPerSecond);
        movie.setFrameSize(new FSBounds(xLower, yLower, xUpper, yUpper));
        movie.add(new FSSetBackgroundColor(FSColorTable.lightblue()));
        
        FSDefineShape rectangle = createRectangle(movie);
        movie.add(rectangle);

        movie.add(new FSPlaceObject2(rectangle.getIdentifier(), 1, 4000, 4000));
        movie.add(FSShowFrame.getInstance());
       
        int angle = 0;
        int delta = 15;
        int steps = 360/delta;
        
        FSCoordTransform transform;
        
        for (int i=0; i