当前位置: 首页>>代码示例>>C++>>正文


C++ Locator类代码示例

本文整理汇总了C++中Locator的典型用法代码示例。如果您正苦于以下问题:C++ Locator类的具体用法?C++ Locator怎么用?C++ Locator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Locator类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PopulateLocators

// Update the locators in the vPath object
int Path::PopulateLocators()
{
    try{
        // Get the global locator
        Locator tempLocator = iblob->locateGlobal();
        // The tempLocator will finally contain a locator to the object
        for(vector<PathComponent>::iterator it = vPath.begin(); it!= vPath.end(); it++)
        {
            if(tempLocator.getElements() < (uint)it->accessCode)
            {
                consistent = false;
                throw 0;
            }
            tempLocator = iblob->locate(tempLocator, (*it).accessCode);
            (*it).loc = tempLocator;
        }
        consistent = true;
        return 1;
    }
    catch(...)
    {
        consistent = false;
        cerr<<"Cannot make the path consistent"<<endl;
        throw string("Cannot make the path consistent");
        return 0;
    }
}
开发者ID:virup,项目名称:Spatial-Network-Data,代码行数:28,代码来源:Path.cpp

示例2:

LocatorImpl::LocatorImpl(const Locator& loc)
{
	_publicId     = loc.getPublicId();
	_systemId     = loc.getSystemId();
	_lineNumber   = loc.getLineNumber();
	_columnNumber = loc.getColumnNumber();
}
开发者ID:Victorcasas,项目名称:georest,代码行数:7,代码来源:LocatorImpl.cpp

示例3:

//==============================================================================
LocatorImpl::LocatorImpl(const Locator& rhs) :
	m_colNo(rhs.getColumnNumber()),
	m_lineNo(rhs.getLineNumber()),
	m_publicId(rhs.getPublicId()),
	m_systemId(rhs.getSystemId())
{
}
开发者ID:twangjie,项目名称:quickcpp,代码行数:8,代码来源:LocatorImpl.cpp

示例4: operator

		void operator()(Locator loc, bool first)
		{
			// write the separator if necessary
			if(!first) this->out << ", ";
			else indent(this->out, this->obj.depth()+1);
			// write the value
			wr_val(loc.get());
		}
开发者ID:Manokha,项目名称:firestarter,代码行数:8,代码来源:json.hpp

示例5: operator

 void operator()(Locator loc, bool first)
 {
     this->indent(1);
     this->out << '<' << name << '>';
     // write the value
     wr_val(loc.get());
     this->out << '<' << name << "/>";
 }
开发者ID:teotwaki,项目名称:firestarter,代码行数:8,代码来源:xml.hpp

示例6: makeInconsistent

Locator Path::gotoBO()
{
    makeInconsistent();
    Locator l;

    try{
        l = iblob->locateGlobal();
    }
    catch(...)
    {
        cerr<<endl<<"ERROR locating Global"<<endl;
    }
    vector<PathComponent>::iterator it = vPath.begin();
    do
    {
        try{
            if((l.getElements() == (it->accessCode)))
            {
                l = iblob->insert(l,it->accessCode, OBJECT_LEVEL);
                it->loc = l;
            }
            else
            {
                l = l.locate(it->accessCode);
            }
        }
        catch(...)
        {
            cerr<<"Path::gotoBO - Discontinuity detected"<<endl;
            throw string("discontinuity");
        }
        it++;
    }while(it!= vPath.end()-1);

    if(l.getElements() < (uint)it->accessCode)
        throw string("Not Present");
    return l;
}
开发者ID:virup,项目名称:Spatial-Network-Data,代码行数:38,代码来源:Path.cpp

