cgma
PartitionCoEdge.cpp
Go to the documentation of this file.
00001 #include "PartitionCoEdge.hpp"
00002 #include "PartitionSurface.hpp"
00003 #include "PartitionCurve.hpp"
00004 #include "PartitionLoop.hpp"
00005 #include "PartitionEngine.hpp"
00006 #include "VirtualQueryEngine.hpp"
00007 
00008 PartitionCoEdge::PartitionCoEdge(PartitionSurface* surf, CubitSense sense)
00009   : mySense(sense),
00010     myLoop(0), 
00011     loopPrev(0),
00012     loopNext(0),
00013     myCurve(0), 
00014     curveNext(0)
00015 { 
00016   surf->sub_entity_set().add_lower_order( this );
00017 }
00018 
00019 PartitionCoEdge::PartitionCoEdge(CoEdgeSM* coedge)
00020   : myLoop(0), 
00021     loopPrev(0),
00022     loopNext(0),
00023     myCurve(0), 
00024     curveNext(0)
00025 {
00026   mySense = coedge->sense();
00027   assert( dynamic_cast<SubEntitySet*>(coedge->owner()) == 0 );
00028   new SubEntitySet( coedge, this );
00029 }
00030 
00031 PartitionCoEdge::PartitionCoEdge(PartitionCoEdge* split_from)
00032   : myLoop(0), 
00033     loopPrev(0),
00034     loopNext(0),
00035     myCurve(0), 
00036     curveNext(0)
00037 {
00038   mySense = split_from->mySense;
00039   if( split_from->real_coedge() )
00040   {
00041     split_from->sub_entity_set().add_partition( this, split_from );
00042   }
00043   else
00044   {
00045     split_from->sub_entity_set().add_lower_order( this );
00046   }
00047 }
00048 
00049 PartitionCoEdge::~PartitionCoEdge()
00050 {
00051   if( myCurve )
00052     myCurve->remove(this);
00053   if( myLoop )
00054     myLoop->remove(this);
00055   
00056   assert( !myCurve && !myLoop );
00057 }
00058 
00059 void PartitionCoEdge::reverse_sense()
00060 {
00061   mySense = mySense == CUBIT_FORWARD  ? CUBIT_REVERSED :
00062             mySense == CUBIT_REVERSED ? CUBIT_FORWARD  :
00063                                         CUBIT_UNKNOWN  ;
00064 } 
00065 
00066 TopologyBridge* PartitionCoEdge::find_parent_loop() const
00067 {
00068   if( get_loop() )
00069     return get_loop();
00070   
00071   CoEdgeSM* coedge = real_coedge();
00072   if( !coedge )
00073     return 0;
00074   
00075   DLIList<TopologyBridge*> list;
00076   coedge->get_parents_virt( list );
00077   assert( list.size() == 1 );
00078   return list.get();
00079 }
00080 
00081 CoEdgeSM* PartitionCoEdge::real_coedge() const
00082 {
00083   return dynamic_cast<CoEdgeSM*>(partitioned_entity());
00084     // this will be null for coedges of segmented (split) curves.
00085 }
00086 
00087 void PartitionCoEdge::get_children_virt( DLIList<TopologyBridge*>& list )
00088 {
00089   assert( myCurve != NULL );
00090   list.append( myCurve );
00091 }
00092 
00093 
00094 void PartitionCoEdge::get_parents_virt( DLIList<TopologyBridge*>& list )
00095 {
00096   TopologyBridge* result = find_parent_loop();
00097   assert( result != NULL );
00098   list.append( result );
00099 }
00100 
00101 
00102     
00103 void PartitionCoEdge::append_simple_attribute_virt( const CubitSimpleAttrib& )
00104   { }
00105 void PartitionCoEdge::remove_simple_attribute_virt( const CubitSimpleAttrib& )
00106   { }
00107 void PartitionCoEdge::remove_all_simple_attribute_virt()
00108   { }
00109 CubitStatus PartitionCoEdge::get_simple_attribute( DLIList<CubitSimpleAttrib>& )
00110   { return CUBIT_FAILURE; }
00111 CubitStatus PartitionCoEdge::get_simple_attribute(const CubitString& ,
00112                                        DLIList<CubitSimpleAttrib>& )
00113   { return CUBIT_FAILURE; }
00114 
00115 
00116 
00117 GeometryQueryEngine* PartitionCoEdge::get_geometry_query_engine() const
00118 {
00119   return VirtualQueryEngine::instance();
00120 }
00121 
00122 PartitionPoint* PartitionCoEdge::start_point() const
00123 {
00124   PartitionPoint* result = 0;
00125   if( myCurve )
00126   {
00127     if( mySense == CUBIT_FORWARD )
00128       result = myCurve->start_point();
00129     else if( mySense == CUBIT_REVERSED )
00130       result = myCurve->end_point();
00131   }
00132   return result;
00133 }
00134 
00135 PartitionPoint* PartitionCoEdge::end_point() const
00136 {
00137   PartitionPoint* result = 0;
00138   if( myCurve )
00139   {
00140     if( mySense == CUBIT_FORWARD )
00141       result = myCurve->end_point();
00142     else if( mySense == CUBIT_REVERSED )
00143       result = myCurve->start_point();
00144   }
00145   return result;
00146 }
00147 
00148 void PartitionCoEdge::notify_split( FacetEntity*, FacetEntity* )
00149   { assert(0); }
00150 
00151 CubitBox PartitionCoEdge::bounding_box() const
00152   { return ((Curve*)get_curve())->bounding_box(); }
00153 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines