Chapter 8:
Detection Node Management Functions
 

This chapter describes the following detection node management functions:

 

FindDetNode(); Find Detection Node

 

FindNextDetNode(); Find Next Detection Node

 

FreeAllDetNodes(); Free All detection Nodes

 

FreeDetNode(); Free Detection Nodes

 

GetDetNode(); Get Detection Node

 

GetDetNodeObjectID(); Get Detection Node Object ID

 

GetNextDetNode(); Get Next Detection Node

 

GetRiserDetNodeLimit(); Get Riser Detection Node Limit

 

LockDetNodeRef(); Lock a Detection Node Reference

 

SetRiserDetNodeLimit(); Set Riser Detection Node Limit

 

UnlockDetNodeRef(); Unlock Detection Node Reference

   

FindDetNode()

 

This function identifies whether or not an object (represented by a detection node record in the detection node list) is within the virtual coordinates identified by pMouser. If an object/detection node record is found, the detection node reference data structure at pDetRef is filled with the graph layer, detection list pointer, and offset from the detection list.

Syntax:

BOOLEAN16 PUBLIC
FindDetNode (
     GraphPtr pGraph,
     Point FAR * pMouser,
     DetNodeRefPtr pDetRef
);

Input:

pGraph: Pointer to a graph created by AllocGraphPtr()

 

pMouser: Pointer to a point data structure where virtual coordinates are defined

 

pDetRef: Pointer to a detection node reference data structure. See the DetNodeRef structure in Appendix A. On success, the following members of the data structure will be set to new values:

 

pDetRef->layer =

graph layer where object was found (ANNOTATION_LAYER, GRAPH_LAYER, BACKGROUND_LAYER,)

 

pDetRef->hDetList =

detection list pointer

 

pDetRef->offset =

offset in detection list where detection node record is found.

Return:

BOOLEAN16: TRUE/FALSE

 

TRUE=

object represented by a DetNodeRec is within pMouser

 

FALSE=

object not found/coordinates are not in the detection list

Notes:

Also, refer to the PGSDK Programmer's Manual for more information about detection nodes and selection lists.

Example:

// change to virtual coordinate
de.DeviceToVirtual( pt );
if (::FindDetNode ( (GraphPtr) m_pGraph,&pt,
      (DetNodeRefPtr) m_pDetNodeRef))
     {...
}

Also See:

FindNextDetNode()

FindNextDetNode()

 

This function identifies whether or not an object (represented by a record in the detection node list) is within the virtual coordinates identified by pMouser. If an object/detection node record is found, the detection node reference data structure at pDetRef is filled with the graph layer, detection list pointer, and offset from the detection list. If bFound is FALSE, this function finds the first object/detection node (same as FindDetNode()). If bFound is TRUE, this function finds the next object/detection node.

Syntax:

BOOLEAN16 PUBLIC
FindNextDetNode (
     GraphPtr pGraph,
     Point FAR * pMouser,
     DetNodeRefPtr pDetRef,
     BOOLEAN16 bFound
);

Input:

pGraph: Pointer to a graph created by AllocGraphPtr

 

pMouser: Pointer to a point data structure where virtual coordinates are defined

 

pDetRef: Pointer to a detection node reference data structure. See the DetNodeRef structure in Appendix A. On success, the following members of the data structure will be set to new values:

 

pDetRef->layer =

graph layer where object was found (ANNOTATION_LAYER, GRAPH_LAYER, BACKGROUND_LAYER,)

 

pDetRef->hDetList =

detection list pointer

 

pDetRef->offset =

offset in detection list where detection node record is found.

 

bFound: TRUE/FALSE

 

TRUE=

find next detection node

 

FALSE=

find first detection node

Return:

BOOLEAN16: FALSE/TRUE

 

TRUE=

DetNodeRec found at pMouser

 

FALSE=

DetNodeRec not found at pMouser

Notes:

Also, see the PGSDK Programmer's Manual for more information about detection nodes and selection lists.

Example:

