AcMapRangeLine class

Land Desktop Development ARX CPP SDK

 

AcMapRangeLine class

Header file: MapArxApi.h.

The AcMapRangeLine class represents a range line, also called a range expression. A range line is a line in a range table consisting of a condition to compare to an object property or object data value and the value to return if the condition evaluates to True.

The condition portion of the range line consists of an operator and a simple expression value. The operator (AcMap::ERangeOperator) can be a comparative operator or a special otherwise operator (AcMap::kRangeOtherwise) which covers conditions not specified by the other range lines in the range table. The expression value is called the range definition.

For example, in the range line

> 1000 SMALL

> is the range operator, 1000 is the range definition, and SMALL is the return value. In the UI, the user would would see this range line displayed as

If > 100 Return: SMALL

Create a range line using the AcMapRangeTable::AddRangeLine function. Get a pointer to AcMapRangeLine using the AcMapRangeTable::GetRangeLine function. You are responsible for deleting the memory allocated for the range line using the delete operator.

To associate range lines in a range table with a property alteration, pass an expression that evaluates to the range table to AcMapPropertyAlteration::SetExpression. For example:

//Add a range table to the range library
AcMapRangeTable *pTable = NULL;
const char *pcName = "MyTypeRangeTable";
const char *pcDsc = "Table for types";
 
if(pRangeLib->AddRangeTable(pTable, pcName, pcDsc) == AcMap::kOk)
{
 // Add range lines that will add text next to the entities
 // that match the input criteria.
 pTable->AddRangeLine(AcMap::kRangeEq, "10e", "LOW");
 pTable->AddRangeLine(AcMap::kRangeEq, "20", "MEDIUM");
 pTable->AddRangeLine(AcMap::kRangeEq, "30", "HIGH");
 pTable->AddRangeLine(AcMap::kRangeOtherwise, NULL, 
"Out of range."); } //Add a Text Alteration AcMapPropertyAlteration *pPropAltObj = NULL; if(pPADef->AddAlteration(pPropAltObj, AcMap::kAlterationTextEntity) == AcMap::kOk) { AcMapTextAlteration *pTextAlt = NULL; //cast the property alteration to a text alteration pTextAlt = (AcMapTextAlteration*)pPropAltObj; //set some attributes pTextAlt->SetColor("Magenta"); pTextAlt->SetJustification("MIDDLE"); pTextAlt->SetRotation("45.0"); pTextAlt->SetHeight("0.5"); // Set the expression and supply the range table, // "MyTypeRangeTable". pTextAlt->SetExpression("(Range .TYPE MyTypeRangeTable)"); }

Do not subclass from this class.

For more information, click graphics/chiclet.gif. Also click Using AutoCAD Map > Queries > Altering the Properties of Queried Objects > Creating a Range Table on the Contents tab of AutoCAD Map Help.