Synopsis

#include <adg-1/adg.h>

struct              AdgDim;
struct              AdgDimClass;
AdgDress            adg_dim_get_dim_dress               (AdgDim *dim);
void                adg_dim_set_dim_dress               (AdgDim *dim,
                                                         AdgDress dress);
void                adg_dim_set_ref1                    (AdgDim *dim,
                                                         const AdgPoint *ref1);
void                adg_dim_set_ref1_explicit           (AdgDim *dim,
                                                         gdouble x,
                                                         gdouble y);
void                adg_dim_set_ref1_from_pair          (AdgDim *dim,
                                                         const CpmlPair *ref1);
void                adg_dim_set_ref1_from_model         (AdgDim *dim,
                                                         AdgModel *model,
                                                         const gchar *ref1);
AdgPoint *          adg_dim_get_ref1                    (AdgDim *dim);
void                adg_dim_set_ref2                    (AdgDim *dim,
                                                         const AdgPoint *ref2);
void                adg_dim_set_ref2_explicit           (AdgDim *dim,
                                                         gdouble x,
                                                         gdouble y);
void                adg_dim_set_ref2_from_pair          (AdgDim *dim,
                                                         const CpmlPair *ref2);
void                adg_dim_set_ref2_from_model         (AdgDim *dim,
                                                         AdgModel *model,
                                                         const gchar *ref2);
AdgPoint *          adg_dim_get_ref2                    (AdgDim *dim);
void                adg_dim_set_pos                     (AdgDim *dim,
                                                         const AdgPoint *pos);
void                adg_dim_set_pos_explicit            (AdgDim *dim,
                                                         gdouble x,
                                                         gdouble y);
void                adg_dim_set_pos_from_pair           (AdgDim *dim,
                                                         const CpmlPair *pos);
void                adg_dim_set_pos_from_model          (AdgDim *dim,
                                                         AdgModel *model,
                                                         const gchar *pos);
AdgPoint *          adg_dim_get_pos                     (AdgDim *dim);
void                adg_dim_set_level                   (AdgDim *dim,
                                                         gdouble level);
gdouble             adg_dim_get_level                   (AdgDim *dim);
void                adg_dim_set_outside                 (AdgDim *dim,
                                                         AdgThreeState outside);
AdgThreeState       adg_dim_get_outside                 (AdgDim *dim);
void                adg_dim_set_detached                (AdgDim *dim,
                                                         AdgThreeState detached);
AdgThreeState       adg_dim_get_detached                (AdgDim *dim);
void                adg_dim_set_value                   (AdgDim *dim,
                                                         const gchar *value);
const gchar *       adg_dim_get_value                   (AdgDim *dim);
void                adg_dim_set_limits                  (AdgDim *dim,
                                                         const gchar *min,
                                                         const gchar *max);
void                adg_dim_set_min                     (AdgDim *dim,
                                                         const gchar *min);
const gchar *       adg_dim_get_min                     (AdgDim *dim);
void                adg_dim_set_max                     (AdgDim *dim,
                                                         const gchar *max);
const gchar *       adg_dim_get_max                     (AdgDim *dim);
gdouble             adg_dim_quote_angle                 (AdgDim *dim,
                                                         gdouble angle);
AdgAlignment *      adg_dim_get_quote                   (AdgDim *dim);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----AdgEntity
               +----AdgDim
                     +----AdgADim
                     +----AdgLDim
                     +----AdgRDim

Properties

  "detached"                 AdgThreeState         : Read / Write
  "dim-dress"                AdgDress              : Read / Write
  "level"                    gdouble               : Read / Write
  "max"                      gchar*                : Read / Write
  "min"                      gchar*                : Read / Write
  "outside"                  AdgThreeState         : Read / Write
  "pos"                      AdgPoint*             : Read / Write
  "ref1"                     AdgPoint*             : Read / Write
  "ref2"                     AdgPoint*             : Read / Write
  "value"                    gchar*                : Read / Write / Construct

Description

The AdgDim class is the base stub of all the dimension entities.

Details

struct AdgDim

struct AdgDim;

All fields are private and should not be used directly. Use its public methods instead.

Since 1.0


struct AdgDimClass

struct AdgDimClass {
    /* Virtual table */
    gdouble             (*quote_angle)          (gdouble         angle);
    gchar *             (*default_value)        (AdgDim         *dim);
};

The default implementation of quote_angle flips the quote if it should be rotated in the bottom right half of the circle, that is:

1
if 1/3 PI <= angle <= -3/4  PI; then angle += PI.

The virtual method default_value instead *must* be implemented by any derived class. The default implementation will trigger an error if called.

quote_angle ()

virtual method that must return the rotation angle of the quote (in radians) of the current dimension.