//Loop to find each DetNodeRect that intersect "pt"
bFoundItem = FindNextDetNode (
     gpGraph, &pt, gpDetNode,
     bFoundItem );
if ( bFoundItem )
//Make selection list item for each found record

Also See:

FindDetNode()

FreeAllDetNodes()

 

This function frees all DetNode memory structures associated with a graph. Occasionally, this function is useful for cases where you want to reuse an existing GraphPtr (example, to Load a .3TF file). It can also be used to free-up additional memory in situations where no editing is allowed/needed.

Syntax:

void PUBLIC FreeAllDetNodes ( GraphPtr pGraph );

Input:

pGraph: A graph pointer created by AllocGraphPtr()

Return:

None

Example:

/* kill any existing DetNodes */
FreeAllDetNodes(pGraph);
/* kill the annotation stuff too */
FreeAllAnodes(pGraph);

Also See:

FreeDetNode()

   

FreeDetNode

 

This function frees/removes the detection node specified by pDetRef from the system's internally maintained detection node list.

Syntax:

void PUBLIC FreeDetNode ( DetNodeRefPtr pDetRef );

Input:

pDetRef: Pointer to a detection node reference data structure. See the DetNodeRef structure in Appendix A.

Return:

None

Example:

if(pCurr->nType == ANODE && pCurr->data.hAnode)
{
     FreeAnode(pGraph, pCurr->data.hAnode);
     pCurr->data.hAnode = 0;
     FreeDetNode(&pCurr->refDetNode);
}
if(pCurr->nObjectID == OTX_BOX_ANNOTATION)
{
     FreeAnode(pGraph, GetAnodeFromTextboxID(
          pGraph, pCurr->nSeriesID));
     FreeDetNode(&pCurr->refDetNode);
}
break;

Also See:

FreeAllDetNodes()

   

GetDetNode()

 

This function searches the detection node list for a detection node (identified by pDetRef) that contains the object, series, and group ID specified by the input parameters objectID, seriesID, and groupID.

Syntax:

INT16 PUBLIC
GetDetNode (
     GraphPtr pGraph,
     INT16 objectID,
     INT16 seriesID,
     INT16 groupID,
     INT16 caseID,
     DetNodeRefPtr pDetRef
);

Input:

pGraph: A graph pointer allocated by AllocGraphPtr()

 

objectID: An ObjectID.

 

seriesID: The seriesID of a particular instance of the object.

 

groupID: The groupID of a particular instance of the object

 

caseID: Not used. Set to -3.

 

pDetRef: A detection node reference pointer. See the DetNodeRef structure in Appendix A.

Return:

INT16: 0/1

 

0=

Object Not Found

 

1=

Object Found

Notes:

Also, refer to the PGSDK Programmer's Manual for more information about detection nodes and selection lists. Appendix A shows the format of the detection node data structure.

Example:

if ( LastSeries > -1 )
{
     GetDetNode ( gpGraph, O2D_RISER,
          LastSeries,
          LastGroup, -3,
          gpDetNode );
     gpSellItem = Select_AddItem (
          gpGraph, gpList,
          gpDetNode );
     OldRec = gpSelItem->rcBounds;
     vdRect ( gpDrawEnv, &OldRect );
}

Also See:

GetDetNodeObjectID(), GetFirstDetNodeRef(), GetNextDetNode()

   

GetDetNodeObjectID()

 

This function returns the ObjectID of the graph object that is described in the detection node identified by pNode.

Syntax:

INT16 PUBLIC
GetDetNodeObjectID (
     DetNodePtr pNode
);

Input:

pNode: Pointer to a detection node. See the DetNodeRec in Appendix A.

Return:

INT16: ObjectID

Notes:

Also, see the PGSDK Programmer's Manual for more information about detection nodes and selection lists.

Example:

// see if this is a movable "common" object
objectID = GetDetNodeObjectID(pDetNode);
attrCode = GetObjectsAttrCode (
          pGraph, objectID);
