⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selectwindow.cc

📁 模糊聚类分析的源程序!
💻 CC
📖 第 1 页 / 共 3 页
字号:
			     "K",			     "100",			     1.0, 100, clusterinfo->K, 0);			       Mselect->SetValue (clusterinfo->M);  Kselect->SetValue (clusterinfo->K);*/  if (clusterinfo->dataset != NULL)    if (clusterinfo->dataset->Lese_Daten_Typ () == Klassifiziert) {      exactnessselect =	new IntegerSelectWindow (display,				 gc,				 this,				 fontstruct,				 0, 0,				 "exactness",				 "100",				 0, 100, clusterinfo->exactness, 0);      exactnessselect->SetValue (clusterinfo->exactness);    }  intselectypos = SELECTWINDOW_BORDERBESIDETEXT;  clusternumberselect->PlaceMe (width - clusternumberselect->Getwidth () - SELECTWINDOW_INSIDESPACE, intselectypos);  intselectypos = clusternumberselect->Gety () +    clusternumberselect->Getheight () +    SELECTWINDOW_INSIDESPACE;  repeatnumberselect->PlaceMe (width - repeatnumberselect->Getwidth () - SELECTWINDOW_INSIDESPACE, intselectypos);  intselectypos = repeatnumberselect->Gety () +    repeatnumberselect->Getheight () +    SELECTWINDOW_INSIDESPACE;  //+  Mselect->PlaceMe (width - Mselect->Getwidth () - SELECTWINDOW_INSIDESPACE, intselectypos);  //+  Kselect->PlaceMe (Mselect->Getx () - Kselect->Getwidth () - SELECTWINDOW_INSIDESPACE, intselectypos);  //+ rightheight = Kselect->Gety () + Kselect->Getheight () + SELECTWINDOW_INSIDESPACE;  rightheight =SELECTWINDOW_INSIDESPACE;  if (exactnessselect != NULL) {/* //+    intselectypos = Mselect->Gety () +      Mselect->Getheight () +      SELECTWINDOW_INSIDESPACE;*/intselectypos = repeatnumberselect->Gety()+repeatnumberselect->Getheight()+                SELECTWINDOW_INSIDESPACE;    exactnessselect->PlaceMe (width - exactnessselect->Getwidth () - SELECTWINDOW_INSIDESPACE, intselectypos);    rightheight = exactnessselect->Gety () +      exactnessselect->Getheight () + SELECTWINDOW_INSIDESPACE;  }// now the left elements  clusterselectwidth = width - clusternumberselect->Getwidth () - 2 * SELECTWINDOW_BORDERBESIDETEXT;  clusterselectheight = 60;  for (counter = 0; counter < CLUSTERTYPNUMBER; counter++) {    if ((unsigned short) clusterinfo->clustertyp == Infos[counter].info)      Infos[counter].options |= TEXTOPTION_SELECTED;    else      Infos[counter].options &= ~TEXTOPTION_SELECTED;  }  clusterselectwindow    = new SelectWindow (display,			gc,			this,			fontstruct,			SELECTWINDOW_BORDERBESIDETEXT,			SELECTWINDOW_BORDERBESIDETEXT,			clusterselectwidth, clusterselectheight,			Infos,			CLUSTERTYPNUMBER, CHANGESELECTED_ACTION, 0,			SELECTWINDOWOPTION_EXCLUSIVESELECTION);  leftheight = clusterselectwindow->Gety () +    clusterselectwindow->Getheight () +    SELECTWINDOW_INSIDESPACE;  for (counter = 0; counter < VALIDYTYPNUMBER; counter++) {    if ((unsigned short) clusterinfo->validitytyp == ValidityInfos[counter].info)      ValidityInfos[counter].options |= TEXTOPTION_SELECTED;    else      ValidityInfos[counter].options &= ~TEXTOPTION_SELECTED;  }  ValidityInfos[counter - 1].options &= ~TEXTOPTION_SELECTABLE;  if (exactnessselect != NULL)    ValidityInfos[counter - 1].options |= TEXTOPTION_SELECTABLE;  validityselectwindow    = new SelectWindow (display,			gc,			this,			fontstruct,			SELECTWINDOW_BORDERBESIDETEXT,			leftheight,			clusterselectwidth, clusterselectheight,			ValidityInfos,			VALIDYTYPNUMBER,			CHANGESELECTED_ACTION, 0,			SELECTWINDOWOPTION_EXCLUSIVESELECTION);  leftheight = validityselectwindow->Gety () +    validityselectwindow->Getheight () +    SELECTWINDOW_INSIDESPACE;  if (clusterinfo->dataset != NULL) {    datainfo = (SelectWindowInfo *) malloc (sizeof (SelectWindowInfo) * clusterinfo->dataset->Lese_DatenDim ());    for (counter = 0; counter < clusterinfo->dataset->Lese_DatenDim (); counter++) {      datainfo[counter].Selecttext = clusterinfo->dataset->Lese_Name_Pointer (counter);      datainfo[counter].options = TEXTOPTION_SELECTABLE;      if (clusterinfo->bvector->Lese_i (counter))	datainfo[counter].options |= TEXTOPTION_SELECTED;      datainfo[counter].info = counter;    }    dataselectwindow      = new SelectWindow (display,			  gc,			  this,			  fontstruct,			  SELECTWINDOW_BORDERBESIDETEXT,			  leftheight,			  clusterselectwidth, clusterselectheight,			  datainfo,			  clusterinfo->dataset->Lese_DatenDim (),			  CHANGESELECTED_ACTION, 0, 0);    leftheight += dataselectwindow->Getheight () +      SELECTWINDOW_INSIDESPACE;  }  possilighticon = new OnOffIcon (display,				  gc,				  this,				  fontstruct,				  SELECTWINDOW_BORDERBESIDETEXT,				  leftheight,				  DEFAULTLIGHTSIZE, DEFAULTLIGHTSIZE,				  NULL, NULL, 0, 0,				  0,				  ICON_SELECTABLE | ICON_LIGHTICON);  possilighticon->MapMe ();  if (clusterinfo->ispossib)    possilighticon->AddStatus (ICON_SELECTED);  leftheight += possilighticon->Getheight () + SELECTWINDOW_INSIDESPACE;  char *newtext;//delta_u=clusterinfo->delta_u;  newtext = (char *) malloc (sizeof (char) * DOUBLELENGTH + 2);  sprintf (newtext, "%lf", clusterinfo->delta_u);  char *delta_u_text = "delta_U:";  short textwidthtextwidth = XTextWidth (fontstruct, delta_u_text, strlen (delta_u_text));  short textwidth = XTextWidth (fontstruct, newtext, strlen (newtext)) + SELECTWINDOW_INSIDESPACE;  short textheight = fontstruct->max_bounds.ascent +  fontstruct->max_bounds.descent;  delta_u_select = new TextBox (display, gc, this, fontstruct,		     textwidthtextwidth + 2 * SELECTWINDOW_BORDERBESIDETEXT,				leftheight,				textwidth, textheight,				0, newtext, 0,				TEXTOPTION_DOUBLEINPUT | TEXTOPTION_DARK,				DELTA_U_CHANGE_ACTION, 0);  leftheight += delta_u_select->Getheight () + SELECTWINDOW_INSIDESPACE;//+ Setzen wir die M-Box neu  char *M_newtext;  M_newtext = (char *) malloc (sizeof (char) * DOUBLELENGTH + 2);  sprintf (M_newtext, "%lf", clusterinfo->M);  char *M_text = "M:";  short M_textwidthtextwidth = XTextWidth (fontstruct, M_text, strlen (M_text));  short M_textwidth = XTextWidth (fontstruct, M_newtext, strlen (M_newtext)) + SELECTWINDOW_INSIDESPACE;  short M_textheight = fontstruct->max_bounds.ascent +  fontstruct->max_bounds.descent;  M_select = new TextBox (display, gc, this, fontstruct,		     M_textwidthtextwidth + 2 * SELECTWINDOW_BORDERBESIDETEXT,				leftheight,				M_textwidth, M_textheight,				0, M_newtext, 0,				TEXTOPTION_DOUBLEINPUT | TEXTOPTION_DARK,				M_CHANGE_ACTION, 0);  leftheight += M_select->Getheight () + SELECTWINDOW_INSIDESPACE;//+ Setzen wir die K-Box neu  char *K_newtext;  K_newtext = (char *) malloc (sizeof (char) * DOUBLELENGTH + 2);  sprintf (K_newtext, "%lf", clusterinfo->K);  char *K_text = "K:";  short K_textwidthtextwidth = XTextWidth (fontstruct, K_text, strlen (K_text));  short K_textwidth = XTextWidth (fontstruct, K_newtext, strlen (K_newtext)) + SELECTWINDOW_INSIDESPACE;  short K_textheight = fontstruct->max_bounds.ascent +  fontstruct->max_bounds.descent;  K_select = new TextBox (display, gc, this, fontstruct,		     K_textwidthtextwidth + 2 * SELECTWINDOW_BORDERBESIDETEXT,				leftheight,				K_textwidth, K_textheight,				0, K_newtext, 0,				TEXTOPTION_DOUBLEINPUT | TEXTOPTION_DARK,				K_CHANGE_ACTION, 0);  leftheight += K_select->Getheight () + SELECTWINDOW_INSIDESPACE;// now the actionicons at the bottom  short actioniconypos = MAX (leftheight, rightheight);  OK = new ActionIcon (display,		       gc,		       this,		       fontstruct, 35, actioniconypos, 40, 30,		       "Ok", NULL, 0, 0, SELECTED_OK, ICON_SELECTABLE);  Cancel = new ActionIcon (display,			   gc,			   this,			   fontstruct, 105, actioniconypos, 40, 30,		    "Cancel", NULL, 0, 0, SELECTED_CANCEL, ICON_SELECTABLE);// place icons in middle  {    short freewidthhalf = (width - 3 * OK->Getwidth ()) / 2;    OK->PlaceMe (freewidthhalf, OK->Gety ());    Cancel->PlaceMe (freewidthhalf + 2 * OK->Getwidth (), OK->Gety ());  }// now resize window to fit  short depth;  SizeMe (width, OK->Gety () + OK->Getheight () + SELECTWINDOW_BORDERBESIDETEXT);  depth = DefaultDepth (display, DefaultScreen (display));  pixmap = XCreatePixmap (display, window, width, height, depth);  XSetForeground (display, gc, buttonpix);  XFillRectangle (display, pixmap, gc, 0, 0, width, height);  DrawBorder (pixmap, 0, 0, width, height, 0, 0, "", HIGH);  XSetForeground (display, gc, blackpix);  {    short possx = possilighticon->Getwidth () + possilighticon->Getx () + SELECTWINDOW_INSIDESPACE,      possy = possilighticon->Gety () + possilighticon->Getheight ();    XDrawString (display,		 pixmap,		 gc,		 possx, possy,//            possilighticon->Getwidth()+possilighticon->Getx()+SELECTWINDOW_INSIDESPACE,    //            possilighticon->Gety()+possilighticon->Getheight(), 		 possitext, strlen (possitext));    possarea_left = possx;    possarea_right = possx + XTextWidth (fontstruct, possitext, strlen (possitext));    possarea_bottom = possy;    possarea_top = possy - textheight;  }    XDrawString (display, pixmap, gc,	       SELECTWINDOW_BORDERBESIDETEXT,	       delta_u_select->Gety () + delta_u_select->Getheight () - 3,	       delta_u_text, strlen (delta_u_text));    DrawBorder (pixmap, delta_u_select->Getx () - 2, delta_u_select->Gety () - 2,    delta_u_select->Getwidth () + 2, delta_u_select->Getheight () + 2, 0, 0,	      "", LOW);  //+ f"ur M-Box  XDrawString (display, pixmap, gc,	       SELECTWINDOW_BORDERBESIDETEXT,	       + M_select->Gety () + M_select->Getheight () - 3,	       M_text, strlen (M_text));    DrawBorder (pixmap, M_select->Getx () - 2, M_select->Gety () - 2,    M_select->Getwidth () + 2, M_select->Getheight () + 2, 0, 0,	      "", LOW);  //+ f"ur K-Box  XDrawString (display, pixmap, gc,	       SELECTWINDOW_BORDERBESIDETEXT,	       + K_select->Gety () + K_select->Getheight () - 3,	       K_text, strlen (K_text));    DrawBorder (pixmap, K_select->Getx () - 2, K_select->Gety () - 2,    K_select->Getwidth () + 2, K_select->Getheight () + 2, 0, 0,	      "", LOW);	             SetSelectedInput (ExposureMask		    | EnterWindowMask		    | LeaveWindowMask		    | ButtonPressMask		    | ButtonReleaseMask);  FixMySize ();  MapMe ();  XDefineCursor (display, window, maincursor);}ClusterOptionWindow::~ClusterOptionWindow (){  UnmapMe ();  XFreePixmap (display, pixmap);  delete OK;  delete Cancel;  delete clusternumberselect;  delete repeatnumberselect;  //+  delete Mselect;  //+ delete Kselect;  if (exactnessselect != NULL)    delete exactnessselect;  delete delta_u_select;  delete M_select; //+  delete K_select; //+}void ClusterOptionWindow::Action (int Actionnumber, int value){  switch (Actionnumber) {  case DELTA_U_CHANGE_ACTION:    myclusterinfo.delta_u = *((double *) value);    break;  case M_CHANGE_ACTION: //+ M-Box    myclusterinfo.M = *((double *) value);    break;  case K_CHANGE_ACTION: //+ K-Box    myclusterinfo.K = *((double *) value);    break;  case SELECTED_OK:    myclusterinfo.repeatnumber = repeatnumberselect->GetValue ();    myclusterinfo.clusternumber = clusternumberselect->GetValue ();//+    myclusterinfo.M = Mselect->GetValue ();//+    myclusterinfo.K = Kselect->GetValue ();    if (exactnessselect != NULL)      myclusterinfo.exactness = exactnessselect->GetValue ();    myclusterinfo.validitytyp = (Guete_Typ) (validityselectwindow->GetAcuteInfo ());    myclusterinfo.clustertyp = clusterselectwindow->GetAcuteInfo ();    myclusterinfo.delta_u = MAX (MIN (myclusterinfo.delta_u, 1.0), 0.0);    myclusterinfo.M = MAX (MIN (myclusterinfo.M, 100.0), 1.0001); //+    myclusterinfo.K = MAX (MIN (myclusterinfo.K, 100.0), 1.0); //+    if (possilighticon->IsSelected ())      myclusterinfo.ispossib = 1;    else      myclusterinfo.ispossib = 0;    if (myclusterinfo.dataset != NULL)      myclusterinfo.resultbvector = *dataselectwindow->Getbvector ();    UnmapMe ();    XUnmapWindow (display, window);    Parent->Action (actionnumber, (int) &myclusterinfo);#if 0    /* XXX: would you believe this ??? */    delete this;#endif    break;  case SELECTED_CANCEL:    UnmapMe ();    Parent->Action (actionnumber, (int) NULL);#if 0    /* XXX: would you believe this ??? */    delete this;#endif    break;  }}void ClusterOptionWindow::HandleEvent (XEvent * Event){  switch (Event->type) {  case Expose:    XCopyArea (display, pixmap, window, gc,	       Event->xgraphicsexpose.x, Event->xgraphicsexpose.y,	       Event->xgraphicsexpose.width, Event->xgraphicsexpose.height,	       Event->xgraphicsexpose.x, Event->xgraphicsexpose.y);    break;  case ButtonPress:    if ((possarea_left <= Event->xbutton.x) &&	(possarea_right >= Event->xbutton.x) &&	(possarea_top <= Event->xbutton.y) &&	(possarea_bottom >= Event->xbutton.y)) {      if (possilighticon->IsSelected ())	possilighticon->UnselectMe ();      else	possilighticon->SelectMe ();    }    break;  }}RuleOptionWindow::RuleOptionWindow (Display * initdisplay,		  GC initgc,		  BigWindow * initParent,		  XFontStruct * fontstruct,		  int initx, int inity,		  char *text,		  int Actionnumber,		  RuleInfo * Ruleinfo,		  RULEOPTIONSTATUS initoption):BigWindow (initdisplay,	   initgc,	   DefaultRootWindow (initdisplay),	   fontstruct,	   initx, inity,	   200, 200,	   text,	   DEFAULT_BDWIDTH){  threshold = .01;  hillheight = DEFAULT_HUEGEL_GRENZE;  Parent = initParent;  actionnumber = Actionnumber;  ruleselectwindow = NULL;  ruleinfo = Ruleinfo;  short xpos = SELECTWINDOW_BORDERBESIDETEXT, ypos = SELECTWINDOW_BORDERBESIDETEXT,    windowwidth = 150, counter, textheight = fontstruct->max_bounds.ascent +  fontstruct->max_bounds.descent;  SelectWindowInfo *datainfo;  if (ruleinfo->dataset != NULL) {    datainfo = (SelectWindowInfo *) malloc (sizeof (SelectWindowInfo) * ruleinfo->dataset->Lese_DatenDim ());    for (counter = 0; counter < ruleinfo->dataset->Lese_DatenDim (); counter++) {      datainfo[counter].Selecttext = ruleinfo->dataset->Lese_Name_Pointer (counter);      datainfo[counter].options = TEXTOPTION_SELECTABLE;      if (ruleinfo->selecteddims->Lese_i (counter))	datainfo[counter].options |= TEXTOPTION_SELECTED;      datainfo[counter].info = counter;    }    dataselectwindow      = new SelectWindow (display,			  gc,			  this,			  fontstruct,			  xpos,			  ypos,			  windowwidth, 200,			  datainfo,			  ruleinfo->dataset->Lese_DatenDim (),			  CHANGESELECTED_ACTION, 0, 0);  }  ypos = dataselectwindow->Gety () +    dataselectwindow->Getheight () +    SELECTWINDOW_INSIDESPACE;  if (initoption == RULEOPTION) {    RuletypInfos[0].options |= TEXTOPTION_SELECTED;    for (counter = 1; counter < RULETYPNUMBER; counter++)      RuletypInfos[counter].options &= ~TEXTOPTION_SELECTED;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -