42 #include <wx/msgdlg.h>
68 wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize&
size,
long style ) : m_TopSeqEntry(seh)
71 for ( ; b_iter ; ++b_iter )
75 if (!
m_Found && b_iter->GetSeq_entry_Handle().HasParentEntry())
85 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
86 wxDialog::Create( parent,
id, caption, pos,
size, style );
91 GetSizer()->SetSizeHints(
this);
116 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
117 itemDialog1->SetSizer(itemBoxSizer2);
119 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxHORIZONTAL);
120 itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
122 wxArrayString itemChoiceStrings, itemChoiceStringsWritable;
126 wxMessageBox(
wxT(
"No LatLon records found"),
wxT(
"Error"), wxOK | wxICON_ERROR);
133 wxMessageBox(
wxT(
"No LatLon records found or all records correctly formatted"),
wxT(
"Error"), wxOK | wxICON_ERROR);
139 itemBoxSizer3->Add(
m_GridPanel, 0, wxALIGN_TOP|wxALL, 5);
142 m_Grid->SetTable(gridAdapter,
true);
143 m_Grid->AutoSizeColumns();
144 int l_height =
m_Grid->GetColLabelSize();
145 m_Grid->SetColLabelSize( 2 * l_height );
152 if ((*it)->IsSetHeader() && (*it)->GetHeader().IsSetTitle() )
154 string title = (*it)->GetHeader().GetTitle();
157 itemChoiceStrings.Add(wxString(title));
159 itemChoiceStringsWritable.Add(wxString(title));
168 if (glyph_col >= 0 && glyph_col+1 <
m_Grid->GetNumberCols())
174 wxBoxSizer* itemBoxSizer4 =
new wxBoxSizer(wxHORIZONTAL);
175 itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
180 wxBoxSizer* itemBoxSizer13 =
new wxBoxSizer(wxHORIZONTAL);
181 itemBoxSizer2->Add(itemBoxSizer13, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
183 wxButton* itemButton14 =
new wxButton( itemDialog1, wxID_OK,
_(
"Accept"), wxDefaultPosition, wxDefaultSize, 0 );
184 itemBoxSizer13->Add(itemButton14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
186 wxButton* itemButton15 =
new wxButton( itemDialog1, wxID_CANCEL,
_(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
187 itemBoxSizer13->Add(itemButton15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
199 expand_col->
SetHeader().SetField_name(
"expand");
200 expand_col->
SetData().SetString();
203 current_col->
SetHeader().SetTitle(
"Lat-Lon");
204 current_col->
SetHeader().SetField_name(
"current");
205 current_col->
SetData().SetString();
208 country_col->
SetHeader().SetTitle(
"Country");
209 country_col->
SetHeader().SetField_name(
"country");
210 country_col->
SetData().SetString();
213 suggested_col->
SetHeader().SetTitle(
"Suggested Correction");
214 suggested_col->
SetHeader().SetField_name(
"suggested");
215 suggested_col->
SetData().SetString();
221 bogus_col->
SetHeader().SetField_name(
"");
222 bogus_col->
SetData().SetString();
225 table->SetColumns().push_back(id_col);
226 table->SetColumns().push_back(expand_col);
227 table->SetColumns().push_back(current_col);
228 table->SetColumns().push_back(country_col);
229 table->SetColumns().push_back(suggested_col);
230 table->SetColumns().push_back(bogus_col);
244 id_col->
SetData().SetId().push_back(
id);
245 expand_col->
SetData().SetString().push_back(
"");
246 current_col->
SetData().SetString().push_back(*
fi);
247 country_col->
SetData().SetString().push_back(country);
248 suggested_col->
SetData().SetString().push_back(msg);
249 bogus_col->
SetData().SetString().push_back(
"");
262 bool select_all =
false;
265 if (wxMessageBox(
ToWxString(
"Apply to all?"),
wxT(
"Nothing is selected"), wxOK | wxCANCEL,
NULL) == wxOK)
273 for (
size_t row = 0; row < values_table->
GetColumn(
"current").GetData().GetString().
size(); ++row)
279 if ((old_latlon != new_latlon || old_country != new_country)
280 && (
m_Grid->IsInSelection(
static_cast<int>(row),0) || select_all))
281 m_LatLonCountry[make_pair(old_latlon, old_country)] = make_pair(new_latlon, new_country);
286 for ( ; b_iter ; ++b_iter )
306 return "Invalid operation in Country Conflict Tool";
366 wxMessageDialog dlg(
this,
_(
"Discard modifications?"),
_(
"Attention"),wxOK|wxCANCEL|wxCENTRE);
367 if (dlg.ShowModal() == wxID_OK)
381 if ((*subsource)->IsSetSubtype() &&
383 && (*subsource)->IsSetName())
385 latlon = (*subsource)->GetName();
393 if ((*subsource)->IsSetSubtype() &&
395 && (*subsource)->IsSetName())
397 country = (*subsource)->GetName();
401 if (!latlon.empty() && !country.empty())
411 bool modified =
false;
416 if ((*subsource)->IsSetSubtype() &&
418 (*subsource)->IsSetName())
420 latlon = (*subsource)->GetName();
428 if ((*subsource)->IsSetSubtype() &&
430 (*subsource)->IsSetName())
432 country = (*subsource)->GetName();
437 if (latlon.empty() || country.empty())
445 string new_latlon = it->second.first;
446 string new_country = it->second.second;
450 if ((*subsource)->IsSetSubtype() &&
452 (*subsource)->IsSetName())
454 (*subsource)->SetName(new_latlon);
461 if ((*subsource)->IsSetSubtype() &&
463 && (*subsource)->IsSetName())
465 (*subsource)->SetName(new_country);
478 if ((*it)->IsSource()) {
485 if ((*it)->IsSource()) {
488 new_desc->
Assign(orig_desc);
517 new_feat->
Assign(feat_it->GetOriginalFeature());
void AddCommand(IEditCommand &command)
static bool ShowToolTips()
Should we show tooltips?
CStringConstraintSelect * m_StringConstraintPanel
void x_ApplyToDescriptors(const objects::CSeq_entry &se, CCmdComposite *composite)
CRef< CCmdComposite > GetCommand()
map< pair< string, string >, pair< string, string > > m_LatLonCountry
CRef< CCmdComposite > GetCommandFromValuesTable(CRef< objects::CSeq_table >)
vector< string > m_Country
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void x_GatherLatLon(const objects::CBioSource &biosource)
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
objects::CSeq_entry_Handle m_TopSeqEntry
vector< string > m_ReplaceLatLon
CSeqTableGridPanel * m_GridPanel
vector< string > m_LatLon
void x_FindBioSource(objects::CSeq_entry_Handle tse, CCmdComposite *composite=NULL)
~CCountryConflict()
Destructor.
CRef< objects::CSeq_table > GetChoices(CRef< objects::CSeq_table > values_table)
void OnClickOk(wxCommandEvent &event)
void OnClickCancel(wxCommandEvent &event)
bool x_ApplyToBioSource(objects::CBioSource &biosource)
void Init()
Initialises member variables.
bool IsReadOnlyColumn(string column_name)
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=_("Country Conflict Tool"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
void CreateControls()
Creates the controls and sizers.
CRef< objects::CSeq_table > GetValuesTableFromSeqEntry()
CCountryConflict()
Constructors.
void MakeColumnReadOnly(int pos, bool val=true)
void InitColumnCollapse(int col)
CRef< objects::CSeq_table > GetValuesTable()
namespace ncbi::objects::
const CSeqTable_column & GetColumn(CTempString column_name) const
static string ValidateLatLonCountry(const string &countryname, string &lat_lon, bool check_state, ELatLonCountryErr &errcode)
const_iterator end() const
const_iterator find(const key_type &key) const
USING_SCOPE(ncbi::objects)
const char * kSequenceIdColLabel
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
CSeq_entry_Handle GetSeq_entry_Handle(void) const
Get parent Seq-entry handle.
CConstRef< CSeq_entry > GetCompleteSeq_entry(void) const
Complete and get const reference to the seq-entry.
bool HasParentEntry(void) const
Check if current seq-entry has a parent.
CSeq_entry_Handle GetParentEntry(void) const
Get parent Seq-entry handle.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
@ eSubtype_lat_lon
+/- decimal degrees
const TColumns & GetColumns(void) const
Get the Columns member data.
void SetHeader(THeader &value)
Assign a value to Header data member.
vector< CRef< CSeqTable_column > > TColumns
void SetData(TData &value)
Assign a value to Data data member.
TNum_rows GetNum_rows(void) const
Get the Num_rows member data.
const TString & GetString(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
@ eField_id_location_id
location Seq-id
void SetData(TData &value)
Assign a value to Data data member.
const TSet & GetSet(void) const
Get the variant data.
bool IsSet(void) const
Check if variant Set is selected.
TSource & SetSource(void)
Select the variant.
@ eMol_na
just a nucleic acid
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
const struct ncbi::grid::netcache::search::fields::SIZE size
Utility macros and typedefs for exploring NCBI objects from seqfeat.asn.
#define FOR_EACH_SUBSOURCE_ON_BIOSOURCE(Itr, Var)
FOR_EACH_SUBSOURCE_ON_BIOSOURCE EDIT_EACH_SUBSOURCE_ON_BIOSOURCE.
#define EDIT_EACH_SUBSOURCE_ON_BIOSOURCE(Itr, Var)
#define FOR_EACH_SEQENTRY_ON_SEQSET(Itr, Var)
FOR_EACH_SEQENTRY_ON_SEQSET EDIT_EACH_SEQENTRY_ON_SEQSET.
#define FOR_EACH_SEQDESC_ON_SEQENTRY(Itr, Var)
FOR_EACH_SEQDESC_ON_SEQENTRY EDIT_EACH_SEQDESC_ON_SEQENTRY.
wxString ToWxString(const string &s)