94 const static string kGraphOverlay =
"graph_overlay";
95 static int s_GraphOverlayNum = 0;
124 config->SetLegend_text(
"anchor_12");
130 bool stacked =
false;
132 bool smooth_curve =
false;
133 string fit_step =
"5";
138 config->SetHidden_settings().push_back
141 config->SetHidden_settings().push_back
144 config->SetHidden_settings().push_back
151 value_range =iter->second;
157 fit_step = iter->second;
160 }
catch (std::exception&) {
164 scale = stored_scale;
169 (
"scale",
"Linear/Log Scale",
171 "Scale for graph data");
172 choice->SetValues().push_back
176 "Shown at linear scale",
177 "Graph data is shown at linear scale"));
178 choice->SetValues().push_back(
182 "Shown at log base 10 scale",
183 "Graph data is shown at logarithmic (base 10) scale"));
184 choice->SetValues().push_back(
188 "Shown at natural logarithm (base e) scale",
189 "Graph data is shown at natural logrithm (base e) scale"));
190 choice->SetValues().push_back(
194 "Shown at log base 2 scale",
195 "Graph data is shown at logarithmic (base 2) scale"));
196 config->SetChoice_list().push_back(choice);
198 config->SetCheck_boxes().push_back(
200 "smooth_curve",
"Smooth curve",
"Smooth curve",
"", smooth_curve));
202 bool range_autoscale =
true;
203 string range_min, range_max;
204 if (!value_range.empty()) {
207 if (!r_min.empty() && r_min !=
"inf") {
208 range_min = (errno) ?
"" : r_min;
210 if (!r_max.empty() && r_max !=
"inf") {
211 range_max = (errno) ?
"" : r_max;
213 config->SetHidden_settings().push_back(
219 "Set value range (data outside range will be clipped)",
220 "Set value range (data outside range will be clipped)",
226 auto condition =
Ref(
new objects::CConditional);
227 condition->SetName(
"scale");
232 range_control->SetConditions().push_back(condition);
235 config->SetRange_controls().push_back(range_control);
238 config->SetCheck_boxes().push_back(
240 kStacked,
"Stacked",
"Graphs are stacked under each other",
"", stacked));
281 DECLARE_EVENT_TABLE()
301 if (m_Source.empty())
302 m_Source =
"Composite track";
310 m_Legend.SetLayoutPolicy(&*layered_layout);
311 m_Legend.SetRenderingContext(r_cntx);
312 m_Legend.SetParent(
this);
316 m_Grid->SetRenderingContext(r_cntx);
317 m_Grid->SetShowTitle(
false);
325 string config_name = annot_name;
343 *merged_params = *overlay_params;
388 if(dlg.ShowModal() == wxID_OK) {
415 if (proxy->GetOrder() == order) {
428 if ( !preset_style.empty())
429 settings[
"profile"] = preset_style;
449 bool parameter_present =
false;
450 string scale, stored_scale;
451 bool draw_bg =
false, need_ruler =
true;
452 string bg_color, label_color, ruler_color, value_range;
455 bool smooth_curve =
false;
460 bg_color = iter->second;
461 parameter_present =
true;
464 parameter_present =
true;
466 scale = iter->second;
467 parameter_present =
true;
469 stored_scale = iter->second;
470 parameter_present =
true;
473 parameter_present =
true;
476 parameter_present =
true;
478 label_color = iter->second;
479 parameter_present =
true;
481 ruler_color = iter->second;
482 parameter_present =
true;
484 value_range = iter->second;
485 parameter_present =
true;
491 }
catch (exception& e) {
494 parameter_present =
true;
497 parameter_present =
true;
499 }
catch (std::exception&) {
500 LOG_POST(
Error <<
"CGraphTrackContainer::x_LoadSettings: invalid settings "
513 if (!parameter_present)
520 if (!bg_color.empty())
523 if (!label_color.empty())
526 if (!ruler_color.empty())
539 if (!stored_scale.empty()) {
544 if (!value_range.empty()) {
545 string range_min, range_max;
547 if (!range_min.empty() && range_min !=
"inf")
549 if (!range_max.empty() && range_max !=
"inf")
562 }
catch (std::exception&) {
563 LOG_POST(
Error <<
"CGraphTrackContainer::x_LoadSettings: invalid histogram settings");
584 for (
auto& proxy : m_TrackProxies) {
585 if (proxy->GetSource() == source_name) {
593 m_LTHost->LTH_PushEventHandler(&*
handler);
595 m_LTHost->LTH_PopEventHandler();
672 if (!(*iter)->GetShown())
713 vector<SLegendData> legend_fields;
715 if (!(*iter)->GetShown())
718 data.annot = (*iter)->GetSource();
721 data.track_id = (*iter)->GetId();
723 if (!
data.label.empty())
725 data.label += (*iter)->GetDisplayName().empty() ?
data.annot : (*iter)->GetDisplayName();
727 legend_fields.push_back(
data);
729 if (legend_fields.empty())
741 int num_cols =
min((
int)(view_width/legend_item_span), (
int)legend_fields.size());
750 int num_rows = ceil((
float)legend_fields.size() / num_cols);
752 for (
int row = 0;
row < num_rows; ++
row) {
753 size_t base_index =
row * num_cols;
755 if (base_index + num_cols >= legend_fields.size())
756 num_cols =
static_cast<int>(legend_fields.size() - base_index);
757 int c = num_cols / 2;
759 if (num_cols % 2 != 0)
760 left -= legend_item_span/2;
761 for (
int col = 0; col < c; ++col) {
763 left -= legend_item_span;
766 for (
int col = 0; col < num_cols; ++col) {
769 legend_fields[base_index + col].
label,
770 legend_fields[base_index + col].track_id,
771 legend_fields[base_index + col].params->m_fgColor,
772 legend_fields[base_index + col].params->m_LabelColor));
773 g->SetTop(
row * row_height +
row * 4 + 2);
774 g->SetHeight(row_height);
777 g->SetWidth(legend_item_span);
787 left += legend_item_span;
809 if (!(*iter)->GetShown())
869 if (!(*iter)->GetShown())
871 if (!(*iter)->TrackNotSet())
880 auto graph_track =
dynamic_cast<const CGraphTrack*
>(ch.GetPointer());
882 for (
auto& glyph : graph_track->GetChildren()) {
893 if (!
GetId().empty()) {
895 if (iter->m_ParentId.empty()) {
896 iter->m_ParentId =
GetId();
923 if ((*iter)->GetOrder() ==
gt->GetOrder()) {
924 new_track_proxy = &**iter;
925 }
else if ((*iter)->GetOrder() ==
GetOrder()) {
926 current_track_proxy = &**iter;
928 if (current_track_proxy && new_track_proxy)
931 _ASSERT(current_track_proxy != 0 && new_track_proxy != 0);
932 if (current_track_proxy == 0 || new_track_proxy == 0)
942 if ((*ch_it)->GetOrder() >= new_order) {
943 new_order = (*ch_it)->GetOrder() + 1;
946 subtrack_proxy->
SetOrder(new_order);
947 new_overlay->
GetChildren().push_back(subtrack_proxy);
962 if (self_proxy == 0) {
974 vector<string> subtracks;
978 if (!(*iter)->GetId().empty())
979 subtracks.push_back((*iter)->GetId());
980 else if (!(*iter)->GetUId().empty()) {
981 subtracks.push_back((*iter)->GetUId());
984 if (proxy && !proxy->
GetAnnots().empty())
985 subtracks.push_back(proxy->
GetAnnots().front());
986 else if (!(*iter)->GetSource().empty())
987 subtracks.push_back((*iter)->GetSource());
991 if (!subtracks.empty()) {
992 sort(subtracks.begin(), subtracks.end());
1008 if ((*t_it)->GetOrder() == track_id) {
1019 if ((*iter)->GetOrder() ==
GetOrder()) {
1020 overlay_proxy=
dynamic_cast<CTrackProxy*
>(&**iter);
1036 if ((*ch_it)->GetOrder() >= new_order) {
1037 new_order = (*ch_it)->GetOrder() + 1;
1042 if ((*it)->GetOrder() == track_id) {
1055 n_proxy->CTempTrackProxy::operator=(*proxy);
1056 n_proxy->SetKey(
"graph_track");
1057 n_proxy->SetOrder(new_order);
1058 n_proxy->SetTrack(proxy->
GetTrack());
1059 n_proxy->GetTrack()->SetShowTitle(
true);
1064 annots.push_back(
gt->GetAnnot());
1065 n_proxy->SetAnnots(annots);
User-defined methods of the data storage class.
User-defined methods of the data storage class.
virtual void Update(bool layout_only)
Update content and layout including the bounding box.
virtual void SetRegistryPath(const string &path)
void SetDSContext(ISGDataSourceContext *ds_context)
void SetRenderingContext(CRenderingContext *r_cntx)
virtual void x_UpdateBoundingBox()
Update the bounding box assuming children's sizes are fixed if any.
CLayoutGroup & SetGroup()
const CLayoutGroup::TObjectList & GetChildren() const
const CLayoutGroup & GetGroup() const
CLayoutGroup::TObjectList & SetChildren()
void SetLayoutPolicy(ILayoutPolicy *policy)
Set policy on how to deploy the layout of its children.
void OnContextMenu(wxContextMenuEvent &anEvent)
CGraphOverlayEvtHandler(CGraphOverlay *overlay, int track_id)
void x_OnTrackSettings(wxCommandEvent &event)
void x_OnHideTrack(wxCommandEvent &event)
CRef< CGraphOverlay > m_Overlay
void x_OnRemoveTrack(wxCommandEvent &event)
virtual const CTrackTypeInfo & GetThisTypeInfo() const
virtual TTrackMap CreateTracks(SConstScopedObject &object, ISGDataSourceContext *ds_context, CRenderingContext *r_cntx, const SExtraParams ¶ms=SExtraParams(), const TAnnotMetaDataList &src_annots=TAnnotMetaDataList()) const
create a layout track based on the input objects and extra parameters.
virtual CRef< objects::CTrackConfigSet > GetSettings(const string &profile, const TKeyValuePairs &settings, const CTempTrackProxy *track_proxy) const
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
CGraphOverlayFactory()
CGraphOverlayFactory.
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
CGraphOverlay container of the graph_tracks that are dispalyed in overlay mode.
virtual void LH_OnItemDblClick(const string &source_name)
notifies the host about changes of the track.
virtual bool CanDrop(CRef< CLayoutTrack > &track)
CRef< CSimpleLayout > m_StackedLayout
virtual void x_UpdateBoundingBox()
Update the bounding box assuming children's sizes are fixed if any.
void UpdateSource(CTempTrackProxy *self_proxy=0)
virtual void OnTrackSettings(int order)
virtual void x_OnAllJobsFinished()
actions to take on all job finished.
void MoveTrackOut(int track_id)
static CTrackTypeInfo m_TypeInfo
CLayoutTrack required track type info.
virtual void x_RenderContent() const
The content rendering must be implemented in the derived layout tracks.
void x_UpdateContainerParams(CHistParams ¶ms)
CRef< CHistogramGlyph > m_Grid
virtual void x_SaveSettings(const string &preset_style)
save the track settings to a profile string.
string m_Source
The unique name - combination of subtracks annots - is used to access the track setting in registry.
CRef< COverlayLayout > m_OverlayLayout
virtual void GetHTMLActiveAreas(TAreaVector *p_areas) const
Get html active areas.
virtual void x_LoadSettings(const string &, const TKeyValuePairs &settings)
load the track settings.
void x_UpdateTrackSettings(const string &source_name)
virtual CRef< CSeqGlyph > HitTest(const TModelPoint &p)
Hit testing.
virtual void x_OnLayoutChanged()
update the layout.
virtual bool Drop(CRef< CLayoutTrack > &track)
virtual const CTrackTypeInfo & GetTypeInfo() const
void UpdateTrackParams(const string &annot_name)
Close a track.
static const string kOverlayed
void SetConfig(CRef< CHistParams > config)
bool CreateX(wxWindow *parent, wxWindowID id=ID_CHISTCONFIGDLG, const wxString &caption=_("Graph Rendering Options"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
CRef< CHistParams > GetConfig() const
void SetConfigName(const string &name)
void AddSettings(const string &name, CRef< CHistParams > hist_params)
Add a new settings for a given name.
void AddTempSettings(const string &name, CRef< CHistParams > hist_params)
Add a temporary settings for a given name.
bool HasSettings(const string &name) const
Check if there is settings for a given name.
CRef< CHistParams > GetDefHistParams() const
CRef< CHistParams > GetHistParams(TFeatSubtype subtype) const
Get histogram settings using feature subtype.
CRgbaColor m_SmearColorMin
EScale m_StoredScale
stored scale of the underlying data (e.g. as reported by TMS)
static EScale ScaleStrToValue(const string &scale)
static const string & TypeValueToStr(CHistParams::EType type)
static const string & ScaleValueToStr(CHistParams::EScale scale)
EScale m_Scale
requested scale
CRange< float > m_ValueRange
CRgbaColor m_SmearColorMax
void SetAxisMin(TDataType min)
void SetAnnotName(const string &name)
void SetAxisMax(TDataType max)
void SetFixedScale(bool value)
virtual void GetHTMLActiveAreas(TAreaVector *p_areas) const
Get html active areas.
TDataType GetMax() const
Get the actually density max/min values.
void SetRenderingMode(ERenderingMode mode)
void DrawGrid(bool include_background) const
void SetConfig(const CSeqGraphicConfig &config)
CLayeredLayout is a standard 2D layout policy.
void PushBack(CSeqGlyph *obj)
Append a layout object to the end.
const TObjectList & GetChildren() const
CLayoutGroup inline methods.
virtual void GetHTMLActiveAreas(TAreaVector *p_areas) const
Get html active areas.
virtual CRef< CSeqGlyph > HitTest(const TModelPoint &p)
Hit testing.
ILayoutPolicy::TObjectList TObjectList
bool m_Expanded
is this track in expanded state
virtual void x_SaveSettings(const string &preset_style)
save the track settings to a profile string.
bool m_On
is this track shown
CLayoutTrack * GetParentTrack()
void x_OnLayoutChanged()
update the layout.
const string & GetId() const
bool x_HitTitleBar(const TModelPoint &p) const
hit the title bar?.
void SetProfile(const string &preset_style)
CLayoutTrack inline method implmentation.
CRef< CSeqGraphicConfig > m_gConfig
global configuration.
COverlayLayout is the layout policy that arranges glyphs over the top of each other.
CRenderingContext offers the basic context and utility methods for rendering layout objects in featur...
TModelRange IntersectVisible(const CSeqGlyph *obj) const
TModelUnit SeqToScreen(const TModelUnit &size) const
convert from sequence positions to screen pixels
TModelUnit ScreenToSeq(const TModelUnit &size) const
convert from screen pixels to sequence positions
TSeqPos GetViewWidth() const
static string ComposeProfileString(const TKeyValuePairs &settings)
CRenderingContext * m_Context
the rendering context
void x_Parent2Local(TModelPoint &pnt) const
Transform the coordiante from parent coord. to local coord.
virtual void SetHeight(TModelUnit h)
bool IsIn(const TModelPoint &p) const
Hit test for points in PARENT COORD.
virtual void SetWidth(TModelUnit w)
virtual void SetLeft(TModelUnit l)
virtual TModelUnit GetTop() const
virtual TModelUnit GetHeight() const
virtual void Update(bool)
Update content and layout including the bounding box.
virtual void SetTop(TModelUnit b)
void Draw() const
render the layout.
virtual TModelUnit GetWidth() const
virtual TModelUnit GetLeft() const
vector< CHTMLActiveArea > TAreaVector
CRef< CHistParamsManager > GetHistParamsManager() const
Get histogram config manager.
CRef< CGlTextureFont > GetLabelFont() const
CSimpleLayout is the simpliest layout policy that simply stack a set of glyphs one on top of the othe...
virtual CRef< CTempTrackProxy > Clone() const
list< CRef< CTempTrackProxy > > TTrackProxies
void SetSource(const string &src)
const TAnnots & GetAnnots() const
const TTrackProxies & GetChildren() const
void SetOrder(int order)
CTempTrackProxy class implementation.
const string & GetStoredScale() const
const CLayoutTrack * GetTrack() const
static CRef< objects::CChoice > CreateChoice(const string &name, const string &disp_name, const string &curr_val, const string &help, bool optional=false)
static CRef< objects::CHiddenSetting > CreateHiddenSetting(const string &name, const string &value)
static CRef< objects::CCheckBox > CreateCheckBox(const string &name, const string &disp_n, const string &help_text, const string &legend_txt, bool value, bool optional=false)
static CRef< objects::CRangeControl > CreateRangeControl(const string &name, const string &disp_name, const string &help, const string &value_min, const string &value_max, bool autoscale=true, bool inverse=false, bool optional=false)
static void DecodeValueRange(const string &value_range, string &range_min, string &range_max, bool &range_auto)
static CRef< objects::CChoiceItem > CreateChoiceItem(const string &name, const string &disp_name, const string &help, const string &legend_txt, bool optional=false)
CTrackContainer - a track container in the form of layout track.
void SetSkipGenuineCheck(bool flag)
const TTrackProxies & GetSubtrackProxies() const
CTrackContainer inline methods.
void AddTrackProxy(CTempTrackProxy *proxy, bool upgateMsg=true)
Add a track proxy.
CTrackProxy * AddNewTrack(const string &track_key, const CTrackProxy::TAnnots &annots, const string &disp_name, const string &name="", const string &filter="", const string &sub_key="")
Add a new empty track proxy.
virtual void OnToggleTrack(int order)
void SetAdaptive(bool flag)
void SetAnnotLevel(int level)
void x_UpdateMsg()
udpate message in track title bar.
virtual void RemoveTrack(int order, bool immediately=true)
completely remove a track from the hierachical tree.
void MoveTrack(int from, int to)
CTempTrackProxy::TTrackProxies TTrackProxies
TTrackProxies m_TrackProxies
all the tracks including on and off.
virtual void x_OnAllJobsFinished()
actions to take on all job finished.
CTrackProxy data structure contains information about the position of a track in its parent scope,...
CTrackTypeInfo - holds description of a layout track type.
const string & GetDescr() const
const string & GetId() const
static CUICommandRegistry & GetInstance()
the main instance associated with the application
ISGDSManager is seqgraphic data source manage that serves as an data source context.
virtual CIRef< ISGDataSource > GetDS(const string &type, SConstScopedObject &object)=0
Get a seqgraphic data source instance of the specified type.
void(*)(CSeq_entry_Handle seh, IWorkbench *wb, const CSerialObject &obj) handler
static const int kLegendBarWidth
static const string kStacked
static const int kLegendLabelGap
static const string kValueRange
static const int kLegenPadding
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define ERASE_ITERATE(Type, Var, Cont)
Non-constant version with ability to erase current element, if container permits.
#define VECTOR_ERASE(Var, Cont)
Use this macro inside body of ERASE_ITERATE cycle to erase from vector-like container.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
IRender & GetGl()
convenience function for getting current render manager
virtual TModelUnit TextHeight(const CGlTextureFont *font) const =0
virtual TModelUnit TextWidth(const CGlTextureFont *font, const char *text) const =0
string ToString(bool printAlpha=true, bool uchars=true) const
Return a string representation of the current color.
void FromString(const string &str)
Assign color values encoded in a string.
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
position_type GetLength(void) const
static position_type GetEmptyFrom(void)
TThisType & Set(position_type from, position_type to)
static position_type GetEmptyTo(void)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static bool StringToBool(const CTempString str)
Convert string to bool.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
static const string BoolToString(bool value)
Convert bool to string.
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
@ fConvErr_NoThrow
Do not throw an exception on error.
static const char label[]
void SetFrom(TFrom value)
Assign a value to From data member.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
void SetTo(TTo value)
Assign a value to To data member.
Tdata & Set(void)
Assign a value to data member.
constexpr auto sort(_Init &&init)
constexpr bool empty(list< Ts... >) noexcept
const CharType(& source)[N]
ViewerWindowBase::OnEditMenu ViewerWindowBase::OnJustification EVT_MENU(MID_SHOW_GEOM_VLTNS, ViewerWindowBase::OnShowGeomVltns) EVT_MENU(MID_FIND_PATTERN
#define row(bind, expected)
int g(Seg_Gsm *spe, Seq_Mtf *psm, Thd_Gsm *tdg)
#define WX_DEFINE_MENU(name)
New macros for defining menus for use with CUICommandRegistry.
#define WX_MENU_ITEM(cmd)
wxMenu * CreateMenu(const CMenuItem *item)
Creates a wxMenu object replicating the structure of CMenuItem.