//////////////////////////////////////
// START of File: C0_DIMEN.CPP
//////////////////////////////////////

//===================================================================
//
// COPYRIGHT NOTICE:  This code is protected by Copyright!
//
// Copyright (c) 1994, 1995, 1996, 1997 by DPC Technology.
// All rights reserved.
//
// See files "cf_copyr.h" and "cf_licen.h" for details of
// copyright and license specifications, and contact information.
//
//===================================================================

//
// Include this source file's header file:
//
#include	<cf_api/bf_defs.h>
#include    <cf_api/c0_dimen.hpp>
            // relative to the IDE include path: ~/cfrz

cf_2DPoint
    ::cf_2DPoint()
{
    iX_ = iY_ = 0;
}


cf_2DPoint
    ::cf_2DPoint( const cf_2DPoint &cr_cf_2dpSource )
{
    this->iX_ = cr_cf_2dpSource.iX_;
    this->iY_ = cr_cf_2dpSource.iY_;
}


cf_2DPoint
    ::cf_2DPoint( int iX, int iY )
{
    iX_ = iX;
    iY_ = iY;
}


cf_2DPoint
    ::~cf_2DPoint()
{}


cf_2DPoint&
    cf_2DPoint
        ::operator=( const cf_2DPoint &cr_cf_2dpUserVal )
{
    this->iX_ = cr_cf_2dpUserVal.iX_;
    this->iY_ = cr_cf_2dpUserVal.iY_;
	return( *this );
}


cf_2DPoint&
    cf_2DPoint
        ::operator += ( cf_2DPoint &r_cf_2dpTarget )
{
	this->iX_ += r_cf_2dpTarget.iX_;
	this->iY_ += r_cf_2dpTarget.iY_;
	return( *this );
}


cf_2DPoint
    cf_2DPoint
        ::yieldMin( cf_2DPoint cf_2dpCompareWith )
{
	return
    (
        cf_2DPoint  // Construct a 2D-Point from:
        (
            // The lesser of the X-coords:
            ( ( iX_ < cf_2dpCompareWith.iX_ ) ? iX_ : cf_2dpCompareWith.iX_ ),
            // ... AND the lesser of the Y-coords:
            ( ( iY_ < cf_2dpCompareWith.iY_ ) ? iY_ : cf_2dpCompareWith.iY_)
        )
    );
}


cf_2DPoint
    cf_2DPoint
        ::yieldMax( cf_2DPoint cf_2dpCompareWith )
{
	return
    (
        cf_2DPoint  // Construct a 2D-Point from:
        (
            // The greater of the X-coords:
            ( ( iX_ > cf_2dpCompareWith.iX_ ) ? iX_ : cf_2dpCompareWith.iX_ ),
            // ... AND the greater of the Y-coords:
            ( ( iY_ > cf_2dpCompareWith.iY_ ) ? iY_ : cf_2dpCompareWith.iY_)
        )
    );
}


int&
    cf_2DPoint
        ::x()
{ return( iX_ ); }


int&
    cf_2DPoint
        ::y()
{ return( iY_ ); }


void
    cf_2DPoint
        ::setZero()
{ iX_ = iY_ = 0; }
//
// End of cf_2DPoint Pseudo-Implementation/Mapping.
//

//==============================
// Implement class cf_2DRect:
//==============================
cf_2DRect
    ::cf_2DRect()
{ this->iLeft_ = this->iTop_ = this->iRight_ = this->iBottom_ = 0; }

cf_2DRect
    ::cf_2DRect( cf_2DPoint bpUL, cf_2DPoint bpLR )
{
	iLeft_ = bpUL.x();  iTop_ = bpUL.y();
	iRight_ = bpLR.x(); iBottom_ = bpLR.y();
}

cf_2DRect
    ::cf_2DRect(   int iLeft, int iTop, int iRight, int iBottom )
{ iLeft_ = iLeft; iTop_ = iTop; iRight_ = iRight; iBottom_ = iBottom; }


cf_2DRect
    ::~cf_2DRect()
{}

cf_2DRect
    cf_2DRect
        ::operator=( const cf_2DRect &cr_cf_2drUserVal )
{
	this->iLeft_ = cr_cf_2drUserVal.iLeft_;
	this->iTop_ = cr_cf_2drUserVal.iTop_;
	this->iRight_ = cr_cf_2drUserVal.iRight_;
	this->iBottom_ = cr_cf_2drUserVal.iBottom_;
	return( *this );
}

int
    cf_2DRect
        ::height()
{ return( iBottom_ - iTop_ ); }

int
    cf_2DRect
        ::width()
{ return( iRight_ - iLeft_ ); }

int&
    cf_2DRect
        ::bottom()
{ return( iBottom_ ); }

int&
    cf_2DRect
        ::left()
{ return( iLeft_ ); }

int&
    cf_2DRect
        ::right()
{ return( iRight_ ); }

int&
    cf_2DRect
        ::top()
{ return( iTop_ ); }

//
// End of cf_2DRect Pseudo-Implementation/Mapping.
//

//////////////////////////////////////
// END of File: C0_DIMEN.CPP
//////////////////////////////////////




