示例#1
0
NITFAPI(cgm_Element*) cgm_PolyLineElement_construct(nitf_Error* error)
{
    cgm_Element* element = cgm_Element_construct(CGM_POLYLINE_ELEMENT, error);
    if (element)
    {
        cgm_PolyLineElement* poly = (cgm_PolyLineElement*)
        NITF_MALLOC(sizeof(cgm_PolyLineElement));

        if (!poly)
        {
            NITF_FREE(element);
            return NULL;
        }
        poly->attributes = NULL;
        poly->vertices = nitf_List_construct(error);
        if (!poly->vertices)
        {
            NITF_FREE(poly);
            NITF_FREE(element);
            return NULL;
        }
        element->data = (NITF_DATA*)poly;
    }
    element->print = &polyPrint;
    element->clone = &polyClone;
    element->destroy = &polyDestroy;

    return element;
}
示例#2
0
NITFAPI(cgm_Element*) cgm_EllipticalArcElement_construct(nitf_Error* error)
{
    cgm_Element* element =
        cgm_Element_construct(CGM_ELLIPTICAL_ARC_CENTER_ELEMENT, error);
    if (element)
    {
        cgm_EllipticalArcElement* arc = (cgm_EllipticalArcElement*)
        NITF_MALLOC(sizeof(cgm_EllipticalArcElement));
        if (!arc)
        {
            NITF_FREE(element);
            return NULL;
        }
        arc->attributes = NULL;
        arc->centerX = -1;
        arc->centerY = -1;
        arc->end1X = -1;
        arc->end1Y = -1;
        arc->end2X = -1;
        arc->end2Y = -1;
        arc->startVectorX = -1;
        arc->endVectorY = -1;
        element->data = (NITF_DATA*)arc;
    }
    element->print = &ellipticalArcPrint;
    element->clone = &ellipticalArcClone;
    element->destroy = &ellipticalArcDestroy;

    return element;
}
示例#3
0
NITFAPI(cgm_Element*) cgm_RectangleElement_construct(nitf_Error* error)
{
    cgm_Element* element = cgm_Element_construct(CGM_RECTANGLE_ELEMENT, error);
    if (element)
    {
        cgm_RectangleElement* rect = (cgm_RectangleElement*)
        NITF_MALLOC(sizeof(cgm_RectangleElement));
        if (!rect)
        {
            NITF_FREE(element);
            return NULL;
        }

        rect->attributes = NULL;
        rect->rectangle = NULL;

        element->data = (NITF_DATA*)rect;
    }

    element->print = &rectanglePrint;
    element->clone = &rectangleClone;
    element->destroy = &rectangleDestroy;

    return element;
}
示例#4
0
NITFAPI(cgm_Element*) cgm_CircularArcElement_construct(nitf_Error* error)
{
    cgm_Element* element = cgm_Element_construct(
            CGM_CIRCULAR_ARC_CENTER_ELEMENT, error);
    if (element)
    {
        cgm_CircularArcElement* arc = (cgm_CircularArcElement*)
        NITF_MALLOC(sizeof(cgm_CircularArcElement));
        if (!arc)
        {
            NITF_FREE(element);
            return NULL;
        }
        arc->attributes = NULL;

        arc->centerX = -1;
        arc->centerY = -1;
        arc->startX = -1;
        arc->startY = -1;
        arc->endX = -1;
        arc->endY = -1;
        arc->radius = -1;
        element->data = (NITF_DATA*)arc;

    }
    element->print = &circularArcPrint;
    element->clone = &circularArcClone;
    element->destroy = &circularArcDestroy;

    return element;
}
示例#5
0
NITFAPI(cgm_Element*) cgm_CircleElement_construct(nitf_Error* error)
{
    cgm_Element* element = cgm_Element_construct(CGM_CIRCLE_ELEMENT, error);
    if (element)
    {
        cgm_CircleElement* circle = (cgm_CircleElement*)
        NITF_MALLOC(sizeof(cgm_CircleElement));
        if (!circle)
        {
            NITF_FREE(element);
            return NULL;
        }
        circle->attributes = NULL;
        circle->centerX = -1;
        circle->centerY = -1;
        circle->radius = -1;
        element->data = (NITF_DATA*)circle;
    }
    element->print = &printCircle;
    element->destroy = &destroyCircle;
    element->clone = &cloneCircle;

    return element;
}