//******************************************************************* // File: spzones.cpp // Author: Jeff Ruby // Agency: U.S. Army Topographic Engineering Center // Last Modified: 1/11/95 // // This is the source file that is used to create the menus // for getting the appropriate state plane zone. It uses // boxes.cpp to create the scroll windows. //******************************************************************* #include #include #include #include "corpsgui.h" #include "spzones.h" //******************************************************************* // This procedure is the start point for the menus. // Datum toggles between 27 & 83, zone holds the zone number, // and menus holds current active line in the current menu. //******************************************************************* short GetSPZone(short datum,int *zone,short *menus) { int tmpzone=0; tmpzone = GetState(datum,menus); if(tmpzone) *zone = tmpzone; else return 0; return 1; } //******************************************************************* // This procedure is used to build the window to select // the state. //******************************************************************* short GetState(short datum,short *menus) { int numelems=0; int opt=1,zone=0; short choice=0; char title[20] = {""}; char stuff[][80] = {"Alabama ", "Arizona ", "Arkansas ", "California ", "Colorado ", "Connecticut ", "Delaware ", "Florida ", "Georgia ", "Idaho ", "Illinois ", "Indiana ", "Iowa ", "Kansas ", "Kentucky ", "Louisiana ", "Maine ", "Maryland ", "Massachusetts ", "Michigan ", "Minnesota ", "Mississippi ", "Missouri ", "Montana ", "Nebraska ", "Nevada ", "New Hampshire ", "New Jersey ", "New Mexico ", "New York ", "North Carolina ", "North Dakota ", "Ohio ", "Oklahoma ", "Oregon ", "Pennsylvania ", "Rhode Island ", "South Carolina ", "South Dakota ", "Tennessee ", "Texas ", "Utah ", "Vermont ", "Virginia ", "Washington ", "West Virginia ", "Wisconsin ", "Wyoming ", "Alaska ", "Hawaii ", "Puerto Rico ", "Virgin Islands ", "St. Croix "}; numelems = sizeof(stuff)/sizeof(stuff[0]); if(datum) strcpy(title," SP NAD 27 "); else{ numelems--; strcpy(title," SP NAD 83 "); } do { choice = BuildScroll(SPCOL,SPROW,10,title, SPBACK,SPTEXT,SPBORDER,SPTITLE,SPMODBACK,SPMODTEXT, stuff[0],numelems,sizeof(stuff[0]),menus[0]); switch(choice) { case 0: return 0; case 1: opt = BuildEW(101,stuff[choice-1],menus); //AL zone = 100 + opt; break; case 2: opt = BuildECW(201,stuff[choice-1],menus); //AZ zone = 200 + opt; break; case 3: opt = BuildNS(301,stuff[choice-1],menus); //AR zone = 300 + opt; break; case 4: if(datum) opt = California27(menus); //CA else opt = California83(menus); zone = 400 + opt; break; case 5: opt = BuildNCS(501,stuff[choice-1],menus); //CO zone = 500 + opt; break; case 6: zone = 600; //CT break; case 7: zone = 700; //DE break; case 8: opt = Florida(menus); //FL zone = 900 + opt; break; case 9: opt = BuildEW(1001,stuff[choice-1],menus); //GA zone = 1000 + opt; break; case 10: opt = BuildECW(1101,stuff[choice-1],menus); //ID zone = 1100 + opt; break; case 11: opt = BuildEW(1201,stuff[choice-1],menus); //IL zone = 1200 + opt; break; case 12: opt = BuildEW(1301,stuff[choice-1],menus); //IN zone = 1300 + opt; break; case 13: opt = BuildNS(1401,stuff[choice-1],menus); //IA zone = 1400 + opt; break; case 14: opt = BuildNS(1501,stuff[choice-1],menus); //KS zone = 1500 + opt; break; case 15: opt = BuildNS(1601,stuff[choice-1],menus); //KY zone = 1600 + opt; break; case 16: opt = Louisiana(menus); //LA zone = 1700 + opt; break; case 17: opt = BuildEW(1801,stuff[choice-1],menus); //ME zone = 1800 + opt; break; case 18: zone = 1900; //MD break; case 19: opt = Massachusetts(menus); //MA zone = 2000 + opt; break; case 20: if(datum) opt = Michigan27(menus); //MI else opt = BuildNCS(2111,stuff[choice-1],menus); zone = 2110 + opt; break; case 21: opt = BuildNCS(2201,stuff[choice-1],menus); //MN zone = 2200 + opt; break; case 22: opt = BuildEW(2301,stuff[choice-1],menus); //MS zone = 2300 + opt; break; case 23: opt = BuildECW(2401,stuff[choice-1],menus); //MO zone = 2400 + opt; break; case 24: zone = 2500; //NE if(datum){ opt = BuildNCS(2501,stuff[choice-1],menus); zone += opt; } break; case 25: zone = 2600; //MT if(datum){ opt = BuildNS(2601,stuff[choice-1],menus); zone += opt; } break; case 26: opt = BuildECW(2701,stuff[choice-1],menus); //NV zone = 2700 + opt; break; case 27: zone = 2800; //NH break; case 28: zone = 2900; //NJ break; case 29: opt = BuildECW(3001,stuff[choice-1],menus); //NM zone = 3000 + opt; break; case 30: opt = NewYork(menus); //NY zone = 3100 + opt; break; case 31: zone = 3200; //NC break; case 32: opt = BuildNS(3301,stuff[choice-1],menus); //ND zone = 3300 + opt; break; case 33: opt = BuildNS(3401,stuff[choice-1],menus); //OH zone = 3400 + opt; break; case 34: opt = BuildNS(3501,stuff[choice-1],menus); //OK zone = 3500 + opt; break; case 35: opt = BuildNS(3601,stuff[choice-1],menus); //OR zone = 3600 + opt; break; case 36: opt = BuildNS(3701,stuff[choice-1],menus); //PA zone = 3700 + opt; break; case 37: zone = 3800; //RI break; case 38: zone = 3900; //SC if(datum){ opt = BuildNS(3901,stuff[choice-1],menus); zone += opt; } break; case 39: opt = BuildNS(4001,stuff[choice-1],menus); //SD zone = 4000 + opt; break; case 40: zone = 4100; //TN break; case 41: opt = Texas(menus); //TX zone = 4200 + opt; break; case 42: opt = BuildNCS(4301,stuff[choice-1],menus); //UT zone = 4300 + opt; break; case 43: zone = 4400; //VT break; case 44: opt = BuildNS(4501,stuff[choice-1],menus); //VA zone = 4500 + opt; break; case 45: opt = BuildNS(4601,stuff[choice-1],menus); //WA zone = 4600 + opt; break; case 46: opt = BuildNS(4701,stuff[choice-1],menus); //WV zone = 4700 + opt; break; case 47: opt = BuildNCS(4801,stuff[choice-1],menus); //WI zone = 4800 + opt; break; case 48: if(datum) opt = Wyoming27(menus); //WY else opt = Wyoming83(menus); zone = 4900 + opt; break; case 49: opt = Alaska(menus); //AK zone = 5000 + opt; break; case 50: opt = Hawaii(menus); //HI zone = 5100 + opt; break; case 51: //PR case 52: zone = datum ? 5201:5200; //VI break; case 53: return 5202; // St. Croix default: break; } menus[0] = choice-1; if(opt) return zone; else opt = 1; }while(choice); return 0; } //******************************************************************* // This procedure is used to build the window to select // a zone where the state is divided into East and West // sections. //******************************************************************* short BuildEW(int base, char *state, short *menus) { short i=0; short choice=0; char stuff[][80] = {"East","West"}; char stmp[80] = {""}; for(i=0;i<2;i++) { strcpy(stmp,stuff[i]); sprintf(stuff[i]," %4.4d %s%s",base+i,state,stmp); } choice = BuildScroll(SPCOL,SPROW,25,state, SPBACK,SPTEXT,SPBORDER,SPTITLE,SPMODBACK,SPMODTEXT, stuff[0],sizeof(stuff)/sizeof(stuff[0]), sizeof(stuff[0]),menus[2]); if(choice) menus[2] = choice; return choice; } //******************************************************************* // This procedure is used to build the window to select // a zone where the state is divided into North and South // sections. //******************************************************************* short BuildNS(int base, char *state,short *menus) { short i=0; short choice=0; char stuff[][80] = {"North","South"}; char stmp[80] = {""}; for(i=0;i<2;i++) { strcpy(stmp,stuff[i]); sprintf(stuff[i]," %4.4d %s%s",base+i,state,stmp); } choice = BuildScroll(SPCOL,SPROW,25,state, SPBACK,SPTEXT,SPBORDER,SPTITLE,SPMODBACK,SPMODTEXT, stuff[0],sizeof(stuff)/sizeof(stuff[0]), sizeof(stuff[0]),menus[2]); if(choice) menus[2] = choice; return choice; } //******************************************************************* // This procedure is used to build the window to select // a zone where the state is divided into East, Central and West // sections. //******************************************************************* short BuildECW(int base, char *state,short *menus) { short i=0; short choice=0; char stuff[][80] = {"East","Central","West"}; char stmp[80] = {""}; for(i=0;i<3;i++) { strcpy(stmp,stuff[i]); sprintf(stuff[i]," %4.4d %s%s",base+i,state,stmp); } choice = BuildScroll(SPCOL,SPROW,25,state, SPBACK,SPTEXT,SPBORDER,SPTITLE,SPMODBACK,SPMODTEXT, stuff[0],sizeof(stuff)/sizeof(stuff[0]), sizeof(stuff[0]),menus[2]); if(choice) menus[2] = choice; return choice; } //******************************************************************* // This procedure is used to build the window to select // a zone where the state is divided into North, Central, and // South sections. //******************************************************************* short BuildNCS(int base, char *state,short *menus) { short i=0; short choice=0; char stuff[][80] = {"North","Central","South"}; char stmp[80] = {""}; for(i=0;i<3;i++) { strcpy(stmp,stuff[i]); sprintf(stuff[i]," %4.4d %s%s",base+i,state,stmp); } choice = BuildScroll(SPCOL,SPROW,25,state, SPBACK,SPTEXT,SPBORDER,SPTITLE,SPMODBACK,SPMODTEXT, stuff[0],sizeof(stuff)/sizeof(stuff[0]), sizeof(stuff[0]),menus[2]); if(choice) menus[2] = choice; return choice; } //******************************************************************* // Below are menus for special states which do not fit into // the above categories. //******************************************************************* short Massachusetts(short *menus) { short choice=0; char stuff[][80] = {" 2001 Massachusetts Mainland", " 2002 Massachusetts Island"}; choice = BuildScroll(SPCOL,SPROW,20," Massachusettes ", SPBACK,SPTEXT,SPBORDER,SPTITLE,SPMODBACK,SPMODTEXT, stuff[0],sizeof(stuff)/sizeof(stuff[0]), sizeof(stuff[0]),menus[2]); if(choice) menus[2] = choice; return choice; } short NewYork(short *menus) { short choice=0; char stuff[][80] = {" 3101 New York East", " 3102 New York Central", " 3103 New York West", " 3104 New York Long Island"}; choice = BuildScroll(SPCOL,SPROW,25," New York ", SPBACK,SPTEXT,SPBORDER,SPTITLE,SPMODBACK,SPMODTEXT, stuff[0],sizeof(stuff)/sizeof(stuff[0]), sizeof(stuff[0]),menus[2]); if(choice) menus[2] = choice; return choice; } short Florida(short *menus) { short choice=0; char stuff[][80] = {" 0901 Florida East ", " 0902 Florida West ", " 0903 Florida North "}; choice = BuildScroll(SPCOL,SPROW,25," Florida ", SPBACK,SPTEXT,SPBORDER,SPTITLE,SPMODBACK,SPMODTEXT, stuff[0],sizeof(stuff)/sizeof(stuff[0]), sizeof(stuff[0]),menus[2]); if(choice) menus[2] = choice; return choice; } short Michigan27(short *menus) { short opt; char stuff[][80] = {" 2101 Michigan East ", " 2102 Michigan Central TM", " 2103 Michigan West ", " 2111 Michigan North ", " 2112 Michigan Central LAM", " 2113 Michigan South"}; opt = BuildScroll(SPCOL,SPROW,25," Michigan ", SPBACK,SPTEXT,SPBORDER,SPTITLE,SPMODBACK,SPMODTEXT, stuff[0],sizeof(stuff)/sizeof(stuff[0]), sizeof(stuff[0]),menus[2]); if(opt) menus[2] = opt; if(opt>3) opt -= 3; else if(opt) opt-=10; return opt; } short Louisiana(short *menus) { short choice=0; char stuff[][80] = {" 1701 Louisiana North ", " 1702 Louisiana South ", " 1703 Louisiana Offshore "}; choice = BuildScroll(SPCOL,SPROW,25," Louisiana ", SPBACK,SPTEXT,SPBORDER,SPTITLE,SPMODBACK,SPMODTEXT, stuff[0],sizeof(stuff)/sizeof(stuff[0]), sizeof(stuff[0]),menus[2]); if(choice) menus[2] = choice; return choice; } short Texas(short *menus) { short choice=0; char stuff[][80] = {" 4201 Texas North ", " 4202 Texas North Central ", " 4203 Texas Central ", " 4204 Texas South Central", " 4205 Texas South "}; choice = BuildScroll(SPCOL,SPROW,25," Texas ", SPBACK,SPTEXT,SPBORDER,SPTITLE,SPMODBACK,SPMODTEXT, stuff[0],sizeof(stuff)/sizeof(stuff[0]), sizeof(stuff[0]),menus[2]); if(choice) menus[2] = choice; return choice; } short Alaska(short *menus) { short choice=0; char stuff[][80] = {" 5001 Alaska Zone 1 ", " 5002 Alaska Zone 2 ", " 5003 Alaska Zone 3 ", " 5004 Alaska Zone 4 ", " 5005 Alaska Zone 5 ", " 5006 Alaska Zone 6 ", " 5007 Alaska Zone 7 ", " 5008 Alaska Zone 8 ", " 5009 Alaska Zone 9 ", " 5010 Alaska Zone 10 "}; choice = BuildScroll(SPCOL,SPROW,25," Alaska ", SPBACK,SPTEXT,SPBORDER,SPTITLE,SPMODBACK,SPMODTEXT, stuff[0],sizeof(stuff)/sizeof(stuff[0]), sizeof(stuff[0]),menus[2]); if(choice) menus[2] = choice; return choice; } short Wyoming27(short *menus) { short choice=0; char stuff[][80] = {" 4901 Wyoming Zone 1 ", " 4902 Wyoming Zone 2 ", " 4903 Wyoming Zone 3 ", " 4904 Wyoming Zone 4 "}; choice = BuildScroll(SPCOL,SPROW,25," Wyoming ", SPBACK,SPTEXT,SPBORDER,SPTITLE,SPMODBACK,SPMODTEXT, stuff[0],sizeof(stuff)/sizeof(stuff[0]), sizeof(stuff[0]),menus[2]); if(choice) menus[2] = choice; return choice; } short Wyoming83(short *menus) { short choice=0; char stuff[][80] = {" 4901 Wyoming East ", " 4902 Wyoming East Central ", " 4903 Wyoming West Central ", " 4904 Wyoming West "}; choice = BuildScroll(SPCOL,SPROW,25," Wyoming ", SPBACK,SPTEXT,SPBORDER,SPTITLE,SPMODBACK,SPMODTEXT, stuff[0],sizeof(stuff)/sizeof(stuff[0]), sizeof(stuff[0]),menus[2]); if(choice) menus[2] = choice; return choice; } short California27(short *menus) { short choice=0; char stuff[][80] = {" 0401 California Zone 1", " 0402 California Zone 2", " 0403 California Zone 3", " 0404 California Zone 4", " 0405 California Zone 5", " 0406 California Zone 6", " 0407 California Zone 7"}; choice = BuildScroll(SPCOL,SPROW,25," California ", SPBACK,SPTEXT,SPBORDER,SPTITLE,SPMODBACK,SPMODTEXT, stuff[0],sizeof(stuff)/sizeof(stuff[0]), sizeof(stuff[0]),menus[2]); if(choice) menus[2] = choice; return choice; } short California83(short *menus) { short choice=0; char stuff[][80] = {" 0401 California Zone 1", " 0402 California Zone 2", " 0403 California Zone 3", " 0404 California Zone 4", " 0405 California Zone 5", " 0406 California Zone 6"}; choice = BuildScroll(SPCOL,SPROW,25," California ", SPBACK,SPTEXT,SPBORDER,SPTITLE,SPMODBACK,SPMODTEXT, stuff[0],sizeof(stuff)/sizeof(stuff[0]), sizeof(stuff[0]),menus[2]); if(choice) menus[2] = choice; return choice; } short Hawaii(short *menus) { short choice=0; char stuff[][80] = {" 5101 Hawaii Zone 1 ", " 5102 Hawaii Zone 2 ", " 5103 Hawaii Zone 3 ", " 5104 Hawaii Zone 4 ", " 5105 Hawaii Zone 5 "}; choice = BuildScroll(SPCOL,SPROW,25," Hawaii ", SPBACK,SPTEXT,SPBORDER,SPTITLE,SPMODBACK,SPMODTEXT, stuff[0],sizeof(stuff)/sizeof(stuff[0]), sizeof(stuff[0]),menus[2]); if(choice) menus[2] = choice; return choice; }