### ICoordinateSystem

  The ICoordinateSystem class maintains the settings information used to implement window coordinate mapping between the application coordinate system and the coordinate system used by the underlying GUI. Window coordinate mapping is needed because GUIs vary in their definition of the origin point of window coordinates. For example, Presentation Manager defines the 0,0 point of the screen to be the lower-left corner, and positive changes in the Y-coordinate move up the screen. Conversely, Motif and Windows define the 0,0 point to be the upper-left corner of the screen, and positive changes in the Y-coordinate move down the screen.

  This class is used extensively by the Open Class Library implementation to map the coordinates used in an application to those required by the GUI toolkit. If you are writing application code that does not use native system calls, your primary use of this class will be to use ICoordinateSystem::setApplicationOrientation to specify your application's coordinate system. If you do not call this function, the default value of originUpperLeft is used.

  If you are extending the library by writing classes for custom controls or providing other reusable classes based on Open Class Library, then consider using this class to provide coordinate-mapping for your users. Coordinate conversion is needed when you make calls to system routines that accept points or rectangles. You also may need it if you rely on a specific orientation to perform layout of windows or graphics.

### ICoordinateSystem - Member Functions and Data by Group

### Conversion

Conversion is the process of mapping a point or rectangle expressed in one orientation to one expressed in another orientation. To perform the conversion, a reference size is required. The reference size is the size of the coordinate space in which the point or rectangle to be converted is expressed. For example, the reference size of a top-level window positioned with respect to the screen size would be the screen size.

convertToApplication

  Converts a point or rectangle from the native coordinate orientation to the application orientation.

  Overload 1

      public:
      static IRectangle
        convertToApplication( const IRectangle& nativeRectangle,
                              const ISize& referenceSize )

  Returns a rectangle in application coordinates. The rectangle is computed from a rectangle expressed in native orientation and a reference size. referenceSize should be the size of the coordinate space in which the native point coordinate is expressed.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      public:
      static IPoint
        convertToApplication( const IPoint& nativePoint,
                              const ISize& referenceSize )

  Returns a point in application coordinates. The point is computed from a point expressed in native orientation and a reference size. referenceSize should be the size of the coordinate space in which the native point coordinate is expressed.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

convertToNative

  Converts a point or rectangle from the application coordinate orientation to the native orientation.

  Overload 1

      public:
      static IRectangle
        convertToNative( const IRectangle& applicationRectangle,
                         const ISize& referenceSize )

  Returns a rectangle in native coordinates. The rectangle is computed from a rectangle expressed in application orientation and a reference size. referenceSize should be the size of the coordinate space in which the application point is expressed.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      public:
      static IPoint
        convertToNative( const IPoint& applicationPoint,
                         const ISize& referenceSize )

  Returns a point in native coordinates. The point is computed from a point expressed in application orientation and a reference size. referenceSize should be the size of the coordinate space in which the application point is expressed.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

isConversionNeeded

      public:
      static bool isConversionNeeded()

  Returns true if the native and application orientations are different. Otherwise, false is returned.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Orientation

The orientation describes the reference point (0,0) used when a location in a window or screen is described.

applicationOrientation

      public:
      static EOrientation applicationOrientation()

  Returns the currently set orientation to be used by the Open Class Library interface. Unless otherwise noted, all IRectangle and IPoint objects passed across the Open Class Library interface are in this orientation. The default application orientation is originUpperLeft.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

nativeOrientation

      public:
      static EOrientation nativeOrientation()

  Returns the orientation that is used natively on the current platform.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

OS/2 Considerations

  This function returns originLowerLeft.

Windows Considerations

  This function returns originUpperLeft.

setApplicationOrientation

      public:
      static EOrientation
        setApplicationOrientation( EOrientation coordsystem = kOriginUpperLeft )

  Sets the orientation to be used for the Open Class Library interface. If you want to change this value, you must call this function before any IWindow objects are created.
  Note: Calling this function after IWindow objects have been created may cause unpredictable results. If your design calls for using an orientation other than the Open Class Library default of kOriginUpperLeft, set the orientation early in your program.

  This function does not affect the processing of dialog templates loaded from resource files. The coordinates in resource files are always interpreted in native system coordinates when the dialog is being loaded.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### ICoordinateSystem - Enumerations

EOrientation

      enum EOrientation { kOriginUpperLeft,
                          kOriginLowerLeft,
                          originUpperLeft=kOriginUpperLeft,
                          originLowerLeft=kOriginLowerLeft }

  EOrientation is an enumeration describing the coordinate systems supported by Open Class Library. The kOriginUpperLeft orientation has the origin located in the upper-left corner of the reference coordinate space. This is the orientation used by the native Windows and Motif toolkits. The kOriginLowerLeft orientation has the origin located in the lower-left corner of the reference coordinate space. This is the coordinate system used by the Presentation Manager in OS/2.

  originUpperLeft and originLowerLeft, which were used in prior releases of the Open Class Library are mapped to kOriginUpperLeft and kOriginLowerLeft, respectively, to maintain backward compatability.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### ICoordinateSystem - Inherited Member Functions and Data

#### Inherited Public Functions

  - None

#### Inherited Public Data

  - None

#### Inherited Protected Functions

  - None

#### Inherited Protected Data

  - None