karbon
vtransformnodes.cc00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "vpath.h"
00022 #include "vsegment.h"
00023 #include "vtransformnodes.h"
00024
00025
00026 VTransformNodes::VTransformNodes( const QWMatrix& m )
00027 : m_matrix( m )
00028 {
00029 }
00030
00031 void
00032 VTransformNodes::visitVSubpath( VSubpath& path )
00033 {
00034 path.first();
00035 while( path.current() )
00036 {
00037 if( path.current()->isCurve() )
00038 {
00039 if( !path.current()->knotIsSelected() &&
00040 path.current()->pointIsSelected( 1 ) &&
00041 path.current()->next() &&
00042 path.current()->next()->isCurve() &&
00043 !path.current()->next()->pointIsSelected( 0 ) &&
00044 path.current()->isSmooth() )
00045 {
00046
00047 QWMatrix m2( m_matrix.m11(), m_matrix.m12(), m_matrix.m21(), m_matrix.m22(),
00048 -m_matrix.dx(), -m_matrix.dy() );
00049 path.current()->next()->setPoint( 0, path.current()->next()->point( 0 ).transform( m2 ) );
00050 }
00051 if( path.current()->pointIsSelected( 0 ) &&
00052 path.current()->prev() &&
00053 path.current()->prev()->isCurve() &&
00054 !path.current()->prev()->knotIsSelected() &&
00055 !path.current()->prev()->pointIsSelected( 1 ) &&
00056 path.current()->prev()->isSmooth() )
00057 {
00058
00059 QWMatrix m2( m_matrix.m11(), m_matrix.m12(), m_matrix.m21(), m_matrix.m22(),
00060 -m_matrix.dx(), -m_matrix.dy() );
00061 path.current()->prev()->setPoint( 1, path.current()->prev()->point( 1 ).transform( m2 ) );
00062 }
00063 }
00064
00065 for( uint i = 0; i < path.current()->degree(); ++i )
00066 {
00067 if( path.current()->pointIsSelected( i ) )
00068 path.current()->setPoint( i, path.current()->point( i ).transform( m_matrix ) );
00069 }
00070
00071 if( !success() )
00072 setSuccess();
00073 path.next();
00074 }
00075 }
00076
|