本文整理汇总了C++中ControlPoint类的典型用法代码示例。如果您正苦于以下问题:C++ ControlPoint类的具体用法?C++ ControlPoint怎么用?C++ ControlPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ControlPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void SplineControl::controlPoint_FingerUp(ControlPoint &cp, const FingerEventArgs &e)
{
if(!controlPointContains(e))
{
for(vector<ControlPoint *>::iterator it = controlPoints.begin(); it != controlPoints.end(); it++)
{
ControlPoint *itCp = *it;
assert(itCp != NULL);
if(cp.getId() == itCp->getId())
{
controlPoints.erase(it);
break;
}
}
deleteInterfaceElement(&cp);
}
snapControlPoint(cp);
fullLengthDirty = true;
dirty = true;
splineDirty = true;
}
示例2: RestoreControlPoints
void OpacityTransferFunctionWidget::RestoreControlPoints(int number,
float max,
float* scalar,
float* opacity) {
// Temporary control point
ControlPoint tmp;
// Set number of control points
_numberOfControlPoints = number;
// Set maximum scalar value
_scalarMaximum = max;
// Clear all control points
_controlPoint.clear();
// Set each control point from arrays
for (int i = 0 ; i < number ; i++) {
tmp.SetScalar(scalar[i]);
tmp.SetOpacity(opacity[i]);
_controlPoint.push_back(tmp);
}
// Set focus point
_focusPoint = -1;
return;
}
示例3: fillLineEdits
void QnetSetAprioriDialog::fillLineEdits() {
QString id = m_points.at(0)->text();
ControlPoint *pt = m_qnetTool->controlNet()->GetPoint(id);
SurfacePoint sPt = pt->GetAprioriSurfacePoint();
vector<Distance> targetRadii = m_qnetTool->controlNet()->GetTargetRadii();
sPt.SetRadii(Distance(targetRadii[0]),
Distance(targetRadii[1]),
Distance(targetRadii[2]));
if (sPt.GetLatitude().degrees() != Null) {
aprioriLatEdit->setText(
QString::number(sPt.GetLatitude().degrees()));
}
if (sPt.GetLatSigmaDistance().meters() != Null) {
latSigmaEdit->setText(
QString::number(sPt.GetLatSigmaDistance().meters()));
}
if (sPt.GetLongitude().degrees() != Null) {
aprioriLonEdit->setText(
QString::number(sPt.GetLongitude().degrees()));
}
if (sPt.GetLonSigmaDistance().meters() != Null) {
lonSigmaEdit->setText(
QString::number(sPt.GetLonSigmaDistance().meters()));
}
if (sPt.GetLocalRadius().meters() != Null) {
aprioriRadiusEdit->setText(
QString::number(sPt.GetLocalRadius().meters()));
}
if (sPt.GetLocalRadiusSigma().meters() != Null) {
radiusSigmaEdit->setText(
QString::number(sPt.GetLocalRadiusSigma().meters()));
}
}
示例4: setControlPointLatLon
/**
* Calculates the lat/lon of the ControlNet.
*
* @param incubes The filename of the list of cubes in the ControlNet
* @param cnet The filename of the ControlNet
*/
void setControlPointLatLon(SerialNumberList &snl, ControlNet &cnet) {
CubeManager manager;
manager.SetNumOpenCubes(50); //Should keep memory usage to around 1GB
Progress progress;
progress.SetText("Calculating Lat/Lon");
progress.SetMaximumSteps(cnet.GetNumPoints());
progress.CheckStatus();
for (int cp = 0; cp < cnet.GetNumPoints(); cp++) {
ControlPoint *point = cnet.GetPoint(cp);
ControlMeasure *cm = point->GetRefMeasure();
Cube *cube = manager.OpenCube(snl.FileName(cm->GetCubeSerialNumber()));
try {
cube->camera()->SetImage(cm->GetSample(), cm->GetLine());
g_surfacePoints[point->GetId()] = cube->camera()->GetSurfacePoint();
}
catch (IException &e) {
QString msg = "Unable to create camera for cube file [";
msg += snl.FileName(cm->GetCubeSerialNumber()) + "]";
throw IException(e, IException::Unknown, msg, _FILEINFO_);
}
cube = NULL; //Do not delete, manager still has ownership
progress.CheckStatus();
}
manager.CleanCubes();
}
示例5: getControlPoint
void RenewSubscriber::run()
{
ControlPoint *ctrlp = getControlPoint();
long renewInterval = RenewSubscriber::INTERVAL * 1000;
while (isRunnable() == true) {
Wait(renewInterval);
ctrlp->renewSubscriberService();
}
}
示例6: getControlPoint
void Disposer::run()
{
ControlPoint *ctrlp = getControlPoint();
long monitorInterval = ctrlp->getExpiredDeviceMonitoringInterval() * 1000;
while (isRunnable() == true) {
uHTTP::Wait(monitorInterval);
ctrlp->removeExpiredDevices();
//ctrlp->print();
}
}
示例7: getControlPoint
void SSDPSearchResponseSocket::run()
{
ControlPoint *ctrlPoint = getControlPoint();
while (isRunnable() == true) {
//Thread.yield();
SSDPPacket *packet = receive();
if (packet == NULL)
continue;
if (ctrlPoint != NULL)
ctrlPoint->searchResponseReceived(packet);
}
}
示例8: stretchControlPoints
void FFTSplineControl::stretchControlPoints(float factor)
{
for(unsigned int i = 0; i < controlPoints.size(); i++)
{
ControlPoint *cp = controlPoints[i];
assert(cp != NULL);
float x = cp->getPosition().getX();
x *= factor;
cp->getPosition().setX(x);
}
}
示例9: unlockPoint
void QnetSetAprioriDialog::unlockPoint(QListWidgetItem *pointId) {
ControlPoint *pt = m_qnetTool->controlNet()->GetPoint(pointId->text());
if (pt->IsEditLocked() && pointId->checkState() == Qt::Unchecked) {
pt->SetEditLock(false);
editLockPointsListBox->removeItemWidget(pointId);
pointId->setHidden(true);
editLockPointsListBox->repaint();
this->repaint();
emit netChanged();
}
}
示例10:
QDebug operator<<(QDebug debug, const ControlPoint &controlPoint)
{
if (controlPoint.isValid()) {
debug.nospace() << "ControlPoint("
<< controlPoint.coordinate().x() << ", "
<< controlPoint.coordinate().y() << ", "
<< controlPoint.pointType() << ')';
} else {
debug.nospace() << "ControlPoint(invalid)";
}
return debug.space();
}
示例11: getRelationSecondControlPointIndex
unsigned int Editor::getRelationSecondControlPointIndex(unsigned int relationId)
{
CSP* containingCSP = m_relationIdToContainingCSP[relationId];
AntPostRelation* relation = containingCSP->getAntPostRelationById(relationId);
if (relation == NULL) {
return NO_ID;
}
ControlPoint* currentControlPoint = (ControlPoint*) relation->entity2();
return currentControlPoint->getId();
}
示例12: ControlPoint
void SplineControl::registerControlPoint(const Point2f &p)
{
ControlPoint *controlPoint = new ControlPoint(p, height * CONTROL_POINT_SIZE);
controlPoint->setFingerDragged(MakeDelegate(this, &SplineControl::controlPoint_FingerDragged));
controlPoint->setFingerUp(MakeDelegate(this, &SplineControl::controlPoint_FingerUp));
registerInterfaceElement(controlPoint);
controlPoints.push_back(controlPoint);
sort(controlPoints.begin(), controlPoints.end(), &ControlPoint::compare);
fullLengthDirty = true;
dirty = true;
splineDirty = true;
}
示例13: addPortMapping
bool PortMapper::addPortMapping(Device& igd, PortMapping& pm)
{
bool rval = false;
// get wan IP connection service from device
ControlPoint cp;
Service wipcs = cp.getWanIpConnectionService(igd);
if(!wipcs.isNull())
{
// add port mapping
rval = cp.addPortMapping(pm, wipcs);
}
return rval;
}
示例14: glPushAttrib
/*
void SplineControl::renderSplineControl(float SplineControlWidth)
{
glPushAttrib(GL_LINE_BIT | GL_CURRENT_BIT);
glColor4f(1.0f, 1.0f, 1.0, 1.0f);
glLineWidth(getLineWidth(2.0f));
glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINE_STRIP);
float increment = InterfaceManager::getBeatLength() / (float)InterfaceManager::VALUES_PER_BEAT;
for(float f = 0.0; f <= SplineControlWidth; f+= (increment / (float)UPSAMPLE_FACTOR))
{
float legendlessHeight = height - ((height * LEGEND_DIM) * 2.0f);
float value = getValue(f);
float vx = f;
float vy = (value * legendlessHeight) + (height * LEGEND_DIM);
glVertex3f(vx, height - vy, 0.0f);
}
glEnd();
glDisable(GL_LINE_SMOOTH);
glPopAttrib();
}
*/
void SplineControl::savePreset(unsigned int presetType)
{
WavesGlobalState *wavesGlobalState = WavesGlobalState::getInstance();
assert(wavesGlobalState != NULL);
std::map<unsigned int, SplinePreset *> &splinePresets = wavesGlobalState->getSplinePresets();
unsigned int numControlPoints = controlPoints.size();
if(numControlPoints > 0)
{
std::vector<const Point2f> points;
for(unsigned int i = 0; i < numControlPoints; i++)
{
ControlPoint *cp = controlPoints[i];
assert(cp != NULL);
const Point2f &cPos = cp->getPosition();
float sx = cPos.getX() / width;
float sy = cPos.getY() / height;
Point2f sp(sx, sy);
points.push_back(sp);
}
// HACK : assume that if saved and Id in particular range, it must be a default and so save an altered copy
if((!presetSaved && numControlPoints > 0) || (presetSaved && presetId >= 0 && presetId <= 5))
{
unsigned int pId = SplinePreset::generateId();
SplinePreset *preset = new SplinePreset(pId, points, width, (SplinePreset::PresetType)presetType);
assert(preset != NULL);
splinePresets[pId] = preset;
preset->save();
presetId = pId;
presetSaved = true;
}
else
{
SplinePreset *preset = splinePresets[presetId];
assert(preset != NULL);
preset->setPoints(points);
preset->save();
}
}
}
示例15: switch
bool AnimationPath::getInterpolatedControlPoint(double time,ControlPoint& controlPoint) const
{
if (_timeControlPointMap.empty()) return false;
switch(_loopMode)
{
case(SWING):
{
double modulated_time = (time - getFirstTime())/(getPeriod()*2.0);
double fraction_part = modulated_time - floor(modulated_time);
if (fraction_part>0.5) fraction_part = 1.0-fraction_part;
time = getFirstTime()+(fraction_part*2.0) * getPeriod();
break;
}
case(LOOP):
{
double modulated_time = (time - getFirstTime())/getPeriod();
double fraction_part = modulated_time - floor(modulated_time);
time = getFirstTime()+fraction_part * getPeriod();
break;
}
case(NO_LOOPING):
// no need to modulate the time.
break;
}
TimeControlPointMap::const_iterator second = _timeControlPointMap.lower_bound(time);
if (second==_timeControlPointMap.begin())
{
controlPoint = second->second;
}
else if (second!=_timeControlPointMap.end())
{
TimeControlPointMap::const_iterator first = second;
--first;
// we have both a lower bound and the next item.
// delta_time = second.time - first.time
double delta_time = second->first - first->first;
if (delta_time==0.0)
controlPoint = first->second;
else
{
controlPoint.interpolate((time - first->first)/delta_time,
first->second,
second->second);
}
}
else // (second==_timeControlPointMap.end())
{
controlPoint = _timeControlPointMap.rbegin()->second;
}
return true;
}