(*
ISO TC184/SC4/WG12 N4830 - ISO/CD 10303-46 Visual presentation - EXPRESS
*) 


SCHEMA presentation_appearance_schema;
 
REFERENCE FROM external_reference_schema
    (externally_defined_item,
     pre_defined_item);

REFERENCE FROM geometry_schema
    (axis2_placement,
     b_spline_curve, 
     cartesian_point,
     composite_curve,
     curve,
     geometric_representation_item,
     point,
     polyline, 
     vector);

REFERENCE FROM group_schema
  (group);

REFERENCE FROM measure_schema
    (descriptive_measure,
     length_measure,
     measure_with_unit,
     plane_angle_measure,
     positive_length_measure,
     ratio_measure,
     positive_ratio_measure);

REFERENCE FROM presentation_organization_schema
     (area_dependent_annotation_representation,
      presentation_area,
      presentation_layer_assignment,
      presentation_layer_usage,
      presentation_representation,
      presentation_set,
      presentation_view,
      product_data_representation_view,
      view_dependent_annotation_representation);

REFERENCE FROM presentation_definition_schema
    (annotation_curve_occurrence,
     annotation_fill_area,
     annotation_symbol_occurrence,
     annotation_text_with_delineation,
     symbol_representation_with_blanking_box);

REFERENCE FROM presentation_resource_schema
    (character_glyph_symbol_outline,
     character_glyph_symbol_stroke,
     colour);

REFERENCE FROM product_property_representation_schema
    (shape_representation_relationship);

REFERENCE FROM representation_schema
    (founded_item,
     mapped_item,
     representation,
     representation_item,
     representation_map,
     using_representations);

