static PyObject *
TimeSliderObject_SetTimeDisplay(PyObject *self, PyObject *args)
{
    TimeSliderObjectObject *obj = (TimeSliderObjectObject *)self;

    int ival;
    if(!PyArg_ParseTuple(args, "i", &ival))
        return NULL;

    // Set the timeDisplay in the object.
    if(ival >= 0 && ival < 4)
    {
/*CUSTOM*/
        int val = (obj->data->GetIntAttribute1() & (~12)) | ((ival & 3) << 2);
        obj->data->SetIntAttribute1(val);
        UpdateAnnotationHelper(obj->data);
    }
    else
    {
        fprintf(stderr, "An invalid timeDisplay value was given. "
                        "Valid values are in the range of [0,2]. "
                        "You can also use the following names: "
                        "AllFrames, FramesForPlot, StatesForPlot, "
                        "UserSpecified.");
        return NULL;
    }

    Py_INCREF(Py_None);
    return Py_None;
}
示例#2
0
static PyObject *
Text3DObject_SetHeightMode(PyObject *self, PyObject *args)
{
    Text3DObjectObject *obj = (Text3DObjectObject *)self;

    int ival;
    if(!PyArg_ParseTuple(args, "i", &ival))
        return NULL;

    // Set the heightMode in the object.
    if(ival >= 0 && ival < 2)
        obj->data->SetHeightMode(ival == 1);
    else
    {
        fprintf(stderr, "An invalid heightMode value was given. "
                        "Valid values are in the range of [0,1]. "
                        "You can also use the following names: "
                        "Relative, Fixed.");
        return NULL;
    }
/*CUSTOM*/
    UpdateAnnotationHelper(obj->data);

    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
TimeSliderObject_SetPercentComplete(PyObject *self, PyObject *args)
{
    TimeSliderObjectObject *obj = (TimeSliderObjectObject *)self;

    double dval;
    if(!PyArg_ParseTuple(args, "d", &dval))
        return NULL;

    // Set the timeDisplay in the object.
    if(dval >= 0. && dval <= 100.)
    {
/*CUSTOM*/
        double percent = dval * 0.01;
        obj->data->SetDoubleAttribute1(percent);
        UpdateAnnotationHelper(obj->data);
    }
    else
    {
        fprintf(stderr, "An invalid percentComplete value was given. "
                        "Valid values are in the range of [0,100].");
        return NULL;
    }

    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
TimeSliderObject_SetTimeFormatString(PyObject *self, PyObject *args)
{
    TimeSliderObjectObject *obj = (TimeSliderObjectObject *)self;

    char *str;
    if(!PyArg_ParseTuple(args, "s", &str))
        return NULL;

    // Set the text in the object.
/*CUSTOM*/
    stringVector s(obj->data->GetText());
    if(s.size() > 1)
    {
        s[1] = str;
    }
    else
    {
        s.clear();
        s.push_back("");
        s.push_back(str);
    }
    obj->data->SetText(s);
    UpdateAnnotationHelper(obj->data);

    Py_INCREF(Py_None);
    return Py_None;
}
示例#5
0
static PyObject *
Text2DObject_SetFontFamily(PyObject *self, PyObject *args)
{
    Text2DObjectObject *obj = (Text2DObjectObject *)self;

    int ival;
    if(!PyArg_ParseTuple(args, "i", &ival))
        return NULL;

    // Set the fontFamily in the object.
    if(ival >= 0 && ival < 3)
    {
/*CUSTOM*/
        obj->data->SetFontFamily(AnnotationObject::FontFamily(ival));
        UpdateAnnotationHelper(obj->data);
    }
    else
    {
        fprintf(stderr, "An invalid fontFamily value was given. "
                        "Valid values are in the range of [0,2]. "
                        "You can also use the following names: "
                        "Arial, Courier, Times.");
        return NULL;
    }

    Py_INCREF(Py_None);
    return Py_None;
}
示例#6
0
static PyObject *
Text3DObject_SetRotations(PyObject *self, PyObject *args)
{
    Text3DObjectObject *obj = (Text3DObjectObject *)self;

    double dvals[3];
    dvals[0] = obj->data->GetRotations()[0];
    dvals[1] = obj->data->GetRotations()[1];
    dvals[2] = obj->data->GetRotations()[2];
    if(!PyArg_ParseTuple(args, "ddd", &dvals[0], &dvals[1], &dvals[2]))
    {
        PyObject     *tuple;
        if(!PyArg_ParseTuple(args, "O", &tuple))
            return NULL;

        if(PyTuple_Check(tuple))
        {
            if(PyTuple_Size(tuple) != 3)
                return NULL;

            PyErr_Clear();
            for(int i = 0; i < PyTuple_Size(tuple); ++i)
            {
                PyObject *item = PyTuple_GET_ITEM(tuple, i);
                if(PyFloat_Check(item))
                    dvals[i] = PyFloat_AS_DOUBLE(item);
                else if(PyInt_Check(item))
                    dvals[i] = double(PyInt_AS_LONG(item));
                else if(PyLong_Check(item))
                    dvals[i] = PyLong_AsDouble(item);
                else
                    dvals[i] = 0.;
            }
        }
        else
            return NULL;
    }

    // Mark the rotations in the object as modified.
    obj->data->SetRotations(dvals);

/*CUSTOM*/
    UpdateAnnotationHelper(obj->data);

    Py_INCREF(Py_None);
    return Py_None;
}
示例#7
0
static PyObject *
Text3DObject_SetActive(PyObject *self, PyObject *args)
{
    Text3DObjectObject *obj = (Text3DObjectObject *)self;

    int ival;
    if(!PyArg_ParseTuple(args, "i", &ival))
        return NULL;

    // Set the active in the object.
    obj->data->SetActive(ival != 0);
/*CUSTOM*/
    UpdateAnnotationHelper(obj->data);

    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
TimeSliderObject_SetUseForegroundForTextColor(PyObject *self, PyObject *args)
{
    TimeSliderObjectObject *obj = (TimeSliderObjectObject *)self;

    int ival;
    if(!PyArg_ParseTuple(args, "i", &ival))
        return NULL;

    // Set the useForegroundForTextColor in the object.
    obj->data->SetUseForegroundForTextColor(ival != 0);
/* CUSTOM */
    UpdateAnnotationHelper(obj->data);

    Py_INCREF(Py_None);
    return Py_None;
}
示例#9
0
static PyObject *
Text3DObject_SetFixedHeight(PyObject *self, PyObject *args)
{
    Text3DObjectObject *obj = (Text3DObjectObject *)self;

    double dval;
    if(!PyArg_ParseTuple(args, "d", &dval))
        return NULL;

    // Set the fixedHeight in the object.
    obj->data->SetFixedHeight(dval);

/*CUSTOM*/
    UpdateAnnotationHelper(obj->data);

    Py_INCREF(Py_None);
    return Py_None;
}
示例#10
0
static PyObject *
Text3DObject_SetText(PyObject *self, PyObject *args)
{
    Text3DObjectObject *obj = (Text3DObjectObject *)self;

    char *str;
    if(!PyArg_ParseTuple(args, "s", &str))
        return NULL;

    // Set the text in the object.
/*CUSTOM*/
    stringVector s; s.push_back(str);
    obj->data->SetText(s);
    UpdateAnnotationHelper(obj->data);

    Py_INCREF(Py_None);
    return Py_None;
}
示例#11
0
static PyObject *
TimeSliderObject_SetShaded(PyObject *self, PyObject *args)
{
    TimeSliderObjectObject *obj = (TimeSliderObjectObject *)self;

    int ival;
    if(!PyArg_ParseTuple(args, "i", &ival))
        return NULL;

    // Set the shaded in the object.
/*CUSTOM*/
    int v = (obj->data->GetIntAttribute1() & (~2)) | ((ival?1:0) << 1);
    obj->data->SetIntAttribute1(v);
    UpdateAnnotationHelper(obj->data);

    Py_INCREF(Py_None);
    return Py_None;
}
示例#12
0
static PyObject *
TimeSliderObject_SetHeight(PyObject *self, PyObject *args)
{
    TimeSliderObjectObject *obj = (TimeSliderObjectObject *)self;

    double dval;
    if(!PyArg_ParseTuple(args, "d", &dval))
        return NULL;

    // Set the height in the object.
/*CUSTOM*/
    double *pos2 = obj->data->GetPosition2();
    pos2[1] = dval;
    obj->data->SelectPosition2();
    UpdateAnnotationHelper(obj->data);

    Py_INCREF(Py_None);
    return Py_None;
}
示例#13
0
static PyObject *
TimeSliderObject_SetPosition(PyObject *self, PyObject *args)
{
    TimeSliderObjectObject *obj = (TimeSliderObjectObject *)self;

    double *dvals = obj->data->GetPosition();
    if(!PyArg_ParseTuple(args, "dd", &dvals[0], &dvals[1]))
    {
        PyObject     *tuple;
        if(!PyArg_ParseTuple(args, "O", &tuple))
            return NULL;

        if(PyTuple_Check(tuple))
        {
            if(PyTuple_Size(tuple) != 2)
                return NULL;

            PyErr_Clear();
            for(int i = 0; i < PyTuple_Size(tuple); ++i)
            {
                PyObject *item = PyTuple_GET_ITEM(tuple, i);
                if(PyFloat_Check(item))
                    dvals[i] = (PyFloat_AS_DOUBLE(item));
                else if(PyInt_Check(item))
                    dvals[i] = double(PyInt_AS_LONG(item));
                else if(PyLong_Check(item))
                    dvals[i] = (PyLong_AsDouble(item));
                else
                    dvals[i] = 0.;
            }
        }
        else
            return NULL;
    }

    // Mark the position in the object as modified.
    obj->data->SelectPosition();
/* CUSTOM */
    UpdateAnnotationHelper(obj->data);

    Py_INCREF(Py_None);
    return Py_None;
}
示例#14
0
static PyObject *
Text3DObject_SetTextColor(PyObject *self, PyObject *args)
{
    Text3DObjectObject *obj = (Text3DObjectObject *)self;

    int c[4];
    if(!PyArg_ParseTuple(args, "iiii", &c[0], &c[1], &c[2], &c[3]))
    {
        c[3] = 255;
        if(!PyArg_ParseTuple(args, "iii", &c[0], &c[1], &c[2]))
        {
            double dr, dg, db, da;
            if(PyArg_ParseTuple(args, "dddd", &dr, &dg, &db, &da))
            {
                c[0] = int(dr);
                c[1] = int(dg);
                c[2] = int(db);
                c[3] = int(da);
            }
            else if(PyArg_ParseTuple(args, "ddd", &dr, &dg, &db))
            {
                c[0] = int(dr);
                c[1] = int(dg);
                c[2] = int(db);
                c[3] = 255;
            }
            else
            {
                PyObject *tuple = NULL;
                if(!PyArg_ParseTuple(args, "O", &tuple))
                    return NULL;

                if(!PyTuple_Check(tuple))
                    return NULL;

                // Make sure that the tuple is the right size.
                if(PyTuple_Size(tuple) < 3 || PyTuple_Size(tuple) > 4)
                    return NULL;

                // Make sure that all elements in the tuple are ints.
                for(int i = 0; i < PyTuple_Size(tuple); ++i)
                {
                    PyObject *item = PyTuple_GET_ITEM(tuple, i);
                    if(PyInt_Check(item))
                        c[i] = int(PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, i)));
                    else if(PyFloat_Check(item))
                        c[i] = int(PyFloat_AS_DOUBLE(PyTuple_GET_ITEM(tuple, i)));
                    else
                        return NULL;
                }
            }
        }
        PyErr_Clear();
    }

    // Set the textColor in the object.
    ColorAttribute ca(c[0], c[1], c[2], c[3]);
    obj->data->SetTextColor(ca);

/*CUSTOM*/
    UpdateAnnotationHelper(obj->data);

    Py_INCREF(Py_None);
    return Py_None;
}