00001 //--- < VISIBILITYPOLICY.H > ----| ViewGraph - A Flexible Graph view Framework | 00002 // 00003 // This file contains the default visibility policy for 00004 // a graph's nodes. Include this file and derive from 00005 // DefaultVisibilityPolicy in order to control when certain 00006 // objects appear and how big they are at certain zoom 00007 // levels. 00008 00009 // For details, see the comments further down. 00010 // 00011 // $Author: botik32 $ 00012 // $Revision: 1.1.1.1 $ 00013 // $Date: 2004/03/26 10:50:26 $ 00014 //-----------------------------------------------------------------------------/ 00015 00016 00017 #ifndef VISIBILITYPOLICY_H 00018 #define VISIBILITYPOLICY_H 00019 00020 /// This is a behaviour class for GraphDisplay. 00021 /// Its sole purpose is to decide on what level 00022 /// of magnification the object should appear. 00023 class DefaultVisibilityPolicy 00024 { 00025 public: 00026 /// returns the level of magnification at 00027 /// which the node appears in normal size. 00028 /// Returned value cannot be less than 1. 00029 virtual double magnification_level( void * ) 00030 { 00031 // default behaviour: all nodes get drawn 00032 return 1; 00033 }; 00034 }; 00035 00036 // You can define your behaviour class that knows your 00037 // node more intimately, like this: 00038 /* 00039 00040 class MyVisibilityPolicy : public DefaultVisibilityPolicy 00041 { 00042 public: 00043 /// This function checks a MyNode for the 00044 /// weight and uses it to define the magni 00045 /// fication level 00046 double magnification_level( void *node ) 00047 { 00048 MyNode *mynode = (MyNode*)node; 00049 double lvl = MAX_WGT/sqrt(mynode->get_weight()); 00050 return lvl>1 ? lvl : 1; 00051 }; 00052 }; 00053 00054 00055 */ 00056 00057 #endif 00058 00059 /// $Log: visibilitypolicy.h,v $ 00060 /// Revision 1.1.1.1 2004/03/26 10:50:26 botik32 00061 /// Initial release 00062 /// 00063 /// Revision 1.1.1.1 2004/03/26 08:53:33 botik 00064 /// initial import 00065 /// 00066 /// 00067 /// Revision 1.2 2003/10/13 16:42:08 botik 00068 /// Added the Log keyword to the end of file 00069 ///