Changeset View
Changeset View
Standalone View
Standalone View
objects/point_type.cc
Show First 20 Lines • Show All 282 Lines • ▼ Show 20 Line(s) | 281 | { | |||
---|---|---|---|---|---|
283 | return &t; | 283 | return &t; | ||
284 | } | 284 | } | ||
285 | 285 | | |||
286 | ObjectImp* MidPointType::calcx( const Coordinate& a, const Coordinate& b ) const | 286 | ObjectImp* MidPointType::calcx( const Coordinate& a, const Coordinate& b ) const | ||
287 | { | 287 | { | ||
288 | return new PointImp( ( a + b ) / 2 ); | 288 | return new PointImp( ( a + b ) / 2 ); | ||
289 | } | 289 | } | ||
290 | 290 | | |||
291 | static const ArgsParser::spec argsspecGoldenPoint[] = | ||||
292 | { | ||||
293 | { PointImp::stype(), I18N_NOOP( "Construct the golden ratio point of this point and another point" ), | ||||
294 | I18N_NOOP( "Select the first of the two points of which you want to construct the golden ratio point..." ), false }, | ||||
295 | { PointImp::stype(), I18N_NOOP( "Construct the golden ratio point of this point and another point" ), | ||||
296 | I18N_NOOP( "Select the other of the two points of which you want to construct the golden ratio point..." ), false } | ||||
297 | }; | ||||
298 | | ||||
299 | KIG_INSTANTIATE_OBJECT_TYPE_INSTANCE( GoldenPointType ) | ||||
300 | | ||||
301 | GoldenPointType::GoldenPointType() | ||||
302 | : ObjectABType( "GoldenPoint", argsspecGoldenPoint, 2 ) | ||||
303 | { | ||||
304 | } | ||||
305 | | ||||
306 | GoldenPointType::~GoldenPointType() | ||||
307 | { | ||||
308 | } | ||||
309 | | ||||
310 | const GoldenPointType* GoldenPointType::instance() | ||||
311 | { | ||||
312 | static const GoldenPointType t; | ||||
313 | return &t; | ||||
314 | } | ||||
315 | | ||||
316 | ObjectImp* GoldenPointType::calcx( const Coordinate& a, const Coordinate& b ) const | ||||
317 | { | ||||
318 | return new PointImp( a + (sqrt(5) - 1) * (b - a) / 2 ); | ||||
319 | } | ||||
320 | | ||||
291 | bool ConstrainedPointType::inherits( int type ) const | 321 | bool ConstrainedPointType::inherits( int type ) const | ||
292 | { | 322 | { | ||
293 | return type == ID_ConstrainedPointType; | 323 | return type == ID_ConstrainedPointType; | ||
294 | } | 324 | } | ||
295 | 325 | | |||
296 | const ConstrainedPointType* ConstrainedPointType::instance() | 326 | const ConstrainedPointType* ConstrainedPointType::instance() | ||
297 | { | 327 | { | ||
298 | static const ConstrainedPointType t; | 328 | static const ConstrainedPointType t; | ||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | 386 | { | |||
357 | return args; | 387 | return args; | ||
358 | } | 388 | } | ||
359 | 389 | | |||
360 | const ObjectImpType* MidPointType::resultId() const | 390 | const ObjectImpType* MidPointType::resultId() const | ||
361 | { | 391 | { | ||
362 | return PointImp::stype(); | 392 | return PointImp::stype(); | ||
363 | } | 393 | } | ||
364 | 394 | | |||
395 | const ObjectImpType* GoldenPointType::resultId() const | ||||
396 | { | ||||
397 | return PointImp::stype(); | ||||
398 | } | ||||
399 | | ||||
365 | QStringList FixedPointType::specialActions() const | 400 | QStringList FixedPointType::specialActions() const | ||
366 | { | 401 | { | ||
367 | QStringList ret; | 402 | QStringList ret; | ||
368 | ret << i18n( "Set &Coordinate..." ); | 403 | ret << i18n( "Set &Coordinate..." ); | ||
369 | ret << i18n( "Redefine" ); | 404 | ret << i18n( "Redefine" ); | ||
370 | return ret; | 405 | return ret; | ||
371 | } | 406 | } | ||
372 | 407 | | |||
▲ Show 20 Lines • Show All 477 Lines • Show Last 20 Lines |