90 auto simulation = getSimulation();
92 auto pathVisualization = it.second;
93 auto pathCanvasVisualization =
static_cast<const PathCanvasVisualization *
>(pathVisualization);
94 auto moduleIds = pathCanvasVisualization->moduleIds;
95 std::vector<LineSegment> segments;
96 for (
int index = 1; index < moduleIds.size(); index++) {
97 auto fromModuleId = moduleIds[index - 1];
98 auto toModuleId = moduleIds[index];
99 auto fromModule = simulation->getModule(fromModuleId);
100 auto toModule = simulation->getModule(toModuleId);
104 segments.push_back(LineSegment(fromPosition + shift, toPosition + shift));
106 std::vector<cFigure::Point> points;
107 for (
int index = 0; index < segments.size(); index++) {
111 auto& segment1 = segments[index - 1];
112 auto& segment2 = segments[index];
113 Coord intersection = intersectLines(segment1, segment2);
114 if (std::isfinite(intersection.x) && std::isfinite(intersection.y)) {
118 double distance = segment1.getPoint2().distance(segment2.getPoint1());
119 double distance1 = intersection.distance(segment1.getPoint2());
120 double distance2 = intersection.distance(segment2.getPoint1());
121 if (distance1 + distance2 < 4 * distance)
134 if (index == segments.size() - 1)
137 pathCanvasVisualization->figure->setPoints(points);
double fadeOutAnimationSpeed
Definition: PathVisualizerBase.h:81
double lineShift
Definition: PathVisualizerBase.h:71
const char * lineContactMode
Definition: PathVisualizerBase.h:74
const char * lineShiftMode
Definition: PathVisualizerBase.h:72
virtual Coord getContactPosition(const cModule *networkNode, const Coord &fromPosition, const char *contactMode, double contactSpacing) const
Definition: VisualizerBase.cc:54
virtual Coord getPosition(const cModule *networkNode) const
Definition: VisualizerBase.cc:42
virtual void refreshDisplay() const override
Definition: PathVisualizerBase.cc:94
Coord getLineShift(int sourceModuleId, int destinationModuleId, const Coord &sourcePosition, const Coord &destinationPosition, const char *shiftMode, int shiftOffset)
Definition: LineManager.cc:108
std::multimap< std::pair< int, int >, const PathVisualization * > pathVisualizations
Maps source/destination modules to multiple paths between them.
Definition: PathVisualizerBase.h:96
const CanvasProjection * canvasProjection
Definition: PathCanvasVisualizerBase.h:43
cModule * visualizerTargetModule
Definition: VisualizerBase.h:31
LineManager * lineManager
Definition: PathVisualizerBase.h:84
double lineContactSpacing
Definition: PathVisualizerBase.h:73
bool isPointOnSegment(const LineSegment &segment, const Coord &point)
Definition: PathCanvasVisualizerBase.cc:54
cFigure::Point computeCanvasPoint(const Coord &point) const
Definition: CanvasProjection.cc:32