Exemple #1
0
static char *getPlot3d(char *pAxeUID, scicos_block * block)
{
    char *pPlot3d;

    sco_data *sco = (sco_data *) * (block->work);

    // assert the sco is not NULL
    if (sco == NULL)
    {
        return NULL;
    }

    // fast path for an existing object
    if (sco->scope.cachedPlot3dUID != NULL)
    {
        return sco->scope.cachedPlot3dUID;
    }

    pPlot3d = findChildWithKindAt(pAxeUID, __GO_PLOT3D__, 0);

    /*
     * Allocate if necessary
     */
    if (pPlot3d == NULL)
    {
        pPlot3d = createGraphicObject(__GO_PLOT3D__);

        if (pPlot3d != NULL)
        {
            createDataObject(pPlot3d, __GO_PLOT3D__);
            setGraphicObjectRelationship(pAxeUID, pPlot3d);
        }
    }

    /*
     * Setup on first access
     */
    if (pPlot3d != NULL)
    {

        setBounds(block, pAxeUID, pPlot3d);
        setPlot3dSettings(pPlot3d);
        setDefaultValues(block, pPlot3d);

        {
            int iClipState = 1; //on
            setGraphicObjectProperty(pPlot3d, __GO_CLIP_STATE__, &iClipState, jni_int, 1);
        }
    }

    /*
     * then cache with a local storage
     */
    if (pPlot3d != NULL && sco->scope.cachedPlot3dUID == NULL)
    {
        sco->scope.cachedPlot3dUID = strdup(pPlot3d);
        releaseGraphicObjectProperty(__GO_PARENT__, pPlot3d, jni_string, 1);
    }
    return sco->scope.cachedPlot3dUID;
}
Exemple #2
0
static int getPlot3d(int iAxeUID, scicos_block * block)
{
    int iPlot3d;

    sco_data *sco = (sco_data *) * (block->work);

    // assert the sco is not NULL
    if (sco == NULL)
    {
        return 0;
    }

    // fast path for an existing object
    if (sco->scope.cachedPlot3dUID)
    {
        return sco->scope.cachedPlot3dUID;
    }

    iPlot3d = findChildWithKindAt(iAxeUID, __GO_PLOT3D__, 0);

    /*
     * Allocate if necessary
     */
    if (iPlot3d == 0)
    {
        iPlot3d = createGraphicObject(__GO_PLOT3D__);

        if (iPlot3d != 0)
        {
            createDataObject(iPlot3d, __GO_PLOT3D__);
            setGraphicObjectRelationship(iAxeUID, iPlot3d);
        }
        else
        {
            return 0;
        }
    }

    /*
     * Setup on first access
     */
    setBounds(block, iAxeUID, iPlot3d);
    setPlot3dSettings(iPlot3d);
    setDefaultValues(block, iPlot3d);

    {
        int iClipState = 1; //on
        setGraphicObjectProperty(iPlot3d, __GO_CLIP_STATE__, &iClipState, jni_int, 1);
    }

    /*
     * then cache with a local storage
     */
    sco->scope.cachedPlot3dUID = iPlot3d;
    return sco->scope.cachedPlot3dUID;
}