示例7: findUnsolvedSceneItems

    ResourceSolverPtr findUnsolvedSceneItems(SceneInfo* sceneInfo)
    {
        SceneSolver* solver = new SceneSolver;
        ResourceSolverPtr holder(solver);

        MeshLocator meshLocator(DEFAULT_RESOURCE_GROUP_NAME);

        typedef std::map<String, Locator*> LocatorMap;
        LocatorMap locators;
        locators["MeshName"] = &meshLocator;
        // TODO: other locators

        typedef std::pair<String,Ogre::String> TypeValuePair;
        typedef std::map<TypeValuePair, UnsolvedSceneItem*> UnsolvedMap;
        UnsolvedMap unsolvedMap;

        const Scene::Objects& objects = sceneInfo->getObjects();
        for (Scene::Objects::const_iterator itObject = objects.begin(); itObject != objects.end(); ++itObject)
        {
            const ObjectPtr& object = *itObject;
            const PropertyList& properties = object->getProperties();
            for (PropertyList::const_iterator itProperty = properties.begin(); itProperty != properties.end(); ++itProperty)
            {
                const PropertyDef& propertyDef = *itProperty;
                LocatorMap::const_iterator itLocator = locators.find(propertyDef.type);
                if (itLocator == locators.end())
                    continue;

                Locator* locator = itLocator->second;
                assert(locator);

               Ogre::String value = object->getPropertyAsString(propertyDef.name);
                TypeValuePair key(propertyDef.type, value);
                std::pair<UnsolvedMap::iterator, bool> inserted =
                    unsolvedMap.insert(UnsolvedMap::value_type(key, NULL));
                if (!inserted.second)
                {
                    // The item already checked
                    if (!inserted.first->second)
                    {
                        // The item exists
                        continue;
                    }
                }
                else
                {
                    // First time to check the item
                    bool found = locator->exists(value);
                    if (found)
                    {
                        continue;
                    }

                    // Create new unsolved resource
                    UnsolvedSceneItem* item = new UnsolvedSceneItem(solver);
                    solver->unsolvedResources.push_back(UnsolvedResourcePtr(item));

                    // Setup origin name
                    item->origin = value;

                    // Setup description
                    item->description = locator->getDescription(value, object->getName(), propertyDef.name);

                    // Setup recommend values
                    item->recommends = locator->getRecommendValues(value);

                    // Setup possible values
                    item->possibles = locator->getPossibleValues(value);

                    inserted.first->second = item;
                }

                inserted.first->second->references.push_back(UnsolvedSceneItem::Reference(object, propertyDef.name));
            }
        }

        return holder;
    }
开发者ID:gitrider,项目名称:wxsj2,代码行数:78,代码来源:FairySceneSolver.cpp

示例8: main

