Overview Schemas Index

GEOMETRY_SCHEMA (jsdai.SGeometry_schema)


FUNCTION dimension_of
          (item : geometric_representation_item) : dimension_count;

LOCAL
    x   : SET  OF  representation;
    y   : representation_context;
    dim : dimension_count;
  END_LOCAL;
  -- FOR  cartesian_point, direction, OR vector dimension is determined by
  -- counting components.
    IF  'GEOMETRY_SCHEMA.CARTESIAN_POINT' IN  TYPEOF(item) THEN
       dim := SIZEOF(item\cartesian_point.coordinates);
       RETURN(dim);
    END_IF;
    IF  'GEOMETRY_SCHEMA.DIRECTION' IN  TYPEOF(item) THEN
       dim := SIZEOF(item\direction.direction_ratios);
       RETURN(dim);
    END_IF;
    IF 'GEOMETRY_SCHEMA.VECTOR' IN  TYPEOF(item) THEN
       dim := SIZEOF(item\vector.orientation\direction.direction_ratios);
       RETURN(dim);
    END_IF;
  -- FOR  all other types OF  geometric_representation_item dim is obtained
  -- via context.
  -- Find the SET  OF  representation IN which the item is used. 

  x := using_representations(item);

  -- Determines the dimension_count OF  the 
  -- geometric_representation_context. Note that the 
  -- RULE compatible_dimension ensures that the context_of_items
  -- is OF  TYPE geometric_representation_context AND has
  -- the same dimension_count FOR all values OF x.
  -- The SET x is non-empty since this is required BY WR1 of
  -- representation_item.
    y := x[1].context_of_items;
    dim := y\geometric_representation_context.coordinate_space_dimension;
    RETURN (dim);

END_FUNCTION; -- dimension_of

public class FDimension_of
          public static Value run(SdaiContext _context, Value item)