(*
 * $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/
 *)

(*
   Derived from ISO TC184/SC4/WG12 N - ISO/CD-TS 10303-xxxx Part feature location - EXPRESS ARM
   by LKSoftWare GmbH for implementation purpose within IDA-STEP(TM)
*)

SCHEMA Part_feature_location_xim;

USE FROM Shape_feature_xim;	-- ISO/TS 10303-xxxx

USE FROM Part_feature_location_mim;


--REFERENCE FROM Non_feature_shape_element_xim 
--	(Non_feature_shape_model,
--	Usage_view_level_non_feature_shape_model);

    TYPE feature_or_non_feature_usage = EXTENSIBLE GENERIC_ENTITY SELECT;
	END_TYPE;
	
	TYPE usage_concept = EXTENSIBLE GENERIC_ENTITY SELECT;
	END_TYPE;

  ENTITY Usage_concept_usage_relationship_armx
    SUBTYPE OF (Geometric_placement_operation, usage_concept_usage_relationship);
       SELF\Geometric_placement_operation.template_definition RENAMED associated_shape_definition    : shape_representation;
       SELF\item_identified_representation_usage.definition RENAMED associated_usage                 : usage_concept;
       SELF\item_identified_representation_usage.used_representation RENAMED associating_usage_shape : feature_or_non_feature_usage;
     DERIVE
       SELF\item_identified_representation_usage.name : label :=?;
       SELF\representation_item.name : label := ?;
     INVERSE
       composed_model : SET[1:1] OF shape_representation FOR items;
     WHERE
       WR1 : (  ('NON_FEATURE_SHAPE_ELEMENT_XIM.NON_FEATURE_SHAPE_MODEL' IN TYPEOF(associated_shape_definition)) AND 
                ('NON_FEATURE_SHAPE_ELEMENT_XIM.NON_FEATURE_SHAPE_MODEL' IN TYPEOF(associating_usage_shape))) OR 
             (('ELEMENTAL_GEOMETRIC_SHAPE_XIM.SHAPE_REPRESENTATION' IN TYPEOF(associated_shape_definition)) AND 
              ('ELEMENTAL_GEOMETRIC_SHAPE_XIM.SHAPE_REPRESENTATION' IN TYPEOF(associating_usage_shape)));
       WR2 : NOT ( ('PART_FEATURE_LOCATION_XIM.GEOMETRIC_OPERATOR_TRANSFORMATION' IN
               TYPEOF(SELF)) AND ('PART_FEATURE_LOCATION_XIM.CARTESIAN_TRANSFORMATION_2D' IN 
               TYPEOF(SELF\Geometric_operator_transformation.target))) OR 
             ('NON_FEATURE_SHAPE_ELEMENT_XIM.NON_FEATURE_SHAPE_MODEL' IN TYPEOF(associating_usage_shape));  
       WR3 : associating_usage_shape = composed_model[1]; 
       WR4 : NOT EXISTS(SELF\Representation_item.name);
       WR5 : ('CONTEXTUAL_SHAPE_POSITIONING_XIM.GEOMETRIC_PLACEMENT' IN TYPEOF(SELF)) OR
             ('CONTEXTUAL_SHAPE_POSITIONING_XIM.GEOMETRIC_OPERATOR_TRANSFORMATION' IN TYPEOF(SELF));
       WR6 : NOT('CONTEXTUAL_SHAPE_POSITIONING_XIM.GEOMETRIC_PLACEMENT_MODEL' IN TYPEOF(composed_model[1]));
  END_ENTITY;


END_SCHEMA;


