Loading 3d-viewer/vrml_v1_modelparser.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -192,7 +192,7 @@ int VRML1_MODEL_PARSER::readMaterial() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { return 0; return 0; } } Loading Loading @@ -240,7 +240,7 @@ int VRML1_MODEL_PARSER::readCoordinate3() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { return 0; return 0; } } Loading Loading @@ -268,7 +268,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { return 0; return 0; } } Loading 3d-viewer/vrml_v2_modelparser.cpp +9 −9 Original line number Original line Diff line number Diff line Loading @@ -145,7 +145,7 @@ int VRML2_MODEL_PARSER::read_Transform() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { // DBG( printf( " } Exit Transform\n" ) ); // DBG( printf( " } Exit Transform\n" ) ); break; break; Loading Loading @@ -265,7 +265,7 @@ int VRML2_MODEL_PARSER::read_DEF() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { // DBG( printf( " } Exit DEF\n") ); // DBG( printf( " } Exit DEF\n") ); return 0; return 0; Loading Loading @@ -321,7 +321,7 @@ int VRML2_MODEL_PARSER::read_Shape() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { // DBG( printf( " } Exit Shape\n") ); // DBG( printf( " } Exit Shape\n") ); return 0; return 0; Loading Loading @@ -368,7 +368,7 @@ int VRML2_MODEL_PARSER::read_Appearance() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { return 0; return 0; } } Loading Loading @@ -473,7 +473,7 @@ int VRML2_MODEL_PARSER::read_Material() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { return 0; return 0; } } Loading Loading @@ -566,7 +566,7 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { // DBG( printf( " } Exit IndexedFaceSet\n") ); // DBG( printf( " } Exit IndexedFaceSet\n") ); return 0; return 0; Loading Loading @@ -749,7 +749,7 @@ int VRML2_MODEL_PARSER::read_Color() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { // DBG( printf( " m_DiffuseColor.size: %ld\n", m_model->m_Materials->m_DiffuseColor.size() ) ); // DBG( printf( " m_DiffuseColor.size: %ld\n", m_model->m_Materials->m_DiffuseColor.size() ) ); return 0; return 0; Loading Loading @@ -779,7 +779,7 @@ int VRML2_MODEL_PARSER::read_Normal() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { // DBG( printf( " m_PerFaceNormalsNormalized.size: %lu\n", m_model->m_PerFaceNormalsNormalized.size() ) ); // DBG( printf( " m_PerFaceNormalsNormalized.size: %lu\n", m_model->m_PerFaceNormalsNormalized.size() ) ); return 0; return 0; Loading Loading @@ -817,7 +817,7 @@ int VRML2_MODEL_PARSER::read_Coordinate() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { // DBG( printf( " m_Point.size: %lu\n", m_model->m_Point.size() ) ); // DBG( printf( " m_Point.size: %lu\n", m_model->m_Point.size() ) ); return 0; return 0; Loading 3d-viewer/x3dmodelparser.cpp +3 −1 Original line number Original line Diff line number Diff line Loading @@ -384,7 +384,9 @@ bool X3D_MODEL_PARSER::parseDoubleTriplet( const wxString& aData, { { wxStringTokenizer tokens( aData ); wxStringTokenizer tokens( aData ); double x, y, z; double x = 0; double y = 0; double z = 0; bool ret = tokens.GetNextToken().ToDouble( &x ) bool ret = tokens.GetNextToken().ToDouble( &x ) && tokens.GetNextToken().ToDouble( &y ) && tokens.GetNextToken().ToDouble( &y ) Loading common/gal/stroke_font.cpp +28 −11 Original line number Original line Diff line number Diff line Loading @@ -98,7 +98,8 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe // Every coordinate description of the Hershey format has an offset, // Every coordinate description of the Hershey format has an offset, // it has to be subtracted // it has to be subtracted point.x = (double) ( coordinate[0] - 'R' ) * HERSHEY_SCALE - glyphStartX; point.x = (double) ( coordinate[0] - 'R' ) * HERSHEY_SCALE - glyphStartX; point.y = (double) ( coordinate[1] - 'R' ) * HERSHEY_SCALE; // -10 is here to keep GAL rendering consistent with the legacy gfx stuff point.y = (double) ( coordinate[1] - 'R' - 10) * HERSHEY_SCALE; pointList.push_back( point ); pointList.push_back( point ); } } Loading Loading @@ -161,25 +162,41 @@ void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRo // Single line height // Single line height int lineHeight = getInterline( ); int lineHeight = getInterline( ); int lineCount = linesCount( aText ); // The overall height of all lines of text // align the 1st line of text double textBlockHeight = lineHeight * ( linesCount( aText ) - 1 ); switch( m_verticalJustify ) switch( m_verticalJustify ) { { case GR_TEXT_VJUSTIFY_TOP: m_gal->Translate( VECTOR2D( 0, m_glyphSize.y ) ); break; case GR_TEXT_VJUSTIFY_CENTER: case GR_TEXT_VJUSTIFY_CENTER: m_gal->Translate( VECTOR2D( 0, -textBlockHeight / 2.0 ) ); m_gal->Translate( VECTOR2D( 0, m_glyphSize.y / 2.0 ) ); break; break; case GR_TEXT_VJUSTIFY_BOTTOM: case GR_TEXT_VJUSTIFY_BOTTOM: m_gal->Translate( VECTOR2D( 0, -textBlockHeight ) ); break; break; default: break; } if( lineCount > 1 ) { switch( m_verticalJustify ) { case GR_TEXT_VJUSTIFY_TOP: case GR_TEXT_VJUSTIFY_TOP: break; break; default: case GR_TEXT_VJUSTIFY_CENTER: m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight / 2) ); break; break; case GR_TEXT_VJUSTIFY_BOTTOM: m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight ) ); break; } } } m_gal->SetIsStroke( true ); m_gal->SetIsStroke( true ); Loading common/geometry/shape_collisions.cpp +22 −9 Original line number Original line Diff line number Diff line Loading @@ -175,7 +175,7 @@ static inline bool Collide( const SHAPE_CIRCLE& aA, const SHAPE_SEGMENT& aSeg, i if( col && aNeedMTV ) if( col && aNeedMTV ) { { aMTV = pushoutForce( aA, aSeg.GetSeg(), aClearance + aSeg.GetWidth() / 2); aMTV = -pushoutForce( aA, aSeg.GetSeg(), aClearance + aSeg.GetWidth() / 2); } } return col; return col; } } Loading Loading @@ -231,14 +231,26 @@ static inline bool Collide( const SHAPE_LINE_CHAIN& aA, const SHAPE_SEGMENT& aB, } } template<class ShapeAType, class ShapeBType> bool template<class ShapeAType, class ShapeBType> CollCase( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV ) inline bool CollCase( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV ) { { return Collide (*static_cast<const ShapeAType*>( aA ), return Collide (*static_cast<const ShapeAType*>( aA ), *static_cast<const ShapeBType*>( aB ), *static_cast<const ShapeBType*>( aB ), aClearance, aNeedMTV, aMTV); aClearance, aNeedMTV, aMTV); } } template<class ShapeAType, class ShapeBType> inline bool CollCaseReversed ( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV ) { bool rv = Collide (*static_cast<const ShapeBType*>( aB ), *static_cast<const ShapeAType*>( aA ), aClearance, aNeedMTV, aMTV); if(rv && aNeedMTV) aMTV = -aMTV; return rv; } bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV ) bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV ) { { switch( aA->Type() ) switch( aA->Type() ) Loading @@ -263,7 +275,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed switch( aB->Type() ) switch( aB->Type() ) { { case SH_RECT: case SH_RECT: return CollCase<SHAPE_RECT, SHAPE_CIRCLE>( aB, aA, aClearance, aNeedMTV, aMTV ); return CollCaseReversed<SHAPE_CIRCLE, SHAPE_RECT>( aA, aB, aClearance, aNeedMTV, aMTV ); case SH_CIRCLE: case SH_CIRCLE: return CollCase<SHAPE_CIRCLE, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_CIRCLE, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV ); Loading @@ -273,6 +285,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed case SH_SEGMENT: case SH_SEGMENT: return CollCase<SHAPE_CIRCLE, SHAPE_SEGMENT>( aA, aB, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_CIRCLE, SHAPE_SEGMENT>( aA, aB, aClearance, aNeedMTV, aMTV ); default: default: break; break; } } Loading Loading @@ -303,7 +316,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed return CollCase<SHAPE_RECT, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_RECT, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV ); case SH_CIRCLE: case SH_CIRCLE: return CollCase<SHAPE_CIRCLE, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV ); return CollCaseReversed<SHAPE_SEGMENT, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV ); case SH_LINE_CHAIN: case SH_LINE_CHAIN: return CollCase<SHAPE_LINE_CHAIN, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_LINE_CHAIN, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV ); Loading Loading
3d-viewer/vrml_v1_modelparser.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -192,7 +192,7 @@ int VRML1_MODEL_PARSER::readMaterial() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { return 0; return 0; } } Loading Loading @@ -240,7 +240,7 @@ int VRML1_MODEL_PARSER::readCoordinate3() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { return 0; return 0; } } Loading Loading @@ -268,7 +268,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { return 0; return 0; } } Loading
3d-viewer/vrml_v2_modelparser.cpp +9 −9 Original line number Original line Diff line number Diff line Loading @@ -145,7 +145,7 @@ int VRML2_MODEL_PARSER::read_Transform() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { // DBG( printf( " } Exit Transform\n" ) ); // DBG( printf( " } Exit Transform\n" ) ); break; break; Loading Loading @@ -265,7 +265,7 @@ int VRML2_MODEL_PARSER::read_DEF() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { // DBG( printf( " } Exit DEF\n") ); // DBG( printf( " } Exit DEF\n") ); return 0; return 0; Loading Loading @@ -321,7 +321,7 @@ int VRML2_MODEL_PARSER::read_Shape() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { // DBG( printf( " } Exit Shape\n") ); // DBG( printf( " } Exit Shape\n") ); return 0; return 0; Loading Loading @@ -368,7 +368,7 @@ int VRML2_MODEL_PARSER::read_Appearance() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { return 0; return 0; } } Loading Loading @@ -473,7 +473,7 @@ int VRML2_MODEL_PARSER::read_Material() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { return 0; return 0; } } Loading Loading @@ -566,7 +566,7 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { // DBG( printf( " } Exit IndexedFaceSet\n") ); // DBG( printf( " } Exit IndexedFaceSet\n") ); return 0; return 0; Loading Loading @@ -749,7 +749,7 @@ int VRML2_MODEL_PARSER::read_Color() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { // DBG( printf( " m_DiffuseColor.size: %ld\n", m_model->m_Materials->m_DiffuseColor.size() ) ); // DBG( printf( " m_DiffuseColor.size: %ld\n", m_model->m_Materials->m_DiffuseColor.size() ) ); return 0; return 0; Loading Loading @@ -779,7 +779,7 @@ int VRML2_MODEL_PARSER::read_Normal() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { // DBG( printf( " m_PerFaceNormalsNormalized.size: %lu\n", m_model->m_PerFaceNormalsNormalized.size() ) ); // DBG( printf( " m_PerFaceNormalsNormalized.size: %lu\n", m_model->m_PerFaceNormalsNormalized.size() ) ); return 0; return 0; Loading Loading @@ -817,7 +817,7 @@ int VRML2_MODEL_PARSER::read_Coordinate() continue; continue; } } if( ( *text == '}' ) ) if( *text == '}' ) { { // DBG( printf( " m_Point.size: %lu\n", m_model->m_Point.size() ) ); // DBG( printf( " m_Point.size: %lu\n", m_model->m_Point.size() ) ); return 0; return 0; Loading
3d-viewer/x3dmodelparser.cpp +3 −1 Original line number Original line Diff line number Diff line Loading @@ -384,7 +384,9 @@ bool X3D_MODEL_PARSER::parseDoubleTriplet( const wxString& aData, { { wxStringTokenizer tokens( aData ); wxStringTokenizer tokens( aData ); double x, y, z; double x = 0; double y = 0; double z = 0; bool ret = tokens.GetNextToken().ToDouble( &x ) bool ret = tokens.GetNextToken().ToDouble( &x ) && tokens.GetNextToken().ToDouble( &y ) && tokens.GetNextToken().ToDouble( &y ) Loading
common/gal/stroke_font.cpp +28 −11 Original line number Original line Diff line number Diff line Loading @@ -98,7 +98,8 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe // Every coordinate description of the Hershey format has an offset, // Every coordinate description of the Hershey format has an offset, // it has to be subtracted // it has to be subtracted point.x = (double) ( coordinate[0] - 'R' ) * HERSHEY_SCALE - glyphStartX; point.x = (double) ( coordinate[0] - 'R' ) * HERSHEY_SCALE - glyphStartX; point.y = (double) ( coordinate[1] - 'R' ) * HERSHEY_SCALE; // -10 is here to keep GAL rendering consistent with the legacy gfx stuff point.y = (double) ( coordinate[1] - 'R' - 10) * HERSHEY_SCALE; pointList.push_back( point ); pointList.push_back( point ); } } Loading Loading @@ -161,25 +162,41 @@ void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRo // Single line height // Single line height int lineHeight = getInterline( ); int lineHeight = getInterline( ); int lineCount = linesCount( aText ); // The overall height of all lines of text // align the 1st line of text double textBlockHeight = lineHeight * ( linesCount( aText ) - 1 ); switch( m_verticalJustify ) switch( m_verticalJustify ) { { case GR_TEXT_VJUSTIFY_TOP: m_gal->Translate( VECTOR2D( 0, m_glyphSize.y ) ); break; case GR_TEXT_VJUSTIFY_CENTER: case GR_TEXT_VJUSTIFY_CENTER: m_gal->Translate( VECTOR2D( 0, -textBlockHeight / 2.0 ) ); m_gal->Translate( VECTOR2D( 0, m_glyphSize.y / 2.0 ) ); break; break; case GR_TEXT_VJUSTIFY_BOTTOM: case GR_TEXT_VJUSTIFY_BOTTOM: m_gal->Translate( VECTOR2D( 0, -textBlockHeight ) ); break; break; default: break; } if( lineCount > 1 ) { switch( m_verticalJustify ) { case GR_TEXT_VJUSTIFY_TOP: case GR_TEXT_VJUSTIFY_TOP: break; break; default: case GR_TEXT_VJUSTIFY_CENTER: m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight / 2) ); break; break; case GR_TEXT_VJUSTIFY_BOTTOM: m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight ) ); break; } } } m_gal->SetIsStroke( true ); m_gal->SetIsStroke( true ); Loading
common/geometry/shape_collisions.cpp +22 −9 Original line number Original line Diff line number Diff line Loading @@ -175,7 +175,7 @@ static inline bool Collide( const SHAPE_CIRCLE& aA, const SHAPE_SEGMENT& aSeg, i if( col && aNeedMTV ) if( col && aNeedMTV ) { { aMTV = pushoutForce( aA, aSeg.GetSeg(), aClearance + aSeg.GetWidth() / 2); aMTV = -pushoutForce( aA, aSeg.GetSeg(), aClearance + aSeg.GetWidth() / 2); } } return col; return col; } } Loading Loading @@ -231,14 +231,26 @@ static inline bool Collide( const SHAPE_LINE_CHAIN& aA, const SHAPE_SEGMENT& aB, } } template<class ShapeAType, class ShapeBType> bool template<class ShapeAType, class ShapeBType> CollCase( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV ) inline bool CollCase( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV ) { { return Collide (*static_cast<const ShapeAType*>( aA ), return Collide (*static_cast<const ShapeAType*>( aA ), *static_cast<const ShapeBType*>( aB ), *static_cast<const ShapeBType*>( aB ), aClearance, aNeedMTV, aMTV); aClearance, aNeedMTV, aMTV); } } template<class ShapeAType, class ShapeBType> inline bool CollCaseReversed ( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV ) { bool rv = Collide (*static_cast<const ShapeBType*>( aB ), *static_cast<const ShapeAType*>( aA ), aClearance, aNeedMTV, aMTV); if(rv && aNeedMTV) aMTV = -aMTV; return rv; } bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV ) bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV ) { { switch( aA->Type() ) switch( aA->Type() ) Loading @@ -263,7 +275,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed switch( aB->Type() ) switch( aB->Type() ) { { case SH_RECT: case SH_RECT: return CollCase<SHAPE_RECT, SHAPE_CIRCLE>( aB, aA, aClearance, aNeedMTV, aMTV ); return CollCaseReversed<SHAPE_CIRCLE, SHAPE_RECT>( aA, aB, aClearance, aNeedMTV, aMTV ); case SH_CIRCLE: case SH_CIRCLE: return CollCase<SHAPE_CIRCLE, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_CIRCLE, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV ); Loading @@ -273,6 +285,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed case SH_SEGMENT: case SH_SEGMENT: return CollCase<SHAPE_CIRCLE, SHAPE_SEGMENT>( aA, aB, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_CIRCLE, SHAPE_SEGMENT>( aA, aB, aClearance, aNeedMTV, aMTV ); default: default: break; break; } } Loading Loading @@ -303,7 +316,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed return CollCase<SHAPE_RECT, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_RECT, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV ); case SH_CIRCLE: case SH_CIRCLE: return CollCase<SHAPE_CIRCLE, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV ); return CollCaseReversed<SHAPE_SEGMENT, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV ); case SH_LINE_CHAIN: case SH_LINE_CHAIN: return CollCase<SHAPE_LINE_CHAIN, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_LINE_CHAIN, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV ); Loading