cgma
|
00001 //---------------------------------------------------------------------------- 00002 // Class: ImprintLineSegment 00003 // Description: A class to represent a linesegment for boundary imprinting. 00004 // 00005 // Creator: David R. White 00006 //---------------------------------------------------------------------------- 00007 #include "ImprintLineSegment.hpp" 00008 #include "ImprintPointData.hpp" 00009 #include "ImprintMatchData.hpp" 00010 #include "CubitVector.hpp" 00011 #include "CubitBox.hpp" 00012 #include "RefEntity.hpp" 00013 #include "DLIList.hpp" 00014 00015 ImprintLineSegment::ImprintLineSegment(ImprintPointData *start_point, 00016 ImprintPointData *end_point, 00017 RefEntity *owner_v) 00018 { 00019 CubitVector min, max; 00020 CubitVector p1 = start_point->coordinates(); 00021 CubitVector p2 = end_point->coordinates(); 00022 if ( p1.x() < p2.x() ) { 00023 min.x(p1.x()); 00024 max.x(p2.x()); 00025 } 00026 else { 00027 min.x(p2.x()); 00028 max.x(p1.x()); 00029 } 00030 if ( p1.y() < p2.y() ) { 00031 min.y(p1.y()); 00032 max.y(p2.y()); 00033 } 00034 else { 00035 min.y(p2.y()); 00036 max.y(p1.y()); 00037 } 00038 if ( p1.z() < p2.z() ) { 00039 min.z(p1.z()); 00040 max.z(p2.z()); 00041 } 00042 else { 00043 min.z(p2.z()); 00044 max.z(p1.z()); 00045 } 00046 boundingBox = CubitBox(min, max); 00047 startPoint = start_point; 00048 endPoint = end_point; 00049 nextSeg = NULL; 00050 prevSeg = NULL; 00051 myOwner = owner_v; 00052 inactiveFlag = CUBIT_FALSE; 00053 segMatches = NULL; 00054 startPoint->set_next_seg(this); 00055 endPoint->set_prev_seg(this); 00056 } 00057 ImprintLineSegment::~ImprintLineSegment() 00058 { 00059 if ( segMatches != NULL ) 00060 delete segMatches; 00061 } 00062 void ImprintLineSegment::add_match_data(ImprintMatchData* m_d) 00063 { 00064 if ( segMatches == NULL ) 00065 segMatches = new DLIList<ImprintMatchData*>; 00066 segMatches->append(m_d); 00067 } 00068 void ImprintLineSegment::get_match_data(DLIList<ImprintMatchData*> &match_data) 00069 { 00070 if ( segMatches == NULL ) 00071 return; 00072 else 00073 match_data += (*segMatches); 00074 }