UnlockDetNodeRef(pDetRef);
return attrCode; /* TRUE if non-zero */

Also See:

GetDetNode(), GetFirstDetNodeRef(), GetNextDetNode()

   

GetNextDetNode()

 

This function searches the list of detection node structures for a structure whose entries match all of the items supplied in the input parameter list. It returns zero if no match is found.

Syntax:

INT16 PUBLIC
GetNextDetNode (
     GraphPtr pGraph,
     INT16 objectID,
     INT16 seriesID,
     INT16 groupID,
     INT16 caseID,
     DetNodeRefPtr pDetRef
);

Input:

pGraph: Pointer to graph created by AllocGraphPtr()

 

objectID: An INT16 value identifying an ObjectID.

 

seriesID: An INT16 value identifying a particular instance of the object identified by objectID. Use NULL_SERIESID if there is only one instance of objectID.

 

groupID: An INT16 value identifying a groupID

 

caseID: not used. Set to -3.

 

pDetRef: A pointer to a detection node reference data structure. See the DetNodeRef structure in Appendix A.

Return:

INT16: zero/non-zero

 

Value

Description

 

Zero =

Not Found

 

Non-Zero=

Pointer to the matching detection node

Notes:

Also, see the PGSDK Programmer's Manual for more information about detection nodes and selection lists.

Also See:

GetDetNode(), GetFirstDetNodeRef()

   

GetRiserDetNodeLimit()

 

This function returns an INT16 value that identifies the maximum number of detection nodes that will be created for riser objects in the graph identified by pGraph:

Syntax:

INT16 PUBLIC
GetRiserDetNodeLimit (
     GraphPtr pGraph
);

Input:

pGraph: Pointer to the graph object created by AllocGraphPtr()

Return:

INT16: Maximum number of detection nodes created for risers.

Example:

nMaxDetNode = GetRiserDetNodeLimit ( gpGraph );

Also See:

SetRiserDetNodeLimit()

   

LockDetNodeRef

 

This function locks the detection node reference memory handle and returns a pointer to the associated detection node.

Syntax:

DetNodePtr PUBLIC
LockDetNodeRef (
     DetNodeRefPtr hDetRef
);

Input:

hDetRef: Pointer to a detection node reference. See the DetNodeRef structure in Appendix A.

Return:

DetNodePtr

 

NULL = invalid detection node reference pointer

 

Non-Zero = Pointer to a detection node

Example:

//Get detection node reference pointer
Item2DetRef ( pItem, &detRef );
//Lock detection node reference
pDetNode = LockDetNodeRef ( &detRef );

Also See:

UnlockDetNodeRef()

   

SetRiserDetNodeLimit()

 

This functions sets the maximum number of detection nodes that can be created for riser objects in the graph identified by pGraph.

Syntax:

VOID PUBLIC
SetRiserDetNodeLimit (
     GraphPtr pGraph,
     INT16 MaxNum
);

Input:

pGraph: Pointer to the graph object created by AllocGraphPtr()

 

MaxNum: Maximum number of detection nodes

Return:

None

Example:

SetRiserDetNodeLimit ( gpGraph, 1000 );

Notes:

By default, only the first 512 risers have detection node information generated. If there are more than 512 risers, detection nodes are generated for the first series risers and the first group risers. All subsequent risers will not have detection nodes generated.

Also See:

GetRiserDetNodeLimit()

   

UnlockDetNodeRef

 

This function unlocks a detection node reference previously locked by LockDetNodeRef().

Syntax:

INT16 PUBLIC
UnlockDetNodeRef (
     DetNodeRefPtr hDetRef
);

Input:

hDetRef: Pointer to the detection node reference to be unlocked. See the DetNodeRef data structure in Appendix A.

Return:

INT16:

 

Possible Values

Description

 

EDR_INVALID_DETNODEREF =

Detection Node Reference Point is invalid

 

E00_OK =

no errors

Example:

UnlockDetNodeRef ( pDetRef );

Also See:

LockDetNodeRef()