本文整理汇总了C++中Curve类的典型用法代码示例。如果您正苦于以下问题:C++ Curve类的具体用法?C++ Curve怎么用?C++ Curve使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Curve类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeGenCyl
Surface makeGenCyl(const Curve &profile, const Curve &sweep )
{
Surface surface;
if (!checkFlat(profile))
{
cerr << "genCyl profile curve must be flat on xy plane." << endl;
exit(0);
}
// TODO: Here you should build the surface. See surf.h for details.
Curve c = profile;
Curve sweepL = sweep;
unsigned step = sweep.size();
Matrix4f transform;
Matrix4f transinverse;
Curve newc;
vector<Curve> clist;
for(unsigned i=0;i<step;i++){//sweepL.size();i++){
CurvePoint p = sweepL[i];
transform = getTransform(p);
transinverse = transform.inverse();
transinverse.transpose();
newc.clear();
for(unsigned j=0;j<c.size();j++){
Vector4f tempV = transform*Vector4f(c[j].V,1);
Vector4f tempN = transinverse*Vector4f(c[j].N,1);
Vector3f newV = Vector3f(tempV[0],tempV[1],tempV[2]);
Vector3f newN = Vector3f(-tempN[0],-tempN[1],-tempN[2]);
struct CurvePoint newp = {newV,c[j].T,newN,c[j].B};
newc.push_back(newp);
}
clist.push_back(newc);
}
for(unsigned k=0;k<clist.size()-1;k++){
pushVV(surface,clist[k]);
addTriangle(surface,clist[k],clist[k+1],k);
}
pushVV(surface,clist[clist.size()-1]);
pushVV(surface,clist[0]);
addTriangle(surface,clist[clist.size()-1],clist[0],clist.size()-1);
return surface;
}
示例2: color
Curve *
Volume::getMA (Entity *settings)
{
QVariant *type = settings->get(QString("maType"));
if (! type)
return 0;
QVariant *period = settings->get(QString("maPeriod"));
if (! period)
return 0;
QVariant *var = settings->get(QString("maColor"));
if (! var)
return 0;
QColor color(var->toString());
QVariant *label = settings->get(QString("maLabel"));
if (! label)
return 0;
QVariant *style = settings->get(QString("maStyle"));
if (! style)
return 0;
QVariant *width = settings->get(QString("maWidth"));
if (! width)
return 0;
BarType bt;
if (! getMA(bt.indexToString(BarType::_VOLUME), label->toString(), type->toInt(), period->toInt()))
return 0;
Curve *curve = new Curve(QString("CurveLine"));
curve->setLabel(label->toString());
CurveLineType clt;
curve->setStyle(clt.stringToIndex(style->toString()));
curve->setPen(width->toInt());
curve->setColor(color);
curve->fill(label->toString(), QString(), QString(), QString(), color);
return curve;
}
示例3: Curve
Curve *
OHLC::getOHLC (QString tstyle, QString key, QString tuc, QString tdc, QString tnc)
{
if (! g_symbol)
return 0;
Curve *ohlc = new Curve(QString("CurveOHLC"));
ohlc->setLabel(key);
CurveOHLCType ohlcType;
ohlc->setStyle(ohlcType.stringToIndex(tstyle));
QColor uc(tuc);
QColor dc(tdc);
QColor nc(tnc);
BarType bt;
ohlc->fill(bt.indexToString(BarType::_OPEN),
bt.indexToString(BarType::_HIGH),
bt.indexToString(BarType::_LOW),
bt.indexToString(BarType::_CLOSE),
nc);
QList<int> keys = g_symbol->keys();
for (int pos = 1; pos < keys.size(); pos++)
{
Bar *pbar = ohlc->bar(keys.at(pos - 1));
Bar *bar = ohlc->bar(keys.at(pos));
if (bar->close() > pbar->close())
bar->setColor(uc);
else
{
if (bar->close() < pbar->close())
bar->setColor(dc);
}
}
return ohlc;
}
示例4: pair_intersect
/**
* This uses the local bounds functions of curves to generically intersect two.
* It passes in the curves, time intervals, and keeps track of depth, while
* returning the results through the Crossings parameter.
*/
void pair_intersect(Curve const & A, double Al, double Ah,
Curve const & B, double Bl, double Bh,
Crossings &ret, unsigned depth=0) {
// std::cout << depth << "(" << Al << ", " << Ah << ")\n";
OptRect Ar = A.boundsLocal(Interval(Al, Ah));
if (!Ar) return;
OptRect Br = B.boundsLocal(Interval(Bl, Bh));
if (!Br) return;
if(! Ar->intersects(*Br)) return;
//Checks the general linearity of the function
if((depth > 12)) { // || (A.boundsLocal(Interval(Al, Ah), 1).maxExtent() < 0.1
//&& B.boundsLocal(Interval(Bl, Bh), 1).maxExtent() < 0.1)) {
double tA, tB, c;
if(linear_intersect(A.pointAt(Al), A.pointAt(Ah),
B.pointAt(Bl), B.pointAt(Bh),
tA, tB, c)) {
tA = tA * (Ah - Al) + Al;
tB = tB * (Bh - Bl) + Bl;
intersect_polish_root(A, tA,
B, tB);
if(depth % 2)
ret.push_back(Crossing(tB, tA, c < 0));
else
ret.push_back(Crossing(tA, tB, c > 0));
return;
}
}
if(depth > 12) return;
double mid = (Bl + Bh)/2;
pair_intersect(B, Bl, mid,
A, Al, Ah,
ret, depth+1);
pair_intersect(B, mid, Bh,
A, Al, Ah,
ret, depth+1);
}
示例5: lua_Curve_setPoint
int lua_Curve_setPoint(lua_State* state)
{
// Get the number of parameters.
int paramCount = lua_gettop(state);
// Attempt to match the parameters to a valid binding.
switch (paramCount)
{
case 5:
{
do
{
if ((lua_type(state, 1) == LUA_TUSERDATA) &&
lua_type(state, 2) == LUA_TNUMBER &&
lua_type(state, 3) == LUA_TNUMBER &&
(lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
(lua_type(state, 5) == LUA_TSTRING || lua_type(state, 5) == LUA_TNIL))
{
// Get parameter 1 off the stack.
unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
// Get parameter 2 off the stack.
float param2 = (float)luaL_checknumber(state, 3);
// Get parameter 3 off the stack.
gameplay::ScriptUtil::LuaArray<float> param3 = gameplay::ScriptUtil::getFloatPointer(4);
// Get parameter 4 off the stack.
Curve::InterpolationType param4 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 5));
Curve* instance = getInstance(state);
instance->setPoint(param1, param2, param3, param4);
return 0;
}
} while (0);
lua_pushstring(state, "lua_Curve_setPoint - Failed to match the given parameters to a valid function signature.");
lua_error(state);
break;
}
case 7:
{
do
{
if ((lua_type(state, 1) == LUA_TUSERDATA) &&
lua_type(state, 2) == LUA_TNUMBER &&
lua_type(state, 3) == LUA_TNUMBER &&
(lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
(lua_type(state, 5) == LUA_TSTRING || lua_type(state, 5) == LUA_TNIL) &&
(lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
(lua_type(state, 7) == LUA_TTABLE || lua_type(state, 7) == LUA_TLIGHTUSERDATA))
{
// Get parameter 1 off the stack.
unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
// Get parameter 2 off the stack.
float param2 = (float)luaL_checknumber(state, 3);
// Get parameter 3 off the stack.
gameplay::ScriptUtil::LuaArray<float> param3 = gameplay::ScriptUtil::getFloatPointer(4);
// Get parameter 4 off the stack.
Curve::InterpolationType param4 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 5));
// Get parameter 5 off the stack.
gameplay::ScriptUtil::LuaArray<float> param5 = gameplay::ScriptUtil::getFloatPointer(6);
// Get parameter 6 off the stack.
gameplay::ScriptUtil::LuaArray<float> param6 = gameplay::ScriptUtil::getFloatPointer(7);
Curve* instance = getInstance(state);
instance->setPoint(param1, param2, param3, param4, param5, param6);
return 0;
}
} while (0);
lua_pushstring(state, "lua_Curve_setPoint - Failed to match the given parameters to a valid function signature.");
lua_error(state);
break;
}
default:
{
lua_pushstring(state, "Invalid number of parameters (expected 5 or 7).");
lua_error(state);
break;
}
}
return 0;
}
示例6: main
int main(int argc, char ** argv)
{
const char *prefix = "";
int num = -1, syncsteps = 0, bignum = 0;
long maxsteps = 5000;
bool debug = false, parsed = false, lazy = false;
enum { BRUTEFORCE, RANDOMWALK, MONTECARLO, STUNEL, GDMIN } alg = STUNEL;
char *fmeasured = 0;
const char *tprefix = ".";
MinChi *min = 0;
float alpha = 0.1,beta = 5e-3,gamma = 500;
long gdmin_set_size = -1;
MPI_Init(&argc,&argv);
cout << "# ";
for (int i=0; i<argc; i++) cout << argv[i] << " ";
cout << endl;
int opt;
while ((opt = getopt(argc,argv,"n:m:b:da:l:g:s:qy:t:Lp:z:N")) != EOF) switch (opt) {
case 'n': num = atoi(optarg); break;
case 'N': bignum = 1; break;
case 'm': fmeasured = optarg; break;
case 'l': alpha = atof(optarg); break;
case 'b': beta = atof(optarg); break;
case 'g': gamma = atof(optarg); break;
case 's': maxsteps = atol(optarg); break;
case 'd': debug = true; break;
case 'a': if (strcasecmp(optarg,"bruteforce") == 0) alg = BRUTEFORCE;
else if (strcasecmp(optarg,"random_walk")==0) alg = RANDOMWALK;
else if (strcasecmp(optarg,"montecarlo")==0) alg = MONTECARLO;
else if (strcasecmp(optarg,"stunnel")==0) alg = STUNEL;
else if (strcasecmp(optarg, "gdmin") == 0) alg = GDMIN;
else { usage(argv[0]); return 1; }
break;
case 'q': parsed = true; break;
case 'y': syncsteps = atoi(optarg); break;
case 't': tprefix = optarg; break;
case 'L': lazy = true; break;
case 'p': prefix = optarg; break;
case 'z': gdmin_set_size = atol(optarg); break;
default: usage(argv[0]); return 1;
}
if (num<=0 || !fmeasured) { usage(argv[0]); return 1; }
/* not anymore: assert(num < 100); /* XXX: hardcoded %02d elsewhere */
/* maximal step length (alltogether, not per dimension) */
alpha /= sqrt(2. + num);
/* MC scaling, 5e-3 step up accepted with 10% */
beta = - log(.1)/beta;
assert(gdmin_set_size<0 || (gdmin_set_size > 0 && alg == GDMIN));
Curve measured;
vector<C12Map> maps;
maps.resize(num);
if (measured.load(fmeasured)) return 1;
for (int i=0; i<num; i++) {
char buf[PATH_MAX];
/* used to align generated curves */
maps[i].setMeasured(measured);
if (lazy) {
if (num < 100 && !bignum)
snprintf(buf,sizeof buf,"%s%02d.pdb",prefix,i+1);
else
snprintf(buf,sizeof buf,"%s%02d/%04d.pdb",prefix,(i+1)/100,i+1);
maps[i].setQMax(measured.getQMax());
maps[i].setSize(measured.getSize());
if (maps[i].setLazy(buf,fmeasured)) return 1;
}
else if (parsed) {
snprintf(buf, sizeof buf, "%s%02d.c12",prefix,i+1);
if (maps[i].restore(buf)) return 1;
maps[i].alignScale(measured);
}
else {
snprintf(buf,sizeof buf,"%s%02d/%02d_%%.2f_%%.3f.dat",prefix,i+1,i+1);
if (maps[i].load(buf)) return 1;
maps[i].alignScale(measured);
}
}
switch (alg) {
case BRUTEFORCE: {
BruteForce *b = new BruteForce(measured,maps);
b->setStep(.01);
min = b;
break;
//.........这里部分代码省略.........
示例7: main
int main( int argc, char** argv )
{
trace.beginBlock ( "Example FrechetShortcut" );
trace.info() << "Args:";
for ( int i = 0; i < argc; ++i )
trace.info() << " " << argv[ i ];
trace.info() << endl;
std::string filename;
double error;
if(argc == 1)
{
trace.info() << "Use default file and error value\n";
filename = examplesPath + "samples/plant-frechet.dat";
error = 3;
}
else
if(argc != 3)
{
trace.info() << "Please enter a filename and error value.\n";
return 0;
}
else
{
filename = argv[1];
error = atof(argv[2]);
}
ifstream instream; // input stream
instream.open (filename.c_str(), ifstream::in);
Curve c; //grid curve
c.initFromVectorStream(instream);
Board2D board;
// Display the pixels as arrows range to show the way the curve is scanned
board << c.getArrowsRange();
trace.beginBlock("Simple example");
//! [FrechetShortcutUsage]
Curve::PointsRange r = c.getPointsRange();
typedef FrechetShortcut<Curve::PointsRange::ConstIterator,int> Shortcut;
// Computation of one shortcut
Shortcut s(error);
s.init( r.begin() );
while ( ( s.end() != r.end() )
&&( s.extendFront() ) ) {}
// Computation of a greedy segmentation
typedef GreedySegmentation<Shortcut> Segmentation;
Segmentation theSegmentation( r.begin(), r.end(), Shortcut(error) );
// the segmentation is computed here
Segmentation::SegmentComputerIterator it = theSegmentation.begin();
Segmentation::SegmentComputerIterator itEnd = theSegmentation.end();
for ( ; it != itEnd; ++it) {
s=Shortcut(*it);
trace.info() << s << std::endl;
board << s;
}
board.saveEPS("FrechetShortcutExample.eps", Board2D::BoundingBox, 5000 );
//! [FrechetShortcutUsage]
#ifdef WITH_CAIRO
board.saveCairo("FrechetShortcutExample.png");
#endif
trace.endBlock();
return 0;
}
示例8: setPointer
bool CoilCoolingDXVariableRefrigerantFlow_Impl::setCoolingCapacityModifierCurveFunctionofFlowFraction(const Curve& curve) {
bool result = setPointer(OS_Coil_Cooling_DX_VariableRefrigerantFlowFields::CoolingCapacityModifierCurveFunctionofFlowFraction, curve.handle());
return result;
}
示例9: it
void Plot::setHighLow ()
{
_plotSettings.high = 0;
_plotSettings.low = 0;
bool flag = FALSE;
QHashIterator<QString, Curve *> it(_plotSettings.curves);
while (it.hasNext())
{
it.next();
Curve *curve = it.value();
double h, l;
if (! curve->highLowRange(_plotSettings.startPos, _plotSettings.endPos, h, l))
continue;
if (! flag)
{
_plotSettings.high = h;
_plotSettings.low = l;
flag = TRUE;
}
else
{
if (h > _plotSettings.high)
_plotSettings.high = h;
if (l < _plotSettings.low)
_plotSettings.low = l;
}
}
QHashIterator<QString, Marker *> it2(_plotSettings.markers);
while (it2.hasNext())
{
it2.next();
Marker *co = it2.value();
double h, l;
if (! co->highLow(_plotSettings.startPos, _plotSettings.endPos, h, l))
continue;
if (! flag)
{
_plotSettings.high = h;
_plotSettings.low = l;
flag = TRUE;
}
else
{
if (h > _plotSettings.high)
_plotSettings.high = h;
if (l < _plotSettings.low)
_plotSettings.low = l;
}
}
if(high){
setAxisScale(QwtPlot::yRight, low, high);
}else{
setAxisScale(QwtPlot::yRight, _plotSettings.low, _plotSettings.high);
}
//TODO
// setAxisScale(QwtPlot::yRight, 0, 100);
}
示例10: setPointer
bool EvaporativeCoolerDirectResearchSpecial_Impl::setEffectivenessFlowRatioModifierCurve(const Curve& curve) {
return setPointer(OS_EvaporativeCooler_Direct_ResearchSpecialFields::EffectivenessFlowRatioModifierCurveName, curve.handle());
}
示例11: setValue
bool CurveNode::setValue (const String& strMemberName, const String* pstrValue)
{
bool bValueSet = false;
Curve* pObject = dynamic_cast<Curve*>(m_pObject);
if (strMemberName == L"Rot")
{
if (!pstrValue)
{
pObject->resetValue_Rot();
}
else
{
pObject->setRot(EnumClockwiseImpl::parseString(pstrValue->c_str(), pstrValue->length()));
bValueSet = true;
}
}
if (strMemberName == L"Chord")
{
if (!pstrValue)
{
pObject->resetValue_Chord();
}
else
{
pObject->setChord(DoubleObjectImpl::parseString(pstrValue->c_str(), pstrValue->length()));
bValueSet = true;
}
}
if (strMemberName == L"CrvType")
{
if (!pstrValue)
{
pObject->resetValue_CrvType();
}
else
{
pObject->setCrvType(EnumCurveTypeImpl::parseString(pstrValue->c_str(), pstrValue->length()));
bValueSet = true;
}
}
if (strMemberName == L"Delta")
{
if (!pstrValue)
{
pObject->resetValue_Delta();
}
else
{
pObject->setDelta(DoubleObjectImpl::parseString(pstrValue->c_str(), pstrValue->length()));
bValueSet = true;
}
}
if (strMemberName == L"Desc")
{
if (!pstrValue)
{
pObject->resetValue_Desc();
}
else
{
pObject->setDesc(StringObjectImpl::parseString(pstrValue->c_str(), pstrValue->length()));
bValueSet = true;
}
}
if (strMemberName == L"DirEnd")
{
if (!pstrValue)
{
pObject->resetValue_DirEnd();
}
else
{
pObject->setDirEnd(DoubleObjectImpl::parseString(pstrValue->c_str(), pstrValue->length()));
bValueSet = true;
}
}
if (strMemberName == L"DirStart")
{
if (!pstrValue)
{
pObject->resetValue_DirStart();
}
else
{
pObject->setDirStart(DoubleObjectImpl::parseString(pstrValue->c_str(), pstrValue->length()));
bValueSet = true;
}
}
if (strMemberName == L"External")
{
if (!pstrValue)
{
pObject->resetValue_External();
}
else
{
pObject->setExternal(DoubleObjectImpl::parseString(pstrValue->c_str(), pstrValue->length()));
bValueSet = true;
}
}
//.........这里部分代码省略.........
示例12: insertLegend
void Plot::createGraph()
{
insertLegend(new QwtLegend(), QwtPlot::BottomLegend);
setAxisTitle(xBottom, "x -->");
setAxisTitle(yLeft, "y -->");
// Inicializa as variaveis pela primeira curva
Curve* curve = cCurves[0]->getCurve();
std::vector<double> matrix_x = curve->getElementsX();
std::vector<double> matrix_y = curve->getElementsY();
double minX = matrix_x[0];
double maxX = matrix_x[0];
double minY = matrix_y[0];
double maxY = matrix_y[0];
for (unsigned int i = 0; i < cCurves.size(); i++)
{
Curve* curve = cCurves[i]->getCurve();
std::vector<double> matrix_x = curve->getElementsX();
std::vector<double> matrix_y = curve->getElementsY();
for (unsigned int j = 0; j < matrix_x.size(); j++)
{
if (minX > matrix_x[j])
minX = matrix_x[j];
if (maxX < matrix_x[j])
maxX = matrix_x[j];
if (minY > matrix_y[j])
minY = matrix_y[j];
if (maxY < matrix_y[j])
maxY = matrix_y[j];
}
cCurves[i]->attach(this);
cCurves[i]->plotGraph();
cPoints[i]->attach(this);
cPoints[i]->plotExperimentalPoints();
}
int py = (maxY - minY) / 10;
int px = (maxX - minX) / 10;
minX -= px;
maxX += px;
minY -= py;
maxY += py;
int stepY = (maxY - minY)/10;
int stepX = (maxX - minX)/10;
// QwtLog10ScaleEngine* logScale = new QwtLog10ScaleEngine();
// setAxisScaleEngine(QwtPlot::xBottom, logScale);
// setAxisScaleEngine(QwtPlot::yLeft, logScale);
setAxisScale(QwtPlot::xBottom, minX, maxX, stepX);
setAxisScale(QwtPlot::yLeft, minY, maxY, stepY);
replot();
}
示例13: pick
bool CurveEditTool::MouseDown( const MouseButtonInput& e )
{
bool success = true;
if ( GetEditMode() == CurveEditModes::Modify )
{
success = m_ControlPointManipulator->MouseDown( e );
}
else
{
Curve* curve = NULL;
{
FrustumLinePickVisitor pick (m_Scene->GetViewport()->GetCamera(), e.GetPosition().x, e.GetPosition().y);
m_Scene->Pick( &pick );
V_PickHitSmartPtr sorted;
PickHit::Sort(m_Scene->GetViewport()->GetCamera(), pick.GetHits(), sorted, PickSortTypes::Intersection);
for ( V_PickHitSmartPtr::const_iterator itr = sorted.begin(), end = sorted.end(); itr != end; ++itr )
{
if ( curve = Reflect::SafeCast<Curve>( (*itr)->GetHitObject() ) )
{
break;
}
}
}
if ( !curve || !m_Scene->IsEditable() )
{
return false;
}
LinePickVisitor pick (m_Scene->GetViewport()->GetCamera(), e.GetPosition().x, e.GetPosition().y);
switch ( GetEditMode() )
{
case CurveEditModes::Insert:
{
std::pair<uint32_t, uint32_t> points;
if ( !curve->ClosestControlPoints( &pick, points ) )
{
return false;
}
CurveControlPoint* p0 = curve->GetControlPointByIndex( points.first );
CurveControlPoint* p1 = curve->GetControlPointByIndex( points.second );
Vector3 a( p0->GetPosition() );
Vector3 b( p1->GetPosition() );
Vector3 p;
if ( curve->GetCurveType() == CurveType::Linear )
{
float mu;
if ( !pick.GetPickSpaceLine().IntersectsSegment( a, b, -1.0f, &mu ) )
{
return false;
}
p = a * ( 1.0f - mu ) + b * mu;
}
else
{
p = ( a + b ) * 0.5f;
}
uint32_t index = points.first > points.second ? points.first : points.second;
CurveControlPointPtr point = new CurveControlPoint();
point->SetOwner( curve->GetOwner() );
point->Initialize();
curve->GetOwner()->Push( curve->InsertControlPointAtIndex( index, point ) );
break;
}
case CurveEditModes::Remove:
{
int32_t index = curve->ClosestControlPoint( &pick );
if ( index < 0 )
{
return false;
}
curve->GetOwner()->Push( curve->RemoveControlPointAtIndex( index ) );
break;
}
}
curve->Dirty();
m_Scene->Execute( false );
}
return success || Base::MouseDown( e );
}
示例14: KeyPress
void CurveEditTool::KeyPress( const KeyboardInput& e )
{
if ( !m_Scene->IsEditable() )
{
return;
}
int32_t keyCode = e.GetKeyCode();
if ( keyCode == KeyCodes::Left || keyCode == KeyCodes::Up || keyCode == KeyCodes::Right || keyCode == KeyCodes::Down )
{
OS_SceneNodeDumbPtr selection = m_Scene->GetSelection().GetItems();
if ( selection.Empty() )
{
return;
}
CurveControlPoint* point = Reflect::SafeCast<CurveControlPoint>( selection.Front() );
if ( !point )
{
return;
}
Curve* curve = Reflect::SafeCast<Curve>( point->GetParent() );
if ( !curve )
{
return;
}
int32_t index = curve->GetIndexForControlPoint( point );
if ( index == -1 )
{
return;
}
uint32_t countControlPoints = curve->GetNumberControlPoints();
if ( keyCode == KeyCodes::Left || keyCode == KeyCodes::Down )
{
index--;
index += countControlPoints;
index %= countControlPoints;
}
else if ( keyCode == KeyCodes::Right || keyCode == KeyCodes::Up )
{
index++;
index %= countControlPoints;
}
point = curve->GetControlPointByIndex( index );
selection.Clear();
selection.Append( point );
m_Scene->GetSelection().SetItems( selection );
}
Base::KeyPress( e );
}
示例15: idfObject
boost::optional<IdfObject> ForwardTranslator::translateCoilCoolingDXSingleSpeedWithoutUnitary( model::CoilCoolingDXSingleSpeed & modelObject )
{
OptionalString s;
IdfObject idfObject(IddObjectType::Coil_Cooling_DX_SingleSpeed);
s = modelObject.name();
if( s )
{
idfObject.setName(*s);
}
// hook up required objects
try {
Schedule sched = modelObject.getAvailabilitySchedule();
translateAndMapModelObject(sched);
idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::AvailabilityScheduleName,
sched.name().get() );
Curve cb = modelObject.getTotalCoolingCapacityFunctionOfTemperatureCurve();
translateAndMapModelObject(cb);
idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::TotalCoolingCapacityFunctionofTemperatureCurveName,
cb.name().get());
Curve cq = modelObject.getTotalCoolingCapacityFunctionOfFlowFractionCurve();
translateAndMapModelObject(cq);
idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::TotalCoolingCapacityFunctionofFlowFractionCurveName,
cq.name().get());
cb =modelObject.getEnergyInputRatioFunctionOfTemperatureCurve();
translateAndMapModelObject(cb);
idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::EnergyInputRatioFunctionofTemperatureCurveName,
cb.name().get());
cq=modelObject.getEnergyInputRatioFunctionOfFlowFractionCurve();
translateAndMapModelObject(cq);
idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::EnergyInputRatioFunctionofFlowFractionCurveName,
cq.name().get());
cq=modelObject.getPartLoadFractionCorrelationCurve();
translateAndMapModelObject(cq);
idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::PartLoadFractionCorrelationCurveName,
cq.name().get());
}
catch (std::exception& e) {
LOG(Error,"Could not translate " << modelObject.briefDescription() << ", because "
<< e.what() << ".");
return boost::none;
}
OptionalDouble d = modelObject.ratedTotalCoolingCapacity();
if( d )
{
idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::GrossRatedTotalCoolingCapacity,*d);
}
else
{
idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::GrossRatedTotalCoolingCapacity,"Autosize");
}
d = modelObject.ratedSensibleHeatRatio();
if( d )
{
idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::GrossRatedSensibleHeatRatio,*d);
}
else
{
idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::GrossRatedSensibleHeatRatio,"Autosize");
}
d = modelObject.getRatedCOP();
if( d )
{
idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::GrossRatedCoolingCOP,*d);
}
d = modelObject.ratedAirFlowRate();
if( d )
{
idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::RatedAirFlowRate,*d);
}
else
{
idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::RatedAirFlowRate,"Autosize");
}
d = modelObject.getRatedEvaporatorFanPowerPerVolumeFlowRate();
if( d )
{
idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::RatedEvaporatorFanPowerPerVolumeFlowRate,*d);
}
OptionalModelObject omo = modelObject.inletModelObject();
if( omo )
{
translateAndMapModelObject(*omo);
s = omo->name();
if(s)
{
idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::AirInletNodeName,*s );
}
//.........这里部分代码省略.........