CigiBaseSymbolLineDef.cpp

Go to the documentation of this file.
00001 
00040 #define _EXPORT_CCL_
00041 
00042 
00043 #include "CigiBaseSymbolLineDef.h"
00044 #include "CigiExceptions.h"
00045 
00046 using namespace std;
00047 
00048 // ====================================================================
00049 // Construction/Destruction
00050 // ====================================================================
00051 
00052 // ================================================
00053 // CigiBaseSymbolLineDef
00054 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00055 CigiBaseSymbolLineDef::CigiBaseSymbolLineDef(void)
00056 {
00057 }
00058 
00059 // ================================================
00060 // ~CigiBaseSymbolLineDef
00061 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00062 CigiBaseSymbolLineDef::~CigiBaseSymbolLineDef(void)
00063 {
00064    CigiBaseVertexSymbolData *pVtx;
00065    vector<CigiBaseVertexSymbolData *>::iterator iVtx;
00066    for(iVtx=Vertices.begin();iVtx!=Vertices.end();iVtx++)
00067    {
00068       pVtx = *iVtx;
00069       if(pVtx != NULL)
00070          delete pVtx;
00071    }
00072    Vertices.clear();
00073 }
00074 
00075 
00076 // ================================================
00077 // CigiBaseSymbolLineDef - Copy constructor
00078 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00079 CigiBaseSymbolLineDef::CigiBaseSymbolLineDef(const CigiBaseSymbolLineDef &BaseIn)
00080 {
00081    SymbolID = BaseIn.SymbolID;
00082    Primitive = BaseIn.Primitive;
00083    StipplePattern = BaseIn.StipplePattern;
00084    LineWidth = BaseIn.LineWidth;
00085    StipplePatternLen = BaseIn.StipplePatternLen;
00086 
00087    // The Vertex Vector should be copied in the specific version class
00088 }
00089 
00090 // ================================================
00091 // Copy operator
00092 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00093 CigiBaseSymbolLineDef & CigiBaseSymbolLineDef::operator=(const CigiBaseSymbolLineDef &BaseIn)
00094 {
00095    SymbolID = BaseIn.SymbolID;
00096    Primitive = BaseIn.Primitive;
00097    StipplePattern = BaseIn.StipplePattern;
00098    LineWidth = BaseIn.LineWidth;
00099    StipplePatternLen = BaseIn.StipplePatternLen;
00100 
00101    // The Vertex Vector should be copied in the specific version class
00102 
00103    return(*this);
00104 }
00105 
00106 
00107 // ====================================================================
00108 // Conversion Control
00109 // ====================================================================
00110 int CigiBaseSymbolLineDef::GetCnvt(CigiVersionID &CnvtVersion,
00111                                 CigiCnvtInfoType::Type &CnvtInfo)
00112 {
00113    if(CnvtVersion.GetCombinedCigiVersion() < 0x303)
00114    {
00115       CnvtInfo.ProcID = CigiProcessType::ProcNone;
00116       CnvtInfo.CnvtPacketID = 0;
00117    }
00118    else
00119    {
00120       CnvtInfo.ProcID = CigiProcessType::ProcStd;
00121       CnvtInfo.CnvtPacketID = CIGI_SYMBOL_LINE_DEFINITION_PACKET_ID_V3_3;
00122    }
00123 
00124    return(CIGI_SUCCESS);
00125 }
00126 
00127 
00128 // ====================================================================
00129 // Accessors
00130 // ====================================================================
00131 
00132 
00133 // ================================================
00134 // SetPrimitive
00135 // ================================================
00136 int CigiBaseSymbolLineDef::SetPrimitive(const PrimitiveGrp PrimitiveIn, bool bndchk)
00137 {
00138 
00139 #ifndef CIGI_NO_BND_CHK
00140    if(bndchk && ((PrimitiveIn < 0)||(PrimitiveIn > 6)))
00141    {
00142 #ifndef CIGI_NO_EXCEPT
00143       throw CigiValueOutOfRangeException("Primitive", (int)PrimitiveIn,0,6);
00144 #endif
00145       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00146    }
00147 #endif
00148 
00149    Primitive = PrimitiveIn;
00150 
00151    return(CIGI_SUCCESS);
00152 
00153 }
00154 
00155 // ================================================
00156 // SetLineWidth
00157 // ================================================
00158 int CigiBaseSymbolLineDef::SetLineWidth(const float LineWidthIn, bool bndchk)
00159 {
00160 
00161 #ifndef CIGI_NO_BND_CHK
00162    if(bndchk && (LineWidthIn < 0.0))
00163    {
00164 #ifndef CIGI_NO_EXCEPT
00165       throw CigiValueOutOfRangeException("LineWidth", (double)LineWidthIn,">=",0.0);
00166 #endif
00167       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00168    }
00169 #endif
00170 
00171    LineWidth = LineWidthIn;
00172 
00173    return(CIGI_SUCCESS);
00174 
00175 }
00176 
00177 // ================================================
00178 // SetStipplePatternLen
00179 // ================================================
00180 int CigiBaseSymbolLineDef::SetStipplePatternLen(const float StipplePatternLenIn, bool bndchk)
00181 {
00182 
00183 #ifndef CIGI_NO_BND_CHK
00184    if(bndchk && (StipplePatternLenIn < 0.0))
00185    {
00186 #ifndef CIGI_NO_EXCEPT
00187       throw CigiValueOutOfRangeException("StipplePatternLen", (double)StipplePatternLenIn,">=",0.0);
00188 #endif
00189       return(CIGI_ERROR_VALUE_OUT_OF_RANGE);
00190    }
00191 #endif
00192 
00193    StipplePatternLen = StipplePatternLenIn;
00194 
00195    return(CIGI_SUCCESS);
00196 
00197 }
00198 
00199 // ================================================
00200 // GetVertexCount
00201 // ================================================
00202 int CigiBaseSymbolLineDef::GetVertexCount(void)
00203 {
00204    return(Vertices.size());
00205 }
00206 
00207 // ================================================
00208 // GetVertex
00209 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00210 CigiBaseVertexSymbolData * CigiBaseSymbolLineDef::GetVertex(int VertexIndex, bool bndchk)
00211 {
00212    CigiBaseVertexSymbolData * pVtx = NULL;
00213 
00214    if((VertexIndex >= 0) && ((Cigi_uint8)VertexIndex < Vertices.size()))
00215    {
00216       pVtx = Vertices[VertexIndex];
00217    }
00218    else
00219    {
00220 #ifndef CIGI_NO_BND_CHK
00221       if(bndchk)
00222       {
00223 #ifndef CIGI_NO_EXCEPT
00224          throw CigiValueOutOfRangeException("VertexIndex", (int)VertexIndex,0,Vertices.size());
00225 #endif
00226       }
00227 #endif
00228    }
00229 
00230    return(pVtx);
00231 }
00232 
00233 // ================================================
00234 // ClearVertices
00235 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
00236 void CigiBaseSymbolLineDef::ClearVertices(void)
00237 {
00238    CigiBaseVertexSymbolData *pVtx;
00239    vector<CigiBaseVertexSymbolData *>::iterator iVtx;
00240    for(iVtx=Vertices.begin();iVtx!=Vertices.end();iVtx++)
00241    {
00242       pVtx = *iVtx;
00243       if(pVtx != NULL)
00244          delete pVtx;
00245    }
00246    Vertices.clear();
00247    VariableDataSize = 0;
00248 }
00249 
00250 

Generated on Wed Apr 29 08:59:57 2009 for CCL by  doxygen 1.4.7