(*
 * $Id$
 *
 * JSDAI(TM), a way to implement STEP, ISO 10303
 * Copyright (C) 1997-2008, LKSoftWare GmbH, Germany
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License
 * version 3 as published by the Free Software Foundation (AGPL v3).
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * JSDAI is a registered trademark of LKSoftWare GmbH, Germany
 * This software is also available under commercial licenses.
 * See also http://www.jsdai.net/
 *)

(*schema_mapping elemental_geometric_shape(Elemental_geometric_shape_arm, Elemental_geometric_shape_mim);*)

uof_mapping Elemental_Geometric_Shape(Elemental_Geometric_Shape);
(* geometric_representation_context is taken from AIM instead
entity_mapping Geometric_coordinate_space(Geometric_coordinate_space, geometric_representation_context);

mapping_constraints;

			geometric_representation_context <= representation_context
			
end_mapping_constraints;

attribute_mapping dimension_count(dimension_count, geometric_representation_context.coordinate_space_dimension);

end_attribute_mapping;

end_entity_mapping;

entity_mapping Detailed_geometric_model_element(Detailed_geometric_model_element, geometric_representation_item);

mapping_constraints;
representation_item => geometric_representation_item
			
end_mapping_constraints;

end_entity_mapping;

entity_mapping Geometric_model(Geometric_model, shape_representation);

attribute_mapping context_of_items(context_of_items, $PATH, geometric_representation_context);
shape_representation <=
representation
representation.context_of_items ->
representation_context =>
geometric_representation_context
				
end_attribute_mapping;

attribute_mapping version_id(version_id, identification_assignment.assigned_id);
shape_representation
identification_item = shape_representation
identification_item <-
applied_identification_assignment.items[i]
applied_identification_assignment <=
identification_assignment
{identification_assignment.role ->
identification_role
identification_role.name='version'}
identification_assignment.assigned_id
end_attribute_mapping;

attribute_mapping items(items, $PATH, Detailed_geometric_model_element);
shape_representation <=
representation
representation.items[i] ->
representation_item => geometric_representation_item
end_attribute_mapping;

attribute_mapping model_extent(model_extent, ((value_representation_item))((measure_representation_item)));
(
shape_representation <=
representation <-
representation_relationship.rep_1
representation_relationship
{representation_relationship.name='model extent association'}
representation_relationship.rep_2 ->
representation
{representation.name ='model extent representation'}
representation.items[i] -> representation_item
{representation_item.name ='model extent value'}
representation_item =>
value_representation_item
)(
shape_representation <=
representation <-
representation_relationship.rep_1
representation_relationship
{representation_relationship.name='model extent association'}
representation_relationship.rep_2 ->
representation
{representation.name ='model extent representation'}
representation.items[i] -> representation_item
{representation_item.name ='model extent value'}
representation_item =>
measure_representation_item
)
end_attribute_mapping;

end_entity_mapping;
*)
entity_mapping Cartesian_point(Cartesian_point, cartesian_point);

mapping_constraints;
geometric_representation_item => point
			point => cartesian_point
			
end_mapping_constraints;

attribute_mapping coordinates(coordinates, cartesian_point.coordinates);

end_attribute_mapping;

end_entity_mapping;

entity_mapping Direction(Direction, direction);

mapping_constraints;
geometric_representation_item => direction
			
end_mapping_constraints;

attribute_mapping coordinates(coordinates, direction.direction_ratios);

end_attribute_mapping;

