53 #include <wx/statline.h>
54 #include <wx/valgen.h>
56 #include <wx/stattext.h>
57 #include <wx/checkbox.h>
58 #include <wx/msgdlg.h>
59 #include <wx/bitmap.h>
106 : m_OneViewPerObject(
false )
112 return wxPanel::Create( parent,
id, pos,
size, style );
143 TransferDataFromWindow();
160 TransferDataToWindow();
216 : m_Factory( factory )
255 GetSizer()->SetSizeHints(
this);
281 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
282 itemPanel1->SetSizer(itemBoxSizer2);
285 itemBoxSizer2->Add(
m_ListPanel, 1, wxGROW|wxALL, 5);
288 itemBoxSizer2->Add(
m_GroupCtrl, 1, wxGROW|wxALL, 5);
290 m_GroupCheckBox =
new wxCheckBox( itemPanel1,
ID_GROUPVIEW,
_(
"Group objects by identifying sequences"), wxDefaultPosition, wxDefaultSize, 0 );
292 itemBoxSizer2->Add(
m_GroupCheckBox, 0, wxALIGN_LEFT|wxLEFT|wxBOTTOM, 5);
311 if( event.IsChecked() ){
340 if (objs.
begin()->second->GetNumRows() > 0) {
368 size_t num_objects =
objects->GetNumRows();
373 vector<CScope*> loc_scopes, aln_scopes;
378 for(
size_t ix = 0; ix < num_objects; ix++ ){
395 if( it != find_map.
end() ){
401 loc_scopes.push_back( scope );
416 for(
int q = 0; q < num_seqs; q++ ){
423 vector< set<CSeq_id_Handle> >::iterator found =
431 aln_scopes.push_back( scope );
485 for(
size_t ix = 0; ix < num_objects; ix++ ){
520 size_t num_objects =
objects->GetNumRows();
522 vector<int> rows_selected;
525 for(
size_t row = 0;
row < rows_selected.size();
row++ ){
526 int ix = rows_selected[
row];
529 for(
size_t i = 0;
i < num_objects;
i++ ){
533 buf.push_back(s_obj);
543 for (
size_t i = 0;
i < num_objects;
i++) {
544 if (
int(
m_Groups[
i] - num_objects) == ix) {
547 buf.push_back(s_obj);
556 for(
size_t i = 0;
i < num_objects;
i++ ){
560 buf.push_back(s_obj);
572 return ( !
buf.empty());
588 size_t num_objects =
objects->GetNumRows();
590 vector<int> rows_selected;
593 for(
size_t row = 0;
row < rows_selected.size();
row++ ){
594 int ix = rows_selected[
row];
597 for(
size_t i = 0;
i < num_objects;
i++ ){
609 for(
size_t i = 0;
i < num_objects;
i++ ){
610 if(
int(
m_Groups[
i] - num_objects) == ix ){
664 , m_Descriptor(
NULL )
670 : m_Factory( &factory )
671 , m_Descriptor( &factory.GetProjectViewTypeDescriptor() )
760 return action ==
eNext;
774 if (it !=
objects.end() && it->second->GetNumRows() == 1)
return false;
777 (
objects.size() == 1 &&
objects.begin()->second->GetNumRows() > 1)) {
780 }
else if(
objects.begin()->second->GetNumRows() == 1 ){
811 #define MAX_NUM_VIEWS_SAFE 10
825 if( object_map.
empty() || object_map.
begin()->second->GetNumRows() == 0 ){
827 wxT(
"The selections can't be opened in the selected view!"),
828 wxT(
"Open View"), wxOK | wxICON_EXCLAMATION
853 if (it == object_map.
end()) it = object_map.
begin();
856 int num_objects =
objects->GetNumRows();
857 for(
int idx = 0; idx < num_objects; ++idx ){
868 wxT(
"The input object is not compatible with the selected view."),
869 wxT(
"Open View"), wxOK | wxICON_EXCLAMATION
875 wxT(
"Particular kind of this input object is not supported:\n")
877 wxT(
"Open View"), wxOK | wxICON_EXCLAMATION
885 if( action ==
eNext ){
888 wxT(
"Please select at least one object."),
889 wxT(
"Open View"), wxOK | wxICON_EXCLAMATION
901 vector<int>::iterator found = find(
m_OutputIndices.begin(), ix_trv, *ix_trv );
903 if( found == ix_trv ){
912 string message =
"You are about to open more than ";
914 message +=
" views at a time.\nAre you sure?";
928 }
else if( action ==
eBack ){
944 wxT(
"Doing object conversion..."));
946 NCBI_CATCH(
"COpenViewManager::x_DoConversion");
953 return loc1->
Compare(*loc2) < 0;
969 if (need_extra_col) {
973 need_extra_col =
false;
982 if (!scope || !obj)
continue;
993 loc_map[idh].insert(loc);
1004 if (!scope || !obj)
continue;
1015 if (relations.size() > 1 && itr == relations.begin())
continue;
1024 converts.reserve(related.size());
1028 const CObject* converted_obj = &obj_iter->GetObject();
1030 if( obj_ptrs.
insert( converted_obj ).second ){
1035 if ( !loc_map[idh].insert(loc).second ) {
1041 converts.push_back(*obj_iter);
1046 if( !converts.empty() ){
1050 if (need_extra_col) {
1055 int row_num = obj_list->
AddRow(
const_cast<CObject*
>(obj_iter->GetObjectPtr()), scope);
1056 if (need_extra_col) {
1057 obj_list->
SetString( 0, row_num, obj_iter->GetComment() );
EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX, CAdjustFeaturesForGaps::OnKnownUnknownSelected) EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX1
std::invoke_result< _Fty, ICanceled & >::type GUI_AsyncExec(_Fty &&_Fnarg, const wxString &msg=wxT("Accessing network..."))
virtual void SaveSettings() const
virtual void SetObjects(const TObjectListMap &objs)
add your methods here
CwxTableListCtrl * m_GroupCtrl
void OnGroupViewClick(wxCommandEvent &event)
vector< CSeq_id_Handle > m_LocHandles
IProjectViewFactory * m_PVFactory
void SetProjectViewFactory(IProjectViewFactory *factory)
vector< set< CSeq_id_Handle > > m_AlnHandles
virtual bool GetSelectedIndices(vector< int > &buf)
CObjectListWidgetSel * m_ListPanel
virtual void EnforceOneViewPerObject()
Force OneViewPerObject true, and lock it.
wxCheckBox * m_OneViewPerObjectCheckBox
virtual void LoadSettings()
wxCheckBox * m_GroupCheckBox
vector< int > m_GroupSize
virtual void SetRegistryPath(const string &path)
virtual bool Create(wxWindow *parent, wxWindowID id=ID_CCONVERSIONRESULTPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxNO_BORDER|wxTAB_TRAVERSAL)
virtual void CreateControls()
virtual bool GetSelection(TConstScopedObjects &buf)
Return the selected item.
CRegistryWriteView GetWriteView(const string §ion)
get a read-write view at a particular level.
static CGuiRegistry & GetInstance()
access the application-wide singleton
CRegistryReadView GetReadView(const string §ion) const
get a read-only view at a particular level.
vector< TRelation > TRelationVector
static void FindRelations(objects::CScope &scope, const CObject &obj, const string &to_type_in, TRelationVector &relations)
CObjectList Data structure representing a list of CObjects with associated Scopes and other optional ...
int AddRow(CObject *obj, objects::CScope *scope)
void SetString(int col, int row, const string &val)
int AddColumn(EColumnType type, const string &name, int col=-1)
virtual bool CanDo(EAction action)
indicates whether a transition (action) is possible
const CProjectViewTypeDescriptor * m_Descriptor
virtual void SetInputObjects(const TConstScopedObjects &input)
Set input objects that serve as original user input data.
virtual bool AtFinalStep()
true if state is Final (i.e. "Finish" button shall be shown instead of "Next")
virtual void CleanUI()
clean UI objects associated with the Manager
virtual const TConstScopedObjects & GetOutputObjects() const
Return the final input objects for views after possible object conversions and object aggregation.
virtual void SetParentWindow(wxWindow *parent)
vector< int > m_OutputIndices
virtual bool IsCompletedState()
true if data gathering has finished and Open dialog shall be closed
IProjectViewFactory * m_Factory
CParamsPanel * m_ParamPanel
The GUI panel listing the parameters guiding the object conversion and the conversion results.
void SetProjectViewFactory(IProjectViewFactory *factory)
bool mf_IsCombineRequested
void x_DoConversion(TObjectListMap &objects)
virtual bool NeedParamsPanel(const TObjectListMap &objects)
void DoAsyncConversion(TObjectListMap &objects, ICanceled &cancel)
virtual const vector< int > GetOutputIndices() const
virtual CParamsPanel * CreateParamsPanel()
virtual void SaveSettings() const
virtual wxPanel * GetCurrentPanel()
return the panel corresponding to the current state the function may create a new panel or return a p...
virtual bool DoTransition(EAction action)
perform transition if possible and returns true, otherwise the function shall warn the user about the...
wxWindow * m_ParentWindow
virtual void InitUI()
initialize the Manager before using in UI (set it to Initial state)
TConstScopedObjects m_InputObjects
objects that serve as input arguments for the object converter
virtual void FinalizeParams()
TConstScopedObjects m_OutputObjects
The output objects after view-specific object conversion and possible object aggregation.
virtual void LoadSettings()
virtual void SetRegistryPath(const string &path)
void x_LoadParamPanelSettings()
CPVFactoryCombinator(IProjectViewFactory *factory)
virtual void operator()(const TConstScopedObjects &objects, TObjectsMap &objects_map) const
IProjectViewFactory * m_Factory
virtual bool IsCombineRequested() const
virtual bool GetSelectedObjects(TConstScopedObjects &buf)
TObjectListMap m_ObjectMaps
void OnOneViewPerObjectClick(wxCommandEvent &event)
virtual bool GetSelectedIndices(vector< int > &buf)
wxBitmap GetBitmapResource(const wxString &name)
virtual void SetObjects(const TObjectListMap &objs)
add your methods here
virtual void LoadSettings()
virtual void SaveSettings() const
static bool ShowToolTips()
wxIcon GetIconResource(const wxString &name)
virtual void SetRegistryPath(const string &path)
virtual void EnforceOneViewPerObject()
Force OneViewPerObject true, and lock it.
virtual bool Create(wxWindow *parent, wxWindowID id=ID_CPARAMSPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxNO_BORDER|wxTAB_TRAVERSAL)
const string GetPrimaryInputType() const
EPVObjectsAccepted GetObjectsAccepted() const
class CRegistryReadView provides a nested hierarchical view at a particular key.
bool GetBool(const string &key, bool default_val=false) const
void Set(const string &key, int val)
access a named key at this level, with no recursion
vector< SObject > TObjects
virtual string GetProperty(const string &) const
virtual void GetRelated(objects::CScope &scope, const CObject &obj, TObjects &related, TFlags flags=eDefault, ICanceled *cancel=NULL) const =0
@ fConvert_NoExpensive
do not perform any expensive tests (such as fetching from the network)
TDim CheckNumRows(void) const
Validatiors.
const CSeq_id & GetSeq_id(TDim row) const
Get seq-id (the first one if segments have different ids).
Base class for all serializable objects.
CwxTextTableModel - very simple model for storing SMALL numbers fo strings.
virtual void Init(int n_cols, int n_rows)
virtual void SetStringValueAt(int row, int col, const wxString &value)
CwxTableListCtrl - generic wxListCtrl-based Table Control.
wxArrayInt GetDataRowsSelected() const
void SetModel(IwxTableModel *data_model, bool own=false)
Interface for testing cancellation request in a long lasting operation.
virtual bool IsCompatibleWith(const CObject &object, objects::CScope &scope)
virtual vector< int > CombineInputObjects(const TConstScopedObjects &objects)
virtual const CProjectViewTypeDescriptor & GetProjectViewTypeDescriptor() const =0
returns a Descriptor for the View Type supported by the Factory
virtual void CombineObjects(const TConstScopedObjects &objects, TObjectsMap &objects_map)
container_type::const_iterator const_iterator
const_iterator begin() const
const_iterator end() const
const_iterator find(const key_type &key) const
iterator_bool insert(const value_type &val)
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static const column_t columns[]
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define NCBI_CATCH(message)
Catch CExceptions as well This macro is deprecated - use *_X or *_XX variant instead of it.
const string & GetMsg(void) const
Get message string.
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
EDialogReturnValue NcbiMessageBox(const string &message, TDialogType type=eDialog_Ok, EDialogIcon icon=eIcon_Exclamation, const string &title="Error", EDialogTextMode text_mode=eRaw)
virtual const string & GetLabel() const
vector< SConstScopedObject > TConstScopedObjects
virtual const CTypeInfo * GetThisTypeInfo(void) const =0
string GetSeqIdString(bool with_version=false) const
Return seqid string with optional version for text seqid type.
CConstRef< CSeq_id > GetSeqId(void) const
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
int Compare(const CSeq_loc &loc) const
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
CSeq_id_Handle GetIdHandle(const CSeq_loc &loc, CScope *scope)
@ eGetId_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
virtual bool IsCanceled(void) const =0
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
@ fWithCommas
Use commas as thousands separator.
static const char label[]
unsigned int
A callback function used to compare two keys in a database.
const struct ncbi::grid::netcache::search::fields::SIZE size
#define MAX_NUM_VIEWS_SAFE
static const char * kOneViewPerObject
#define row(bind, expected)
bool operator()(const CSeq_loc *loc1, const CSeq_loc *loc2) const
wxString ToWxString(const string &s)