00001 // ***************************************************************************** 00002 // ***************************************************************************** 00003 // oa2DSpace.h 00004 // 00005 // This file contains the definitions for classes that support searching within 00006 // a two-dimensional space. 00007 // 00008 // ***************************************************************************** 00009 // Except as specified in the OpenAccess terms of use of Cadence or Silicon 00010 // Integration Initiative, this material may not be copied, modified, 00011 // re-published, uploaded, executed, or distributed in any way, in any medium, 00012 // in whole or in part, without prior written permission from Cadence. 00013 // 00014 // Copyright 2004-2005 Cadence Design Systems, Inc. 00015 // All Rights Reserved. 00016 // 00017 // $Author: icftcm $ 00018 // $Revision: #1 $ 00019 // $Date: 2010/08/09 $ 00020 // $State: Exp $ 00021 // ***************************************************************************** 00022 // ***************************************************************************** 00023 00024 00025 00026 #ifndef oa2DSpace_P 00027 #define oa2DSpace_P 00028 00029 00030 00031 // ***************************************************************************** 00032 // Nested includes 00033 // ***************************************************************************** 00034 #include "oaXYTree.h" 00035 00036 00037 00038 // ***************************************************************************** 00039 // Declare and define types in the OpenAccess namespace. 00040 // ***************************************************************************** 00041 BEGIN_OA_NAMESPACE 00042 00043 00044 00045 // ***************************************************************************** 00046 // Forward Class Declarations 00047 // ***************************************************************************** 00048 class oaBox; 00049 template<class T, class M, class UD> 00050 class oaXYTree; 00051 template<class T, class M, class UD> 00052 class oaXYTreeProd; 00053 00054 00055 00056 // template<class T, class UD> 00057 // class Measurer { 00058 // public: 00059 // typedef UD measurerArgumentType; // optional 00060 // 00061 // static void getObjBBox(T object, 00062 // UD argument, 00063 // const oaBox &bBox); 00064 // ... 00065 // }; 00066 00067 00068 template<class T, class M, class UD> 00069 class oa2DSearch; 00070 00071 // ***************************************************************************** 00072 // oa2DSpace<> 00073 // 00074 // This class template can be used to create a searchable two-dimensional space 00075 // of objects of nearly arbitrary type. The measurer class argument M defines 00076 // the interface for measuring the objects. 00077 // ***************************************************************************** 00078 template<class T, class M, class UD> 00079 class oa2DSpace { 00080 public: 00081 oa2DSpace(UD measurerArgument = 0); 00082 00083 void add(T object); 00084 void remove(T object); 00085 void clear(); 00086 00087 oaBoolean findNearestNeighborToObj(T to, 00088 T &result); 00089 oaBoolean findNearestNeighborToArea(const oaBox &to, 00090 T &result); 00091 00092 private: 00093 oaXYTree<T, M, UD> m_tree; 00094 friend class oa2DSearch<T, M, UD>; 00095 }; 00096 00097 00098 00099 // ***************************************************************************** 00100 // oa2DSearch<> 00101 // 00102 // This class template can be used to search a two-dimensional space represented 00103 // by oa2DSpace<>. 00104 // ***************************************************************************** 00105 template<class T, class M, class UD> 00106 class oa2DSearch : public oaXYTreeProd<T, M, UD> { 00107 public: 00108 oa2DSearch(oa2DSpace<T, M, UD> *space, 00109 oaUInt4 filterSize = 0); 00110 00111 00112 virtual void process(T) = 0; 00113 void stop(); 00114 oaBoolean search(const oaBox &searchArea); 00115 }; 00116 00117 00118 00119 END_OA_NAMESPACE 00120 00121 #endif
Copyright © 2002 - 2010 Cadence Design Systems, Inc.
All Rights Reserved.