(*
   $Id$
   ISO TC184/SC4/WG12 N4778 - ISO/CD-TS 10303-1308 Picture representation - EXPRESS MIM
*)

SCHEMA Picture_representation_mim;

USE FROM Binary_representation_mim; -- ISO/CD-TS 10303-1369

USE FROM Presentation_hierarchy_mim; -- ISO/CD-TS 10303-1330

USE FROM presentation_organization_schema 
  (presentation_area, 
  presentation_size,
  area_in_set) ;

USE FROM presentation_resource_schema (planar_box);

USE FROM geometry_schema (axis2_placement_2d);
  
  CONSTANT 
    pre_defined_picture_representation_types : SET [0:?] OF STRING := [ 'JPEG', 'PNG', 'TIFF', 'BMP', 'GIF']; 
  END_CONSTANT;  

  TYPE picture_representation_item_select = SELECT (
    styled_item,
    picture_representation_item, 
    planar_box,
    axis2_placement_2d); 
  END_TYPE; 

  TYPE pr_external_identification_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON external_identification_item WITH  
    (externally_defined_picture_representation_item);
  END_TYPE;

  ENTITY externally_defined_picture_representation_item 
    SUBTYPE OF (picture_representation_item); 
    INVERSE 
      source : applied_external_identification_assignment FOR items; 
    WHERE 
      WR1: NOT (SELF\representation_item.name IN pre_defined_picture_representation_types); 
  END_ENTITY; 

  ENTITY picture_representation
    SUBTYPE OF (presentation_view);
      SELF\representation.items : SET[2:?] OF picture_representation_item_select;
    INVERSE
      size : presentation_size FOR unit;
  WHERE
    WR1: SIZEOF(QUERY(items <* SELF\representation.items | 'PICTURE_REPRESENTATION_MIM.PICTURE_REPRESENTATION_ITEM' IN TYPEOF(items))) = 1;
  END_ENTITY;
 
  ENTITY picture_representation_item 
    ABSTRACT SUPERTYPE OF (ONEOF(externally_defined_picture_representation_item, predefined_picture_representation_item))
    SUBTYPE OF (bytes_representation_item);
  END_ENTITY; 
 
  ENTITY predefined_picture_representation_item 
    SUBTYPE OF (picture_representation_item); 
    WHERE 
      WR1: SELF\representation_item.name IN pre_defined_picture_representation_types; 
  END_ENTITY; 
 
END_SCHEMA;