end_entity_mapping;
(* It is everything taken from AIM
entity_mapping Axis_placement(Axis_placement, ((axis2_placement_2d))((axis2_placement_3d)));

attribute_mapping origin(origin, $PATH, Cartesian_point);
placement.location -> cartesian_point
			
end_attribute_mapping;

attribute_mapping x_axis(x_axis, ($PATH)($PATH), Direction);
(axis2_placement_2d.ref_direction -> direction
			)(axis2_placement_3d.p[1] -> direction
			)
end_attribute_mapping;

attribute_mapping y_axis(y_axis, ($PATH)($PATH), Direction);
(axis2_placement_2d.p[2] -> direction
			)(axis2_placement_3d.p[2] -> direction
			)
end_attribute_mapping;

end_entity_mapping;
*)
(*
entity_mapping Cartesian_transformation_2d(Cartesian_transformation_2d, cartesian_transformation_operator_2d
);

mapping_constraints;
geometric_representation_item => cartesian_transformation_operator
cartesian_transformation_operator => cartesian_transformation_operator_2d

end_mapping_constraints;

attribute_mapping multiplication_matrix(multiplication_matrix, $PATH, Direction);

			cartesian_transformation_operator_2d <= cartesian_transformation_operator
[cartesian_transformation_operator.axis1 -> direction]
[cartesian_transformation_operator.axis2 -> direction]
			
end_attribute_mapping;

attribute_mapping translation(translation, $PATH, Cartesian_point);

cartesian_transformation_operator_2d <= cartesian_transformation_operator
cartesian_transformation_operator.local_origin -> cartesian_point

end_attribute_mapping;

end_entity_mapping;
*)
(* Replaced by entity from AIM
entity_mapping Cartesian_transformation_3d(Cartesian_transformation_3d, cartesian_transformation_operator_3d
);

mapping_constraints;
geometric_representation_item => cartesian_transformation_operator
cartesian_transformation_operator => cartesian_transformation_operator_3d

end_mapping_constraints;

attribute_mapping multiplication_matrix(multiplication_matrix, $PATH, Direction);

[cartesian_transformation_operator_3d <= cartesian_transformation_operator
[cartesian_transformation_operator.axis1 -> ]
[cartesian_transformation_operator.axis2 -> ]]
[[cartesian_transformation_operator_3d.axis3 -> ]]
direction
			
end_attribute_mapping;

attribute_mapping translation(translation, $PATH, Cartesian_point);

cartesian_transformation_operator_3d <= cartesian_transformation_operator
cartesian_transformation_operator.local_origin -> cartesian_point

end_attribute_mapping;

end_entity_mapping;
*)
entity_mapping Axis_placement_mapping(Axis_placement_mapping, item_defined_transformation
			);

mapping_constraints;

end_mapping_constraints;

attribute_mapping source(source, $PATH, axis2_placement);

item_defined_transformation.transform_item_1 ->
representation_item
representation_item => geometric_representation_item
(geometric_representation_item => placement 
placement => axis2_placement_2d)
(geometric_representation_item => placement 
placement => axis2_placement_3d)
			
end_attribute_mapping;

attribute_mapping target(target, $PATH, axis2_placement);

item_defined_transformation.transform_item_2 ->
representation_item
representation_item => geometric_representation_item
(geometric_representation_item => placement 
placement => axis2_placement_2d)
(geometric_representation_item => placement 
placement => axis2_placement_3d)
			
end_attribute_mapping;

end_entity_mapping;

entity_mapping Axis_placement_transformation_mapping(Axis_placement_transformation_mapping, item_defined_transformation
);

mapping_constraints;

end_mapping_constraints;

attribute_mapping source(source, $PATH, axis2_placement);

item_defined_transformation.transform_item_1 ->
representation_item
representation_item => geometric_representation_item
(geometric_representation_item => placement 
placement => axis2_placement_2d)
(geometric_representation_item => placement 
placement => axis2_placement_3d)
			
end_attribute_mapping;

attribute_mapping target(target, $PATH, cartesian_transformation_operator_2d);

item_defined_transformation.transform_item_2 ->
representation_item
representation_item => geometric_representation_item
geometric_representation_item => cartesian_transformation_operator
cartesian_transformation_operator => cartesian_transformation_operator_2d
			
end_attribute_mapping;

attribute_mapping target(target, $PATH, Cartesian_transformation_operator_3d);

item_defined_transformation.transform_item_2 ->
representation_item
representation_item => geometric_representation_item
geometric_representation_item => cartesian_transformation_operator
cartesian_transformation_operator => cartesian_transformation_operator_3d
			
end_attribute_mapping;

end_entity_mapping;
end_uof_mapping;

(*end_schema_mapping;*)
