AcMapTextAlteration class

Land Desktop Development ARX CPP SDK

 

AcMapTextAlteration class

Header file: MapAlteration.h.

Note  This class has new functions added for AutoCAD Map 3D 2005.

An instance of the AcMapTextAlteration class represents a text alteration, which provides text labels for objects queried into the project drawing if property alteration is enabled for the query.

The AcMapTextAlteration class is a subclass of the AcMapPropertyAlteration class. Do not subclass from this class. Note that it inherits certain functions of the base class without overloading them. AcMapTextAlteration inherits AcMapTextAlteration::GetType from AcMapPropertyAlteration and it returns kAlterationTextEntity.

To access the members of this class, create an AcMapTextAlteration pointer using AcMapPropertyAlterationDefinition::AddAlteration and cast it to the AcMapTextAlteration* type as follows:

pDef->AddAlteration(pcAlt, AcMap::kAlterationTextEntity);

...
AcMapTextAlteration *pTextAlt = NULL;
pTextAlt = (AcMapTextAlteration*)pcAlt;
pTextAlt->SetColor("RED");

You are responsible for deleting the pcAlt pointer. Do not attempt to delete the pDef pointer.

You create an AcMapTextAlteration pointer by adding an alteration to the property alteration definition. Next, you specify the text to be altered using AcMapTextAlteration::SetExpression. Default values are used to alter the specified text unless you access members of AcMapTextAlteration, as shown in the following example that changes the color of text. This example assumes you have attached citymap7.dwg from the MAPTUT directory.

// For simplicity, error checking is not shown.

AcMapSession    *mapApi = NULL;
AcMapProject    *pProj = NULL;
AcMapQueryBranch *pQBranch = NULL;
AcMapLocationCondition *pLocationCondition = NULL;
AcMapQuery *pQuery = NULL;
 
mapApi = AcMapGetSession();
mapApi->GetProject(pProj);
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::kAlterationTextEntity);
AcMapTextAlteration *pTextAlt = NULL;
pTextAlt = (AcMapTextAlteration*)pcAlt;
pTextAlt->SetColor("RED");
pcAlt->SetExpression(":NAME@WATER_BODIES");
pQuery->EnablePropertyAlteration(Adesk::kTrue);
pQuery->Define(pQBranch);
pQuery->Run();
delete pcAlt ;
delete pLocationCondition;
delete pQBranch;
delete pQuery;