53 std::vector<const IPhysicalObject *> objectsCopy;
57 for (
auto object : objectsCopy) {
58 const ShapeBase *shape =
object->getShape();
59 const Coord& position =
object->getPosition();
60 const EulerAngles& orientation =
object->getOrientation();
61 const Rotation rotation(orientation);
63 const Cuboid *cuboid =
dynamic_cast<const Cuboid *
>(shape);
65 std::vector<std::vector<Coord> > faces;
70 const Sphere *sphere =
dynamic_cast<const Sphere *
>(shape);
72 double radius = sphere->getRadius();
73 cOvalFigure *figure =
new cOvalFigure(
"sphere");
74 figure->setTooltip(
"This oval represents a physical object");
75 figure->setAssociatedObject(const_cast<cObject *>(check_and_cast<const cObject *>(
object)));
76 figure->setFilled(
true);
78 figure->setBounds(cFigure::Rectangle(center.x - radius, center.y - radius, radius * 2, radius * 2));
79 figure->setLineWidth(object->getLineWidth());
80 figure->setLineColor(object->getLineColor());
81 figure->setFillColor(object->getFillColor());
82 figure->setLineOpacity(object->getOpacity());
83 figure->setFillOpacity(object->getOpacity());
84 figure->setZoomLineWidth(
false);
85 std::string objectTags(
"physical_object ");
86 if (object->getTags())
87 objectTags += object->getTags();
88 figure->setTags((objectTags +
" " +
tags).c_str());
92 const Prism *prism =
dynamic_cast<const Prism *
>(shape);
94 std::vector<std::vector<Coord> > faces;
99 const Polyhedron *polyhedron =
dynamic_cast<const Polyhedron *
>(shape);
101 std::vector<std::vector<Coord> > faces;
106 const char *name = check_and_cast<
const cObject *>(object)->getName();
108 cLabelFigure *nameFigure =
new cLabelFigure(
"objectName");
110 nameFigure->setTags((std::string(
"physical_object object_name label ") +
tags).c_str());
111 nameFigure->setText(name);
const char * tags
Definition: VisualizerBase.h:32
const Rotation & getRotation() const
Definition: CanvasProjection.h:39
const IPhysicalEnvironment * physicalEnvironment
Definition: PhysicalEnvironmentVisualizerBase.h:35
bool displayObjects
Definition: PhysicalEnvironmentVisualizerBase.h:36
const CanvasProjection * canvasProjection
Definition: PhysicalEnvironmentCanvasVisualizer.h:51
cGroupFigure * objectsLayer
Definition: PhysicalEnvironmentCanvasVisualizer.h:56
virtual const IPhysicalObject * getObject(int index) const =0
virtual void computeFacePoints(const IPhysicalObject *object, std::vector< std::vector< Coord > > &faces, const Rotation &rotation) const
Definition: PhysicalEnvironmentCanvasVisualizer.cc:118
virtual int getNumObjects() const =0
cFigure::Point computeCanvasPoint(const Coord &point) const
Definition: CanvasProjection.cc:32