(*
   $Id$
   ISO TC184/SC4/WG12 N4125 - ISO/TS 10303-1726 Physical unit 2d shape - EXPRESS ARM
   Supersedes ISO TC184/SC4/WG12 N3558
*)

SCHEMA Physical_unit_2d_shape_arm;

USE FROM Non_feature_shape_element_arm;	-- ISO/TS 10303-1706
USE FROM Layered_2d_shape_arm; -- ISO/TS 10303-1693

REFERENCE FROM Requirement_decomposition_arm(get_rvd);	-- ISO/TS 10303-1740


  SUBTYPE_CONSTRAINT planar_shape_model_subtypes FOR Planar_shape_model;  
    (ONEOF (Planar_projected_shape_model,
	Physical_unit_planar_keepout_shape_model));
  END_SUBTYPE_CONSTRAINT; 

  TYPE pu2ds_external_identification_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON external_identification_item WITH  
    (Physical_unit_planar_shape_model);
  END_TYPE;

  TYPE pu2ds_physical_unit_shape_model_select = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON physical_unit_shape_model_select WITH 
    (Physical_unit_planar_shape_model);
  END_TYPE; 

  TYPE pu2ds_feature_or_non_feature_usage = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON feature_or_non_feature_usage WITH 
    (part_template_or_physical_unit_2d_shape_select);
  END_TYPE;

  TYPE pu2ds_view_shape_select = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON view_shape_select WITH 
    (Physical_unit_shape_model);
  END_TYPE; 

  TYPE pu2ds_part_template_or_physical_unit_2d_shape_select = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON part_template_or_physical_unit_2d_shape_select WITH 
    (Physical_unit_planar_shape_model);
  END_TYPE;

  TYPE predefined_planar_purpose = ENUMERATION OF
    (analysis_input,
     analysis_output,
     shock_analysis_input,
     shock_analysis_output,
     assembly_symbol,
     design,
     design_profile,
     vibration_analysis_input,
     vibration_analysis_output,
     electromagnetic_compatibility_analysis_input,
     electromagnetic_compatibility_analysis_output,
     physical_extent,
     thermal_analysis_input,
     thermal_analysis_output);
  END_TYPE;

  TYPE pu2ds_shape_location = ENUMERATION OF
    (above,
     below,
     congruent);
  END_TYPE;

  TYPE pu2ds_shape_side = ENUMERATION OF
    (same_side,
     opposite_side,
     both_sides);
  END_TYPE;

  TYPE pu2ds_component_application = ENUMERATION OF
    (compliant_components_permitted,
     no_components_permitted);
  END_TYPE;

  ENTITY Physical_unit_planar_keepout_shape_model
    SUBTYPE OF (Planar_shape_model,
 			Usage_view_level_non_feature_shape_model,
 			Physical_unit_keepout_shape_model);
      SELF\Usage_view_level_non_feature_shape_model.model_shape : Physical_unit_shape_model;
      component_application                                    : pu2ds_component_application;
      shape_distance_from_seating_plane                        : OPTIONAL Length_tolerance_characteristic;
      shape_location_with_respect_to_seating_plane             : OPTIONAL pu2ds_shape_location;
      side                                                     : OPTIONAL pu2ds_shape_side;
      extrusion                                                : OPTIONAL BOOLEAN;
	DERIVE
  		application_technology_constraint: SET[0:?] OF Requirement_view_definition :=
		  get_rvd(SELF, 'application technology constraint');
    WHERE
      WR1 : NOT ((pu2ds_shape_location.congruent = shape_location_with_respect_to_seating_plane) AND (EXISTS(shape_distance_from_seating_plane)));
   	  WR2 : (SIZEOF(application_technology_constraint) <= 1);
   	  WR3 : NOT EXISTS(SELF\Representation.name);
   	  WR4 : NOT EXISTS(SELF\Representation.description);
   	  WR5 : NOT EXISTS(shape_distance_from_seating_plane) OR EXISTS(shape_location_with_respect_to_seating_plane);
   	  WR6 : NOT ('PACKAGE_ARM.PACKAGE' IN TYPEOF(model_shape.shape_characterized_definition)) OR
   	        EXISTS(shape_distance_from_seating_plane);
      WR7 : NOT EXISTS(side) OR ('PACKAGE_ARM.PACKAGE' IN TYPEOF(model_shape.shape_characterized_definition));
      WR8 : NOT EXISTS(extrusion) OR EXISTS(side);
  END_ENTITY;

  ENTITY Physical_unit_planar_shape_model
    SUBTYPE OF (Planar_projected_shape_model, Physical_unit_shape_model);
      shape_distance_from_seating_plane            : OPTIONAL Length_tolerance_characteristic;
      shape_location_with_respect_to_seating_plane : OPTIONAL pu2ds_shape_location;
      shape_purpose                                : OPTIONAL predefined_planar_purpose;
	DERIVE
  		application_technology_constraint: SET[0:?] OF Requirement_view_definition :=
                                           get_rvd(SELF, 'application technology constraint');
    INVERSE
	  external_shape_purpose : SET [0:1] OF External_source_identification FOR item;      
	WHERE
	  WR1: (EXISTS (shape_purpose)) XOR ((SIZEOF(external_shape_purpose)) = 1);
   	  WR2 : (SIZEOF(application_technology_constraint) <= 1);	  
   	  WR3 : NOT EXISTS(SELF\Representation.description);
   	  WR4 : NOT (EXISTS(shape_distance_from_seating_plane) XOR EXISTS(shape_location_with_respect_to_seating_plane));
      WR5 : NOT (('PACKAGE_ARM.PACKAGE' IN TYPEOF(SELF\Physical_unit_shape_model.shape_characterized_definition)) XOR
   	        EXISTS(shape_distance_from_seating_plane));
  END_ENTITY;

END_SCHEMA;
