예제 #1
0
	    virtual void QCAR_onUpdate(QCAR::State& /*state*/)
	    {
	        if (switchDataSetAsap)
	        {
	            switchDataSetAsap = false;

	            // Get the image tracker:
	            QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
	            QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
	                trackerManager.getTracker(QCAR::ImageTracker::getClassType()));
	            if (imageTracker == 0 || dataSetStonesAndChips == 0 || dataSetTarmac == 0 || dataSetvmio_vuforial_dev == 0 ||
	                imageTracker->getActiveDataSet() == 0)
	            {
	                LOG("Failed to switch data set.");
	                return;
	            }

				switch( selectedDataset )
				{
					case STONES_AND_CHIPS_DATASET_ID:
						if (imageTracker->getActiveDataSet() != dataSetStonesAndChips)
						{
							imageTracker->deactivateDataSet(dataSetvmio_vuforial_dev);
							imageTracker->deactivateDataSet(dataSetTarmac);
							imageTracker->activateDataSet(dataSetStonesAndChips);
						}
						break;

					case TARMAC_DATASET_ID:
						if (imageTracker->getActiveDataSet() != dataSetTarmac)
						{
							imageTracker->deactivateDataSet(dataSetvmio_vuforial_dev);
							imageTracker->deactivateDataSet(dataSetStonesAndChips);
							imageTracker->activateDataSet(dataSetTarmac);
						}
						break;

					case vmio_vuforial_dev_ID:
						if (imageTracker->getActiveDataSet() != dataSetvmio_vuforial_dev)
						{
							imageTracker->deactivateDataSet(dataSetStonesAndChips);
							imageTracker->activateDataSet(dataSetTarmac);
							imageTracker->deactivateDataSet(dataSetvmio_vuforial_dev);
						}
						break;
				}

				if(isExtendedTrackingActivated)
				{
					QCAR::DataSet* currentDataSet = imageTracker->getActiveDataSet();
					for (int tIdx = 0; tIdx < currentDataSet->getNumTrackables(); tIdx++)
					{
						QCAR::Trackable* trackable = currentDataSet->getTrackable(tIdx);
						trackable->startExtendedTracking();
					}
				}

	        }
	    }
JNIEXPORT jboolean JNICALL
Java_rajawali_vuforia_RajawaliVuforiaActivity_stopExtendedTracking(JNIEnv*, jobject)
{
    QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
    QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
          trackerManager.getTracker(QCAR::ImageTracker::getClassType()));

    QCAR::DataSet* currentDataSet = imageTracker->getActiveDataSet();
    if (imageTracker == 0 || currentDataSet == 0)
    	return JNI_FALSE;

    for (int tIdx = 0; tIdx < currentDataSet->getNumTrackables(); tIdx++)
    {
    	QCAR::Trackable* trackable = currentDataSet->getTrackable(tIdx);
        if(!trackable->stopExtendedTracking())
        	return JNI_FALSE;
    }

    isExtendedTrackingActivated = false;
    return JNI_TRUE;
}
예제 #3
0
	JNIEXPORT jboolean JNICALL
	Java_com_miosys_finder_ui_PfinderTargets_startExtendedTracking(JNIEnv*, jobject)
	{
	    QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();
	    QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
	          trackerManager.getTracker(QCAR::ImageTracker::getClassType()));

	    QCAR::DataSet* currentDataSet = imageTracker->getActiveDataSet();
	    if (imageTracker == 0 || currentDataSet == 0)
	    	return JNI_FALSE;

	    for (int tIdx = 0; tIdx < currentDataSet->getNumTrackables(); tIdx++)
	    {
	        QCAR::Trackable* trackable = currentDataSet->getTrackable(tIdx);
	        if(!trackable->startExtendedTracking())
	        	return JNI_FALSE;
	    }

	    isExtendedTrackingActivated = true;
	    return JNI_TRUE;
	}