52 #ifdef CHECK_MEMORY_LEAKS
54 #endif // CHECK_MEMORY_LEAKS
64 std::copy(v.begin(), v.end(), std::back_inserter(
myCont));
96 for (ContType::const_iterator i =
myCont.begin(); i !=
myCont.end() - 1; i++) {
101 (*(i + 1)).x() - p.
x(),
102 (*(i + 1)).y() - p.
y());
106 (*(
myCont.end() - 1)).x() - p.
x(),
107 (*(
myCont.end() - 1)).y() - p.
y());
109 (*(
myCont.begin())).x() - p.
x(),
110 (*(
myCont.begin())).y() - p.
y());
112 return (!(fabs(angle) <
PI));
118 for (ContType::const_iterator i =
myCont.begin(); i !=
myCont.end() - 1; i++) {
119 if (poly.
around(*i, offset)) {
132 for (ContType::const_iterator i =
myCont.begin(); i !=
myCont.end() - 1; i++) {
147 for (ContType::const_iterator i =
myCont.begin(); i !=
myCont.end() - 1; i++) {
160 for (ContType::const_iterator i =
myCont.begin(); i !=
myCont.end() - 1; i++) {
171 for (ContType::const_iterator i =
myCont.begin(); i !=
myCont.end() - 1; i++) {
219 ContType::const_iterator i =
myCont.begin();
222 const SUMOReal nextLength = (*i).distanceTo(*(i + 1));
223 if (seenLength + nextLength > pos) {
226 seenLength += nextLength;
227 }
while (++i !=
myCont.end() - 1);
234 ContType::const_iterator i =
myCont.begin();
237 const SUMOReal nextLength = (*i).distanceTo2D(*(i + 1));
238 if (seenLength + nextLength > pos) {
241 seenLength += nextLength;
242 }
while (++i !=
myCont.end() - 1);
249 ContType::const_iterator i =
myCont.begin();
252 SUMOReal nextLength = (*i).distanceTo(*(i + 1));
253 if (seenLength + nextLength > pos) {
254 Line l(*i, *(i + 1));
257 seenLength += nextLength;
258 }
while (++i !=
myCont.end() - 1);
266 ContType::const_iterator i =
myCont.begin();
269 SUMOReal nextLength = (*i).distanceTo(*(i + 1));
270 if (seenLength + nextLength > pos) {
271 Line l(*i, *(i + 1));
274 seenLength += nextLength;
275 }
while (++i !=
myCont.end() - 1);
289 return p1 + (p2 - p1) * (pos / dist);
301 return p1 + (p2 - p1) * (pos / dist);
308 for (ContType::const_iterator i =
myCont.begin(); i !=
myCont.end(); i++) {
319 for (ContType::const_iterator i =
myCont.begin(); i !=
myCont.end(); i++) {
333 const int endIndex = (
int)tmp.
size() - 1;
337 if (tmp.
area() != 0) {
339 for (
int i = 0; i < endIndex; i++) {
340 const SUMOReal z = tmp[i].x() * tmp[i + 1].y() - tmp[i + 1].x() * tmp[i].y();
342 x += (tmp[i].x() + tmp[i + 1].x()) * z;
343 y += (tmp[i].y() + tmp[i + 1].y()) * z;
351 for (
int i = 0; i < endIndex; i++) {
353 x += (tmp[i].x() + tmp[i + 1].x()) * length / 2;
354 y += (tmp[i].y() + tmp[i + 1].y()) * length / 2;
357 return Position(x / lengthSum, y / lengthSum);
365 for (
size_t i = 0; i <
size(); i++) {
366 myCont[i] = centroid + ((
myCont[i] - centroid) * factor);
383 for (ContType::const_iterator i =
myCont.begin(); i !=
myCont.end() - 1; i++) {
384 len += (*i).distanceTo(*(i + 1));
397 const int endIndex = (
int)tmp.
size() - 1;
399 for (
int i = 0; i < endIndex; i++) {
400 area += tmp[i].x() * tmp[i + 1].y() - tmp[i + 1].x() * tmp[i].y();
411 for (ContType::const_iterator i =
myCont.begin(); i !=
myCont.end() - 1; i++) {
412 if (poly.
around(*i, offset)) {
440 std::pair<PositionVector, PositionVector>
451 ContType::const_iterator it =
myCont.begin() + 1;
464 Position p = tmpL.getPositionAtDistance(where - seen);
471 for (; it !=
myCont.end(); it++) {
474 assert(first.
size() >= 2);
475 assert(second.
size() >= 2);
478 return std::pair<PositionVector, PositionVector>(first, second);
484 for (PositionVector::ContType::const_iterator i = geom.
myCont.begin(); i != geom.
myCont.end(); i++) {
485 if (i != geom.
myCont.begin()) {
502 for (
size_t i = 0; i <
size(); i++) {
503 myCont[i].add(xoff, yoff, zoff);
510 for (
size_t i = 0; i <
size(); i++) {
511 myCont[i].reshiftRotate(xoff, yoff, rot);
519 return atan2(p1.
x(), p1.
y()) < atan2(p2.
x(), p2.
y());
538 if (p1.
x() != p2.
x()) {
539 return p1.
x() < p2.
x();
541 return p1.
y() < p2.
y();
549 return (P1.
x() - P0.
x()) * (P2.
y() - P0.
y()) - (P2.
x() - P0.
x()) * (P1.
y() - P0.
y());
570 for (ContType::const_iterator i =
myCont.begin(); i !=
myCont.end() - 1; i++) {
573 *i, *(i + 1), line.
p1(), line.
p2()));
591 if (l1.intersects(l2) && l1.intersectsAtLength2D(l2) < l1.length2D() - 100) {
617 ContType::const_iterator i =
myCont.begin();
619 while ((i + 1) !=
myCont.end()
621 seen + (*i).distanceTo(*(i + 1)) <
begin) {
622 seen += (*i).distanceTo(*(i + 1));
626 while ((i + 1) !=
myCont.end()
628 seen + (*i).distanceTo(*(i + 1)) <
end) {
636 seen += (*i).distanceTo(*(i + 1));
659 ContType::const_iterator i =
myCont.begin();
661 while ((i + 1) !=
myCont.end()
663 seen + (*i).distanceTo2D(*(i + 1)) <
begin) {
664 seen += (*i).distanceTo2D(*(i + 1));
668 while ((i + 1) !=
myCont.end()
670 seen + (*i).distanceTo2D(*(i + 1)) <
end) {
678 seen += (*i).distanceTo2D(*(i + 1));
697 if (currDist >= 0 && currDist < dist) {
702 for (ContType::iterator i =
myCont.begin(); i !=
myCont.end() - 1; i++, currPos++) {
704 if (currDist >= 0 && currDist < dist) {
710 for (
size_t j = 0; j < pos; j++) {
720 if (np != *(
myCont.begin())) {
722 if (np != *(
myCont.begin())) {
724 assert(
myCont.size() > 1);
741 if (currDist >= 0 && currDist < dist) {
746 for (ContType::reverse_iterator i =
myCont.rbegin(); i !=
myCont.rend() - 1; i++, currPos++) {
748 if (currDist >= 0 && currDist < dist) {
754 for (
size_t j = 0; j < pos; j++) {
766 if (np != *(myCont.end() - 1)) {
767 myCont.erase(myCont.end() - 1);
768 if (np != *(myCont.end() - 1)) {
769 myCont.push_back(np);
770 assert(myCont.size() > 1);
771 assert(*(myCont.begin()) != *(myCont.end() - 1));
799 for (ContType::const_iterator i =
myCont.begin(); i !=
myCont.end() - 1; i++) {
803 if (dist < minDist) {
804 nearestPos = pos + seen;
807 seen += (*i).distanceTo2D(*(i + 1));
819 for (
int i = 0; i < (
int)
size(); i++) {
821 if (dist < minDist) {
835 int insertionIndex = 1;
836 for (
int i = 0; i < (
int)
size() - 1; i++) {
838 if (dist < minDist) {
839 insertionIndex = i + 1;
844 return insertionIndex;
851 return myCont.front().distanceTo(p);
855 for (ContType::const_iterator i =
myCont.begin(); i !=
myCont.end() - 1; i++) {
857 p, *i, *(i + 1), outIntersection));
863 std::vector<SUMOReal>
865 std::vector<SUMOReal> ret;
866 for (ContType::const_iterator i = other.
myCont.begin(); i != other.
myCont.end() - 1; i++) {
868 copy(atSegment.begin(), atSegment.end(), back_inserter(ret));
874 std::vector<SUMOReal>
876 std::vector<SUMOReal> ret;
878 for (ContType::const_iterator i =
myCont.begin(); i !=
myCont.end() - 1; i++) {
879 Line l((*i), *(i + 1));
884 ret.push_back(atLength + pos);
894 assert(
myCont.size() > 1);
900 myCont.erase(myCont.begin());
902 myCont.erase(myCont.end() - 1);
910 for (ContType::const_reverse_iterator i =
myCont.rbegin(); i !=
myCont.rend(); i++) {
923 for (
size_t i = 0; i <
myCont.size(); i++) {
927 std::pair<SUMOReal, SUMOReal> offsets =
930 from.
y() - offsets.second, from.
z()));
931 }
else if (i ==
myCont.size() - 1) {
934 std::pair<SUMOReal, SUMOReal> offsets =
937 to.
y() - offsets.second, to.
z()));
943 me.
x() - to.
x(), me.
y() - to.
y()) / 2);
947 std::pair<SUMOReal, SUMOReal> off =
952 std::pair<SUMOReal, SUMOReal> offsets =
954 std::pair<SUMOReal, SUMOReal> offsets2 =
957 Position(from.
x() - offsets.first, from.
y() - offsets.second),
958 Position(me.
x() - offsets.first, me.
y() - offsets.second));
961 Position(me.
x() - offsets2.first, me.
y() - offsets2.second),
962 Position(to.
x() - offsets2.first, to.
y() - offsets2.second));
1004 assert(
myCont.size() > pos + 1);
1030 std::vector<SUMOReal>
1032 std::vector<SUMOReal> ret;
1033 ContType::const_iterator i;
1088 assert(
size() > index);
1102 ContType::iterator last =
myCont.begin();
1103 for (ContType::iterator i =
myCont.begin() + 1; i !=
myCont.end();) {
1104 if (last->almostSame(*i)) {
1119 for (ContType::iterator i =
myCont.begin() + 1; i !=
myCont.end() - 1;) {
1134 for (
int i = 0; i < (
int)
size(); i++) {
1135 if ((*
this)[i] != v2[i]) {