### Text layer model for dimensioning:

The main element of a dimension is the text. Its textual layer must have the following fields:

- a character field to store the dimension text
- a character field to store the font Of the dimension text
- a real number field to store the dimension text height (in map unit)
- a real number field to store text rotation (degree counterclockwise where zero = horizontal to the right)

Optional fields:

- an integer number field to store the unique ID of the dimension
  This field is required if you want to group the objects of the same dimension and implement the erasing and editing features of an existing dimension. Because it must be a unique value field, actually, it is supported for PostGIS table only where you have to create a serial type not null field which is the primary key of the table. (i.e. “id”). In addition to this you have to create another bigint type field which will be managed by QAD to store the dimension ID (i.e. “dim_id”). Shape files don’t let QAD group objects of the same dimension so, after drawing a dimension, every objects will be independent each one from the other.
- a character field to store the color of the dimension text
- a character field to store the dimension style name (required if you want to use the editing features of an existing dimension)
- a character field (2 characters) to store the dimension style (linear, aligned ...) according to the following scheme:
  "AL" = linear aligned dimension
  "AN" = angular dimension
  "BL" = baseline and continued dimension
  "DI" = diameters of arcs and circles dimension
  "LD" = creates a line that connects annotation to a feature
  "LI" = dimensions using only the horizontal or vertical components of the locations
  "RA" = radial dimension
  "AR" = measure the length along a circle or arc
  (required if you want to use the editing features of an existing dimension)

An SQL example to create a PostGIS table and indexes for dimension text:

CREATE TABLE qad_dimension.dim_text

(

id serial NOT NULL,

text character varying(50) NOT NULL,

font character varying(50) NOT NULL,

h_text double precision NOT NULL,

rot double precision NOT NULL,

color character varying(10) NOT NULL,

dim_style character varying(50) NOT NULL,

dim_type character varying(2) NOT NULL,

geom geometry(Point,3003),

dim_id bigint NOT NULL,

CONSTRAINT dim_text_pkey PRIMARY KEY (id)

)

WITH (

OIDS=FALSE

);

CREATE INDEX dim_text_dim_id

ON qad_dimension.dim_text

USING btree

(dim_id);

CREATE INDEX sidx_dim_text_geom

ON qad_dimension.dim_text

USING gist

(geom);

The textual layer must be defined with labels as follows:

- The font must be read from a field that stores the font character of the dimension text (tab <Labels>-<Text>)
- The size must be read by a real number field that stores the dimension text height (in map units, tab <Labels>-<Text>)
- The rotation must be read by a real number field that stores the dimension text rotation (degree counterclockwise where zero = horizontal to the right), option <Preserve data rotation values> activated, (tab <Labels>-<Placement>)
- Placement <Around point> with distance = 0 (tab <Labels>-<Placement>)
- <Show all label for this layer> option enabled (tab <Labels>-<Rendering>)
- <Show upside-down labels> option with value <always> (tab <Labels>-<Rendering>)
- <Discourage labels from covering features> option disabled (tab <Labels>-<Rendering>)

Optional settings:

- The color can be read from a character field that stores the dimension text color (tab <Labels>-<Text>)