7 #include "PlusConfigure.h" 11 #include "vtkIGSIOTransformRepository.h" 18 static const std::string UPDATE_TRANSFORM_CMD =
"UpdateTransform";
23 : TransformValue(NULL)
24 , TransformPersistent(true)
25 , TransformError(-1.0)
38 this->SetName(UPDATE_TRANSFORM_CMD);
45 cmdNames.push_back(UPDATE_TRANSFORM_CMD);
52 if (commandName.empty() || igsioCommon::IsEqualInsensitive(commandName, UPDATE_TRANSFORM_CMD))
54 desc += UPDATE_TRANSFORM_CMD;
55 desc +=
": Update the details of a transform in the remote transform repository.";
73 XML_READ_STRING_ATTRIBUTE_OPTIONAL(TransformName, aConfig);
74 XML_READ_VECTOR_ATTRIBUTE_REQUIRED(
double, 16, TransformValue, aConfig);
75 XML_READ_BOOL_ATTRIBUTE_OPTIONAL(TransformPersistent, aConfig);
76 XML_READ_SCALAR_ATTRIBUTE_OPTIONAL(
double, TransformError, aConfig);
77 XML_READ_CSTRING_ATTRIBUTE_OPTIONAL(TransformDate, aConfig);
89 aConfig->SetAttribute(
"TransformName", this->GetTransformName().c_str());
93 double vectorMatrix[16] = {0};
95 aConfig->SetVectorAttribute(
"TransformValue", 16, vectorMatrix);
98 XML_WRITE_STRING_ATTRIBUTE_IF_NOT_EMPTY(TransformDate, aConfig);
105 XML_WRITE_BOOL_ATTRIBUTE(TransformPersistent, aConfig);
113 LOG_INFO(
"vtkPlusUpdateTransformCommand::Execute:");
115 std::string baseMessageString = std::string(
"UpdateTransform (") + (!this->GetTransformName().empty() ? this->GetTransformName() :
"undefined") +
")";
116 std::string warningString;
124 igsioTransformName aName;
125 aName.SetTransformName(this->GetTransformName());
129 bool persistent =
false;
133 warningString +=
" WARNING: replacing non-persistent transform with a persistent transform.";
137 if (this->TransformValue)
143 warningString +=
" WARNING: transform is not specified.";
148 if (!this->GetTransformDate().empty())
164 vtkSmartPointer<vtkMatrix4x4> matrix = vtkSmartPointer<vtkMatrix4x4>::New();
165 matrix->DeepCopy(matrixElements);
virtual void PrintSelf(ostream &os, vtkIndent indent)
virtual PlusStatus WriteConfiguration(vtkXMLDataElement *aConfig)
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *aConfig)
virtual vtkIGSIOTransformRepository * GetTransformRepository()
void QueueCommandResponse(PlusStatus status, const std::string &message, const std::string &error="", const igtl::MessageBase::MetaDataMap *metaData=nullptr)