%
%  Name: edtgeset.m
% 
%  Usage: edtgeset.m
% 
%   Description:
%    Set up the uicontrols for the geometry editor
%
%  Version SWD970202
%
%  Author(s): Scott Doebling, doebling@lanl.gov
%
%  Institution: Los Alamos National Laboratory,
%		ESA-EA
%
%  Copyright (c) 1996-1997, The Regents of the University
%     	of California. (See top level of code for
%			full copyright statement.)
%

hedtgfig = figure( ...
	'visible','off',...
	'Name','DIAMOND: EditGeom', ...
	'NumberTitle','off', ...
	'Units','normal', ...
	'Position',[0.1 0.1 0.8 0.8]);


%%
%% Set default values for undefined variables
%%

%%
%%
%%  Bar Connectivity Controls Definitions
%%
%%

ibar = 1;
inode1 = 1;
inode2 = 2;

ibarlab = 0;
ibardel = 0;

%
% Define Frame Around Bar Controls
%

hbarframe = uicontrol(hedtgfig,'style','frame',...
		'units','normal',...
		'pos',[0.05 0.90 0.9 0.1]);

	uicontrol(hedtgfig,'style','text',...
	'units','normal',...
	'pos',[.05 .954 .2 .04],...
	'back',[.9 .9 .9], ...
    	'string','Bar Definition')

%
%  Define Bar Element Label Switch
%

hbarlab = uicontrol(hedtgfig,'style','checkbox',...
		'units','normal',...
		'position',[0.27 0.954 0.2 0.04],...
		'string','Show Labels',...
		'value',ibarlab,...
		'callback','ibarlab = get(hbarlab,''value'');');

%
%  Define Bar Element Delete Switch
%

hbardel = uicontrol(hedtgfig,'style','checkbox',...
		'units','normal',...
		'position',[0.50 0.954 0.2 0.04],...
		'string','Delete Bar',...
		'value',ibardel,...
		'callback','ibardel = get(hbardel,''value'');');

%
%  Define Update Button for Bar Definitions
%

hibarupdate = uicontrol(hedtgfig,'style','push',...
	'units','normal',...
	'pos',[.055 .904 .2 .04],...
        'string','Update Bar Geometry',...
	'callback','updtbars');

%
% Define Text box for Bar Number
%

hibar = uicontrol(hedtgfig,'style','edit',...
	'units','normal',...
	'pos',[.42 .904 .05 .04],...
        'string',num2str(ibar));

	uicontrol(hedtgfig,'style','text',...
	'units','normal',...
	'pos',[.27 .904 .15 .04],...
    	'string','Bar Label');

%
% Define Text box for Node1 Number
%

hinode1 = uicontrol(hedtgfig,'style','edit',...
	'units','normal',...
	'pos',[0.65 .904 .05 .04],...
        'string',num2str(inode1));

	uicontrol(hedtgfig,'style','text',...
	'units','normal',...
	'pos',[0.5 .904 .15 .04],...
    	'string','Node 1 Label');


%
% Define Text box for Node2 Number
%

hinode2 = uicontrol(hedtgfig,'style','edit',...
	'units','normal',...
	'pos',[0.88 .904 .05 .04],...
        'string',num2str(inode2));

	uicontrol(hedtgfig,'style','text',...
	'units','normal',...
	'pos',[0.73 .904 .15 .04],...
    	'string','Node 2 Label');


%%
%%
%%  Node List Controls Definitions
%%
%%

inode = 1;
xnode = 0;
ynode = 0;
znode = 0;

inodelab = 0;
inodedel = 0;

%
% Define Frame Around Node List Controls
%

hnodeframe = uicontrol(hedtgfig,'style','frame',...
		'units','normal',...
		'pos',[0.05 0.79 0.9 0.1]);

	uicontrol(hedtgfig,'style','text',...
	'units','normal',...
	'pos',[.05 .844 .2 .04],...
	'back',[.9 .9 .9], ...
    	'string','Node List Definition')

%
%  Define Node Label Switch
%

hnodelab = uicontrol(hedtgfig,'style','checkbox',...
		'units','normal',...
		'position',[0.27 0.844 0.2 0.04],...
		'string','Show Labels',...
		'value',inodelab,...
		'callback','inodelab = get(hnodelab,''value'');');

%
%  Define Node Delete Switch
%

hnodedel = uicontrol(hedtgfig,'style','checkbox',...
		'units','normal',...
		'position',[0.5 0.844 0.2 0.04],...
		'string','Delete Node',...
		'value',inodedel,...
		'callback','inodedel = get(hnodedel,''value'');');

%
%  Define Update Button for Node Definitions
%

hinodeupdate = uicontrol(hedtgfig,'style','push',...
	'units','normal',...
	'pos',[.055 .794 .2 .04],...
        'string','Update Node Geometry',...
	'callback','updtnode');

%
% Define Text box for Node Label
%

