00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2011 by the OpenStructure authors 00005 // 00006 // This library is free software; you can redistribute it and/or modify it under 00007 // the terms of the GNU Lesser General Public License as published by the Free 00008 // Software Foundation; either version 3.0 of the License, or (at your option) 00009 // any later version. 00010 // This library is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, Inc., 00017 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 //------------------------------------------------------------------------------ 00019 #ifndef OST_GFX_IMPL_TRACE_RENDERER_BASE_HH 00020 #define OST_GFX_IMPL_TRACE_RENDERER_BASE_HH 00021 00022 /* 00023 Authors: Marco Biasini, Ansgar Philippsen 00024 */ 00025 00026 #include <ost/gfx/module_config.hh> 00027 #include <ost/gfx/impl/entity_renderer.hh> 00028 #include <ost/gfx/impl/backbone_trace.hh> 00029 00030 namespace ost { namespace gfx { namespace impl { 00031 00040 class DLLEXPORT_OST_GFX TraceRendererBase : public EntityRenderer { 00041 public: 00042 TraceRendererBase(BackboneTrace* trace, int overshoot); 00043 00044 virtual geom::AlignedCuboid GetBoundingBox() const; 00045 00046 virtual void PrepareRendering(bool twist_hack); 00047 virtual bool HasDataToRender() const; 00048 virtual void UpdateViews(); 00049 virtual void Apply(const gfx::ByElementColorOp& op); 00050 virtual void Apply(const gfx::ByChainColorOp& op); 00051 virtual void Apply(const gfx::UniformColorOp& op); 00052 virtual void Apply(const gfx::GradientLevelColorOp& op); 00053 virtual void Apply(const gfx::EntityViewColorOp& op); 00054 #if OST_IMG_ENABLED 00055 virtual void Apply(const gfx::MapHandleColorOp& op); 00056 #endif 00057 00058 virtual void PickAtom(const geom::Line3& line, Real line_width, 00059 mol::AtomHandle& picked_atom); 00060 00061 virtual void PickBond(const geom::Line3& line, Real line_width, 00062 mol::BondHandle& picked_bond); 00063 protected: 00064 00065 void set_node_colors(const Color& c, const mol::Query& q, ColorMask mask); 00066 00067 void rebuild_sel(const SplineEntryListList& spline_list_list, 00068 SplineEntryListList& sel_spline_list_list, 00069 const Color& sel_color); 00070 00071 BackboneTrace* trace_; 00072 BackboneTrace trace_subset_; 00073 BackboneTrace sel_subset_; 00074 }; 00075 00076 }}} 00077 00078 #endif