default_value ()

abstract virtual method that must return the default value (as a newly allocated string to be freed with g_free()) of the current dimension.

Since 1.0


adg_dim_get_dim_dress ()

AdgDress            adg_dim_get_dim_dress               (AdgDim *dim);

Gets the dimension dress to be used in rendering dim.

dim :

an AdgDim

Returns :

the current dimension dress. [transfer none]

Since 1.0


adg_dim_set_dim_dress ()

void                adg_dim_set_dim_dress               (AdgDim *dim,
                                                         AdgDress dress);

Sets a new dimension dress to dim. The new dress must be related to the original dress for this property: you cannot set a dress used for line styles to a dress managing fonts.

The check is done by calling adg_dress_are_related() with dress and the previous dress as arguments. Check out its documentation for details on what is a related dress.

dim :

an AdgDim

dress :

the new AdgDress to use

Since 1.0


adg_dim_set_ref1 ()

void                adg_dim_set_ref1                    (AdgDim *dim,
                                                         const AdgPoint *ref1);

Sets the "ref1" property to ref1. The old point is silently discarded, unreferencing its model if that point was bound to a named pair (hence, possibly destroying the model if this was the last reference).

ref1 can be NULL, in which case the point is destroyed.

dim :

an AdgDim

ref1 :

the new point to use as first reference

Since 1.0


adg_dim_set_ref1_explicit ()

void                adg_dim_set_ref1_explicit           (AdgDim *dim,
                                                         gdouble x,
                                                         gdouble y);

Sets the "ref1" property to the (x, y) explicit coordinates. The old point is silently discarded, unreferencing its model if that point was bound to a named pair (hence, possibly destroying the model if this was the last reference).

dim :

an AdgDim

x :

x coordinate of the first reference point

y :

y coordinate of the first reference point

Since 1.0


adg_dim_set_ref1_from_pair ()

void                adg_dim_set_ref1_from_pair          (AdgDim *dim,
                                                         const CpmlPair *ref1);

Convenient function to set the "ref1" property using a pair instead of explicit coordinates.

dim :

an AdgDim

ref1 :

the coordinates pair of the first reference point

Since 1.0


adg_dim_set_ref1_from_model ()

void                adg_dim_set_ref1_from_model         (AdgDim *dim,
                                                         AdgModel *model,
                                                         const gchar *ref1);

Binds "ref1" to the ref1 named pair of model. If model is NULL, the point will be unset. In any case, the old point is silently discarded, unreferencing its model if that point was bound to a named pair (hence, possibly destroying the model if this was the last reference).

The assignment is lazy so ref1 could be not be present in model. Anyway, at the first access to this point an error will be raised if the named pair is still missing.

dim :

an AdgDim

model :

the source AdgModel

ref1 :

a named pair in model

Since 1.0


adg_dim_get_ref1 ()

AdgPoint *          adg_dim_get_ref1                    (AdgDim *dim);

Gets the "ref1" point of dim.

The returned point is internally owned and must not be freed or modified. Anyway it is not const because a call to adg_point_update() with the returned value must be able to modify the internal cache.

dim :

an AdgDim

Returns :

the first reference point. [transfer none]

Since 1.0


adg_dim_set_ref2 ()

void                adg_dim_set_ref2                    (AdgDim *dim,
                                                         const AdgPoint *ref2);

Sets the "ref2" property to ref2. The old point is silently discarded, unreferencing its model if that point was bound to a named pair (hence, possibly destroying the model if it was the last reference).

ref2 can be NULL, in which case the point is destroyed.

dim :

an AdgDim

ref2 :

the new point to use as second reference

Since 1.0


adg_dim_set_ref2_explicit ()

void                adg_dim_set_ref2_explicit           (AdgDim *dim,
                                                         gdouble x,
                                                         gdouble y);

Sets the "ref2" property to the (x, y) explicit coordinates. The old point is silently discarded, unreferencing its model if that point was bound to a named pair (hence, possibly destroying the model if this was the last reference).

dim :

an AdgDim

x :

x coordinate of the second reference point

y :

y coordinate of the second reference point

Since 1.0


adg_dim_set_ref2_from_pair ()

void                adg_dim_set_ref2_from_pair          (AdgDim *dim,
                                                         const CpmlPair *ref2);

Convenient function to set the "ref2" property using a pair instead of explicit coordinates.

dim :

an AdgDim

ref2 :

the coordinates pair of the second reference point

Since 1.0


adg_dim_set_ref2_from_model ()

void                adg_dim_set_ref2_from_model         (AdgDim *dim,
                                                         AdgModel *model,
                                                         const gchar *ref2);

