last ...
This commit is contained in:
@@ -118,6 +118,12 @@ enum ENUM_XSESSION
|
||||
X_FRANKFORT,
|
||||
};
|
||||
|
||||
enum ENUM_X_ZONE_EDGE
|
||||
{
|
||||
X_ZONE_UPPER_EDGE,
|
||||
X_ZONE_LOWER_EDGE
|
||||
};
|
||||
|
||||
//
|
||||
// Represent a Session Working Time ...
|
||||
struct XSession
|
||||
@@ -1472,7 +1478,6 @@ bool AddIfNotExists(
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
int count = ArraySize(dest);
|
||||
result = source.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
@@ -1482,7 +1487,7 @@ bool AddIfNotExists(
|
||||
//
|
||||
int idx = FindIndex(source, dest);
|
||||
bool isExists = IsValidIndex(idx);
|
||||
if (isExists)
|
||||
if (!isExists)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
@@ -1618,7 +1623,6 @@ bool AddIfNotExists(
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
int count = ArraySize(dest);
|
||||
result = source.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
@@ -1628,7 +1632,7 @@ bool AddIfNotExists(
|
||||
//
|
||||
int idx = FindIndex(source, dest);
|
||||
bool isExists = IsValidIndex(idx);
|
||||
if (isExists)
|
||||
if (!isExists)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
@@ -1644,6 +1648,117 @@ bool AddIfNotExists(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
/**
|
||||
* Check if a Zone inside another one ...
|
||||
*
|
||||
* @param source: XZone instance ...
|
||||
* @param dest: XZone instance ...
|
||||
* @param edge: ENUM_X_ZONE_EDGE member, define inside edge of zone ...
|
||||
* @param forceInside: Boolean, if set true means all edges of source must be inside dest ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsInside(
|
||||
XZone &source,
|
||||
XZone &dest,
|
||||
ENUM_X_ZONE_EDGE edge,
|
||||
bool forceInside = true //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = source.IsValid() &&
|
||||
dest.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isEdgePassed =
|
||||
//
|
||||
edge == X_ZONE_UPPER_EDGE
|
||||
? source.upper <= dest.upper
|
||||
: source.lower >= dest.lower
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isForcePassed =
|
||||
//
|
||||
forceInside
|
||||
? edge == X_ZONE_UPPER_EDGE
|
||||
? source.lower >= dest.lower
|
||||
: source.upper <= dest.upper
|
||||
: edge == X_ZONE_UPPER_EDGE
|
||||
? true
|
||||
: true
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
result = isEdgePassed &&
|
||||
isForcePassed;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
bool IsInside(
|
||||
XOHCL &source,
|
||||
XZone &dest,
|
||||
ENUM_X_ZONE_EDGE edge,
|
||||
bool forceInside = true //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = source.IsValid() &&
|
||||
dest.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XZone iSource;
|
||||
double upper =
|
||||
edge == X_ZONE_UPPER_EDGE
|
||||
? source.high
|
||||
: source.GetDown();
|
||||
double lower =
|
||||
edge == X_ZONE_UPPER_EDGE
|
||||
? source.GetUp()
|
||||
: source.low;
|
||||
result = iSource.Init(
|
||||
upper,
|
||||
lower,
|
||||
"XOHCL",
|
||||
source.time,
|
||||
TimeCurrent() //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = IsInside(
|
||||
iSource,
|
||||
dest,
|
||||
edge,
|
||||
forceInside //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// State Extensions ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user