hinode = uicontrol(hedtgfig,'style','edit',...
	'units','normal',...
	'pos',[.88 .844 .05 .04],...
        'string',num2str(ibar));

	uicontrol(hedtgfig,'style','text',...
	'units','normal',...
	'pos',[.73 .844 .15 .04],...
    	'string','Node Label');

%
% Define Text box for xnode
%

hixnode = uicontrol(hedtgfig,'style','edit',...
	'units','normal',...
	'pos',[0.42 .794 .05 .04],...
        'string',num2str(xnode));

	uicontrol(hedtgfig,'style','text',...
	'units','normal',...
	'pos',[0.27 .794 .15 .04],...
    	'string','Node X Coord.');


%
% Define Text box for ynode
%

hiynode = uicontrol(hedtgfig,'style','edit',...
	'units','normal',...
	'pos',[0.65 .794 .05 .04],...
        'string',num2str(ynode));

	uicontrol(hedtgfig,'style','text',...
	'units','normal',...
	'pos',[0.50 .794 .15 .04],...
    	'string','Node Y Coord.');

%
% Define Text box for znode
%

hiznode = uicontrol(hedtgfig,'style','edit',...
	'units','normal',...
	'pos',[0.88 .794 .05 .04],...
        'string',num2str(znode));

	uicontrol(hedtgfig,'style','text',...
	'units','normal',...
	'pos',[0.73 .794 .15 .04],...
    	'string','Node Z Coord.');

%%
%%
%%  Define Geometry Axes
%%
%%

hageom =  axes('position',[0.1 0.1 0.8 0.64]);

%%
%%
%%  Define the Update-Geometry Button
%%
%%

higeomupdate = uicontrol(hedtgfig,'style','push',...
	'units','normal',...
	'pos',[.05 .73 .25 .05],...
        'string','Update Geometry Display',...
	'callback','updtgeom(''-'',ibarlab,inodelab,Nodes,Bars,hageom)');
%%
%%
%%  Define the Exit Button
%%
%%

higeomupdate = uicontrol(hedtgfig,'style','push',...
	'units','normal',...
	'pos',[.775 .01 .2 .04],...
        'string','Exit EditGeom',...
	'callback','set(hedtgfig,''visible'',''off'')');

%
% Define Elevation Slider
%

helslid = uicontrol(hedtgfig,'style','slider',...
		'units','normal',...
		'pos',[0.33 0.76 0.25 0.02],...
		'max',90,...
		'min',0,...
		'value',naxel,...
		'callback',['naxel = floor(get(helslid,''value''));',...
			'set(heltxt,''string'',num2str(naxel));',...
			]);
	
	uicontrol(hedtgfig,'style','text',...
		'units','normal',...
		'pos',[0.33 0.73 0.03 0.03],...
		'string','0');

	uicontrol(hedtgfig,'style','text',...
		'units','normal',...
		'pos',[0.55 0.73 0.03 0.03],...
		'string','90');

	uicontrol(hedtgfig,'style','text',...
		'units','normal',...
		'pos',[0.38 0.73 0.10 0.03],...
		'string','Elevation');

heltxt = uicontrol(hedtgfig,'style','edit',...
		'units','normal',...
		'pos',[0.48 0.73 0.05 0.03],...
		'string',num2str(naxel),...
		'callback',['naxel = floor(str2num(get(heltxt,''string'')));',...
			'set(helslid,''value'',naxel);',...
			]);
%
% Define Azimuth Slider
%

%hazslid = uicontrol(hedtgfig,'style','slider',...
%		'units','normal',...
%		'pos',[0.60 0.76 0.25 0.02],...
%		'max',360,...
%		'min',0,...
%		'value',naxaz,...
%		'callback',['naxaz = floor(get(hazslid,''value''));',...
%			'set(haztxt,''string'',num2str(naxaz));',...
%			'view(naxaz,naxel)']);
	
%	uicontrol(hedtgfig,'style','text',...
%		'units','normal',...
%		'pos',[0.60 0.73 0.03 0.03],...
%		'string','0');

%	uicontrol(hedtgfig,'style','text',...
%		'units','normal',...
%		'pos',[0.81 0.73 0.04 0.03],...
%		'string','360');

%	uicontrol(hedtgfig,'style','text',...
%		'units','normal',...
%		'pos',[0.65 0.73 0.10 0.03],...
%		'string','Azimuth');

%hhaztxt = uicontrol(hedtgfig,'style','edit',...
%		'units','normal',...
%		'pos',[0.75 0.73 0.05 0.03],...
%		'string',num2str(naxaz),...
%		'callback',['naxaz = floor(str2num(get(haztxt,''string'')));',...
%			'set(hazslid,''value'',naxaz);',...
%			]);
%
%  Fast edit
%
	uicontrol(hedtgfig,'style','push', ...
	'units','normal',...
	'pos',[.87 .73 .12 .05],...
        'string','Fast Edit',...
	'callback','fastedit');
