Changeset 14690 for trunk/FACT++/src
- Timestamp:
- 11/25/12 12:44:56 (12 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/InterpreterV8.cc
r14689 r14690 1519 1519 } 1520 1520 1521 Handle<Object> InterpreterV8::ConstructRiseSet(const Handle<Value> time, const ln_rst_time &rst )1521 Handle<Object> InterpreterV8::ConstructRiseSet(const Handle<Value> time, const ln_rst_time &rst, const bool &rc) 1522 1522 { 1523 1523 Handle<Object> obj = Object::New(); 1524 1524 obj->Set(String::New("time"), time, ReadOnly); 1525 if (rst.transit<0) 1525 1526 const uint64_t v = uint64_t(time->NumberValue()); 1527 const double jd = Time(v/1000, v%1000).JD(); 1528 1529 const bool isUp = rc>0 || 1530 (rst.rise<rst.set && (jd>rst.rise && jd<rst.set)) || 1531 (rst.rise>rst.set && (jd<rst.set || jd>rst.rise)); 1532 1533 obj->Set(String::New("isUp"), Boolean::New(rc>=0 && isUp), ReadOnly); 1534 1535 if (rc!=0) 1526 1536 return obj; 1527 1537 … … 1533 1543 1534 1544 obj->Set(String::New("rise"), rise, ReadOnly); 1535 obj->Set(String::New("set"), 1545 obj->Set(String::New("set"), set, ReadOnly); 1536 1546 obj->Set(String::New("transit"), trans, ReadOnly); 1547 1537 1548 return obj; 1538 1549 } … … 1558 1569 if (str==string("civil").substr(0, str.length())) 1559 1570 hrz = LN_SOLAR_CIVIL_HORIZON; 1560 if (str==string("nautic ").substr(0, str.length()))1571 if (str==string("nautical").substr(0, str.length())) 1561 1572 hrz = LN_SOLAR_NAUTIC_HORIZON; 1562 1573 if (str==string("astronomical").substr(0, str.length())) … … 1583 1594 1584 1595 ln_rst_time sun; 1585 const bool rc = ln_get_solar_rst_horizon(JD-0.5, &obs, hrz, &sun); 1586 if (rc) 1587 sun.transit = -1; 1588 1589 Handle<Object> rst = ConstructRiseSet(date, sun); 1596 const int rc = ln_get_solar_rst_horizon(JD-0.5, &obs, hrz, &sun); 1597 Handle<Object> rst = ConstructRiseSet(date, sun, rc); 1590 1598 rst->Set(String::New("horizon"), Number::New(hrz)); 1591 1599 return handle_scope.Close(rst); … … 1615 1623 1616 1624 ln_rst_time moon; 1617 const bool rc = ln_get_lunar_rst(JD-0.5, &obs, &moon); 1618 1619 if (rc) 1620 moon.transit = -1; 1621 1622 Handle<Object> rst = ConstructRiseSet(date, moon); 1625 const int rc = ln_get_lunar_rst(JD-0.5, &obs, &moon); 1626 Handle<Object> rst = ConstructRiseSet(date, moon, rc); 1623 1627 return handle_scope.Close(rst); 1624 1628 }; -
trunk/FACT++/src/InterpreterV8.h
r14689 r14690 105 105 static v8::Handle<v8::Value> MoonHorizon(const v8::Arguments &args); 106 106 static v8::Handle<v8::Value> SunHorizon(const v8::Arguments &args); 107 static v8::Handle<v8::Object> ConstructRiseSet(const v8::Handle<v8::Value>, const ln_rst_time & );107 static v8::Handle<v8::Object> ConstructRiseSet(const v8::Handle<v8::Value>, const ln_rst_time &, const bool &); 108 108 #endif 109 109
Note:
See TracChangeset
for help on using the changeset viewer.