TextRepresentation::TextRepresentation(const std::string name) : Representation(name)
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(TextRepresentation, std::shared_ptr<SurgSim::Framework::Asset>,
									  Font, getFont, setFont);

	// Enables the alternative use of the font file instead of the actual font object
	DecoderType decoder = std::bind(&TextRepresentation::loadFont, this,
									std::bind(&YAML::Node::as<std::string>, std::placeholders::_1));
	setDecoder("FontFileName", decoder);

	SetterType setter = std::bind(&TextRepresentation::loadFont, this,
								  std::bind(SurgSim::Framework::convert<std::string>, std::placeholders::_1));
	setSetter("FontFileName", setter);

	SURGSIM_ADD_SERIALIZABLE_PROPERTY(TextRepresentation, std::string, Text, getText, setText);

	SURGSIM_ADD_SERIALIZABLE_PROPERTY(TextRepresentation, double, FontSize, getFontSize, setFontSize);

	SURGSIM_ADD_SERIALIZABLE_PROPERTY(TextRepresentation, SurgSim::DataStructures::OptionalValue<double>,
									  MaximumWidth, getOptionalMaximumWidth, setOptionalMaximumWidth);

	SURGSIM_ADD_SERIALIZABLE_PROPERTY(SurgSim::Graphics::TextRepresentation, SurgSim::Math::Vector4d,
									  Color, getColor, setColor);

}
TransferPhysicsToGraphicsMeshBehavior::TransferPhysicsToGraphicsMeshBehavior(const std::string& name) :
	SurgSim::Framework::Behavior(name)
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(TransferPhysicsToGraphicsMeshBehavior,
									  std::shared_ptr<SurgSim::Framework::Component>, Source, getSource, setSource);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(TransferPhysicsToGraphicsMeshBehavior,
									  std::shared_ptr<SurgSim::Framework::Component>, Target, getTarget, setTarget);
}
TransferParticlesToPointCloudBehavior::TransferParticlesToPointCloudBehavior(const std::string& name) :
	SurgSim::Framework::Behavior(name)
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(TransferParticlesToPointCloudBehavior,
									  std::shared_ptr<SurgSim::Framework::Component>, Source, getSource, setSource);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(TransferParticlesToPointCloudBehavior,
									  std::shared_ptr<SurgSim::Framework::Component>, Target, getTarget, setTarget);
}
KeyboardTogglesComponentBehavior::KeyboardTogglesComponentBehavior(const std::string& name) :
	SurgSim::Framework::Behavior(name),
	m_keyPressedLastUpdate(false)
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(KeyboardTogglesComponentBehavior, std::shared_ptr<SurgSim::Framework::Component>,
									  InputComponent, getInputComponent, setInputComponent);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(KeyboardTogglesComponentBehavior, KeyboardRegistryType,
									  KeyboardRegistry, getKeyboardRegistry, setKeyboardRegistry);
}
Esempio n. 5
0
Representation::Representation(const std::string& name) :
	SurgSim::Framework::Representation(name)
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(Representation, std::vector<std::string>, GroupReferences,
									  getGroupReferences, setGroupReferences);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(Representation, bool, DrawAsWireFrame,
									  getDrawAsWireFrame, setDrawAsWireFrame);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(Representation, bool, GenerateTangents,
									  isGeneratingTangents, setGenerateTangents);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(Representation, std::string, MaterialReference,
									  getMaterialReference, setMaterialReference);

	addGroupReference(DefaultGroupName);
}
CurveRepresentation::CurveRepresentation(const std::string& name) : Representation(name)
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(CurveRepresentation, size_t, Subdivisions, getSubdivisions, setSubdivisions);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(CurveRepresentation, double, Tension, getTension, setTension);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(CurveRepresentation, Math::Vector4d, Color, getColor, setColor);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(CurveRepresentation, double, Width, getWidth, setWidth);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(CurveRepresentation, bool, AntiAliasing, isAntiAliasing, setAntiAliasing);

	// Provide a common entry point accepting VerticesPlain under the label "Vertices"
	// this can be used by behaviors to address this structure and the point cloud the same way
	auto converter = std::bind(SurgSim::Framework::convert<DataStructures::VerticesPlain>, std::placeholders::_1);
	auto functor = std::bind((void(CurveRepresentation::*)(const DataStructures::VerticesPlain&))
							 &CurveRepresentation::updateControlPoints, this, converter);

	setSetter("Vertices", functor);
}
CombiningOutputComponent::CombiningOutputComponent(const std::string& name) :
	SurgSim::Input::OutputComponent(name),
	m_combiner(DEFAULT_FUNCTOR)
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(CombiningOutputComponent,
		std::vector<std::shared_ptr<SurgSim::Framework::Component>>,
		Outputs, getOutputs, setOutputs);
}
Esempio n. 8
0
RecordPose::RecordPose(const std::string& name) :
	DeviceFilter(name),
	m_cumulativeTime(0),
	m_fileName("ReplayPoseDevice.txt")
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(RecordPose, std::string, FileName, getFileName, setFileName);
	m_timer.setMaxNumberOfFrames(1);
	m_timer.start();
}
KeyboardCallbackBehavior::KeyboardCallbackBehavior(const std::string& name) :
	Framework::Behavior(name),
	m_keyPressedLastUpdate(false),
	m_actionKey(Devices::NONE)
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(KeyboardCallbackBehavior, std::shared_ptr<SurgSim::Framework::Component>,
										InputComponent, getInputComponent, setInputComponent);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(KeyboardCallbackBehavior, int, ActionKey, getKey, registerKey);
}
OsgSkeletonRepresentation::OsgSkeletonRepresentation(const std::string& name) :
	Representation(name),
	OsgRepresentation(name),
	SkeletonRepresentation(name),
	m_logger(SurgSim::Framework::Logger::getLogger("Graphics/OsgSkeletonRepresentation")),
	m_bones(std::make_shared<std::map<std::string, BoneData>>())
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(OsgSkeletonRepresentation, std::string,
									  SkinningShaderFileName, getSkinningShaderFileName, setSkinningShaderFileName);
}
Esempio n. 11
0
OctreeShape::OctreeShape() :
	m_rootNode(std::make_shared<NodeType>())
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(
		SurgSim::Math::OctreeShape,
		std::shared_ptr<SurgSim::Framework::Asset>,
		Octree,
		getOctree,
		setOctree);

	SURGSIM_ADD_SETTER(OctreeShape, std::string, OctreeFileName, loadOctree);
}
Esempio n. 12
0
SamplingMetricBase::SamplingMetricBase(const std::string& name) :
	SurgSim::Framework::Behavior(name),
	m_logger(SurgSim::Framework::Logger::getLogger(name)),
	m_targetManagerType(SurgSim::Framework::MANAGER_TYPE_BEHAVIOR),
	m_elapsedTime(0.0),
	m_maxNumberOfMeasurements(54000)
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(SurgSim::Framework::SamplingMetricBase, size_t, MaxNumberOfMeasurements,
									  getMaxNumberOfMeasurements, setMaxNumberOfMeasurements);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(SurgSim::Framework::SamplingMetricBase, int, TargetManagerType,
									  getTargetManagerType, setTargetManagerType);
}
Esempio n. 13
0
Representation::Representation(const std::string& name) :
	SurgSim::Framework::Representation(name),
	m_collisionRepresentation(nullptr),
	m_gravity(0.0, -9.81, 0.0),
	m_numDof(0),
	m_isGravityEnabled(true),
	m_isDrivingSceneElementPose(true),
	m_logger(SurgSim::Framework::Logger::getLogger("Physics/Representation"))
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(Representation, size_t, NumDof, getNumDof, setNumDof);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(Representation, bool, IsGravityEnabled, isGravityEnabled, setIsGravityEnabled);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(Representation, bool, IsDrivingSceneElementPose,
									  isDrivingSceneElementPose, setIsDrivingSceneElementPose);
}
Esempio n. 14
0
OculusView::OculusView(const std::string& name) : OsgView(name)
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(OculusView, std::shared_ptr<SurgSim::Framework::Component>, InputComponent,
									  getInputComponent, setInputComponent);

	// Default Settings of Oculus DK2
	setFullScreen(true);
	setDisplayType(View::DISPLAY_TYPE_HMD);
	setStereoMode(View::STEREO_MODE_HORIZONTAL_SPLIT);
	setScreenWidth(0.0631);
	setScreenHeight(0.071);
	setEyeSeparation(0.06);
	setScreenDistance(0.10);
	setTargetScreen(1); // Assume Oculus HMD has ID '1'.

	std::array<int, 2> dimensions = {1920, 1080};
	setDimensions(dimensions);
}
PointCloudRepresentation::PointCloudRepresentation(const std::string& name) : Representation(name)
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(PointCloudRepresentation, double, PointSize, getPointSize, setPointSize);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(PointCloudRepresentation, SurgSim::Math::Vector4d, Color, getColor, setColor);
}
Esempio n. 16
0
PoseComponent::PoseComponent(const std::string& name) : Component(name)
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(PoseComponent, SurgSim::Math::RigidTransform3d, Pose, getPose, setPose);
}