Exemple #1
0
int
main(int argc, char *argv[])
{
    AdgPath *path;

    adg_test_init(&argc, &argv);

    adg_test_add_object_checks("/adg/hatch/type/object", ADG_TYPE_HATCH);
    adg_test_add_entity_checks("/adg/hatch/type/entity", ADG_TYPE_HATCH);

    path = adg_path_new();
    adg_path_move_to_explicit(path, 1, 2);
    adg_path_line_to_explicit(path, 4, 5);
    adg_path_line_to_explicit(path, 7, 8);
    adg_path_close(path);
    adg_test_add_global_space_checks("/adg/hatch/behavior/global-space", adg_hatch_new(ADG_TRAIL(path)));
    adg_test_add_local_space_checks("/adg/hatch/behavior/local-space", adg_hatch_new(ADG_TRAIL(path)));
    g_object_unref(path);

    g_test_add_func("/adg/hatch/property/fill-dress", _adg_property_fill_dress);

    return g_test_run();
}
Exemple #2
0
static void
_adg_arrange_class(AdgProjectionClass *projection_class,
                   AdgProjectionScheme scheme)
{
    AdgProjectionClassPrivate *data_class;
    AdgPath *symbol, *axis;

    data_class = projection_class->data_class;

    if (data_class->scheme == scheme)
        return;

    if (data_class->symbol != NULL)
        g_object_unref(data_class->symbol);

    if (data_class->axis != NULL)
        g_object_unref(data_class->axis);

    data_class->scheme = scheme;

    switch(scheme) {
    case ADG_PROJECTION_SCHEME_UNDEFINED:
        symbol = NULL;
        axis = NULL;
        break;
    case ADG_PROJECTION_SCHEME_FIRST_ANGLE:
        symbol = adg_path_new();
        adg_path_move_to_explicit(symbol, 4, 19);
        adg_path_line_to_explicit(symbol, 24, 24);
        adg_path_line_to_explicit(symbol, 24, 4);
        adg_path_line_to_explicit(symbol, 4, 9);
        adg_path_close(symbol);
        adg_path_move_to_explicit(symbol, 49, 14);
        adg_path_arc_to_explicit(symbol, 29, 14, 49, 14);
        adg_path_move_to_explicit(symbol, 44, 14);
        adg_path_arc_to_explicit(symbol, 34, 14, 44, 14);

        axis = adg_path_new();
        adg_path_move_to_explicit(axis, 0, 14);
        adg_path_line_to_explicit(axis, 53, 14);
        adg_path_move_to_explicit(axis, 39, 0);
        adg_path_line_to_explicit(axis, 39, 28);
        break;
    case ADG_PROJECTION_SCHEME_THIRD_ANGLE:
        symbol = adg_path_new();
        adg_path_move_to_explicit(symbol, 29, 19);
        adg_path_line_to_explicit(symbol, 49, 24);
        adg_path_line_to_explicit(symbol, 49, 4);
        adg_path_line_to_explicit(symbol, 29, 9);
        adg_path_close(symbol);
        adg_path_move_to_explicit(symbol, 24, 14);
        adg_path_arc_to_explicit(symbol, 4, 14, 24, 14);
        adg_path_move_to_explicit(symbol, 19, 14);
        adg_path_arc_to_explicit(symbol, 9, 14, 19, 14);

        axis = adg_path_new();
        adg_path_move_to_explicit(axis, 0, 14);
        adg_path_line_to_explicit(axis, 53, 14);
        adg_path_move_to_explicit(axis, 14, 0);
        adg_path_line_to_explicit(axis, 14, 28);
        break;
    default:
        g_return_if_reached();
        break;
    }

    data_class->symbol = symbol;
    data_class->axis = axis;
    data_class->extents.is_defined = FALSE;

    if (axis != NULL)
        cpml_extents_add(&data_class->extents,
                         adg_trail_get_extents((AdgTrail *) axis));

    if (symbol != NULL)
        cpml_extents_add(&data_class->extents,
                         adg_trail_get_extents((AdgTrail *) symbol));
}
Exemple #3
0
static void
_adg_arrange_class(AdgLogoClass *logo_class)
{
    AdgLogoClassPrivate *data_class;
    CpmlExtents *extents;

    data_class = logo_class->data_class;
    extents = &data_class->extents;

    if (data_class->symbol == NULL) {
        AdgPath *path = adg_path_new();

        adg_path_move_to_explicit(path, 8, 26);
        adg_path_line_to_explicit(path, 24, 10);
        adg_path_arc_to_explicit(path, 32, 18, 24, 26);
        adg_path_line_to_explicit(path, 24, 11);

        adg_path_move_to_explicit(path, 40, 10);
        adg_path_arc_to_explicit(path, 32, 18, 40, 26);
        adg_path_line_to_explicit(path, 40, 22);
        adg_path_line_to_explicit(path, 38, 22);

        adg_path_move_to_explicit(path, 23, 22);
        adg_path_line_to_explicit(path, 16, 22);

        data_class->symbol = path;
        extents->is_defined = FALSE;
    }

    if (data_class->screen == NULL) {
        AdgPath *path = adg_path_new();

        adg_path_move_to_explicit(path, 3, 3);
        adg_path_line_to_explicit(path, 47, 3);
        adg_path_fillet(path, 10);
        adg_path_line_to_explicit(path, 47, 33);
        adg_path_fillet(path, 10);
        adg_path_line_to_explicit(path, 3, 33);
        adg_path_fillet(path, 10);
        adg_path_close(path);
        adg_path_fillet(path, 10);

        data_class->screen = path;
        extents->is_defined = FALSE;
    }

    if (data_class->frame == NULL) {
        AdgPath *path = adg_path_new();

        adg_path_move_to_explicit(path, 0, 0);
        adg_path_line_to_explicit(path, 50, 0);
        adg_path_line_to_explicit(path, 50, 36);
        adg_path_line_to_explicit(path, 0, 36);
        adg_path_close(path);

        data_class->frame = path;
        extents->is_defined = FALSE;
    }

    if (!data_class->extents.is_defined) {
        cpml_extents_add(extents,
                         adg_trail_get_extents((AdgTrail *) data_class->symbol));
        cpml_extents_add(extents,
                         adg_trail_get_extents((AdgTrail *) data_class->screen));
        cpml_extents_add(extents,
                         adg_trail_get_extents((AdgTrail *) data_class->frame));
    }
}