diff options
Diffstat (limited to 'kig/misc/special_constructors.cc')
-rw-r--r-- | kig/misc/special_constructors.cc | 148 |
1 files changed, 74 insertions, 74 deletions
diff --git a/kig/misc/special_constructors.cc b/kig/misc/special_constructors.cc index ccb92ac6..0806f09b 100644 --- a/kig/misc/special_constructors.cc +++ b/kig/misc/special_constructors.cc @@ -68,7 +68,7 @@ public: ConicConicIntersectionConstructor(); ~ConicConicIntersectionConstructor(); - void drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, + void drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, const KigDocument& ) const; std::vector<ObjectHolder*> build( const std::vector<ObjectCalcer*>& os, KigDocument& d, KigWidget& w ) const; void plug( KigPart* doc, KigGUIAction* kact ); @@ -109,13 +109,13 @@ ConicRadicalConstructor::~ConicRadicalConstructor() } void ConicRadicalConstructor::drawprelim( - const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, const KigDocument& doc ) const + const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, const KigDocument& doc ) const { - if ( tqparents.size() == 2 && tqparents[0]->imp()->inherits( ConicImp::stype() ) && - tqparents[1]->imp()->inherits( ConicImp::stype() ) ) + if ( parents.size() == 2 && parents[0]->imp()->inherits( ConicImp::stype() ) && + parents[1]->imp()->inherits( ConicImp::stype() ) ) { Args args; - std::transform( tqparents.begin(), tqparents.end(), + std::transform( parents.begin(), parents.end(), std::back_inserter( args ), std::mem_fun( &ObjectCalcer::imp ) ); for ( int i = -1; i < 2; i += 2 ) { @@ -170,27 +170,27 @@ LocusConstructor::~LocusConstructor() { } -void LocusConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, +void LocusConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, const KigDocument& ) const { // this function is rather ugly, but it is necessary to do it this // way in order to play nice with Kig's design.. - if ( tqparents.size() != 2 ) return; - const ObjectTypeCalcer* constrained = dynamic_cast<ObjectTypeCalcer*>( tqparents.front() ); - const ObjectCalcer* moving = tqparents.back(); + if ( parents.size() != 2 ) return; + const ObjectTypeCalcer* constrained = dynamic_cast<ObjectTypeCalcer*>( parents.front() ); + const ObjectCalcer* moving = parents.back(); if ( ! constrained || ! constrained->type()->inherits( ObjectType::ID_ConstrainedPointType ) ) { // moving is in fact the constrained point.. swap them.. - moving = tqparents.front(); - constrained = dynamic_cast<const ObjectTypeCalcer*>( tqparents.back() ); + moving = parents.front(); + constrained = dynamic_cast<const ObjectTypeCalcer*>( parents.back() ); assert( constrained ); }; assert( constrained->type()->inherits( ObjectType::ID_ConstrainedPointType ) ); - const ObjectImp* oimp = constrained->tqparents().back()->imp(); + const ObjectImp* oimp = constrained->parents().back()->imp(); if( !oimp->inherits( CurveImp::stype() ) ) - oimp = constrained->tqparents().front()->imp(); + oimp = constrained->parents().front()->imp(); assert( oimp->inherits( CurveImp::stype() ) ); const CurveImp* cimp = static_cast<const CurveImp*>( oimp ); @@ -222,18 +222,18 @@ const int LocusConstructor::wantArgs( return ArgsParser::Invalid; } -std::vector<ObjectHolder*> LocusConstructor::build( const std::vector<ObjectCalcer*>& tqparents, KigDocument&, KigWidget& ) const +std::vector<ObjectHolder*> LocusConstructor::build( const std::vector<ObjectCalcer*>& parents, KigDocument&, KigWidget& ) const { std::vector<ObjectHolder*> ret; - assert( tqparents.size() == 2 ); + assert( parents.size() == 2 ); - ObjectTypeCalcer* constrained = dynamic_cast<ObjectTypeCalcer*>( tqparents.front() ); - ObjectCalcer* moving = tqparents.back(); + ObjectTypeCalcer* constrained = dynamic_cast<ObjectTypeCalcer*>( parents.front() ); + ObjectCalcer* moving = parents.back(); if ( ! constrained || ! constrained->type()->inherits( ObjectType::ID_ConstrainedPointType ) ) { // moving is in fact the constrained point.. swap them.. - moving = tqparents.front(); - constrained = dynamic_cast<ObjectTypeCalcer*>( tqparents.back() ); + moving = parents.front(); + constrained = dynamic_cast<ObjectTypeCalcer*>( parents.back() ); assert( constrained ); }; assert( constrained->type()->inherits( ObjectType::ID_ConstrainedPointType ) ); @@ -374,21 +374,21 @@ TQString PolygonBNPTypeConstructor::selectStatement( return i18n("Select a point to be a vertex of the new polygon..."); } -void PolygonBNPTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, +void PolygonBNPTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, const KigDocument& ) const { - if ( tqparents.size() < 2 ) return; + if ( parents.size() < 2 ) return; std::vector<Coordinate> points; - for ( uint i = 0; i < tqparents.size(); ++i ) + for ( uint i = 0; i < parents.size(); ++i ) { const Coordinate vertex = - static_cast<const PointImp*>( tqparents[i]->imp() )->coordinate(); + static_cast<const PointImp*>( parents[i]->imp() )->coordinate(); points.push_back( vertex ); } - if ( tqparents.size() == 2 ) + if ( parents.size() == 2 ) { SegmentImp segment = SegmentImp( points[0], points[1] ); drawer.draw( segment, p, true ); @@ -398,12 +398,12 @@ void PolygonBNPTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPaint } } -std::vector<ObjectHolder*> PolygonBNPTypeConstructor::build( const std::vector<ObjectCalcer*>& tqparents, KigDocument&, KigWidget& ) const +std::vector<ObjectHolder*> PolygonBNPTypeConstructor::build( const std::vector<ObjectCalcer*>& parents, KigDocument&, KigWidget& ) const { - uint count = tqparents.size() - 1; + uint count = parents.size() - 1; assert ( count >= 3 ); std::vector<ObjectCalcer*> args; - for ( uint i = 0; i < count; ++i ) args.push_back( tqparents[i] ); + for ( uint i = 0; i < count; ++i ) args.push_back( parents[i] ); ObjectTypeCalcer* calcer = new ObjectTypeCalcer( mtype, args ); ObjectHolder* h = new ObjectHolder( calcer ); std::vector<ObjectHolder*> ret; @@ -443,12 +443,12 @@ PolygonVertexTypeConstructor::~PolygonVertexTypeConstructor() { } -void PolygonVertexTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, +void PolygonVertexTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, const KigDocument& ) const { - if ( tqparents.size() != 1 ) return; + if ( parents.size() != 1 ) return; - const PolygonImp* polygon = dynamic_cast<const PolygonImp*>( tqparents.front()->imp() ); + const PolygonImp* polygon = dynamic_cast<const PolygonImp*>( parents.front()->imp() ); const std::vector<Coordinate> points = polygon->points(); int sides = points.size(); @@ -459,11 +459,11 @@ void PolygonVertexTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPa } } -std::vector<ObjectHolder*> PolygonVertexTypeConstructor::build( const std::vector<ObjectCalcer*>& tqparents, KigDocument&, KigWidget& ) const +std::vector<ObjectHolder*> PolygonVertexTypeConstructor::build( const std::vector<ObjectCalcer*>& parents, KigDocument&, KigWidget& ) const { std::vector<ObjectHolder*> ret; - assert( tqparents.size() == 1 ); - const PolygonImp* polygon = dynamic_cast<const PolygonImp*>( tqparents.front()->imp() ); + assert( parents.size() == 1 ); + const PolygonImp* polygon = dynamic_cast<const PolygonImp*>( parents.front()->imp() ); const std::vector<Coordinate> points = polygon->points(); int sides = points.size(); @@ -471,7 +471,7 @@ std::vector<ObjectHolder*> PolygonVertexTypeConstructor::build( const std::vecto for ( int i = 0; i < sides; ++i ) { ObjectConstCalcer* d = new ObjectConstCalcer( new IntImp( i ) ); - std::vector<ObjectCalcer*> args( tqparents ); + std::vector<ObjectCalcer*> args( parents ); args.push_back( d ); ret.push_back( new ObjectHolder( new ObjectTypeCalcer( mtype, args ) ) ); } @@ -510,12 +510,12 @@ PolygonSideTypeConstructor::~PolygonSideTypeConstructor() { } -void PolygonSideTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, +void PolygonSideTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, const KigDocument& ) const { - if ( tqparents.size() != 1 ) return; + if ( parents.size() != 1 ) return; - const PolygonImp* polygon = dynamic_cast<const PolygonImp*>( tqparents.front()->imp() ); + const PolygonImp* polygon = dynamic_cast<const PolygonImp*>( parents.front()->imp() ); const std::vector<Coordinate> points = polygon->points(); uint sides = points.size(); @@ -527,11 +527,11 @@ void PolygonSideTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPain } } -std::vector<ObjectHolder*> PolygonSideTypeConstructor::build( const std::vector<ObjectCalcer*>& tqparents, KigDocument&, KigWidget& ) const +std::vector<ObjectHolder*> PolygonSideTypeConstructor::build( const std::vector<ObjectCalcer*>& parents, KigDocument&, KigWidget& ) const { std::vector<ObjectHolder*> ret; - assert( tqparents.size() == 1 ); - const PolygonImp* polygon = dynamic_cast<const PolygonImp*>( tqparents.front()->imp() ); + assert( parents.size() == 1 ); + const PolygonImp* polygon = dynamic_cast<const PolygonImp*>( parents.front()->imp() ); const std::vector<Coordinate> points = polygon->points(); uint sides = points.size(); @@ -539,7 +539,7 @@ std::vector<ObjectHolder*> PolygonSideTypeConstructor::build( const std::vector< for ( uint i = 0; i < sides; ++i ) { ObjectConstCalcer* d = new ObjectConstCalcer( new IntImp( i ) ); - std::vector<ObjectCalcer*> args( tqparents ); + std::vector<ObjectCalcer*> args( parents ); args.push_back( d ); ret.push_back( new ObjectHolder( new ObjectTypeCalcer( mtype, args ) ) ); } @@ -700,17 +700,17 @@ void PolygonBCVConstructor::handlePrelim( delete_all( args.begin() + 2, args.end() ); } -std::vector<ObjectHolder*> PolygonBCVConstructor::build( const std::vector<ObjectCalcer*>& tqparents, KigDocument&, KigWidget& ) const +std::vector<ObjectHolder*> PolygonBCVConstructor::build( const std::vector<ObjectCalcer*>& parents, KigDocument&, KigWidget& ) const { - assert ( tqparents.size() == 3 ); + assert ( parents.size() == 3 ); std::vector<ObjectCalcer*> args; - Coordinate c = static_cast<const PointImp*>( tqparents[0]->imp() )->coordinate(); - Coordinate v = static_cast<const PointImp*>( tqparents[1]->imp() )->coordinate(); - Coordinate cntrl = static_cast<const PointImp*>( tqparents[2]->imp() )->coordinate(); + Coordinate c = static_cast<const PointImp*>( parents[0]->imp() )->coordinate(); + Coordinate v = static_cast<const PointImp*>( parents[1]->imp() )->coordinate(); + Coordinate cntrl = static_cast<const PointImp*>( parents[2]->imp() )->coordinate(); - args.push_back( tqparents[0] ); - args.push_back( tqparents[1] ); + args.push_back( parents[0] ); + args.push_back( parents[1] ); int winding = 0; int nsides = computeNsides( c, v, cntrl, winding ); ObjectConstCalcer* d = new ObjectConstCalcer( new IntImp( nsides ) ); @@ -789,20 +789,20 @@ TQString PolygonBCVConstructor::selectStatement( return ""; } -void PolygonBCVConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, +void PolygonBCVConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, const KigDocument& doc ) const { - if ( tqparents.size() < 3 || tqparents.size() > 4 ) return; + if ( parents.size() < 3 || parents.size() > 4 ) return; - assert ( tqparents[0]->imp()->inherits( PointImp::stype() ) && - tqparents[1]->imp()->inherits( PointImp::stype() ) && - tqparents[2]->imp()->inherits( IntImp::stype() ) ); + assert ( parents[0]->imp()->inherits( PointImp::stype() ) && + parents[1]->imp()->inherits( PointImp::stype() ) && + parents[2]->imp()->inherits( IntImp::stype() ) ); - if ( tqparents.size() == 4 ) - assert ( tqparents[3]->imp()->inherits( IntImp::stype() ) ); + if ( parents.size() == 4 ) + assert ( parents[3]->imp()->inherits( IntImp::stype() ) ); Args args; - std::transform( tqparents.begin(), tqparents.end(), + std::transform( parents.begin(), parents.end(), std::back_inserter( args ), std::mem_fun( &ObjectCalcer::imp ) ); ObjectImp* data = mtype->calc( args, doc ); @@ -878,16 +878,16 @@ ConicConicIntersectionConstructor::~ConicConicIntersectionConstructor() { } -void ConicConicIntersectionConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, +void ConicConicIntersectionConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, const KigDocument& ) const { - if ( tqparents.size() != 2 ) return; - assert ( tqparents[0]->imp()->inherits( ConicImp::stype() ) && - tqparents[1]->imp()->inherits( ConicImp::stype() ) ); + if ( parents.size() != 2 ) return; + assert ( parents[0]->imp()->inherits( ConicImp::stype() ) && + parents[1]->imp()->inherits( ConicImp::stype() ) ); const ConicCartesianData conica = - static_cast<const ConicImp*>( tqparents[0]->imp() )->cartesianData(); + static_cast<const ConicImp*>( parents[0]->imp() )->cartesianData(); const ConicCartesianData conicb = - static_cast<const ConicImp*>( tqparents[1]->imp() )->cartesianData(); + static_cast<const ConicImp*>( parents[1]->imp() )->cartesianData(); bool ok = true; for ( int wr = -1; wr < 2; wr += 2 ) { @@ -1190,12 +1190,12 @@ void MeasureTransportConstructor::handlePrelim( void MeasureTransportConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, - const std::vector<ObjectCalcer*>& tqparents, + const std::vector<ObjectCalcer*>& parents, const KigDocument& doc ) const { Args args; using namespace std; - transform( tqparents.begin(), tqparents.end(), + transform( parents.begin(), parents.end(), back_inserter( args ), mem_fun( &ObjectCalcer::imp ) ); ObjectImp* data = mtype->calc( args, doc ); drawer.draw( *data, p, true ); @@ -1236,13 +1236,13 @@ TQString MeasureTransportConstructor::selectStatement( } std::vector<ObjectHolder*> MeasureTransportConstructor::build( - const std::vector<ObjectCalcer*>& tqparents, + const std::vector<ObjectCalcer*>& parents, KigDocument&, KigWidget& ) const { - assert ( tqparents.size() == 3 ); + assert ( parents.size() == 3 ); // std::vector<ObjectCalcer*> args; -// for ( uint i = 0; i < count; ++i ) args.push_back( tqparents[i] ); - ObjectTypeCalcer* calcer = new ObjectTypeCalcer( mtype, tqparents ); +// for ( uint i = 0; i < count; ++i ) args.push_back( parents[i] ); + ObjectTypeCalcer* calcer = new ObjectTypeCalcer( mtype, parents ); ObjectHolder* h = new ObjectHolder( calcer ); std::vector<ObjectHolder*> ret; ret.push_back( h ); @@ -1386,15 +1386,15 @@ MidPointOfTwoPointsConstructor::~MidPointOfTwoPointsConstructor() } void MidPointOfTwoPointsConstructor::drawprelim( - const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, + const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, const KigDocument& ) const { - if ( tqparents.size() != 2 ) return; - assert( tqparents[0]->imp()->inherits( PointImp::stype() ) ); - assert( tqparents[1]->imp()->inherits( PointImp::stype() ) ); + if ( parents.size() != 2 ) return; + assert( parents[0]->imp()->inherits( PointImp::stype() ) ); + assert( parents[1]->imp()->inherits( PointImp::stype() ) ); const Coordinate m = - ( static_cast<const PointImp*>( tqparents[0]->imp() )->coordinate() + - static_cast<const PointImp*>( tqparents[1]->imp() )->coordinate() ) / 2; + ( static_cast<const PointImp*>( parents[0]->imp() )->coordinate() + + static_cast<const PointImp*>( parents[1]->imp() )->coordinate() ) / 2; drawer.draw( PointImp( m ), p, true ); } |