diff options
Diffstat (limited to 'kig/objects/object_factory.cc')
-rw-r--r-- | kig/objects/object_factory.cc | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/kig/objects/object_factory.cc b/kig/objects/object_factory.cc index 5b1a6add..c2d7b3b5 100644 --- a/kig/objects/object_factory.cc +++ b/kig/objects/object_factory.cc @@ -109,21 +109,21 @@ ObjectTypeCalcer* ObjectFactory::relativePointCalcer( x = loc.x - reference.x; y = loc.y - reference.y; } - std::vector<ObjectCalcer*> tqparents; - tqparents.push_back( new ObjectConstCalcer( new DoubleImp( x ) ) ); - tqparents.push_back( new ObjectConstCalcer( new DoubleImp( y ) ) ); - tqparents.push_back( o ); - return new ObjectTypeCalcer( RelativePointType::instance(), tqparents ); + std::vector<ObjectCalcer*> parents; + parents.push_back( new ObjectConstCalcer( new DoubleImp( x ) ) ); + parents.push_back( new ObjectConstCalcer( new DoubleImp( y ) ) ); + parents.push_back( o ); + return new ObjectTypeCalcer( RelativePointType::instance(), parents ); } ObjectTypeCalcer* ObjectFactory::constrainedPointCalcer( ObjectCalcer* curve, double param ) const { assert( curve->imp()->inherits( CurveImp::stype() ) ); - std::vector<ObjectCalcer*> tqparents; - tqparents.push_back( new ObjectConstCalcer( new DoubleImp( param ) ) ); - tqparents.push_back( curve ); - return new ObjectTypeCalcer( ConstrainedPointType::instance(), tqparents ); + std::vector<ObjectCalcer*> parents; + parents.push_back( new ObjectConstCalcer( new DoubleImp( param ) ) ); + parents.push_back( curve ); + return new ObjectTypeCalcer( ConstrainedPointType::instance(), parents ); } ObjectHolder* ObjectFactory::constrainedPoint( @@ -152,24 +152,24 @@ ObjectTypeCalcer* ObjectFactory::locusCalcer( assert( dynamic_cast<const ObjectTypeCalcer*>( a ) ); ObjectTypeCalcer* constrained = static_cast<ObjectTypeCalcer*>( a ); assert( constrained->type()->inherits( ObjectType::ID_ConstrainedPointType ) ); - assert( constrained->tqparents().size() == 2 ); - ObjectCalcer* curve = a->tqparents().back(); + assert( constrained->parents().size() == 2 ); + ObjectCalcer* curve = a->parents().back(); const ObjectCalcer* moving = b; - std::vector<ObjectCalcer*> hiertqparents; - hiertqparents.push_back( constrained ); - std::vector<ObjectCalcer*> sideOfTree = sideOfTreePath( hiertqparents, moving ); - std::copy( sideOfTree.begin(), sideOfTree.end(), std::back_inserter( hiertqparents ) ); + std::vector<ObjectCalcer*> hierparents; + hierparents.push_back( constrained ); + std::vector<ObjectCalcer*> sideOfTree = sideOfTreePath( hierparents, moving ); + std::copy( sideOfTree.begin(), sideOfTree.end(), std::back_inserter( hierparents ) ); - ObjectHierarchy hier( hiertqparents, moving ); + ObjectHierarchy hier( hierparents, moving ); - std::vector<ObjectCalcer*> realtqparents( 2 + sideOfTree.size(), 0 ); - realtqparents[0] = new ObjectConstCalcer( new HierarchyImp( hier ) ); - realtqparents[1] = curve; - copy( sideOfTree.begin(), sideOfTree.end(), realtqparents.begin() + 2 ); + std::vector<ObjectCalcer*> realparents( 2 + sideOfTree.size(), 0 ); + realparents[0] = new ObjectConstCalcer( new HierarchyImp( hier ) ); + realparents[1] = curve; + copy( sideOfTree.begin(), sideOfTree.end(), realparents.begin() + 2 ); - return new ObjectTypeCalcer( LocusType::instance(), realtqparents ); + return new ObjectTypeCalcer( LocusType::instance(), realparents ); } ObjectHolder* ObjectFactory::locus( ObjectCalcer* a, ObjectCalcer* b ) const @@ -179,35 +179,35 @@ ObjectHolder* ObjectFactory::locus( ObjectCalcer* a, ObjectCalcer* b ) const ObjectHolder* ObjectFactory::label( const TQString& s, const Coordinate& loc, - bool needframe, const std::vector<ObjectCalcer*>& tqparents, + bool needframe, const std::vector<ObjectCalcer*>& parents, const KigDocument& doc ) const { - return new ObjectHolder( labelCalcer( s, loc, needframe, tqparents, doc ) ); + return new ObjectHolder( labelCalcer( s, loc, needframe, parents, doc ) ); } ObjectTypeCalcer* ObjectFactory::labelCalcer( const TQString& s, const Coordinate& loc, - bool needframe, const std::vector<ObjectCalcer*>& tqparents, + bool needframe, const std::vector<ObjectCalcer*>& parents, const KigDocument& doc ) const { - return attachedLabelCalcer( s, 0, loc, needframe, tqparents, doc ); + return attachedLabelCalcer( s, 0, loc, needframe, parents, doc ); } ObjectTypeCalcer* ObjectFactory::attachedLabelCalcer( const TQString& s, ObjectCalcer* p, const Coordinate& loc, bool needframe, - const std::vector<ObjectCalcer*>& ntqparents, + const std::vector<ObjectCalcer*>& nparents, const KigDocument& doc ) const { - std::vector<ObjectCalcer*> tqparents; - tqparents.reserve( ntqparents.size() + 3 ); - tqparents.push_back( new ObjectConstCalcer( new IntImp( needframe ? 1 : 0 ) ) ); + std::vector<ObjectCalcer*> parents; + parents.reserve( nparents.size() + 3 ); + parents.push_back( new ObjectConstCalcer( new IntImp( needframe ? 1 : 0 ) ) ); - tqparents.push_back( getAttachPoint( p, loc, doc ) ); + parents.push_back( getAttachPoint( p, loc, doc ) ); - tqparents.push_back( new ObjectConstCalcer( new StringImp( s ) ) ); - std::copy( ntqparents.begin(), ntqparents.end(), std::back_inserter( tqparents ) ); - ObjectTypeCalcer* ret = new ObjectTypeCalcer( TextType::instance(), tqparents ); + parents.push_back( new ObjectConstCalcer( new StringImp( s ) ) ); + std::copy( nparents.begin(), nparents.end(), std::back_inserter( parents ) ); + ObjectTypeCalcer* ret = new ObjectTypeCalcer( TextType::instance(), parents ); ret->calc( doc ); return ret; } @@ -268,10 +268,10 @@ ObjectCalcer* ObjectFactory::getAttachPoint( ObjectHolder* ObjectFactory::attachedLabel( const TQString& s, ObjectCalcer* locationtqparent, const Coordinate& loc, bool needframe, - const std::vector<ObjectCalcer*>& tqparents, + const std::vector<ObjectCalcer*>& parents, const KigDocument& doc ) const { - return new ObjectHolder( attachedLabelCalcer( s, locationtqparent, loc, needframe, tqparents, doc ) ); + return new ObjectHolder( attachedLabelCalcer( s, locationtqparent, loc, needframe, parents, doc ) ); } ObjectPropertyCalcer* ObjectFactory::propertyObjectCalcer( @@ -321,15 +321,15 @@ void ObjectFactory::redefinePoint( // point already was constrained -> simply update the param // DataObject and make sure point is on the right curve... ObjectCalcer* dataobj = 0; - std::vector<ObjectCalcer*> tqparents = point->tqparents(); - assert( tqparents.size() == 2 ); - assert ( tqparents[0]->imp()->inherits( DoubleImp::stype() ) ); - dataobj = tqparents[0]; - - tqparents.clear(); - tqparents.push_back( dataobj ); - tqparents.push_back( v ); - point->setParents( tqparents ); + std::vector<ObjectCalcer*> parents = point->parents(); + assert( parents.size() == 2 ); + assert ( parents[0]->imp()->inherits( DoubleImp::stype() ) ); + dataobj = parents[0]; + + parents.clear(); + parents.push_back( dataobj ); + parents.push_back( v ); + point->setParents( parents ); assert( dynamic_cast<ObjectConstCalcer*>( dataobj ) ); static_cast<ObjectConstCalcer*>( dataobj )->setImp( |