Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Orekit
Stavor
Commits
90c2c164
Commit
90c2c164
authored
Jul 18, 2014
by
Xavier
Browse files
Orbit views
parent
19058cf7
Changes
15
Hide whitespace changes
Inline
Side-by-side
assets/www/huds/index_orbit.html
View file @
90c2c164
...
...
@@ -109,6 +109,8 @@
var
value_orbit_i
=
Math
.
PI
/
9
;
var
value_orbit_w
=
Math
.
PI
;
var
value_orbit_raan
=
0
;
var
locked_view
=
false
;
//-----------------------------------------------------------------------------------------------------------------------
...
...
@@ -138,7 +140,17 @@
onRenderFcts
.
push
(
function
(){
renderer
.
render
(
scene
,
camera
);
})
//////////////////////////////////////////////////////////////////////////////////
// VIEWS //
//////////////////////////////////////////////////////////////////////////////////
onRenderFcts
.
push
(
function
(){
if
(
locked_view
){
camera
.
position
=
value_spacecraft
.
clone
().
normalize
().
multiplyScalar
(
getCamDistance
());
camera
.
lookAt
(
scene
.
position
);
}
})
//////////////////////////////////////////////////////////////////////////////////
// loop runner //
//////////////////////////////////////////////////////////////////////////////////
...
...
assets/www/huds/interface_orbit.js
View file @
90c2c164
...
...
@@ -159,3 +159,16 @@ function updateModelState(new_state){
//}
//}
}
function
changeView
(
view_mode
){
switch
(
view_mode
){
case
"
Free
"
:
//free
locked_view
=
false
;
break
;
case
"
Locked
"
:
//locked
locked_view
=
true
;
break
;
}
}
function
getCamDistance
(){
return
Math
.
sqrt
(
camera
.
position
.
x
*
camera
.
position
.
x
+
camera
.
position
.
y
*
camera
.
position
.
y
+
camera
.
position
.
z
*
camera
.
position
.
z
);
}
project.properties
View file @
90c2c164
...
...
@@ -13,4 +13,4 @@
# Project target.
target
=
android-19
android.library.reference.1
=
../android-support-v7-appcompat
android.library.reference.2
=
../crosswalk-webview-7.36.154.8-
arm
android.library.reference.2
=
../crosswalk-webview-7.36.154.8-
x86
res/layout-land/orb_display.xml
View file @
90c2c164
...
...
@@ -17,21 +17,6 @@
android:orientation=
"vertical"
>
</LinearLayout>
<FrameLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentTop=
"true"
android:layout_marginLeft=
"3dp"
>
<TextView
android:id=
"@+id/textViewFPS"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/fps_zero"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"@color/white"
/>
</FrameLayout>
<FrameLayout
android:id=
"@+id/SimControlFrame"
android:layout_width=
"wrap_content"
...
...
@@ -62,7 +47,37 @@
android:src=
"@drawable/stop"
/>
</LinearLayout>
</FrameLayout>
<FrameLayout
android:id=
"@+id/spinnerlayout"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
<Button
android:id=
"@+id/buttonMissionNew"
android:layout_width=
"90dp"
android:layout_height=
"wrap_content"
android:background=
"@drawable/view_selector"
android:minHeight=
"30dp"
android:text=
"@string/menu_views_ref_frame_xyz"
android:textAppearance=
"?android:attr/textAppearanceSmall"
/>
</FrameLayout>
<FrameLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentLeft=
"true"
android:layout_below=
"@id/spinnerlayout"
android:layout_marginLeft=
"3dp"
>
<TextView
android:id=
"@+id/textViewFPS"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/fps_zero"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"@color/white"
/>
</FrameLayout>
<FrameLayout
android:id=
"@+id/frameLayoutProgress"
...
...
@@ -94,6 +109,5 @@
android:src=
"@drawable/ic_launcher"
/>
</FrameLayout>
</RelativeLayout>
\ No newline at end of file
res/layout-sw600dp-land/orb_display.xml
View file @
90c2c164
...
...
@@ -20,7 +20,8 @@
<FrameLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentTop=
"true"
android:layout_alignParentLeft=
"true"
android:layout_below=
"@id/spinnerlayout"
android:layout_marginLeft=
"3dp"
>
<TextView
...
...
@@ -62,6 +63,21 @@
android:src=
"@drawable/stop"
/>
</LinearLayout>
</FrameLayout>
<FrameLayout
android:id=
"@+id/spinnerlayout"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
<Button
android:id=
"@+id/buttonMissionNew"
android:layout_width=
"135dp"
android:layout_height=
"wrap_content"
android:background=
"@drawable/view_selector"
android:minHeight=
"45dp"
android:text=
"@string/menu_views_ref_frame_xyz"
android:textAppearance=
"?android:attr/textAppearanceMedium"
/>
</FrameLayout>
<FrameLayout
android:id=
"@+id/frameLayoutProgress"
...
...
res/layout-sw600dp/orb_display.xml
View file @
90c2c164
...
...
@@ -48,10 +48,26 @@
</LinearLayout>
</FrameLayout>
<FrameLayout
android:id=
"@+id/spinnerlayout"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
<Button
android:id=
"@+id/buttonMissionNew"
android:layout_width=
"135dp"
android:layout_height=
"wrap_content"
android:background=
"@drawable/view_selector"
android:minHeight=
"45dp"
android:text=
"@string/menu_views_ref_frame_xyz"
android:textAppearance=
"?android:attr/textAppearanceMedium"
/>
</FrameLayout>
<FrameLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentLeft=
"true"
android:layout_below=
"@id/spinnerlayout"
android:layout_marginTop=
"3dp"
>
<TextView
...
...
@@ -95,6 +111,5 @@
android:src=
"@drawable/ic_launcher"
/>
</FrameLayout>
</RelativeLayout>
\ No newline at end of file
res/layout/orb_display.xml
View file @
90c2c164
...
...
@@ -48,10 +48,26 @@
</LinearLayout>
</FrameLayout>
<FrameLayout
android:id=
"@+id/spinnerlayout"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
<Button
android:id=
"@+id/buttonMissionNew"
android:layout_width=
"90dp"
android:layout_height=
"wrap_content"
android:background=
"@drawable/view_selector"
android:minHeight=
"30dp"
android:text=
"@string/menu_views_ref_frame_xyz"
android:textAppearance=
"?android:attr/textAppearanceSmall"
/>
</FrameLayout>
<FrameLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentLeft=
"true"
android:layout_below=
"@id/spinnerlayout"
android:layout_marginTop=
"3dp"
>
<TextView
...
...
res/menu/views_orb.xml
0 → 100644
View file @
90c2c164
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
tools:context=
"cs.si.stavor.fragments.HudFragment"
>
<item
android:id=
"@+id/menu_orbviews_free"
android:title=
"@string/menu_orbviews_free"
app:showAsAction=
"never"
/>
<item
android:id=
"@+id/menu_orbviews_locked"
android:title=
"@string/menu_orbviews_locked"
app:showAsAction=
"never"
/>
</menu>
res/values-es/strings.xml
View file @
90c2c164
...
...
@@ -66,6 +66,9 @@
<string
name=
"menu_views_earth"
>
Tierra
</string>
<string
name=
"menu_views_sun"
>
Sol
</string>
<string
name=
"menu_orbviews_free"
>
Libre
</string>
<string
name=
"menu_orbviews_locked"
>
Agarrado
</string>
<string
name=
"about"
>
Acerca de
</string>
<string
name=
"cs_site"
>
http://c-s.fr/
</string>
<string
name=
"about_table_project"
>
Proyecto
</string>
...
...
res/values-fr/strings.xml
View file @
90c2c164
...
...
@@ -67,6 +67,9 @@
<string
name=
"menu_views_earth"
>
Terre
</string>
<string
name=
"menu_views_sun"
>
Soleil
</string>
<string
name=
"menu_orbviews_free"
>
Libre
</string>
<string
name=
"menu_orbviews_locked"
>
Saisi
</string>
<string
name=
"about"
>
À propos
</string>
<string
name=
"cs_site"
>
http://c-s.fr/
</string>
<string
name=
"about_table_project"
>
Projet
</string>
...
...
res/values/keys.xml
View file @
90c2c164
...
...
@@ -134,5 +134,8 @@
<string
name=
"key_views_earth"
>
Earth
</string>
<string
name=
"key_views_sun"
>
Sun
</string>
<string
name=
"key_orbviews_free"
>
Free
</string>
<string
name=
"key_orbviews_locked"
>
Locked
</string>
</resources>
\ No newline at end of file
res/values/strings.xml
View file @
90c2c164
...
...
@@ -66,6 +66,9 @@
<string
name=
"menu_views_earth"
>
Earth
</string>
<string
name=
"menu_views_sun"
>
Sun
</string>
<string
name=
"menu_orbviews_free"
>
Free
</string>
<string
name=
"menu_orbviews_locked"
>
Locked
</string>
<string
name=
"about"
>
About
</string>
<string
name=
"cs_site"
>
http://c-s.fr/
</string>
<string
name=
"about_table_project"
>
Project
</string>
...
...
src/cs/si/stavor/MainActivity.java
View file @
90c2c164
...
...
@@ -222,6 +222,7 @@ public class MainActivity extends ActionBarActivity implements
if
(
dataFragment
==
null
)
{
flagActivityFirstExec
=
true
;
((
StavorApplication
)
getApplication
()).
modelViewId
=
R
.
id
.
menu_views_ref_frame_xyz
;
((
StavorApplication
)
getApplication
()).
modelOrbitViewId
=
R
.
id
.
menu_orbviews_free
;
// add the fragment
dataFragment
=
new
RetainedFragment
();
fm
.
beginTransaction
().
add
(
dataFragment
,
"data"
).
commit
();
...
...
src/cs/si/stavor/StavorApplication.java
View file @
90c2c164
...
...
@@ -21,6 +21,7 @@ public class StavorApplication extends Application {
public
SQLiteDatabase
db
;
public
int
modelViewId
=
R
.
id
.
menu_views_ref_frame_xyz
;
public
int
modelOrbitViewId
=
R
.
id
.
menu_orbviews_free
;
WebAppInterface
jsInterface
;
...
...
src/cs/si/stavor/fragments/OrbitFragment.java
View file @
90c2c164
...
...
@@ -5,6 +5,7 @@ import org.xwalk.core.XWalkView;
import
cs.si.stavor.R
;
import
cs.si.stavor.MainActivity
;
import
cs.si.stavor.StavorApplication
;
import
cs.si.stavor.model.Browsers
;
import
cs.si.stavor.simulator.Simulator
;
import
android.annotation.SuppressLint
;
...
...
@@ -12,12 +13,16 @@ import android.app.Activity;
import
android.os.Bundle
;
import
android.app.Fragment
;
import
android.view.LayoutInflater
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.View.OnClickListener
;
import
android.view.ViewGroup.LayoutParams
;
import
android.widget.Button
;
import
android.widget.FrameLayout
;
import
android.widget.ImageButton
;
import
android.widget.LinearLayout
;
import
android.widget.PopupMenu
;
import
android.widget.ProgressBar
;
import
android.widget.TextView
;
...
...
@@ -50,6 +55,7 @@ public final class OrbitFragment extends Fragment {
private
Simulator
simulator
;
LinearLayout
browserLayout
;
Button
views_menu
;
/**
* WebView from XWalk project to increase compatibility of WebGL
...
...
@@ -81,6 +87,16 @@ public final class OrbitFragment extends Fragment {
browserLayout
.
addView
(
mXwalkView
);
views_menu
=
(
Button
)
rootView
.
findViewById
(
R
.
id
.
buttonMissionNew
);
views_menu
.
setOnClickListener
(
new
OnClickListener
(){
@Override
public
void
onClick
(
View
arg0
)
{
showPopup
(
arg0
);
}
});
views_menu
.
setText
(
titleOfViewId
(((
StavorApplication
)
getActivity
().
getApplication
()).
modelOrbitViewId
));
//Play/Pause/Stop buttons
ImageButton
but_play
=
(
ImageButton
)
rootView
.
findViewById
(
R
.
id
.
imageButtonPlay
);
...
...
@@ -124,6 +140,52 @@ public final class OrbitFragment extends Fragment {
fps
.
setAlpha
((
float
)
1.0
);
}
private
String
titleOfViewId
(
int
id
){
switch
(
id
)
{
case
R
.
id
.
menu_orbviews_free
:
return
getString
(
R
.
string
.
menu_orbviews_free
);
case
R
.
id
.
menu_orbviews_locked
:
return
getString
(
R
.
string
.
menu_orbviews_locked
);
default
:
return
getString
(
R
.
string
.
menu_orbviews_free
);
}
}
/**
* Shows the visualization Views menu
* @param v
*/
private
void
showPopup
(
View
v
)
{
PopupMenu
popup
=
new
PopupMenu
(
getActivity
(),
v
);
// This activity implements OnMenuItemClickListener
popup
.
setOnMenuItemClickListener
(
new
PopupMenu
.
OnMenuItemClickListener
()
{
@Override
public
boolean
onMenuItemClick
(
MenuItem
item
)
{
String
com_view
=
(
String
)
item
.
getTitle
();
String
command
;
((
StavorApplication
)
getActivity
().
getApplication
()).
modelOrbitViewId
=
item
.
getItemId
();
switch
(
item
.
getItemId
())
{
case
R
.
id
.
menu_orbviews_free
:
command
=
getString
(
R
.
string
.
key_orbviews_free
);
break
;
case
R
.
id
.
menu_orbviews_locked
:
command
=
getString
(
R
.
string
.
key_orbviews_locked
);
break
;
default
:
return
false
;
}
views_menu
.
setText
(
com_view
);
mXwalkView
.
load
(
"javascript:changeView('"
+
command
+
"')"
,
null
);
return
true
;
}
});
popup
.
inflate
(
R
.
menu
.
views_orb
);
popup
.
show
();
}
@Override
public
void
onDestroyView
(){
simulator
.
setBrowserLoaded
(
false
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment