1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #include "point.h"
- Point::Point(Json::Value& v)
- {
- m_angle= v["angle"].asDouble();
- m_field= v["field"].asDouble();
- m_radius= v["radius"].asDouble();
- m_coord= v["coordinates"];
- m_parent= v["parent"].asString();
- m_useAngle=v["useAngle"].asBool();
- std::cout << "=======" << m_coord.toStyledString() << "\n";
- }
- Point::Point()
- {
- m_angle=180;
- m_field=90;
- m_radius=5;
- m_coord= Json::Value(Json::arrayValue);
- std::cout << "=======" << m_coord.toStyledString() << "\n";
- m_parent="";
- }
- Point::Point(Node& v)
- {
- for(int i=0; i<v.m_keys.size(); i++)
- {
- if(v.m_keys[i]=="angle") m_angle=atof(v.m_values[i].c_str());
- if(v.m_keys[i]=="field") m_field=atof(v.m_values[i].c_str());
- if(v.m_keys[i]=="radius") m_radius=atof(v.m_values[i].c_str());
- }
- m_coord = Json::Value(Json::arrayValue);
- std::cout << "=======" << m_coord.toStyledString() << "\n";
- m_coord[0]=v.m_lon;
- m_coord[01]=v.m_lat;
- }
- const std::string& Point::getParent() {return m_parent;}
- Json::Value Point::toJson()
- {
- Json::Value v(Json::objectValue);
- v["angle"]=m_angle;
- v["field"]=m_field;
- v["radius"]=m_radius;
- v["coordinates"]=m_coord;
- v["useAngle"]=m_useAngle;
- return v;
- }
- Point::~Point()
- {
- //dtor
- }
- int Point::count_child() const
- {
- return m_coord.size();
- }
|