📄 vector_object.hpp
字号:
/* * =========================================================================== * PRODUCTION $Log: vector_object.hpp,v $ * PRODUCTION Revision 1000.1 2004/04/12 18:14:54 gouriano * PRODUCTION PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.5 * PRODUCTION * =========================================================================== */#ifndef GUI_UTILS___VECTOR_OBJECT__HPP#define GUI_UTILS___VECTOR_OBJECT__HPP/* $Id: vector_object.hpp,v 1000.1 2004/04/12 18:14:54 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: Peter Meric * * File Description: * CPVecObj - vector objects - point, polygon * CPVecPoint * CPVecLine * CPVecPolygon * CPVecText * */#include <corelib/ncbiobj.hpp>#include <gui/utils/rgba_color.hpp>#include <vector>BEGIN_NCBI_SCOPEclass CPVecObj : public CObject{public: CPVecObj(); virtual ~CPVecObj(); virtual bool IsFlatColored(void) const = 0; virtual unsigned int GetNumPoints(void) const = 0;};class CPVecPoint : public CPVecObj{public: enum { eCoordX = 1, eCoordY = 2, eCoordZ = 4, // shortcuts eCoordXY = 3, eCoordXYZ = 7 }; enum { // 7 ints per vertex (x, y, z, R, G, B, A) kVertexSize = 7 }; CPVecPoint(const float* buffer); virtual ~CPVecPoint(); virtual const CRgbaColor& GetColor(void) const; virtual unsigned int GetNumPoints(void) const; virtual bool IsFlatColored(void) const; void PrintTo(CNcbiOstream& strm, short flags = eCoordXYZ) const;private: float m_X, m_Y, m_Z; CRgbaColor m_Color;};CNcbiOstream& operator<<(CNcbiOstream& strm, const CPVecPoint& p);class CPVecLine : public CPVecObj{public: CPVecLine(const float* buffer); virtual ~CPVecLine(); virtual pair<CPVecPoint, CPVecPoint> GetPoints(void) const; virtual unsigned int GetNumPoints(void) const; virtual bool IsFlatColored(void) const; void PrintTo(CNcbiOstream& strm, short flags = CPVecPoint::eCoordXYZ) const;private: CPVecPoint m_P1, m_P2;};class CPVecPolygon : public CPVecObj{public: typedef vector< CRef<CPVecPoint> > TPointList; CPVecPolygon(int num_vertices, const float* buffer); virtual ~CPVecPolygon(); virtual unsigned int GetNumPoints(void) const; virtual bool IsFlatColored(void) const; typedef TPointList::iterator iterator; typedef TPointList::const_iterator const_iterator; typedef TPointList::reverse_iterator reverse_iterator; typedef TPointList::const_reverse_iterator const_reverse_iterator; iterator begin(void); const_iterator begin(void) const; iterator end(void); const_iterator end(void) const; reverse_iterator rbegin(void); const_reverse_iterator rbegin(void) const; reverse_iterator rend(void); const_reverse_iterator rend(void) const;private: TPointList m_Points; bool m_FlatColored;};CNcbiOstream& operator<<(CNcbiOstream& strm, const CPVecLine& l);class CPVecText : public CObject{public: CPVecText(const string& text, float position[4], const CRgbaColor& color, const string& font = "Helvetica"); virtual ~CPVecText(); string GetText(void) const; const float* GetPosition(void) const; const CRgbaColor& GetColor(void) const; string GetFont(void) const;private: string m_Text; float m_Position[4]; CRgbaColor m_Color; string m_Font;};END_NCBI_SCOPE#endif // GUI_UTILS___VECTOR_OBJECT__HPP/* * =========================================================================== * $Log: vector_object.hpp,v $ * Revision 1000.1 2004/04/12 18:14:54 gouriano * PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.5 * * Revision 1.5 2004/01/27 18:29:20 dicuccio * Code clean-up. Pass by const-ref instead of value for CRgbaColor * * Revision 1.4 2003/06/18 16:41:00 meric * First phase of print reorg: remove dependence on gui/opengl and OpenGL * except for class COpenGLPrintBuffer * * Revision 1.3 2003/06/16 15:55:58 dicuccio * Work-in-progress: everything compiles, still much reorganization to be done. * Moved generic functionality out of opengl/print/ and into gui/utils (print * options, print dialogs, etc.). Removed interactive state from CGlCanvas. * Added hook in CView for opening standard print dialog, and for generic print * handling. * * Revision 1.2 2003/06/16 12:46:21 dicuccio * Clean-up after initial commit * * Revision 1.1 2003/06/13 19:00:30 meric * Initial version * * * =========================================================================== */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -