CRopeKeyframe::~CRopeKeyframe() { // Release transmit state ownership. SetStartPoint( NULL, 0 ); SetEndPoint( NULL, 0 ); SetParent( NULL, 0 ); }
//============================================================================ // NCGShading::SetStartEndPoints : Set the start/end points. //---------------------------------------------------------------------------- void NCGShading::SetStartEndPoints(const NRectangle &theRect, NPosition startPos, NPosition endPos) { // Update our state SetStartPoint(theRect.GetPoint(startPos)); SetEndPoint( theRect.GetPoint(endPos)); }
// ============================================================================ // ============================================================================ bool Vista2DLine::Init(float nPosX1, float nPosY1, float nPosX2, float nPosY2, unsigned char nRed, unsigned char nGreen, unsigned char nBlue) { bool success = SetStartPoint(nPosX1, nPosY1); success &= SetEndPoint(nPosX2,nPosY2); success &= SetColor(nRed,nGreen,nBlue); m_bIsInitialized = success; return success; }
void BasicPacketFlow::Pause(BOOL bWouldBlock, UINT32 ulPausePoint) { if (ulPausePoint > 0) { SetEndPoint(ulPausePoint, TRUE); } else { if (m_bIsPausePointSet) { m_bIsPausePointSet = FALSE; m_uEndPoint = 0; } m_bPlayPendingOnSeek = FALSE; m_bSessionPlaying = FALSE; HandleTimeLineStateChange(FALSE); if (!bWouldBlock) { // can we get multiple pauses? if (!m_bPaused) { m_bPaused = TRUE; // must be set before UpdatePlayTime(). HXTimeval hxt = m_pAccurateClock->GetTimeOfDay(); Timeval t((long)hxt.tv_sec, (long)hxt.tv_usec); m_tvBankedPlayTime += (t - m_tvRTSPPlayTime); UpdatePlayTime(); } } if (m_pRateManager) { IHXPacketFlowControl* pRateMgrFlowControl = NULL; if (HXR_OK == m_pRateManager->QueryInterface(IID_IHXPacketFlowControl, (void**)&pRateMgrFlowControl)) { pRateMgrFlowControl->Pause(ulPausePoint); HX_RELEASE(pRateMgrFlowControl); } } } }
void CRopeKeyframe::Activate() { BaseClass::Activate(); if( !m_bCreatedFromMapFile ) return; // Legacy support.. if ( m_iRopeMaterialModelIndex == -1 ) { m_iRopeMaterialModelIndex = PrecacheModel( "cable/cable.vmt" ); } // Find the next entity in our chain. CBaseEntity *pEnt = gEntList.FindEntityByName( NULL, m_iNextLinkName ); if( pEnt && pEnt->edict() ) { SetEndPoint( pEnt ); if( m_spawnflags & SF_ROPE_RESIZE ) m_RopeFlags |= ROPE_RESIZE; } else { // If we're from the map file, and we don't have a target ent, and // "Start Dangling" wasn't set, then this rope keyframe doesn't have // any rope coming out of it. if ( m_fLockedPoints & (int)ROPE_LOCK_END_POINT ) { m_RopeFlags &= ~ROPE_SIMULATE; } } // By default, our start point is our own entity. SetStartPoint( this ); // If we don't do this here, then when we save/load, we won't "own" the transmit // state of our parent, so the client might get our entity without our parent entity. SetParent( GetParent(), GetParentAttachment() ); EndpointsChanged(); Init(); }
int main(int argc, char ** argv) { QString volcR10("C:/develop/$sync/GFZ/data/VTK XML data/Volcano 2 topo.vtp"); auto object = Loader::readFile( volcR10 ); double bounds[6]; auto & dataSet = *object->dataSet(); dataSet.GetBounds(bounds); vtkVector2d A{ bounds[0], 0 }; vtkVector2d B{ bounds[1], 0 }; auto inputPolyData = dynamic_cast<PolyDataObject *>(object.get()); auto selector = vtkSmartPointer<LineOnCellsSelector2D>::New(); selector->SetInputData(&dataSet); selector->SetCellCentersConnection(inputPolyData->cellCentersOutputPort()); selector->SetStartPoint(A); selector->SetEndPoint(B); //auto extractSelection = vtkSmartPointer<vtkExtractSelectedPolyDataIds>::New(); //extractSelection->SetInputData(&dataSet); //extractSelection->SetInputConnection(1, selector->GetOutputPort()); //extractSelection->Update(); //auto vPoly = extractSelection->GetOutput(); //auto extractSelection = vtkSmartPointer<vtkExtractSelection>::New(); //extractSelection->SetInputData(&dataSet); //extractSelection->SetSelectionConnection(selector->GetOutputPort()); //extractSelection->Update(); //auto outputData = vtkUnstructuredGrid::SafeDownCast(extractSelection->GetOutput()); //auto vPoly = vtkSmartPointer<vtkPolyData>::New(); //vPoly->SetPoints(outputData->GetPoints()); //vPoly->SetPolys(outputData->GetCells()); //vPoly->GetCellData()->PassData(outputData->GetCellData()); //vPoly->GetPointData()->PassData(outputData->GetPointData()); selector->Update(); auto vPoly = selector->GetExtractedPoints(); auto poly = std::make_unique<PolyDataObject>("extraction", *vPoly); QApplication app(argc, argv); ColorMappingChooser cmc; cmc.show(); RenderConfigWidget rcw; rcw.show(); RendererConfigWidget rrcw; rrcw.show(); DataSetHandler dsh; DataMapping dm(dsh); auto view = dm.openInRenderView({ poly.get(), object.get() }); auto pointsVis = dynamic_cast<RenderedPolyData *>(view->visualizationFor(poly.get())); pointsVis->mainActor()->GetProperty()->SetPointSize(5); pointsVis->mainActor()->PickableOn(); auto baseVis = dynamic_cast<RenderedPolyData *>(view->visualizationFor(object.get())); baseVis->mainActor()->GetProperty()->SetOpacity(0.2); baseVis->mainActor()->PickableOff(); view->show(); cmc.setCurrentRenderView(view); rcw.setCurrentRenderView(view); rcw.setSelectedData(poly.get()); rrcw.setCurrentRenderView(view); return app.exec(); }
void LeapMotionHandler::leapDraw(bool& lockCurrentFrame, bool proxActive, drawing::Illustrator& illustrator) { proxActive = false; if (proxActive) { return; } //Get all pointables from current leap frame Leap::PointableList pointables = this->currentFrame.pointables(); //Gets a virtual rectangular prism which is within the field of view of Leap Leap::InteractionBox iBox = this->currentFrame.interactionBox(); auto fingerLocationCircles = vector<drawing::TouchCircle>(); auto drawEventsToSendToIllustrator = vector<drawing::DrawEvent>(); //Traverse all pointables for (auto& point : pointables) { //Normalize points from iBox Leap::Vector normalizedPosition = iBox.normalizePoint(point.stabilizedTipPosition()); //Get x and y coordinate value form normalized value within given window float leapXCoordinate = normalizedPosition.x * windowWidth; float leapYCoordinate = windowHeight - normalizedPosition.y * windowHeight; float touchDistance = point.touchDistance(); auto currentPoint = vec2(leapXCoordinate, leapYCoordinate); auto pointId = point.id(); auto guid = getGuid(pointId); int eventMaxLifeSpan = 1; if (touchDistance > 0 && point.touchZone() != Leap::Pointable::Zone::ZONE_NONE) { auto color = distanceToColor(touchDistance); fingerLocationCircles.push_back(drawing::TouchCircle(currentPoint, 40.0f, color, 50.0f, true, 1)); auto finalizableDrawEventIterator = finalizeableDrawEvents.find(guid); bool finilizableDrawEventWasFound = finalizableDrawEventIterator != finalizeableDrawEvents.end(); if (finilizableDrawEventWasFound) { auto finalizableEvent = finalizableDrawEventIterator->second; //finalize that sumbitch send it to the illustrator finalizableEvent.SetEndPoint(currentPoint); drawEventsToSendToIllustrator.push_back(finalizableEvent); //delete it from finalizeableDrawEvents finalizeableDrawEvents.erase(finalizableDrawEventIterator); //remove guid associated with this event pointIdToGuidMap.erase(pointId); } } if(touchDistance < 0) { lockCurrentFrame = true; auto finalizableDrawEventIterator = finalizeableDrawEvents.find(guid); bool finalizableDrawEventWasFound = finalizableDrawEventIterator != finalizeableDrawEvents.end(); if(finalizableDrawEventWasFound) //continuation of series of draw events { auto finalizableEvent = finalizableDrawEventIterator->second; //reset life of finilizable draw event, so it doesnt die finalizableEvent.ResetCurrentAge(); //check if we are continuing any temp draw events auto tempDrawEventIterator = temporaryDrawEvents.find(guid); bool tempDrawEventWasFound = tempDrawEventIterator != temporaryDrawEvents.end(); if (tempDrawEventWasFound) //continuation of previous temp draw event { auto tempDrawEvent = tempDrawEventIterator->second; //finish temp draw event tempDrawEvent.SetEndPoint(currentPoint); //send it off drawEventsToSendToIllustrator.push_back(tempDrawEvent); //remove from temporaryDrawEvents temporaryDrawEvents.erase(tempDrawEventIterator); } else { auto parentStartLocation = finalizableEvent.GetStartPoint(); //create new temp draw event auto newTempDrawEvent = drawing::DrawEvent(currentPoint, parentStartLocation, guid, false, eventMaxLifeSpan); temporaryDrawEvents.insert_or_assign(guid, newTempDrawEvent); } } else //should be a new series of drawing events { //create new finilizable draw event auto newFinalizableDrawEvent = drawing::DrawEvent(currentPoint, guid, true, eventMaxLifeSpan); createPointIdToGuidMapping(pointId, guid); finalizeableDrawEvents.insert_or_assign(guid, newFinalizableDrawEvent); } } } if (fingerLocationCircles.size() > 0) { illustrator.addToTemporaryCircles(fingerLocationCircles); } if (drawEventsToSendToIllustrator.size() > 0) { illustrator.addDrawEventsToQueue(drawEventsToSendToIllustrator); } //increment all draw events lifespan //remove all those that exceed max life span for (auto it = begin(temporaryDrawEvents); it != end(temporaryDrawEvents);) { if (!it->second.ShouldBeAlive()) { it = temporaryDrawEvents.erase(it); } else ++it; } for (auto it = begin(finalizeableDrawEvents); it != end(finalizeableDrawEvents);) { if (!it->second.ShouldBeAlive()) { it = finalizeableDrawEvents.erase(it); } else ++it; } }
void CSearchMap::SetEndPoint(MapPoint p) { SetEndPoint(p.x, p.y); }