contrib/oxl/osl/osl_edge.cxx
Go to the documentation of this file.
00001 // This is oxl/osl/osl_edge.cxx
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005 //:
00006 // \file
00007 // \author fsm
00008 
00009 #include "osl_edge.h"
00010 
00011 #include <osl/osl_hacks.h>
00012 
00013 //--------------------------------------------------------------------------------
00014 
00015 osl_edge::osl_edge(int n, osl_vertex *a, osl_vertex *b)
00016   : osl_edgel_chain(n)
00017   , v1(a)
00018   , v2(b)
00019 { 
00020 #if ALLOW_CORELEAKS
00021   ref();
00022 #endif
00023   v1->ref();
00024   v2->ref();
00025 }
00026 
00027 osl_edge::osl_edge(osl_edgel_chain const &ec, osl_vertex *a, osl_vertex *b)
00028   : osl_edgel_chain(ec)
00029   , v1(a)
00030   , v2(b)
00031 {
00032 #if ALLOW_CORELEAKS
00033   ref();
00034 #endif
00035   v1->ref();
00036   v2->ref();
00037 }
00038 
00039 osl_edge::~osl_edge() { 
00040 #if !ALLOW_CORELEAKS
00041   v1->unref();
00042   v2->unref();
00043 #endif
00044   v1 = 0;
00045   v2 = 0;
00046 }
00047 
00048 void osl_edge::set_v1(osl_vertex *newv) {
00049   if (v1 == newv)
00050     return;
00051   if (newv)
00052     newv->ref();
00053 #if !ALLOW_CORELEAKS
00054   if (v1)
00055     v1->unref();
00056 #endif
00057   v1 = newv;
00058 }
00059 void osl_edge::set_v2(osl_vertex *newv) {
00060   if (v2 == newv)
00061     return;
00062   if (newv)
00063     newv->ref();
00064 #if !ALLOW_CORELEAKS
00065   if (v2)
00066     v2->unref();
00067 #endif
00068   v2 = newv;
00069 }
00070 
00071 float osl_edge::GetStartX() const { return v1->x; }
00072 float osl_edge::GetStartY() const { return v1->y; }
00073 
00074 float osl_edge::GetEndX() const { return v2->x; }
00075 float osl_edge::GetEndY() const { return v2->y; }
00076 
00077 void osl_edge::SetStartX(float v) { v1->x = v; }
00078 void osl_edge::SetStartY(float v) { v1->y = v; }
00079 
00080 void osl_edge::SetEndX(float v) { v2->x = v; }
00081 void osl_edge::SetEndY(float v) { v2->y = v; }
00082 
00083 //--------------------------------------------------------------------------------
00084 
00085 #include <vcl_list.h>
00086 #include <vcl_vector.h>
00087 OSL_TOPOLOGY_REF_UNREF_INSTANTIATE(vcl_list<osl_edge*>);
00088 OSL_TOPOLOGY_REF_UNREF_INSTANTIATE(vcl_vector<osl_edge*>);