本文整理汇总了C++中CurvePtr类的典型用法代码示例。如果您正苦于以下问题:C++ CurvePtr类的具体用法?C++ CurvePtr怎么用?C++ CurvePtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CurvePtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: min
float WaterElevationLayer::WaterElevationCurveData::getSampleLength(CurvePtr c)
{
float width = min(c->getWidth(), 20.0f);
if (c->getType() == LAKE) {
width = 6.0f;
}
return 20.0f * width / 6.0f;
}
示例2: ElevationCurveData
WaterElevationLayer::WaterElevationCurveData::WaterElevationCurveData(CurveId id, CurvePtr flattenCurve, ptr<TileProducer> elevations) :
ElevationCurveData(id, flattenCurve, elevations, true)
{
if (flattenCurve->getType() == LAKE && flattenCurve->getWidth() > 12) { // large river
if (startCapLength + endCapLength > 2 * length / 3) {
startCapLength = endCapLength = length / 3;
}
}
}
示例3: movePoint
void LazyGraph::movePoint(CurvePtr c, int i, const vec2d &p)
{
if (i == 0 || i == c->getSize() - 1) {
NodePtr n = i == 0 ? c->getStart() : c->getEnd();
nodeCache->add(n.get(), true);
} else {
curveCache->add(c.get(), true);
}
Graph::movePoint(c, i, p);
}
示例4: DimIdx
void
TrackMarker::getCenterKeyframes(std::set<double>* keyframes) const
{
CurvePtr curve = _imp->center.lock()->getAnimationCurve(ViewIdx(0), DimIdx(0));
assert(curve);
KeyFrameSet keys = curve->getKeyFrames_mt_safe();
for (KeyFrameSet::iterator it = keys.begin(); it != keys.end(); ++it) {
keyframes->insert( it->getTime() );
}
}
示例5: LazyCurve
CurvePtr LazyGraph::newCurve(CurvePtr parent, bool setParent)
{
CurveId id = nextCurveId;
nextCurveId.id++;
CurvePtr c = new LazyCurve(this, id);
curves.insert(make_pair(id, c.get()));
if (curveOffsets.find(id) == curveOffsets.end()) {
curveOffsets.insert(make_pair(id, (long int) - 1));
}
curveCache->add(c.get(), true);
return c;
}
示例6: TOTALWIDTH
double WaterElevationLayer::WaterElevationMargin::getMargin(double clipSize, CurvePtr p)
{
float pwidth = p->getWidth();
if (p->getType() == WaterElevationCurveData::RIVER) {
float scale = 2.0f * (samplesPerTile - 1) / clipSize;
if (p->getParent() != NULL && pwidth * scale >= 1) {
return TOTALWIDTH(BASEWIDTH(pwidth, scale));
} else {
return 0;
}
} else {
return pwidth / 2;
}
}
示例7: ceil
float WaterElevationLayer::WaterElevationCurveData::getCapLength(NodePtr p, vec2d q)
{
vec2d o = p->getPos();
float capLength = 0;
bool largeRiver = false;
for (int i = 0; i < p->getCurveCount(); ++i) {
CurvePtr ipath = p->getCurve(i);
if ((ipath->getAncestor()->getId() == id) == false) {
if (ipath->getType() == LAKE && ipath->getWidth() > 12) {
largeRiver = true;
}
vec2d r = ipath->getXY(p, 1);
if (abs(angle(q - o, r - o) - M_PI) < 0.01) {
continue;
}
float pw = flattenCurve->getType() == RIVER ? 2 * flattenCurve->getWidth() : flattenCurve->getWidth();
float ipw = ipath->getType() == RIVER ? 2 * ipath->getWidth() : ipath->getWidth();
vec2d corner = proland::corner(o, q, r, (double) pw, (double) ipw);
float dot = (q - o).dot(corner - o);
capLength = max((double) capLength, dot / (o - q).length());
}
}
if (largeRiver && flattenCurve->getType() == RIVER) {
capLength = (q - o).length();
}
return ceil(capLength);
}
示例8: addNode
NodePtr LazyHydroGraph::addNode(CurvePtr c, int i, Graph::Changes &changed)
{
CurveId riverId = c.cast<HydroCurve>()->getRiver();
float potential = c.cast<HydroCurve>()->getPotential();
NodePtr n = Graph::addNode(c, i, changed);
for (int i = 0; i < 2; i++) {
CurvePtr cc = n->getCurve(i);
if (!(cc->getId() == c->getId())) {
cc.cast<HydroCurve>()->setRiver(riverId);
cc.cast<HydroCurve>()->setPotential(potential);
}
}
return n;
}
示例9: deleteKnobAnimation
static void
deleteKnobAnimation(const std::set<double>& userKeyframes,
const KnobIPtr& knob,
DeleteKnobAnimationEnum type,
double currentTime)
{
for (int i = 0; i < knob->getNDimensions(); ++i) {
CurvePtr curve = knob->getAnimationCurve(ViewIdx(0), DimIdx(i));
assert(curve);
KeyFrameSet keys = curve->getKeyFrames_mt_safe();
std::list<double> toRemove;
switch (type) {
case eDeleteKnobAnimationAll: {
for (KeyFrameSet::iterator it = keys.begin(); it != keys.end(); ++it) {
std::set<double>::iterator found = userKeyframes.find( it->getTime() );
if ( found == userKeyframes.end() ) {
toRemove.push_back( it->getTime() );
}
}
break;
}
case eDeleteKnobAnimationBeforeTime: {
for (KeyFrameSet::iterator it = keys.begin(); it != keys.end(); ++it) {
if (it->getTime() >= currentTime) {
break;
}
std::set<double>::iterator found = userKeyframes.find( it->getTime() );
if ( found == userKeyframes.end() ) {
toRemove.push_back( it->getTime() );
}
}
break;
}
case eDeleteKnobAnimationAfterTime: {
for (KeyFrameSet::reverse_iterator it = keys.rbegin(); it != keys.rend(); ++it) {
if (it->getTime() <= currentTime) {
break;
}
std::set<double>::iterator found = userKeyframes.find( it->getTime() );
if ( found == userKeyframes.end() ) {
toRemove.push_back( it->getTime() );
}
}
break;
}
}
knob->deleteValuesAtTime(toRemove, ViewSetSpec::all(), DimIdx(i), eValueChangedReasonUserEdited);
}
}
示例10: ArrCurve
void C2M::buildRings(CurvePtr sp){
if (!sp)
return;
cout<<"rwfer:"<<sp->size()<<endl;
ac = new ArrCurve(sp->toArr(), sp->size(), true);
RingPtr pre = 0;
for(int i=0; i<ac->size(); i++){
Vec3 o = ac->getP(i);
Vec3 no = (o - Eye::get()->P).normalize();
Vec3 tan = ac->getT(i);
Vec3 up = (no%tan).normalize();
double z = (o - Eye::get()->P).norm();
Vec3 pmid = Eye::get()->P + no*( PZ / (no*Eye::get()->N) );
ac->setP(i, pmid);
double t0 = getHit(pmid, up);
double t1 = getHit(pmid, -up);
//cout<<"..........................................."<<endl;
if (t0<0 || t1<0)
continue;
Vec3 p0 = pmid + up*t0;
Vec3 p1 = pmid - up*t1;
o = (p0+p1)*0.5;
z = (o - Eye::get()->P).norm();
//o = Eye::get()->P + ((p0+p1)*0.5 - Eye::get()->P ).normalize()*z;
no = (o - Eye::get()->P).normalize();
Vec3 n0 = (p0 - Eye::get()->P).normalize();
Vec3 n1 = (p1 - Eye::get()->P).normalize();
double a0 = z * (n0*no);
double a1 = z * (n1*no);
double a = (a0+a1)*0.5;
//recompute center to be exactly in the middle of p0 and p1
RingPtr rng = new Ring(o, Eye::get()->P + a*n0, Eye::get()->P + a*n1);
//rng->reorient(tan);
if (pre)
rng->setPrevNext(pre,0);
else
_rings.push_back(rng);
pre = rng;
}
}
示例11: apply
void ChooseColorDialog::apply() {
CurveList curveList = _store->getObjects<Curve>();
for (CurveList::iterator curve_iter = curveList.begin(); curve_iter != curveList.end(); ++curve_iter)
{
VectorPtr vector;
CurvePtr curve = kst_cast<Curve>(*curve_iter);
if (_xVector->isChecked()) {
vector = curve->xVector();
} else {
vector = curve->yVector();
}
if (DataVectorPtr dataVector = kst_cast<DataVector>(vector))
{
curve->writeLock();
curve->setColor(getColorForFile(dataVector->filename()));
curve->registerChange();
curve->unlock();
}
}
// Store the selected colors in the corresponding datasource objects
QMutableMapIterator<DataSourcePtr, QColor> itDatasource(_dataSourceColors);
QListIterator<ColorButton*> itColorButton(_colorButtons);
DataSourcePtr ds;
while (itDatasource.hasNext()) {
ds = itDatasource.next().key();
ds->setColor(itColorButton.next()->color()); // Per construction there should always be as many color buttons as datasources
}
updateColorGroup(); // This will update the _dataSourceColors map
UpdateManager::self()->doUpdates(true);
kstApp->mainWindow()->document()->setChanged(true);
}
示例12: getArea
void LazyGraph::removeArea(AreaId id)
{
AreaPtr a = getArea(id);
if (a != NULL) {
for (int i = 0; i < a->getCurveCount(); i++) {
CurvePtr c = a->getCurve(i);
c->removeArea(a->getId());
curveCache->add(c.get(), true);
}
while (a->getCurveCount()) {
a->removeCurve(0);
}
}
areaCache->changedResources.erase(a.get());
map<AreaId, long int>::iterator k = areaOffsets.find(id);
if (k != areaOffsets.end()) {
areaOffsets.erase(k);
}
}
示例13: TOTALWIDTH
double HydroFlowProducer::RiverMargin::getMargin(double clipSize, CurvePtr p)
{
if (p->getType() != HydroCurve::BANK) {
float pwidth = p->getWidth();
if (p->getType() == HydroCurve::AXIS) {
float scale = 2.0f * (samplesPerTile - 1) / clipSize;
if (pwidth * scale >= 1) {
return TOTALWIDTH(BASEWIDTH(pwidth, scale));
} else {
return 0.0f;
}
} else {
return pwidth / 2.0f;
}
}
if (p.cast<HydroCurve>()->getRiver().id == NULL_ID) {
return 0.f;
}
CurvePtr ancestor = p.cast<HydroCurve>()->getRiverPtr();
assert(ancestor != NULL);
return getMargin(clipSize, ancestor) * 2.0f;
}
示例14: getCurve
void LazyGraph::removeCurve(CurveId id)
{
CurvePtr c = getCurve(id);
if (c != NULL) {
NodePtr start = c->getStart();
NodePtr end = c->getEnd();
NodeId nId;
nId.id = NULL_ID;
c->addVertex(nId, 0);
c->addVertex(nId, 1);
if (start != end && start != NULL) {
start->removeCurve(id);
if (start->getCurveCount() == 0) {
NodeId sid = start->getId();
start = NULL;
removeNode(sid);
} else {
nodeCache->add(start.get(), true);
}
}
if (end != NULL) {
end->removeCurve(id);
if (end->getCurveCount() == 0) {
NodeId eid = end->getId();
end = NULL;
removeNode(eid);
} else {
nodeCache->add(end.get(), true);
}
}
}
curveCache->changedResources.erase(c.get());
map<CurveId, long int>::iterator k = curveOffsets.find(id);
if (k != curveOffsets.end()) {
curveOffsets.erase(k);
}
}
示例15: assert
//.........这里部分代码省略.........
_imp->curveWidget->renderText( xText, curveYRange.max, tr("max").toStdString(), minMaxColor.redF(), minMaxColor.greenF(), minMaxColor.blueF(), minMaxColor.alphaF());
}
}
GL_GPU::Color4f(_imp->color[0], _imp->color[1], _imp->color[2], _imp->color[3]);
GL_GPU::PointSize(_imp->lineWidth);
GL_GPU::Enable(GL_BLEND);
GL_GPU::BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_GPU::Enable(GL_LINE_SMOOTH);
GL_GPU::Hint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
GL_GPU::LineWidth(1.5);
glCheckError(GL_GPU);
if (hasDrawnExpr) {
drawLineStrip(exprVertices, btmLeft, topRight);
GL_GPU::LineStipple(2, 0xAAAA);
GL_GPU::Enable(GL_LINE_STIPPLE);
}
drawLineStrip(vertices, btmLeft, topRight);
if (hasDrawnExpr) {
GL_GPU::Disable(GL_LINE_STIPPLE);
}
glCheckErrorIgnoreOSXBug(GL_GPU);
//render the name of the curve
GL_GPU::Color4f(1.f, 1.f, 1.f, 1.f);
double interval = ( topRight.x() - btmLeft.x() ) / (double)curvesCount;
double textX = _imp->curveWidget->toZoomCoordinates(15, 0).x() + interval * (double)curveIndex;
double textY;
CurvePtr internalCurve = _imp->internalCurve.lock();
QString curveName = getName();
QColor thisColor;
thisColor.setRgbF(Image::clamp(_imp->color[0], 0., 1.),
Image::clamp(_imp->color[1], 0., 1.),
Image::clamp(_imp->color[2], 0., 1.));
try {
// Use expression to place the text if the curve is not animated
textY = evaluate(internalCurve && !internalCurve->isAnimated(), textX);
} catch (...) {
// if it fails attempt without expression, this will most likely return a constant value
textY = evaluate(false /*useExpression*/, textX);
}
if ( ( textX >= btmLeft.x() ) && ( textX <= topRight.x() ) && ( textY >= btmLeft.y() ) && ( textY <= topRight.y() ) ) {
_imp->curveWidget->renderText( textX, textY, curveName.toStdString(), thisColor.redF(), thisColor.greenF(), thisColor.blueF(), thisColor.alphaF());
}
GL_GPU::Color4f(_imp->color[0], _imp->color[1], _imp->color[2], _imp->color[3]);
//draw keyframes
GL_GPU::PointSize(7.f);
GL_GPU::Enable(GL_POINT_SMOOTH);
KeyFrameWithStringSet::const_iterator foundSelectedKey;
if (foundThisCurveSelectedKeys) {
foundSelectedKey = foundThisCurveSelectedKeys->end();
}
for (KeyFrameSet::const_iterator k = keyframes.begin(); k != keyframes.end(); ++k) {
const KeyFrame & key = (*k);
// Do not draw keyframes out of range