All examples for GUI
#	Using GUI in interactive 2-D gravity modeling

### --------------------------------------------------------
### Two density bodies are created in a uniform background. 
### An two-frame image is created, with coordinated cross-section 
### and gravity displays and push-butons to demonstrate 
### interaction with the gravity modeling program.
###
### The gravity modeling tool uses a legacy Fotran code by
### the University of Wyoming Reflection Seismology group 
### (S.Mackenzie, modified by: C.Hurich, R.Johnson, and R.Black; 
### June, 1984) based on the method by Talwani et. al. 
### (Geophysics, 1959)
################################################################


### Model description and gracity modeling tool
### Note that the tool deals only with the gravity problem
### and has nothing to do with interactive graphics.
### In this example, lists "body" specify the gravity bodies, and
### the observed gravity data are given in list "profile"
#################################################################

*call	grmod2	KM      0       2.6	grmod2_model

# bodies with names, densities, and optional "lithology" 
# classification types

body	2.9		Big hunk
40      10
40      20
80      40
90      5

body	3.3		Small chip
10      1.5
10      6.5
15      10.5
18      7.0

# surface and observed gravity profile. They can also be loaded from 
# database tables, but we are using a simple job line description here

profile
0       0       0
5	1.0	30
10	1.5	50
15	0.5	70
20	-0.4	100
25	0	120
30	0       150
35	0.2	70
40	1.6	0
45	1.8	-30
50	2.6	-50
55	2.9	-70
60	2.2	-100
65	3.4	-50
70	2.2	-30
75	0.7	5
80	-1.0	30
85	-0.5	35
90	0       50
95	0.5	20
100	0.7      3

### Define graphics elements for the images
#########################################################

*call	graphic

# buttons and the corresponding commands sent to grmod2_model above

button	button1		Left		
grmod2_model	exec	m-1.0 

button	button2		Right		
grmod2_model	exec	m1.0  

button	button11	Apart		
grmod2_model	exec	a1.0  

button	button21	Closer		
grmod2_model	exec	a-1.0   

button	button3		Heavier		
grmod2_model	exec	d0.02 

button	button4		Lighter		
grmod2_model	exec	d-0.02  

button	button5		Print		
grmod2_model	print	Hello, world!

# palettes used to display density

backgr	black
foregr	black

palette	pal-density1
-0.3	red		0	blue
0	white		0.3	red

#palette	pal-density		buor			5.5	8
palette	pal-density	gmtseis			2.5	3.6

# line and fill styles for the bodies and gravity profiles

line	solid	1	brown		line-surface
line	solid	1	green		line-bodies
line	solid	1	blue		line-grcalc
line	solid	1	yellow		line-grobs
line	solid	1	red		line-grresidual

fill	solid	blue		fill-bodies

# text style for labeling densities

textstl	center	center		text-densities
font	10				blue

axis	axis-grav	bar	left
_label		mGal
_ticks
	
axis	axis-dist	bar	bottom
_label		X [km]
_ticks	

axis	axis-depth	bar	left
_label		Z [km]
_ticks	

### Define the cross-section image
######################################

*call	image	section  
1       1       5       3
range-x	0       100
range-y	-20	50      yes

# plot cross-section elements from grmod2 call above

gravmod	grmod2_model
section			surface			line-surface
section			bodies			line-bodies
section			bodies			fill-bodies
section						pal-density
section						text-densities

# density color bar

cscale	vert	-0.8	-0.3	0.1	0.3	Density
pal-density

# butons to control the modelling

object	button1
object	button2
object	button11
object	button21
object	button3
object	button4
object	button5

object	axis-depth

### Define the gravity profile image
#########################################

*call	image	gravity  
1       5       5       3 
range-x	0       100
range-y	-400	400

# plot gravity profile elements from grmod2 call above

gravmod	grmod2_model
gravity						line-grobs
calgrav						line-grcalc
resgrav						line-grresidual

object	axis-grav
object	axis-dist

#### start an OpenGL viewer session using the two images
########################################################

*call	gui
gravity
section

# make coordinated X coordinates and zoom levels in both sections

layout	vert				x	zoom	

# display the Object Tree, graphics, and Property Editor in three docking windows 

dockers
otree		canvas
#otree		graph
prop