Example #1
0
Subgroup& Subgroup::deleteGenerator( const Word& w ) {
  VectorOf<Word> theGenerators = look()->theGenerators;
  int i = theGenerators.indexOf(w);
  if ( i == -1 )
	 error("attempt to delete nonexistent word in Subgroup::deleteGenerator");
  else {
	 int len = theGenerators.length();
	 VectorOf<Word> temp(len - 1);
	 int k = 0;
	 for( int j = 0; j < len; ++j )
		if ( j != i ) temp[k++] = theGenerators[j];
	 change()->theGenerators = temp;
	 
	 enhance()->theOrder = -1;
	 // @stc not yet correct: the order does not necessarily become unknown
	 return *this;
  }
}
Example #2
0
int main(int argc, char **argv) {
	float lm, hm;
	int ID;
	float x1, y1, x2, y2;
	char ch;
	char filename[1024];
	int enhanceid = -1;
	int sectionmode = LON;
	int histmode = DEP;
	float binw = 10.0;

	reset(&mainset);
	load(&mainset);

	rangeadjust(&control, &mainset, NULL, NULL, NULL, NULL);

	ID = cpgopen("/xwindow");
	resizemax(0.85);
	cpgask(0);

	/*
	 * This a bug-fix for the gmt command that outputs the borders wrapped.
	 */
	int i;
	for(i=0; i < nborders; i++)
		if (borders[i][0] != -999 && borders[i][0] > 180)
			borders[i][0] = borders[i][0] - 360.0;

	lm = hm = -1.0;
	while (ch != 'Q') {
		if (control.printout) {
			lerchar("Entre com o nome do arquivo", filename, 1000);
			if (strlen(filename) == 0) {
				strcpy(message, "Nome invalido.");
				alert(ERROR);
				control.printout = 0;
			} else {
				if (strlen(filename) < 3 || strncasecmp( &filename[strlen(filename)-3], ".ps", 3) != 0) {
					sprintf(filename,"%s.ps/cps",filename);
				} else {
					sprintf(filename,"%s/cps",filename);
				}
				cpgopen(filename);
				cpgask(0);
			}
		}

		plot(&control, &mainset);

		if (control.printout == 0 && enhanceid != -1) {
			enhanceid = enhance(&control, &mainset, enhanceid);
		}

		if (mainset.region) {
			plotsection(&mainset, &control, sectionmode);
			plothistogram(&mainset, binw, histmode, lm, hm);
		}

		if (control.printout) {
			cpgclos();
			cpgslct(ID);
			control.printout = 0;

			filename[strlen(filename) - 4] = '\0';
			sprintf(message, "Print Out saved to file %s", filename);
			alert(INFO);

			continue;
		}

		// Restore default map position
		cpgsvp(0.07, 0.93, 0.35, 0.9);
		cpgswin(control.xmin, control.xmax, control.ymin, control.ymax);
		ch = getonechar(&x1, &y1, 0);
		switch(ch) {
		case('='): {
			control.printout = 1;
			break;
		}
		case('R'): {
			reset(&mainset);
			load(&mainset);
			break;
		}

		case('B'): {
			binw = lerfloat("Entre com o valor da largura do bin?");
			break;
		}

		case('A'): {
			enhanceid = findpt(&mainset, x1, y1);
			break;
		}

		case('2'): {
			control.hasplates = (control.hasplates == 1) ? 0 : 1;
			break;
		}

		case('1'): {
			control.hascontinents++;
			if (control.hascontinents > 2) control.hascontinents = 0;
			break;
		}

		case ('W'): {
			control.xmax = 180;
			control.xmin = -180;
			control.ymax = 90;
			control.ymin = -90;
			break;
		}

		case('0'): {
			mainset.lon1 = -180;
			mainset.lon2 = 180;
			mainset.lat1 = -90;
			mainset.lat2 = 90;
			load(&mainset);
			mainset.region = 0;
			break;
		}

		case ('L'): {
			sectionmode = (sectionmode == LAT) ? LON : LAT;
			break;
		}

		case ('H'): {
			histmode = (histmode == MAG) ? DEP : MAG;
			binw = (histmode == MAG) ? 0.1 : 10.0;
			break;
		}

		case ('S'): {
			x2 = x1;
			y2 = y1;
			getonechar(&x2, &y2, 1);
			order(&x1,&x2);
			order(&y1,&y2);
			mainset.lon1 = x1;
			mainset.lon2 = x2;
			mainset.lat1 = y1;
			mainset.lat2 = y2;
			load(&mainset);
			mainset.region = 1;
			break;
		}

		case('X'): { // ZOOM
			x2 = x1;
			y2 = y1;
			getonechar(&x2, &y2, 1);
			order(&x1,&x2);
			order(&y1,&y2);
			rangeadjust(&control, &mainset, &x1, &x2, &y1, &y2);
			break;
		}

		case('C'): { // Color mode
			control.colormode ++;
			if (control.colormode>COLORMAG) control.colormode = COLORNONE;
			break;
		}

		case('N'): { /* Ano */
			int y1, y2;
			y1 = lerint("Entre com ano inicial?");
			y2 = lerint("Entre com ano final?");
			orderint(&y1,&y2);
			mainset.y1 = y1;
			mainset.y2 = y2;
			load(&mainset);
			break;
		}

		case('M'): { /* Magnitude */
			float m1, m2;
			m1 = lerfloat("Entre com a Magnitude Inicial?");
			m2 = lerfloat("Entre com a Magnitude Final?");
			order(&m1,&m2);
			mainset.m1 = m1;
			mainset.m2 = m2;
			load(&mainset);
			break;
		}

		case('J'): { /* Ajuste */
			lm = lerfloat("Entre com o menor valor de mag. para ajuste.");
			hm = lerfloat("Entre com o maior valor de mag. para ajuste.");
			if (lm == hm) {
				lm = hm = -1;
			}
			break;
		}
		case('P'): { /* Profundidade */
			float d1, d2;
			d1 = lerfloat("Entre com a Profundidade Minima?");
			d2 = lerfloat("Entre com a Profundidade Maxima?");
			order(&d1,&d2);
			mainset.d1 = d1;
			mainset.d2 = d2;
			load(&mainset);
			break;
		}

		}
	}

	cpgclos();
}
Example #3
0
Subgroup& Subgroup::addGenerator( const Word& w ) {
  change()->theGenerators.append(w);
  enhance()->theOrder = -1;
  // @stc not yet correct: the order does not necessarily become unknown
  return *this;
}