Show
Ignore:
Timestamp:
03/21/12 18:36:20 (3 years ago)
Author:
robert
Message:

Ran script to remove trailing spaces and tabs

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgPlugins/dxf/dxfEntity.cpp

    r13035 r13041  
    11/* dxfReader for OpenSceneGraph  Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com ) 
    22 * Programmed by Paul de Repentigny <pdr@grapharchitecture.com> 
    3  *  
     3 * 
    44 * OpenSceneGraph is (C) 2004 Robert Osfield 
    5  *  
     5 * 
    66 * This library is provided as-is, without support of any kind. 
    77 * 
    88 * Read DXF docs or OSG docs for any related questions. 
    9  *  
     9 * 
    1010 * You may contact the author if you have suggestions/corrections/enhancements. 
    1111 */ 
     
    3535RegisterEntityProxy<dxfText> g_dxfText; 
    3636 
    37 void  
     37void 
    3838dxfBasicEntity::assign(dxfFile* , codeValue& cv) 
    3939{ 
     
    7171            _vertices[cv._groupCode - 30].z() = d; 
    7272            break; 
    73              
     73 
    7474        default: 
    7575            dxfBasicEntity::assign(dxf, cv); 
     
    104104    double d = cv._double; 
    105105    // 2005.12.13 pdr: learned today that negative indices mean something and were possible 
    106      
     106 
    107107    int s = cv._int; // 2005.12.13 pdr: group codes [70,78] now signed int. 
    108108    if ( s < 0 ) s = -s; 
     
    129129            _indice4 = s; 
    130130            break; 
    131              
     131 
    132132        default: 
    133133            dxfBasicEntity::assign(dxf, cv); 
     
    180180 
    181181    if (_useAccuracy) { 
    182         // we generate points on a polyline where each point lies on the arc, thus the maximum error occurs at the midpoint of each line segment where it lies furthest inside the arc  
    183         // If we divide the segment in half and connect the bisection point to the arc's center, we have two rightangled triangles with  
     182        // we generate points on a polyline where each point lies on the arc, thus the maximum error occurs at the midpoint of each line segment where it lies furthest inside the arc 
     183        // If we divide the segment in half and connect the bisection point to the arc's center, we have two rightangled triangles with 
    184184        // one side=r-maxError, hypotenuse=r, and internal angle at center is half the angle we will step with: 
    185         double maxError=min(_maxError,_radius); // Avoid offending acos() in the edge case where allowable deviation is greater than radius.  
     185        double maxError=min(_maxError,_radius); // Avoid offending acos() in the edge case where allowable deviation is greater than radius. 
    186186        double newtheta=acos( (_radius-maxError) / _radius); 
    187         newtheta=osg::RadiansToDegrees(newtheta)*2.0;  
    188          
     187        newtheta=osg::RadiansToDegrees(newtheta)*2.0; 
     188 
    189189        // Option to only use the new accuracy code when it would improve on the accuracy of the old method 
    190190        if (_improveAccuracyOnly) { 
     
    193193            theta=newtheta; 
    194194        } 
    195     }  
     195    } 
    196196    theta=osg::DegreesToRadians(theta); 
    197197 
    198198    // We create an anglestep<=theta so that the line's points are evenly distributed around the circle 
    199199    unsigned int numsteps=static_cast<unsigned int>(floor(osg::PI*2/theta)); 
    200     if (numsteps<3) numsteps=3; // Sanity check: minimal representation of a circle is a tri  
     200    if (numsteps<3) numsteps=3; // Sanity check: minimal representation of a circle is a tri 
    201201    double anglestep=osg::PI*2/numsteps; 
    202202 
     
    210210    } 
    211211 
    212     sc->addLineStrip(getLayer(), _color, vlist); // Should really add LineLoop implementation and save a vertex  
     212    sc->addLineStrip(getLayer(), _color, vlist); // Should really add LineLoop implementation and save a vertex 
    213213    sc->ocs_clear(); 
    214214} 
     
    274274 
    275275    if (_useAccuracy) { 
    276         // we generate points on a polyline where each point lies on the arc, thus the maximum error occurs at the midpoint of each line segment where it lies furthest inside the arc  
    277         // If we divide the segment in half and connect the bisection point to the arc's center, we have two rightangled triangles with  
     276        // we generate points on a polyline where each point lies on the arc, thus the maximum error occurs at the midpoint of each line segment where it lies furthest inside the arc 
     277        // If we divide the segment in half and connect the bisection point to the arc's center, we have two rightangled triangles with 
    278278        // one side=r-maxError, hypotenuse=r, and internal angle at center is half the angle we will step with: 
    279         double maxError=min(_maxError,_radius); // Avoid offending acos() in the edge case where allowable deviation is greater than radius.  
     279        double maxError=min(_maxError,_radius); // Avoid offending acos() in the edge case where allowable deviation is greater than radius. 
    280280        double newtheta=acos( (_radius-maxError) / _radius); 
    281         newtheta=osg::RadiansToDegrees(newtheta)*2.0;  
     281        newtheta=osg::RadiansToDegrees(newtheta)*2.0; 
    282282        //cout<<"r="<<_radius<<" _me="<<_maxError<<" (_radius-_maxError)="<<(_radius-_maxError)<<" newtheta="<<newtheta<<endl; 
    283283        // Option to only use the new accuracy code when it would improve on the accuracy of the old method 
     
    287287            theta=newtheta; 
    288288        } 
    289     }  
     289    } 
    290290 
    291291    double angle_step = DegreesToRadians(end - start); 
    292     int numsteps = (int)((end - start)/theta);  
     292    int numsteps = (int)((end - start)/theta); 
    293293    //cout<<"arc theta="<<osg::RadiansToDegrees(theta)<<" end="<<end<<" start="<<start<<" numsteps="<<numsteps<<" e-s/theta="<<((end-start)/theta)<<" end-start="<<(end-start)<<endl; 
    294294    if (numsteps * theta < (end - start)) numsteps++; 
     
    298298    start = DegreesToRadians((-_endAngle)+90.0); 
    299299    double angle1 = start; 
    300      
     300 
    301301    Vec3d a = _center; 
    302302    Vec3d b; 
    303303 
    304     for (int r = 0; r <= numsteps; r++)  
     304    for (int r = 0; r <= numsteps; r++) 
    305305    { 
    306306        b = a + Vec3d(_radius * (double) sin(angle1), _radius * (double) cos(angle1), 0); 
     
    394394} 
    395395 
    396 void  
     396void 
    397397dxfPolyline::assign(dxfFile* dxf, codeValue& cv) 
    398398{ 
     
    406406        _currentVertex->assign(dxf, cv); 
    407407 
    408         if ((_flag & 64 /*i.e. polymesh*/) &&  
    409             (cv._groupCode == 70 /*i.e. vertex flag*/) &&  
     408        if ((_flag & 64 /*i.e. polymesh*/) && 
     409            (cv._groupCode == 70 /*i.e. vertex flag*/) && 
    410410            (cv._int & 128 /*i.e. vertex is actually a face*/)) 
    411411            _indices.push_back(_currentVertex); // Add the index only if _currentvertex is actually an index 
     
    428428                // Meaningful only when _surfacetype == 6, don' trust it for polymeshes. 
    429429                // From the docs : 
    430                 // "The 71 group specifies the number of vertices in the mesh, and the 72 group  
    431                 // specifies the number of faces. Although these counts are correct for all meshes  
    432                 // created with the PFACE command, applications are not required to place correct  
     430                // "The 71 group specifies the number of vertices in the mesh, and the 72 group 
     431                // specifies the number of faces. Although these counts are correct for all meshes 
     432                // created with the PFACE command, applications are not required to place correct 
    433433                // values in these fields.)" 
    434434                // Amusing isn't it ? 
     
    438438                // Meaningful only when _surfacetype == 6, don' trust it for polymeshes. 
    439439                // From the docs : 
    440                 // "The 71 group specifies the number of vertices in the mesh, and the 72 group  
    441                 // specifies the number of faces. Although these counts are correct for all meshes  
    442                 // created with the PFACE command, applications are not required to place correct  
     440                // "The 71 group specifies the number of vertices in the mesh, and the 72 group 
     441                // specifies the number of faces. Although these counts are correct for all meshes 
     442                // created with the PFACE command, applications are not required to place correct 
    443443                // values in these fields.)" 
    444444                // Amusing isn't it ? 
     
    488488        unsigned int ncount; 
    489489        unsigned int mcount; 
    490         if (_surfacetype == 6) {  
     490        if (_surfacetype == 6) { 
    491491            // I dont have examples of type 5 and 8, but they may be the same as 6 
    492492            mcount = _mdensity; 
    493493            ncount = _ndensity; 
    494         } else {  
     494        } else { 
    495495            mcount = _mcount; 
    496496            ncount = _ncount; 
     
    619619            sc->addTriangles(getLayer(), _color, vlist, invert_order); 
    620620 
    621     } else if (_flag & 64) {  
     621    } else if (_flag & 64) { 
    622622        unsigned short _facetype = 3; 
    623623 
     
    679679} 
    680680 
    681 void  
     681void 
    682682dxfLWPolyline::assign(dxfFile* dxf, codeValue& cv) 
    683683{ 
     
    797797    // and push it back after we fill our context 
    798798    // This is a snapshot in time. I will rewrite all this to be cleaner, 
    799     // but for now, it seems working fine  
     799    // but for now, it seems working fine 
    800800    // (with the files I have, the results are equal to Voloview, 
    801801    // and better than Deep Exploration and Lightwave). 
    802      
     802 
    803803    // sanity check (useful when no block remains after all unsupported entities have been filtered out) 
    804804    if (!_block) 
     
    840840} 
    841841 
    842 void  
     842void 
    843843dxfText::assign(dxfFile* dxf, codeValue& cv) 
    844844{ 
     
    913913    _text->setCharacterSize( _height, 1.0/_xscale ); 
    914914    _text->setFont("arial.ttf"); 
    915        
     915 
    916916    Quat qr( DegreesToRadians(_rotation), Z_AXIS ); 
    917      
     917 
    918918    if ( _flags & 2 ) qr = Quat( PI, Y_AXIS ) * qr; 
    919919    if ( _flags & 4 ) qr = Quat( PI, X_AXIS ) * qr; 
    920      
     920 
    921921    _text->setAxisAlignment(osgText::Text::USER_DEFINED_ROTATION); 
    922922    _text->setRotation(qr); 
    923     
     923 
    924924    if ( _hjustify != 0 || _vjustify !=0 ) _point1 = _point2; 
    925      
     925 
    926926    switch (_vjustify) { 
    927927    case 3: 
     
    974974        break; 
    975975    } 
    976      
     976 
    977977    _text->setAlignment(align); 
    978      
     978 
    979979    sc->addText(getLayer(), _color, _point1, _text.get()); 
    980980    sc->ocs_clear(); 
     
    983983 
    984984// static 
    985 void  
     985void 
    986986dxfEntity::registerEntity(dxfBasicEntity* entity) 
    987987{ 
     
    990990 
    991991// static 
    992 void  
     992void 
    993993dxfEntity::unregisterEntity(dxfBasicEntity* entity) 
    994994{ 
     
    10071007} 
    10081008 
    1009 void  
     1009void 
    10101010dxfEntity::assign(dxfFile* dxf, codeValue& cv) 
    10111011{ 
     
    10141014        // The funny thing here. Group code 66 has been called 'obsoleted' 
    10151015        // for a POLYLINE. But not for an INSERT. Moreover, a TABLE 
    1016         // can have a 66 for... an obscure bottom cell color value.  
     1016        // can have a 66 for... an obscure bottom cell color value. 
    10171017        // I decided to rely on the presence of the 66 code for 
    10181018        // the POLYLINE. If you find a better alternative,