//-*-c++-*- #ifndef INCLUDED_MapBuilderDemo_h_ #define INCLUDED_MapBuilderDemo_h_ #include "DualCoding/DualCoding.h" #include "Events/EventBase.h" #include "Sound/SoundManager.h" using namespace DualCoding; class MapBuilderDemo : public VisualRoutinesBehavior { public: MapBuilderDemo(): VisualRoutinesBehavior("MapBuilderDemo") {} virtual void DoStart() { VisualRoutinesBehavior::DoStart(); const int pink_index = ProjectInterface::getColorIndex("pink"); const int orange_index = ProjectInterface::getColorIndex("orange"); const int green_index = ProjectInterface::getColorIndex("green"); const int yellow_index = ProjectInterface::getColorIndex("yellow"); vector gazePts; gazePts.push_back(Point(220,80,-100)); gazePts.push_back(Point(350,300,-100)); gazePts.push_back(Point(1000,0,-100)); gazePts.push_back(Point(350,-300,-100)); gazePts.push_back(Point(220,-80,-100)); gazePts.push_back(Point(300,0,-100)); localShS.clear(); NEW_SHAPE(gazePoly, PolygonData, new PolygonData(localShS, gazePts, false)); MapBuilderRequest req(MapBuilderRequest::localMap); req.searchArea = gazePoly; req.pursueShapes = true; req.maxDist = 1000; req.rawY = true; req.clearShapes = false; req.objectColors[lineDataType].insert(pink_index); req.occluderColors[lineDataType].insert(orange_index); req.occluderColors[lineDataType].insert(yellow_index); req.occluderColors[lineDataType].insert(green_index); req.objectColors[ellipseDataType].insert(orange_index); req.objectColors[ellipseDataType].insert(yellow_index); req.objectColors[ellipseDataType].insert(green_index); unsigned int mapreq_id = mapBuilder.executeRequest(req); erouter->addListener(this, EventBase::mapbuilderEGID, mapreq_id, EventBase::statusETID); } virtual void processEvent(const EventBase &event) { cout << "MapBuilder returned " << event.getDescription() << endl; sndman->playFile("barklow.wav"); cout << "Found " << camShS.allShapes().size() << " cam shapes." << endl; SHAPEROOTVEC_ITERATE(camShS, s) s->printParams(); END_ITERATE; cout << "Found " << localShS.allShapes().size() << " local shapes." << endl; SHAPEROOTVEC_ITERATE(localShS, s) s->printParams(); END_ITERATE; } virtual std::string getName() const {return "MapBuilderDemo"; } }; #endif