Gauge Hierarchy (Legacy)¶
This code snippet shows how to create a gauge hierarchy and save it into a file using the legacy EasyGauge API.
C++¶
#include <eVision/EasyGauge/Legacy/ECircleGauge.h>
#include <eVision/EasyGauge/Legacy/ERectangleGauge.h>
using namespace eVision;
using namespace eVision::Legacy;
// EWorldShape constructor
EWorldShape worldShape;
// Gauges constructor
Legacy::ERectangleGauge rectangleGauge;
Legacy::ECircleGauge circleGauge1, circleGauge2;
// ...
// Attach the rectangle gauge to the EWorldShape
rectangleGauge.Attach(&worldShape);
// Attach the circle gauges to the rectangle gauge
circleGauge1.Attach(&rectangleGauge);
circleGauge2.Attach(&rectangleGauge);
// Set the first circle gauge name
circleGauge1.SetName("myCircleGauge1");
// ...
// Save worldShape together with its daughters
worldShape.Save("myWorldShape.gge", true);
C#¶
using eVision;
using Legacy = eVision.Legacy;
// EWorldShape constructor
Legacy.EWorldShape worldShape = new Legacy.EWorldShape();
// Gauges constructor
Legacy.ERectangleGauge rectangleGauge = new Legacy.ERectangleGauge();
Legacy.ECircleGauge circleGauge1 = new Legacy.ECircleGauge();
Legacy.ECircleGauge circleGauge2 = new Legacy.ECircleGauge();
// ...
// Attach the rectangle gauge to the EWorldShape
rectangleGauge.Attach(worldShape);
// Attach the circle gauges to the rectangle gauge
circleGauge1.Attach(rectangleGauge);
circleGauge2.Attach(rectangleGauge);
// Set the first circle gauge name
circleGauge1.Name = "myCircleGauge1";
// ...
// Save worldShape together with its daughters
worldShape.Save("myWorldShape.gge", true);
Python¶
import eVision
import eVision.Legacy as Legacy
# EWorldShape constructor
world_shape = Legacy.EWorldShape()
# Gauges constructor
rectangle_gauge = Legacy.ERectangleGauge()
circle_gauge1 = Legacy.ECircleGauge()
circle_gauge2 = Legacy.ECircleGauge()
# ...
# Attach the rectangle gauge to the EWorldShape
rectangle_gauge.Attach(world_shape)
# Attach the circle gauges to the rectangle gauge
circle_gauge1.Attach(rectangle_gauge)
circle_gauge2.Attach(rectangle_gauge)
# Set the first circle gauge name
circle_gauge1.Name = "myCircleGauge1"
# ...
# Save world_shape together with its daughters
world_shape.Save("myWorldShape.gge", True)