Binds "ref2" to the ref2 named pair of model. If model is NULL, the point will be unset. In any case, the old point is silently discarded, unreferencing its model if that point was bound to a named pair (hence, possibly destroying the model if this was the last reference).

The assignment is lazy so ref2 could be not be present in model. Anyway, at the first access to this point an error will be raised if the named pair is still missing.

dim :

an AdgDim

model :

the source AdgModel

ref2 :

a named pair in model

Since 1.0


adg_dim_get_ref2 ()

AdgPoint *          adg_dim_get_ref2                    (AdgDim *dim);

Gets the "ref2" point of dim.

The returned point is internally owned and must not be freed or modified. Anyway it is not const because a call to adg_point_update() with the returned value must be able to modify the internal cache.

dim :

an AdgDim

Returns :

the second reference point. [transfer none]

Since 1.0


adg_dim_set_pos ()

void                adg_dim_set_pos                     (AdgDim *dim,
                                                         const AdgPoint *pos);

Sets the "pos" property of dim to pos. The old point is silently discarded, unreferencing its model if that point was bound to a named pair (hence, possibly destroying the model if it was the last reference).

pos can be NULL, in which case the point is destroyed.

dim :

an AdgDim

pos :

the new point to use as position

Since 1.0


adg_dim_set_pos_explicit ()

void                adg_dim_set_pos_explicit            (AdgDim *dim,
                                                         gdouble x,
                                                         gdouble y);

Sets the "pos" property to the (x, y) explicit coordinates. The old point is silently discarded, unreferencing its model if that point was bound to a named pair (hence, possibly destroying the model if this was the last reference).

dim :

an AdgDim

x :

x coordinate of the position

y :

y coordinate of the position

Since 1.0


adg_dim_set_pos_from_pair ()

void                adg_dim_set_pos_from_pair           (AdgDim *dim,
                                                         const CpmlPair *pos);

Convenient function to set the "pos" property using a pair instead of explicit coordinates.

dim :

an AdgDim

pos :

the coordinates pair of the position point

Since 1.0


adg_dim_set_pos_from_model ()

void                adg_dim_set_pos_from_model          (AdgDim *dim,
                                                         AdgModel *model,
                                                         const gchar *pos);

Binds "pos" to the pos named pair of model. If model is NULL, the point will be unset. In any case, the old point is silently discarded, unreferencing its model if that point was bound to a named pair (hence, possibly destroying the model if this was the last reference).

The assignment is lazy so pos could be not be present in model. Anyway, at the first access to this point an error will be raised if the named pair is still missing.

dim :

an AdgDim

model :

the source AdgModel

pos :

a named pair in model

Since 1.0


adg_dim_get_pos ()

AdgPoint *          adg_dim_get_pos                     (AdgDim *dim);

Gets the "pos" point of dim.

The returned point is internally owned and must not be freed or modified. Anyway it is not const because a call to adg_point_update() with the returned value must be able to modify the internal cache.

dim :

an AdgDim

Returns :

the position point. [transfer none]

Since 1.0


adg_dim_set_level ()

void                adg_dim_set_level                   (AdgDim *dim,
                                                         gdouble level);

Sets a new level for this dimension. The level is used to stack the quotes using a spacing value from dim_style (specified in global space).

dim :

an AdgDim

level :

the new level

Since 1.0


adg_dim_get_level ()

gdouble             adg_dim_get_level                   (AdgDim *dim);

Gets the level of this dimension.

dim :

an AdgDim

Returns :

the level value.

Since 1.0


adg_dim_set_outside ()

void                adg_dim_set_outside                 (AdgDim *dim,
                                                         AdgThreeState outside);

Sets a new state for the "outside" flag: check the property documentation for further details.

dim :

an AdgDim

outside :

the new outside state

Since 1.0


adg_dim_get_outside ()

AdgThreeState       adg_dim_get_outside                 (AdgDim *dim);

Gets the state of the "outside" property: check the property documentation for further details.

dim :

an AdgDim

Returns :

the current flag state.

Since 1.0


adg_dim_set_detached ()

void                adg_dim_set_detached                (AdgDim *dim,
                                                         AdgThreeState detached);

Sets a new state for the "detached" flag: check the property documentation for further details.

This is used only by dimensions where detaching has meaning. In some cases, such as with AdgRDim dimensions, this property is not used.

dim :

an AdgDim

detached :

the new detached state

Since 1.0


adg_dim_get_detached ()

AdgThreeState       adg_dim_get_detached                (AdgDim *dim);

Gets the state of the "detached" property: check the property documentation for further details.

dim :

an AdgDim

Returns :

the current flag state.

Since 1.0


adg_dim_set_value ()

void                adg_dim_set_value                   (AdgDim *dim,
                                                         const gchar *value);