int main() {
	/*namedWindow("Left Camera", WINDOW_AUTOSIZE);
	namedWindow("Right Camera", WINDOW_AUTOSIZE);

	int cam1 = -1;
	int cam2 = -1;
	vector<vector<int>> perms;
	int numCams = 0;
	for (int i = 0;; i++) {
		VideoCapture cam(i);
		if (cam.isOpened()) {
			numCams++;
		}
		else {
			break;
		}
	}
	for (int i = 0; i < numCams - 1; i++) {
		for (int j = i + 1; j < numCams; j++) {
			vector<int> v1 = { i, j };
			vector<int> v2 = { j, i };
			perms.push_back(v1);
			perms.push_back(v2);
		}
	}

	for (int i = 0; cam1 < 0 || cam2 < 0; i++) {
		if (i = perms.size) {
			i = 0;
		}
		Mat img1;
		Mat img2;
		VideoCapture cam1(perms[i][0]);
		VideoCapture cam2(perms[i][1]);
		int key = -1;
		while (waitKey(0)) {
			cam1.read(img1);
			cam2.read(img2);
			imshow("Left Camera", img1);
			imshow("Right Camera", img2)
		}
	}*/


	RECT desktop;
	const HWND hDesktop = GetDesktopWindow();
	int width = 0;
	int height = 0;
	GetWindowRect(hDesktop, &desktop);
	width = (int)desktop.right;
	int adjustedWidth = (int)(width*1.5);
	height = (int)desktop.bottom;
	int adjustedHeight = (int)(height*1.5);

	Locator locator = Locator();

	int screenx = 0;
	int screeny = 0;
	vector<vector<double>> frames;
	bool click = false;
	int i=0;

	bool makeMove = true;

	while (true) {
		vector<double> point = locator.get3DPoint();
		
		//cout << "(" << point[0] << " , " << point[1] << " , " << point[2] << ")" << endl;
		double xwidth = 2 * (point[2] - 164.75) * tan(28.35 / 180 * PI);
		double ywidth = 1.2 * point[2] * tan(34 * PI / 180);
		
		
		
		double zDiff = 0;
		
		if (frames.size()==10){
			zDiff = frames[0][2] - frames[9][2];
		}
		if (((point[0] == 0 && point[1] == 0 && point[2] == 0)||zDiff>=50)&&i>10) {
			if (!frames.empty()){
				if (!click){
					click = true;
					if (makeMove) {
						leftclick(frames[0][0], frames[0][1]);
					}
					i = 0;
				}
			}
		}
		else{
			if (click){ 
				click = false; 
			
			}
			screenx = (int)(((1 - (point[0] + xwidth / 2) / xwidth)* adjustedWidth) - adjustedWidth*.25);
			screeny = (int)(((1 - (point[1] + ywidth / 2) / ywidth) * adjustedHeight) - adjustedHeight*.25);
			//cout << "(" << screenx << " , " << screeny << ")" << endl;
			if (makeMove) {
				SetCursorPos(screenx, screeny);
			}
//.........这里部分代码省略.........
开发者ID:drew-neely,项目名称:TheHamsterMouse,代码行数:101,代码来源:Source.cpp

示例9: if

void RayTracedTechnique::init()
{
    OSG_INFO<<"RayTracedTechnique::init()"<<std::endl;

    if (!_volumeTile)
    {
        OSG_NOTICE<<"RayTracedTechnique::init(), error no volume tile assigned."<<std::endl;
        return;
    }

    if (_volumeTile->getLayer()==0)
    {
        OSG_NOTICE<<"RayTracedTechnique::init(), error no layer assigend to volume tile."<<std::endl;
        return;
    }

    if (_volumeTile->getLayer()->getImage()==0)
    {
        OSG_NOTICE<<"RayTracedTechnique::init(), error no image assigned to layer."<<std::endl;
        return;
    }

     ShadingModel shadingModel = Isosurface;
     float alphaFuncValue = 0.1;

    _transform = new osg::MatrixTransform;

    osg::ref_ptr<osg::Geode> geode = new osg::Geode;

    _transform->addChild(geode.get());

    osg::Image* image_3d = 0;
    osg::TransferFunction1D* tf = 0;
    Locator* masterLocator = _volumeTile->getLocator();
    Locator* layerLocator = _volumeTile->getLayer()->getLocator();

    image_3d = _volumeTile->getLayer()->getImage();


    CollectPropertiesVisitor cpv;
    if (_volumeTile->getLayer()->getProperty())
    {
        _volumeTile->getLayer()->getProperty()->accept(cpv);
    }

    if (cpv._isoProperty.valid())
    {
        shadingModel = Isosurface;
        alphaFuncValue = cpv._isoProperty->getValue();
    }
    else if (cpv._mipProperty.valid())
    {
        shadingModel = MaximumIntensityProjection;
    }
    else if (cpv._lightingProperty.valid())
    {
        shadingModel = Light;
    }
    else
    {
        shadingModel = Standard;
    }

    if (cpv._tfProperty.valid())
    {
        tf = dynamic_cast<osg::TransferFunction1D*>(cpv._tfProperty->getTransferFunction());
    }

    if (cpv._afProperty.valid())
    {
        alphaFuncValue = cpv._afProperty->getValue();
    }


    if (!masterLocator && layerLocator) masterLocator = layerLocator;
    if (!layerLocator && masterLocator) layerLocator = masterLocator;


    osg::Matrix geometryMatrix;
    if (masterLocator)
    {
        geometryMatrix = masterLocator->getTransform();
        _transform->setMatrix(geometryMatrix);
        masterLocator->addCallback(new TransformLocatorCallback(_transform.get()));
    }

    osg::Matrix imageMatrix;
    if (layerLocator)
    {
        imageMatrix = layerLocator->getTransform();
    }

    OSG_INFO<<"RayTracedTechnique::init() : geometryMatrix = "<<geometryMatrix<<std::endl;
    OSG_INFO<<"RayTracedTechnique::init() : imageMatrix = "<<imageMatrix<<std::endl;

    osg::Texture::InternalFormatMode internalFormatMode = osg::Texture::USE_IMAGE_DATA_FORMAT;

    {

        osg::Texture::FilterMode minFilter = osg::Texture::LINEAR;
//.........这里部分代码省略.........
开发者ID:3dcl,项目名称:osg,代码行数:101,代码来源:RayTracedTechnique.cpp

示例10: write_to_blob

void write_to_blob(int number)
{
    // ESTABLISH CONNECTION TO THE DATABASE
    prepareBLOB_In_DB(string("phoenix.cise.ufl.edu:1521/orcl"), string(username), string(password));

    //iBlobStore * store = new iBlobOracleStore(mylob, errhp, svchp);
    iBlobStore * store = new iBlobOracleStore(mylob, errhp, svchp);
    iBlob p (store, false);

    // Start the timer
    clock_t begin=clock();

    /* IBLOB FUNCTIONS USED TO CREATE THE SEGMENT OBJECT */
    for(int i = 0; i < number; i++)
    {
        cout<<i<<endl;
        Locator lGlobal = p.locateGlobal();
        cout<<"Done 1 "<<endl;
        Locator l;
        if(lGlobal.getElements()  == 0)
        {cout<<"Here"<<endl;
            l = p.insert(lGlobal, 0);
        }
        cout<<"Done 2 "<<endl;
        Locator lLeftPt = l.insert(0);
        cout<<"Done 3 "<<endl;
        Locator lRightPt = l.insert(1);
        cout<<"Done 4 "<<endl;
        Locator lLPTx = lLeftPt.insert(0);
        cout<<"Done 5 "<<endl;
        Locator lLPTy = lLeftPt.insert(1);
        cout<<"Done 6 "<<endl;
        Locator lRPTx = lRightPt.insert(0);
        cout<<"Done 7 "<<endl;
        Locator lRPTy = lRightPt.insert(1);
        cout<<"Done 8 "<<endl;
        double x1 = fRand(0,MAX);
        double y1 = fRand(0,MAX);
        double x2 = fRand(0,MAX);
        double y2 = fRand(0,MAX);
        cout<<"Done 8.5 "<<endl;
        p.insertVal(x1, lLeftPt, 0);
        cout<<"Done 9 "<<endl;
        p.insertVal(y1, lLPTy, 0);
        cout<<"Done 10 "<<endl;
        p.insertVal(x2, lRPTx, 0);
        cout<<"Done 11 "<<endl;
        p.insertVal(y2, lRPTy, 0);
        cout<<"Done 12 "<<endl;
    }

    /****************************************************/
    clock_t end=clock();
    cout << "Time elapsed: " << double(diffclock(end,begin)) << " ms"<< endl;

    closeConnection();
}
开发者ID:virup,项目名称:TSS,代码行数:57,代码来源:stressTestSegment.cpp

示例11: expirationTime

void* Visualizer::DataLocator::incrementalExtractorThreadMethod(void)
	{
	/* Enable asynchronous cancellation of this thread: */
	Threads::Thread::setCancelState(Threads::Thread::CANCEL_ENABLE);
	Threads::Thread::setCancelType(Threads::Thread::CANCEL_ASYNCHRONOUS);
	
	/* Handle extraction requests until interrupted: */
	Realtime::AlarmTimer alarm;
	Misc::Time expirationTime(0.1);
	while(true)
		{
		/* Wait until there is a seed request: */
		Locator* locator;
		{
		Threads::Mutex::Lock seedRequestLock(seedRequestMutex);
		#ifdef __DARWIN__
		while(seedLocator==0)
			{
			seedRequestCond.wait(seedRequestMutex);
			if(terminate)
				return 0;
			}
		#else
		while(seedLocator==0)
			seedRequestCond.wait(seedRequestMutex);
		#endif
		locator=seedLocator;
		seedLocator=0;
		extracting=true;
		}
		
		/* Start extracting a new visualization element: */
		int nextIndex=(renderIndex+1)%3;
		if(nextIndex==mostRecentIndex)
			nextIndex=(nextIndex+1)%3;
		
		if(locator->isValid())
			{
			if(extractor->getPipe()!=0)
				{
				/* Notify the slave nodes that a new visualization element is coming: */
				extractor->getPipe()->write<int>(1);
				}
			trackedElements[nextIndex]=extractor->startElement(locator);
			
			/* Continue extracting the visualization element until it is done: */
			bool keepGrowing;
			do
				{
				/* Grow the visualization element by a little bit: */
				alarm.armTimer(expirationTime);
				keepGrowing=!extractor->continueElement(alarm);
				
				/* Set the most recently updated visualization element: */
				mostRecentIndex=nextIndex;
				Vrui::requestUpdate();
				
				/* Check if the current element is still being tracked: */
				{
				Threads::Mutex::Lock seedRequestLock(seedRequestMutex);
				if(seedTracking)
					keepGrowing=false;
				extracting=keepGrowing;
				}
				}
			while(keepGrowing);
			extractor->finishElement();
			}
		else
			{
			if(extractor->getPipe()!=0)
				{
				/* Notify the slave nodes that the currently tracked visualization element should be deleted: */
				extractor->getPipe()->write<int>(0);
				}
			trackedElements[nextIndex]=0;
			mostRecentIndex=nextIndex;
			Vrui::requestUpdate();
			}
		delete locator;
		if(extractor->getPipe()!=0)
			{
			extractor->getPipe()->barrier();
			}
		}
	
	return 0;
	}
开发者ID:jrevote,项目名称:3DA-3DVisualizer,代码行数:88,代码来源:DataLocator.cpp

示例12: while

void* Visualizer::DataLocator::immediateExtractorThreadMethod(void)
	{
	/* Enable asynchronous cancellation of this thread: */
	Threads::Thread::setCancelState(Threads::Thread::CANCEL_ENABLE);
	Threads::Thread::setCancelType(Threads::Thread::CANCEL_ASYNCHRONOUS);
	
	/* Handle extraction requests until interrupted: */
	while(true)
		{
		/* Wait until there is an extraction request: */
		Locator* locator;
		{
		Threads::Mutex::Lock seedRequestLock(seedRequestMutex);
		#ifdef __DARWIN__
		do
			{
			seedRequestCond.wait(seedRequestMutex);
			if(terminate)
				return 0;
			}
		while(!extracting);
		#else
		do
			{
			seedRequestCond.wait(seedRequestMutex);
			}
		while(!extracting);
		#endif
		locator=seedLocator;
		seedLocator=0;
		}
		
		/* Extract a new visualization element: */
		int nextIndex=(renderIndex+1)%3;
		if(nextIndex==mostRecentIndex)
			nextIndex=(nextIndex+1)%3;
		
		if(extractor->hasSeededCreator()&&locator!=0&&locator->isValid())
			{
			/* Extract a seeded element: */
			if(extractor->getPipe()!=0)
				{
				/* Notify the slave nodes that a new visualization element is coming: */
				extractor->getPipe()->write<int>(1);
				}
			trackedElements[nextIndex]=extractor->createElement(locator);
			}
		else if(!extractor->hasSeededCreator())
			{
			/* Extract a global element: */
			if(extractor->getPipe()!=0)
				{
				/* Notify the slave nodes that a new visualization element is coming: */
				extractor->getPipe()->write<int>(1);
				}
			trackedElements[nextIndex]=extractor->createElement();
			}
		else
			{
			if(extractor->getPipe()!=0)
				{
				/* Notify the slave nodes that the currently tracked visualization element should be deleted: */
				extractor->getPipe()->write<int>(0);
				}
			trackedElements[nextIndex]=0;
			}
		delete locator;
		
		if(extractor->getPipe()!=0)
			{
			/* Wait until the new visualization element has arrived at all slaves: */
			extractor->getPipe()->barrier();
			}
		
		/* Hand the new visualization element to the application: */
		mostRecentIndex=nextIndex;
		Vrui::requestUpdate();
		}
	
	return 0;
	}
开发者ID:jrevote,项目名称:3DA-3DVisualizer,代码行数:81,代码来源:DataLocator.cpp

示例13: Container

Container::Container(Locator locator) : Container(locator.GetPath())
{
}
开发者ID:jalal70,项目名称:readium-sdk,代码行数:3,代码来源:container.cpp

示例14: main

// The MAIN function, from here we start the application and run the game loop
int main()
{

	
	

	// Init GLFW
	glfwInit();
	// Set all the required options for GLFW
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
	glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);

	// Create a GLFWwindow object that we can use for GLFW's functions
	GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "Hamster Cube", nullptr, nullptr);
	glfwMakeContextCurrent(window);

	// Set the required callback functions
	glfwSetKeyCallback(window, key_callback);
	glfwSetCursorPosCallback(window, mouse_callback);
	glfwSetScrollCallback(window, scroll_callback);

	//glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);

	// Set this to true so GLEW knows to use a modern approach to retrieving function pointers and extensions
	glewExperimental = GL_TRUE;
	// Initialize GLEW to setup the OpenGL Function pointers
	glewInit();

	// Define the viewport dimensions
	glViewport(0, 0, WIDTH, HEIGHT);

	// Setup OpenGL options
	glEnable(GL_DEPTH_TEST);


	// Build and compile our shader program
	Shader ourShader("C:/Users/Drew/Desktop/HamsterVert.txt", "C:/Users/Drew/Desktop/HamsterFrag.txt");


	// Set up vertex data (and buffer(s)) and attribute pointers
	GLfloat vertices[] = {
		-0.5f, -0.5f, -0.5f,
		0.5f, -0.5f, -0.5f,
		0.5f, 0.5f, -0.5f,
		0.5f, 0.5f, -0.5f,
		-0.5f, 0.5f, -0.5f,
		-0.5f, -0.5f, -0.5f,

		-0.5f, -0.5f, 0.5f,
		0.5f, -0.5f, 0.5f,
		0.5f, 0.5f, 0.5f,
		0.5f, 0.5f, 0.5f,
		-0.5f, 0.5f, 0.5f,
		-0.5f, -0.5f, 0.5f,

		-0.5f, 0.5f, 0.5f,
		-0.5f, 0.5f, -0.5f,
		-0.5f, -0.5f, -0.5f,
		-0.5f, -0.5f, -0.5f,
		-0.5f, -0.5f, 0.5f,
		-0.5f, 0.5f, 0.5f,

		0.5f, 0.5f, 0.5f,
		0.5f, 0.5f, -0.5f,
		0.5f, -0.5f, -0.5f,
		0.5f, -0.5f, -0.5f,
		0.5f, -0.5f, 0.5f,
		0.5f, 0.5f, 0.5f,

		-0.5f, -0.5f, -0.5f,
		0.5f, -0.5f, -0.5f,
		0.5f, -0.5f, 0.5f,
		0.5f, -0.5f, 0.5f,
		-0.5f, -0.5f, 0.5f,
		-0.5f, -0.5f, -0.5f,

		-0.5f, 0.5f, -0.5f,
		0.5f, 0.5f, -0.5f,
		0.5f, 0.5f, 0.5f,
		0.5f, 0.5f, 0.5f,
		-0.5f, 0.5f, 0.5f,
		-0.5f, 0.5f, -0.5f,
	};
	GLuint VBO, VAO;
	glGenVertexArrays(1, &VAO);
	glGenBuffers(1, &VBO);

	glBindVertexArray(VAO);

	glBindBuffer(GL_ARRAY_BUFFER, VBO);
	glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

	// Position attribute
	glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), (GLvoid*)0);
	glEnableVertexAttribArray(0);


//.........这里部分代码省略.........
开发者ID:drew-neely,项目名称:TheHamster,代码行数:101,代码来源:main.cpp


注:本文中的Locator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。