void CTransformationsDialog::OnAddButton() { CElementManager & OElementManager = ((CReportAsistentApp *) AfxGetApp())->m_pGeneralManager->ElementManager; CAElInfo * info = OElementManager.getActiveElementInfo(OElementManager.IdentifyElement(m_active_element)); if ( MAX_TRANSFORMATION_COUNT < info->getTranformationsCount() ) { //Error return; } int nSel = m_SupportedList.GetSelCount(); int SelItems[ MAX_TRANSFORMATION_COUNT ]; int nRes = m_SupportedList.GetSelItems( MAX_TRANSFORMATION_COUNT, SelItems ); if (nRes == LB_ERR) return; int I; for (I=0;I<nSel;I++) { if (!AddTransformation(SelItems[I])) return; } }
void CTransformationsDialog::OnDblclkSupportedTransfList() { int nSel = m_SupportedList.GetSelCount(); if (nSel > 1) return; int SelItems[2]; int nRes = m_SupportedList.GetSelItems( 1, SelItems ); if (nRes == LB_ERR) return; AddTransformation(SelItems[0]); return; }
BrickTarget::BrickTarget(GameManager *mgr, WallLevel *_parent, int _xPos, int _yPos) : Sprite(mgr) { DEBUG_TRACER(BrickTarget::BrickTarget); prefix = wordBuilder->GetNextPrefix(); isSelected = false; parent = _parent; staticTarget = false; sprintf(debugId, "BrTg - %d(%s) [%d, %d]", brickTargetCount, prefix.c_str(), _xPos, _yPos); SetImage(mgr->GetResourceManager()->GetImage(IMAGE_BRICK_TARGET)); xPos = _xPos; yPos = _yPos; int brickLocX = 85 + (yPos % 2) * 70 + xPos * 140; int brickLocY = 330 - 73 * yPos; SetBaseLocation(CIwVec2(brickLocX, brickLocY)); AddTransformation(new AnchorTransformation()); mgr->RegisterGameObject(this); //char buffer[50]; //sprintf(buffer, "%d, %d", xPos, yPos); //prefixSprite = new TextSprite(mgr, buffer); prefixSprite = new TextSprite(mgr, prefix.c_str()); prefixSprite->SetParent(this); prefixSprite->AddTransformation(new AnchorTransformation()); prefixSprite->AddTransformation(new RotationTransformation(0, Clockwise)); prefixSprite->SetFont(mgr->GetResourceManager()->GetFont(FONT_COOPER_18)); prefixSprite->SetBackgroundColor(g_IwGxColours[IW_GX_COLOUR_WHITE]); prefixSprite->SetBorderColor(g_IwGxColours[IW_GX_COLOUR_BLACK]); prefixSprite->SetBorderThickness(CIwVec2(2, 2)); prefixSprite->SetPadding(CIwVec2(3, 3)); prefixSprite->SetZIndex(10); mgr->RegisterGameObject(prefixSprite); sprintf(prefixSprite->debugId, "Brick Target Prefix - %d(%s)", brickTargetCount, prefix.c_str()); brickTargetCount++; }
void HClusterDlg::CreateControls() { wxScrolledWindow* scrl = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(880,780), wxHSCROLL|wxVSCROLL ); scrl->SetScrollRate( 5, 5 ); wxPanel *panel = new wxPanel(scrl); // Input wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL); bool show_auto_ctrl = true; AddInputCtrls(panel, vbox, show_auto_ctrl); // Parameters wxFlexGridSizer* gbox = new wxFlexGridSizer(7,2,5,0); // NumberOfCluster Control AddNumberOfClusterCtrl(panel, gbox); // Transformation AddTransformation(panel, gbox); wxStaticText* st12 = new wxStaticText(panel, wxID_ANY, _("Method:"), wxDefaultPosition, wxSize(120,-1)); wxString choices12[] = {"Single-linkage","Ward's-linkage", "Complete-linkage","Average-linkage"}; wxChoice* box12 = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxSize(120,-1), 4, choices12); box12->SetSelection(1); gbox->Add(st12, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 10); gbox->Add(box12, 1, wxEXPAND); wxStaticText* st13 = new wxStaticText(panel, wxID_ANY, _("Distance Function:"), wxDefaultPosition, wxSize(120,-1)); wxString choices13[] = {"Euclidean", "Manhattan"}; wxChoice* box13 = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxSize(120,-1), 2, choices13); box13->SetSelection(0); gbox->Add(st13, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 10); gbox->Add(box13, 1, wxEXPAND); wxStaticText* st17 = new wxStaticText(panel, wxID_ANY, _("Spatial Constraint:"), wxDefaultPosition, wxSize(128,-1)); chk_contiguity = new wxCheckBox(panel, wxID_ANY, ""); gbox->Add(st17, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 10); gbox->Add(chk_contiguity, 1, wxEXPAND); chk_contiguity->Disable(); wxStaticText* st16 = new wxStaticText(panel, wxID_ANY, _(""), wxDefaultPosition, wxSize(128,-1)); combo_weights = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxSize(200,-1)); gbox->Add(st16, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 10); gbox->Add(combo_weights, 1, wxEXPAND); combo_weights->Disable(); wxStaticBoxSizer *hbox = new wxStaticBoxSizer(wxHORIZONTAL, panel, _("Parameters:")); hbox->Add(gbox, 1, wxEXPAND); // Output wxFlexGridSizer* gbox1 = new wxFlexGridSizer(5,2,5,0); wxStaticText* st3 = new wxStaticText (panel, wxID_ANY, _("Save Cluster in Field:"), wxDefaultPosition, wxDefaultSize); wxTextCtrl *box3 = new wxTextCtrl(panel, wxID_ANY, "CL", wxDefaultPosition, wxSize(120,-1)); gbox1->Add(st3, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 10); gbox1->Add(box3, 1, wxALIGN_CENTER_VERTICAL); wxStaticBoxSizer *hbox1 = new wxStaticBoxSizer(wxHORIZONTAL, panel, _("Output:")); hbox1->Add(gbox1, 1, wxEXPAND); // Buttons wxButton *okButton = new wxButton(panel, wxID_OK, _("Run"), wxDefaultPosition, wxSize(70, 30)); saveButton = new wxButton(panel, wxID_SAVE, _("Save/Show Map"), wxDefaultPosition, wxDefaultSize); wxButton *closeButton = new wxButton(panel, wxID_EXIT, _("Close"), wxDefaultPosition, wxSize(70, 30)); wxBoxSizer *hbox2 = new wxBoxSizer(wxHORIZONTAL); hbox2->Add(okButton, 0, wxALIGN_CENTER | wxALL, 5); hbox2->Add(saveButton, 0, wxALIGN_CENTER | wxALL, 5); hbox2->Add(closeButton, 0, wxALIGN_CENTER | wxALL, 5); // Container vbox->Add(hbox, 0, wxEXPAND | wxALL, 10); vbox->Add(hbox1, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 10); vbox->Add(hbox2, 0, wxALIGN_CENTER | wxALL, 10); // Summary control notebook = new wxNotebook( panel, wxID_ANY); m_panel = new DendrogramPanel(max_n_clusters, notebook, wxID_ANY); notebook->AddPage(m_panel, _("Dendrogram")); m_reportbox = new SimpleReportTextCtrl(notebook, wxID_ANY, ""); notebook->AddPage(m_reportbox, _("Summary")); notebook->Connect(wxEVT_NOTEBOOK_PAGE_CHANGING, wxBookCtrlEventHandler(HClusterDlg::OnNotebookChange), NULL, this); wxBoxSizer *container = new wxBoxSizer(wxHORIZONTAL); container->Add(vbox); container->Add(notebook,1, wxEXPAND | wxALL); panel->SetSizerAndFit(container); wxBoxSizer* panelSizer = new wxBoxSizer(wxVERTICAL); panelSizer->Add(panel, 1, wxEXPAND|wxALL, 0); scrl->SetSizer(panelSizer); wxBoxSizer* sizerAll = new wxBoxSizer(wxVERTICAL); sizerAll->Add(scrl, 1, wxEXPAND|wxALL, 0); SetSizer(sizerAll); SetAutoLayout(true); sizerAll->Fit(this); Centre(); // Content m_textbox = box3; //m_iterations = box11; m_method = box12; m_distance = box13; // init weights vector<boost::uuids::uuid> weights_ids; WeightsManInterface* w_man_int = project->GetWManInt(); w_man_int->GetIds(weights_ids); size_t sel_pos=0; for (size_t i=0; i<weights_ids.size(); ++i) { combo_weights->Append(w_man_int->GetShortDispName(weights_ids[i])); if (w_man_int->GetDefault() == weights_ids[i]) sel_pos = i; } if (weights_ids.size() > 0) combo_weights->SetSelection(sel_pos); // Events okButton->Bind(wxEVT_BUTTON, &HClusterDlg::OnOKClick, this); saveButton->Bind(wxEVT_BUTTON, &HClusterDlg::OnSave, this); closeButton->Bind(wxEVT_BUTTON, &HClusterDlg::OnClickClose, this); combo_n->Connect(wxEVT_TEXT, wxCommandEventHandler(HClusterDlg::OnClusterChoice), NULL, this); combo_n->Connect(wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler(HClusterDlg::OnClusterChoice), NULL, this); chk_contiguity->Bind(wxEVT_CHECKBOX, &HClusterDlg::OnSpatialConstraintCheck, this); saveButton->Disable(); }