Explicitely sets the text to use as value. If value is NULL or was never set, an automatic text is calculated using the format specified in the current AdgDimStyle and getting its value by calling the default_value() virtual method.

Inside the template string, the "<>" tag (or whatever specified by the "number-tag" property) is substituted with the string returned by the default_value() virtual method.

dim :

an AdgDim

value :

the value text. [allow-none]

Since 1.0


adg_dim_get_value ()

const gchar *       adg_dim_get_value                   (AdgDim *dim);

Gets the value text. The string is internally owned and must not be freed or modified.

dim :

an AdgDim

Returns :

the value text. [transfer none]

Since 1.0


adg_dim_set_limits ()

void                adg_dim_set_limits                  (AdgDim *dim,
                                                         const gchar *min,
                                                         const gchar *max);

Shortcut to set both the limits at once.

dim :

an AdgDim

min :

the new minumum value. [allow-none]

max :

the new maximum value. [allow-none]

Since 1.0


adg_dim_set_min ()

void                adg_dim_set_min                     (AdgDim *dim,
                                                         const gchar *min);

Sets the minimum value. Use NULL as min to disable it.

dim :

an AdgDim

min :

the new minimum limit. [allow-none]

Since 1.0


adg_dim_get_min ()

const gchar *       adg_dim_get_min                     (AdgDim *dim);

Gets the minimum value text or NULL on minimum value disabled.

The string is internally owned and must not be freed or modified.

dim :

an AdgDim

Returns :

the mimimum value text. [transfer none]

Since 1.0


adg_dim_set_max ()

void                adg_dim_set_max                     (AdgDim *dim,
                                                         const gchar *max);

Sets the maximum value. Use NULL as max to disable it.

dim :

an AdgDim

max :

the new maximum value. [allow-none]

Since 1.0


adg_dim_get_max ()

const gchar *       adg_dim_get_max                     (AdgDim *dim);

Gets the maximum value text or NULL on maximum value disabled.

The string is internally owned and must not be freed or modified.

dim :

an AdgDim

Returns :

the maximum value text. [transfer none]

Since 1.0


adg_dim_quote_angle ()

gdouble             adg_dim_quote_angle                 (AdgDim *dim,
                                                         gdouble angle);

Note

This function is only useful in new dimension implementations.

Converts angle accordling to the style of dim. Any quote angle should be validated by this method because every dimensioning style has its own convention regardling the text rotation.

dim :

an AdgDim

angle :

an angle (in radians)

Returns :

the angle to use (always in radians).

Since 1.0


adg_dim_get_quote ()

AdgAlignment *      adg_dim_get_quote                   (AdgDim *dim);

Gets the quote entity, if any. This function is valid only after the AdgDim implementation of the arrange() virtual method has been called.

The returned entity is owned by dim and should not be modified or freed.

Note

This function is only useful in new dimension implementations.

dim :

an AdgDim

Returns :

the quote entity. [transfer none]

Since 1.0

Property Details

The "detached" property

  "detached"                 AdgThreeState         : Read / Write

Where the quote must be positioned: in the middle of the base line (ADG_THREE_STATE_OFF), near the pos point (ADG_THREE_STATE_ON) or should be automatically deducted depending on the available space.

Default value: ADG_THREE_STATE_UNKNOWN


The "dim-dress" property

  "dim-dress"                AdgDress              : Read / Write

The dress to use for rendering this dimension.


The "level" property

  "level"                    gdouble               : Read / Write

The dimension level, that is the factor to multiply the baseline spacing (defined in the dimension style) to get the offset from pos where the quote should be rendered.

Default value: 1


The "max" property

  "max"                      gchar*                : Read / Write

The maximum value allowed or the highest tolerance from value (depending of the dimension style): set to NULL to suppress.

Default value: NULL


The "min" property

  "min"                      gchar*                : Read / Write

The minimum value allowed or the lowest tolerance from value (depending of the dimension style): set to NULL to suppress.

Default value: NULL


The "outside" property

  "outside"                  AdgThreeState         : Read / Write

Whether the arrows must be inside the extension lines (ADG_THREE_STATE_OFF), must be extended outside the extension lines (ADG_THREE_STATE_ON) or should be automatically handled depending on the available space.

Default value: ADG_THREE_STATE_UNKNOWN


The "pos" property

  "pos"                      AdgPoint*             : Read / Write

The reference position of the quote: it will be combined with "level" to get the real quote position.


The "ref1" property

  "ref1"                     AdgPoint*             : Read / Write

First reference point of the dimension.


The "ref2" property

  "ref2"                     AdgPoint*             : Read / Write

Second reference point of the dimension.


The "value" property

  "value"                    gchar*                : Read / Write / Construct

The template string to be used for generating the set value of the quote.

Default value: NULL