📄 taxplot3d_ds.hpp
字号:
/* * =========================================================================== * PRODUCTION $Log: taxplot3d_ds.hpp,v $ * PRODUCTION Revision 1000.0 2004/04/12 18:27:10 gouriano * PRODUCTION PRODUCTION: IMPORTED [CATCHUP_003] Dev-tree R1.5 * PRODUCTION * =========================================================================== */#ifndef GUI_WIDGETS_GRAPH_3D___GRAPH_3D_DS__HPP#define GUI_WIDGETS_GRAPH_3D___GRAPH_3D_DS__HPP/* $Id: taxplot3d_ds.hpp,v 1000.0 2004/04/12 18:27:10 gouriano Exp $ * =========================================================================== * * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information * * This software/database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software/database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular * purpose. * * Please cite the author in any work or product based on this material. * * =========================================================================== * * Authors: Vladimir Tereshkov * * File Description: * Datasource for visualization in CTaxplot3dPanel */#include <corelib/ncbistd.hpp>#include <corelib/ncbiobj.hpp>#include <gui/math/vect3.hpp>#include <gui/math/matrix3.hpp>#include <gui/math/matrix4.hpp>#include <algorithm>BEGIN_NCBI_SCOPE// applied vertex definitiontemplate <class T, class W>class CGraph3DVertex : public CObject{public: enum EShape { eCube, eSphere, eCross }; CGraph3DVertex() : m_Selected(false), m_Visible(true), m_Shape(eSphere) { } CGraph3DVertex(T x, T y, T z, Int4 gi = 0) { CGraph3DVertex(); setXYZ(x, y, z); m_Gi = gi; } ~CGraph3DVertex(){}; // setting xyz void setXYZ(T x, T y, T z) { m_Point.X() = x; m_Point.Y() = y; m_Point.Z() = z; } // setting color void setRGB(W r, W g, W b) { m_Color.X() = r; m_Color.Y() = g; m_Color.Z() = b; } // function void operator ()(CGraph3DVertex<T, W> & vert) { m_Point = vert.getXYZ(); m_Color = vert.getRGB(); m_Shape = vert.getShape(); m_Visible = vert.isVisible(); m_Selected = vert.isSelected(); m_Gi = vert.getGi(); } // setting shape void setShape(EShape shape) {m_Shape = shape;} // getting everything EShape getShape(void) const {return m_Shape; } CVect3<T>& getXYZ(void) {return m_Point; } const CVect3<T>& getXYZ(void) const {return m_Point; } CVect3<W>& getRGB(void) {return m_Color; } const CVect3<W>& getRGB(void) const {return m_Color; } Int4 getGi(void) const {return m_Gi; } // checks bool isSelected(void) const {return m_Selected;} bool isVisible(void) const {return m_Visible;} // actions void doSelect(bool flag=true) {m_Selected = flag;} void doVisible(bool flag=true){m_Visible = flag;} private: CVect3<T> m_Point; // coordinates CVect3<W> m_Color; // rgb color bool m_Selected; // selection bool m_Visible; // visibility EShape m_Shape; // shape Int4 m_Gi; // gi of object };// data source for 3d graphclass NCBI_GUIWIDGETS_TAXPLOT_EXPORT CTaxplot3dDataSource : public CObject {public: typedef CGraph3DVertex<float, float> TVertex; typedef unary_function<float, void> TFilter; CTaxplot3dDataSource(); ~CTaxplot3dDataSource(); // adding void addVertex(TVertex & vert); void addVertex(TVertex * vert); void addDatasource(CTaxplot3dDataSource & ds); void addDatasource(CTaxplot3dDataSource * ds); // setting/getting labels string & xLabel(void) {return m_Xlabel;} string & yLabel(void) {return m_Ylabel;} string & zLabel(void) {return m_Zlabel;} // selection/visibility void doVisibleAt(int i, bool flag = true); void doSelectAt(int i, bool flag = true); // getting everything vector<TVertex> & getData(void); TVertex & getVertexAt(int i); // actions with data CTaxplot3dDataSource* normalizeAll(void); void reshapeAll(TVertex::EShape shp); void applyFiltering(void); // filtering functor add-ons void addFilter(TFilter ff){}; // clearing void clear(void); // retrieving scale float getScale(void) { return m_Scale; } // clear selection void dropSelection(void); private: vector <TVertex> m_Data; vector <TFilter> m_Filters; string m_Xlabel, m_Ylabel, m_Zlabel; float m_Scale;};END_NCBI_SCOPE/* * =========================================================================== * $Log: taxplot3d_ds.hpp,v $ * Revision 1000.0 2004/04/12 18:27:10 gouriano * PRODUCTION: IMPORTED [CATCHUP_003] Dev-tree R1.5 * * Revision 1.5 2004/01/28 19:53:44 ucko * CGraph3DVertex<>: supply const versions of all getters. * * Revision 1.4 2004/01/28 15:50:04 tereshko * Added scale, current gi, to display tooltips in graph * * Revision 1.3 2004/01/21 14:16:29 dicuccio * Adjusted API to be more coding standard compliant. * * Revision 1.2 2004/01/14 16:33:36 tereshko * Taxplot viewer interation minor fixes * * Revision 1.1 2004/01/05 16:22:03 tereshko * Initial revision * * =========================================================================== */#endif // GUI_WIDGETS_HIT_MATRIX___HIT_MATRIX_WIDGET__HPP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -