2 #include <samchon/protocol/SharedEntityArray.hpp> 3 #include <samchon/examples/tsp/GeometryPoint.hpp> 13 using namespace library;
14 using namespace protocol;
75 distance = travel.distance;
78 virtual ~
Travel() =
default;
80 virtual void construct(shared_ptr<XML> xml)
override 82 super::construct(xml);
84 if (xml->hasProperty(
"distance") ==
true)
85 distance = xml->getProperty<
double>(
"distance");
105 if(this->distance != INT_MIN)
106 return this->distance;
108 double distance = 0.0;
109 for(
size_t i = 1; i < size(); i++)
110 distance += at(i-1)->calcDistance(*at(i));
112 ((
Travel*)
this)->distance = distance;
126 return this->calcDistance() < travel.calcDistance();
132 virtual auto TAG()
const ->
string override 141 virtual auto toXML() const -> shared_ptr<
XML>
override 143 shared_ptr<XML> &xml = super::toXML();
144 if (distance != INT_MIN)
145 xml->setProperty(
"distance", distance);
166 "uid longitude latitude\n";
168 for(
size_t i = 0; i < size(); i++)
169 str += at(i)->toString() +
"\n";
Represent a travel containning Point(s)
double distance
Estimated hours to move.
auto calcDistance() const -> double
Calculate distance to move.
Travel(Travel &&travel)
Move Constructor.
auto operator<(const Travel &travel) const -> bool
Compare which object is less.
An Entity and a container of children Entity objects.
virtual auto toXML() const -> shared_ptr< XML > override
Get an XML object represents the EntityGroup.
static auto numberFormat(double val, int precision=2) -> std::string
auto toString() const -> string
Convert the Travel to String.
A geometry coordinates (point)
Travel()
Default Constructor.
virtual auto CHILD_TAG() const -> string override
A tag name of children.
Travel(const Travel &travel)
Copy Constructor.