1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008 Henrik Tidefelt
22 #include "shapesexceptions.h"
23 #include "lighttypes.h"
25 using namespace Shapes
;
29 RefCountPtr
< const Lang::Value
>
30 Ast::NegExpr::impl( DUMMYANDREF( const Lang::Float
) arg
, const Kernel::PassedDyn
& dyn
) const
32 return RefCountPtr
< const Lang::Value
>( new Lang::Float( - arg
->val_
) );
35 RefCountPtr
< const Lang::Value
>
36 Ast::NegExpr::impl( DUMMYANDREF( const Lang::Integer
) arg
, const Kernel::PassedDyn
& dyn
) const
38 return RefCountPtr
< const Lang::Value
>( new Lang::Integer( - arg
->val_
) );
41 RefCountPtr
< const Lang::Value
>
42 Ast::NegExpr::impl( DUMMYANDREF( const Lang::Length
) arg
, const Kernel::PassedDyn
& dyn
) const
44 return RefCountPtr
< const Lang::Value
>( new Lang::Length( - arg
->get( ) ) );
47 RefCountPtr
< const Lang::Value
>
48 Ast::NegExpr::impl( DUMMYANDREF( const Lang::FloatPair
) arg
, const Kernel::PassedDyn
& dyn
) const
50 return RefCountPtr
< const Lang::Value
>( new Lang::FloatPair( - arg
->x_
, - arg
->y_
) );
53 RefCountPtr
< const Lang::Value
>
54 Ast::NegExpr::impl( DUMMYANDREF( const Lang::Coords2D
) arg
, const Kernel::PassedDyn
& dyn
) const
56 return RefCountPtr
< const Lang::Value
>( new Lang::Coords2D( - arg
->x_
.get( ), - arg
->y_
.get( ) ) );
59 RefCountPtr
< const Lang::Value
>
60 Ast::NegExpr::impl( DUMMYANDREF( const Lang::FloatTriple
) arg
, const Kernel::PassedDyn
& dyn
) const
62 return RefCountPtr
< const Lang::Value
>( new Lang::FloatTriple( - arg
->x_
, - arg
->y_
, - arg
->z_
) );
65 RefCountPtr
< const Lang::Value
>
66 Ast::NegExpr::impl( DUMMYANDREF( const Lang::Coords3D
) arg
, const Kernel::PassedDyn
& dyn
) const
68 return RefCountPtr
< const Lang::Value
>( new Lang::Coords3D( - arg
->x_
.get( ), - arg
->y_
.get( ), - arg
->z_
.get( ) ) );
72 RefCountPtr
< const Lang::Value
>
73 Ast::RelativeExpr::impl( DUMMYANDREF( const Lang::Length
) arg
, const Kernel::PassedDyn
& dyn
) const
75 return RefCountPtr
< const Lang::Value
>( new Lang::Length( true, arg
->get( ) ) );
78 RefCountPtr
< const Lang::Value
>
79 Ast::RelativeExpr::impl( DUMMYANDREF( const Lang::Coords2D
) arg
, const Kernel::PassedDyn
& dyn
) const
81 return RefCountPtr
< const Lang::Value
>( new Lang::Coords2D( Lang::Length( true, arg
->x_
.get( ) ), Lang::Length( true, arg
->y_
.get( ) ) ) );
84 RefCountPtr
< const Lang::Value
>
85 Ast::RelativeExpr::impl( DUMMYANDREF( const Lang::Coords3D
) arg
, const Kernel::PassedDyn
& dyn
) const
87 return RefCountPtr
< const Lang::Value
>( new Lang::Coords3D( Lang::Length( true, arg
->x_
.get( ) ), Lang::Length( true, arg
->y_
.get( ) ), Lang::Length( true, arg
->z_
.get( ) ) ) );
91 RefCountPtr
< const Lang::Value
>
92 Ast::NotExpr::impl( DUMMYANDREF( const Lang::Boolean
) arg
, const Kernel::PassedDyn
& dyn
) const
94 return RefCountPtr
< const Lang::Value
>( new Lang::Boolean( ! arg
->val_
) );
98 RefCountPtr
< const Lang::Value
>
99 Ast::CycleExpr::impl( DUMMYANDREF( const Lang::PathPoint2D
) arg
, const Kernel::PassedDyn
& dyn
) const
101 const Lang::SinglePointPath2D
* tmp
= new Lang::SinglePointPath2D( arg
);
102 return impl( tmp
, RefCountPtr
< const Lang::SinglePointPath2D
>( tmp
), dyn
);
105 RefCountPtr
< const Lang::Value
>
106 Ast::CycleExpr::impl( DUMMYANDREF( const Lang::Path2D
) arg
, const Kernel::PassedDyn
& dyn
) const
108 return RefCountPtr
< const Lang::Value
>( new Lang::ClosedPath2D( arg
) );
111 RefCountPtr
< const Lang::Value
>
112 Ast::CycleExpr::impl( DUMMYANDREF( const Lang::PathPoint3D
) arg
, const Kernel::PassedDyn
& dyn
) const
114 const Lang::SinglePointPath3D
* tmp
= new Lang::SinglePointPath3D( arg
);
115 return impl( tmp
, RefCountPtr
< const Lang::SinglePointPath3D
>( tmp
), dyn
);
118 RefCountPtr
< const Lang::Value
>
119 Ast::CycleExpr::impl( DUMMYANDREF( const Lang::Path3D
) arg
, const Kernel::PassedDyn
& dyn
) const
121 return RefCountPtr
< const Lang::Value
>( new Lang::ClosedPath3D( arg
) );