Header file: MapAlteration.h.
An instance of the AcMapPropertyAlteration class represents a property alteration. A property alteration has an alteration type, which identifies the property to be altered (color, layer, line type, and so on), and an expression, which describes how the property is to be altered when the results of a query are displayed with property alteration enabled.
Created by calling AcMapPropertyAlterationDefinition::AddAlteration. This function returns a pointer to AcMapPropertyAlteration that you are responsible for deleting with the delete operator.
A collection of property alterations constitutes a property alteration definition, which is represented by an AcMapPropertyAlterationDefinition object. The property alteration definition is contained by the query to which it applies.
There are two other classes for representing property alterations: AcMapTextAlteration and AcMapHatchAlteration. Note that these two are subclassed from AcMapPropertyAlteration, and that both of them use the SetExpression function of the base class to set their respective expressions—to specify the string for the text alteration, or the hatch pattern name for the hatch alteration.
Do not subclass from this class.
The following code alters the color of queried objects to red. This example assumes that a drawing is already attached. For simplicity, error checking is not shown.
AcMapSession *mapApi = NULL; AcMapProject *pProj = NULL; AcMapDrawingSet *pDSet = NULL; AcMapQueryBranch *pQBranch = NULL; AcMapLocationCondition *pLocationCondition = NULL; AcMapQuery *pQuery = NULL; mapApi = AcMapGetSession(); mapApi->GetProject(pProj); pProj->GetDrawingSet(pDSet); pQBranch = new AcMapQueryBranch(); pLocationCondition = new AcMapLocationCondition(AcMap::kOperatorAnd, AcMap::kLocationInside); pLocationCondition->SetBoundary((&AcMapAllBoundary;())); pProj->CreateQuery(pQuery, Adesk::kFalse); pQuery->Clear(Adesk::kTrue); pQuery->SetMode(AcMap::kQueryDraw); pQBranch->AppendOperand(pLocationCondition); AcMapPropertyAlterationDefinition *pDef = NULL; AcMapPropertyAlteration *pcAlt = NULL; pQuery->GetPropertyAlteration(pDef); pDef->AddAlteration(pcAlt, AcMap::kAlterationColor); pcAlt->SetExpression("RED"); pQuery->EnablePropertyAlteration(Adesk::kTrue); pQuery->Define(pQBranch); pQuery->Run(); pDSet->ZoomExtents(); delete pcAlt ; delete pLocationCondition; delete pQBranch; delete pQuery;