(*
 * $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 WG12N2604 - ISO/TS 10303-1110 Surface_conditions - Express ARM
   by LKSoftWare GmbH for implementation purpose within IDA-STEP(TM)
*)

SCHEMA Surface_conditions_xim;

USE FROM Dimension_tolerance_xim;

USE FROM Generic_material_aspects_xim;

USE FROM Part_view_definition_xim;

USE FROM Value_with_unit_extension_xim;

USE FROM surface_conditions_mim;

 TYPE measuring_gauge_select = EXTENSIBLE GENERIC_ENTITY SELECT (
   Part_view_definition);
 END_TYPE;

  TYPE sf_material_item_select = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON material_item_select WITH
	(Coating_layer);
  END_TYPE;

 TYPE shaped_element_select = SELECT
      (Shape_element,Item_shape);
 END_TYPE;

 TYPE texture_select = SELECT
      (Surface_texture);
 END_TYPE;

 ENTITY Coating_layer
 SUBTYPE OF (Shape_element);
 INVERSE
   thickness : SET[0:1] OF Thickness_size_dimension FOR applies_to;
 WHERE
 WR1: SIZEOF(USEDIN(SELF, 'SURFACE_CONDITIONS_XIM.MATERIAL_DESIGNATION.DEFINITIONS'))=1;
 END_ENTITY;

 ENTITY Contact_ratio
  SUBTYPE OF (contact_ratio_representation);
  ratio_value : measure_representation_item;
  measuring_gauge : measuring_gauge_select;
 END_ENTITY;

 ENTITY Hardness
  SUBTYPE OF (hardness_representation);
  measuring_method : STRING;
  environment_condition : OPTIONAL SET[1:?] OF STRING; (** Originally it is mandatory SET[0:?] **)
  measuring_position : OPTIONAL STRING;
  hardness_value : measure_representation_item;
  depth : OPTIONAL measure_representation_item;
 END_ENTITY;

(* Removed as a result of 2354 issue from SEDSILLA
 ENTITY Physical_model_representation
  SUBTYPE OF (Product_view_definition, physically_modelled_product_definition);
--  SELF\Product_view_definition.defined_version : Physical_model_version;
 END_ENTITY; *)

 ENTITY Surface_condition
  ABSTRACT SUPERTYPE OF (ONEOF(Contact_ratio,Hardness,Tactile_appearance,
                         Treatment_result,Visual_appearance,Surface_texture))
  SUBTYPE OF (representation);
  value_determination : OPTIONAL STRING;
 END_ENTITY;

 ENTITY Surface_condition_association
  SUBTYPE OF (property_definition_representation);
  SELF\property_definition_representation.used_representation RENAMED describing_surface_condition : representation;
  described_element : shaped_element_select;
 END_ENTITY;

 ENTITY Surface_texture
  SUBTYPE OF (Surface_condition, surface_texture_representation);
  measuring_method : STRING;
  measuring_direction : OPTIONAL Measurement_path;
 END_ENTITY;

 ENTITY Surface_texture_parameter__measure_representation_item
  SUBTYPE OF (measure_representation_item);
  SELF\representation_item.name RENAMED parameter_name : label;
  described_texture : texture_select;
  -- parameter_index : OPTIONAL INTEGER; *** commented out because of wrong mapping *** SEDS
  DERIVE 
  	parameter_value : measure_representation_item := SELF;
 END_ENTITY;
 
 ENTITY Surface_texture_parameter__value_range
  SUBTYPE OF (value_range);
  SELF\representation_item.name RENAMED parameter_name : label;
  described_texture : texture_select;
  -- parameter_index : OPTIONAL INTEGER; *** commented out because of wrong mapping ***  SEDS
  DERIVE 
  	parameter_value : measure_representation_item := SELF;
 END_ENTITY;

 ENTITY Tactile_appearance
  SUBTYPE OF (Surface_condition, tactile_appearance_representation);
  	depth : OPTIONAL measure_representation_item; 
 END_ENTITY;

 ENTITY Treatment_result
  SUBTYPE OF (Surface_condition);
  (* attribute is accessable from supertype
  id : OPTIONAL STRING; *)
  name_x : OPTIONAL STRING;
  description_x : STRING;
  purpose : OPTIONAL STRING;
  (* Overlapps with name_x *)
  DERIVE
   SELF\representation.description :text :=?;
 END_ENTITY;

 ENTITY Visual_appearance
  SUBTYPE OF (Surface_condition, visual_appearance_representation);
  id_x : OPTIONAL STRING;
  colour_id : STRING;
  colour_name : OPTIONAL STRING;
  lustre : STRING;
  transparency : OPTIONAL STRING;
  pattern : OPTIONAL STRING;
 END_ENTITY;

END_SCHEMA;
