Linuxpops  3.01.04
Spectral Anaysis Package for Single Dish Data
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
region_cmd.c
Go to the documentation of this file.
1 /*
2 Copyright 2021 Arizona Board of Regents on behalf of the University of Arizona.
3 
4 For commercial uses, to obtain a license to sell and or sublicense copies of
5 the Software please contact the University of Arizona at Tech Launch Arizona:
6 lewish@tla.arizona.edu.
7 
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction for non-commercial use educational and
11 research purposes, including without limitation the rights to use, copy,
12 modify, merge, publish, distribute, and to permit persons to whom the Software
13 is furnished to do so, subject to the following conditions:
14 
15 The entire above copyright notice and this permission notice shall be included
16 in all copies or substantial portions of the Software.
17 
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 SOFTWARE.
25 
26 1. Additional Required Provisions
27 
28 1.1. Arbitration. The parties agree that if a dispute arises between them
29 concerning this Agreement, the parties may be required to submit the matter to
30 arbitration pursuant to Arizona law.
31 
32 1.2. Applicable Law and Venue. This Agreement shall be interpreted pursuant
33 to the laws of the State of Arizona. Any arbitration or litigation between the
34 Parties shall be conducted in Pima County, ARIZONA, and LICENSEE hereby
35 submits to venue and jurisdiction in Pima County, ARIZONA.
36 
37 1.3. Non-Discrimination. The Parties agree to be bound by state and federal
38 laws and regulations governing equal opportunity and non-discrimination and
39 immigration.
40 
41 1.4. Appropriation of Funds. The Parties recognize that performance by
42 ARIZONA may depend upon appropriation of funds by the State Legislature of
43 ARIZONA. If the Legislature fails to appropriate the necessary funds, or if
44 ARIZONA’S appropriation is reduced during the fiscal year, ARIZONA may cancel
45 this Agreement without further duty or obligation. ARIZONA will notify
46 LICENSEE as soon as reasonably possible after it knows of the loss of funds.
47 
48 1.5. Conflict of Interest. This Agreement is subject to the provisions of
49 A.R.S. 38-511 and other conflict of interest regulations. Within three years
50 of the EFFECTIVE DATE, ARIZONA may cancel this Agreement if any person
51 significantly involved in initiating, negotiating, drafting, securing, or
52 creating this Agreement for or on behalf of ARIZONA becomes an employee or
53 consultant in any capacity of LICENSEE with respect to the subject matter of
54 this Agreement.
55 
56  */
57 
58 #include "extern.h"
59 
61 
62 char region_fname[256];
63 
64 int regionCmd()
65 {
66  char tbuf[256], dbuf[256];
67  char results[256], input[256];
68 
69  if(isSet(PF_L_FLAG)) /* List */
70  {
71  listRegions();
72 
73  to_dataserv("otfregionlist");
74 
75  return(0);
76  }
77 
78  if(isSet(PF_E_FLAG)) /* Erase */
79  {
80  remRegions();
81 
82  to_dataserv("otfregiondelete");
83 
84  return(0);
85  }
86 
87  if(isSet(PF_R_FLAG)) /* Read */
88  {
89  if(env->otf_size_factor == 0.0)
90  {
91  env->otf_size_factor = 1.0;
92  }
93 
94  if(args->ntokens > 1) /* Use passed fname */
95  {
96  strcpy(region_fname, args->secondArg);
97  }
98  else /* Else select it */
99  {
100  bzero(results, sizeof(results));
101 
102  sprintf(input, "--file-selection --title='Select a Region File' --file-filter='*.reg' --filename='.' 2> /dev/null");
103 
104  doZenity(input, results);
105 
106  if(strlen(results))
107  {
108  st_report("doZenity() returned: '%s'", results);
109  strcmprs(results);
110  st_report("doZenity() After strcmprs: '%s'", results);
111 
112  strcpy(region_fname, results);
113  }
114  else
115  {
116  return(0);
117  }
118  }
119 
120  if(strlen(region_fname) > 2)
121  {
122 
123  sprintf(tbuf, "%s %f", region_fname, env->otf_size_factor);
124 
125  do_loadRegion(tbuf);
126 
127  if(isSet(PF_D_FLAG))
128  {
129  sprintf(dbuf, "otfregionload %s %f 0", region_fname, env->otf_size_factor);
130  to_dataserv(dbuf);
131  }
132 
133  if(isSet(PF_A_FLAG))
134  {
135 
136  st_report("Auto Setting map extents to: RA: %f, Dec: %f, Map Width: %f, Map_Height: %f",
138 
139  if(region_ra != 0.0)
140  {
142  }
143 
144  if(region_dec != 0.0)
145  {
147  }
148 
149  if(region_rsize != 0.0)
150  {
152  }
153 
154  if(region_dsize != 0.0)
155  {
157  }
158  }
159 
160  return(0);
161  }
162  else
163  {
165  return(1);
166  }
167  }
168 
170 
171  return(0);
172 }
char * strcmprs(char *str)
struct RESULTS results[MAX_BKNDS][MAX_BKNDS]
Definition: beam.c:81
struct PARSE_STACK * args
Definition: parse.h:196
Definition: parse.h:8
double otf_map_ysize
Definition: env.h:239
char region_fname[256]
Definition: region_cmd.c:62
int printH_FlagHelp(char *cmd)
Definition: help.c:430
double region_rsize
Definition: region_cmd.c:60
double region_dsize
Definition: region_cmd.c:60
struct ENVIRONMENT * env
Definition: linuxpops.c:71
int isSet(int flag)
Definition: parse.c:646
int doZenity(char *cmd, char *rst)
Definition: io.c:86
double region_dec
Definition: region_cmd.c:60
int do_loadRegion(char *buf)
Definition: region.c:354
int remRegions(void)
Definition: region.c:180
int regionCmd(void)
Definition: region_cmd.c:64
double otf_map_xsize
Definition: env.h:238
double otf_map_ra
Definition: env.h:236
void st_report()
int listRegions(void)
Definition: region.c:208
double otf_size_factor
Definition: env.h:242
double otf_map_dec
Definition: env.h:237
char * secondArg
Definition: parse.h:181
int ntokens
Definition: parse.h:173
char * firstArg
Definition: parse.h:180
double region_ra
Definition: region_cmd.c:60
int to_dataserv(char *buf)
Definition: otf.c:82