tsc_Entity

This class is the base class for all job data model objects.  The class is lightweight and should generally be copied or constructed as an instance or a reference rather than being 'new'ed.

The tsc_Entity class is abstract; it may only exist as one of its subclasses.

The subclasses include:

Member functions

To help determine the subclass type, the following member functions are provided:

bool IsPoint() const;
bool IsLine() const;
bool IsArc() const;
bool IsPolyline() const;

Use these methods to obtain a subclass from a tsc_Entity type.  All subclasses contain constructors that accept a tsc_Entity.  For example:

{

    tsc_EntityList mapEnts = myDatabase.MapSelections();

    if ((mapEnts.Count() > 0) && mapEnts[0].IsPoint())

    {

        tsc_Point myPoint {mapEnts[0]};

        ...

    }


bool IsDeleted() const;
Returns true if the entity has been flagged as deleted.

tsc_EntitySource SourceDatabaseType () const;
Returns the database that is the source of the entity.

tsc_String Name () const;
Returns the entity's name; all entity types have a name.  Names are not necessarily unique; there may be many objects of the same name.  Points of the same name have special rules, but they refer to entirely different objects for lines or arcs.  Valid names may not be more than 16 characters.

tsc_String Notes () const;
Returns the notes associated with this object.  The string may include line breaks, represented in C++ as "\r\n".

tsc_String FeatureString () const;
Returns the feature string (otherwise known as the Code) of the entity.

tsc_EntityFeatures Features() const;
Returns the list of features and their attributes that are attached to this entity.

bool Exists() const;
An entity may refer to an object which belongs to a file (job, csv, dxf, ifc, etc) which may have been detached since the object was originally referenced.  If this occurs, the entity becomes "empty", meaning that most functions on the entity will work but return null values.  To determine if an object still exists use this function.

tsc_XmlElement GetEntityJxl() const;
Returns complete job xml for the entity. This XML fragment may be modified by methods in the tsc_XmlElement class, however these will change only the local XML, not the underlying database objects or the job XML.  For more information about JXL including a link to the schema click here.

Removal of entities by other threads

Entities don't "suddenly" cease to exist.  All code within the plugin that refers to global objects such as the database is protected by a locking mechanism internal to Survey Core.  Within any one event handler you can obtain a list of entities, remove non-existent items, and use the list knowing that all remaining objects will continue to exist.  This rule will apply until the plugin exits the current function and returns to Survey Core, or executes any code which may cause a wait, such as calling ShowDialog on a tsc_Form, calling tsc_MessageBox::Show, tsc_SurveyCore::Sleep(), or other similar function, including many of the UI methods.