UnityMol  0.9.6-875
UnityMol viewer / In developement
GuidedNavigationOldGUI.cs
Go to the documentation of this file.
1 using UnityEngine;
2 using System.Collections;
3 using UI;
4 using Molecule.Model;
5 using Molecule.View;
6 using Reorient;
7 using OptimalView;
8 using GuidedNav;
9 
10 
12 
13  public static bool showGuidedMenu = false;
14 
15  public static void GuidedOptions(int a){
16  showGuidedMenu = LoadTypeGUI.SetTitleExit("Guided Navigation");
18 
19  if(!UIData.guided)
20  {
21  // Enter the origin of symmetry as an array of 3 floats
22  GUILayout.BeginHorizontal();
23  GUILayout.Label (new GUIContent ("Symmetry origin: ", "Enter here the origin 3D coordinates of the symmetry axis"), GUILayout.MinWidth ((int)(Rectangles.advOptWidth * 0.4f)));
24 
25  GNParameters.SymmetryOriginX = GUILayout.TextField (GNParameters.SymmetryOriginX, 8);
26  GNParameters.SymmetryOriginY = GUILayout.TextField (GNParameters.SymmetryOriginY, 8);
27  GNParameters.SymmetryOriginZ = GUILayout.TextField (GNParameters.SymmetryOriginZ, 8);
28 
29  GUILayout.EndHorizontal ();
30 
31  // Enter the direction of symmetry as an array of 3 floats
32  GUILayout.BeginHorizontal();
33  GUILayout.Label (new GUIContent ("Symmetry direction: ", "Enter here the direction of the symmetry axis"), GUILayout.MinWidth ((int)(Rectangles.advOptWidth * 0.4f)));
34 
38 
39  GUILayout.EndHorizontal ();
40 
41  // Submit the symmetry information to proceed to the atoms coordinates changes (only one time)
42  GUILayout.BeginHorizontal ();
43  if (GUILayout.Button (new GUIContent ("Send", "submit the symmetrical information."))) {
44  float OriginX = float.Parse(GNParameters.SymmetryOriginX);
45  float OriginY = float.Parse(GNParameters.SymmetryOriginY);
46  float OriginZ = float.Parse(GNParameters.SymmetryOriginZ);
47  float DirectionX = float.Parse(GNParameters.SymmetryDirectionX);
48  float DirectionY = float.Parse(GNParameters.SymmetryDirectionY);
49  float DirectionZ = float.Parse(GNParameters.SymmetryDirectionZ);
50  Reorient.Reorient.LoadSymmetry (OriginX, OriginY, OriginZ, DirectionX, DirectionY, DirectionZ);
51  }
52  GUILayout.EndHorizontal ();
53  }
54 
55  if(UIData.guided)
56  {
57  GUILayout.BeginHorizontal();
58  GUILayout.Label (new GUIContent ("Target: ", "Enter here the 3D coordinates of the atom target"), GUILayout.MinWidth ((int)(Rectangles.advOptWidth * 0.4f)));
59 
60  GNParameters.TargetX = GUILayout.TextField (GNParameters.TargetX, 8);
61  GNParameters.TargetY = GUILayout.TextField (GNParameters.TargetY, 8);
62  GNParameters.TargetZ = GUILayout.TextField (GNParameters.TargetZ, 8);
63 
64  GUILayout.EndHorizontal ();
65 
66  GUILayout.BeginHorizontal();
67  GUILayout.Label (new GUIContent ("Camera distance: ", "Enter here the desired distance between the target and the camera"), GUILayout.MinWidth ((int)(Rectangles.advOptWidth * 0.4f)));
68 
69  GNParameters.CameraDistance = GUILayout.TextField (GNParameters.CameraDistance, 8);
70 
71  GUILayout.EndHorizontal ();
72 
73  GUILayout.BeginHorizontal ();
74  if (GUILayout.Button (new GUIContent ("Send", "compute the best point-of-view for the target coordinates."))) {
75  float[] TargetCoords = new float[3];
76  TargetCoords[0] = float.Parse(GNParameters.TargetX);
77  TargetCoords[1] = float.Parse(GNParameters.TargetY);
78  TargetCoords[2] = float.Parse(GNParameters.TargetZ);
79  float Distance = float.Parse(GNParameters.CameraDistance);
80  OptimalView.OptimalView.GetOptimalPosition(TargetCoords, Distance);
81  }
82  GUILayout.EndHorizontal ();
83  GUILayout.BeginHorizontal ();
85  new GUIContent("Show symmetry axis and origin point", "Hide/Show symmetry axis and origin point"));
91  GNParameters.originThere = false;
92  }
93  GUILayout.EndHorizontal ();
94 
95  GUILayout.BeginHorizontal ();
96  if (GUILayout.Button (new GUIContent ("Stop", "Get out of Guided Navigation Mode."))) {
98  GUIMoleculeController.scenecontroller.GetComponent<maxCamera> ().ToCenter();
99  }
100  GUILayout.EndHorizontal ();
101  }
102 
103  GUI.enabled = true;
104  GUI.DragWindow();
105  gnManager.UpdateManager();
106  }
107 
108 }
static GuidedNavigationManager getGuidedNavigationManager()
Definition: UnityMolMain.cs:38
void CreateAxeAndOrigin()
Instantiate the origin and symmetry axis game objects.
static bool originThere
Did we instantiate the origin and symmetry axis? True by default.
void DestroyAxeAndOrigin()
Destroy the axis and origin game objects.
static bool guided
Definition: UIData.cs:201
static int advOptWidth
Definition: Rectangles.cs:250
static void GetOptimalPosition(float[] target, float radius)
Get the position with the largest view cone on a specific target and with respect to an input radius ...
Definition: OptimalView.cs:49
static string CameraDistance
Distance of the camera to the target.
static string TargetX
3D coordinates of the camera target
!WiP Includes FLAGS of GUI.
Definition: UIData.cs:78
The GNParameters class regroups settings used for Guided Navigation and GLIC spreading.
static bool SetTitleExit(string s)
This is a somewhat odd but very convenient function.
Definition: LoadTypeGUI.cs:153
static void GuidedOptions(int a)
static bool hasMoleculeDisplay
Definition: UIData.cs:96
static void LoadSymmetry(float Xorigin, float Yorigin, float Zorigin, float Xdirection, float Ydirection, float Zdirection)
Definition: Reorient.cs:23
static string SymmetryDirectionX
Symmetry axis direction.
static bool showOriginAxe
Display the origin and symmetry axis (true) or not (false)
Definition: GUIDisplay.cs:66
static string SymmetryOriginX
3D coordinates of the symmetry axis origin