00001 // -*- C++ -*- 00002 // 00003 // This file is part of libgvectors. 00004 // libgvectors is a C++ library intended for visualizing mathematical vectors. 00005 // Copyright (C) 2007 Rafael Ostertag 00006 // 00007 // This program is free software; you can redistribute it and/or 00008 // modify it under the terms of the GNU General Public License 00009 // as published by the Free Software Foundation; either version 2 00010 // of the License, or (at your option) any later version. 00011 // 00012 // This program is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with this program; if not, write to the Free Software 00019 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00020 // USA. 00021 // 00022 // $Id: vstoreitem_8h-source.html,v 1.1 2007-09-08 19:02:38 rafi Exp $ 00023 // 00024 // File: vstoreitem.h 00025 // Author: Rafael Ostertag 00026 // 00027 // Created on July 22, 2007, 8:01 PM 00028 // 00029 00041 #ifndef _VSTOREITEM_H 00042 #define _VSTOREITEM_H 00043 00044 #include <list> 00045 00046 #include <gvectortypes.h> 00047 #include <gvector.h> 00048 #include <drawer.h> 00049 #include <vstorefuncs.h> 00050 #include <visualvector.h> 00051 #include <filewriter.h> 00052 00053 namespace GVectors { 00061 class VStoreItem { 00062 private: 00068 VStoreItem *parent; 00074 gvid_t id; 00084 bool ismanaged; 00090 vv_ptr_t vector; 00096 std::list<VStoreItem*> children; 00103 std::list<gvid_t>& ref_deleted; 00104 00105 protected: 00107 void set_origin_on_children(); 00108 00110 VStoreItem(vv_ptr_t v, std::list<gvid_t>& dr, VStoreItem* p, bool m=true); 00112 virtual ~VStoreItem(); 00113 00115 gvid_t get_id() const; 00117 vv_ptr_t get_vector() const; 00118 00120 void replace(vv_ptr_t v, bool m=true); 00122 void replace(vv_ref_t v); 00123 00125 void set_origin(const Coordinates& c); 00127 void set_scale(double sc); 00129 void set_arrow_length(double arl); 00131 void set_rotation(const Rotation& r); 00133 void draw(Drawer &d); 00134 00136 VStoreItem* add_child(vv_ptr_t v, bool m=true); 00146 inline VStoreItem* get_parent() const { return parent; } 00149 void child_gone(const VStoreItem *child); 00151 void count_items(CountItems& ci) const; 00153 void save_items(vslevel_t level, FileWriter& fw) const; 00154 00156 void sum_up(GVector& vec) const; 00158 void dimension(GetMinMax& gmm) const; 00159 00160 friend class VectorStore; 00161 friend class FindTopLevel; 00162 friend class VDelete; 00163 friend class VSetOrigin; 00164 friend class VSetArrowLength; 00165 friend class VSetScale; 00166 friend class VSetRotation; 00167 friend class VDraw; 00168 friend class ForEachMinMax; 00169 friend class CountItems; 00170 friend class SaveItems; 00171 }; 00172 00178 typedef VStoreItem* vsi_ptr_t; 00184 typedef VStoreItem& vsi_ref_t; 00190 typedef const VStoreItem* const_vsi_ptr_t; 00196 typedef const VStoreItem& const_vsi_ref_t; 00197 } 00198 00199 #endif /* _VSTOREITEM_H */
1.4.7