2 * Copyright (C) 2009, 2010 SC 4ViewSoft SRL
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
16 package net.sf.openrocket.android.simulation;
\r
18 import net.sf.openrocket.android.Application;
\r
19 import net.sf.openrocket.document.OpenRocketDocument;
\r
20 import net.sf.openrocket.document.Simulation;
\r
21 import android.os.Bundle;
\r
22 import android.support.v4.app.Fragment;
\r
23 import android.support.v4.app.FragmentActivity;
\r
24 import android.support.v4.app.FragmentTransaction;
\r
27 * An activity that encapsulates a graphical view of the chart.
\r
29 public class SimulationViewActivity extends FragmentActivity {
\r
32 protected void onCreate(Bundle savedInstanceState) {
\r
33 super.onCreate(savedInstanceState);
\r
34 //setContentView(R.layout.simulation_graph_activity);
\r
35 int simulationNumber = getIntent().getIntExtra("Simulation", 0);
\r
37 final OpenRocketDocument rocketDocument = ((Application)getApplication()).getRocketDocument();
\r
39 Simulation sim = rocketDocument.getSimulation(simulationNumber);
\r
41 SimulationChart chart = new SimulationChart( simulationNumber);
\r
42 chart.setSeries1(sim.getSimulatedData().getBranch(0).getTypes()[1]);
\r
43 chart.setSeries2(sim.getSimulatedData().getBranch(0).getTypes()[2]);
\r
45 Fragment graph = SimulationFragment.newInstance(chart);
\r
47 FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
\r
48 ft.add(android.R.id.content, graph);
\r