REFERENCE FROM support_resource_schema
    (label,
     bag_to_set);
 

  TYPE approximation_method = ENUMERATION OF
    (chordal_deviation,
     chordal_length);
  END_TYPE;

  TYPE box_characteristic_select = SELECT
    (box_height,
     box_width,
     box_slant_angle,
     box_rotate_angle);
  END_TYPE;

  TYPE box_height = positive_ratio_measure;
  END_TYPE;

  TYPE box_rotate_angle = plane_angle_measure;
  END_TYPE;

  TYPE  box_slant_angle = plane_angle_measure;
  END_TYPE;

  TYPE box_width = positive_ratio_measure;
  END_TYPE;

  TYPE character_spacing_select = SELECT
    (length_measure,
     ratio_measure,
     measure_with_unit,
     descriptive_measure,
     pre_defined_character_spacing);
  END_TYPE;

  TYPE character_style_select = SELECT
    (character_glyph_style_stroke,
     character_glyph_style_outline,
     text_style_for_defined_font);
  END_TYPE;

  TYPE curve_font_or_scaled_curve_font_select = SELECT
    (curve_style_font_select,
     curve_style_font_and_scaling);
  END_TYPE;

  TYPE curve_or_annotation_curve_occurrence = SELECT
    (curve,
     annotation_curve_occurrence);
  END_TYPE;

  TYPE curve_or_render = SELECT
    (curve_style,
     curve_style_rendering);
  END_TYPE;

  TYPE curve_style_font_select = SELECT
    (curve_style_font,
     pre_defined_curve_font,
     externally_defined_curve_font);
  END_TYPE;

  TYPE curve_tolerance_deviation = positive_length_measure;
  END_TYPE;

  TYPE curve_tolerance_parameter = REAL;
  END_TYPE;

  TYPE direction_count_select = SELECT
    (u_direction_count,
     v_direction_count);
  END_TYPE;

  TYPE fill_style_select = SELECT
    (fill_area_style_colour,
     pre_defined_tile_style,
     externally_defined_tile_style,
     fill_area_style_tiles,
     pre_defined_hatch_style,
     externally_defined_hatch_style,
     fill_area_style_hatching);
  END_TYPE;

  TYPE fill_area_style_tile_shape_select = SELECT
    (fill_area_style_tile_curve_with_style,
     fill_area_style_tile_coloured_region,
     fill_area_style_tile_symbol_with_style,
     pre_defined_tile,
     externally_defined_tile);
  END_TYPE;

  TYPE hiding_or_blanking_select = SELECT
    (presentation_area,
     presentation_view,
     product_data_representation_view,
     annotation_fill_area,
     area_dependent_annotation_representation,
     view_dependent_annotation_representation,
     annotation_text_with_delineation,
     character_glyph_symbol_stroke,
     character_glyph_symbol_outline,
     symbol_representation_with_blanking_box);
  END_TYPE;

  TYPE invisibility_context = SELECT 
    (presentation_layer_usage,
     presentation_representation,
     presentation_set);
  END_TYPE;

  TYPE invisible_item = EXTENSIBLE GENERIC_ENTITY SELECT 
    (styled_item,
     presentation_layer_assignment,
     representation);
  END_TYPE;

  TYPE marker_select = SELECT
    (marker_type,
     pre_defined_marker);
  END_TYPE;

  TYPE marker_type = ENUMERATION OF
    (dot,
     x,
     plus,
     asterisk,
     ring,
     square,
     triangle);
  END_TYPE;

  TYPE null_style = ENUMERATION OF
    (null);
  END_TYPE;

  TYPE presentation_style_select = SELECT
    (pre_defined_presentation_style,
     point_style,
     curve_style,
     surface_style_usage,
     symbol_style,
     fill_area_style,
     text_style,
     approximation_tolerance,
     externally_defined_style,
     null_style);
  END_TYPE;

  TYPE product_or_presentation_space = ENUMERATION OF
    (product_shape_space,
     presentation_area_space);
  END_TYPE;

  TYPE rendering_properties_select = SELECT
    (surface_style_reflectance_ambient,
     surface_style_transparent);
  END_TYPE;

  TYPE shading_curve_method = ENUMERATION OF
    (constant_colour,
     linear_colour);
  END_TYPE;

  TYPE shading_surface_method = ENUMERATION OF
    (constant_shading,
     colour_shading,
     dot_shading,
     normal_shading);
  END_TYPE;

  TYPE size_select  = SELECT
    (positive_length_measure,
     measure_with_unit,
     descriptive_measure,
     pre_defined_size);
  END_TYPE;

  TYPE squared_or_rounded = ENUMERATION OF
    (squared,
     rounded);
  END_TYPE;

  TYPE style_context_select = SELECT
    (group,
     presentation_layer_assignment,
     presentation_set,
     representation,
     representation_item,
     shape_representation_relationship);
  END_TYPE;

  TYPE surface_side = ENUMERATION OF
    (positive,
     negative,
     both);
  END_TYPE;

  TYPE surface_side_style_select = SELECT
    (surface_side_style,
     pre_defined_surface_side_style);
  END_TYPE;

  TYPE surface_style_element_select = SELECT
    (surface_style_fill_area,
     surface_style_boundary,
     surface_style_silhouette,
     surface_style_segmentation_curve,
     surface_style_control_grid,
     surface_style_parameter_line,
     surface_style_rendering);
  END_TYPE;

  TYPE surface_tolerance_deviation = positive_length_measure;
  END_TYPE;

  TYPE surface_tolerance_parameter = REAL;
  END_TYPE;

  TYPE symbol_style_select= SELECT
    (symbol_element_style,
     symbol_colour);
  END_TYPE;


  TYPE text_justification = label;
  END_TYPE;

  TYPE tolerance_deviation_select = SELECT
    (curve_tolerance_deviation,
     surface_tolerance_deviation);
  END_TYPE;

  TYPE tolerance_parameter_select = SELECT
    (curve_tolerance_parameter,
     surface_tolerance_parameter);
  END_TYPE;

  TYPE tolerance_select = SELECT
    (approximation_tolerance_deviation,
     approximation_tolerance_parameter);
  END_TYPE;

  TYPE u_direction_count = INTEGER;
    WHERE
      WR1: SELF > 1;
  END_TYPE;

  TYPE v_direction_count = INTEGER;
    WHERE
      WR1: SELF > 1;
  END_TYPE;

  ENTITY approximation_tolerance
    SUBTYPE OF (founded_item);
      tolerance : tolerance_select;
  END_ENTITY;

  ENTITY approximation_tolerance_deviation
    SUBTYPE OF (founded_item);
      tessellation_type : approximation_method;
      tolerances        : SET [1:2] OF tolerance_deviation_select;
      definition_space  : product_or_presentation_space;
    WHERE
      WR1: (HIINDEX(SELF.tolerances) = 1)
            XOR
        (TYPEOF(SELF.tolerances[1]) <> TYPEOF(SELF.tolerances[2]));
  END_ENTITY;

  ENTITY approximation_tolerance_parameter
    SUBTYPE OF (founded_item);
      tolerances : SET [1:2] OF tolerance_parameter_select;
    WHERE
      WR1: (HIINDEX (SELF.tolerances) = 1 )
             XOR
        (TYPEOF (SELF.tolerances[1]) <> TYPEOF (SELF.tolerances[2]));
  END_ENTITY;

  ENTITY character_glyph_style_outline
    SUBTYPE OF (founded_item);
      outline_style : curve_style;
  END_ENTITY;

  ENTITY character_glyph_style_outline_with_characteristics
    SUBTYPE OF (character_glyph_style_outline);
      characteristics : fill_area_style;
  END_ENTITY;

  ENTITY character_glyph_style_stroke
    SUBTYPE OF (founded_item);
      stroke_style : curve_style;
  END_ENTITY;

  ENTITY context_dependent_invisibility
    SUBTYPE OF (invisibility);
      presentation_context : invisibility_context;
  END_ENTITY;

  ENTITY context_dependent_over_riding_styled_item
    SUBTYPE OF(over_riding_styled_item);
      style_context : LIST[1:?] OF style_context_select;
    WHERE
      WR1: (SIZEOF(QUERY( sc <* SELF.style_context |
       'REPRESENTATION_SCHEMA.REPRESENTATION_ITEM' IN
         TYPEOF(sc))) = 1) OR
        (SIZEOF(QUERY( sc <* SELF.style_context |
       'REPRESENTATION_SCHEMA.MAPPED_ITEM' IN
         TYPEOF(sc))) = SIZEOF(style_context)) OR
         (SIZEOF(QUERY( sc <* SELF.style_context |
       'PRODUCT_PROPERTY_REPRESENTATION_SCHEMA.SHAPE_REPRESENTATION_RELATIONSHIP' IN
         TYPEOF(sc))) = SIZEOF(style_context));
  END_ENTITY;

  ENTITY curve_style
    SUBTYPE OF (founded_item);
      name         : label;
      curve_font   : curve_font_or_scaled_curve_font_select;
      curve_width  : size_select;
      curve_colour : colour;
  END_ENTITY;

  ENTITY curve_style_curve_pattern
    SUBTYPE OF (geometric_representation_item);
      pattern        : annotation_curve_occurrence;
      pattern_length : positive_length_measure;
  END_ENTITY;

  ENTITY curve_style_curve_pattern_set
    SUBTYPE OF (curve_style_font, 
                geometric_representation_item);
      pattern_set : SET [1:?] OF curve_style_curve_pattern;
  END_ENTITY;

  ENTITY curve_style_font
    SUBTYPE OF (founded_item);
      name         : label;
      pattern_list : LIST [1:?] OF curve_style_font_pattern;
  END_ENTITY;

  ENTITY curve_style_font_and_scaling
    SUBTYPE OF (founded_item);
      name               : label;
      curve_font         : curve_style_font_select;
      curve_font_scaling : REAL;
  END_ENTITY;

  ENTITY curve_style_font_pattern
    SUBTYPE OF (founded_item);
      visible_segment_length   : positive_length_measure;
      invisible_segment_length : positive_length_measure;
  END_ENTITY;

  ENTITY curve_style_rendering;
    rendering_method     : shading_curve_method;
    rendering_properties : surface_rendering_properties;
  END_ENTITY;

  ENTITY curve_style_wide
    SUBTYPE OF (curve_style_font);
      interior_style : fill_area_style;
  END_ENTITY;

  ENTITY curve_style_with_ends_and_corners
    SUBTYPE OF (curve_style);
      curve_ends    : squared_or_rounded;
      curve_corners : squared_or_rounded;
  END_ENTITY;

  ENTITY curve_style_with_extension
    SUBTYPE OF (curve_style);
      curve_extensions   : length_measure;
  END_ENTITY;

  ENTITY draughting_pre_defined_curve_font
    SUBTYPE OF (pre_defined_curve_font);
    WHERE
      WR1: SELF.name IN
        ['continuous',
         'chain',
         'chain double dash',
         'dashed',
         'dotted'];
  END_ENTITY;

  ENTITY externally_defined_curve_font
    SUBTYPE OF (externally_defined_item);
  END_ENTITY;

  ENTITY externally_defined_hatch_style
    SUBTYPE OF (externally_defined_item, geometric_representation_item);
  END_ENTITY;

  ENTITY externally_defined_style
    SUBTYPE OF (externally_defined_item, founded_item);
  END_ENTITY;

  ENTITY externally_defined_tile
    SUBTYPE OF (externally_defined_item);
  END_ENTITY;

  ENTITY externally_defined_tile_style
    SUBTYPE OF (externally_defined_item, geometric_representation_item);
  END_ENTITY;

  ENTITY fill_area_style
    SUBTYPE OF (founded_item);
      name        : label;
      fill_styles : SET [1:?] OF fill_style_select;
    WHERE
      WR1: SIZEOF(QUERY(fill_style <* SELF.fill_styles |
         'PRESENTATION_APPEARANCE_SCHEMA.'+
         'FILL_AREA_STYLE_COLOUR' IN
         TYPEOF(fill_style)
         )) <= 1;
  END_ENTITY;

  ENTITY fill_area_style_colour;
    name        : label;
    fill_colour : colour;
  END_ENTITY;

  ENTITY fill_area_style_hatching
    SUBTYPE OF (geometric_representation_item);
      hatch_line_appearance         : curve_style;
      start_of_next_hatch_line      : one_direction_repeat_factor;
      point_of_reference_hatch_line : cartesian_point;
      pattern_start                 : cartesian_point;
      hatch_line_angle              : plane_angle_measure;
  END_ENTITY;

  ENTITY fill_area_style_tile_coloured_region
    SUBTYPE OF (geometric_representation_item);
      closed_curve  : curve_or_annotation_curve_occurrence;
      region_colour : colour;
    WHERE
      WR1: (NOT('GEOMETRY_SCHEMA.CURVE' IN TYPEOF (closed_curve))) OR 
        ('GEOMETRY_SCHEMA.CIRCLE' IN TYPEOF (closed_curve)) OR 
        ('GEOMETRY_SCHEMA.ELLIPSE' IN TYPEOF (closed_curve)) OR 
        ( ('GEOMETRY_SCHEMA.B_SPLINE_CURVE' IN TYPEOF (closed_curve)) 
             AND (closed_curve\b_spline_curve.closed_curve = TRUE) ) OR 
        ( ('GEOMETRY_SCHEMA.COMPOSITE_CURVE' IN TYPEOF (closed_curve)) 
             AND (closed_curve\composite_curve.closed_curve = TRUE) ) OR 
        ( ('GEOMETRY_SCHEMA.POLYLINE' IN TYPEOF (closed_curve)) 
             AND (closed_curve\polyline.points[LOINDEX(closed_curve\polyline.points)] = 
                  closed_curve\polyline.points[HIINDEX(closed_curve\polyline.points)]) );
  END_ENTITY;

  ENTITY fill_area_style_tile_curve_with_style
    SUBTYPE OF (geometric_representation_item);
      styled_curve : annotation_curve_occurrence;
  END_ENTITY;

  ENTITY fill_area_style_tile_symbol_with_style
    SUBTYPE OF (geometric_representation_item);
      symbol : annotation_symbol_occurrence;
  END_ENTITY;

  ENTITY fill_area_style_tiles
    SUBTYPE OF (geometric_representation_item);
      tiling_pattern : two_direction_repeat_factor;
      tiles          : SET [1:?] OF fill_area_style_tile_shape_select;
      tiling_scale   : positive_ratio_measure;
  END_ENTITY;

  ENTITY invisibility;
    invisible_items : SET [1:?] OF invisible_item;
  END_ENTITY;

  ENTITY occlusion_precedence;
      higher_precedence : hiding_or_blanking_select;
      lower_precedence  : hiding_or_blanking_select;
      occlusion_context : representation;
    WHERE
      WR1: acyclic_occlusion_precedence (SELF, [SELF.lower_precedence]);
  END_ENTITY;

  ENTITY one_direction_repeat_factor
    SUBTYPE OF (geometric_representation_item);
      repeat_factor : vector;
  END_ENTITY;

  ENTITY over_riding_styled_item
    SUBTYPE OF (styled_item);
      over_ridden_style : styled_item;
  END_ENTITY;

  ENTITY point_style
    SUBTYPE OF (founded_item);
      name          : label;
      marker        : marker_select;
      marker_size   : size_select;
      marker_colour : colour;
  END_ENTITY;

  ENTITY pre_defined_character_spacing
    SUBTYPE OF (pre_defined_item);
  END_ENTITY;

  ENTITY pre_defined_curve_font
    SUBTYPE OF (pre_defined_item);
  END_ENTITY;

  ENTITY pre_defined_hatch_style
    SUBTYPE OF (pre_defined_item, geometric_representation_item);
  END_ENTITY;

  ENTITY pre_defined_marker
    SUBTYPE OF (pre_defined_item);
  END_ENTITY;

  ENTITY pre_defined_presentation_style
    SUBTYPE OF (founded_item, pre_defined_item);
  END_ENTITY;

  ENTITY pre_defined_size
    SUBTYPE OF (pre_defined_item);
  END_ENTITY;

  ENTITY pre_defined_surface_side_style
    SUBTYPE OF (pre_defined_item);
  END_ENTITY;

  ENTITY pre_defined_tile
    SUBTYPE OF (pre_defined_item);
  END_ENTITY;

  ENTITY pre_defined_tile_style
    SUBTYPE OF (pre_defined_item, geometric_representation_item);
  END_ENTITY;

  ENTITY presentation_style_assignment
    SUBTYPE OF (founded_item);
      styles : SET [1:?] OF presentation_style_select;
    WHERE
      WR1: SIZEOF (QUERY (style1 <* SELF.styles |
           NOT (SIZEOF (QUERY (style2 <* (SELF.styles - style1) |
           NOT ((TYPEOF (style1) <> TYPEOF (style2)) OR
             (SIZEOF (['PRESENTATION_APPEARANCE_SCHEMA.' + 
                       'SURFACE_STYLE_USAGE',
                       'PRESENTATION_APPEARANCE_SCHEMA.'+
                       'EXTERNALLY_DEFINED_STYLE'] *
                     TYPEOF (style1)) = 1)
           ))) = 0
         ))) = 0;
      WR2: SIZEOF (QUERY (style1 <* SELF.styles |
         'PRESENTATION_APPEARANCE_SCHEMA.SURFACE_STYLE_USAGE' IN
         TYPEOF(style1)
         )) <= 2;
      WR3: SIZEOF (QUERY (style1 <* SELF.styles |
         ('PRESENTATION_APPEARANCE_SCHEMA.SURFACE_STYLE_USAGE' IN TYPEOF (style1)) AND 
         (SIZEOF (QUERY (style2 <* (SELF.styles - style1) |
           ('PRESENTATION_APPEARANCE_SCHEMA.SURFACE_STYLE_USAGE' IN TYPEOF (style2)) AND 
           ((style1\surface_style_usage.side = both) OR 
           (style2\surface_style_usage.side = both) OR 
           (style1\surface_style_usage.side = style2\surface_style_usage.side)) )) > 0))) = 0;
  END_ENTITY;

  ENTITY presentation_style_by_context
    SUBTYPE OF (presentation_style_assignment);
      style_context : style_context_select;
  END_ENTITY;

  ENTITY symbol_colour;
    colour_of_symbol : colour;
  END_ENTITY;

  ENTITY symbol_element_style
    SUBTYPE OF (founded_item);
      style_of_symbol : presentation_style_assignment;
    WHERE
      WR1: SIZEOF (QUERY ( style <* SELF.style_of_symbol.styles |
           'PRESENTATION_APPEARANCE_SCHEMA.SYMBOL_STYLE' IN
           TYPEOF (style))) = 0;
      WR2: NOT ('PRESENTATION_APPEARANCE_SCHEMA.' +
                'PRESENTATION_STYLE_BY_CONTEXT' IN
              TYPEOF (SELF.style_of_symbol)
           );
  END_ENTITY;

  ENTITY symbol_style
    SUBTYPE OF (founded_item);
      name            : label; 
      style_of_symbol : symbol_style_select;
  END_ENTITY;

  ENTITY styled_item
    SUBTYPE OF (representation_item);
      styles :  SET [1:?] OF presentation_style_assignment;
      item   :  representation_item;
    WHERE
      WR1: (SIZEOF(SELF.styles) = 1)
               XOR
         (SIZEOF(QUERY(pres_style <* SELF.styles |
         NOT ('PRESENTATION_APPEARANCE_SCHEMA.' +
              'PRESENTATION_STYLE_BY_CONTEXT' IN
         TYPEOF(pres_style))
         )) = 0);
  END_ENTITY;

  ENTITY surface_rendering_properties;
    rendered_colour : colour;
  END_ENTITY;

  ENTITY surface_side_style
    SUBTYPE OF (founded_item);
      name   : label;
      styles : SET [1:7] OF surface_style_element_select;
    WHERE
      WR1: SIZEOF(QUERY( style1 <* SELF.styles |
           SIZEOF(QUERY( style2 <* SELF.styles - style1 |
           TYPEOF(style1) = TYPEOF(style2)
           )) > 0
           )) = 0;
  END_ENTITY;

  ENTITY surface_style_boundary
    SUBTYPE OF (founded_item);
      style_of_boundary : curve_or_render;
  END_ENTITY;

  ENTITY surface_style_control_grid
    SUBTYPE OF (founded_item);
      style_of_control_grid : curve_or_render;
  END_ENTITY;

  ENTITY surface_style_fill_area
    SUBTYPE OF (founded_item);
      fill_area : fill_area_style;
  END_ENTITY;

  ENTITY surface_style_parameter_line
    SUBTYPE OF (founded_item);
      style_of_parameter_lines : curve_or_render;
      direction_counts         : SET [1:2] OF direction_count_select;
    WHERE
      WR1: (HIINDEX(SELF.direction_counts) = 1)
                        XOR
         (TYPEOF(SELF.direction_counts[1]) <>
          TYPEOF(SELF.direction_counts[2]));
  END_ENTITY;

  ENTITY surface_style_reflectance_ambient;
    ambient_reflectance : REAL;
  END_ENTITY;

  ENTITY surface_style_reflectance_ambient_diffuse
    SUBTYPE OF (surface_style_reflectance_ambient);
      diffuse_reflectance : REAL;
  END_ENTITY;

  ENTITY surface_style_reflectance_ambient_diffuse_specular
    SUBTYPE OF (surface_style_reflectance_ambient_diffuse);
      specular_reflectance : REAL;
      specular_exponent    : REAL;
      specular_colour      : colour;
  END_ENTITY;

  ENTITY surface_style_rendering;
    rendering_method : shading_surface_method;
    surface_colour   : colour;
  END_ENTITY;

  ENTITY surface_style_rendering_with_properties
    SUBTYPE OF (surface_style_rendering);
      properties : SET [1:2] OF rendering_properties_select;
    WHERE
      WR1: (HIINDEX(SELF.properties) = 1)
                   XOR
         (TYPEOF(SELF.properties[1]) <> TYPEOF(SELF.properties[2]));
  END_ENTITY;

  ENTITY surface_style_segmentation_curve
    SUBTYPE OF (founded_item);
      style_of_segmentation_curve : curve_or_render;
  END_ENTITY;

  ENTITY surface_style_silhouette
    SUBTYPE OF (founded_item);
      style_of_silhouette : curve_or_render;
  END_ENTITY;

  ENTITY surface_style_transparent;
      transparency : REAL;
    WHERE
      WR1: {0.0 <= transparency <= 1.0};
  END_ENTITY;

  ENTITY surface_style_usage
    SUBTYPE OF (founded_item);
      side  : surface_side;
      style : surface_side_style_select;
  END_ENTITY;

  ENTITY text_style
    SUBTYPE OF (founded_item);
      name                 : label;
      character_appearance : character_style_select;
  END_ENTITY;

  ENTITY text_style_for_defined_font;
    text_colour : colour;
  END_ENTITY;

  ENTITY text_style_with_box_characteristics
    SUBTYPE OF (text_style);
      characteristics : SET [1:4] OF box_characteristic_select;
    WHERE
      WR1: SIZEOF( QUERY( c1 <* SELF.characteristics |
           SIZEOF( QUERY( c2 <* SELF.characteristics - c1 |
           TYPEOF (c1) = TYPEOF (c2)
           )) > 0
           )) = 0;
  END_ENTITY;

  ENTITY text_style_with_justification
    SUBTYPE OF (text_style);
      justification : text_justification;
  END_ENTITY;

  ENTITY text_style_with_mirror
    SUBTYPE OF (text_style);
      mirror_placement : axis2_placement;
  END_ENTITY;

  ENTITY text_style_with_spacing
    SUBTYPE OF (text_style);
      character_spacing : character_spacing_select;
  END_ENTITY;

  ENTITY two_direction_repeat_factor
    SUBTYPE OF (one_direction_repeat_factor);
      second_repeat_factor : vector;
  END_ENTITY;

  SUBTYPE_CONSTRAINT founded_item_subtypes FOR founded_item;
    ONEOF (approximation_tolerance,
      approximation_tolerance_deviation,
      approximation_tolerance_parameter,
      character_glyph_style_outline,
      character_glyph_style_stroke,
      curve_style,
      curve_style_font,
      curve_style_font_and_scaling,
      curve_style_font_pattern,
      externally_defined_style,
      fill_area_style,
      point_style,
      pre_defined_presentation_style,
      presentation_style_assignment,
      surface_side_style,
      surface_style_boundary,
      surface_style_control_grid,
      surface_style_fill_area,
      surface_style_parameter_line,
      surface_style_segmentation_curve,
      surface_style_silhouette,
      surface_style_usage,
      symbol_element_style,
      symbol_style,
      text_style);
  END_SUBTYPE_CONSTRAINT;

  SUBTYPE_CONSTRAINT pas_geometric_representation_item_subtypes FOR geometric_representation_item;  
    (ONEOF ( 
     curve, 
     curve_style_curve_pattern, 
     curve_style_curve_pattern_set ,
     externally_defined_hatch_style,
     externally_defined_tile_style,  
     fill_area_style_hatching,
     fill_area_style_tile_coloured_region,
     fill_area_style_tile_curve_with_style, 
     fill_area_style_tile_symbol_with_style, 
     fill_area_style_tiles, 
     one_direction_repeat_factor,
     point, 
     pre_defined_hatch_style,  
     pre_defined_tile_style, 
     vector)); 
  END_SUBTYPE_CONSTRAINT; 

  FUNCTION acyclic_occlusion_precedence
       ( relation : occlusion_precedence;
     set_of_lower : SET OF hiding_or_blanking_select ) : BOOLEAN;
    LOCAL
      x : SET OF occlusion_precedence;
      local_set_of_lower : SET OF hiding_or_blanking_select;
    END_LOCAL;
    REPEAT i:=1 TO HIINDEX(set_of_lower);
      IF relation.higher_precedence :=: set_of_lower[i] THEN
        RETURN(FALSE);
      END_IF;
    END_REPEAT;
    x := bag_to_set (USEDIN ( relation.higher_precedence,
                   'PRESENTATION_APPEARANCE_SCHEMA.'+
           'OCCLUSION_PRECEDENCE.LOWER_PRECEDENCE'));
    local_set_of_lower := set_of_lower + relation.higher_precedence;
    IF SIZEOF (x) > 0 THEN
      REPEAT i:=1 TO HIINDEX (x);
        IF NOT acyclic_occlusion_precedence(x[i] ,
                                     local_set_of_lower) THEN
            RETURN (FALSE);
        END_IF;
      END_REPEAT;
    END_IF;
    RETURN (TRUE);
  END_FUNCTION;

END_SCHEMA; 
