7 #include "PlusConfigure.h" 8 #include "igtl_header.h" 12 #include "vtkIGSIOTransformRepository.h" 18 static const std::string GET_TRANSFORM_CMD =
"GetTransform";
34 this->SetName(GET_TRANSFORM_CMD);
41 cmdNames.push_back(GET_TRANSFORM_CMD);
48 if (commandName.empty() || igsioCommon::IsEqualInsensitive(commandName, GET_TRANSFORM_CMD))
50 desc += GET_TRANSFORM_CMD;
51 desc +=
": Retrieve the details of a transform in the remote transform repository.";
89 LOG_INFO(
"vtkPlusGetTransformCommand::Execute:");
91 std::string baseMessageString = std::string(
"GetTransform (") + (!this->GetTransformName().empty() ? this->GetTransformName() :
"undefined") +
")";
92 std::string warningString;
100 igsioTransformName aName;
101 aName.SetTransformName(this->GetTransformName());
111 vtkSmartPointer<vtkMatrix4x4>
value = vtkSmartPointer<vtkMatrix4x4>::New();
117 std::ostringstream errorStringStream;
118 errorStringStream << error;
120 std::ostringstream valueStringStream;
123 valueStringStream <<
"<name=\"" << aName.GetTransformName() <<
"\" value=\"";
125 for (
int i = 0;
i < 4; ++
i)
127 for (
int j = 0; j < 4; ++j)
129 valueStringStream <<
value->GetElement(
i, j);
132 valueStringStream <<
" ";
138 valueStringStream <<
"\" persistent=\"" << (persistent ?
"true" :
"false") <<
"\" date=\"" <<
date <<
"\" error=\"" << error <<
"\"/>";
143 igtl::MessageBase::MetaDataMap parameters;
144 parameters[aName.GetTransformName()] = std::pair<IANA_ENCODING_TYPE, std::string>(IANA_TYPE_US_ASCII, valueStringStream.str());
145 parameters[
"persistent"] = std::pair<IANA_ENCODING_TYPE, std::string>(IANA_TYPE_US_ASCII, persistent ?
"true" :
"false");
146 parameters[
"date"] = std::pair<IANA_ENCODING_TYPE, std::string>(IANA_TYPE_US_ASCII,
date);
147 parameters[
"error"] = std::pair<IANA_ENCODING_TYPE, std::string>(IANA_TYPE_US_ASCII, errorStringStream.str());
virtual void PrintSelf(ostream &os, vtkIndent indent)
virtual PlusStatus WriteConfiguration(vtkXMLDataElement *aConfig)
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *aConfig)
virtual vtkIGSIOTransformRepository * GetTransformRepository()
bool RespondWithCommandMessage
void QueueCommandResponse(PlusStatus status, const std::string &message, const std::string &error="", const igtl::MessageBase::MetaDataMap *metaData=nullptr)
const char const char * value