UnityMol  0.9.6-875
UnityMol viewer / In developement
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
ElectrostaticOldGUI.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 
7 
8 
9 public class ElectrostaticOldGUI {
10 
11  public static bool showElectrostaticsMenu = false;
12 
13  public static bool showFieldLines = false;
14  public static bool showVolumetricFields = false; // volumetric electrostatic fields
15 
16  public static bool electroIsoSurfaceTransparency = false;
17 
18  public static float generateThresholdDx_pos = 0f;
19  public static float generateThresholdDx_neg = 0f;
20 
21 
28  public static void Electrostatics (int a) {
29  //TODO Remove the generated surfaces here from SurfaceManager and move them to a ElectrostaticManager
30  #if UNITY_WEBPLAYER
31  GUI.enabled = false;
32  #endif
34 
35  showElectrostaticsMenu = LoadTypeGUI.SetTitleExit("Electrostatics");
36  GUILayout.BeginHorizontal ();
37  electroIsoSurfaceTransparency = GUILayout.Toggle(electroIsoSurfaceTransparency, new GUIContent("Transparency", "Toggle transparent isosurfaces."));
38  GUILayout.EndHorizontal ();
39 
40  GUILayout.BeginHorizontal ();
41  int sliderWidth = (int) (Rectangles.electroMenuWidth * 0.60f);
42  generateThresholdDx_neg = LoadTypeGUI.LabelSlider (generateThresholdDx_neg, -10f, 0f,
43  "T: " + Mathf.Round (generateThresholdDx_neg * 10f) / 10f, "Ramp value used for surface generation",GUI.enabled , sliderWidth, 1);
44  GUILayout.EndHorizontal ();
45 
47  GUI.enabled = false ;
48 
49 
50  GUILayout.BeginHorizontal ();
51  if (GUILayout.Button (new GUIContent ("Load Neg.", "Read an OpenDx format electrostatic field and generate a surface"))) {
54 
56 
59 
60  ElectrostaticManager.readdx.isoSurface(generateThresholdDx_neg,Color.red,-1, electroIsoSurfaceTransparency);
61 
62  }
63 
64  GUI.enabled = true ;
65  GUILayout.EndHorizontal ();
66 
67  GUILayout.BeginHorizontal ();
68  generateThresholdDx_pos = LoadTypeGUI.LabelSlider (generateThresholdDx_pos, 0f, 10f,
69  "T: " + Mathf.Round (generateThresholdDx_pos * 10f) / 10f, "Ramp value used for surface generation", GUI.enabled, sliderWidth, 1);
70  GUILayout.EndHorizontal ();
71 
73  GUI.enabled = false ;
74 
75  GUILayout.BeginHorizontal ();
76  if (GUILayout.Button (new GUIContent ("Load Pos.", "Read an OpenDx format electrostatic field and generate a surface"))) {
78 
80 
82 
85  ElectrostaticManager.readdx.isoSurface (generateThresholdDx_pos,Color.blue,1, electroIsoSurfaceTransparency);
86 
87  }
88 
89  GUI.enabled = true ;
90  GUILayout.EndHorizontal ();
91 
93 
94  GUILayout.BeginHorizontal();
95  if (GUILayout.Button (new GUIContent ("Toggle Neg.", "Toggles negative iso-surface from visible to hidden and vice versa"))) {
96 
98 
99  }
100  GUILayout.EndHorizontal ();
101 
103 
104  GUILayout.BeginHorizontal();
105  if (GUILayout.Button (new GUIContent ("Toggle Pos.", "Toggles positive iso-surface from visible to hidden and vice versa"))) {
106 
108  }
109  GUILayout.EndHorizontal();
110 
111  #if UNITY_WEBPLAYER
113  GUI.enabled = false;
114  else
115  GUI.enabled = true;
116  #else
117  GUI.enabled = true;
118  #endif
119 
120  GUILayout.BeginHorizontal();
121  if(GUILayout.Button(new GUIContent("Volumetric Fields", "Toggles volumetric rendering of electrostatic fields"))) {
122  showVolumetricFields = !showVolumetricFields;
124 
125  }
126  GUILayout.EndHorizontal();
127 
128  GUILayout.BeginHorizontal ();
130  GUI.enabled = false ;
131  if (GUILayout.Button (new GUIContent ("Field Lines", "Toggles animated field lines from visible to hidden and vice versa"))) {
132  if (showFieldLines) {
133  showFieldLines = false;
134  LoadTypeGUI.m_colorPicker = null ;
136  } else {
137  showFieldLines = true;
139  }
140  }
141  GUI.enabled = true ;
142  GUILayout.EndHorizontal ();
143  if (Event.current.type == EventType.Repaint)
144  MoleculeModel.newtooltip = GUI.tooltip;
145 
146  GUI.DragWindow();
147  } // End of Electrostatic
148 
149 
157  public static void FieldLines (int a) {
158 
159  if (GUILayout.Button (new GUIContent ("Energy/Field Color", "Choose color to represent potential energy or field lines"))){
162 
163  }
164 
165  if (GUILayout.Button (new GUIContent ("Color Gradient", "Display field lines with a color gradient")))
167 
168  int sliderWidth = (int) (Rectangles.fieldLinesWidth * 0.8f);
169 
171  "Speed " + ElectrostaticManager.fl_speed, "Determines field lines animation speed", true, sliderWidth, 1, true);
173  "Density " + ElectrostaticManager.fl_density, "Determines field lines density", true, sliderWidth, 1, true);
175  "Width " + ElectrostaticManager.fl_linewidth, "Determines field lines width", true, sliderWidth, 1, true);
177  "Length " + (1 - ElectrostaticManager.fl_linelength), "Determines field lines length", true, sliderWidth, 1, true);
178 
181 
182  if (Event.current.type == EventType.Repaint)
183  MoleculeModel.newtooltip = GUI.tooltip;
184 
185  GUI.DragWindow();
186  } // End of FieldLines
187 
188 
189 }
static void Electrostatics(int a)
Defines the electrostatic menu window, which is opened from the main menu window. ...
static bool showElectrostaticsMenu
void DestroySurfaces()
bool changed
Definition: ColorPicker.cs:90
static ColorPicker m_colorPicker
static string file_base_name
Definition: GUIDisplay.cs:120
static void FieldLines(int a)
Defines the Field Lines window, which is opened from the Electrostatic window.
static float generateThresholdDx_pos
void ShowHideSurfacePos()
void ShowHideSurfaceNeg()
static bool electroIsoSurfaceTransparency
static bool showVolumetricFields
static float LabelSlider(float sliderValue, float sliderMinValue, float sliderMaxValue, string labelText, string toolTip, bool enable, int sliderwidth, int labelwidth=100, bool newLine=false)
static ElectrostaticManager getElectrostaticManager()
Definition: UnityMolMain.cs:42
void isoSurface(float threshold, Color color, int isPos, bool transparency=false)
Definition: ReadDX.cs:369
static float generateThresholdDx_neg
static int electroMenuWidth
Definition: Rectangles.cs:210
static bool SetTitleExit(string s)
This is a somewhat odd but very convenient function.
Definition: LoadTypeGUI.cs:153
!WiP manage GUI, and provide static strings for the GUI.
Definition: GUIDisplay.cs:94
static void CreateColorPicker(ColorObject col, string title, List< string > atomTarget, string residueTarget="All", string chainTarget="All")
static int fieldLinesWidth
Definition: Rectangles.cs:218
static bool fieldLineColorGradient
static SurfaceManager getSurfaceManager()
Definition: UnityMolMain.cs:24
static ColorObject EnergyGrayColor
Definition: GUIDisplay.cs:66